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