QUIC Test Server: Basic echo server test
[openssl.git] / Configurations / 10-main.conf
1 ## -*- mode: perl; -*-
2 ## Standard openssl configuration targets.
3
4 # Helper functions for the Windows configs
5 my $vc_win64a_info = {};
6 sub 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",
10                                 ASFLAGS   => "-g",
11                                 asflags   => "-Ox -f win64 -DNEAR",
12                                 asoutflag => "-o " };
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",
18                                 asoutflag => "/Fo" };
19         } else {
20             $die->("NASM not found - make sure it's installed and available on %PATH%\n");
21             $vc_win64a_info = { AS        => "{unknown}",
22                                 ASFLAGS   => "",
23                                 asflags   => "",
24                                 asoutflag => "" };
25         }
26     }
27     return $vc_win64a_info;
28 }
29
30 my $vc_win32_info = {};
31 sub 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",
37                                ASFLAGS   => "",
38                                asflags   => "-f win32",
39                                asoutflag => "-o ",
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",
46                                asoutflag => "/Fo",
47                                perlasm_scheme => "win32" };
48         } else {
49             $die->("NASM not found - make sure it's installed and available on %PATH%\n");
50             $vc_win32_info = { AS        => "{unknown}",
51                                ASFLAGS   => "",
52                                asflags   => "",
53                                asoutflag => "",
54                                perlasm_scheme => "win32" };
55         }
56     }
57     return $vc_win32_info;
58 }
59
60 my $vc_wince_info = {};
61 sub vc_wince_info {
62     unless (%$vc_wince_info) {
63         # sanity check
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')));
67
68         #
69         # Idea behind this is to mimic flags set by eVC++ IDE...
70         #
71         my $wcevers = env('OSVERSION');                     # WCENNN
72         my $wcevernum;
73         my $wceverdotnum;
74         if ($wcevers =~ /^WCE([1-9])([0-9]{2})$/) {
75             $wcevernum = "$1$2";
76             $wceverdotnum = "$1.$2";
77         } else {
78             $die->('%OSVERSION% value is insane');
79             $wcevernum = "{unknown}";
80             $wceverdotnum = "{unknown}";
81         }
82         my $wcecdefs = "-D_WIN32_WCE=$wcevernum -DUNDER_CE=$wcevernum"; # -D_WIN32_WCE=NNN
83         my $wcelflag = "/subsystem:windowsce,$wceverdotnum";        # ...,N.NN
84
85         my $wceplatf =  env('PLATFORM');
86
87         $wceplatf =~ tr/a-z0-9 /A-Z0-9_/;
88         $wcecdefs .= " -DWCE_PLATFORM_$wceplatf";
89
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; };
116       }
117
118         $vc_wince_info = { cppflags => $wcecdefs,
119                            lflags => $wcelflag };
120     }
121     return $vc_wince_info;
122 }
123
124 # Helper functions for the VMS configs
125 my $vms_info = {};
126 sub vms_info {
127     my $pointer_size_str = $config{target} =~ m|-p(\d+)$| ? $1 : "";
128
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
131     # size changes.
132     if (%$vms_info && $vms_info->{pointer_size} ne $pointer_size_str) {
133         $vms_info = {};
134     }
135
136     unless (%$vms_info) {
137         $vms_info->{disable_warns} = [
138             "CXXPRAGMANA",      # Shut up about unknown / unsupported pragmas
139         ];
140         $vms_info->{pointer_size} = $pointer_size_str;
141         if ($pointer_size_str eq "64") {
142             `PIPE CC /NOCROSS_REFERENCE /NOLIST /NOOBJECT /WARNINGS = DISABLE = ( MAYLOSEDATA3, EMPTYFILE ) NL: 2> NL:`;
143             if ($? == 0) {
144                 push @{$vms_info->{disable_warns}}, "MAYLOSEDATA3";
145             }
146         }
147
148         unless ($disabled{zlib}) {
149             my $default_zlib = 'GNV$LIBZSHR' . $pointer_size_str;
150             if (defined($disabled{"zlib-dynamic"})) {
151                 $vms_info->{zlib} = $withargs{zlib_lib} || "$default_zlib/SHARE";
152             } else {
153                 $vms_info->{def_zlib} = $withargs{zlib_lib} || $default_zlib;
154                 # In case the --with-zlib-lib value contains something like
155                 # /SHARE or /LIB or so at the end, remove it.
156                 $vms_info->{def_zlib} =~ s|/.*$||g;
157             }
158         }
159
160         if ($config{target} =~ /-ia64/) {
161             `PIPE ias -H 2> NL:`;
162             if ($? == 0) {
163                 $vms_info->{AS} = "ias";
164                 $vms_info->{ASFLAGS} = '-d debug';
165                 $vms_info->{asflags} = '"-N" vms_upcase';
166                 $vms_info->{asoutflag} = "-o ";
167                 $vms_info->{perlasm_scheme} = "ias";
168             }
169         }
170     }
171     return $vms_info;
172 }
173
174 my %targets = (
175
176 #### Basic configs that should work on any 32-bit box
177     "gcc" => {
178         inherit_from     => [ "BASE_unix" ],
179         CC               => "gcc",
180         CFLAGS           => picker(debug   => "-O0 -g",
181                                    release => "-O3"),
182         thread_scheme    => "(unknown)",
183         bn_ops           => "BN_LLONG",
184     },
185     "cc" => {
186         inherit_from     => [ "BASE_unix" ],
187         CC               => "cc",
188         CFLAGS           => "-O",
189         thread_scheme    => "(unknown)",
190     },
191
192 #### VOS Configurations
193     "vos-gcc" => {
194         inherit_from     => [ "BASE_unix" ],
195         CC               => "gcc",
196         CFLAGS           => picker(default => "-Wall",
197                                    debug   => "-O0 -g",
198                                    release => "-O3"),
199         cppflags         => "-D_POSIX_C_SOURCE=200112L -D_BSD -D_VOS_EXTENDED_NAMES",
200         lib_cppflags     => "-DB_ENDIAN",
201         thread_scheme    => "(unknown)",
202         sys_id           => "VOS",
203         lflags           => add("-Wl,-map"),
204         bn_ops           => "BN_LLONG",
205         shared_extension => ".so",
206     },
207
208 #### Solaris configurations
209     "solaris-common" => {
210         inherit_from     => [ "BASE_unix" ],
211         template         => 1,
212         lib_cppflags     => "-DFILIO_H",
213         ex_libs          => add("-lsocket -lnsl -ldl"),
214         dso_scheme       => "dlfcn",
215         thread_scheme    => "pthreads",
216     },
217 #### Solaris common with Sun C setups
218     "solaris-common-cc" => {
219         inherit_from     => [ "solaris-common" ],
220         template         => 1,
221         shared_target    => "solaris",
222         shared_ldflag    => "-Wl,-Bsymbolic",
223         shared_defflag   => "-Wl,-M,",
224         shared_sonameflag=> "-Wl,-h,",
225     },
226 #### Solaris common with GNU C setups
227     "solaris-common-gcc" => {
228         inherit_from     => [ "solaris-common" ],
229         template         => 1,
230         shared_target    => "solaris-gcc-shared", # The rest is on shared_info.pl
231     },
232 #### Solaris x86 with GNU C setups
233     "solaris-x86-gcc" => {
234         # NB. GNU C has to be configured to use GNU assembler, and not
235         # /usr/ccs/bin/as. Failure to comply will result in compile
236         # failures [at least] in 32-bit build.
237         inherit_from     => [ "solaris-common-gcc" ],
238         CC               => "gcc",
239         CFLAGS           => add_before(picker(default => "-Wall",
240                                               debug   => "-O0 -g",
241                                               release => "-O3 -fomit-frame-pointer")),
242         lib_cppflags     => add("-DL_ENDIAN"),
243         bn_ops           => "BN_LLONG",
244         shared_cflag     => "-fPIC",
245         shared_ldflag    => add_before("-shared -static-libgcc"),
246         asm_arch         => 'x86',
247         perlasm_scheme   => 'elf',
248     },
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" ],
259         CC               => "gcc",
260         CFLAGS           => add_before(picker(default => "-Wall",
261                                               debug   => "-O0 -g",
262                                               release => "-O3")),
263         cflags           => add("-m64"),
264         lib_cppflags     => add("-DL_ENDIAN"),
265         bn_ops           => "SIXTY_FOUR_BIT_LONG",
266         asm_arch         => 'x86_64',
267         perlasm_scheme   => "elf",
268         shared_cflag     => "-fPIC",
269         shared_ldflag    => add_before("-shared -static-libgcc"),
270         multilib         => "/64",
271     },
272
273 #### Solaris x86 with Sun C setups
274     # There used to be solaris-x86-cc target, but it was removed,
275     # primarily because vendor assembler can't assemble our modules
276     # with -KPIC flag. As result it, assembly support, was not even
277     # available as option. But its lack means lack of side-channel
278     # resistant code, which is incompatible with security by today's
279     # standards. Fortunately gcc is readily available prepackaged
280     # option, which we can firmly point at...
281     #
282     # On related note, solaris64-x86_64-cc target won't compile code
283     # paths utilizing AVX and post-Haswell instruction extensions.
284     # Consider switching to solaris64-x86_64-gcc even here...
285     #
286     "solaris64-x86_64-cc" => {
287         inherit_from     => [ "solaris-common-cc" ],
288         CC               => "cc",
289         CFLAGS           => add_before(picker(debug   => "-g",
290                                               release => "-xO5 -xdepend -xbuiltin")),
291         cflags           => add_before("-xarch=generic64 -xstrconst -Xa"),
292         cppflags         => add(threads("-D_REENTRANT")),
293         lib_cppflags     => add("-DL_ENDIAN"),
294         thread_scheme    => "pthreads",
295         lflags           => add(threads("-mt")),
296         bn_ops           => "SIXTY_FOUR_BIT_LONG",
297         asm_arch         => 'x86_64',
298         perlasm_scheme   => "elf",
299         shared_cflag     => "-KPIC",
300         shared_ldflag    => add_before("-G -dy -z text"),
301         multilib         => "/64",
302     },
303
304 #### SPARC Solaris with GNU C setups
305     "solaris-sparcv7-gcc" => {
306         inherit_from     => [ "solaris-common-gcc" ],
307         CC               => "gcc",
308         CFLAGS           => add_before(picker(default => "-Wall",
309                                               debug   => "-O0 -g",
310                                               release => "-O3")),
311         lib_cppflags     => add("-DB_ENDIAN -DBN_DIV2W"),
312         bn_ops           => "BN_LLONG RC4_CHAR",
313         shared_cflag     => "-fPIC",
314         shared_ldflag    => add_before("-shared -static-libgcc"),
315     },
316     "solaris-sparcv8-gcc" => {
317         inherit_from     => [ "solaris-sparcv7-gcc" ],
318         cflags           => add_before("-mcpu=v8"),
319         asm_arch         => 'sparcv8',
320         perlasm_scheme   => 'void',
321     },
322     "solaris-sparcv9-gcc" => {
323         # -m32 should be safe to add as long as driver recognizes
324         # -mcpu=ultrasparc
325         inherit_from     => [ "solaris-sparcv7-gcc" ],
326         cflags           => add_before("-m32 -mcpu=ultrasparc"),
327         asm_arch         => 'sparcv9',
328         perlasm_scheme   => 'void',
329     },
330     "solaris64-sparcv9-gcc" => {
331         inherit_from     => [ "solaris-sparcv9-gcc" ],
332         cflags           => sub { my $f=join(" ",@_); $f =~ s/\-m32/-m64/; $f; },
333         bn_ops           => "BN_LLONG RC4_CHAR",
334         multilib         => "/64",
335     },
336
337 #### SPARC Solaris with Sun C setups
338 # SC4.0 doesn't pass 'make test', upgrade to SC5.0 or SC4.2.
339 # SC4.2 is ok, better than gcc even on bn as long as you tell it -xarch=v8
340 # SC5.0 note: Compiler common patch 107357-01 or later is required!
341     "solaris-sparcv7-cc" => {
342         inherit_from     => [ "solaris-common-cc" ],
343         CC               => "cc",
344         CFLAGS           => add_before(picker(debug   => "-g",
345                                               release => "-xO5 -xdepend")),
346         cflags           => add_before("-xstrconst -Xa"),
347         cppflags         => add(threads("-D_REENTRANT")),
348         lib_cppflags     => add("-DB_ENDIAN -DBN_DIV2W"),
349         lflags           => add(threads("-mt")),
350         bn_ops           => "BN_LLONG RC4_CHAR",
351         shared_cflag     => "-KPIC",
352         shared_ldflag    => add_before("-G -dy -z text"),
353     },
354 ####
355     "solaris-sparcv8-cc" => {
356         inherit_from     => [ "solaris-sparcv7-cc" ],
357         cflags           => add_before("-xarch=v8"),
358         asm_arch         => 'sparcv8',
359         perlasm_scheme   => 'void',
360     },
361     "solaris-sparcv9-cc" => {
362         inherit_from     => [ "solaris-sparcv7-cc" ],
363         cflags           => add_before("-xarch=v8plus"),
364         asm_arch         => 'sparcv9',
365         perlasm_scheme   => 'void',
366     },
367     "solaris64-sparcv9-cc" => {
368         inherit_from     => [ "solaris-sparcv7-cc" ],
369         cflags           => add_before("-m64 -xarch=sparc"),
370         bn_ops           => "BN_LLONG RC4_CHAR",
371         asm_arch         => 'sparcv9',
372         perlasm_scheme   => 'void',
373         multilib         => "/64",
374     },
375
376 #### IRIX 6.x configs
377 # Only N32 and N64 ABIs are supported.
378     "irix-common" => {
379         inherit_from     => [ "BASE_unix" ],
380         template         => 1,
381         cppflags         => threads("-D_SGI_MP_SOURCE"),
382         lib_cppflags     => "-DB_ENDIAN",
383         ex_libs          => add(threads("-lpthread")),
384         thread_scheme    => "pthreads",
385         dso_scheme       => "dlfcn",
386         shared_target    => "self",
387         shared_ldflag    => "-shared -Wl,-Bsymbolic",
388         shared_sonameflag=> "-Wl,-soname,",
389     },
390     "irix-mips3-gcc" => {
391         inherit_from     => [ "irix-common" ],
392         CC               => "gcc",
393         CFLAGS           => picker(debug   => "-g -O0",
394                                    release => "-O3"),
395         LDFLAGS          => "-static-libgcc",
396         cflags           => "-mabi=n32",
397         bn_ops           => "RC4_CHAR SIXTY_FOUR_BIT",
398         asm_arch         => 'mips64',
399         perlasm_scheme   => "n32",
400         multilib         => "32",
401     },
402     "irix-mips3-cc" => {
403         inherit_from     => [ "irix-common" ],
404         CC               => "cc",
405         CFLAGS           => picker(debug   => "-g -O0",
406                                    release => "-O2"),
407         cflags           => "-n32 -mips3 -use_readonly_const -G0 -rdata_shared",
408         bn_ops           => "RC4_CHAR SIXTY_FOUR_BIT",
409         asm_arch         => 'mips64',
410         perlasm_scheme   => "n32",
411         multilib         => "32",
412     },
413     # N64 ABI builds.
414     "irix64-mips4-gcc" => {
415         inherit_from     => [ "irix-common" ],
416         CC               => "gcc",
417         CFLAGS           => picker(debug   => "-g -O0",
418                                    release => "-O3"),
419         LDFLAGS          => "-static-libgcc",
420         cflags           => "-mabi=64 -mips4",
421         bn_ops           => "RC4_CHAR SIXTY_FOUR_BIT_LONG",
422         asm_arch         => 'mips64',
423         perlasm_scheme   => "64",
424         multilib         => "64",
425     },
426     "irix64-mips4-cc" => {
427         inherit_from     => [ "irix-common" ],
428         CC               => "cc",
429         CFLAGS           => picker(debug   => "-g -O0",
430                                    release => "-O2"),
431         cflags           => "-64 -mips4 -use_readonly_const -G0 -rdata_shared",
432         bn_ops           => "RC4_CHAR SIXTY_FOUR_BIT_LONG",
433         asm_arch         => 'mips64',
434         perlasm_scheme   => "64",
435         multilib         => "64",
436     },
437
438 #### Unified HP-UX ANSI C configs.
439 # Special notes:
440 # - Originally we were optimizing at +O4 level. It should be noted
441 #   that the only difference between +O3 and +O4 is global inter-
442 #   procedural analysis. As it has to be performed during the link
443 #   stage the compiler leaves behind certain pseudo-code in lib*.a
444 #   which might be release or even patch level specific. Generating
445 #   the machine code for and analyzing the *whole* program appears
446 #   to be *extremely* memory demanding while the performance gain is
447 #   actually questionable. The situation is intensified by the default
448 #   HP-UX data set size limit (infamous 'maxdsiz' tunable) of 64MB
449 #   which is way too low for +O4. In other words, doesn't +O3 make
450 #   more sense?
451 # - Keep in mind that the HP compiler by default generates code
452 #   suitable for execution on the host you're currently compiling at.
453 #   If the toolkit is meant to be used on various PA-RISC processors
454 #   consider './Configure hpux-parisc-[g]cc +DAportable'.
455 # - -DMD32_XARRAY triggers workaround for compiler bug we ran into in
456 #   32-bit message digests. (For the moment of this writing) HP C
457 #   doesn't seem to "digest" too many local variables (they make "him"
458 #   chew forever:-). For more details look-up MD32_XARRAY comment in
459 #   crypto/sha/sha_local.h.
460 # - originally there were 32-bit hpux-parisc2-* targets. They were
461 #   scrapped, because a) they were not interchangeable with other 32-bit
462 #   targets; b) performance-critical 32-bit assembly modules implement
463 #   even PA-RISC 2.0-specific code paths, which are chosen at run-time,
464 #   thus adequate performance is provided even with PA-RISC 1.1 build.
465     "hpux-common" => {
466         inherit_from     => [ "BASE_unix" ],
467         template         => 1,
468         defines          => add("_XOPEN_SOURCE", "_XOPEN_SOURCE_EXTENDED",
469                                 "_HPUX_ALT_XOPEN_SOCKET_API"),
470         lib_cppflags     => "-DB_ENDIAN",
471         thread_scheme    => "pthreads",
472         dso_scheme       => "dlfcn",    # overridden in 32-bit PA-RISC builds
473         shared_target    => "self",
474         bin_lflags       => "-Wl,+s,+cdp,../:,+cdp,./:",
475         shared_ldflag    => "-Wl,-B,symbolic,+vnocompatwarnings,-z,+s,+cdp,../:,+cdp,./:",
476         shared_sonameflag=> "-Wl,+h,",
477     },
478     "hpux-parisc-gcc" => {
479         inherit_from     => [ "hpux-common" ],
480         CC               => "gcc",
481         CFLAGS           => picker(debug   => "-O0 -g",
482                                    release => "-O3"),
483         cflags           => add(threads("-pthread")),
484         lib_cppflags     => add("-DBN_DIV2W"),
485         ex_libs          => add("-ldld", threads("-pthread")),
486         bn_ops           => "BN_LLONG RC4_CHAR",
487         dso_scheme       => "dl",
488         shared_cflag     => "-fPIC",
489         shared_ldflag    => add_before("-shared"),
490         shared_extension => ".sl.\$(SHLIB_VERSION_NUMBER)",
491     },
492     "hpux-parisc1_1-gcc" => {
493         inherit_from     => [ "hpux-parisc-gcc" ],
494         asm_arch         => 'parisc11',
495         perlasm_scheme   => "32",
496         multilib         => "/pa1.1",
497     },
498     "hpux64-parisc2-gcc" => {
499         inherit_from     => [ "hpux-common" ],
500         CC               => "gcc",
501         CFLAGS           => combine(picker(debug   => "-O0 -g",
502                                            release => "-O3")),
503         cflags           => add(threads("-pthread")),
504         ex_libs          => add("-ldl", threads("-pthread")),
505         bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
506         asm_arch         => 'parisc20_64',
507         perlasm_scheme   => "64",
508         shared_cflag     => "-fpic",
509         shared_ldflag    => add_before("-shared"),
510         shared_extension => ".sl.\$(SHLIB_VERSION_NUMBER)",
511         multilib         => "/pa20_64",
512     },
513
514     # More attempts at unified 10.X and 11.X targets for HP C compiler.
515     "hpux-parisc-cc" => {
516         inherit_from     => [ "hpux-common" ],
517         CC               => "cc",
518         CFLAGS           => picker(debug   => "+O0 +d -g",
519                                    release => "+O3"),
520         cflags           => "+Optrs_strongly_typed -Ae +ESlit",
521         cppflags         => threads("-D_REENTRANT"),
522         lib_cppflags     => add("-DBN_DIV2W -DMD32_XARRAY"),
523         ex_libs          => add("-ldld", threads("-lpthread")),
524         bn_ops           => "RC4_CHAR",
525         dso_scheme       => "dl",
526         shared_cflag     => "+Z",
527         shared_ldflag    => add_before("-b"),
528         shared_extension => ".sl.\$(SHLIB_VERSION_NUMBER)",
529     },
530     "hpux-parisc1_1-cc" => {
531         inherit_from     => [ "hpux-parisc-cc" ],
532         cflags           => add_before("+DA1.1"),
533         asm_arch         => 'parisc11',
534         perlasm_scheme   => "32",
535         multilib         => "/pa1.1",
536     },
537     "hpux64-parisc2-cc" => {
538         inherit_from     => [ "hpux-common" ],
539         CC               => "cc",
540         CFLAGS           => picker(debug   => "+O0 +d -g",
541                                    release => "+O3") ,
542         cflags           => "+DD64 +Optrs_strongly_typed -Ae +ESlit",
543         cppflags         => threads("-D_REENTRANT") ,
544         lib_cppflags     => add("-DMD32_XARRAY"),
545         ex_libs          => add("-ldl", threads("-lpthread")),
546         bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
547         asm_arch         => 'parisc20_64',
548         perlasm_scheme   => "64",
549         shared_cflag     => "+Z",
550         shared_ldflag    => add_before("-b"),
551         shared_extension => ".sl.\$(SHLIB_VERSION_NUMBER)",
552         multilib         => "/pa20_64",
553     },
554
555     # HP/UX IA-64 targets
556     "hpux-ia64-cc" => {
557         inherit_from     => [ "hpux-common" ],
558         CC               => "cc",
559         CFLAGS           => picker(debug   => "+O0 +d -g",
560                                    release => "+O2"),
561         cflags           => "-Ae +DD32 +Olit=all -z",
562         cppflags         => add(threads("-D_REENTRANT")),
563         ex_libs          => add("-ldl", threads("-lpthread")),
564         bn_ops           => "SIXTY_FOUR_BIT",
565         asm_arch         => 'ia64',
566         perlasm_scheme   => 'void',
567         shared_cflag     => "+Z",
568         shared_ldflag    => add_before("-b"),
569         multilib         => "/hpux32",
570     },
571     "hpux64-ia64-cc" => {
572         inherit_from     => [ "hpux-common" ],
573         CC               => "cc",
574         CFLAGS           => picker(debug   => "+O0 +d -g",
575                                    release => "+O3"),
576         cflags           => "-Ae +DD64 +Olit=all -z",
577         cppflags         => threads("-D_REENTRANT"),
578         ex_libs          => add("-ldl", threads("-lpthread")),
579         bn_ops           => "SIXTY_FOUR_BIT_LONG",
580         asm_arch         => 'ia64',
581         perlasm_scheme   => 'void',
582         shared_cflag     => "+Z",
583         shared_ldflag    => add_before("-b"),
584         multilib         => "/hpux64",
585     },
586     # GCC builds...
587     "hpux-ia64-gcc" => {
588         inherit_from     => [ "hpux-common" ],
589         CC               => "gcc",
590         CFLAGS           => picker(debug   => "-O0 -g",
591                                    release => "-O3"),
592         cflags           => add(threads("-pthread")),
593         ex_libs          => add("-ldl", threads("-pthread")),
594         bn_ops           => "SIXTY_FOUR_BIT",
595         asm_arch         => 'ia64',
596         perlasm_scheme   => 'void',
597         shared_cflag     => "-fpic",
598         shared_ldflag    => add_before("-shared"),
599         multilib         => "/hpux32",
600     },
601     "hpux64-ia64-gcc" => {
602         inherit_from     => [ "hpux-common" ],
603         CC               => "gcc",
604         CFLAGS           => picker(debug   => "-O0 -g",
605                                    release => "-O3"),
606         cflags           => combine("-mlp64", threads("-pthread")),
607         ex_libs          => add("-ldl", threads("-pthread")),
608         bn_ops           => "SIXTY_FOUR_BIT_LONG",
609         asm_arch         => 'ia64',
610         perlasm_scheme   => 'void',
611         shared_cflag     => "-fpic",
612         shared_ldflag    => add_before("-shared"),
613         multilib         => "/hpux64",
614     },
615
616 #### HP MPE/iX http://jazz.external.hp.com/src/openssl/
617     "MPE/iX-gcc" => {
618         inherit_from     => [ "BASE_unix" ],
619         CC               => "gcc",
620         CFLAGS           => "-O3",
621         cppflags         => "-D_POSIX_SOURCE -D_SOCKET_SOURCE",
622         includes         => [ "/SYSLOG/PUB" ],
623         lib_cppflags     => "-DBN_DIV2W",
624         sys_id           => "MPE",
625         lflags           => add("-L/SYSLOG/PUB"),
626         ex_libs          => add("-lsyslog -lsocket -lcurses"),
627         thread_scheme    => "(unknown)",
628         bn_ops           => "BN_LLONG",
629     },
630
631 #### DEC Alpha Tru64 targets. Tru64 is marketing name for OSF/1 version 4
632 #### and forward. In reality 'uname -s' still returns "OSF1". Originally
633 #### there were even osf1-* configs targeting prior versions provided,
634 #### but not anymore...
635     "tru64-alpha-gcc" => {
636         inherit_from     => [ "BASE_unix" ],
637         CC               => "gcc",
638         CFLAGS           => "-O3",
639         cflags           => add("-std=c9x", threads("-pthread")),
640         cppflags         => "-D_XOPEN_SOURCE=500 -D_OSF_SOURCE",
641         ex_libs          => add("-lrt", threads("-pthread")), # for mlock(2)
642         bn_ops           => "SIXTY_FOUR_BIT_LONG",
643         asm_arch         => 'alpha',
644         perlasm_scheme   => "void",
645         thread_scheme    => "pthreads",
646         dso_scheme       => "dlfcn",
647         shared_target    => "alpha-osf1-shared",
648         shared_extension => ".so",
649     },
650     "tru64-alpha-cc" => {
651         inherit_from     => [ "BASE_unix" ],
652         CC               => "cc",
653         CFLAGS           => "-tune host -fast",
654         cflags           => add("-std1 -readonly_strings",
655                                 threads("-pthread")),
656         cppflags         => "-D_XOPEN_SOURCE=500 -D_OSF_SOURCE",
657         ex_libs          => add("-lrt", threads("-pthread")), # for mlock(2)
658         bn_ops           => "SIXTY_FOUR_BIT_LONG",
659         asm_arch         => 'alpha',
660         perlasm_scheme   => "void",
661         thread_scheme    => "pthreads",
662         dso_scheme       => "dlfcn",
663         shared_target    => "alpha-osf1-shared",
664         shared_ldflag    => "-msym",
665         shared_extension => ".so",
666     },
667
668 ####
669 #### Variety of LINUX:-)
670 ####
671 # *-generic* is endian-neutral target, but ./config is free to
672 # throw in -D[BL]_ENDIAN, whichever appropriate...
673     "linux-generic32" => {
674         inherit_from     => [ "BASE_unix" ],
675         CC               => "gcc",
676         CXX              => "g++",
677         CFLAGS           => picker(default => "-Wall",
678                                    debug   => "-O0 -g",
679                                    release => "-O3"),
680         CXXFLAGS         => picker(default => "-Wall",
681                                    debug   => "-O0 -g",
682                                    release => "-O3"),
683         cflags           => threads("-pthread"),
684         cxxflags         => combine("-std=c++11", threads("-pthread")),
685         lib_cppflags     => "-DOPENSSL_USE_NODELETE",
686         ex_libs          => add("-ldl", threads("-pthread")),
687         bn_ops           => "BN_LLONG RC4_CHAR",
688         thread_scheme    => "pthreads",
689         dso_scheme       => "dlfcn",
690         shared_target    => "linux-shared",
691         shared_cflag     => "-fPIC",
692         shared_ldflag    => sub { $disabled{pinshared} ? () : "-Wl,-znodelete" },
693         enable           => [ "afalgeng" ],
694     },
695     "linux-latomic" => {
696         inherit_from     => [ "linux-generic32" ],
697         ex_libs          => add(threads("-latomic")),
698     },
699     "linux-generic64" => {
700         inherit_from     => [ "linux-generic32" ],
701         bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
702     },
703
704     "linux-ppc" => {
705         inherit_from     => [ "linux-latomic" ],
706         asm_arch         => 'ppc32',
707         perlasm_scheme   => "linux32",
708         lib_cppflags     => add("-DB_ENDIAN"),
709     },
710     "linux-ppc64" => {
711         inherit_from     => [ "linux-generic64" ],
712         cflags           => add("-m64"),
713         cxxflags         => add("-m64"),
714         lib_cppflags     => add("-DB_ENDIAN"),
715         asm_arch         => 'ppc64',
716         perlasm_scheme   => "linux64",
717         multilib         => "64",
718     },
719     "linux-ppc64le" => {
720         inherit_from     => [ "linux-generic64" ],
721         cflags           => add("-m64"),
722         cxxflags         => add("-m64"),
723         lib_cppflags     => add("-DL_ENDIAN"),
724         asm_arch         => 'ppc64',
725         perlasm_scheme   => "linux64le",
726     },
727
728     "linux-armv4" => {
729         ################################################################
730         # Note that -march is not among compiler options in linux-armv4
731         # target description. Not specifying one is intentional to give
732         # you choice to:
733         #
734         # a) rely on your compiler default by not specifying one;
735         # b) specify your target platform explicitly for optimal
736         # performance, e.g. -march=armv6 or -march=armv7-a;
737         # c) build "universal" binary that targets *range* of platforms
738         # by specifying minimum and maximum supported architecture;
739         #
740         # As for c) option. It actually makes no sense to specify
741         # maximum to be less than ARMv7, because it's the least
742         # requirement for run-time switch between platform-specific
743         # code paths. And without run-time switch performance would be
744         # equivalent to one for minimum. Secondly, there are some
745         # natural limitations that you'd have to accept and respect.
746         # Most notably you can *not* build "universal" binary for
747         # big-endian platform. This is because ARMv7 processor always
748         # picks instructions in little-endian order. Another similar
749         # limitation is that -mthumb can't "cross" -march=armv6t2
750         # boundary, because that's where it became Thumb-2. Well, this
751         # limitation is a bit artificial, because it's not really
752         # impossible, but it's deemed too tricky to support. And of
753         # course you have to be sure that your binutils are actually
754         # up to the task of handling maximum target platform. With all
755         # this in mind here is an example of how to configure
756         # "universal" build:
757         #
758         # ./Configure linux-armv4 -march=armv6 -D__ARM_MAX_ARCH__=8
759         #
760         inherit_from     => [ "linux-latomic" ],
761         asm_arch         => 'armv4',
762         perlasm_scheme   => "linux32",
763     },
764     "linux-aarch64" => {
765         inherit_from     => [ "linux-generic64" ],
766         asm_arch         => 'aarch64',
767         perlasm_scheme   => "linux64",
768     },
769     "linux-arm64ilp32" => {  # https://wiki.linaro.org/Platform/arm64-ilp32
770         inherit_from     => [ "linux-generic32" ],
771         cflags           => add("-mabi=ilp32"),
772         cxxflags         => add("-mabi=ilp32"),
773         bn_ops           => "SIXTY_FOUR_BIT RC4_CHAR",
774         asm_arch         => 'aarch64',
775         perlasm_scheme   => "linux64",
776     },
777
778     "linux-mips32" => {
779         # Configure script adds minimally required -march for assembly
780         # support, if no -march was specified at command line.
781         inherit_from     => [ "linux-latomic" ],
782         cflags           => add("-mabi=32"),
783         cxxflags         => add("-mabi=32"),
784         asm_arch         => 'mips32',
785         perlasm_scheme   => "o32",
786     },
787     # mips32 and mips64 below refer to contemporary MIPS Architecture
788     # specifications, MIPS32 and MIPS64, rather than to kernel bitness.
789     "linux-mips64" => {
790         inherit_from     => [ "linux-latomic" ],
791         cflags           => add("-mabi=n32"),
792         cxxflags         => add("-mabi=n32"),
793         bn_ops           => "RC4_CHAR SIXTY_FOUR_BIT",
794         asm_arch         => 'mips64',
795         perlasm_scheme   => "n32",
796         multilib         => "32",
797     },
798     "linux64-mips64" => {
799         inherit_from     => [ "linux-generic64" ],
800         cflags           => add("-mabi=64"),
801         cxxflags         => add("-mabi=64"),
802         asm_arch         => 'mips64',
803         perlasm_scheme   => "64",
804         multilib         => "64",
805     },
806
807     # riscv below refers to contemporary RISCV Architecture
808     # specifications,
809     "linux64-riscv64" => {
810         inherit_from     => [ "linux-generic64"],
811         perlasm_scheme   => "linux64",
812         asm_arch         => 'riscv64',
813     },
814
815     "linux32-riscv32" => {
816         inherit_from     => [ "linux-generic32"],
817         perlasm_scheme   => "linux32",
818         asm_arch         => 'riscv32',
819     },
820
821     # loongarch64 below refers to contemporary LOONGARCH Architecture
822     # specifications,
823     "linux64-loongarch64" => {
824         inherit_from     => [ "linux-generic64"],
825         perlasm_scheme   => "linux64",
826         asm_arch         => 'loongarch64',
827     },
828
829     #### IA-32 targets...
830     #### These two targets are a bit aged and are to be used on older Linux
831     #### machines where gcc doesn't understand -m32 and -m64
832     "linux-elf" => {
833         inherit_from     => [ "linux-generic32" ],
834         CFLAGS           => add(picker(release => "-fomit-frame-pointer")),
835         lib_cppflags     => add("-DL_ENDIAN"),
836         bn_ops           => "BN_LLONG",
837         asm_arch         => 'x86',
838         perlasm_scheme   => "elf",
839     },
840     "linux-aout" => {
841         inherit_from     => [ "BASE_unix" ],
842         CC               => "gcc",
843         CFLAGS           => add(picker(default => "-Wall",
844                                        debug   => "-O0 -g",
845                                        release => "-O3 -fomit-frame-pointer")),
846         lib_cppflags     => add("-DL_ENDIAN"),
847         bn_ops           => "BN_LLONG",
848         thread_scheme    => "(unknown)",
849         asm_arch         => 'x86',
850         perlasm_scheme   => "a.out",
851     },
852
853     #### X86 / X86_64 targets
854     "linux-x86" => {
855         inherit_from     => [ "linux-generic32" ],
856         CFLAGS           => add(picker(release => "-fomit-frame-pointer")),
857         cflags           => add("-m32"),
858         cxxflags         => add("-m32"),
859         lib_cppflags     => add("-DL_ENDIAN"),
860         bn_ops           => "BN_LLONG",
861         asm_arch         => 'x86',
862         perlasm_scheme   => "elf",
863     },
864     "linux-x86-clang" => {
865         inherit_from     => [ "linux-x86" ],
866         CC               => "clang",
867         CXX              => "clang++",
868         ex_libs          => add(threads("-latomic")),
869     },
870     "linux-x86_64" => {
871         inherit_from     => [ "linux-generic64" ],
872         cflags           => add("-m64"),
873         cxxflags         => add("-m64"),
874         lib_cppflags     => add("-DL_ENDIAN"),
875         bn_ops           => "SIXTY_FOUR_BIT_LONG",
876         asm_arch         => 'x86_64',
877         perlasm_scheme   => "elf",
878         multilib         => "64",
879     },
880     "linux-x86_64-clang" => {
881         inherit_from     => [ "linux-x86_64" ],
882         CC               => "clang",
883         CXX              => "clang++",
884     },
885     "linux-x32" => {
886         inherit_from     => [ "linux-generic32" ],
887         cflags           => add("-mx32"),
888         cxxflags         => add("-mx32"),
889         lib_cppflags     => add("-DL_ENDIAN"),
890         bn_ops           => "SIXTY_FOUR_BIT",
891         asm_arch         => 'x86_64',
892         perlasm_scheme   => "elf32",
893         multilib         => "x32",
894     },
895
896     "linux-ia64" => {
897         inherit_from     => [ "linux-generic64" ],
898         bn_ops           => "SIXTY_FOUR_BIT_LONG",
899         asm_arch         => 'ia64',
900         perlasm_scheme   => 'void',
901     },
902
903     "linux64-s390x" => {
904         inherit_from     => [ "linux-generic64" ],
905         cflags           => add("-m64"),
906         cxxflags         => add("-m64"),
907         lib_cppflags     => add("-DB_ENDIAN"),
908         asm_arch         => 's390x',
909         perlasm_scheme   => "64",
910         multilib         => "64",
911     },
912     "linux32-s390x" => {
913         #### So called "highgprs" target for z/Architecture CPUs
914         # "Highgprs" is kernel feature first implemented in Linux
915         # 2.6.32, see /proc/cpuinfo. The idea is to preserve most
916         # significant bits of general purpose registers not only
917         # upon 32-bit process context switch, but even on
918         # asynchronous signal delivery to such process. This makes
919         # it possible to deploy 64-bit instructions even in legacy
920         # application context and achieve better [or should we say
921         # adequate] performance. The build is binary compatible with
922         # linux-generic32, and the idea is to be able to install the
923         # resulting libcrypto.so alongside generic one, e.g. as
924         # /lib/highgprs/libcrypto.so.x.y, for ldconfig and run-time
925         # linker to autodiscover. Unfortunately it doesn't work just
926         # yet, because of couple of bugs in glibc
927         # sysdeps/s390/dl-procinfo.c affecting ldconfig and ld.so.1...
928         #
929         inherit_from     => [ "linux-generic32" ],
930         cflags           => add("-m31 -Wa,-mzarch"),
931         cxxflags         => add("-m31 -Wa,-mzarch"),
932         lib_cppflags     => add("-DB_ENDIAN"),
933         asm_arch         => 's390x',
934         perlasm_scheme   => "31",
935         multilib         => "/highgprs",
936     },
937
938     #### SPARC Linux setups
939     "linux-sparcv8" => {
940         inherit_from     => [ "linux-latomic" ],
941         cflags           => add("-mcpu=v8"),
942         cxxflags         => add("-mcpu=v8"),
943         lib_cppflags     => add("-DB_ENDIAN -DBN_DIV2W"),
944         asm_arch         => 'sparcv8',
945         perlasm_scheme   => 'void',
946     },
947     "linux-sparcv9" => {
948         # it's a real mess with -mcpu=ultrasparc option under Linux,
949         # but -Wa,-Av8plus should do the trick no matter what.
950         inherit_from     => [ "linux-latomic" ],
951         cflags           => add("-m32 -mcpu=ultrasparc -Wa,-Av8plus"),
952         cxxflags         => add("-m32 -mcpu=ultrasparc -Wa,-Av8plus"),
953         lib_cppflags     => add("-DB_ENDIAN -DBN_DIV2W"),
954         asm_arch         => 'sparcv9',
955         perlasm_scheme   => 'void',
956     },
957     "linux64-sparcv9" => {
958         # GCC 3.1 is a requirement
959         inherit_from     => [ "linux-generic64" ],
960         cflags           => add("-m64 -mcpu=ultrasparc"),
961         cxxflags         => add("-m64 -mcpu=ultrasparc"),
962         lib_cppflags     => add("-DB_ENDIAN"),
963         ex_libs          => add(threads("-latomic")),
964         bn_ops           => "BN_LLONG RC4_CHAR",
965         asm_arch         => 'sparcv9',
966         perlasm_scheme   => 'void',
967         multilib         => "64",
968     },
969
970     "linux-alpha-gcc" => {
971         inherit_from     => [ "linux-generic64" ],
972         lib_cppflags     => add("-DL_ENDIAN"),
973         bn_ops           => "SIXTY_FOUR_BIT_LONG",
974         asm_arch         => 'alpha',
975         perlasm_scheme   => "void",
976     },
977     "linux-c64xplus" => {
978         inherit_from     => [ "BASE_unix" ],
979         # TI_CGT_C6000_7.3.x is a requirement
980         CC               => "cl6x",
981         CFLAGS           => "-o2 -ox -ms",
982         cflags           => "--linux -ea=.s -eo=.o -mv6400+ -pden",
983         cxxflags         => "--linux -ea=.s -eo=.o -mv6400+ -pden",
984         cppflags         => combine("-DOPENSSL_SMALL_FOOTPRINT",
985                                     threads("-D_REENTRANT")),
986         bn_ops           => "BN_LLONG",
987         thread_scheme    => "pthreads",
988         asm_arch         => 'c64xplus',
989         perlasm_scheme   => "void",
990         dso_scheme       => "dlfcn",
991         shared_target    => "linux-shared",
992         shared_cflag     => "--pic",
993         shared_ldflag    => add("-z --sysv --shared"),
994         ranlib           => "true",
995     },
996
997 #### *BSD
998     "BSD-generic32" => {
999         # As for thread cflag. Idea is to maintain "collective" set of
1000         # flags, which would cover all BSD flavors. -pthread applies
1001         # to them all, but is treated differently. OpenBSD expands is
1002         # as -D_POSIX_THREAD -lc_r, which is sufficient. FreeBSD 4.x
1003         # expands it as -lc_r, which has to be accompanied by explicit
1004         # -D_THREAD_SAFE and sometimes -D_REENTRANT. FreeBSD 5.x
1005         # expands it as -lc_r, which seems to be sufficient?
1006         inherit_from     => [ "BASE_unix" ],
1007         CC               => "cc",
1008         CFLAGS           => picker(default => "-Wall",
1009                                    debug   => "-O0 -g",
1010                                    release => "-O3"),
1011         cflags           => threads("-pthread"),
1012         cppflags         => threads("-D_THREAD_SAFE -D_REENTRANT"),
1013         ex_libs          => add(threads("-pthread")),
1014         enable           => add("devcryptoeng"),
1015         bn_ops           => "BN_LLONG",
1016         thread_scheme    => "pthreads",
1017         dso_scheme       => "dlfcn",
1018         shared_target    => "bsd-gcc-shared",
1019         shared_cflag     => "-fPIC",
1020     },
1021     "BSD-generic64" => {
1022         inherit_from     => [ "BSD-generic32" ],
1023         bn_ops           => "SIXTY_FOUR_BIT_LONG",
1024     },
1025
1026     "BSD-x86" => {
1027         inherit_from     => [ "BSD-generic32" ],
1028         CFLAGS           => add(picker(release => "-fomit-frame-pointer")),
1029         lib_cppflags     => add("-DL_ENDIAN"),
1030         bn_ops           => "BN_LLONG",
1031         asm_arch         => 'x86',
1032         perlasm_scheme   => "a.out",
1033     },
1034     "BSD-x86-elf" => {
1035         inherit_from     => [ "BSD-x86" ],
1036         perlasm_scheme   => "elf",
1037     },
1038
1039     "BSD-sparcv8" => {
1040         inherit_from     => [ "BSD-generic32" ],
1041         cflags           => add("-mcpu=v8"),
1042         lib_cppflags     => add("-DB_ENDIAN"),
1043         asm_arch         => 'sparcv8',
1044         perlasm_scheme   => 'void',
1045     },
1046     "BSD-sparc64" => {
1047         # -DMD32_REG_T=int doesn't actually belong in sparc64 target, it
1048         # simply *happens* to work around a compiler bug in gcc 3.3.3,
1049         # triggered by RIPEMD160 code.
1050         inherit_from     => [ "BSD-generic64" ],
1051         lib_cppflags     => add("-DB_ENDIAN -DMD32_REG_T=int"),
1052         bn_ops           => "BN_LLONG",
1053         asm_arch         => 'sparcv9',
1054         perlasm_scheme   => 'void',
1055     },
1056
1057     "BSD-ia64" => {
1058         inherit_from     => [ "BSD-generic64" ],
1059         lib_cppflags     => add("-DL_ENDIAN"),
1060         bn_ops           => "SIXTY_FOUR_BIT_LONG",
1061         asm_arch         => 'ia64',
1062         perlasm_scheme   => 'void',
1063     },
1064
1065     "BSD-x86_64" => {
1066         inherit_from     => [ "BSD-generic64" ],
1067         lib_cppflags     => add("-DL_ENDIAN"),
1068         bn_ops           => "SIXTY_FOUR_BIT_LONG",
1069         asm_arch         => 'x86_64',
1070         perlasm_scheme   => "elf",
1071     },
1072
1073     "BSD-aarch64" => {
1074         inherit_from     => [ "BSD-generic64" ],
1075         lib_cppflags     => add("-DL_ENDIAN"),
1076         bn_ops           => "SIXTY_FOUR_BIT_LONG",
1077         asm_arch         => 'aarch64',
1078         perlasm_scheme   => "linux64",
1079     },
1080
1081     "BSD-ppc" => {
1082         inherit_from     => [ "BSD-generic32" ],
1083         asm_arch         => 'ppc32',
1084         perlasm_scheme   => "linux32",
1085         lib_cppflags     => add("-DB_ENDIAN"),
1086     },
1087
1088     "BSD-ppc64" => {
1089         inherit_from     => [ "BSD-generic64" ],
1090         cflags           => add("-m64"),
1091         cxxflags         => add("-m64"),
1092         lib_cppflags     => add("-DB_ENDIAN"),
1093         asm_arch         => 'ppc64',
1094         perlasm_scheme   => "linux64",
1095     },
1096
1097     "BSD-ppc64le" => {
1098         inherit_from     => [ "BSD-generic64" ],
1099         cflags           => add("-m64"),
1100         cxxflags         => add("-m64"),
1101         lib_cppflags     => add("-DL_ENDIAN"),
1102         asm_arch         => 'ppc64',
1103         perlasm_scheme   => "linux64le",
1104     },
1105
1106     # riscv below refers to contemporary RISCV Architecture
1107     # specifications,
1108     "BSD-riscv64" => {
1109         inherit_from     => [ "BSD-generic64"],
1110         perlasm_scheme   => "linux64",
1111         asm_arch         => 'riscv64',
1112     },
1113
1114     "BSD-riscv32" => {
1115         inherit_from     => [ "BSD-generic32"],
1116         perlasm_scheme   => "linux32",
1117         asm_arch         => 'riscv32',
1118     },
1119
1120     "BSD-armv4" => {
1121         ################################################################
1122         # Note that -march is not among compiler options in linux-armv4
1123         # target description. Not specifying one is intentional to give
1124         # you choice to:
1125         #
1126         # a) rely on your compiler default by not specifying one;
1127         # b) specify your target platform explicitly for optimal
1128         # performance, e.g. -march=armv6 or -march=armv7-a;
1129         # c) build "universal" binary that targets *range* of platforms
1130         # by specifying minimum and maximum supported architecture;
1131         #
1132         # As for c) option. It actually makes no sense to specify
1133         # maximum to be less than ARMv7, because it's the least
1134         # requirement for run-time switch between platform-specific
1135         # code paths. And without run-time switch performance would be
1136         # equivalent to one for minimum. Secondly, there are some
1137         # natural limitations that you'd have to accept and respect.
1138         # Most notably you can *not* build "universal" binary for
1139         # big-endian platform. This is because ARMv7 processor always
1140         # picks instructions in little-endian order. Another similar
1141         # limitation is that -mthumb can't "cross" -march=armv6t2
1142         # boundary, because that's where it became Thumb-2. Well, this
1143         # limitation is a bit artificial, because it's not really
1144         # impossible, but it's deemed too tricky to support. And of
1145         # course you have to be sure that your binutils are actually
1146         # up to the task of handling maximum target platform. With all
1147         # this in mind here is an example of how to configure
1148         # "universal" build:
1149         #
1150         # ./Configure BSD-armv4 -march=armv6 -D__ARM_MAX_ARCH__=8
1151         #
1152         inherit_from     => [ "BSD-generic32" ],
1153         asm_arch         => 'armv4',
1154         perlasm_scheme   => "linux32",
1155     },
1156
1157     "bsdi-elf-gcc" => {
1158         inherit_from     => [ "BASE_unix" ],
1159         CC               => "gcc",
1160         CFLAGS           => "-fomit-frame-pointer -O3 -Wall",
1161         lib_cppflags     => "-DPERL5 -DL_ENDIAN",
1162         ex_libs          => add("-ldl"),
1163         bn_ops           => "BN_LLONG",
1164         asm_arch         => 'x86',
1165         perlasm_scheme   => "elf",
1166         thread_scheme    => "(unknown)",
1167         dso_scheme       => "dlfcn",
1168         shared_target    => "bsd-gcc-shared",
1169         shared_cflag     => "-fPIC",
1170     },
1171
1172 #### SCO/Caldera targets.
1173 #
1174 # Originally we had like unixware-*, unixware-*-pentium, unixware-*-p6, etc.
1175 # Now we only have blended unixware-* as it's the only one used by ./config.
1176 # If you want to optimize for particular microarchitecture, bypass ./config
1177 # and './Configure unixware-7 -Kpentium_pro' or whatever appropriate.
1178 # Note that not all targets include assembler support. Mostly because of
1179 # lack of motivation to support out-of-date platforms with out-of-date
1180 # compiler drivers and assemblers.
1181 #
1182 # UnixWare 2.0x fails destest with -O.
1183     "unixware-2.0" => {
1184         inherit_from     => [ "BASE_unix" ],
1185         CC               => "cc",
1186         cflags           => threads("-Kthread"),
1187         lib_cppflags     => "-DFILIO_H -DNO_STRINGS_H",
1188         ex_libs          => add("-lsocket -lnsl -lresolv -lx"),
1189         thread_scheme    => "uithreads",
1190     },
1191     "unixware-2.1" => {
1192         inherit_from     => [ "BASE_unix" ],
1193         CC               => "cc",
1194         CFLAGS           => "-O",
1195         cflags           => threads("-Kthread"),
1196         lib_cppflags     => "-DFILIO_H",
1197         ex_libs          => add("-lsocket -lnsl -lresolv -lx"),
1198         thread_scheme    => "uithreads",
1199     },
1200     "unixware-7" => {
1201         inherit_from     => [ "BASE_unix" ],
1202         CC               => "cc",
1203         CFLAGS           => "-O",
1204         cflags           => combine("-Kalloca", threads("-Kthread")),
1205         lib_cppflags     => "-DFILIO_H",
1206         ex_libs          => add("-lsocket -lnsl"),
1207         thread_scheme    => "uithreads",
1208         bn_ops           => "BN_LLONG",
1209         asm_arch         => 'x86',
1210         perlasm_scheme   => "elf-1",
1211         dso_scheme       => "dlfcn",
1212         shared_target    => "svr5-shared",
1213         shared_cflag     => "-Kpic",
1214     },
1215     "unixware-7-gcc" => {
1216         inherit_from     => [ "BASE_unix" ],
1217         CC               => "gcc",
1218         CFLAGS           => "-O3 -fomit-frame-pointer -Wall",
1219         cppflags         => add(threads("-D_REENTRANT")),
1220         lib_cppflags     => add("-DL_ENDIAN -DFILIO_H"),
1221         ex_libs          => add("-lsocket -lnsl"),
1222         bn_ops           => "BN_LLONG",
1223         thread_scheme    => "pthreads",
1224         asm_arch         => 'x86',
1225         perlasm_scheme   => "elf-1",
1226         dso_scheme       => "dlfcn",
1227         shared_target    => "gnu-shared",
1228         shared_cflag     => "-fPIC",
1229     },
1230 # SCO 5 - Ben Laurie says the -O breaks the SCO cc.
1231     "sco5-cc" => {
1232         inherit_from     => [ "BASE_unix" ],
1233         cc               => "cc",
1234         cflags           => "-belf",
1235         ex_libs          => add("-lsocket -lnsl"),
1236         thread_scheme    => "(unknown)",
1237         asm_arch         => 'x86',
1238         perlasm_scheme   => "elf-1",
1239         dso_scheme       => "dlfcn",
1240         shared_target    => "svr3-shared",
1241         shared_cflag     => "-Kpic",
1242     },
1243     "sco5-gcc" => {
1244         inherit_from     => [ "BASE_unix" ],
1245         cc               => "gcc",
1246         cflags           => "-O3 -fomit-frame-pointer",
1247         ex_libs          => add("-lsocket -lnsl"),
1248         bn_ops           => "BN_LLONG",
1249         thread_scheme    => "(unknown)",
1250         asm_arch         => 'x86',
1251         perlasm_scheme   => "elf-1",
1252         dso_scheme       => "dlfcn",
1253         shared_target    => "svr3-shared",
1254         shared_cflag     => "-fPIC",
1255     },
1256
1257 #### IBM's AIX.
1258     # Below targets assume AIX >=5. Caveat lector. If you are accustomed
1259     # to control compilation "bitness" by setting $OBJECT_MODE environment
1260     # variable, then you should know that in OpenSSL case it's considered
1261     # only in ./config. Once configured, build procedure remains "deaf" to
1262     # current value of $OBJECT_MODE.
1263     "aix-common" => {
1264         inherit_from     => [ "BASE_unix" ],
1265         template         => 1,
1266         sys_id           => "AIX",
1267         lib_cppflags     => "-DB_ENDIAN",
1268         lflags           => "-Wl,-bsvr4",
1269         thread_scheme    => "pthreads",
1270         dso_scheme       => "dlfcn",
1271         shared_target    => "aix",
1272         module_ldflags   => "-Wl,-G,-bsymbolic,-bnoentry",
1273         shared_ldflag    => "-Wl,-G,-bsymbolic,-bnoentry",
1274         shared_defflag   => "-Wl,-bE:",
1275         shared_fipsflag  => "-Wl,-binitfini:_init:_cleanup",
1276         perl_platform    => 'AIX',
1277     },
1278     "aix-gcc" => {
1279         inherit_from     => [ "aix-common" ],
1280         CC               => "gcc",
1281         CFLAGS           => picker(debug   => "-O0 -g",
1282                                    release => "-O"),
1283         cflags           => add(threads("-pthread")),
1284         ex_libs          => add(threads("-pthread")),
1285         bn_ops           => "BN_LLONG RC4_CHAR",
1286         asm_arch         => 'ppc32',
1287         perlasm_scheme   => "aix32",
1288         shared_ldflag    => add_before("-shared -static-libgcc"),
1289         AR               => add("-X32"),
1290         RANLIB           => add("-X32"),
1291     },
1292     "aix64-gcc" => {
1293         inherit_from     => [ "aix-common" ],
1294         CC               => "gcc",
1295         CFLAGS           => picker(debug   => "-O0 -g",
1296                                    release => "-O"),
1297         cflags           => combine("-maix64", threads("-pthread")),
1298         ex_libs          => add(threads("-pthread")),
1299         bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
1300         asm_arch         => 'ppc64',
1301         perlasm_scheme   => "aix64",
1302         shared_ldflag    => add_before("-shared -static-libgcc"),
1303         shared_extension => "64.so.\$(SHLIB_VERSION_NUMBER)",
1304         AR               => add("-X64"),
1305         RANLIB           => add("-X64"),
1306     },
1307     "aix64-gcc-as" => {
1308         inherit_from     => [ "aix64-gcc" ],
1309         perlasm_scheme   => "aix64-as",
1310     },
1311     "aix-cc" => {
1312         inherit_from     => [ "aix-common" ],
1313         CC               => "cc",
1314         CFLAGS           => picker(debug   => "-O0 -g",
1315                                    release => "-O"),
1316         cflags           => combine("-q32 -qmaxmem=16384 -qro -qroconst",
1317                                     threads("-qthreaded")),
1318         cppflags         => threads("-D_THREAD_SAFE"),
1319         ex_libs          => add(threads("-lpthreads")),
1320         bn_ops           => "BN_LLONG RC4_CHAR",
1321         asm_arch         => 'ppc32',
1322         perlasm_scheme   => "aix32",
1323         shared_cflag     => "-qpic",
1324         AR               => add("-X32"),
1325         RANLIB           => add("-X32"),
1326     },
1327     "aix64-cc" => {
1328         inherit_from     => [ "aix-common" ],
1329         CC               => "cc",
1330         CFLAGS           => picker(debug   => "-O0 -g",
1331                                    release => "-O"),
1332         cflags           => combine("-q64 -qmaxmem=16384 -qro -qroconst",
1333                                     threads("-qthreaded")),
1334         cppflags         => threads("-D_THREAD_SAFE"),
1335         ex_libs          => add(threads("-lpthreads")),
1336         bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
1337         asm_arch         => 'ppc64',
1338         perlasm_scheme   => "aix64",
1339         dso_scheme       => "dlfcn",
1340         shared_cflag     => "-qpic",
1341         shared_extension => "64.so.\$(SHLIB_VERSION_NUMBER)",
1342         AR               => add("-X64"),
1343         RANLIB           => add("-X64"),
1344     },
1345
1346 # SIEMENS BS2000/OSD: an EBCDIC-based mainframe
1347     "BS2000-OSD" => {
1348         inherit_from     => [ "BASE_unix" ],
1349         CC               => "c89",
1350         CFLAGS           => "-O",
1351         cflags           => "-XLLML -XLLMK -XL",
1352         cppflags         => "-DCHARSET_EBCDIC",
1353         lib_cppflags     => "-DB_ENDIAN",
1354         ex_libs          => add("-lsocket -lnsl"),
1355         bn_ops           => "THIRTY_TWO_BIT RC4_CHAR",
1356         thread_scheme    => "(unknown)",
1357     },
1358
1359 #### Visual C targets
1360 #
1361 # Win64 targets, WIN64I denotes IA-64/Itanium and WIN64A - AMD64
1362 #
1363 # Note about /wd4090, disable warning C4090. This warning returns false
1364 # positives in some situations. Disabling it altogether masks both
1365 # legitimate and false cases, but as we compile on multiple platforms,
1366 # we rely on other compilers to catch legitimate cases.
1367 #
1368 # Also note that we force threads no matter what.  Configuring "no-threads"
1369 # is ignored.
1370 #
1371 # UNICODE is defined in VC-common and applies to all targets. It used to
1372 # be an opt-in option for VC-WIN32, but not anymore. The original reason
1373 # was because ANSI API was *native* system interface for no longer
1374 # supported Windows 9x. Keep in mind that UNICODE only affects how
1375 # OpenSSL libraries interact with underlying OS, it doesn't affect API
1376 # that OpenSSL presents to application.
1377
1378     "VC-common" => {
1379         inherit_from     => [ "BASE_Windows" ],
1380         template         => 1,
1381         CC               => "cl",
1382         CPP              => '$(CC) /EP /C',
1383         CFLAGS           => "/W3 /wd4090 /nologo",
1384         coutflag         => "/Fo",
1385         LD               => "link",
1386         LDFLAGS          => "/nologo /debug",
1387         ldoutflag        => "/out:",
1388         ldpostoutflag    => "",
1389         ld_resp_delim    => "\n",
1390         bin_lflags       => "setargv.obj",
1391         makedepcmd       => '$(CC) /Zs /showIncludes',
1392         makedep_scheme   => 'VC',
1393         AR               => "lib",
1394         ARFLAGS          => "/nologo",
1395         aroutflag        => "/out:",
1396         ar_resp_delim    => "\n",
1397         RC               => "rc",
1398         rcoutflag        => "/fo",
1399         defines          => add("OPENSSL_SYS_WIN32", "WIN32_LEAN_AND_MEAN",
1400                                 "UNICODE", "_UNICODE",
1401                                 "_CRT_SECURE_NO_DEPRECATE",
1402                                 "_WINSOCK_DEPRECATED_NO_WARNINGS"),
1403         lib_cflags       => add("/Zi /Fdossl_static.pdb"),
1404         lib_defines      => add("L_ENDIAN"),
1405         dso_cflags       => "/Zi /Fddso.pdb",
1406         bin_cflags       => "/Zi /Fdapp.pdb",
1407         # def_flag made to empty string so a .def file gets generated
1408         shared_defflag   => '',
1409         shared_ldflag    => "/dll",
1410         shared_target    => "win-shared", # meaningless except it gives Configure a hint
1411         lddefflag        => "/def:",
1412         ldresflag        => " ",
1413         ld_implib_flag   => "/implib:",
1414         thread_scheme    => "winthreads",
1415         dso_scheme       => "win32",
1416         perl_platform    => 'Windows::MSVC',
1417         # additional parameter to build_scheme denotes install-path "flavour"
1418         build_scheme     => add("VC-common", { separator => undef }),
1419     },
1420     "VC-noCE-common" => {
1421         inherit_from     => [ "VC-common" ],
1422         template         => 1,
1423         CFLAGS           => add(picker(debug   => '/Od',
1424                                        release => '/O2')),
1425         cflags           => add(picker(default => '/Gs0 /GF /Gy',
1426                                        debug   =>
1427                                        sub {
1428                                            ($disabled{shared} ? "" : "/MDd");
1429                                        },
1430                                        release =>
1431                                        sub {
1432                                            ($disabled{shared} ? "" : "/MD");
1433                                        })),
1434         defines          => add(picker(default => [], # works as type cast
1435                                        debug   => [ "DEBUG", "_DEBUG" ])),
1436         lib_cflags       => add(sub { $disabled{shared} ? "/MT /Zl" : () }),
1437         # Following might/should appears controversial, i.e. defining
1438         # /MDd without evaluating $disabled{shared}. It works in
1439         # non-shared build because static library is compiled with /Zl
1440         # and bares no reference to specific RTL. And it works in
1441         # shared build because multiple /MDd options are not prohibited.
1442         # But why /MDd in static build? Well, basically this is just a
1443         # reference point, which allows to catch eventual errors that
1444         # would prevent those who want to wrap OpenSSL into own .DLL.
1445         # Why not /MD in release build then? Well, some are likely to
1446         # prefer [non-debug] openssl.exe to be free from Micorosoft RTL
1447         # redistributable.
1448         bin_cflags       => add(picker(debug   => "/MDd",
1449                                        release => sub { $disabled{shared} ? "/MT" : () },
1450                                       )),
1451         bin_lflags       => add("/subsystem:console /opt:ref"),
1452         ex_libs          => add(sub {
1453             my @ex_libs = ();
1454             push @ex_libs, 'ws2_32.lib' unless $disabled{sock};
1455             push @ex_libs, 'gdi32.lib advapi32.lib crypt32.lib user32.lib';
1456             return join(" ", @ex_libs);
1457         }),
1458     },
1459     "VC-WIN64-common" => {
1460         inherit_from     => [ "VC-noCE-common" ],
1461         template         => 1,
1462         ex_libs          => add(sub {
1463             my @ex_libs = ();
1464             push @ex_libs, 'bufferoverflowu.lib' if (`cl 2>&1` =~ /14\.00\.4[0-9]{4}\./);
1465             return join(" ", @_, @ex_libs);
1466         }),
1467         bn_ops           => add("SIXTY_FOUR_BIT"),
1468     },
1469     "VC-WIN64I" => {
1470         inherit_from     => [ "VC-WIN64-common" ],
1471         AS               => "ias",
1472         ASFLAGS          => "-d debug",
1473         asoutflag        => "-o ",
1474         sys_id           => "WIN64I",
1475         uplink_arch      => 'ia64',
1476         asm_arch         => 'ia64',
1477         perlasm_scheme   => "ias",
1478         multilib         => "-ia64",
1479     },
1480     "VC-WIN64A" => {
1481         inherit_from     => [ "VC-WIN64-common" ],
1482         AS               => sub { vc_win64a_info()->{AS} },
1483         ASFLAGS          => sub { vc_win64a_info()->{ASFLAGS} },
1484         asoutflag        => sub { vc_win64a_info()->{asoutflag} },
1485         asflags          => sub { vc_win64a_info()->{asflags} },
1486         sys_id           => "WIN64A",
1487         uplink_arch      => 'x86_64',
1488         asm_arch         => 'x86_64',
1489         perlasm_scheme   => "auto",
1490         multilib         => "-x64",
1491     },
1492     "VC-WIN32" => {
1493         inherit_from     => [ "VC-noCE-common" ],
1494         AS               => sub { vc_win32_info()->{AS} },
1495         ASFLAGS          => sub { vc_win32_info()->{ASFLAGS} },
1496         asoutflag        => sub { vc_win32_info()->{asoutflag} },
1497         asflags          => sub { vc_win32_info()->{asflags} },
1498         sys_id           => "WIN32",
1499         bn_ops           => add("BN_LLONG"),
1500         uplink_arch      => 'common',
1501         asm_arch         => 'x86',
1502         perlasm_scheme   => sub { vc_win32_info()->{perlasm_scheme} },
1503         # "WOW" stands for "Windows on Windows", and "VC-WOW" engages
1504         # some installation path heuristics in windows-makefile.tmpl...
1505         build_scheme     => add("VC-WOW", { separator => undef }),
1506     },
1507     "VC-CE" => {
1508         inherit_from     => [ "VC-common" ],
1509         CFLAGS           => add(picker(debug   => "/Od",
1510                                        release => "/O1i")),
1511         CPPDEFINES       => picker(debug   => [ "DEBUG", "_DEBUG" ]),
1512         LDFLAGS          => add("/nologo /opt:ref"),
1513         cflags           =>
1514             combine('/GF /Gy',
1515                     sub { vc_wince_info()->{cflags}; },
1516                     sub { `cl 2>&1` =~ /Version ([0-9]+)\./ && $1>=14
1517                               ? ($disabled{shared} ? " /MT" : " /MD")
1518                               : " /MC"; }),
1519         cppflags         => sub { vc_wince_info()->{cppflags}; },
1520         lib_defines      => add("NO_CHMOD", "OPENSSL_SMALL_FOOTPRINT"),
1521         lib_cppflags     => sub { vc_wince_info()->{cppflags}; },
1522         includes         =>
1523             add(combine(sub { defined(env('WCECOMPAT'))
1524                               ? '$(WCECOMPAT)/include' : (); },
1525                         sub { defined(env('PORTSDK_LIBPATH'))
1526                                   ? '$(PORTSDK_LIBPATH)/../../include'
1527                                   : (); })),
1528         lflags           => add(combine(sub { vc_wince_info()->{lflags}; },
1529                                         sub { defined(env('PORTSDK_LIBPATH'))
1530                                                   ? "/entry:mainCRTstartup" : (); })),
1531         sys_id           => "WINCE",
1532         bn_ops           => add("BN_LLONG"),
1533         ex_libs          => add(sub {
1534             my @ex_libs = ();
1535             push @ex_libs, 'ws2.lib' unless $disabled{sock};
1536             push @ex_libs, 'crypt32.lib';
1537             if (defined(env('WCECOMPAT'))) {
1538                 my $x = '$(WCECOMPAT)/lib';
1539                 if (-f "$x/env('TARGETCPU')/wcecompatex.lib") {
1540                     $x .= '/$(TARGETCPU)/wcecompatex.lib';
1541                 } else {
1542                     $x .= '/wcecompatex.lib';
1543                 }
1544                 push @ex_libs, $x;
1545             }
1546             push @ex_libs, '$(PORTSDK_LIBPATH)/portlib.lib'
1547                 if (defined(env('PORTSDK_LIBPATH')));
1548             push @ex_libs, '/nodefaultlib coredll.lib corelibc.lib'
1549                 if (env('TARGETCPU') =~ /^X86|^ARMV4[IT]/);
1550             return join(" ", @ex_libs);
1551         }),
1552     },
1553
1554 #### MinGW
1555     "mingw-common" => {
1556         inherit_from     => [ 'BASE_unix' ],
1557         template         => 1,
1558         CC               => "gcc",
1559         CFLAGS           => picker(default => "-Wall",
1560                                    debug   => "-g -O0",
1561                                    release => "-O3"),
1562         cppflags         => combine("-DUNICODE -D_UNICODE -DWIN32_LEAN_AND_MEAN",
1563                                     threads("-D_MT")),
1564         lib_cppflags     => "-DL_ENDIAN",
1565         ex_libs          => add("-lws2_32 -lgdi32 -lcrypt32"),
1566         thread_scheme    => "winthreads",
1567         dso_scheme       => "win32",
1568         shared_target    => "mingw-shared",
1569         shared_cppflags  => add("_WINDLL"),
1570         shared_ldflag    => "-static-libgcc",
1571
1572         perl_platform    => 'mingw',
1573     },
1574     "mingw" => {
1575         inherit_from     => [ "mingw-common" ],
1576         CFLAGS           => add(picker(release => "-fomit-frame-pointer")),
1577         cflags           => "-m32",
1578         sys_id           => "MINGW32",
1579         bn_ops           => add("BN_LLONG"),
1580         asm_arch         => 'x86',
1581         uplink_arch      => 'x86',
1582         perlasm_scheme   => "coff",
1583         shared_rcflag    => "--target=pe-i386",
1584         multilib         => "",
1585     },
1586     "mingw64" => {
1587         # As for uplink_arch. Applink makes it possible to use
1588         # .dll compiled with one compiler with application compiled with
1589         # another compiler. It's possible to engage Applink support in
1590         # mingw64 build, but it's not done, because until mingw64
1591         # supports structured exception handling, one can't seriously
1592         # consider its binaries for using with non-mingw64 run-time
1593         # environment. And as mingw64 is always consistent with itself,
1594         # Applink is never engaged and can as well be omitted.
1595         inherit_from     => [ "mingw-common" ],
1596         cflags           => "-m64",
1597         sys_id           => "MINGW64",
1598         bn_ops           => add("SIXTY_FOUR_BIT"),
1599         asm_arch         => 'x86_64',
1600         uplink_arch      => undef,
1601         perlasm_scheme   => "mingw64",
1602         shared_rcflag    => "--target=pe-x86-64",
1603         multilib         => "64",
1604     },
1605
1606 #### UEFI
1607     "UEFI" => {
1608         inherit_from     => [ "BASE_unix" ],
1609         CC               => "cc",
1610         CFLAGS           => "-O",
1611         lib_cppflags     => "-DL_ENDIAN",
1612         sys_id           => "UEFI",
1613     },
1614     "UEFI-x86" => {
1615         inherit_from     => [ "UEFI" ],
1616         asm_arch         => 'x86',
1617         perlasm_scheme   => "win32n",
1618     },
1619     "UEFI-x86_64" => {
1620         inherit_from     => [ "UEFI" ],
1621         asm_arch         => 'x86_64',
1622         perlasm_scheme   => "nasm",
1623     },
1624
1625 #### UWIN
1626     "UWIN" => {
1627         inherit_from     => [ "BASE_unix" ],
1628         CC               => "cc",
1629         CFLAGS           => "-O -Wall",
1630         lib_cppflags     => "-DTERMIOS -DL_ENDIAN",
1631         sys_id           => "UWIN",
1632         bn_ops           => "BN_LLONG",
1633         dso_scheme       => "win32",
1634     },
1635
1636 #### Cygwin
1637     "Cygwin-common" => {
1638         inherit_from     => [ "BASE_unix" ],
1639         template         => 1,
1640
1641         CC               => "gcc",
1642         CFLAGS           => picker(default => "-Wall",
1643                                    debug   => "-g -O0",
1644                                    release => "-O3"),
1645         lib_cppflags     => "-DTERMIOS -DL_ENDIAN",
1646         sys_id           => "CYGWIN",
1647         thread_scheme    => "pthread",
1648         dso_scheme       => "dlfcn",
1649         shared_target    => "cygwin-shared",
1650         shared_cppflags  => "-D_WINDLL",
1651
1652         perl_platform    => 'Cygwin',
1653     },
1654     "Cygwin-x86" => {
1655         inherit_from     => [ "Cygwin-common" ],
1656         CFLAGS           => add(picker(release => "-O3 -fomit-frame-pointer")),
1657         bn_ops           => "BN_LLONG",
1658         asm_arch         => 'x86',
1659         perlasm_scheme   => "coff",
1660     },
1661     "Cygwin-x86_64" => {
1662         inherit_from     => [ "Cygwin-common" ],
1663         CC               => "gcc",
1664         bn_ops           => "SIXTY_FOUR_BIT_LONG",
1665         asm_arch         => 'x86_64',
1666         perlasm_scheme   => "mingw64",
1667     },
1668     # Backward compatibility for those using this target
1669     "Cygwin" => {
1670         inherit_from     => [ "Cygwin-x86" ]
1671     },
1672     # In case someone constructs the Cygwin target name themself
1673     "Cygwin-i386" => {
1674         inherit_from     => [ "Cygwin-x86" ]
1675     },
1676     "Cygwin-i486" => {
1677         inherit_from     => [ "Cygwin-x86" ]
1678     },
1679     "Cygwin-i586" => {
1680         inherit_from     => [ "Cygwin-x86" ]
1681     },
1682     "Cygwin-i686" => {
1683         inherit_from     => [ "Cygwin-x86" ]
1684     },
1685
1686 ##### MacOS X (a.k.a. Darwin) setup
1687     "darwin-common" => {
1688         inherit_from     => [ "BASE_unix" ],
1689         template         => 1,
1690         CC               => "cc",
1691         CFLAGS           => picker(debug   => "-g -O0",
1692                                    release => "-O3"),
1693         cppflags         => threads("-D_REENTRANT"),
1694         lflags           => add("-Wl,-search_paths_first"),
1695         sys_id           => "MACOSX",
1696         bn_ops           => "BN_LLONG RC4_CHAR",
1697         thread_scheme    => "pthreads",
1698         perlasm_scheme   => "osx32",
1699         dso_scheme       => "dlfcn",
1700         ranlib           => "ranlib -c",
1701         shared_target    => "darwin-shared",
1702         shared_cflag     => "-fPIC",
1703         shared_extension => ".\$(SHLIB_VERSION_NUMBER).dylib",
1704     },
1705     # Option "freeze" such as -std=gnu9x can't negatively interfere
1706     # with future defaults for below two targets, because MacOS X
1707     # for PPC has no future, it was discontinued by vendor in 2009.
1708     "darwin-ppc-cc" => { inherit_from => [ "darwin-ppc" ] }, # Historic alias
1709     "darwin-ppc" => {
1710         inherit_from     => [ "darwin-common" ],
1711         cflags           => add("-arch ppc -std=gnu9x -Wa,-force_cpusubtype_ALL"),
1712         lib_cppflags     => add("-DB_ENDIAN"),
1713         shared_cflag     => add("-fno-common"),
1714         asm_arch         => 'ppc32',
1715         perlasm_scheme   => "osx32",
1716     },
1717     "darwin64-ppc-cc" => { inherit_from => [ "darwin64-ppc" ] }, # Historic alias
1718     "darwin64-ppc" => {
1719         inherit_from     => [ "darwin-common" ],
1720         cflags           => add("-arch ppc64 -std=gnu9x"),
1721         lib_cppflags     => add("-DB_ENDIAN"),
1722         bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
1723         asm_arch         => 'ppc64',
1724         perlasm_scheme   => "osx64",
1725     },
1726     "darwin-i386-cc" => { inherit_from => [ "darwin-i386" ] }, # Historic alias
1727     "darwin-i386" => {
1728         inherit_from     => [ "darwin-common" ],
1729         CFLAGS           => add(picker(release => "-fomit-frame-pointer")),
1730         cflags           => add("-arch i386"),
1731         lib_cppflags     => add("-DL_ENDIAN"),
1732         bn_ops           => "BN_LLONG RC4_INT",
1733         asm_arch         => 'x86',
1734         perlasm_scheme   => "macosx",
1735     },
1736     "darwin64-x86_64-cc" => { inherit_from => [ "darwin64-x86_64" ] }, # Historic alias
1737     "darwin64-x86_64" => {
1738         inherit_from     => [ "darwin-common" ],
1739         CFLAGS           => add("-Wall"),
1740         cflags           => add("-arch x86_64"),
1741         lib_cppflags     => add("-DL_ENDIAN"),
1742         bn_ops           => "SIXTY_FOUR_BIT_LONG",
1743         asm_arch         => 'x86_64',
1744         perlasm_scheme   => "macosx",
1745     },
1746     "darwin64-arm64-cc" => { inherit_from => [ "darwin64-arm64" ] }, # "Historic" alias
1747     "darwin64-arm64" => {
1748         inherit_from     => [ "darwin-common" ],
1749         CFLAGS           => add("-Wall"),
1750         cflags           => add("-arch arm64"),
1751         lib_cppflags     => add("-DL_ENDIAN"),
1752         bn_ops           => "SIXTY_FOUR_BIT_LONG",
1753         asm_arch         => 'aarch64',
1754         perlasm_scheme   => "ios64",
1755     },
1756
1757 ##### GNU Hurd
1758     "hurd-x86" => {
1759         inherit_from     => [ "BASE_unix" ],
1760         CC               => "gcc",
1761         CFLAGS           => "-O3 -fomit-frame-pointer -Wall",
1762         cflags           => threads("-pthread"),
1763         lib_cppflags     => "-DL_ENDIAN",
1764         ex_libs          => add("-ldl", threads("-pthread")),
1765         bn_ops           => "BN_LLONG",
1766         asm_arch         => 'x86',
1767         perlasm_scheme   => 'elf',
1768         thread_scheme    => "pthreads",
1769         dso_scheme       => "dlfcn",
1770         shared_target    => "linux-shared",
1771         shared_cflag     => "-fPIC",
1772     },
1773
1774 ##### VxWorks for various targets
1775     "vxworks-ppc60x" => {
1776         inherit_from     => [ "BASE_unix" ],
1777         CC               => "ccppc",
1778         CFLAGS           => "-O2 -Wall -fstrength-reduce",
1779         cflags           => "-mrtp -mhard-float -mstrict-align -fno-implicit-fp -fno-builtin -fno-strict-aliasing",
1780         cppflags         => combine("-D_REENTRANT -DPPC32_fp60x -DCPU=PPC32",
1781                                     "_DTOOL_FAMILY=gnu -DTOOL=gnu",
1782                                     "-I\$(WIND_BASE)/target/usr/h",
1783                                     "-I\$(WIND_BASE)/target/usr/h/wrn/coreip"),
1784         sys_id           => "VXWORKS",
1785         lflags           => add("-L \$(WIND_BASE)/target/usr/lib/ppc/PPC32/common"),
1786         ex_libs          => add("-Wl,--defsym,__wrs_rtp_base=0xe0000000"),
1787     },
1788     "vxworks-ppcgen" => {
1789         inherit_from     => [ "BASE_unix" ],
1790         CC               => "ccppc",
1791         CFLAGS           => "-O1 -Wall",
1792         cflags           => "-mrtp -msoft-float -mstrict-align -fno-builtin -fno-strict-aliasing",
1793         cppflags         => combine("-D_REENTRANT -DPPC32 -DCPU=PPC32",
1794                                     "-DTOOL_FAMILY=gnu -DTOOL=gnu",
1795                                     "-I\$(WIND_BASE)/target/usr/h",
1796                                     "-I\$(WIND_BASE)/target/usr/h/wrn/coreip"),
1797         sys_id           => "VXWORKS",
1798         lflags           => add("-L \$(WIND_BASE)/target/usr/lib/ppc/PPC32/sfcommon"),
1799         ex_libs          => add("-Wl,--defsym,__wrs_rtp_base=0xe0000000"),
1800     },
1801     "vxworks-ppc405" => {
1802         inherit_from     => [ "BASE_unix" ],
1803         CC               => "ccppc",
1804         CFLAGS           => "-g",
1805         cflags           => "-msoft-float -mlongcall",
1806         cppflags         => combine("-D_REENTRANT -DPPC32 -DCPU=PPC405",
1807                                     "-DTOOL_FAMILY=gnu -DTOOL=gnu",
1808                                     "-I\$(WIND_BASE)/target/h"),
1809         sys_id           => "VXWORKS",
1810         lflags           => add("-r"),
1811     },
1812     "vxworks-ppc750" => {
1813         inherit_from     => [ "BASE_unix" ],
1814         CC               => "ccppc",
1815         CFLAGS           => "-ansi -fvolatile -Wall \$(DEBUG_FLAG)",
1816         cflags           => "-nostdinc -fno-builtin -fno-for-scope -fsigned-char -msoft-float -mlongcall",
1817         cppflags         => combine("-DPPC750 -D_REENTRANT -DCPU=PPC604",
1818                                     "-I\$(WIND_BASE)/target/h"),
1819         sys_id           => "VXWORKS",
1820         lflags           => add("-r"),
1821     },
1822     "vxworks-ppc750-debug" => {
1823         inherit_from     => [ "BASE_unix" ],
1824         CC               => "ccppc",
1825         CFLAGS           => "-ansi -fvolatile -Wall -g",
1826         cflags           => "-nostdinc -fno-builtin -fno-for-scope -fsigned-char -msoft-float -mlongcall",
1827         cppflags         => combine("-DPPC750 -D_REENTRANT -DCPU=PPC604",
1828                                     "-DPEDANTIC -DDEBUG",
1829                                     "-I\$(WIND_BASE)/target/h"),
1830         sys_id           => "VXWORKS",
1831         lflags           => add("-r"),
1832     },
1833     "vxworks-ppc860" => {
1834         inherit_from     => [ "BASE_unix" ],
1835         CC               => "ccppc",
1836         cflags           => "-nostdinc -msoft-float",
1837         cppflags         => combine("-DCPU=PPC860 -DNO_STRINGS_H",
1838                                     "-I\$(WIND_BASE)/target/h"),
1839         sys_id           => "VXWORKS",
1840         lflags           => add("-r"),
1841     },
1842     "vxworks-simlinux" => {
1843         inherit_from     => [ "BASE_unix" ],
1844         CC               => "ccpentium",
1845         cflags           => "-B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/ -fno-builtin -fno-defer-pop",
1846         cppflags         => combine("-D_VSB_CONFIG_FILE=\"\$(WIND_BASE)/target/lib/h/config/vsbConfig.h\"",
1847                                     "-DL_ENDIAN -DCPU=SIMLINUX -DNO_STRINGS_H",
1848                                     "-DTOOL_FAMILY=gnu -DTOOL=gnu",
1849                                     "-DOPENSSL_NO_HW_PADLOCK",
1850                                     "-I\$(WIND_BASE)/target/h",
1851                                     "-I\$(WIND_BASE)/target/h/wrn/coreip"),
1852         sys_id           => "VXWORKS",
1853         lflags           => add("-r"),
1854         ranlib           => "ranlibpentium",
1855     },
1856     "vxworks-mips" => {
1857         inherit_from     => [ "BASE_unix" ],
1858         CC               => "ccmips",
1859         CFLAGS           => "-O -G 0",
1860         cflags           => "-mrtp -mips2 -B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/ -msoft-float -mno-branch-likely -fno-builtin -fno-defer-pop",
1861         cppflags         => combine("-D_VSB_CONFIG_FILE=\"\$(WIND_BASE)/target/lib/h/config/vsbConfig.h\"",
1862                                     "-DCPU=MIPS32 -DNO_STRINGS_H",
1863                                     "-DTOOL_FAMILY=gnu -DTOOL=gnu",
1864                                     "-DOPENSSL_NO_HW_PADLOCK",
1865                                     threads("-D_REENTRANT"),
1866                                     "-I\$(WIND_BASE)/target/h",
1867                                     "-I\$(WIND_BASE)/target/h/wrn/coreip"),
1868         sys_id           => "VXWORKS",
1869         lflags           => add("-L \$(WIND_BASE)/target/usr/lib/mips/MIPSI32/sfcommon"),
1870         ex_libs          => add("-Wl,--defsym,__wrs_rtp_base=0xe0000000"),
1871         thread_scheme    => "pthreads",
1872         asm_arch         => 'mips32',
1873         perlasm_scheme   => "o32",
1874         ranlib           => "ranlibmips",
1875     },
1876
1877 #### uClinux
1878     "uClinux-dist" => {
1879         inherit_from     => [ "BASE_unix" ],
1880         CC               => sub { env('CC') },
1881         cppflags         => threads("-D_REENTRANT"),
1882         ex_libs          => add("\$(LDLIBS)"),
1883         bn_ops           => "BN_LLONG",
1884         thread_scheme    => "pthreads",
1885         dso_scheme       => sub { env('LIBSSL_dlfcn') },
1886         shared_target    => "linux-shared",
1887         shared_cflag     => "-fPIC",
1888         ranlib           => sub { env('RANLIB') },
1889     },
1890     "uClinux-dist64" => {
1891         inherit_from     => [ "BASE_unix" ],
1892         CC               => sub { env('CC') },
1893         cppflags         => threads("-D_REENTRANT"),
1894         ex_libs          => add("\$(LDLIBS)"),
1895         bn_ops           => "SIXTY_FOUR_BIT_LONG",
1896         thread_scheme    => "pthreads",
1897         dso_scheme       => sub { env('LIBSSL_dlfcn') },
1898         shared_target    => "linux-shared",
1899         shared_cflag     => "-fPIC",
1900         ranlib           => sub { env('RANLIB') },
1901     },
1902
1903     ##### VMS
1904     # Most things happen in vms-generic.
1905     # Note that vms_info extracts the pointer size from the end of
1906     # the target name, and will assume that anything matching /-p\d+$/
1907     # indicates the pointer size setting for the desired target.
1908     "vms-generic" => {
1909         inherit_from     => [ "BASE_VMS" ],
1910         template         => 1,
1911         CC               => "CC/DECC",
1912         CPP              => '$(CC)/PREPROCESS_ONLY=SYS$OUTPUT:',
1913         CFLAGS           =>
1914             combine(picker(default => "/STANDARD=(ISOC94,RELAXED)/NOLIST/PREFIX=ALL",
1915                            debug   => "/NOOPTIMIZE/DEBUG",
1916                            release => "/OPTIMIZE/NODEBUG"),
1917                     sub { my @warnings =
1918                               @{vms_info()->{disable_warns}};
1919                           @warnings
1920                               ? "/WARNINGS=DISABLE=(".join(",",@warnings).")" : (); }),
1921         cflag_incfirst   => '/FIRST_INCLUDE=',
1922         lib_defines      =>
1923             add("OPENSSL_USE_NODELETE",
1924                 sub {
1925                     return vms_info()->{def_zlib}
1926                         ? "LIBZ=\"\"\"".vms_info()->{def_zlib}."\"\"\"" : ();
1927                 }),
1928         lflags           => picker(default => "/MAP='F\$PARSE(\".MAP\",\"\$\@\")'",
1929                                    debug   => "/DEBUG/TRACEBACK",
1930                                    release => "/NODEBUG/NOTRACEBACK"),
1931         # Because of dso_cflags below, we can't set the generic |cflags| here,
1932         # as it can't be overridden, so we set separate C flags for libraries
1933         # and binaries instead.
1934         bin_cflags       => add("/NAMES=(AS_IS,SHORTENED)/EXTERN_MODEL=STRICT_REFDEF"),
1935         lib_cflags       => add("/NAMES=(AS_IS,SHORTENED)/EXTERN_MODEL=STRICT_REFDEF"),
1936         # Strictly speaking, DSOs should not need to have name shortening,
1937         # as all their exported symbols should be short enough to fit the
1938         # linker's 31 character per symbol name limit.  However, providers
1939         # may be composed of more than one object file, and internal symbols
1940         # may and do surpass the 31 character limit.
1941         dso_cflags       => add("/NAMES=(SHORTENED)"),
1942         ex_libs          => add(sub { return vms_info()->{zlib} || (); }),
1943         shared_target    => "vms-shared",
1944         # def_flag made to empty string so a .opt file gets generated
1945         shared_defflag   => '',
1946         dso_scheme       => "vms",
1947         thread_scheme    => "pthreads",
1948
1949         makedep_scheme   => 'VMS C',
1950         AS               => sub { vms_info()->{AS} },
1951         ASFLAGS          => sub { vms_info()->{ASFLAGS} },
1952         asoutflag        => sub { vms_info()->{asoutflag} },
1953         asflags          => sub { vms_info()->{asflags} },
1954         perlasm_scheme   => sub { vms_info()->{perlasm_scheme} },
1955
1956         disable          => add('pinshared', 'loadereng'),
1957
1958     },
1959
1960     # From HELP CC/POINTER_SIZE:
1961     #
1962     # ----------
1963     # LONG[=ARGV] The compiler assumes 64-bit pointers. If the ARGV option to
1964     #             LONG or 64 is present, the main argument argv will be an
1965     #             array of long pointers instead of an array of short pointers.
1966     #
1967     # 64[=ARGV]   Same as LONG.
1968     # ----------
1969     #
1970     # We don't want the hassle of dealing with 32-bit pointers with argv, so
1971     # we force it to have 64-bit pointers, see the added cflags in the -p64
1972     # config targets below.
1973
1974     "vms-alpha" => {
1975         inherit_from     => [ "vms-generic" ],
1976         bn_ops           => "SIXTY_FOUR_BIT RC4_INT",
1977         pointer_size     => "",
1978     },
1979     "vms-alpha-p32" => {
1980         inherit_from     => [ "vms-alpha" ],
1981         cflags           => add("/POINTER_SIZE=32"),
1982         pointer_size     => "32",
1983     },
1984     "vms-alpha-p64" => {
1985         inherit_from     => [ "vms-alpha" ],
1986         cflags           => add("/POINTER_SIZE=64=ARGV"),
1987         pointer_size     => "64",
1988     },
1989     "vms-ia64" => {
1990         inherit_from     => [ "vms-generic" ],
1991         bn_ops           => "SIXTY_FOUR_BIT RC4_INT",
1992         asm_arch         => sub { vms_info()->{AS} ? 'ia64' : undef },
1993         perlasm_scheme   => 'ias',
1994         pointer_size     => "",
1995
1996     },
1997     "vms-ia64-p32" => {
1998         inherit_from     => [ "vms-ia64" ],
1999         cflags           => add("/POINTER_SIZE=32"),
2000         pointer_size     => "32",
2001     },
2002     "vms-ia64-p64" => {
2003         inherit_from     => [ "vms-ia64" ],
2004         cflags           => add("/POINTER_SIZE=64=ARGV"),
2005         pointer_size     => "64",
2006     },
2007
2008 );