2 ## Standard openssl configuration targets.
4 # Helper functions for the Windows configs
5 my $vc_win64a_info = {};
7 unless (%$vc_win64a_info) {
8 if (`nasm -v 2>NUL` =~ /NASM version ([0-9]+\.[0-9]+)/ && $1 >= 2.0) {
9 $vc_win64a_info = { AS => "nasm",
11 asflags => "-Ox -f win64 -DNEAR",
13 } elsif ($disabled{asm}) {
14 # assembler is still used to compile uplink shim
15 $vc_win64a_info = { AS => "ml64",
16 ASFLAGS => "/nologo /Zi",
17 asflags => "/c /Cp /Cx",
20 $die->("NASM not found - make sure it's installed and available on %PATH%\n");
21 $vc_win64a_info = { AS => "{unknown}",
27 return $vc_win64a_info;
30 my $vc_win32_info = {};
32 unless (%$vc_win32_info) {
33 my $ver=`nasm -v 2>NUL`;
34 my $vew=`nasmw -v 2>NUL`;
35 if ($ver ne "" || $vew ne "") {
36 $vc_win32_info = { AS => $ver ge $vew ? "nasm" : "nasmw",
38 asflags => "-f win32",
40 perlasm_scheme => "win32n" };
41 } elsif ($disabled{asm}) {
42 # not actually used, uplink shim is inlined into C code
43 $vc_win32_info = { AS => "ml",
44 ASFLAGS => "/nologo /Zi",
45 asflags => "/Cp /coff /c /Cx",
47 perlasm_scheme => "win32" };
49 $die->("NASM not found - make sure it's installed and available on %PATH%\n");
50 $vc_win32_info = { AS => "{unknown}",
54 perlasm_scheme => "win32" };
57 return $vc_win32_info;
60 my $vc_wince_info = {};
62 unless (%$vc_wince_info) {
64 $die->('%OSVERSION% is not defined') if (!defined(env('OSVERSION')));
65 $die->('%PLATFORM% is not defined') if (!defined(env('PLATFORM')));
66 $die->('%TARGETCPU% is not defined') if (!defined(env('TARGETCPU')));
69 # Idea behind this is to mimic flags set by eVC++ IDE...
71 my $wcevers = env('OSVERSION'); # WCENNN
74 if ($wcevers =~ /^WCE([1-9])([0-9]{2})$/) {
76 $wceverdotnum = "$1.$2";
78 $die->('%OSVERSION% value is insane');
79 $wcevernum = "{unknown}";
80 $wceverdotnum = "{unknown}";
82 my $wcecdefs = "-D_WIN32_WCE=$wcevernum -DUNDER_CE=$wcevernum"; # -D_WIN32_WCE=NNN
83 my $wcelflag = "/subsystem:windowsce,$wceverdotnum"; # ...,N.NN
85 my $wceplatf = env('PLATFORM');
87 $wceplatf =~ tr/a-z0-9 /A-Z0-9_/;
88 $wcecdefs .= " -DWCE_PLATFORM_$wceplatf";
90 my $wcetgt = env('TARGETCPU'); # just shorter name...
91 SWITCH: for($wcetgt) {
92 /^X86/ && do { $wcecdefs.=" -Dx86 -D_X86_ -D_i386_ -Di_386_";
93 $wcelflag.=" /machine:X86"; last; };
94 /^ARMV4[IT]/ && do { $wcecdefs.=" -DARM -D_ARM_ -D$wcetgt";
95 $wcecdefs.=" -DTHUMB -D_THUMB_" if($wcetgt=~/T$/);
96 $wcecdefs.=" -QRarch4T -QRinterwork-return";
97 $wcelflag.=" /machine:THUMB"; last; };
98 /^ARM/ && do { $wcecdefs.=" -DARM -D_ARM_ -D$wcetgt";
99 $wcelflag.=" /machine:ARM"; last; };
100 /^MIPSIV/ && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000 -D$wcetgt";
101 $wcecdefs.=" -D_MIPS64 -QMmips4 -QMn32";
102 $wcelflag.=" /machine:MIPSFPU"; last; };
103 /^MIPS16/ && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000 -D$wcetgt";
104 $wcecdefs.=" -DMIPSII -QMmips16";
105 $wcelflag.=" /machine:MIPS16"; last; };
106 /^MIPSII/ && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000 -D$wcetgt";
107 $wcecdefs.=" -QMmips2";
108 $wcelflag.=" /machine:MIPS"; last; };
109 /^R4[0-9]{3}/ && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000";
110 $wcelflag.=" /machine:MIPS"; last; };
111 /^SH[0-9]/ && do { $wcecdefs.=" -D$wcetgt -D_${wcetgt}_ -DSHx";
112 $wcecdefs.=" -Qsh4" if ($wcetgt =~ /^SH4/);
113 $wcelflag.=" /machine:$wcetgt"; last; };
114 { $wcecdefs.=" -D$wcetgt -D_${wcetgt}_";
115 $wcelflag.=" /machine:$wcetgt"; last; };
118 $vc_wince_info = { cppflags => $wcecdefs,
119 lflags => $wcelflag };
121 return $vc_wince_info;
124 # Helper functions for the VMS configs
127 my $pointer_size_str = $config{target} =~ m|-p(\d+)$| ? $1 : "";
129 # For the case where Configure iterate through all config targets, such
130 # as when listing them and their details, we reset info if the pointer
132 if (%$vms_info && $vms_info->{pointer_size} ne $pointer_size_str) {
136 unless (%$vms_info) {
137 $vms_info->{disable_warns} = [ ];
138 $vms_info->{pointer_size} = $pointer_size_str;
139 if ($pointer_size_str eq "64") {
140 `PIPE CC /NOCROSS_REFERENCE /NOLIST /NOOBJECT /WARNINGS = DISABLE = ( MAYLOSEDATA3, EMPTYFILE ) NL: 2> NL:`;
142 push @{$vms_info->{disable_warns}}, "MAYLOSEDATA3";
146 unless ($disabled{zlib}) {
147 my $default_zlib = 'GNV$LIBZSHR' . $pointer_size_str;
148 if (defined($disabled{"zlib-dynamic"})) {
149 $vms_info->{zlib} = $withargs{zlib_lib} || "$default_zlib/SHARE";
151 $vms_info->{def_zlib} = $withargs{zlib_lib} || $default_zlib;
152 # In case the --with-zlib-lib value contains something like
153 # /SHARE or /LIB or so at the end, remove it.
154 $vms_info->{def_zlib} =~ s|/.*$||g;
158 if ($config{target} =~ /-ia64/) {
159 `PIPE ias -H 2> NL:`;
161 $vms_info->{AS} = "ias";
162 $vms_info->{ASFLAGS} = '-d debug';
163 $vms_info->{asflags} = '"-N" vms_upcase';
164 $vms_info->{asoutflag} = "-o ";
165 $vms_info->{perlasm_scheme} = "ias";
174 #### Basic configs that should work on any 32-bit box
176 inherit_from => [ "BASE_unix" ],
178 CFLAGS => picker(debug => "-O0 -g",
180 thread_scheme => "(unknown)",
181 bn_ops => "BN_LLONG",
184 inherit_from => [ "BASE_unix" ],
187 thread_scheme => "(unknown)",
190 #### VOS Configurations
192 inherit_from => [ "BASE_unix" ],
194 CFLAGS => picker(default => "-Wall",
197 cppflags => "-D_POSIX_C_SOURCE=200112L -D_BSD -D_VOS_EXTENDED_NAMES",
198 lib_cppflags => "-DB_ENDIAN",
199 thread_scheme => "(unknown)",
201 lflags => add("-Wl,-map"),
202 bn_ops => "BN_LLONG",
203 shared_extension => ".so",
206 #### Solaris configurations
207 "solaris-common" => {
208 inherit_from => [ "BASE_unix" ],
210 lib_cppflags => "-DFILIO_H",
211 ex_libs => add("-lsocket -lnsl -ldl"),
212 dso_scheme => "dlfcn",
213 thread_scheme => "pthreads",
214 shared_target => "solaris",
215 shared_ldflag => "-Wl,-Bsymbolic",
216 shared_defflag => "-Wl,-M,",
217 shared_sonameflag=> "-Wl,-h,",
219 #### Solaris x86 with GNU C setups
220 "solaris-x86-gcc" => {
221 # NB. GNU C has to be configured to use GNU assembler, and not
222 # /usr/ccs/bin/as. Failure to comply will result in compile
223 # failures [at least] in 32-bit build.
224 inherit_from => [ "solaris-common", asm("x86_elf_asm") ],
226 CFLAGS => add_before(picker(default => "-Wall",
228 release => "-O3 -fomit-frame-pointer")),
229 cflags => add(threads("-pthread")),
230 lib_cppflags => add("-DL_ENDIAN"),
231 ex_libs => add(threads("-pthread")),
232 bn_ops => "BN_LLONG",
233 shared_cflag => "-fPIC",
234 shared_ldflag => add_before("-shared -static-libgcc"),
236 "solaris64-x86_64-gcc" => {
237 # -shared -static-libgcc might appear controversial, but modules
238 # taken from static libgcc do not have relocations and linking
239 # them into our shared objects doesn't have any negative side
240 # effects. On the contrary, doing so makes it possible to use
241 # gcc shared build with Sun C. Given that gcc generates faster
242 # code [thanks to inline assembler], I would actually recommend
243 # to consider using gcc shared build even with vendor compiler:-)
244 # -- <appro@openssl.org>
245 inherit_from => [ "solaris-common", asm("x86_64_asm") ],
247 CFLAGS => add_before(picker(default => "-Wall",
250 cflags => add_before("-m64", threads("-pthread")),
251 lib_cppflags => add("-DL_ENDIAN"),
252 ex_libs => add(threads("-pthread")),
253 bn_ops => "SIXTY_FOUR_BIT_LONG",
254 perlasm_scheme => "elf",
255 shared_cflag => "-fPIC",
256 shared_ldflag => add_before("-shared -static-libgcc"),
260 #### Solaris x86 with Sun C setups
261 # There used to be solaris-x86-cc target, but it was removed,
262 # primarily because vendor assembler can't assemble our modules
263 # with -KPIC flag. As result it, assembly support, was not even
264 # available as option. But its lack means lack of side-channel
265 # resistant code, which is incompatible with security by todays
266 # standards. Fortunately gcc is readily available prepackaged
267 # option, which we can firmly point at...
269 # On related note, solaris64-x86_64-cc target won't compile code
270 # paths utilizing AVX and post-Haswell instruction extensions.
271 # Consider switching to solaris64-x86_64-gcc even here...
273 "solaris64-x86_64-cc" => {
274 inherit_from => [ "solaris-common", asm("x86_64_asm") ],
276 CFLAGS => add_before(picker(debug => "-g",
277 release => "-xO5 -xdepend -xbuiltin")),
278 cflags => add_before("-xarch=generic64 -xstrconst -Xa"),
279 cppflags => add(threads("-D_REENTRANT")),
280 lib_cppflags => add("-DL_ENDIAN"),
281 thread_scheme => "pthreads",
282 lflags => add(threads("-mt")),
283 ex_libs => add(threads("-lpthread")),
284 bn_ops => "SIXTY_FOUR_BIT_LONG",
285 perlasm_scheme => "elf",
286 shared_cflag => "-KPIC",
287 shared_ldflag => add_before("-G -dy -z text"),
291 #### SPARC Solaris with GNU C setups
292 "solaris-sparcv7-gcc" => {
293 inherit_from => [ "solaris-common" ],
295 CFLAGS => add_before(picker(default => "-Wall",
298 cflags => add(threads("-pthread")),
299 lib_cppflags => add("-DB_ENDIAN -DBN_DIV2W"),
300 ex_libs => add(threads("-pthread")),
301 bn_ops => "BN_LLONG RC4_CHAR",
302 shared_cflag => "-fPIC",
303 shared_ldflag => add_before("-shared"),
305 "solaris-sparcv8-gcc" => {
306 inherit_from => [ "solaris-sparcv7-gcc", asm("sparcv8_asm") ],
307 cflags => add_before("-mcpu=v8"),
309 "solaris-sparcv9-gcc" => {
310 # -m32 should be safe to add as long as driver recognizes
312 inherit_from => [ "solaris-sparcv7-gcc", asm("sparcv9_asm") ],
313 cflags => add_before("-m32 -mcpu=ultrasparc"),
315 "solaris64-sparcv9-gcc" => {
316 inherit_from => [ "solaris-sparcv9-gcc" ],
317 cflags => sub { my $f=join(" ",@_); $f =~ s/\-m32/-m64/; $f; },
318 bn_ops => "BN_LLONG RC4_CHAR",
322 #### SPARC Solaris with Sun C setups
323 # SC4.0 doesn't pass 'make test', upgrade to SC5.0 or SC4.2.
324 # SC4.2 is ok, better than gcc even on bn as long as you tell it -xarch=v8
325 # SC5.0 note: Compiler common patch 107357-01 or later is required!
326 "solaris-sparcv7-cc" => {
327 inherit_from => [ "solaris-common" ],
329 CFLAGS => add_before(picker(debug => "-g",
330 release => "-xO5 -xdepend")),
331 cflags => add_before("-xstrconst -Xa"),
332 cppflags => add(threads("-D_REENTRANT")),
333 lib_cppflags => add("-DB_ENDIAN -DBN_DIV2W"),
334 lflags => add(threads("-mt")),
335 ex_libs => add(threads("-lpthread")),
336 bn_ops => "BN_LLONG RC4_CHAR",
337 shared_cflag => "-KPIC",
338 shared_ldflag => add_before("-G -dy -z text"),
341 "solaris-sparcv8-cc" => {
342 inherit_from => [ "solaris-sparcv7-cc", asm("sparcv8_asm") ],
343 cflags => add_before("-xarch=v8"),
345 "solaris-sparcv9-cc" => {
346 inherit_from => [ "solaris-sparcv7-cc", asm("sparcv9_asm") ],
347 cflags => add_before("-xarch=v8plus"),
349 "solaris64-sparcv9-cc" => {
350 inherit_from => [ "solaris-sparcv7-cc", asm("sparcv9_asm") ],
351 cflags => add_before("-xarch=v9"),
352 bn_ops => "BN_LLONG RC4_CHAR",
356 #### IRIX 6.x configs
357 # Only N32 and N64 ABIs are supported.
359 inherit_from => [ "BASE_unix" ],
361 cppflags => threads("-D_SGI_MP_SOURCE"),
362 lib_cppflags => "-DB_ENDIAN",
363 ex_libs => add(threads("-lpthread")),
364 thread_scheme => "pthreads",
365 dso_scheme => "dlfcn",
366 shared_target => "self",
367 shared_ldflag => "-shared -Wl,-Bsymbolic",
368 shared_sonameflag=> "-Wl,-soname,",
370 "irix-mips3-gcc" => {
371 inherit_from => [ "irix-common", asm("mips64_asm") ],
373 CFLAGS => picker(debug => "-g -O0",
375 LDFLAGS => "-static-libgcc",
376 cflags => "-mabi=n32",
377 bn_ops => "RC4_CHAR SIXTY_FOUR_BIT",
378 perlasm_scheme => "n32",
382 inherit_from => [ "irix-common", asm("mips64_asm") ],
384 CFLAGS => picker(debug => "-g -O0",
386 cflags => "-n32 -mips3 -use_readonly_const -G0 -rdata_shared",
387 bn_ops => "RC4_CHAR SIXTY_FOUR_BIT",
388 perlasm_scheme => "n32",
392 "irix64-mips4-gcc" => {
393 inherit_from => [ "irix-common", asm("mips64_asm") ],
395 CFLAGS => picker(debug => "-g -O0",
397 LDFLAGS => "-static-libgcc",
398 cflags => "-mabi=64 -mips4",
399 bn_ops => "RC4_CHAR SIXTY_FOUR_BIT_LONG",
400 perlasm_scheme => "64",
403 "irix64-mips4-cc" => {
404 inherit_from => [ "irix-common", asm("mips64_asm") ],
406 CFLAGS => picker(debug => "-g -O0",
408 cflags => "-64 -mips4 -use_readonly_const -G0 -rdata_shared",
409 bn_ops => "RC4_CHAR SIXTY_FOUR_BIT_LONG",
410 perlasm_scheme => "64",
414 #### Unified HP-UX ANSI C configs.
416 # - Originally we were optimizing at +O4 level. It should be noted
417 # that the only difference between +O3 and +O4 is global inter-
418 # procedural analysis. As it has to be performed during the link
419 # stage the compiler leaves behind certain pseudo-code in lib*.a
420 # which might be release or even patch level specific. Generating
421 # the machine code for and analyzing the *whole* program appears
422 # to be *extremely* memory demanding while the performance gain is
423 # actually questionable. The situation is intensified by the default
424 # HP-UX data set size limit (infamous 'maxdsiz' tunable) of 64MB
425 # which is way too low for +O4. In other words, doesn't +O3 make
427 # - Keep in mind that the HP compiler by default generates code
428 # suitable for execution on the host you're currently compiling at.
429 # If the toolkit is meant to be used on various PA-RISC processors
430 # consider './Configure hpux-parisc-[g]cc +DAportable'.
431 # - -DMD32_XARRAY triggers workaround for compiler bug we ran into in
432 # 32-bit message digests. (For the moment of this writing) HP C
433 # doesn't seem to "digest" too many local variables (they make "him"
434 # chew forever:-). For more details look-up MD32_XARRAY comment in
435 # crypto/sha/sha_lcl.h.
436 # - originally there were 32-bit hpux-parisc2-* targets. They were
437 # scrapped, because a) they were not interchangeable with other 32-bit
438 # targets; b) performance-critical 32-bit assembly modules implement
439 # even PA-RISC 2.0-specific code paths, which are chosen at run-time,
440 # thus adequate performance is provided even with PA-RISC 1.1 build.
442 inherit_from => [ "BASE_unix" ],
444 defines => add("_XOPEN_SOURCE", "_XOPEN_SOURCE_EXTENDED",
445 "_HPUX_ALT_XOPEN_SOCKET_API"),
446 lib_cppflags => "-DB_ENDIAN",
447 thread_scheme => "pthreads",
448 dso_scheme => "dlfcn", # overridden in 32-bit PA-RISC builds
449 shared_target => "self",
450 bin_lflags => "-Wl,+s,+cdp,../:,+cdp,./:",
451 shared_ldflag => "-Wl,-B,symbolic,+vnocompatwarnings,-z,+s,+cdp,../:,+cdp,./:",
452 shared_sonameflag=> "-Wl,+h,",
454 "hpux-parisc-gcc" => {
455 inherit_from => [ "hpux-common" ],
457 CFLAGS => picker(debug => "-O0 -g",
459 cflags => add(threads("-pthread")),
460 lib_cppflags => add("-DBN_DIV2W"),
461 ex_libs => add("-ldld", threads("-pthread")),
462 bn_ops => "BN_LLONG RC4_CHAR",
464 shared_cflag => "-fPIC",
465 shared_ldflag => add_before("-shared"),
466 shared_extension => ".sl.\$(SHLIB_VERSION_NUMBER)",
468 "hpux-parisc1_1-gcc" => {
469 inherit_from => [ "hpux-parisc-gcc", asm("parisc11_asm") ],
470 multilib => "/pa1.1",
472 "hpux64-parisc2-gcc" => {
473 inherit_from => [ "hpux-common", asm("parisc20_64_asm") ],
475 CFLAGS => combine(picker(debug => "-O0 -g",
477 cflags => add(threads("-pthread")),
478 ex_libs => add("-ldl", threads("-pthread")),
479 bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
480 shared_cflag => "-fpic",
481 shared_ldflag => add_before("-shared"),
482 shared_extension => ".sl.\$(SHLIB_VERSION_NUMBER)",
483 multilib => "/pa20_64",
486 # More attempts at unified 10.X and 11.X targets for HP C compiler.
487 "hpux-parisc-cc" => {
488 inherit_from => [ "hpux-common" ],
490 CFLAGS => picker(debug => "+O0 +d -g",
492 cflags => "+Optrs_strongly_typed -Ae +ESlit",
493 cppflags => threads("-D_REENTRANT"),
494 lib_cppflags => add("-DBN_DIV2W -DMD32_XARRAY"),
495 ex_libs => add("-ldld", threads("-lpthread")),
496 bn_ops => "RC4_CHAR",
498 shared_cflag => "+Z",
499 shared_ldflag => add_before("-b"),
500 shared_extension => ".sl.\$(SHLIB_VERSION_NUMBER)",
502 "hpux-parisc1_1-cc" => {
503 inherit_from => [ "hpux-parisc-cc", asm("parisc11_asm") ],
504 cflags => add_before("+DA1.1"),
505 multilib => "/pa1.1",
507 "hpux64-parisc2-cc" => {
508 inherit_from => [ "hpux-common", asm("parisc20_64_asm") ],
510 CFLAGS => picker(debug => "+O0 +d -g",
512 cflags => "+DD64 +Optrs_strongly_typed -Ae +ESlit",
513 cppflags => threads("-D_REENTRANT") ,
514 lib_cppflags => add("-DMD32_XARRAY"),
515 ex_libs => add("-ldl", threads("-lpthread")),
516 bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
517 shared_cflag => "+Z",
518 shared_ldflag => add_before("-b"),
519 shared_extension => ".sl.\$(SHLIB_VERSION_NUMBER)",
520 multilib => "/pa20_64",
523 # HP/UX IA-64 targets
525 inherit_from => [ "hpux-common", asm("ia64_asm") ],
527 CFLAGS => picker(debug => "+O0 +d -g",
529 cflags => "-Ae +DD32 +Olit=all -z",
530 cppflags => add(threads("-D_REENTRANT")),
531 ex_libs => add("-ldl", threads("-lpthread")),
532 bn_ops => "SIXTY_FOUR_BIT",
533 shared_cflag => "+Z",
534 shared_ldflag => add_before("-b"),
535 multilib => "/hpux32",
537 "hpux64-ia64-cc" => {
538 inherit_from => [ "hpux-common", asm("ia64_asm") ],
540 CFLAGS => picker(debug => "+O0 +d -g",
542 cflags => "-Ae +DD64 +Olit=all -z",
543 cppflags => threads("-D_REENTRANT"),
544 ex_libs => add("-ldl", threads("-lpthread")),
545 bn_ops => "SIXTY_FOUR_BIT_LONG",
546 shared_cflag => "+Z",
547 shared_ldflag => add_before("-b"),
548 multilib => "/hpux64",
552 inherit_from => [ "hpux-common", asm("ia64_asm") ],
554 CFLAGS => picker(debug => "-O0 -g",
556 cflags => add(threads("-pthread")),
557 ex_libs => add("-ldl", threads("-pthread")),
558 bn_ops => "SIXTY_FOUR_BIT",
559 shared_cflag => "-fpic",
560 shared_ldflag => add_before("-shared"),
561 multilib => "/hpux32",
563 "hpux64-ia64-gcc" => {
564 inherit_from => [ "hpux-common", asm("ia64_asm") ],
566 CFLAGS => picker(debug => "-O0 -g",
568 cflags => combine("-mlp64", threads("-pthread")),
569 ex_libs => add("-ldl", threads("-pthread")),
570 bn_ops => "SIXTY_FOUR_BIT_LONG",
571 shared_cflag => "-fpic",
572 shared_ldflag => add_before("-shared"),
573 multilib => "/hpux64",
576 #### HP MPE/iX http://jazz.external.hp.com/src/openssl/
578 inherit_from => [ "BASE_unix" ],
581 cppflags => "-D_POSIX_SOURCE -D_SOCKET_SOURCE",
582 includes => [ "/SYSLOG/PUB" ],
583 lib_cppflags => "-DBN_DIV2W",
585 lflags => add("-L/SYSLOG/PUB"),
586 ex_libs => add("-lsyslog -lsocket -lcurses"),
587 thread_scheme => "(unknown)",
588 bn_ops => "BN_LLONG",
591 #### DEC Alpha Tru64 targets. Tru64 is marketing name for OSF/1 version 4
592 #### and forward. In reality 'uname -s' still returns "OSF1". Originally
593 #### there were even osf1-* configs targeting prior versions provided,
594 #### but not anymore...
595 "tru64-alpha-gcc" => {
596 inherit_from => [ "BASE_unix", asm("alpha_asm") ],
599 cflags => add("-std=c9x", threads("-pthread")),
600 cppflags => "-D_XOPEN_SOURCE=500 -D_OSF_SOURCE",
601 ex_libs => add("-lrt", threads("-pthread")), # for mlock(2)
602 bn_ops => "SIXTY_FOUR_BIT_LONG",
603 thread_scheme => "pthreads",
604 dso_scheme => "dlfcn",
605 shared_target => "alpha-osf1-shared",
606 shared_extension => ".so",
608 "tru64-alpha-cc" => {
609 inherit_from => [ "BASE_unix", asm("alpha_asm") ],
611 CFLAGS => "-tune host -fast",
612 cflags => add("-std1 -readonly_strings",
613 threads("-pthread")),
614 cppflags => "-D_XOPEN_SOURCE=500 -D_OSF_SOURCE",
615 ex_libs => add("-lrt", threads("-pthread")), # for mlock(2)
616 bn_ops => "SIXTY_FOUR_BIT_LONG",
617 thread_scheme => "pthreads",
618 dso_scheme => "dlfcn",
619 shared_target => "alpha-osf1-shared",
620 shared_ldflag => "-msym",
621 shared_extension => ".so",
625 #### Variety of LINUX:-)
627 # *-generic* is endian-neutral target, but ./config is free to
628 # throw in -D[BL]_ENDIAN, whichever appropriate...
629 "linux-generic32" => {
630 inherit_from => [ "BASE_unix" ],
633 CFLAGS => picker(default => "-Wall",
636 CXXFLAGS => picker(default => "-Wall",
639 cflags => threads("-pthread"),
640 cxxflags => combine("-std=c++11", threads("-pthread")),
641 lib_cppflags => "-DOPENSSL_USE_NODELETE",
642 ex_libs => add("-ldl", threads("-pthread")),
643 bn_ops => "BN_LLONG RC4_CHAR",
644 thread_scheme => "pthreads",
645 dso_scheme => "dlfcn",
646 shared_target => "linux-shared",
647 shared_cflag => "-fPIC",
648 shared_ldflag => sub { $disabled{pinshared} ? () : "-Wl,-znodelete" },
649 enable => [ "afalgeng" ],
651 "linux-generic64" => {
652 inherit_from => [ "linux-generic32" ],
653 bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
657 inherit_from => [ "linux-generic32", asm("ppc32_asm") ],
658 perlasm_scheme => "linux32",
661 inherit_from => [ "linux-generic64", asm("ppc64_asm") ],
662 cflags => add("-m64"),
663 cxxflags => add("-m64"),
664 lib_cppflags => add("-DB_ENDIAN"),
665 perlasm_scheme => "linux64",
669 inherit_from => [ "linux-generic64", asm("ppc64_asm") ],
670 cflags => add("-m64"),
671 cxxflags => add("-m64"),
672 lib_cppflags => add("-DL_ENDIAN"),
673 perlasm_scheme => "linux64le",
677 ################################################################
678 # Note that -march is not among compiler options in linux-armv4
679 # target description. Not specifying one is intentional to give
682 # a) rely on your compiler default by not specifying one;
683 # b) specify your target platform explicitly for optimal
684 # performance, e.g. -march=armv6 or -march=armv7-a;
685 # c) build "universal" binary that targets *range* of platforms
686 # by specifying minimum and maximum supported architecture;
688 # As for c) option. It actually makes no sense to specify
689 # maximum to be less than ARMv7, because it's the least
690 # requirement for run-time switch between platform-specific
691 # code paths. And without run-time switch performance would be
692 # equivalent to one for minimum. Secondly, there are some
693 # natural limitations that you'd have to accept and respect.
694 # Most notably you can *not* build "universal" binary for
695 # big-endian platform. This is because ARMv7 processor always
696 # picks instructions in little-endian order. Another similar
697 # limitation is that -mthumb can't "cross" -march=armv6t2
698 # boundary, because that's where it became Thumb-2. Well, this
699 # limitation is a bit artificial, because it's not really
700 # impossible, but it's deemed too tricky to support. And of
701 # course you have to be sure that your binutils are actually
702 # up to the task of handling maximum target platform. With all
703 # this in mind here is an example of how to configure
706 # ./Configure linux-armv4 -march=armv6 -D__ARM_MAX_ARCH__=8
708 inherit_from => [ "linux-generic32", asm("armv4_asm") ],
709 perlasm_scheme => "linux32",
712 inherit_from => [ "linux-generic64", asm("aarch64_asm") ],
713 perlasm_scheme => "linux64",
715 "linux-arm64ilp32" => { # https://wiki.linaro.org/Platform/arm64-ilp32
716 inherit_from => [ "linux-generic32", asm("aarch64_asm") ],
717 cflags => add("-mabi=ilp32"),
718 cxxflags => add("-mabi=ilp32"),
719 bn_ops => "SIXTY_FOUR_BIT RC4_CHAR",
720 perlasm_scheme => "linux64",
724 # Configure script adds minimally required -march for assembly
725 # support, if no -march was specified at command line.
726 inherit_from => [ "linux-generic32", asm("mips32_asm") ],
727 cflags => add("-mabi=32"),
728 cxxflags => add("-mabi=32"),
729 perlasm_scheme => "o32",
731 # mips32 and mips64 below refer to contemporary MIPS Architecture
732 # specifications, MIPS32 and MIPS64, rather than to kernel bitness.
734 inherit_from => [ "linux-generic32", asm("mips64_asm") ],
735 cflags => add("-mabi=n32"),
736 cxxflags => add("-mabi=n32"),
737 bn_ops => "SIXTY_FOUR_BIT RC4_CHAR",
738 perlasm_scheme => "n32",
741 "linux64-mips64" => {
742 inherit_from => [ "linux-generic64", asm("mips64_asm") ],
743 cflags => add("-mabi=64"),
744 cxxflags => add("-mabi=64"),
745 perlasm_scheme => "64",
749 #### IA-32 targets...
750 #### These two targets are a bit aged and are to be used on older Linux
751 #### machines where gcc doesn't understand -m32 and -m64
753 inherit_from => [ "linux-generic32", asm("x86_elf_asm") ],
754 CFLAGS => add(picker(release => "-fomit-frame-pointer")),
755 lib_cppflags => add("-DL_ENDIAN"),
756 bn_ops => "BN_LLONG",
759 inherit_from => [ "BASE_unix", asm("x86_asm") ],
761 CFLAGS => add(picker(default => "-Wall",
763 release => "-O3 -fomit-frame-pointer")),
764 lib_cppflags => add("-DL_ENDIAN"),
765 bn_ops => "BN_LLONG",
766 thread_scheme => "(unknown)",
767 perlasm_scheme => "a.out",
770 #### X86 / X86_64 targets
772 inherit_from => [ "linux-generic32", asm("x86_asm") ],
773 CFLAGS => add(picker(release => "-fomit-frame-pointer")),
774 cflags => add("-m32"),
775 cxxflags => add("-m32"),
776 lib_cppflags => add("-DL_ENDIAN"),
777 bn_ops => "BN_LLONG",
778 perlasm_scheme => "elf",
780 "linux-x86-clang" => {
781 inherit_from => [ "linux-x86" ],
786 inherit_from => [ "linux-generic64", asm("x86_64_asm") ],
787 cflags => add("-m64"),
788 cxxflags => add("-m64"),
789 lib_cppflags => add("-DL_ENDIAN"),
790 bn_ops => "SIXTY_FOUR_BIT_LONG",
791 perlasm_scheme => "elf",
794 "linux-x86_64-clang" => {
795 inherit_from => [ "linux-x86_64" ],
800 inherit_from => [ "linux-generic32", asm("x86_64_asm") ],
801 cflags => add("-mx32"),
802 cxxflags => add("-mx32"),
803 lib_cppflags => add("-DL_ENDIAN"),
804 bn_ops => "SIXTY_FOUR_BIT",
805 perlasm_scheme => "elf32",
810 inherit_from => [ "linux-generic64", asm("ia64_asm") ],
811 bn_ops => "SIXTY_FOUR_BIT_LONG",
815 inherit_from => [ "linux-generic64", asm("s390x_asm") ],
816 cflags => add("-m64"),
817 cxxflags => add("-m64"),
818 lib_cppflags => add("-DB_ENDIAN"),
819 perlasm_scheme => "64",
823 #### So called "highgprs" target for z/Architecture CPUs
824 # "Highgprs" is kernel feature first implemented in Linux
825 # 2.6.32, see /proc/cpuinfo. The idea is to preserve most
826 # significant bits of general purpose registers not only
827 # upon 32-bit process context switch, but even on
828 # asynchronous signal delivery to such process. This makes
829 # it possible to deploy 64-bit instructions even in legacy
830 # application context and achieve better [or should we say
831 # adequate] performance. The build is binary compatible with
832 # linux-generic32, and the idea is to be able to install the
833 # resulting libcrypto.so alongside generic one, e.g. as
834 # /lib/highgprs/libcrypto.so.x.y, for ldconfig and run-time
835 # linker to autodiscover. Unfortunately it doesn't work just
836 # yet, because of couple of bugs in glibc
837 # sysdeps/s390/dl-procinfo.c affecting ldconfig and ld.so.1...
839 inherit_from => [ "linux-generic32", asm("s390x_asm") ],
840 cflags => add("-m31 -Wa,-mzarch"),
841 cxxflags => add("-m31 -Wa,-mzarch"),
842 lib_cppflags => add("-DB_ENDIAN"),
843 bn_asm_src => sub { my $r=join(" ",@_); $r=~s|asm/s390x\.S|bn_asm.c|; $r; },
844 perlasm_scheme => "31",
845 multilib => "/highgprs",
848 #### SPARC Linux setups
850 inherit_from => [ "linux-generic32", asm("sparcv8_asm") ],
851 cflags => add("-mcpu=v8"),
852 cxxflags => add("-mcpu=v8"),
853 lib_cppflags => add("-DB_ENDIAN -DBN_DIV2W"),
856 # it's a real mess with -mcpu=ultrasparc option under Linux,
857 # but -Wa,-Av8plus should do the trick no matter what.
858 inherit_from => [ "linux-generic32", asm("sparcv9_asm") ],
859 cflags => add("-m32 -mcpu=ultrasparc -Wa,-Av8plus"),
860 cxxflags => add("-m32 -mcpu=ultrasparc -Wa,-Av8plus"),
861 lib_cppflags => add("-DB_ENDIAN -DBN_DIV2W"),
863 "linux64-sparcv9" => {
864 # GCC 3.1 is a requirement
865 inherit_from => [ "linux-generic64", asm("sparcv9_asm") ],
866 cflags => add("-m64 -mcpu=ultrasparc"),
867 cxxflags => add("-m64 -mcpu=ultrasparc"),
868 lib_cppflags => add("-DB_ENDIAN"),
869 bn_ops => "BN_LLONG RC4_CHAR",
873 "linux-alpha-gcc" => {
874 inherit_from => [ "linux-generic64", asm("alpha_asm") ],
875 lib_cppflags => add("-DL_ENDIAN"),
876 bn_ops => "SIXTY_FOUR_BIT_LONG",
878 "linux-c64xplus" => {
879 inherit_from => [ "BASE_unix" ],
880 # TI_CGT_C6000_7.3.x is a requirement
882 CFLAGS => "-o2 -ox -ms",
883 cflags => "--linux -ea=.s -eo=.o -mv6400+ -pden",
884 cxxflags => "--linux -ea=.s -eo=.o -mv6400+ -pden",
885 cppflags => combine("-DOPENSSL_SMALL_FOOTPRINT",
886 threads("-D_REENTRANT")),
887 bn_ops => "BN_LLONG",
888 cpuid_asm_src => "c64xpluscpuid.s",
889 bn_asm_src => "asm/bn-c64xplus.asm c64xplus-gf2m.s",
890 aes_asm_src => "aes-c64xplus.s aes_cbc.c aes-ctr.fake",
891 sha1_asm_src => "sha1-c64xplus.s sha256-c64xplus.s sha512-c64xplus.s",
892 rc4_asm_src => "rc4-c64xplus.s",
893 modes_asm_src => "ghash-c64xplus.s",
894 chacha_asm_src => "chacha-c64xplus.s",
895 poly1305_asm_src => "poly1305-c64xplus.s",
896 thread_scheme => "pthreads",
897 perlasm_scheme => "void",
898 dso_scheme => "dlfcn",
899 shared_target => "linux-shared",
900 shared_cflag => "--pic",
901 shared_ldflag => add("-z --sysv --shared"),
907 # As for thread cflag. Idea is to maintain "collective" set of
908 # flags, which would cover all BSD flavors. -pthread applies
909 # to them all, but is treated differently. OpenBSD expands is
910 # as -D_POSIX_THREAD -lc_r, which is sufficient. FreeBSD 4.x
911 # expands it as -lc_r, which has to be accompanied by explicit
912 # -D_THREAD_SAFE and sometimes -D_REENTRANT. FreeBSD 5.x
913 # expands it as -lc_r, which seems to be sufficient?
914 inherit_from => [ "BASE_unix" ],
916 CFLAGS => picker(default => "-Wall",
919 cflags => threads("-pthread"),
920 cppflags => threads("-D_THREAD_SAFE -D_REENTRANT"),
921 ex_libs => add(threads("-pthread")),
922 enable => add("devcryptoeng"),
923 bn_ops => "BN_LLONG",
924 thread_scheme => "pthreads",
925 dso_scheme => "dlfcn",
926 shared_target => "bsd-gcc-shared",
927 shared_cflag => "-fPIC",
930 inherit_from => [ "BSD-generic32" ],
931 bn_ops => "SIXTY_FOUR_BIT_LONG",
935 inherit_from => [ "BSD-generic32", asm("x86_asm") ],
936 CFLAGS => add(picker(release => "-fomit-frame-pointer")),
937 lib_cppflags => add("-DL_ENDIAN"),
938 bn_ops => "BN_LLONG",
939 shared_target => "bsd-shared",
940 perlasm_scheme => "a.out",
943 inherit_from => [ "BSD-x86" ],
944 perlasm_scheme => "elf",
948 inherit_from => [ "BSD-generic32", asm("sparcv8_asm") ],
949 cflags => add("-mcpu=v8"),
950 lib_cppflags => add("-DB_ENDIAN"),
953 # -DMD32_REG_T=int doesn't actually belong in sparc64 target, it
954 # simply *happens* to work around a compiler bug in gcc 3.3.3,
955 # triggered by RIPEMD160 code.
956 inherit_from => [ "BSD-generic64", asm("sparcv9_asm") ],
957 lib_cppflags => add("-DB_ENDIAN -DMD32_REG_T=int"),
958 bn_ops => "BN_LLONG",
962 inherit_from => [ "BSD-generic64", asm("ia64_asm") ],
963 lib_cppflags => add("-DL_ENDIAN"),
964 bn_ops => "SIXTY_FOUR_BIT_LONG",
968 inherit_from => [ "BSD-generic64", asm("x86_64_asm") ],
969 lib_cppflags => add("-DL_ENDIAN"),
970 bn_ops => "SIXTY_FOUR_BIT_LONG",
971 perlasm_scheme => "elf",
975 inherit_from => [ "BASE_unix", asm("x86_elf_asm") ],
977 CFLAGS => "-fomit-frame-pointer -O3 -Wall",
978 lib_cppflags => "-DPERL5 -DL_ENDIAN",
979 ex_libs => add("-ldl"),
980 bn_ops => "BN_LLONG",
981 thread_scheme => "(unknown)",
982 dso_scheme => "dlfcn",
983 shared_target => "bsd-gcc-shared",
984 shared_cflag => "-fPIC",
988 inherit_from => [ "BASE_unix" ],
990 CFLAGS => "-O -Wall",
991 unistd => "<libc.h>",
992 bn_ops => "BN_LLONG",
993 thread_scheme => "(unknown)",
996 inherit_from => [ "BASE_unix" ],
998 CFLAGS => "-O3 -Wall",
999 unistd => "<libc.h>",
1000 bn_ops => "BN_LLONG",
1001 thread_scheme => "(unknown)",
1004 #### SCO/Caldera targets.
1006 # Originally we had like unixware-*, unixware-*-pentium, unixware-*-p6, etc.
1007 # Now we only have blended unixware-* as it's the only one used by ./config.
1008 # If you want to optimize for particular microarchitecture, bypass ./config
1009 # and './Configure unixware-7 -Kpentium_pro' or whatever appropriate.
1010 # Note that not all targets include assembler support. Mostly because of
1011 # lack of motivation to support out-of-date platforms with out-of-date
1012 # compiler drivers and assemblers.
1014 # UnixWare 2.0x fails destest with -O.
1016 inherit_from => [ "BASE_unix" ],
1018 cflags => threads("-Kthread"),
1019 lib_cppflags => "-DFILIO_H -DNO_STRINGS_H",
1020 ex_libs => add("-lsocket -lnsl -lresolv -lx"),
1021 thread_scheme => "uithreads",
1024 inherit_from => [ "BASE_unix" ],
1027 cflags => threads("-Kthread"),
1028 lib_cppflags => "-DFILIO_H",
1029 ex_libs => add("-lsocket -lnsl -lresolv -lx"),
1030 thread_scheme => "uithreads",
1033 inherit_from => [ "BASE_unix", asm("x86_elf_asm") ],
1036 cflags => combine("-Kalloca", threads("-Kthread")),
1037 lib_cppflags => "-DFILIO_H",
1038 ex_libs => add("-lsocket -lnsl"),
1039 thread_scheme => "uithreads",
1040 bn_ops => "BN_LLONG",
1041 perlasm_scheme => "elf-1",
1042 dso_scheme => "dlfcn",
1043 shared_target => "svr5-shared",
1044 shared_cflag => "-Kpic",
1046 "unixware-7-gcc" => {
1047 inherit_from => [ "BASE_unix", asm("x86_elf_asm") ],
1049 CFLAGS => "-O3 -fomit-frame-pointer -Wall",
1050 cppflags => add(threads("-D_REENTRANT")),
1051 lib_cppflags => add("-DL_ENDIAN -DFILIO_H"),
1052 ex_libs => add("-lsocket -lnsl"),
1053 bn_ops => "BN_LLONG",
1054 thread_scheme => "pthreads",
1055 perlasm_scheme => "elf-1",
1056 dso_scheme => "dlfcn",
1057 shared_target => "gnu-shared",
1058 shared_cflag => "-fPIC",
1060 # SCO 5 - Ben Laurie says the -O breaks the SCO cc.
1062 inherit_from => [ "BASE_unix", asm("x86_elf_asm") ],
1065 ex_libs => add("-lsocket -lnsl"),
1066 thread_scheme => "(unknown)",
1067 perlasm_scheme => "elf-1",
1068 dso_scheme => "dlfcn",
1069 shared_target => "svr3-shared",
1070 shared_cflag => "-Kpic",
1073 inherit_from => [ "BASE_unix", asm("x86_elf_asm") ],
1075 cflags => "-O3 -fomit-frame-pointer",
1076 ex_libs => add("-lsocket -lnsl"),
1077 bn_ops => "BN_LLONG",
1078 thread_scheme => "(unknown)",
1079 perlasm_scheme => "elf-1",
1080 dso_scheme => "dlfcn",
1081 shared_target => "svr3-shared",
1082 shared_cflag => "-fPIC",
1086 # Below targets assume AIX >=5. Caveat lector. If you are accustomed
1087 # to control compilation "bitness" by setting $OBJECT_MODE environment
1088 # variable, then you should know that in OpenSSL case it's considered
1089 # only in ./config. Once configured, build procedure remains "deaf" to
1090 # current value of $OBJECT_MODE.
1092 inherit_from => [ "BASE_unix" ],
1095 lib_cppflags => "-DB_ENDIAN",
1096 lflags => "-Wl,-bsvr4",
1097 thread_scheme => "pthreads",
1098 dso_scheme => "dlfcn",
1099 shared_target => "aix",
1100 module_ldflags => "-Wl,-G,-bsymbolic,-bnoentry",
1101 shared_ldflag => "-Wl,-G,-bsymbolic,-bnoentry",
1102 shared_defflag => "-Wl,-bE:",
1103 perl_platform => 'AIX',
1106 inherit_from => [ "aix-common", asm("ppc32_asm") ],
1108 CFLAGS => picker(debug => "-O0 -g",
1110 cflags => add(threads("-pthread")),
1111 ex_libs => threads("-pthread"),
1112 bn_ops => "BN_LLONG RC4_CHAR",
1113 perlasm_scheme => "aix32",
1114 shared_ldflag => add_before("-shared -static-libgcc"),
1116 RANLIB => add("-X32"),
1119 inherit_from => [ "aix-common", asm("ppc64_asm") ],
1121 CFLAGS => picker(debug => "-O0 -g",
1123 cflags => combine("-maix64", threads("-pthread")),
1124 ex_libs => threads("-pthread"),
1125 bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
1126 perlasm_scheme => "aix64",
1127 shared_ldflag => add_before("-shared -static-libgcc"),
1128 shared_extension => "64.so.\$(SHLIB_VERSION_NUMBER)",
1130 RANLIB => add("-X64"),
1133 inherit_from => [ "aix-common", asm("ppc32_asm") ],
1135 CFLAGS => picker(debug => "-O0 -g",
1137 cflags => combine("-q32 -qmaxmem=16384 -qro -qroconst",
1138 threads("-qthreaded")),
1139 cppflags => threads("-D_THREAD_SAFE"),
1140 ex_libs => threads("-lpthreads"),
1141 bn_ops => "BN_LLONG RC4_CHAR",
1142 perlasm_scheme => "aix32",
1143 shared_cflag => "-qpic",
1145 RANLIB => add("-X32"),
1148 inherit_from => [ "aix-common", asm("ppc64_asm") ],
1150 CFLAGS => picker(debug => "-O0 -g",
1152 cflags => combine("-q64 -qmaxmem=16384 -qro -qroconst",
1153 threads("-qthreaded")),
1154 cppflags => threads("-D_THREAD_SAFE"),
1155 ex_libs => threads("-lpthreads"),
1156 bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
1157 perlasm_scheme => "aix64",
1158 dso_scheme => "dlfcn",
1159 shared_cflag => "-qpic",
1160 shared_extension => "64.so.\$(SHLIB_VERSION_NUMBER)",
1162 RANLIB => add("-X64"),
1165 # SIEMENS BS2000/OSD: an EBCDIC-based mainframe
1167 inherit_from => [ "BASE_unix" ],
1170 cflags => "-XLLML -XLLMK -XL",
1171 cppflags => "-DCHARSET_EBCDIC",
1172 lib_cppflags => "-DB_ENDIAN",
1173 ex_libs => add("-lsocket -lnsl"),
1174 bn_ops => "THIRTY_TWO_BIT RC4_CHAR",
1175 thread_scheme => "(unknown)",
1178 #### Visual C targets
1180 # Win64 targets, WIN64I denotes IA-64/Itanium and WIN64A - AMD64
1182 # Note about /wd4090, disable warning C4090. This warning returns false
1183 # positives in some situations. Disabling it altogether masks both
1184 # legitimate and false cases, but as we compile on multiple platforms,
1185 # we rely on other compilers to catch legitimate cases.
1187 # Also note that we force threads no matter what. Configuring "no-threads"
1190 # UNICODE is defined in VC-common and applies to all targets. It used to
1191 # be an opt-in option for VC-WIN32, but not anymore. The original reason
1192 # was because ANSI API was *native* system interface for no longer
1193 # supported Windows 9x. Keep in mind that UNICODE only affects how
1194 # OpenSSL libraries interact with underlying OS, it doesn't affect API
1195 # that OpenSSL presents to application.
1198 inherit_from => [ "BASE_Windows" ],
1201 CPP => '$(CC) /EP /C',
1202 CFLAGS => "/W3 /wd4090 /nologo",
1203 LDFLAGS => add("/debug"),
1205 defines => add("OPENSSL_SYS_WIN32", "WIN32_LEAN_AND_MEAN",
1206 "UNICODE", "_UNICODE",
1207 "_CRT_SECURE_NO_DEPRECATE",
1208 "_WINSOCK_DEPRECATED_NO_WARNINGS"),
1209 lib_cflags => add("/Zi /Fdossl_static.pdb"),
1210 lib_defines => add("L_ENDIAN"),
1211 dso_cflags => "/Zi /Fddso.pdb",
1212 bin_cflags => "/Zi /Fdapp.pdb",
1213 # def_flag made to empty string so a .def file gets generated
1214 shared_defflag => '',
1215 shared_ldflag => "/dll",
1216 shared_target => "win-shared", # meaningless except it gives Configure a hint
1217 thread_scheme => "winthreads",
1218 dso_scheme => "win32",
1219 apps_aux_src => add("win32_init.c"),
1220 bn_ops => "EXPORT_VAR_AS_FN",
1221 perl_platform => 'Windows::MSVC',
1222 # additional parameter to build_scheme denotes install-path "flavour"
1223 build_scheme => add("VC-common", { separator => undef }),
1225 "VC-noCE-common" => {
1226 inherit_from => [ "VC-common" ],
1228 CFLAGS => add(picker(debug => '/Od',
1230 cflags => add(picker(default => '/Gs0 /GF /Gy',
1233 ($disabled{shared} ? "" : "/MDd");
1237 ($disabled{shared} ? "" : "/MD");
1239 defines => add(picker(default => [], # works as type cast
1240 debug => [ "DEBUG", "_DEBUG" ])),
1241 lib_cflags => add(sub { $disabled{shared} ? "/MT /Zl" : () }),
1242 # Following might/should appears controversial, i.e. defining
1243 # /MDd without evaluating $disabled{shared}. It works in
1244 # non-shared build because static library is compiled with /Zl
1245 # and bares no reference to specific RTL. And it works in
1246 # shared build because multiple /MDd options are not prohibited.
1247 # But why /MDd in static build? Well, basically this is just a
1248 # reference point, which allows to catch eventual errors that
1249 # would prevent those who want to wrap OpenSSL into own .DLL.
1250 # Why not /MD in release build then? Well, some are likely to
1251 # prefer [non-debug] openssl.exe to be free from Micorosoft RTL
1253 bin_cflags => add(picker(debug => "/MDd",
1254 release => sub { $disabled{shared} ? "/MT" : () },
1256 bin_lflags => add("/subsystem:console /opt:ref"),
1257 ex_libs => add(sub {
1259 push @ex_libs, 'ws2_32.lib' unless $disabled{sock};
1260 push @ex_libs, 'gdi32.lib advapi32.lib crypt32.lib user32.lib';
1261 return join(" ", @ex_libs);
1264 "VC-WIN64-common" => {
1265 inherit_from => [ "VC-noCE-common" ],
1267 ex_libs => add(sub {
1269 push @ex_libs, 'bufferoverflowu.lib' if (`cl 2>&1` =~ /14\.00\.4[0-9]{4}\./);
1270 return join(" ", @_, @ex_libs);
1272 bn_ops => add("SIXTY_FOUR_BIT"),
1275 inherit_from => [ "VC-WIN64-common", asm("ia64_asm"),
1276 sub { $disabled{uplink} ? () : "ia64_uplink" } ],
1278 ASFLAGS => "-d debug",
1281 bn_asm_src => sub { return undef unless @_;
1282 my $r=join(" ",@_); $r=~s|bn-ia64.s|bn_asm.c|; $r; },
1283 perlasm_scheme => "ias",
1284 multilib => "-ia64",
1287 inherit_from => [ "VC-WIN64-common", asm("x86_64_asm"),
1288 sub { $disabled{uplink} ? () : "x86_64_uplink" } ],
1289 AS => sub { vc_win64a_info()->{AS} },
1290 ASFLAGS => sub { vc_win64a_info()->{ASFLAGS} },
1291 asoutflag => sub { vc_win64a_info()->{asoutflag} },
1292 asflags => sub { vc_win64a_info()->{asflags} },
1294 bn_asm_src => sub { return undef unless @_;
1295 my $r=join(" ",@_); $r=~s|asm/x86_64-gcc|bn_asm|; $r; },
1296 perlasm_scheme => "auto",
1300 inherit_from => [ "VC-noCE-common", asm("x86_asm"),
1301 sub { $disabled{uplink} ? () : "uplink_common" } ],
1302 CFLAGS => add("/WX"),
1303 AS => sub { vc_win32_info()->{AS} },
1304 ASFLAGS => sub { vc_win32_info()->{ASFLAGS} },
1305 asoutflag => sub { vc_win32_info()->{asoutflag} },
1306 asflags => sub { vc_win32_info()->{asflags} },
1308 bn_ops => add("BN_LLONG"),
1309 perlasm_scheme => sub { vc_win32_info()->{perlasm_scheme} },
1310 # "WOW" stands for "Windows on Windows", and "VC-WOW" engages
1311 # some installation path heuristics in windows-makefile.tmpl...
1312 build_scheme => add("VC-WOW", { separator => undef }),
1315 inherit_from => [ "VC-common" ],
1316 CFLAGS => add(picker(debug => "/Od",
1317 release => "/O1i")),
1318 CPPDEFINES => picker(debug => [ "DEBUG", "_DEBUG" ]),
1319 LDFLAGS => add("/nologo /opt:ref"),
1322 sub { vc_wince_info()->{cflags}; },
1323 sub { `cl 2>&1` =~ /Version ([0-9]+)\./ && $1>=14
1324 ? ($disabled{shared} ? " /MT" : " /MD")
1326 cppflags => sub { vc_wince_info()->{cppflags}; },
1327 lib_defines => add("NO_CHMOD", "OPENSSL_SMALL_FOOTPRINT"),
1328 lib_cppflags => sub { vc_wince_info()->{cppflags}; },
1330 add(combine(sub { defined(env('WCECOMPAT'))
1331 ? '$(WCECOMPAT)/include' : (); },
1332 sub { defined(env('PORTSDK_LIBPATH'))
1333 ? '$(PORTSDK_LIBPATH)/../../include'
1335 lflags => add(combine(sub { vc_wince_info()->{lflags}; },
1336 sub { defined(env('PORTSDK_LIBPATH'))
1337 ? "/entry:mainCRTstartup" : (); })),
1339 bn_ops => add("BN_LLONG"),
1340 ex_libs => add(sub {
1342 push @ex_libs, 'ws2.lib' unless $disabled{sock};
1343 push @ex_libs, 'crypt32.lib';
1344 if (defined(env('WCECOMPAT'))) {
1345 my $x = '$(WCECOMPAT)/lib';
1346 if (-f "$x/env('TARGETCPU')/wcecompatex.lib") {
1347 $x .= '/$(TARGETCPU)/wcecompatex.lib';
1349 $x .= '/wcecompatex.lib';
1353 push @ex_libs, '$(PORTSDK_LIBPATH)/portlib.lib'
1354 if (defined(env('PORTSDK_LIBPATH')));
1355 push @ex_libs, ' /nodefaultlib coredll.lib corelibc.lib'
1356 if (env('TARGETCPU') eq "X86");
1363 inherit_from => [ 'BASE_unix' ],
1366 CFLAGS => picker(default => "-Wall",
1369 cppflags => combine("-DUNICODE -D_UNICODE -DWIN32_LEAN_AND_MEAN",
1371 lib_cppflags => "-DL_ENDIAN",
1372 ex_libs => add("-lws2_32 -lgdi32 -lcrypt32"),
1373 bn_ops => "EXPORT_VAR_AS_FN",
1374 thread_scheme => "winthreads",
1375 dso_scheme => "win32",
1376 shared_target => "mingw-shared",
1377 shared_cppflags => add("_WINDLL"),
1378 shared_ldflag => "-static-libgcc",
1379 apps_aux_src => add("win32_init.c"),
1381 perl_platform => 'mingw',
1384 inherit_from => [ "mingw-common", asm("x86_asm"),
1385 sub { $disabled{uplink} ? () : "x86_uplink" } ],
1386 CFLAGS => add(picker(release => "-fomit-frame-pointer")),
1388 sys_id => "MINGW32",
1389 bn_ops => add("BN_LLONG"),
1390 perlasm_scheme => "coff",
1391 shared_rcflag => "--target=pe-i386",
1395 # As for OPENSSL_USE_APPLINK. Applink makes it possible to use
1396 # .dll compiled with one compiler with application compiled with
1397 # another compiler. It's possible to engage Applink support in
1398 # mingw64 build, but it's not done, because till mingw64
1399 # supports structured exception handling, one can't seriously
1400 # consider its binaries for using with non-mingw64 run-time
1401 # environment. And as mingw64 is always consistent with itself,
1402 # Applink is never engaged and can as well be omitted.
1403 inherit_from => [ "mingw-common", asm("x86_64_asm") ],
1405 sys_id => "MINGW64",
1406 bn_ops => add("SIXTY_FOUR_BIT"),
1407 perlasm_scheme => "mingw64",
1408 shared_rcflag => "--target=pe-x86-64",
1414 inherit_from => [ "BASE_unix" ],
1417 lib_cppflags => "-DL_ENDIAN",
1423 inherit_from => [ "BASE_unix" ],
1425 CFLAGS => "-O -Wall",
1426 lib_cppflags => "-DTERMIOS -DL_ENDIAN",
1428 bn_ops => "BN_LLONG",
1429 dso_scheme => "win32",
1433 "Cygwin-common" => {
1434 inherit_from => [ "BASE_unix" ],
1438 CFLAGS => picker(default => "-Wall",
1441 lib_cppflags => "-DTERMIOS -DL_ENDIAN",
1443 thread_scheme => "pthread",
1444 dso_scheme => "dlfcn",
1445 shared_target => "cygwin-shared",
1446 shared_cppflags => "-D_WINDLL",
1448 perl_platform => 'Cygwin',
1451 inherit_from => [ "Cygwin-common", asm("x86_asm") ],
1452 CFLAGS => add(picker(release => "-O3 -fomit-frame-pointer")),
1453 bn_ops => "BN_LLONG",
1454 perlasm_scheme => "coff",
1456 "Cygwin-x86_64" => {
1457 inherit_from => [ "Cygwin-common", asm("x86_64_asm") ],
1459 bn_ops => "SIXTY_FOUR_BIT_LONG",
1460 perlasm_scheme => "mingw64",
1462 # Backward compatibility for those using this target
1464 inherit_from => [ "Cygwin-x86" ]
1466 # In case someone constructs the Cygwin target name themself
1468 inherit_from => [ "Cygwin-x86" ]
1471 inherit_from => [ "Cygwin-x86" ]
1474 inherit_from => [ "Cygwin-x86" ]
1477 inherit_from => [ "Cygwin-x86" ]
1480 ##### MacOS X (a.k.a. Darwin) setup
1481 "darwin-common" => {
1482 inherit_from => [ "BASE_unix" ],
1485 CFLAGS => picker(debug => "-g -O0",
1487 cppflags => threads("-D_REENTRANT"),
1488 lflags => "-Wl,-search_paths_first",
1490 bn_ops => "BN_LLONG RC4_CHAR",
1491 thread_scheme => "pthreads",
1492 perlasm_scheme => "osx32",
1493 dso_scheme => "dlfcn",
1494 ranlib => "ranlib -c",
1495 shared_target => "darwin-shared",
1496 shared_cflag => "-fPIC",
1497 shared_extension => ".\$(SHLIB_VERSION_NUMBER).dylib",
1499 # Option "freeze" such as -std=gnu9x can't negatively interfere
1500 # with future defaults for below two targets, because MacOS X
1501 # for PPC has no future, it was discontinued by vendor in 2009.
1502 "darwin-ppc-cc" => {
1503 inherit_from => [ "darwin-common", asm("ppc32_asm") ],
1504 cflags => add("-arch ppc -std=gnu9x -Wa,-force_cpusubtype_ALL"),
1505 lib_cppflags => add("-DB_ENDIAN"),
1506 shared_cflag => add("-fno-common"),
1507 perlasm_scheme => "osx32",
1509 "darwin64-ppc-cc" => {
1510 inherit_from => [ "darwin-common", asm("ppc64_asm") ],
1511 cflags => add("-arch ppc64 -std=gnu9x"),
1512 lib_cppflags => add("-DB_ENDIAN"),
1513 bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
1514 perlasm_scheme => "osx64",
1516 "darwin-i386-cc" => {
1517 inherit_from => [ "darwin-common", asm("x86_asm") ],
1518 CFLAGS => add(picker(release => "-fomit-frame-pointer")),
1519 cflags => add("-arch i386"),
1520 lib_cppflags => add("-DL_ENDIAN"),
1521 bn_ops => "BN_LLONG RC4_INT",
1522 perlasm_scheme => "macosx",
1524 "darwin64-x86_64-cc" => {
1525 inherit_from => [ "darwin-common", asm("x86_64_asm") ],
1526 CFLAGS => add("-Wall"),
1527 cflags => add("-arch x86_64"),
1528 lib_cppflags => add("-DL_ENDIAN"),
1529 bn_ops => "SIXTY_FOUR_BIT_LONG",
1530 perlasm_scheme => "macosx",
1535 inherit_from => [ "BASE_unix" ],
1536 inherit_from => [ asm("x86_elf_asm") ],
1538 CFLAGS => "-O3 -fomit-frame-pointer -Wall",
1539 cflags => threads("-pthread"),
1540 lib_cppflags => "-DL_ENDIAN",
1541 ex_libs => add("-ldl", threads("-pthread")),
1542 bn_ops => "BN_LLONG",
1543 thread_scheme => "pthreads",
1544 dso_scheme => "dlfcn",
1545 shared_target => "linux-shared",
1546 shared_cflag => "-fPIC",
1549 ##### VxWorks for various targets
1550 "vxworks-ppc60x" => {
1551 inherit_from => [ "BASE_unix" ],
1553 CFLAGS => "-O2 -Wall -fstrength-reduce",
1554 cflags => "-mrtp -mhard-float -mstrict-align -fno-implicit-fp -fno-builtin -fno-strict-aliasing",
1555 cppflags => combine("-D_REENTRANT -DPPC32_fp60x -DCPU=PPC32",
1556 "_DTOOL_FAMILY=gnu -DTOOL=gnu",
1557 "-I\$(WIND_BASE)/target/usr/h",
1558 "-I\$(WIND_BASE)/target/usr/h/wrn/coreip"),
1559 sys_id => "VXWORKS",
1560 lflags => add("-L \$(WIND_BASE)/target/usr/lib/ppc/PPC32/common"),
1561 ex_libs => add("-Wl,--defsym,__wrs_rtp_base=0xe0000000"),
1563 "vxworks-ppcgen" => {
1564 inherit_from => [ "BASE_unix" ],
1566 CFLAGS => "-O1 -Wall",
1567 cflags => "-mrtp -msoft-float -mstrict-align -fno-builtin -fno-strict-aliasing",
1568 cppflags => combine("-D_REENTRANT -DPPC32 -DCPU=PPC32",
1569 "-DTOOL_FAMILY=gnu -DTOOL=gnu",
1570 "-I\$(WIND_BASE)/target/usr/h",
1571 "-I\$(WIND_BASE)/target/usr/h/wrn/coreip"),
1572 sys_id => "VXWORKS",
1573 lflags => add("-L \$(WIND_BASE)/target/usr/lib/ppc/PPC32/sfcommon"),
1574 ex_libs => add("-Wl,--defsym,__wrs_rtp_base=0xe0000000"),
1576 "vxworks-ppc405" => {
1577 inherit_from => [ "BASE_unix" ],
1580 cflags => "-msoft-float -mlongcall",
1581 cppflags => combine("-D_REENTRANT -DPPC32 -DCPU=PPC405",
1582 "-DTOOL_FAMILY=gnu -DTOOL=gnu",
1583 "-I\$(WIND_BASE)/target/h"),
1584 sys_id => "VXWORKS",
1585 lflags => add("-r"),
1587 "vxworks-ppc750" => {
1588 inherit_from => [ "BASE_unix" ],
1590 CFLAGS => "-ansi -fvolatile -Wall \$(DEBUG_FLAG)",
1591 cflags => "-nostdinc -fno-builtin -fno-for-scope -fsigned-char -msoft-float -mlongcall",
1592 cppflags => combine("-DPPC750 -D_REENTRANT -DCPU=PPC604",
1593 "-I\$(WIND_BASE)/target/h"),
1594 sys_id => "VXWORKS",
1595 lflags => add("-r"),
1597 "vxworks-ppc750-debug" => {
1598 inherit_from => [ "BASE_unix" ],
1600 CFLAGS => "-ansi -fvolatile -Wall -g",
1601 cflags => "-nostdinc -fno-builtin -fno-for-scope -fsigned-char -msoft-float -mlongcall",
1602 cppflags => combine("-DPPC750 -D_REENTRANT -DCPU=PPC604",
1603 "-DPEDANTIC -DDEBUG",
1604 "-I\$(WIND_BASE)/target/h"),
1605 sys_id => "VXWORKS",
1606 lflags => add("-r"),
1608 "vxworks-ppc860" => {
1609 inherit_from => [ "BASE_unix" ],
1611 cflags => "-nostdinc -msoft-float",
1612 cppflags => combine("-DCPU=PPC860 -DNO_STRINGS_H",
1613 "-I\$(WIND_BASE)/target/h"),
1614 sys_id => "VXWORKS",
1615 lflags => add("-r"),
1617 "vxworks-simlinux" => {
1618 inherit_from => [ "BASE_unix" ],
1620 cflags => "-B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/ -fno-builtin -fno-defer-pop",
1621 cppflags => combine("-D_VSB_CONFIG_FILE=\"\$(WIND_BASE)/target/lib/h/config/vsbConfig.h\"",
1622 "-DL_ENDIAN -DCPU=SIMLINUX -DNO_STRINGS_H",
1623 "-DTOOL_FAMILY=gnu -DTOOL=gnu",
1624 "-DOPENSSL_NO_HW_PADLOCK",
1625 "-I\$(WIND_BASE)/target/h",
1626 "-I\$(WIND_BASE)/target/h/wrn/coreip"),
1627 sys_id => "VXWORKS",
1628 lflags => add("-r"),
1629 ranlib => "ranlibpentium",
1632 inherit_from => [ "BASE_unix", asm("mips32_asm") ],
1634 CFLAGS => "-O -G 0",
1635 cflags => "-mrtp -mips2 -B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/ -msoft-float -mno-branch-likely -fno-builtin -fno-defer-pop",
1636 cppflags => combine("-D_VSB_CONFIG_FILE=\"\$(WIND_BASE)/target/lib/h/config/vsbConfig.h\"",
1637 "-DCPU=MIPS32 -DNO_STRINGS_H",
1638 "-DTOOL_FAMILY=gnu -DTOOL=gnu",
1639 "-DOPENSSL_NO_HW_PADLOCK",
1640 threads("-D_REENTRANT"),
1641 "-I\$(WIND_BASE)/target/h",
1642 "-I\$(WIND_BASE)/target/h/wrn/coreip"),
1643 sys_id => "VXWORKS",
1644 lflags => add("-L \$(WIND_BASE)/target/usr/lib/mips/MIPSI32/sfcommon"),
1645 ex_libs => add("-Wl,--defsym,__wrs_rtp_base=0xe0000000"),
1646 thread_scheme => "pthreads",
1647 perlasm_scheme => "o32",
1648 ranlib => "ranlibmips",
1653 inherit_from => [ "BASE_unix" ],
1654 CC => sub { env('CC') },
1655 cppflags => threads("-D_REENTRANT"),
1656 ex_libs => add("\$(LDLIBS)"),
1657 bn_ops => "BN_LLONG",
1658 thread_scheme => "pthreads",
1659 dso_scheme => sub { env('LIBSSL_dlfcn') },
1660 shared_target => "linux-shared",
1661 shared_cflag => "-fPIC",
1662 ranlib => sub { env('RANLIB') },
1664 "uClinux-dist64" => {
1665 inherit_from => [ "BASE_unix" ],
1666 CC => sub { env('CC') },
1667 cppflags => threads("-D_REENTRANT"),
1668 ex_libs => add("\$(LDLIBS)"),
1669 bn_ops => "SIXTY_FOUR_BIT_LONG",
1670 thread_scheme => "pthreads",
1671 dso_scheme => sub { env('LIBSSL_dlfcn') },
1672 shared_target => "linux-shared",
1673 shared_cflag => "-fPIC",
1674 ranlib => sub { env('RANLIB') },
1678 # Most things happen in vms-generic.
1679 # Note that vms_info extracts the pointer size from the end of
1680 # the target name, and will assume that anything matching /-p\d+$/
1681 # indicates the pointer size setting for the desired target.
1683 inherit_from => [ "BASE_VMS" ],
1686 CPP => '$(CC)/PREPROCESS_ONLY=SYS$OUTPUT:',
1688 combine(picker(default => "/STANDARD=(ISOC94,RELAXED)/NOLIST/PREFIX=ALL",
1689 debug => "/NOOPTIMIZE/DEBUG",
1690 release => "/OPTIMIZE/NODEBUG"),
1691 sub { my @warnings =
1692 @{vms_info()->{disable_warns}};
1694 ? "/WARNINGS=DISABLE=(".join(",",@warnings).")" : (); }),
1696 add("OPENSSL_USE_NODELETE",
1698 return vms_info()->{def_zlib}
1699 ? "LIBZ=\"\"\"".vms_info()->{def_zlib}."\"\"\"" : ();
1701 lflags => picker(default => "/MAP='F\$PARSE(\".MAP\",\"\$\@\")'",
1702 debug => "/DEBUG/TRACEBACK",
1703 release => "/NODEBUG/NOTRACEBACK"),
1704 # Because of dso_cflags below, we can't set the generic |cflags| here,
1705 # as it can't be overriden, so we set separate C flags for libraries
1706 # and binaries instead.
1707 bin_cflags => add("/NAMES=(AS_IS,SHORTENED)/EXTERN_MODEL=STRICT_REFDEF"),
1708 lib_cflags => add("/NAMES=(AS_IS,SHORTENED)/EXTERN_MODEL=STRICT_REFDEF"),
1709 # For modules specifically, we assume that they only use public
1710 # OpenSSL symbols, and therefore don't need to mangle names on
1713 ex_libs => add(sub { return vms_info()->{zlib} || (); }),
1714 shared_target => "vms-shared",
1715 # def_flag made to empty string so a .opt file gets generated
1716 shared_defflag => '',
1717 dso_scheme => "vms",
1718 thread_scheme => "pthreads",
1720 AS => sub { vms_info()->{AS} },
1721 ASFLAGS => sub { vms_info()->{ASFLAGS} },
1722 asoutflag => sub { vms_info()->{asoutflag} },
1723 asflags => sub { vms_info()->{asflags} },
1724 perlasm_scheme => sub { vms_info()->{perlasm_scheme} },
1726 disable => add('pinshared'),
1728 apps_aux_src => "vms_term_sock.c vms_decc_argv.c",
1729 apps_init_src => "vms_decc_init.c",
1732 # From HELP CC/POINTER_SIZE:
1735 # LONG[=ARGV] The compiler assumes 64-bit pointers. If the ARGV option to
1736 # LONG or 64 is present, the main argument argv will be an
1737 # array of long pointers instead of an array of short pointers.
1739 # 64[=ARGV] Same as LONG.
1742 # We don't want the hassle of dealing with 32-bit pointers with argv, so
1743 # we force it to have 64-bit pointers, see the added cflags in the -p64
1744 # config targets below.
1747 inherit_from => [ "vms-generic" ],
1748 bn_ops => "SIXTY_FOUR_BIT RC4_INT",
1751 "vms-alpha-p32" => {
1752 inherit_from => [ "vms-alpha" ],
1753 cflags => add("/POINTER_SIZE=32"),
1754 pointer_size => "32",
1756 "vms-alpha-p64" => {
1757 inherit_from => [ "vms-alpha" ],
1758 cflags => add("/POINTER_SIZE=64=ARGV"),
1759 pointer_size => "64",
1762 inherit_from => [ "vms-generic",
1763 sub { vms_info()->{AS}
1764 ? asm("ia64_asm")->() : () } ],
1765 bn_ops => "SIXTY_FOUR_BIT RC4_INT",
1768 modes_asm_src => "", # Because ghash-ia64.s doesn't work on VMS
1771 inherit_from => [ "vms-ia64" ],
1772 cflags => add("/POINTER_SIZE=32"),
1773 pointer_size => "32",
1776 inherit_from => [ "vms-ia64" ],
1777 cflags => add("/POINTER_SIZE=64=ARGV"),
1778 pointer_size => "64",