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