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