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