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