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