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",
215 #### Solaris common with Sun C setups
216 "solaris-common-cc" => {
217 inherit_from => [ "solaris-common" ],
219 shared_target => "solaris",
220 shared_ldflag => "-Wl,-Bsymbolic",
221 shared_defflag => "-Wl,-M,",
222 shared_sonameflag=> "-Wl,-h,",
224 #### Solaris common with GNU C setups
225 "solaris-common-gcc" => {
226 inherit_from => [ "solaris-common" ],
228 shared_target => "solaris-gcc-shared", # The rest is on shared_info.pl
230 #### Solaris x86 with GNU C setups
231 "solaris-x86-gcc" => {
232 # NB. GNU C has to be configured to use GNU assembler, and not
233 # /usr/ccs/bin/as. Failure to comply will result in compile
234 # failures [at least] in 32-bit build.
235 inherit_from => [ "solaris-common-gcc" ],
237 CFLAGS => add_before(picker(default => "-Wall",
239 release => "-O3 -fomit-frame-pointer")),
240 cflags => add(threads("-pthread")),
241 lib_cppflags => add("-DL_ENDIAN"),
242 ex_libs => add(threads("-pthread")),
243 bn_ops => "BN_LLONG",
244 shared_cflag => "-fPIC",
245 shared_ldflag => add_before("-shared -static-libgcc"),
247 perlasm_scheme => 'elf',
249 "solaris64-x86_64-gcc" => {
250 # -shared -static-libgcc might appear controversial, but modules
251 # taken from static libgcc do not have relocations and linking
252 # them into our shared objects doesn't have any negative side
253 # effects. On the contrary, doing so makes it possible to use
254 # gcc shared build with Sun C. Given that gcc generates faster
255 # code [thanks to inline assembler], I would actually recommend
256 # to consider using gcc shared build even with vendor compiler:-)
257 # -- <appro@openssl.org>
258 inherit_from => [ "solaris-common-gcc" ],
260 CFLAGS => add_before(picker(default => "-Wall",
263 cflags => add_before("-m64", threads("-pthread")),
264 lib_cppflags => add("-DL_ENDIAN"),
265 ex_libs => add(threads("-pthread")),
266 bn_ops => "SIXTY_FOUR_BIT_LONG",
267 asm_arch => 'x86_64',
268 perlasm_scheme => "elf",
269 shared_cflag => "-fPIC",
270 shared_ldflag => add_before("-shared -static-libgcc"),
274 #### Solaris x86 with Sun C setups
275 # There used to be solaris-x86-cc target, but it was removed,
276 # primarily because vendor assembler can't assemble our modules
277 # with -KPIC flag. As result it, assembly support, was not even
278 # available as option. But its lack means lack of side-channel
279 # resistant code, which is incompatible with security by today's
280 # standards. Fortunately gcc is readily available prepackaged
281 # option, which we can firmly point at...
283 # On related note, solaris64-x86_64-cc target won't compile code
284 # paths utilizing AVX and post-Haswell instruction extensions.
285 # Consider switching to solaris64-x86_64-gcc even here...
287 "solaris64-x86_64-cc" => {
288 inherit_from => [ "solaris-common-cc" ],
290 CFLAGS => add_before(picker(debug => "-g",
291 release => "-xO5 -xdepend -xbuiltin")),
292 cflags => add_before("-xarch=generic64 -xstrconst -Xa"),
293 cppflags => add(threads("-D_REENTRANT")),
294 lib_cppflags => add("-DL_ENDIAN"),
295 thread_scheme => "pthreads",
296 lflags => add(threads("-mt")),
297 ex_libs => add(threads("-lpthread")),
298 bn_ops => "SIXTY_FOUR_BIT_LONG",
299 asm_arch => 'x86_64',
300 perlasm_scheme => "elf",
301 shared_cflag => "-KPIC",
302 shared_ldflag => add_before("-G -dy -z text"),
306 #### SPARC Solaris with GNU C setups
307 "solaris-sparcv7-gcc" => {
308 inherit_from => [ "solaris-common-gcc" ],
310 CFLAGS => add_before(picker(default => "-Wall",
313 cflags => add(threads("-pthread")),
314 lib_cppflags => add("-DB_ENDIAN -DBN_DIV2W"),
315 ex_libs => add(threads("-pthread")),
316 bn_ops => "BN_LLONG RC4_CHAR",
317 shared_cflag => "-fPIC",
318 shared_ldflag => add_before("-shared"),
320 "solaris-sparcv8-gcc" => {
321 inherit_from => [ "solaris-sparcv7-gcc" ],
322 cflags => add_before("-mcpu=v8"),
323 asm_arch => 'sparcv8',
324 perlasm_scheme => 'void',
326 "solaris-sparcv9-gcc" => {
327 # -m32 should be safe to add as long as driver recognizes
329 inherit_from => [ "solaris-sparcv7-gcc" ],
330 cflags => add_before("-m32 -mcpu=ultrasparc"),
331 asm_arch => 'sparcv9',
332 perlasm_scheme => 'void',
334 "solaris64-sparcv9-gcc" => {
335 inherit_from => [ "solaris-sparcv9-gcc" ],
336 cflags => sub { my $f=join(" ",@_); $f =~ s/\-m32/-m64/; $f; },
337 bn_ops => "BN_LLONG RC4_CHAR",
341 #### SPARC Solaris with Sun C setups
342 # SC4.0 doesn't pass 'make test', upgrade to SC5.0 or SC4.2.
343 # SC4.2 is ok, better than gcc even on bn as long as you tell it -xarch=v8
344 # SC5.0 note: Compiler common patch 107357-01 or later is required!
345 "solaris-sparcv7-cc" => {
346 inherit_from => [ "solaris-common-cc" ],
348 CFLAGS => add_before(picker(debug => "-g",
349 release => "-xO5 -xdepend")),
350 cflags => add_before("-xstrconst -Xa"),
351 cppflags => add(threads("-D_REENTRANT")),
352 lib_cppflags => add("-DB_ENDIAN -DBN_DIV2W"),
353 lflags => add(threads("-mt")),
354 ex_libs => add(threads("-lpthread")),
355 bn_ops => "BN_LLONG RC4_CHAR",
356 shared_cflag => "-KPIC",
357 shared_ldflag => add_before("-G -dy -z text"),
360 "solaris-sparcv8-cc" => {
361 inherit_from => [ "solaris-sparcv7-cc" ],
362 cflags => add_before("-xarch=v8"),
363 asm_arch => 'sparcv8',
364 perlasm_scheme => 'void',
366 "solaris-sparcv9-cc" => {
367 inherit_from => [ "solaris-sparcv7-cc" ],
368 cflags => add_before("-xarch=v8plus"),
369 asm_arch => 'sparcv9',
370 perlasm_scheme => 'void',
372 "solaris64-sparcv9-cc" => {
373 inherit_from => [ "solaris-sparcv7-cc" ],
374 cflags => add_before("-xarch=v9"),
375 bn_ops => "BN_LLONG RC4_CHAR",
376 asm_arch => 'sparcv9',
377 perlasm_scheme => 'void',
381 #### IRIX 6.x configs
382 # Only N32 and N64 ABIs are supported.
384 inherit_from => [ "BASE_unix" ],
386 cppflags => threads("-D_SGI_MP_SOURCE"),
387 lib_cppflags => "-DB_ENDIAN",
388 ex_libs => add(threads("-lpthread")),
389 thread_scheme => "pthreads",
390 dso_scheme => "dlfcn",
391 shared_target => "self",
392 shared_ldflag => "-shared -Wl,-Bsymbolic",
393 shared_sonameflag=> "-Wl,-soname,",
395 "irix-mips3-gcc" => {
396 inherit_from => [ "irix-common" ],
398 CFLAGS => picker(debug => "-g -O0",
400 LDFLAGS => "-static-libgcc",
401 cflags => "-mabi=n32",
402 bn_ops => "RC4_CHAR SIXTY_FOUR_BIT",
403 asm_arch => 'mips64',
404 perlasm_scheme => "n32",
408 inherit_from => [ "irix-common" ],
410 CFLAGS => picker(debug => "-g -O0",
412 cflags => "-n32 -mips3 -use_readonly_const -G0 -rdata_shared",
413 bn_ops => "RC4_CHAR SIXTY_FOUR_BIT",
414 asm_arch => 'mips64',
415 perlasm_scheme => "n32",
419 "irix64-mips4-gcc" => {
420 inherit_from => [ "irix-common" ],
422 CFLAGS => picker(debug => "-g -O0",
424 LDFLAGS => "-static-libgcc",
425 cflags => "-mabi=64 -mips4",
426 bn_ops => "RC4_CHAR SIXTY_FOUR_BIT_LONG",
427 asm_arch => 'mips64',
428 perlasm_scheme => "64",
431 "irix64-mips4-cc" => {
432 inherit_from => [ "irix-common" ],
434 CFLAGS => picker(debug => "-g -O0",
436 cflags => "-64 -mips4 -use_readonly_const -G0 -rdata_shared",
437 bn_ops => "RC4_CHAR SIXTY_FOUR_BIT_LONG",
438 asm_arch => 'mips64',
439 perlasm_scheme => "64",
443 #### Unified HP-UX ANSI C configs.
445 # - Originally we were optimizing at +O4 level. It should be noted
446 # that the only difference between +O3 and +O4 is global inter-
447 # procedural analysis. As it has to be performed during the link
448 # stage the compiler leaves behind certain pseudo-code in lib*.a
449 # which might be release or even patch level specific. Generating
450 # the machine code for and analyzing the *whole* program appears
451 # to be *extremely* memory demanding while the performance gain is
452 # actually questionable. The situation is intensified by the default
453 # HP-UX data set size limit (infamous 'maxdsiz' tunable) of 64MB
454 # which is way too low for +O4. In other words, doesn't +O3 make
456 # - Keep in mind that the HP compiler by default generates code
457 # suitable for execution on the host you're currently compiling at.
458 # If the toolkit is meant to be used on various PA-RISC processors
459 # consider './Configure hpux-parisc-[g]cc +DAportable'.
460 # - -DMD32_XARRAY triggers workaround for compiler bug we ran into in
461 # 32-bit message digests. (For the moment of this writing) HP C
462 # doesn't seem to "digest" too many local variables (they make "him"
463 # chew forever:-). For more details look-up MD32_XARRAY comment in
464 # crypto/sha/sha_local.h.
465 # - originally there were 32-bit hpux-parisc2-* targets. They were
466 # scrapped, because a) they were not interchangeable with other 32-bit
467 # targets; b) performance-critical 32-bit assembly modules implement
468 # even PA-RISC 2.0-specific code paths, which are chosen at run-time,
469 # thus adequate performance is provided even with PA-RISC 1.1 build.
471 inherit_from => [ "BASE_unix" ],
473 defines => add("_XOPEN_SOURCE", "_XOPEN_SOURCE_EXTENDED",
474 "_HPUX_ALT_XOPEN_SOCKET_API"),
475 lib_cppflags => "-DB_ENDIAN",
476 thread_scheme => "pthreads",
477 dso_scheme => "dlfcn", # overridden in 32-bit PA-RISC builds
478 shared_target => "self",
479 bin_lflags => "-Wl,+s,+cdp,../:,+cdp,./:",
480 shared_ldflag => "-Wl,-B,symbolic,+vnocompatwarnings,-z,+s,+cdp,../:,+cdp,./:",
481 shared_sonameflag=> "-Wl,+h,",
483 "hpux-parisc-gcc" => {
484 inherit_from => [ "hpux-common" ],
486 CFLAGS => picker(debug => "-O0 -g",
488 cflags => add(threads("-pthread")),
489 lib_cppflags => add("-DBN_DIV2W"),
490 ex_libs => add("-ldld", threads("-pthread")),
491 bn_ops => "BN_LLONG RC4_CHAR",
493 shared_cflag => "-fPIC",
494 shared_ldflag => add_before("-shared"),
495 shared_extension => ".sl.\$(SHLIB_VERSION_NUMBER)",
497 "hpux-parisc1_1-gcc" => {
498 inherit_from => [ "hpux-parisc-gcc" ],
499 asm_arch => 'parisc11',
500 perlasm_scheme => "32",
501 multilib => "/pa1.1",
503 "hpux64-parisc2-gcc" => {
504 inherit_from => [ "hpux-common" ],
506 CFLAGS => combine(picker(debug => "-O0 -g",
508 cflags => add(threads("-pthread")),
509 ex_libs => add("-ldl", threads("-pthread")),
510 bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
511 asm_arch => 'parisc20_64',
512 perlasm_scheme => "64",
513 shared_cflag => "-fpic",
514 shared_ldflag => add_before("-shared"),
515 shared_extension => ".sl.\$(SHLIB_VERSION_NUMBER)",
516 multilib => "/pa20_64",
519 # More attempts at unified 10.X and 11.X targets for HP C compiler.
520 "hpux-parisc-cc" => {
521 inherit_from => [ "hpux-common" ],
523 CFLAGS => picker(debug => "+O0 +d -g",
525 cflags => "+Optrs_strongly_typed -Ae +ESlit",
526 cppflags => threads("-D_REENTRANT"),
527 lib_cppflags => add("-DBN_DIV2W -DMD32_XARRAY"),
528 ex_libs => add("-ldld", threads("-lpthread")),
529 bn_ops => "RC4_CHAR",
531 shared_cflag => "+Z",
532 shared_ldflag => add_before("-b"),
533 shared_extension => ".sl.\$(SHLIB_VERSION_NUMBER)",
535 "hpux-parisc1_1-cc" => {
536 inherit_from => [ "hpux-parisc-cc" ],
537 cflags => add_before("+DA1.1"),
538 asm_arch => 'parisc11',
539 perlasm_scheme => "32",
540 multilib => "/pa1.1",
542 "hpux64-parisc2-cc" => {
543 inherit_from => [ "hpux-common" ],
545 CFLAGS => picker(debug => "+O0 +d -g",
547 cflags => "+DD64 +Optrs_strongly_typed -Ae +ESlit",
548 cppflags => threads("-D_REENTRANT") ,
549 lib_cppflags => add("-DMD32_XARRAY"),
550 ex_libs => add("-ldl", threads("-lpthread")),
551 bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
552 asm_arch => 'parisc20_64',
553 perlasm_scheme => "64",
554 shared_cflag => "+Z",
555 shared_ldflag => add_before("-b"),
556 shared_extension => ".sl.\$(SHLIB_VERSION_NUMBER)",
557 multilib => "/pa20_64",
560 # HP/UX IA-64 targets
562 inherit_from => [ "hpux-common" ],
564 CFLAGS => picker(debug => "+O0 +d -g",
566 cflags => "-Ae +DD32 +Olit=all -z",
567 cppflags => add(threads("-D_REENTRANT")),
568 ex_libs => add("-ldl", threads("-lpthread")),
569 bn_ops => "SIXTY_FOUR_BIT",
571 perlasm_scheme => 'void',
572 shared_cflag => "+Z",
573 shared_ldflag => add_before("-b"),
574 multilib => "/hpux32",
576 "hpux64-ia64-cc" => {
577 inherit_from => [ "hpux-common" ],
579 CFLAGS => picker(debug => "+O0 +d -g",
581 cflags => "-Ae +DD64 +Olit=all -z",
582 cppflags => threads("-D_REENTRANT"),
583 ex_libs => add("-ldl", threads("-lpthread")),
584 bn_ops => "SIXTY_FOUR_BIT_LONG",
586 perlasm_scheme => 'void',
587 shared_cflag => "+Z",
588 shared_ldflag => add_before("-b"),
589 multilib => "/hpux64",
593 inherit_from => [ "hpux-common" ],
595 CFLAGS => picker(debug => "-O0 -g",
597 cflags => add(threads("-pthread")),
598 ex_libs => add("-ldl", threads("-pthread")),
599 bn_ops => "SIXTY_FOUR_BIT",
601 perlasm_scheme => 'void',
602 shared_cflag => "-fpic",
603 shared_ldflag => add_before("-shared"),
604 multilib => "/hpux32",
606 "hpux64-ia64-gcc" => {
607 inherit_from => [ "hpux-common" ],
609 CFLAGS => picker(debug => "-O0 -g",
611 cflags => combine("-mlp64", threads("-pthread")),
612 ex_libs => add("-ldl", threads("-pthread")),
613 bn_ops => "SIXTY_FOUR_BIT_LONG",
615 perlasm_scheme => 'void',
616 shared_cflag => "-fpic",
617 shared_ldflag => add_before("-shared"),
618 multilib => "/hpux64",
621 #### HP MPE/iX http://jazz.external.hp.com/src/openssl/
623 inherit_from => [ "BASE_unix" ],
626 cppflags => "-D_POSIX_SOURCE -D_SOCKET_SOURCE",
627 includes => [ "/SYSLOG/PUB" ],
628 lib_cppflags => "-DBN_DIV2W",
630 lflags => add("-L/SYSLOG/PUB"),
631 ex_libs => add("-lsyslog -lsocket -lcurses"),
632 thread_scheme => "(unknown)",
633 bn_ops => "BN_LLONG",
636 #### DEC Alpha Tru64 targets. Tru64 is marketing name for OSF/1 version 4
637 #### and forward. In reality 'uname -s' still returns "OSF1". Originally
638 #### there were even osf1-* configs targeting prior versions provided,
639 #### but not anymore...
640 "tru64-alpha-gcc" => {
641 inherit_from => [ "BASE_unix" ],
644 cflags => add("-std=c9x", threads("-pthread")),
645 cppflags => "-D_XOPEN_SOURCE=500 -D_OSF_SOURCE",
646 ex_libs => add("-lrt", threads("-pthread")), # for mlock(2)
647 bn_ops => "SIXTY_FOUR_BIT_LONG",
649 perlasm_scheme => "void",
650 thread_scheme => "pthreads",
651 dso_scheme => "dlfcn",
652 shared_target => "alpha-osf1-shared",
653 shared_extension => ".so",
655 "tru64-alpha-cc" => {
656 inherit_from => [ "BASE_unix" ],
658 CFLAGS => "-tune host -fast",
659 cflags => add("-std1 -readonly_strings",
660 threads("-pthread")),
661 cppflags => "-D_XOPEN_SOURCE=500 -D_OSF_SOURCE",
662 ex_libs => add("-lrt", threads("-pthread")), # for mlock(2)
663 bn_ops => "SIXTY_FOUR_BIT_LONG",
665 perlasm_scheme => "void",
666 thread_scheme => "pthreads",
667 dso_scheme => "dlfcn",
668 shared_target => "alpha-osf1-shared",
669 shared_ldflag => "-msym",
670 shared_extension => ".so",
674 #### Variety of LINUX:-)
676 # *-generic* is endian-neutral target, but ./config is free to
677 # throw in -D[BL]_ENDIAN, whichever appropriate...
678 "linux-generic32" => {
679 inherit_from => [ "BASE_unix" ],
682 CFLAGS => picker(default => "-Wall",
685 CXXFLAGS => picker(default => "-Wall",
688 cflags => threads("-pthread"),
689 cxxflags => combine("-std=c++11", threads("-pthread")),
690 lib_cppflags => "-DOPENSSL_USE_NODELETE",
691 ex_libs => add("-ldl", threads("-pthread")),
692 bn_ops => "BN_LLONG RC4_CHAR",
693 thread_scheme => "pthreads",
694 dso_scheme => "dlfcn",
695 shared_target => "linux-shared",
696 shared_cflag => "-fPIC",
697 shared_ldflag => sub { $disabled{pinshared} ? () : "-Wl,-znodelete" },
698 enable => [ "afalgeng" ],
700 "linux-generic64" => {
701 inherit_from => [ "linux-generic32" ],
702 bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
706 inherit_from => [ "linux-generic32" ],
708 perlasm_scheme => "linux32",
709 lib_cppflags => add("-DB_ENDIAN"),
712 inherit_from => [ "linux-generic64" ],
713 cflags => add("-m64"),
714 cxxflags => add("-m64"),
715 lib_cppflags => add("-DB_ENDIAN"),
717 perlasm_scheme => "linux64",
721 inherit_from => [ "linux-generic64" ],
722 cflags => add("-m64"),
723 cxxflags => add("-m64"),
724 lib_cppflags => add("-DL_ENDIAN"),
726 perlasm_scheme => "linux64le",
730 ################################################################
731 # Note that -march is not among compiler options in linux-armv4
732 # target description. Not specifying one is intentional to give
735 # a) rely on your compiler default by not specifying one;
736 # b) specify your target platform explicitly for optimal
737 # performance, e.g. -march=armv6 or -march=armv7-a;
738 # c) build "universal" binary that targets *range* of platforms
739 # by specifying minimum and maximum supported architecture;
741 # As for c) option. It actually makes no sense to specify
742 # maximum to be less than ARMv7, because it's the least
743 # requirement for run-time switch between platform-specific
744 # code paths. And without run-time switch performance would be
745 # equivalent to one for minimum. Secondly, there are some
746 # natural limitations that you'd have to accept and respect.
747 # Most notably you can *not* build "universal" binary for
748 # big-endian platform. This is because ARMv7 processor always
749 # picks instructions in little-endian order. Another similar
750 # limitation is that -mthumb can't "cross" -march=armv6t2
751 # boundary, because that's where it became Thumb-2. Well, this
752 # limitation is a bit artificial, because it's not really
753 # impossible, but it's deemed too tricky to support. And of
754 # course you have to be sure that your binutils are actually
755 # up to the task of handling maximum target platform. With all
756 # this in mind here is an example of how to configure
759 # ./Configure linux-armv4 -march=armv6 -D__ARM_MAX_ARCH__=8
761 inherit_from => [ "linux-generic32" ],
763 perlasm_scheme => "linux32",
766 inherit_from => [ "linux-generic64" ],
767 asm_arch => 'aarch64',
768 perlasm_scheme => "linux64",
770 "linux-arm64ilp32" => { # https://wiki.linaro.org/Platform/arm64-ilp32
771 inherit_from => [ "linux-generic32" ],
772 cflags => add("-mabi=ilp32"),
773 cxxflags => add("-mabi=ilp32"),
774 bn_ops => "SIXTY_FOUR_BIT RC4_CHAR",
775 asm_arch => 'aarch64',
776 perlasm_scheme => "linux64",
780 # Configure script adds minimally required -march for assembly
781 # support, if no -march was specified at command line.
782 inherit_from => [ "linux-generic32" ],
783 cflags => add("-mabi=32"),
784 cxxflags => add("-mabi=32"),
785 asm_arch => 'mips32',
786 perlasm_scheme => "o32",
788 # mips32 and mips64 below refer to contemporary MIPS Architecture
789 # specifications, MIPS32 and MIPS64, rather than to kernel bitness.
791 inherit_from => [ "linux-generic32" ],
792 cflags => add("-mabi=n32"),
793 cxxflags => add("-mabi=n32"),
794 bn_ops => "RC4_CHAR",
795 asm_arch => 'mips64',
796 perlasm_scheme => "n32",
799 "linux64-mips64" => {
800 inherit_from => [ "linux-generic64" ],
801 cflags => add("-mabi=64"),
802 cxxflags => add("-mabi=64"),
803 asm_arch => 'mips64',
804 perlasm_scheme => "64",
808 # riscv64 below refers to contemporary RISCV Architecture
810 "linux64-riscv64" => {
811 inherit_from => [ "linux-generic64"],
812 perlasm_scheme => "linux64",
815 #### IA-32 targets...
816 #### These two targets are a bit aged and are to be used on older Linux
817 #### machines where gcc doesn't understand -m32 and -m64
819 inherit_from => [ "linux-generic32" ],
820 CFLAGS => add(picker(release => "-fomit-frame-pointer")),
821 lib_cppflags => add("-DL_ENDIAN"),
822 bn_ops => "BN_LLONG",
824 perlasm_scheme => "elf",
827 inherit_from => [ "BASE_unix" ],
829 CFLAGS => add(picker(default => "-Wall",
831 release => "-O3 -fomit-frame-pointer")),
832 lib_cppflags => add("-DL_ENDIAN"),
833 bn_ops => "BN_LLONG",
834 thread_scheme => "(unknown)",
836 perlasm_scheme => "a.out",
839 #### X86 / X86_64 targets
841 inherit_from => [ "linux-generic32" ],
842 CFLAGS => add(picker(release => "-fomit-frame-pointer")),
843 cflags => add("-m32"),
844 cxxflags => add("-m32"),
845 lib_cppflags => add("-DL_ENDIAN"),
846 bn_ops => "BN_LLONG",
848 perlasm_scheme => "elf",
850 "linux-x86-clang" => {
851 inherit_from => [ "linux-x86" ],
856 inherit_from => [ "linux-generic64" ],
857 cflags => add("-m64"),
858 cxxflags => add("-m64"),
859 lib_cppflags => add("-DL_ENDIAN"),
860 bn_ops => "SIXTY_FOUR_BIT_LONG",
861 asm_arch => 'x86_64',
862 perlasm_scheme => "elf",
865 "linux-x86_64-clang" => {
866 inherit_from => [ "linux-x86_64" ],
871 inherit_from => [ "linux-generic32" ],
872 cflags => add("-mx32"),
873 cxxflags => add("-mx32"),
874 lib_cppflags => add("-DL_ENDIAN"),
875 bn_ops => "SIXTY_FOUR_BIT",
876 asm_arch => 'x86_64',
877 perlasm_scheme => "elf32",
882 inherit_from => [ "linux-generic64" ],
883 bn_ops => "SIXTY_FOUR_BIT_LONG",
885 perlasm_scheme => 'void',
889 inherit_from => [ "linux-generic64" ],
890 cflags => add("-m64"),
891 cxxflags => add("-m64"),
892 lib_cppflags => add("-DB_ENDIAN"),
894 perlasm_scheme => "64",
898 #### So called "highgprs" target for z/Architecture CPUs
899 # "Highgprs" is kernel feature first implemented in Linux
900 # 2.6.32, see /proc/cpuinfo. The idea is to preserve most
901 # significant bits of general purpose registers not only
902 # upon 32-bit process context switch, but even on
903 # asynchronous signal delivery to such process. This makes
904 # it possible to deploy 64-bit instructions even in legacy
905 # application context and achieve better [or should we say
906 # adequate] performance. The build is binary compatible with
907 # linux-generic32, and the idea is to be able to install the
908 # resulting libcrypto.so alongside generic one, e.g. as
909 # /lib/highgprs/libcrypto.so.x.y, for ldconfig and run-time
910 # linker to autodiscover. Unfortunately it doesn't work just
911 # yet, because of couple of bugs in glibc
912 # sysdeps/s390/dl-procinfo.c affecting ldconfig and ld.so.1...
914 inherit_from => [ "linux-generic32" ],
915 cflags => add("-m31 -Wa,-mzarch"),
916 cxxflags => add("-m31 -Wa,-mzarch"),
917 lib_cppflags => add("-DB_ENDIAN"),
919 perlasm_scheme => "31",
920 multilib => "/highgprs",
923 #### SPARC Linux setups
925 inherit_from => [ "linux-generic32" ],
926 cflags => add("-mcpu=v8"),
927 cxxflags => add("-mcpu=v8"),
928 lib_cppflags => add("-DB_ENDIAN -DBN_DIV2W"),
929 asm_arch => 'sparcv8',
930 perlasm_scheme => 'void',
933 # it's a real mess with -mcpu=ultrasparc option under Linux,
934 # but -Wa,-Av8plus should do the trick no matter what.
935 inherit_from => [ "linux-generic32" ],
936 cflags => add("-m32 -mcpu=ultrasparc -Wa,-Av8plus"),
937 cxxflags => add("-m32 -mcpu=ultrasparc -Wa,-Av8plus"),
938 lib_cppflags => add("-DB_ENDIAN -DBN_DIV2W"),
939 asm_arch => 'sparcv9',
940 perlasm_scheme => 'void',
942 "linux64-sparcv9" => {
943 # GCC 3.1 is a requirement
944 inherit_from => [ "linux-generic64" ],
945 cflags => add("-m64 -mcpu=ultrasparc"),
946 cxxflags => add("-m64 -mcpu=ultrasparc"),
947 lib_cppflags => add("-DB_ENDIAN"),
948 bn_ops => "BN_LLONG RC4_CHAR",
949 asm_arch => 'sparcv9',
950 perlasm_scheme => 'void',
954 "linux-alpha-gcc" => {
955 inherit_from => [ "linux-generic64" ],
956 lib_cppflags => add("-DL_ENDIAN"),
957 bn_ops => "SIXTY_FOUR_BIT_LONG",
959 perlasm_scheme => "void",
961 "linux-c64xplus" => {
962 inherit_from => [ "BASE_unix" ],
963 # TI_CGT_C6000_7.3.x is a requirement
965 CFLAGS => "-o2 -ox -ms",
966 cflags => "--linux -ea=.s -eo=.o -mv6400+ -pden",
967 cxxflags => "--linux -ea=.s -eo=.o -mv6400+ -pden",
968 cppflags => combine("-DOPENSSL_SMALL_FOOTPRINT",
969 threads("-D_REENTRANT")),
970 bn_ops => "BN_LLONG",
971 thread_scheme => "pthreads",
972 asm_arch => 'c64xplus',
973 perlasm_scheme => "void",
974 dso_scheme => "dlfcn",
975 shared_target => "linux-shared",
976 shared_cflag => "--pic",
977 shared_ldflag => add("-z --sysv --shared"),
983 # As for thread cflag. Idea is to maintain "collective" set of
984 # flags, which would cover all BSD flavors. -pthread applies
985 # to them all, but is treated differently. OpenBSD expands is
986 # as -D_POSIX_THREAD -lc_r, which is sufficient. FreeBSD 4.x
987 # expands it as -lc_r, which has to be accompanied by explicit
988 # -D_THREAD_SAFE and sometimes -D_REENTRANT. FreeBSD 5.x
989 # expands it as -lc_r, which seems to be sufficient?
990 inherit_from => [ "BASE_unix" ],
992 CFLAGS => picker(default => "-Wall",
995 cflags => threads("-pthread"),
996 cppflags => threads("-D_THREAD_SAFE -D_REENTRANT"),
997 ex_libs => add(threads("-pthread")),
998 enable => add("devcryptoeng"),
999 bn_ops => "BN_LLONG",
1000 thread_scheme => "pthreads",
1001 dso_scheme => "dlfcn",
1002 shared_target => "bsd-gcc-shared",
1003 shared_cflag => "-fPIC",
1005 "BSD-generic64" => {
1006 inherit_from => [ "BSD-generic32" ],
1007 bn_ops => "SIXTY_FOUR_BIT_LONG",
1011 inherit_from => [ "BSD-generic32" ],
1012 CFLAGS => add(picker(release => "-fomit-frame-pointer")),
1013 lib_cppflags => add("-DL_ENDIAN"),
1014 bn_ops => "BN_LLONG",
1016 perlasm_scheme => "a.out",
1019 inherit_from => [ "BSD-x86" ],
1020 perlasm_scheme => "elf",
1024 inherit_from => [ "BSD-generic32" ],
1025 cflags => add("-mcpu=v8"),
1026 lib_cppflags => add("-DB_ENDIAN"),
1027 asm_arch => 'sparcv8',
1028 perlasm_scheme => 'void',
1031 # -DMD32_REG_T=int doesn't actually belong in sparc64 target, it
1032 # simply *happens* to work around a compiler bug in gcc 3.3.3,
1033 # triggered by RIPEMD160 code.
1034 inherit_from => [ "BSD-generic64" ],
1035 lib_cppflags => add("-DB_ENDIAN -DMD32_REG_T=int"),
1036 bn_ops => "BN_LLONG",
1037 asm_arch => 'sparcv9',
1038 perlasm_scheme => 'void',
1042 inherit_from => [ "BSD-generic64" ],
1043 lib_cppflags => add("-DL_ENDIAN"),
1044 bn_ops => "SIXTY_FOUR_BIT_LONG",
1046 perlasm_scheme => 'void',
1050 inherit_from => [ "BSD-generic64" ],
1051 lib_cppflags => add("-DL_ENDIAN"),
1052 bn_ops => "SIXTY_FOUR_BIT_LONG",
1053 asm_arch => 'x86_64',
1054 perlasm_scheme => "elf",
1058 inherit_from => [ "BASE_unix" ],
1060 CFLAGS => "-fomit-frame-pointer -O3 -Wall",
1061 lib_cppflags => "-DPERL5 -DL_ENDIAN",
1062 ex_libs => add("-ldl"),
1063 bn_ops => "BN_LLONG",
1065 perlasm_scheme => "elf",
1066 thread_scheme => "(unknown)",
1067 dso_scheme => "dlfcn",
1068 shared_target => "bsd-gcc-shared",
1069 shared_cflag => "-fPIC",
1072 #### SCO/Caldera targets.
1074 # Originally we had like unixware-*, unixware-*-pentium, unixware-*-p6, etc.
1075 # Now we only have blended unixware-* as it's the only one used by ./config.
1076 # If you want to optimize for particular microarchitecture, bypass ./config
1077 # and './Configure unixware-7 -Kpentium_pro' or whatever appropriate.
1078 # Note that not all targets include assembler support. Mostly because of
1079 # lack of motivation to support out-of-date platforms with out-of-date
1080 # compiler drivers and assemblers.
1082 # UnixWare 2.0x fails destest with -O.
1084 inherit_from => [ "BASE_unix" ],
1086 cflags => threads("-Kthread"),
1087 lib_cppflags => "-DFILIO_H -DNO_STRINGS_H",
1088 ex_libs => add("-lsocket -lnsl -lresolv -lx"),
1089 thread_scheme => "uithreads",
1092 inherit_from => [ "BASE_unix" ],
1095 cflags => threads("-Kthread"),
1096 lib_cppflags => "-DFILIO_H",
1097 ex_libs => add("-lsocket -lnsl -lresolv -lx"),
1098 thread_scheme => "uithreads",
1101 inherit_from => [ "BASE_unix" ],
1104 cflags => combine("-Kalloca", threads("-Kthread")),
1105 lib_cppflags => "-DFILIO_H",
1106 ex_libs => add("-lsocket -lnsl"),
1107 thread_scheme => "uithreads",
1108 bn_ops => "BN_LLONG",
1110 perlasm_scheme => "elf-1",
1111 dso_scheme => "dlfcn",
1112 shared_target => "svr5-shared",
1113 shared_cflag => "-Kpic",
1115 "unixware-7-gcc" => {
1116 inherit_from => [ "BASE_unix" ],
1118 CFLAGS => "-O3 -fomit-frame-pointer -Wall",
1119 cppflags => add(threads("-D_REENTRANT")),
1120 lib_cppflags => add("-DL_ENDIAN -DFILIO_H"),
1121 ex_libs => add("-lsocket -lnsl"),
1122 bn_ops => "BN_LLONG",
1123 thread_scheme => "pthreads",
1125 perlasm_scheme => "elf-1",
1126 dso_scheme => "dlfcn",
1127 shared_target => "gnu-shared",
1128 shared_cflag => "-fPIC",
1130 # SCO 5 - Ben Laurie says the -O breaks the SCO cc.
1132 inherit_from => [ "BASE_unix" ],
1135 ex_libs => add("-lsocket -lnsl"),
1136 thread_scheme => "(unknown)",
1138 perlasm_scheme => "elf-1",
1139 dso_scheme => "dlfcn",
1140 shared_target => "svr3-shared",
1141 shared_cflag => "-Kpic",
1144 inherit_from => [ "BASE_unix" ],
1146 cflags => "-O3 -fomit-frame-pointer",
1147 ex_libs => add("-lsocket -lnsl"),
1148 bn_ops => "BN_LLONG",
1149 thread_scheme => "(unknown)",
1151 perlasm_scheme => "elf-1",
1152 dso_scheme => "dlfcn",
1153 shared_target => "svr3-shared",
1154 shared_cflag => "-fPIC",
1158 # Below targets assume AIX >=5. Caveat lector. If you are accustomed
1159 # to control compilation "bitness" by setting $OBJECT_MODE environment
1160 # variable, then you should know that in OpenSSL case it's considered
1161 # only in ./config. Once configured, build procedure remains "deaf" to
1162 # current value of $OBJECT_MODE.
1164 inherit_from => [ "BASE_unix" ],
1167 lib_cppflags => "-DB_ENDIAN",
1168 lflags => "-Wl,-bsvr4",
1169 thread_scheme => "pthreads",
1170 dso_scheme => "dlfcn",
1171 shared_target => "aix",
1172 module_ldflags => "-Wl,-G,-bsymbolic,-bnoentry",
1173 shared_ldflag => "-Wl,-G,-bsymbolic,-bnoentry",
1174 shared_defflag => "-Wl,-bE:",
1175 shared_fipsflag => "-Wl,-binitfini:init:cleanup",
1176 perl_platform => 'AIX',
1179 inherit_from => [ "aix-common" ],
1181 CFLAGS => picker(debug => "-O0 -g",
1183 cflags => add(threads("-pthread")),
1184 ex_libs => add(threads("-pthread")),
1185 bn_ops => "BN_LLONG RC4_CHAR",
1186 asm_arch => 'ppc32',
1187 perlasm_scheme => "aix32",
1188 shared_ldflag => add_before("-shared -static-libgcc"),
1190 RANLIB => add("-X32"),
1193 inherit_from => [ "aix-common" ],
1195 CFLAGS => picker(debug => "-O0 -g",
1197 cflags => combine("-maix64", threads("-pthread")),
1198 ex_libs => add(threads("-pthread")),
1199 bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
1200 asm_arch => 'ppc64',
1201 perlasm_scheme => "aix64",
1202 shared_ldflag => add_before("-shared -static-libgcc"),
1203 shared_extension => "64.so.\$(SHLIB_VERSION_NUMBER)",
1205 RANLIB => add("-X64"),
1208 inherit_from => [ "aix-common" ],
1210 CFLAGS => picker(debug => "-O0 -g",
1212 cflags => combine("-q32 -qmaxmem=16384 -qro -qroconst",
1213 threads("-qthreaded")),
1214 cppflags => threads("-D_THREAD_SAFE"),
1215 ex_libs => add(threads("-lpthreads")),
1216 bn_ops => "BN_LLONG RC4_CHAR",
1217 asm_arch => 'ppc32',
1218 perlasm_scheme => "aix32",
1219 shared_cflag => "-qpic",
1221 RANLIB => add("-X32"),
1224 inherit_from => [ "aix-common" ],
1226 CFLAGS => picker(debug => "-O0 -g",
1228 cflags => combine("-q64 -qmaxmem=16384 -qro -qroconst",
1229 threads("-qthreaded")),
1230 cppflags => threads("-D_THREAD_SAFE"),
1231 ex_libs => add(threads("-lpthreads")),
1232 bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
1233 asm_arch => 'ppc64',
1234 perlasm_scheme => "aix64",
1235 dso_scheme => "dlfcn",
1236 shared_cflag => "-qpic",
1237 shared_extension => "64.so.\$(SHLIB_VERSION_NUMBER)",
1239 RANLIB => add("-X64"),
1242 # SIEMENS BS2000/OSD: an EBCDIC-based mainframe
1244 inherit_from => [ "BASE_unix" ],
1247 cflags => "-XLLML -XLLMK -XL",
1248 cppflags => "-DCHARSET_EBCDIC",
1249 lib_cppflags => "-DB_ENDIAN",
1250 ex_libs => add("-lsocket -lnsl"),
1251 bn_ops => "THIRTY_TWO_BIT RC4_CHAR",
1252 thread_scheme => "(unknown)",
1255 #### Visual C targets
1257 # Win64 targets, WIN64I denotes IA-64/Itanium and WIN64A - AMD64
1259 # Note about /wd4090, disable warning C4090. This warning returns false
1260 # positives in some situations. Disabling it altogether masks both
1261 # legitimate and false cases, but as we compile on multiple platforms,
1262 # we rely on other compilers to catch legitimate cases.
1264 # Also note that we force threads no matter what. Configuring "no-threads"
1267 # UNICODE is defined in VC-common and applies to all targets. It used to
1268 # be an opt-in option for VC-WIN32, but not anymore. The original reason
1269 # was because ANSI API was *native* system interface for no longer
1270 # supported Windows 9x. Keep in mind that UNICODE only affects how
1271 # OpenSSL libraries interact with underlying OS, it doesn't affect API
1272 # that OpenSSL presents to application.
1275 inherit_from => [ "BASE_Windows" ],
1278 CPP => '$(CC) /EP /C',
1279 CFLAGS => "/W3 /wd4090 /nologo",
1282 LDFLAGS => "/nologo /debug",
1283 ldoutflag => "/out:",
1285 ARFLAGS => "/nologo",
1286 aroutflag => "/out:",
1287 defines => add("OPENSSL_SYS_WIN32", "WIN32_LEAN_AND_MEAN",
1288 "UNICODE", "_UNICODE",
1289 "_CRT_SECURE_NO_DEPRECATE",
1290 "_WINSOCK_DEPRECATED_NO_WARNINGS"),
1291 lib_cflags => add("/Zi /Fdossl_static.pdb"),
1292 lib_defines => add("L_ENDIAN"),
1293 dso_cflags => "/Zi /Fddso.pdb",
1294 bin_cflags => "/Zi /Fdapp.pdb",
1295 # def_flag made to empty string so a .def file gets generated
1296 shared_defflag => '',
1297 shared_ldflag => "/dll",
1298 shared_target => "win-shared", # meaningless except it gives Configure a hint
1299 thread_scheme => "winthreads",
1300 dso_scheme => "win32",
1301 perl_platform => 'Windows::MSVC',
1302 # additional parameter to build_scheme denotes install-path "flavour"
1303 build_scheme => add("VC-common", { separator => undef }),
1305 "VC-noCE-common" => {
1306 inherit_from => [ "VC-common" ],
1308 CFLAGS => add(picker(debug => '/Od',
1310 cflags => add(picker(default => '/Gs0 /GF /Gy',
1313 ($disabled{shared} ? "" : "/MDd");
1317 ($disabled{shared} ? "" : "/MD");
1319 defines => add(picker(default => [], # works as type cast
1320 debug => [ "DEBUG", "_DEBUG" ])),
1321 lib_cflags => add(sub { $disabled{shared} ? "/MT /Zl" : () }),
1322 # Following might/should appears controversial, i.e. defining
1323 # /MDd without evaluating $disabled{shared}. It works in
1324 # non-shared build because static library is compiled with /Zl
1325 # and bares no reference to specific RTL. And it works in
1326 # shared build because multiple /MDd options are not prohibited.
1327 # But why /MDd in static build? Well, basically this is just a
1328 # reference point, which allows to catch eventual errors that
1329 # would prevent those who want to wrap OpenSSL into own .DLL.
1330 # Why not /MD in release build then? Well, some are likely to
1331 # prefer [non-debug] openssl.exe to be free from Micorosoft RTL
1333 bin_cflags => add(picker(debug => "/MDd",
1334 release => sub { $disabled{shared} ? "/MT" : () },
1336 bin_lflags => add("/subsystem:console /opt:ref"),
1337 ex_libs => add(sub {
1339 push @ex_libs, 'ws2_32.lib' unless $disabled{sock};
1340 push @ex_libs, 'gdi32.lib advapi32.lib crypt32.lib user32.lib';
1341 return join(" ", @ex_libs);
1344 "VC-WIN64-common" => {
1345 inherit_from => [ "VC-noCE-common" ],
1347 ex_libs => add(sub {
1349 push @ex_libs, 'bufferoverflowu.lib' if (`cl 2>&1` =~ /14\.00\.4[0-9]{4}\./);
1350 return join(" ", @_, @ex_libs);
1352 bn_ops => add("SIXTY_FOUR_BIT"),
1355 inherit_from => [ "VC-WIN64-common" ],
1357 ASFLAGS => "-d debug",
1360 uplink_arch => 'ia64',
1362 perlasm_scheme => "ias",
1363 multilib => "-ia64",
1366 inherit_from => [ "VC-WIN64-common" ],
1367 AS => sub { vc_win64a_info()->{AS} },
1368 ASFLAGS => sub { vc_win64a_info()->{ASFLAGS} },
1369 asoutflag => sub { vc_win64a_info()->{asoutflag} },
1370 asflags => sub { vc_win64a_info()->{asflags} },
1372 uplink_arch => 'x86_64',
1373 asm_arch => 'x86_64',
1374 perlasm_scheme => "auto",
1378 inherit_from => [ "VC-noCE-common" ],
1379 AS => sub { vc_win32_info()->{AS} },
1380 ASFLAGS => sub { vc_win32_info()->{ASFLAGS} },
1381 asoutflag => sub { vc_win32_info()->{asoutflag} },
1382 asflags => sub { vc_win32_info()->{asflags} },
1384 bn_ops => add("BN_LLONG"),
1385 uplink_arch => 'common',
1387 perlasm_scheme => sub { vc_win32_info()->{perlasm_scheme} },
1388 # "WOW" stands for "Windows on Windows", and "VC-WOW" engages
1389 # some installation path heuristics in windows-makefile.tmpl...
1390 build_scheme => add("VC-WOW", { separator => undef }),
1393 inherit_from => [ "VC-common" ],
1394 CFLAGS => add(picker(debug => "/Od",
1395 release => "/O1i")),
1396 CPPDEFINES => picker(debug => [ "DEBUG", "_DEBUG" ]),
1397 LDFLAGS => add("/nologo /opt:ref"),
1400 sub { vc_wince_info()->{cflags}; },
1401 sub { `cl 2>&1` =~ /Version ([0-9]+)\./ && $1>=14
1402 ? ($disabled{shared} ? " /MT" : " /MD")
1404 cppflags => sub { vc_wince_info()->{cppflags}; },
1405 lib_defines => add("NO_CHMOD", "OPENSSL_SMALL_FOOTPRINT"),
1406 lib_cppflags => sub { vc_wince_info()->{cppflags}; },
1408 add(combine(sub { defined(env('WCECOMPAT'))
1409 ? '$(WCECOMPAT)/include' : (); },
1410 sub { defined(env('PORTSDK_LIBPATH'))
1411 ? '$(PORTSDK_LIBPATH)/../../include'
1413 lflags => add(combine(sub { vc_wince_info()->{lflags}; },
1414 sub { defined(env('PORTSDK_LIBPATH'))
1415 ? "/entry:mainCRTstartup" : (); })),
1417 bn_ops => add("BN_LLONG"),
1418 ex_libs => add(sub {
1420 push @ex_libs, 'ws2.lib' unless $disabled{sock};
1421 push @ex_libs, 'crypt32.lib';
1422 if (defined(env('WCECOMPAT'))) {
1423 my $x = '$(WCECOMPAT)/lib';
1424 if (-f "$x/env('TARGETCPU')/wcecompatex.lib") {
1425 $x .= '/$(TARGETCPU)/wcecompatex.lib';
1427 $x .= '/wcecompatex.lib';
1431 push @ex_libs, '$(PORTSDK_LIBPATH)/portlib.lib'
1432 if (defined(env('PORTSDK_LIBPATH')));
1433 push @ex_libs, '/nodefaultlib coredll.lib corelibc.lib'
1434 if (env('TARGETCPU') =~ /^X86|^ARMV4[IT]/);
1435 return join(" ", @ex_libs);
1441 inherit_from => [ 'BASE_unix' ],
1444 CFLAGS => picker(default => "-Wall",
1447 cppflags => combine("-DUNICODE -D_UNICODE -DWIN32_LEAN_AND_MEAN",
1449 lib_cppflags => "-DL_ENDIAN",
1450 ex_libs => add("-lws2_32 -lgdi32 -lcrypt32"),
1451 thread_scheme => "winthreads",
1452 dso_scheme => "win32",
1453 shared_target => "mingw-shared",
1454 shared_cppflags => add("_WINDLL"),
1455 shared_ldflag => "-static-libgcc",
1457 perl_platform => 'mingw',
1460 inherit_from => [ "mingw-common" ],
1461 CFLAGS => add(picker(release => "-fomit-frame-pointer")),
1463 sys_id => "MINGW32",
1464 bn_ops => add("BN_LLONG"),
1466 uplink_arch => 'x86',
1467 perlasm_scheme => "coff",
1468 shared_rcflag => "--target=pe-i386",
1472 # As for uplink_arch. Applink makes it possible to use
1473 # .dll compiled with one compiler with application compiled with
1474 # another compiler. It's possible to engage Applink support in
1475 # mingw64 build, but it's not done, because until mingw64
1476 # supports structured exception handling, one can't seriously
1477 # consider its binaries for using with non-mingw64 run-time
1478 # environment. And as mingw64 is always consistent with itself,
1479 # Applink is never engaged and can as well be omitted.
1480 inherit_from => [ "mingw-common" ],
1482 sys_id => "MINGW64",
1483 bn_ops => add("SIXTY_FOUR_BIT"),
1484 asm_arch => 'x86_64',
1485 uplink_arch => undef,
1486 perlasm_scheme => "mingw64",
1487 shared_rcflag => "--target=pe-x86-64",
1493 inherit_from => [ "BASE_unix" ],
1496 lib_cppflags => "-DL_ENDIAN",
1500 inherit_from => [ "UEFI" ],
1502 perlasm_scheme => "win32n",
1505 inherit_from => [ "UEFI" ],
1506 asm_arch => 'x86_64',
1507 perlasm_scheme => "nasm",
1512 inherit_from => [ "BASE_unix" ],
1514 CFLAGS => "-O -Wall",
1515 lib_cppflags => "-DTERMIOS -DL_ENDIAN",
1517 bn_ops => "BN_LLONG",
1518 dso_scheme => "win32",
1522 "Cygwin-common" => {
1523 inherit_from => [ "BASE_unix" ],
1527 CFLAGS => picker(default => "-Wall",
1530 lib_cppflags => "-DTERMIOS -DL_ENDIAN",
1532 thread_scheme => "pthread",
1533 dso_scheme => "dlfcn",
1534 shared_target => "cygwin-shared",
1535 shared_cppflags => "-D_WINDLL",
1537 perl_platform => 'Cygwin',
1540 inherit_from => [ "Cygwin-common" ],
1541 CFLAGS => add(picker(release => "-O3 -fomit-frame-pointer")),
1542 bn_ops => "BN_LLONG",
1544 perlasm_scheme => "coff",
1546 "Cygwin-x86_64" => {
1547 inherit_from => [ "Cygwin-common" ],
1549 bn_ops => "SIXTY_FOUR_BIT_LONG",
1550 asm_arch => 'x86_64',
1551 perlasm_scheme => "mingw64",
1553 # Backward compatibility for those using this target
1555 inherit_from => [ "Cygwin-x86" ]
1557 # In case someone constructs the Cygwin target name themself
1559 inherit_from => [ "Cygwin-x86" ]
1562 inherit_from => [ "Cygwin-x86" ]
1565 inherit_from => [ "Cygwin-x86" ]
1568 inherit_from => [ "Cygwin-x86" ]
1571 ##### MacOS X (a.k.a. Darwin) setup
1572 "darwin-common" => {
1573 inherit_from => [ "BASE_unix" ],
1576 CFLAGS => picker(debug => "-g -O0",
1578 cppflags => threads("-D_REENTRANT"),
1579 lflags => add("-Wl,-search_paths_first"),
1581 bn_ops => "BN_LLONG RC4_CHAR",
1582 thread_scheme => "pthreads",
1583 perlasm_scheme => "osx32",
1584 dso_scheme => "dlfcn",
1585 ranlib => "ranlib -c",
1586 shared_target => "darwin-shared",
1587 shared_cflag => "-fPIC",
1588 shared_extension => ".\$(SHLIB_VERSION_NUMBER).dylib",
1590 # Option "freeze" such as -std=gnu9x can't negatively interfere
1591 # with future defaults for below two targets, because MacOS X
1592 # for PPC has no future, it was discontinued by vendor in 2009.
1593 "darwin-ppc-cc" => { inherit_from => [ "darwin-ppc" ] }, # Historic alias
1595 inherit_from => [ "darwin-common" ],
1596 cflags => add("-arch ppc -std=gnu9x -Wa,-force_cpusubtype_ALL"),
1597 lib_cppflags => add("-DB_ENDIAN"),
1598 shared_cflag => add("-fno-common"),
1599 asm_arch => 'ppc32',
1600 perlasm_scheme => "osx32",
1602 "darwin64-ppc-cc" => { inherit_from => [ "darwin64-ppc" ] }, # Historic alias
1604 inherit_from => [ "darwin-common" ],
1605 cflags => add("-arch ppc64 -std=gnu9x"),
1606 lib_cppflags => add("-DB_ENDIAN"),
1607 bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
1608 asm_arch => 'ppc64',
1609 perlasm_scheme => "osx64",
1611 "darwin-i386-cc" => { inherit_from => [ "darwin-i386" ] }, # Historic alias
1613 inherit_from => [ "darwin-common" ],
1614 CFLAGS => add(picker(release => "-fomit-frame-pointer")),
1615 cflags => add("-arch i386"),
1616 lib_cppflags => add("-DL_ENDIAN"),
1617 bn_ops => "BN_LLONG RC4_INT",
1619 perlasm_scheme => "macosx",
1621 "darwin64-x86_64-cc" => { inherit_from => [ "darwin64-x86_64" ] }, # Historic alias
1622 "darwin64-x86_64" => {
1623 inherit_from => [ "darwin-common" ],
1624 CFLAGS => add("-Wall"),
1625 cflags => add("-arch x86_64"),
1626 lib_cppflags => add("-DL_ENDIAN"),
1627 bn_ops => "SIXTY_FOUR_BIT_LONG",
1628 asm_arch => 'x86_64',
1629 perlasm_scheme => "macosx",
1631 "darwin64-arm64-cc" => { inherit_from => [ "darwin64-arm64" ] }, # "Historic" alias
1632 "darwin64-arm64" => {
1633 inherit_from => [ "darwin-common" ],
1634 CFLAGS => add("-Wall"),
1635 cflags => add("-arch arm64"),
1636 lib_cppflags => add("-DL_ENDIAN"),
1637 bn_ops => "SIXTY_FOUR_BIT_LONG",
1638 asm_arch => 'aarch64',
1639 perlasm_scheme => "ios64",
1644 inherit_from => [ "BASE_unix" ],
1646 CFLAGS => "-O3 -fomit-frame-pointer -Wall",
1647 cflags => threads("-pthread"),
1648 lib_cppflags => "-DL_ENDIAN",
1649 ex_libs => add("-ldl", threads("-pthread")),
1650 bn_ops => "BN_LLONG",
1652 perlasm_scheme => 'elf',
1653 thread_scheme => "pthreads",
1654 dso_scheme => "dlfcn",
1655 shared_target => "linux-shared",
1656 shared_cflag => "-fPIC",
1659 ##### VxWorks for various targets
1660 "vxworks-ppc60x" => {
1661 inherit_from => [ "BASE_unix" ],
1663 CFLAGS => "-O2 -Wall -fstrength-reduce",
1664 cflags => "-mrtp -mhard-float -mstrict-align -fno-implicit-fp -fno-builtin -fno-strict-aliasing",
1665 cppflags => combine("-D_REENTRANT -DPPC32_fp60x -DCPU=PPC32",
1666 "_DTOOL_FAMILY=gnu -DTOOL=gnu",
1667 "-I\$(WIND_BASE)/target/usr/h",
1668 "-I\$(WIND_BASE)/target/usr/h/wrn/coreip"),
1669 sys_id => "VXWORKS",
1670 lflags => add("-L \$(WIND_BASE)/target/usr/lib/ppc/PPC32/common"),
1671 ex_libs => add("-Wl,--defsym,__wrs_rtp_base=0xe0000000"),
1673 "vxworks-ppcgen" => {
1674 inherit_from => [ "BASE_unix" ],
1676 CFLAGS => "-O1 -Wall",
1677 cflags => "-mrtp -msoft-float -mstrict-align -fno-builtin -fno-strict-aliasing",
1678 cppflags => combine("-D_REENTRANT -DPPC32 -DCPU=PPC32",
1679 "-DTOOL_FAMILY=gnu -DTOOL=gnu",
1680 "-I\$(WIND_BASE)/target/usr/h",
1681 "-I\$(WIND_BASE)/target/usr/h/wrn/coreip"),
1682 sys_id => "VXWORKS",
1683 lflags => add("-L \$(WIND_BASE)/target/usr/lib/ppc/PPC32/sfcommon"),
1684 ex_libs => add("-Wl,--defsym,__wrs_rtp_base=0xe0000000"),
1686 "vxworks-ppc405" => {
1687 inherit_from => [ "BASE_unix" ],
1690 cflags => "-msoft-float -mlongcall",
1691 cppflags => combine("-D_REENTRANT -DPPC32 -DCPU=PPC405",
1692 "-DTOOL_FAMILY=gnu -DTOOL=gnu",
1693 "-I\$(WIND_BASE)/target/h"),
1694 sys_id => "VXWORKS",
1695 lflags => add("-r"),
1697 "vxworks-ppc750" => {
1698 inherit_from => [ "BASE_unix" ],
1700 CFLAGS => "-ansi -fvolatile -Wall \$(DEBUG_FLAG)",
1701 cflags => "-nostdinc -fno-builtin -fno-for-scope -fsigned-char -msoft-float -mlongcall",
1702 cppflags => combine("-DPPC750 -D_REENTRANT -DCPU=PPC604",
1703 "-I\$(WIND_BASE)/target/h"),
1704 sys_id => "VXWORKS",
1705 lflags => add("-r"),
1707 "vxworks-ppc750-debug" => {
1708 inherit_from => [ "BASE_unix" ],
1710 CFLAGS => "-ansi -fvolatile -Wall -g",
1711 cflags => "-nostdinc -fno-builtin -fno-for-scope -fsigned-char -msoft-float -mlongcall",
1712 cppflags => combine("-DPPC750 -D_REENTRANT -DCPU=PPC604",
1713 "-DPEDANTIC -DDEBUG",
1714 "-I\$(WIND_BASE)/target/h"),
1715 sys_id => "VXWORKS",
1716 lflags => add("-r"),
1718 "vxworks-ppc860" => {
1719 inherit_from => [ "BASE_unix" ],
1721 cflags => "-nostdinc -msoft-float",
1722 cppflags => combine("-DCPU=PPC860 -DNO_STRINGS_H",
1723 "-I\$(WIND_BASE)/target/h"),
1724 sys_id => "VXWORKS",
1725 lflags => add("-r"),
1727 "vxworks-simlinux" => {
1728 inherit_from => [ "BASE_unix" ],
1730 cflags => "-B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/ -fno-builtin -fno-defer-pop",
1731 cppflags => combine("-D_VSB_CONFIG_FILE=\"\$(WIND_BASE)/target/lib/h/config/vsbConfig.h\"",
1732 "-DL_ENDIAN -DCPU=SIMLINUX -DNO_STRINGS_H",
1733 "-DTOOL_FAMILY=gnu -DTOOL=gnu",
1734 "-DOPENSSL_NO_HW_PADLOCK",
1735 "-I\$(WIND_BASE)/target/h",
1736 "-I\$(WIND_BASE)/target/h/wrn/coreip"),
1737 sys_id => "VXWORKS",
1738 lflags => add("-r"),
1739 ranlib => "ranlibpentium",
1742 inherit_from => [ "BASE_unix" ],
1744 CFLAGS => "-O -G 0",
1745 cflags => "-mrtp -mips2 -B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/ -msoft-float -mno-branch-likely -fno-builtin -fno-defer-pop",
1746 cppflags => combine("-D_VSB_CONFIG_FILE=\"\$(WIND_BASE)/target/lib/h/config/vsbConfig.h\"",
1747 "-DCPU=MIPS32 -DNO_STRINGS_H",
1748 "-DTOOL_FAMILY=gnu -DTOOL=gnu",
1749 "-DOPENSSL_NO_HW_PADLOCK",
1750 threads("-D_REENTRANT"),
1751 "-I\$(WIND_BASE)/target/h",
1752 "-I\$(WIND_BASE)/target/h/wrn/coreip"),
1753 sys_id => "VXWORKS",
1754 lflags => add("-L \$(WIND_BASE)/target/usr/lib/mips/MIPSI32/sfcommon"),
1755 ex_libs => add("-Wl,--defsym,__wrs_rtp_base=0xe0000000"),
1756 thread_scheme => "pthreads",
1757 asm_arch => 'mips32',
1758 perlasm_scheme => "o32",
1759 ranlib => "ranlibmips",
1764 inherit_from => [ "BASE_unix" ],
1765 CC => sub { env('CC') },
1766 cppflags => threads("-D_REENTRANT"),
1767 ex_libs => add("\$(LDLIBS)"),
1768 bn_ops => "BN_LLONG",
1769 thread_scheme => "pthreads",
1770 dso_scheme => sub { env('LIBSSL_dlfcn') },
1771 shared_target => "linux-shared",
1772 shared_cflag => "-fPIC",
1773 ranlib => sub { env('RANLIB') },
1775 "uClinux-dist64" => {
1776 inherit_from => [ "BASE_unix" ],
1777 CC => sub { env('CC') },
1778 cppflags => threads("-D_REENTRANT"),
1779 ex_libs => add("\$(LDLIBS)"),
1780 bn_ops => "SIXTY_FOUR_BIT_LONG",
1781 thread_scheme => "pthreads",
1782 dso_scheme => sub { env('LIBSSL_dlfcn') },
1783 shared_target => "linux-shared",
1784 shared_cflag => "-fPIC",
1785 ranlib => sub { env('RANLIB') },
1789 # Most things happen in vms-generic.
1790 # Note that vms_info extracts the pointer size from the end of
1791 # the target name, and will assume that anything matching /-p\d+$/
1792 # indicates the pointer size setting for the desired target.
1794 inherit_from => [ "BASE_VMS" ],
1797 CPP => '$(CC)/PREPROCESS_ONLY=SYS$OUTPUT:',
1799 combine(picker(default => "/STANDARD=(ISOC94,RELAXED)/NOLIST/PREFIX=ALL",
1800 debug => "/NOOPTIMIZE/DEBUG",
1801 release => "/OPTIMIZE/NODEBUG"),
1802 sub { my @warnings =
1803 @{vms_info()->{disable_warns}};
1805 ? "/WARNINGS=DISABLE=(".join(",",@warnings).")" : (); }),
1807 add("OPENSSL_USE_NODELETE",
1809 return vms_info()->{def_zlib}
1810 ? "LIBZ=\"\"\"".vms_info()->{def_zlib}."\"\"\"" : ();
1812 lflags => picker(default => "/MAP='F\$PARSE(\".MAP\",\"\$\@\")'",
1813 debug => "/DEBUG/TRACEBACK",
1814 release => "/NODEBUG/NOTRACEBACK"),
1815 # Because of dso_cflags below, we can't set the generic |cflags| here,
1816 # as it can't be overridden, so we set separate C flags for libraries
1817 # and binaries instead.
1818 bin_cflags => add("/NAMES=(AS_IS,SHORTENED)/EXTERN_MODEL=STRICT_REFDEF"),
1819 lib_cflags => add("/NAMES=(AS_IS,SHORTENED)/EXTERN_MODEL=STRICT_REFDEF"),
1820 # For modules specifically, we assume that they only use public
1821 # OpenSSL symbols, and therefore don't need to mangle names on
1824 ex_libs => add(sub { return vms_info()->{zlib} || (); }),
1825 shared_target => "vms-shared",
1826 # def_flag made to empty string so a .opt file gets generated
1827 shared_defflag => '',
1828 dso_scheme => "vms",
1829 thread_scheme => "pthreads",
1831 AS => sub { vms_info()->{AS} },
1832 ASFLAGS => sub { vms_info()->{ASFLAGS} },
1833 asoutflag => sub { vms_info()->{asoutflag} },
1834 asflags => sub { vms_info()->{asflags} },
1835 perlasm_scheme => sub { vms_info()->{perlasm_scheme} },
1837 disable => add('pinshared'),
1841 # From HELP CC/POINTER_SIZE:
1844 # LONG[=ARGV] The compiler assumes 64-bit pointers. If the ARGV option to
1845 # LONG or 64 is present, the main argument argv will be an
1846 # array of long pointers instead of an array of short pointers.
1848 # 64[=ARGV] Same as LONG.
1851 # We don't want the hassle of dealing with 32-bit pointers with argv, so
1852 # we force it to have 64-bit pointers, see the added cflags in the -p64
1853 # config targets below.
1856 inherit_from => [ "vms-generic" ],
1857 bn_ops => "SIXTY_FOUR_BIT RC4_INT",
1860 "vms-alpha-p32" => {
1861 inherit_from => [ "vms-alpha" ],
1862 cflags => add("/POINTER_SIZE=32"),
1863 pointer_size => "32",
1865 "vms-alpha-p64" => {
1866 inherit_from => [ "vms-alpha" ],
1867 cflags => add("/POINTER_SIZE=64=ARGV"),
1868 pointer_size => "64",
1871 inherit_from => [ "vms-generic" ],
1872 bn_ops => "SIXTY_FOUR_BIT RC4_INT",
1873 asm_arch => sub { vms_info()->{AS} ? 'ia64' : undef },
1874 perlasm_scheme => 'ias',
1879 inherit_from => [ "vms-ia64" ],
1880 cflags => add("/POINTER_SIZE=32"),
1881 pointer_size => "32",
1884 inherit_from => [ "vms-ia64" ],
1885 cflags => add("/POINTER_SIZE=64=ARGV"),
1886 pointer_size => "64",