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