Home | History | Annotate | Line # | Download | only in Configurations
10-main.conf revision 1.1.1.15
      1 ## -*- mode: perl; -*-
      2 ## Standard openssl configuration targets.
      3 
      4 # Helper functions for the Windows configs
      5 my $vc_win64a_info = {};
      6 sub vc_win64a_info {
      7     unless (%$vc_win64a_info) {
      8         if (`nasm -v 2>NUL` =~ /NASM version ([0-9]+\.[0-9]+)/ && $1 >= 2.0) {
      9             $vc_win64a_info = { AS        => "nasm",
     10                                 ASFLAGS   => "-g",
     11                                 asflags   => "-Ox -f win64 -DNEAR",
     12                                 asoutflag => "-o ",
     13                                 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 
     33 my $vc_win32_info = {};
     34 sub 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 
     63 my $vc_wince_info = {};
     64 sub 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
    128 my $vms_info = {};
    129 sub 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 
    177 my %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 (at] 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 
    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     # riscv64 below refers to contemporary RISCV Architecture
    818     # specifications,
    819     "linux64-riscv64" => {
    820         inherit_from     => [ "linux-generic64"],
    821         perlasm_scheme   => "linux64",
    822     },
    823 
    824     # loongarch64 below refers to contemporary LoongArch Architecture
    825     # specifications,
    826     "linux64-loongarch64" => {
    827         inherit_from     => [ "linux-generic64"],
    828         perlasm_scheme   => "linux64",
    829     },
    830 
    831     #### IA-32 targets...
    832     #### These two targets are a bit aged and are to be used on older Linux
    833     #### machines where gcc doesn't understand -m32 and -m64
    834     "linux-elf" => {
    835         inherit_from     => [ "linux-generic32" ],
    836         CFLAGS           => add(picker(release => "-fomit-frame-pointer")),
    837         lib_cppflags     => add("-DL_ENDIAN"),
    838         bn_ops           => "BN_LLONG",
    839         asm_arch         => 'x86',
    840         perlasm_scheme   => "elf",
    841     },
    842     "linux-aout" => {
    843         inherit_from     => [ "BASE_unix" ],
    844         CC               => "gcc",
    845         CFLAGS           => add(picker(default => "-Wall",
    846                                        debug   => "-O0 -g",
    847                                        release => "-O3 -fomit-frame-pointer")),
    848         lib_cppflags     => add("-DL_ENDIAN"),
    849         bn_ops           => "BN_LLONG",
    850         thread_scheme    => "(unknown)",
    851         asm_arch         => 'x86',
    852         perlasm_scheme   => "a.out",
    853     },
    854 
    855     #### X86 / X86_64 targets
    856     "linux-x86" => {
    857         inherit_from     => [ "linux-generic32" ],
    858         CFLAGS           => add(picker(release => "-fomit-frame-pointer")),
    859         cflags           => add("-m32"),
    860         cxxflags         => add("-m32"),
    861         lib_cppflags     => add("-DL_ENDIAN"),
    862         bn_ops           => "BN_LLONG",
    863         asm_arch         => 'x86',
    864         perlasm_scheme   => "elf",
    865     },
    866     "linux-x86-clang" => {
    867         inherit_from     => [ "linux-x86" ],
    868         CC               => "clang",
    869         CXX              => "clang++",
    870         ex_libs          => add(threads("-latomic")),
    871     },
    872     "linux-x86_64" => {
    873         inherit_from     => [ "linux-generic64" ],
    874         cflags           => add("-m64"),
    875         cxxflags         => add("-m64"),
    876         lib_cppflags     => add("-DL_ENDIAN"),
    877         bn_ops           => "SIXTY_FOUR_BIT_LONG",
    878         asm_arch         => 'x86_64',
    879         perlasm_scheme   => "elf",
    880         multilib         => "64",
    881     },
    882     "linux-x86_64-clang" => {
    883         inherit_from     => [ "linux-x86_64" ],
    884         CC               => "clang",
    885         CXX              => "clang++",
    886     },
    887     "linux-x32" => {
    888         inherit_from     => [ "linux-generic32" ],
    889         cflags           => add("-mx32"),
    890         cxxflags         => add("-mx32"),
    891         lib_cppflags     => add("-DL_ENDIAN"),
    892         bn_ops           => "SIXTY_FOUR_BIT",
    893         asm_arch         => 'x86_64',
    894         perlasm_scheme   => "elf32",
    895         multilib         => "x32",
    896     },
    897 
    898     "linux-ia64" => {
    899         inherit_from     => [ "linux-generic64" ],
    900         bn_ops           => "SIXTY_FOUR_BIT_LONG",
    901         asm_arch         => 'ia64',
    902         perlasm_scheme   => 'void',
    903     },
    904 
    905     "linux64-s390x" => {
    906         inherit_from     => [ "linux-generic64" ],
    907         cflags           => add("-m64"),
    908         cxxflags         => add("-m64"),
    909         lib_cppflags     => add("-DB_ENDIAN"),
    910         asm_arch         => 's390x',
    911         perlasm_scheme   => "64",
    912         multilib         => "64",
    913     },
    914     "linux32-s390x" => {
    915         #### So called "highgprs" target for z/Architecture CPUs
    916         # "Highgprs" is kernel feature first implemented in Linux
    917         # 2.6.32, see /proc/cpuinfo. The idea is to preserve most
    918         # significant bits of general purpose registers not only
    919         # upon 32-bit process context switch, but even on
    920         # asynchronous signal delivery to such process. This makes
    921         # it possible to deploy 64-bit instructions even in legacy
    922         # application context and achieve better [or should we say
    923         # adequate] performance. The build is binary compatible with
    924         # linux-generic32, and the idea is to be able to install the
    925         # resulting libcrypto.so alongside generic one, e.g. as
    926         # /lib/highgprs/libcrypto.so.x.y, for ldconfig and run-time
    927         # linker to autodiscover. Unfortunately it doesn't work just
    928         # yet, because of couple of bugs in glibc
    929         # sysdeps/s390/dl-procinfo.c affecting ldconfig and ld.so.1...
    930         #
    931         inherit_from     => [ "linux-generic32" ],
    932         cflags           => add("-m31 -Wa,-mzarch"),
    933         cxxflags         => add("-m31 -Wa,-mzarch"),
    934         lib_cppflags     => add("-DB_ENDIAN"),
    935         asm_arch         => 's390x',
    936         perlasm_scheme   => "31",
    937         multilib         => "/highgprs",
    938     },
    939 
    940     #### SPARC Linux setups
    941     "linux-sparcv8" => {
    942         inherit_from     => [ "linux-latomic" ],
    943         cflags           => add("-mcpu=v8"),
    944         cxxflags         => add("-mcpu=v8"),
    945         lib_cppflags     => add("-DB_ENDIAN -DBN_DIV2W"),
    946         asm_arch         => 'sparcv8',
    947         perlasm_scheme   => 'void',
    948     },
    949     "linux-sparcv9" => {
    950         # it's a real mess with -mcpu=ultrasparc option under Linux,
    951         # but -Wa,-Av8plus should do the trick no matter what.
    952         inherit_from     => [ "linux-latomic" ],
    953         cflags           => add("-m32 -mcpu=ultrasparc -Wa,-Av8plus"),
    954         cxxflags         => add("-m32 -mcpu=ultrasparc -Wa,-Av8plus"),
    955         lib_cppflags     => add("-DB_ENDIAN -DBN_DIV2W"),
    956         asm_arch         => 'sparcv9',
    957         perlasm_scheme   => 'void',
    958     },
    959     "linux64-sparcv9" => {
    960         # GCC 3.1 is a requirement
    961         inherit_from     => [ "linux-generic64" ],
    962         cflags           => add("-m64 -mcpu=ultrasparc"),
    963         cxxflags         => add("-m64 -mcpu=ultrasparc"),
    964         lib_cppflags     => add("-DB_ENDIAN"),
    965         ex_libs          => add(threads("-latomic")),
    966         bn_ops           => "BN_LLONG RC4_CHAR",
    967         asm_arch         => 'sparcv9',
    968         perlasm_scheme   => 'void',
    969         multilib         => "64",
    970     },
    971 
    972     "linux-alpha-gcc" => {
    973         inherit_from     => [ "linux-generic64" ],
    974         lib_cppflags     => add("-DL_ENDIAN"),
    975         bn_ops           => "SIXTY_FOUR_BIT_LONG",
    976         asm_arch         => 'alpha',
    977         perlasm_scheme   => "void",
    978     },
    979     "linux-c64xplus" => {
    980         inherit_from     => [ "BASE_unix" ],
    981         # TI_CGT_C6000_7.3.x is a requirement
    982         CC               => "cl6x",
    983         CFLAGS           => "-o2 -ox -ms",
    984         cflags           => "--linux -ea=.s -eo=.o -mv6400+ -pden",
    985         cxxflags         => "--linux -ea=.s -eo=.o -mv6400+ -pden",
    986         cppflags         => combine("-DOPENSSL_SMALL_FOOTPRINT",
    987                                     threads("-D_REENTRANT")),
    988         bn_ops           => "BN_LLONG",
    989         thread_scheme    => "pthreads",
    990         asm_arch         => 'c64xplus',
    991         perlasm_scheme   => "void",
    992         dso_scheme       => "dlfcn",
    993         shared_target    => "linux-shared",
    994         shared_cflag     => "--pic",
    995         shared_ldflag    => add("-z --sysv --shared"),
    996         ranlib           => "true",
    997     },
    998 
    999 #### *BSD
   1000     "BSD-generic32" => {
   1001         # As for thread cflag. Idea is to maintain "collective" set of
   1002         # flags, which would cover all BSD flavors. -pthread applies
   1003         # to them all, but is treated differently. OpenBSD expands is
   1004         # as -D_POSIX_THREAD -lc_r, which is sufficient. FreeBSD 4.x
   1005         # expands it as -lc_r, which has to be accompanied by explicit
   1006         # -D_THREAD_SAFE and sometimes -D_REENTRANT. FreeBSD 5.x
   1007         # expands it as -lc_r, which seems to be sufficient?
   1008         inherit_from     => [ "BASE_unix" ],
   1009         CC               => "cc",
   1010         CFLAGS           => picker(default => "-Wall",
   1011                                    debug   => "-O0 -g",
   1012                                    release => "-O3"),
   1013         cflags           => threads("-pthread"),
   1014         cppflags         => threads("-D_THREAD_SAFE -D_REENTRANT"),
   1015         ex_libs          => add(threads("-pthread")),
   1016         enable           => add("devcryptoeng"),
   1017         bn_ops           => "BN_LLONG",
   1018         thread_scheme    => "pthreads",
   1019         dso_scheme       => "dlfcn",
   1020         shared_target    => "bsd-gcc-shared",
   1021         shared_cflag     => "-fPIC",
   1022     },
   1023     "BSD-generic64" => {
   1024         inherit_from     => [ "BSD-generic32" ],
   1025         bn_ops           => "SIXTY_FOUR_BIT_LONG",
   1026     },
   1027 
   1028     "BSD-x86" => {
   1029         inherit_from     => [ "BSD-generic32" ],
   1030         CFLAGS           => add(picker(release => "-fomit-frame-pointer")),
   1031         lib_cppflags     => add("-DL_ENDIAN"),
   1032         bn_ops           => "BN_LLONG",
   1033         asm_arch         => 'x86',
   1034         perlasm_scheme   => "a.out",
   1035     },
   1036     "BSD-x86-elf" => {
   1037         inherit_from     => [ "BSD-x86" ],
   1038         perlasm_scheme   => "elf",
   1039     },
   1040 
   1041     "BSD-sparcv8" => {
   1042         inherit_from     => [ "BSD-generic32" ],
   1043         cflags           => add("-mcpu=v8"),
   1044         lib_cppflags     => add("-DB_ENDIAN"),
   1045         asm_arch         => 'sparcv8',
   1046         perlasm_scheme   => 'void',
   1047     },
   1048     "BSD-sparc64" => {
   1049         # -DMD32_REG_T=int doesn't actually belong in sparc64 target, it
   1050         # simply *happens* to work around a compiler bug in gcc 3.3.3,
   1051         # triggered by RIPEMD160 code.
   1052         inherit_from     => [ "BSD-generic64" ],
   1053         lib_cppflags     => add("-DB_ENDIAN -DMD32_REG_T=int"),
   1054         bn_ops           => "BN_LLONG",
   1055         asm_arch         => 'sparcv9',
   1056         perlasm_scheme   => 'void',
   1057     },
   1058 
   1059     "BSD-ia64" => {
   1060         inherit_from     => [ "BSD-generic64" ],
   1061         lib_cppflags     => add("-DL_ENDIAN"),
   1062         bn_ops           => "SIXTY_FOUR_BIT_LONG",
   1063         asm_arch         => 'ia64',
   1064         perlasm_scheme   => 'void',
   1065     },
   1066 
   1067     "BSD-x86_64" => {
   1068         inherit_from     => [ "BSD-generic64" ],
   1069         lib_cppflags     => add("-DL_ENDIAN"),
   1070         bn_ops           => "SIXTY_FOUR_BIT_LONG",
   1071         asm_arch         => 'x86_64',
   1072         perlasm_scheme   => "elf",
   1073     },
   1074 
   1075     "BSD-aarch64" => {
   1076         inherit_from     => [ "BSD-generic64" ],
   1077         lib_cppflags     => add("-DL_ENDIAN"),
   1078         bn_ops           => "SIXTY_FOUR_BIT_LONG",
   1079         asm_arch         => 'aarch64',
   1080         perlasm_scheme   => "linux64",
   1081     },
   1082 
   1083     # riscv64 below refers to contemporary RISCV Architecture
   1084     # specifications,
   1085     "BSD-riscv64" => {
   1086         inherit_from     => [ "BSD-generic64"],
   1087         perlasm_scheme   => "linux64",
   1088     },
   1089 
   1090     "bsdi-elf-gcc" => {
   1091         inherit_from     => [ "BASE_unix" ],
   1092         CC               => "gcc",
   1093         CFLAGS           => "-fomit-frame-pointer -O3 -Wall",
   1094         lib_cppflags     => "-DPERL5 -DL_ENDIAN",
   1095         ex_libs          => add("-ldl"),
   1096         bn_ops           => "BN_LLONG",
   1097         asm_arch         => 'x86',
   1098         perlasm_scheme   => "elf",
   1099         thread_scheme    => "(unknown)",
   1100         dso_scheme       => "dlfcn",
   1101         shared_target    => "bsd-gcc-shared",
   1102         shared_cflag     => "-fPIC",
   1103     },
   1104 
   1105 #### SCO/Caldera targets.
   1106 #
   1107 # Originally we had like unixware-*, unixware-*-pentium, unixware-*-p6, etc.
   1108 # Now we only have blended unixware-* as it's the only one used by ./config.
   1109 # If you want to optimize for particular microarchitecture, bypass ./config
   1110 # and './Configure unixware-7 -Kpentium_pro' or whatever appropriate.
   1111 # Note that not all targets include assembler support. Mostly because of
   1112 # lack of motivation to support out-of-date platforms with out-of-date
   1113 # compiler drivers and assemblers.
   1114 #
   1115 # UnixWare 2.0x fails destest with -O.
   1116     "unixware-2.0" => {
   1117         inherit_from     => [ "BASE_unix" ],
   1118         CC               => "cc",
   1119         cflags           => threads("-Kthread"),
   1120         lib_cppflags     => "-DFILIO_H -DNO_STRINGS_H",
   1121         ex_libs          => add("-lsocket -lnsl -lresolv -lx"),
   1122         thread_scheme    => "uithreads",
   1123     },
   1124     "unixware-2.1" => {
   1125         inherit_from     => [ "BASE_unix" ],
   1126         CC               => "cc",
   1127         CFLAGS           => "-O",
   1128         cflags           => threads("-Kthread"),
   1129         lib_cppflags     => "-DFILIO_H",
   1130         ex_libs          => add("-lsocket -lnsl -lresolv -lx"),
   1131         thread_scheme    => "uithreads",
   1132     },
   1133     "unixware-7" => {
   1134         inherit_from     => [ "BASE_unix" ],
   1135         CC               => "cc",
   1136         CFLAGS           => "-O",
   1137         cflags           => combine("-Kalloca", threads("-Kthread")),
   1138         lib_cppflags     => "-DFILIO_H",
   1139         ex_libs          => add("-lsocket -lnsl"),
   1140         thread_scheme    => "uithreads",
   1141         bn_ops           => "BN_LLONG",
   1142         asm_arch         => 'x86',
   1143         perlasm_scheme   => "elf-1",
   1144         dso_scheme       => "dlfcn",
   1145         shared_target    => "svr5-shared",
   1146         shared_cflag     => "-Kpic",
   1147     },
   1148     "unixware-7-gcc" => {
   1149         inherit_from     => [ "BASE_unix" ],
   1150         CC               => "gcc",
   1151         CFLAGS           => "-O3 -fomit-frame-pointer -Wall",
   1152         cppflags         => add(threads("-D_REENTRANT")),
   1153         lib_cppflags     => add("-DL_ENDIAN -DFILIO_H"),
   1154         ex_libs          => add("-lsocket -lnsl"),
   1155         bn_ops           => "BN_LLONG",
   1156         thread_scheme    => "pthreads",
   1157         asm_arch         => 'x86',
   1158         perlasm_scheme   => "elf-1",
   1159         dso_scheme       => "dlfcn",
   1160         shared_target    => "gnu-shared",
   1161         shared_cflag     => "-fPIC",
   1162     },
   1163 # SCO 5 - Ben Laurie says the -O breaks the SCO cc.
   1164     "sco5-cc" => {
   1165         inherit_from     => [ "BASE_unix" ],
   1166         cc               => "cc",
   1167         cflags           => "-belf",
   1168         ex_libs          => add("-lsocket -lnsl"),
   1169         thread_scheme    => "(unknown)",
   1170         asm_arch         => 'x86',
   1171         perlasm_scheme   => "elf-1",
   1172         dso_scheme       => "dlfcn",
   1173         shared_target    => "svr3-shared",
   1174         shared_cflag     => "-Kpic",
   1175     },
   1176     "sco5-gcc" => {
   1177         inherit_from     => [ "BASE_unix" ],
   1178         cc               => "gcc",
   1179         cflags           => "-O3 -fomit-frame-pointer",
   1180         ex_libs          => add("-lsocket -lnsl"),
   1181         bn_ops           => "BN_LLONG",
   1182         thread_scheme    => "(unknown)",
   1183         asm_arch         => 'x86',
   1184         perlasm_scheme   => "elf-1",
   1185         dso_scheme       => "dlfcn",
   1186         shared_target    => "svr3-shared",
   1187         shared_cflag     => "-fPIC",
   1188     },
   1189 
   1190 #### IBM's AIX.
   1191     # Below targets assume AIX >=5. Caveat lector. If you are accustomed
   1192     # to control compilation "bitness" by setting $OBJECT_MODE environment
   1193     # variable, then you should know that in OpenSSL case it's considered
   1194     # only in ./config. Once configured, build procedure remains "deaf" to
   1195     # current value of $OBJECT_MODE.
   1196     "aix-common" => {
   1197         inherit_from     => [ "BASE_unix" ],
   1198         template         => 1,
   1199         sys_id           => "AIX",
   1200         lib_cppflags     => "-DB_ENDIAN",
   1201         lflags           => "-Wl,-bsvr4",
   1202         thread_scheme    => "pthreads",
   1203         dso_scheme       => "dlfcn",
   1204         shared_target    => "aix",
   1205         module_ldflags   => "-Wl,-G,-bsymbolic,-bnoentry",
   1206         shared_ldflag    => "-Wl,-G,-bsymbolic,-bnoentry",
   1207         shared_defflag   => "-Wl,-bE:",
   1208         shared_fipsflag  => "-Wl,-binitfini:_init:_cleanup",
   1209         perl_platform    => 'AIX',
   1210     },
   1211     "aix-gcc" => {
   1212         inherit_from     => [ "aix-common" ],
   1213         CC               => "gcc",
   1214         CFLAGS           => picker(debug   => "-O0 -g",
   1215                                    release => "-O"),
   1216         cflags           => add(threads("-pthread")),
   1217         ex_libs          => add(threads("-pthread")),
   1218         bn_ops           => "BN_LLONG RC4_CHAR",
   1219         asm_arch         => 'ppc32',
   1220         perlasm_scheme   => "aix32",
   1221         shared_ldflag    => add_before("-shared -static-libgcc"),
   1222         AR               => add("-X32"),
   1223         RANLIB           => add("-X32"),
   1224     },
   1225     "aix64-gcc" => {
   1226         inherit_from     => [ "aix-common" ],
   1227         CC               => "gcc",
   1228         CFLAGS           => picker(debug   => "-O0 -g",
   1229                                    release => "-O"),
   1230         cflags           => combine("-maix64", threads("-pthread")),
   1231         ex_libs          => add(threads("-pthread")),
   1232         bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
   1233         asm_arch         => 'ppc64',
   1234         perlasm_scheme   => "aix64",
   1235         shared_ldflag    => add_before("-shared -static-libgcc"),
   1236         shared_extension => "64.so.\$(SHLIB_VERSION_NUMBER)",
   1237         AR               => add("-X64"),
   1238         RANLIB           => add("-X64"),
   1239     },
   1240     "aix64-gcc-as" => {
   1241         inherit_from     => [ "aix64-gcc" ],
   1242         perlasm_scheme   => "aix64-as",
   1243     },
   1244     "aix-cc" => {
   1245         inherit_from     => [ "aix-common" ],
   1246         CC               => "cc",
   1247         CFLAGS           => picker(debug   => "-O0 -g",
   1248                                    release => "-O"),
   1249         cflags           => combine("-q32 -qmaxmem=16384 -qro -qroconst",
   1250                                     threads("-qthreaded")),
   1251         cppflags         => threads("-D_THREAD_SAFE"),
   1252         ex_libs          => add(threads("-lpthreads")),
   1253         bn_ops           => "BN_LLONG RC4_CHAR",
   1254         asm_arch         => 'ppc32',
   1255         perlasm_scheme   => "aix32",
   1256         shared_cflag     => "-qpic",
   1257         AR               => add("-X32"),
   1258         RANLIB           => add("-X32"),
   1259     },
   1260     "aix64-cc" => {
   1261         inherit_from     => [ "aix-common" ],
   1262         CC               => "cc",
   1263         CFLAGS           => picker(debug   => "-O0 -g",
   1264                                    release => "-O"),
   1265         cflags           => combine("-q64 -qmaxmem=16384 -qro -qroconst",
   1266                                     threads("-qthreaded")),
   1267         cppflags         => threads("-D_THREAD_SAFE"),
   1268         ex_libs          => add(threads("-lpthreads")),
   1269         bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
   1270         asm_arch         => 'ppc64',
   1271         perlasm_scheme   => "aix64",
   1272         dso_scheme       => "dlfcn",
   1273         shared_cflag     => "-qpic",
   1274         shared_extension => "64.so.\$(SHLIB_VERSION_NUMBER)",
   1275         AR               => add("-X64"),
   1276         RANLIB           => add("-X64"),
   1277     },
   1278 
   1279 # SIEMENS BS2000/OSD: an EBCDIC-based mainframe
   1280     "BS2000-OSD" => {
   1281         inherit_from     => [ "BASE_unix" ],
   1282         CC               => "c89",
   1283         CFLAGS           => "-O",
   1284         cflags           => "-XLLML -XLLMK -XL",
   1285         cppflags         => "-DCHARSET_EBCDIC",
   1286         lib_cppflags     => "-DB_ENDIAN",
   1287         ex_libs          => add("-lsocket -lnsl"),
   1288         bn_ops           => "THIRTY_TWO_BIT RC4_CHAR",
   1289         thread_scheme    => "(unknown)",
   1290     },
   1291 
   1292 #### Visual C targets
   1293 #
   1294 # Win64 targets, WIN64I denotes IA-64/Itanium and WIN64A - AMD64
   1295 #
   1296 # Note about /wd4090, disable warning C4090. This warning returns false
   1297 # positives in some situations. Disabling it altogether masks both
   1298 # legitimate and false cases, but as we compile on multiple platforms,
   1299 # we rely on other compilers to catch legitimate cases.
   1300 #
   1301 # Also note that we force threads no matter what.  Configuring "no-threads"
   1302 # is ignored.
   1303 #
   1304 # UNICODE is defined in VC-common and applies to all targets. It used to
   1305 # be an opt-in option for VC-WIN32, but not anymore. The original reason
   1306 # was because ANSI API was *native* system interface for no longer
   1307 # supported Windows 9x. Keep in mind that UNICODE only affects how
   1308 # OpenSSL libraries interact with underlying OS, it doesn't affect API
   1309 # that OpenSSL presents to application.
   1310 
   1311     "VC-common" => {
   1312         inherit_from     => [ "BASE_Windows" ],
   1313         template         => 1,
   1314         CC               => "cl",
   1315         CPP              => '$(CC) /EP /C',
   1316         CFLAGS           => "/W3 /wd4090 /nologo",
   1317         coutflag         => "/Fo",
   1318         LD               => "link",
   1319         LDFLAGS          => "/nologo /debug",
   1320         ldoutflag        => "/out:",
   1321         ldpostoutflag    => "",
   1322         ld_resp_delim    => "\n",
   1323         bin_lflags       => "setargv.obj",
   1324         makedepcmd       => '$(CC) /Zs /showIncludes',
   1325         makedep_scheme   => 'VC',
   1326         AR               => "lib",
   1327         ARFLAGS          => "/nologo",
   1328         aroutflag        => "/out:",
   1329         ar_resp_delim    => "\n",
   1330         RC               => "rc",
   1331         rcoutflag        => "/fo",
   1332         defines          => add("OPENSSL_SYS_WIN32", "WIN32_LEAN_AND_MEAN",
   1333                                 "UNICODE", "_UNICODE",
   1334                                 "_CRT_SECURE_NO_DEPRECATE",
   1335                                 "_WINSOCK_DEPRECATED_NO_WARNINGS"),
   1336         lib_cflags       => add("/Zi /Fdossl_static.pdb"),
   1337         lib_defines      => add("L_ENDIAN"),
   1338         dso_cflags       => "/Zi /Fddso.pdb",
   1339         bin_cflags       => "/Zi /Fdapp.pdb",
   1340         # def_flag made to empty string so a .def file gets generated
   1341         shared_defflag   => '',
   1342         shared_ldflag    => "/dll",
   1343         shared_target    => "win-shared", # meaningless except it gives Configure a hint
   1344         lddefflag        => "/def:",
   1345         ldresflag        => " ",
   1346         ld_implib_flag   => "/implib:",
   1347         thread_scheme    => "winthreads",
   1348         dso_scheme       => "win32",
   1349         perl_platform    => 'Windows::MSVC',
   1350         # additional parameter to build_scheme denotes install-path "flavour"
   1351         build_scheme     => add("VC-common", { separator => undef }),
   1352     },
   1353     "VC-noCE-common" => {
   1354         inherit_from     => [ "VC-common" ],
   1355         template         => 1,
   1356         CFLAGS           => add(picker(debug   => '/Od',
   1357                                        release => '/O2')),
   1358         cflags           => add(picker(default => '/Gs0 /GF /Gy',
   1359                                        debug   =>
   1360                                        sub {
   1361                                            ($disabled{shared} ? "" : "/MDd");
   1362                                        },
   1363                                        release =>
   1364                                        sub {
   1365                                            ($disabled{shared} ? "" : "/MD");
   1366                                        })),
   1367         defines          => add(picker(default => [], # works as type cast
   1368                                        debug   => [ "DEBUG", "_DEBUG" ])),
   1369         lib_cflags       => add(sub { $disabled{shared} ? "/MT /Zl" : () }),
   1370         # Following might/should appears controversial, i.e. defining
   1371         # /MDd without evaluating $disabled{shared}. It works in
   1372         # non-shared build because static library is compiled with /Zl
   1373         # and bares no reference to specific RTL. And it works in
   1374         # shared build because multiple /MDd options are not prohibited.
   1375         # But why /MDd in static build? Well, basically this is just a
   1376         # reference point, which allows to catch eventual errors that
   1377         # would prevent those who want to wrap OpenSSL into own .DLL.
   1378         # Why not /MD in release build then? Well, some are likely to
   1379         # prefer [non-debug] openssl.exe to be free from Micorosoft RTL
   1380         # redistributable.
   1381         bin_cflags       => add(picker(debug   => "/MDd",
   1382                                        release => sub { $disabled{shared} ? "/MT" : () },
   1383                                       )),
   1384         bin_lflags       => add("/subsystem:console /opt:ref"),
   1385         ex_libs          => add(sub {
   1386             my @ex_libs = ();
   1387             push @ex_libs, 'ws2_32.lib' unless $disabled{sock};
   1388             push @ex_libs, 'gdi32.lib advapi32.lib crypt32.lib user32.lib';
   1389             return join(" ", @ex_libs);
   1390         }),
   1391     },
   1392     "VC-WIN64-common" => {
   1393         inherit_from     => [ "VC-noCE-common" ],
   1394         template         => 1,
   1395         ex_libs          => add(sub {
   1396             my @ex_libs = ();
   1397             push @ex_libs, 'bufferoverflowu.lib' if (`cl 2>&1` =~ /14\.00\.4[0-9]{4}\./);
   1398             return join(" ", @_, @ex_libs);
   1399         }),
   1400         bn_ops           => add("SIXTY_FOUR_BIT"),
   1401     },
   1402     "VC-WIN64I" => {
   1403         inherit_from     => [ "VC-WIN64-common" ],
   1404         AS               => "ias",
   1405         ASFLAGS          => "-d debug",
   1406         asoutflag        => "-o ",
   1407         sys_id           => "WIN64I",
   1408         uplink_arch      => 'ia64',
   1409         asm_arch         => 'ia64',
   1410         perlasm_scheme   => "ias",
   1411         multilib         => "-ia64",
   1412     },
   1413     "VC-WIN64A" => {
   1414         inherit_from     => [ "VC-WIN64-common" ],
   1415         AS               => sub { vc_win64a_info()->{AS} },
   1416         ASFLAGS          => sub { vc_win64a_info()->{ASFLAGS} },
   1417         asoutflag        => sub { vc_win64a_info()->{asoutflag} },
   1418         asflags          => sub { vc_win64a_info()->{asflags} },
   1419         sys_id           => "WIN64A",
   1420         uplink_arch      => 'x86_64',
   1421         asm_arch         => 'x86_64',
   1422         perlasm_scheme   => sub { vc_win64a_info()->{perlasm_scheme} },
   1423         multilib         => "-x64",
   1424     },
   1425     "VC-WIN32" => {
   1426         inherit_from     => [ "VC-noCE-common" ],
   1427         AS               => sub { vc_win32_info()->{AS} },
   1428         ASFLAGS          => sub { vc_win32_info()->{ASFLAGS} },
   1429         asoutflag        => sub { vc_win32_info()->{asoutflag} },
   1430         asflags          => sub { vc_win32_info()->{asflags} },
   1431         sys_id           => "WIN32",
   1432         bn_ops           => add("BN_LLONG"),
   1433         uplink_arch      => 'common',
   1434         asm_arch         => 'x86',
   1435         perlasm_scheme   => sub { vc_win32_info()->{perlasm_scheme} },
   1436         # "WOW" stands for "Windows on Windows", and "VC-WOW" engages
   1437         # some installation path heuristics in windows-makefile.tmpl...
   1438         build_scheme     => add("VC-WOW", { separator => undef }),
   1439     },
   1440     "VC-CE" => {
   1441         inherit_from     => [ "VC-common" ],
   1442         CFLAGS           => add(picker(debug   => "/Od",
   1443                                        release => "/O1i")),
   1444         CPPDEFINES       => picker(debug   => [ "DEBUG", "_DEBUG" ]),
   1445         LDFLAGS          => add("/nologo /opt:ref"),
   1446         cflags           =>
   1447             combine('/GF /Gy',
   1448                     sub { vc_wince_info()->{cflags}; },
   1449                     sub { `cl 2>&1` =~ /Version ([0-9]+)\./ && $1>=14
   1450                               ? ($disabled{shared} ? " /MT" : " /MD")
   1451                               : " /MC"; }),
   1452         cppflags         => sub { vc_wince_info()->{cppflags}; },
   1453         lib_defines      => add("NO_CHMOD", "OPENSSL_SMALL_FOOTPRINT"),
   1454         lib_cppflags     => sub { vc_wince_info()->{cppflags}; },
   1455         includes         =>
   1456             add(combine(sub { defined(env('WCECOMPAT'))
   1457                               ? '$(WCECOMPAT)/include' : (); },
   1458                         sub { defined(env('PORTSDK_LIBPATH'))
   1459                                   ? '$(PORTSDK_LIBPATH)/../../include'
   1460                                   : (); })),
   1461         lflags           => add(combine(sub { vc_wince_info()->{lflags}; },
   1462                                         sub { defined(env('PORTSDK_LIBPATH'))
   1463                                                   ? "/entry:mainCRTstartup" : (); })),
   1464         sys_id           => "WINCE",
   1465         bn_ops           => add("BN_LLONG"),
   1466         ex_libs          => add(sub {
   1467             my @ex_libs = ();
   1468             push @ex_libs, 'ws2.lib' unless $disabled{sock};
   1469             push @ex_libs, 'crypt32.lib';
   1470             if (defined(env('WCECOMPAT'))) {
   1471                 my $x = '$(WCECOMPAT)/lib';
   1472                 if (-f "$x/env('TARGETCPU')/wcecompatex.lib") {
   1473                     $x .= '/$(TARGETCPU)/wcecompatex.lib';
   1474                 } else {
   1475                     $x .= '/wcecompatex.lib';
   1476                 }
   1477                 push @ex_libs, $x;
   1478             }
   1479             push @ex_libs, '$(PORTSDK_LIBPATH)/portlib.lib'
   1480                 if (defined(env('PORTSDK_LIBPATH')));
   1481             push @ex_libs, '/nodefaultlib coredll.lib corelibc.lib'
   1482                 if (env('TARGETCPU') =~ /^X86|^ARMV4[IT]/);
   1483             return join(" ", @ex_libs);
   1484         }),
   1485     },
   1486 
   1487 #### MinGW
   1488     "mingw-common" => {
   1489         inherit_from     => [ 'BASE_unix' ],
   1490         template         => 1,
   1491         CC               => "gcc",
   1492         CFLAGS           => picker(default => "-Wall",
   1493                                    debug   => "-g -O0",
   1494                                    release => "-O3"),
   1495         cppflags         => combine("-DUNICODE -D_UNICODE -DWIN32_LEAN_AND_MEAN",
   1496                                     threads("-D_MT")),
   1497         lib_cppflags     => "-DL_ENDIAN",
   1498         ex_libs          => add("-lws2_32 -lgdi32 -lcrypt32"),
   1499         thread_scheme    => "winthreads",
   1500         dso_scheme       => "win32",
   1501         shared_target    => "mingw-shared",
   1502         shared_cppflags  => add("_WINDLL"),
   1503         shared_ldflag    => "-static-libgcc",
   1504 
   1505         perl_platform    => 'mingw',
   1506     },
   1507     "mingw" => {
   1508         inherit_from     => [ "mingw-common" ],
   1509         CFLAGS           => add(picker(release => "-fomit-frame-pointer")),
   1510         cflags           => "-m32",
   1511         sys_id           => "MINGW32",
   1512         bn_ops           => add("BN_LLONG"),
   1513         asm_arch         => 'x86',
   1514         uplink_arch      => 'x86',
   1515         perlasm_scheme   => "coff",
   1516         shared_rcflag    => "--target=pe-i386",
   1517         multilib         => "",
   1518     },
   1519     "mingw64" => {
   1520         # As for uplink_arch. Applink makes it possible to use
   1521         # .dll compiled with one compiler with application compiled with
   1522         # another compiler. It's possible to engage Applink support in
   1523         # mingw64 build, but it's not done, because until mingw64
   1524         # supports structured exception handling, one can't seriously
   1525         # consider its binaries for using with non-mingw64 run-time
   1526         # environment. And as mingw64 is always consistent with itself,
   1527         # Applink is never engaged and can as well be omitted.
   1528         inherit_from     => [ "mingw-common" ],
   1529         cflags           => "-m64",
   1530         sys_id           => "MINGW64",
   1531         bn_ops           => add("SIXTY_FOUR_BIT"),
   1532         asm_arch         => 'x86_64',
   1533         uplink_arch      => undef,
   1534         perlasm_scheme   => "mingw64",
   1535         shared_rcflag    => "--target=pe-x86-64",
   1536         multilib         => "64",
   1537     },
   1538 
   1539 #### UEFI
   1540     "UEFI" => {
   1541         inherit_from     => [ "BASE_unix" ],
   1542         CC               => "cc",
   1543         CFLAGS           => "-O",
   1544         lib_cppflags     => "-DL_ENDIAN",
   1545         sys_id           => "UEFI",
   1546     },
   1547     "UEFI-x86" => {
   1548         inherit_from     => [ "UEFI" ],
   1549         asm_arch         => 'x86',
   1550         perlasm_scheme   => "win32n",
   1551     },
   1552     "UEFI-x86_64" => {
   1553         inherit_from     => [ "UEFI" ],
   1554         asm_arch         => 'x86_64',
   1555         perlasm_scheme   => "nasm",
   1556     },
   1557 
   1558 #### UWIN
   1559     "UWIN" => {
   1560         inherit_from     => [ "BASE_unix" ],
   1561         CC               => "cc",
   1562         CFLAGS           => "-O -Wall",
   1563         lib_cppflags     => "-DTERMIOS -DL_ENDIAN",
   1564         sys_id           => "UWIN",
   1565         bn_ops           => "BN_LLONG",
   1566         dso_scheme       => "win32",
   1567     },
   1568 
   1569 #### Cygwin
   1570     "Cygwin-common" => {
   1571         inherit_from     => [ "BASE_unix" ],
   1572         template         => 1,
   1573 
   1574         CC               => "gcc",
   1575         CFLAGS           => picker(default => "-Wall",
   1576                                    debug   => "-g -O0",
   1577                                    release => "-O3"),
   1578         lib_cppflags     => "-DTERMIOS -DL_ENDIAN",
   1579         sys_id           => "CYGWIN",
   1580         thread_scheme    => "pthread",
   1581         dso_scheme       => "dlfcn",
   1582         shared_target    => "cygwin-shared",
   1583         shared_cppflags  => "-D_WINDLL",
   1584 
   1585         perl_platform    => 'Cygwin',
   1586     },
   1587     "Cygwin-x86" => {
   1588         inherit_from     => [ "Cygwin-common" ],
   1589         CFLAGS           => add(picker(release => "-O3 -fomit-frame-pointer")),
   1590         bn_ops           => "BN_LLONG",
   1591         asm_arch         => 'x86',
   1592         perlasm_scheme   => "coff",
   1593     },
   1594     "Cygwin-x86_64" => {
   1595         inherit_from     => [ "Cygwin-common" ],
   1596         CC               => "gcc",
   1597         bn_ops           => "SIXTY_FOUR_BIT_LONG",
   1598         asm_arch         => 'x86_64',
   1599         perlasm_scheme   => "mingw64",
   1600     },
   1601     # Backward compatibility for those using this target
   1602     "Cygwin" => {
   1603 	inherit_from     => [ "Cygwin-x86" ]
   1604     },
   1605     # In case someone constructs the Cygwin target name themself
   1606     "Cygwin-i386" => {
   1607 	inherit_from     => [ "Cygwin-x86" ]
   1608     },
   1609     "Cygwin-i486" => {
   1610 	inherit_from     => [ "Cygwin-x86" ]
   1611     },
   1612     "Cygwin-i586" => {
   1613 	inherit_from     => [ "Cygwin-x86" ]
   1614     },
   1615     "Cygwin-i686" => {
   1616 	inherit_from     => [ "Cygwin-x86" ]
   1617     },
   1618 
   1619 ##### MacOS X (a.k.a. Darwin) setup
   1620     "darwin-common" => {
   1621         inherit_from     => [ "BASE_unix" ],
   1622         template         => 1,
   1623         CC               => "cc",
   1624         CFLAGS           => picker(debug   => "-g -O0",
   1625                                    release => "-O3"),
   1626         cppflags         => threads("-D_REENTRANT"),
   1627         lflags           => add("-Wl,-search_paths_first"),
   1628         sys_id           => "MACOSX",
   1629         bn_ops           => "BN_LLONG RC4_CHAR",
   1630         thread_scheme    => "pthreads",
   1631         perlasm_scheme   => "osx32",
   1632         dso_scheme       => "dlfcn",
   1633         ranlib           => "ranlib -c",
   1634         shared_target    => "darwin-shared",
   1635         shared_cflag     => "-fPIC",
   1636         shared_extension => ".\$(SHLIB_VERSION_NUMBER).dylib",
   1637     },
   1638     # Option "freeze" such as -std=gnu9x can't negatively interfere
   1639     # with future defaults for below two targets, because MacOS X
   1640     # for PPC has no future, it was discontinued by vendor in 2009.
   1641     "darwin-ppc-cc" => { inherit_from => [ "darwin-ppc" ] }, # Historic alias
   1642     "darwin-ppc" => {
   1643         inherit_from     => [ "darwin-common" ],
   1644         cflags           => add("-arch ppc -std=gnu9x -Wa,-force_cpusubtype_ALL"),
   1645         lib_cppflags     => add("-DB_ENDIAN"),
   1646         shared_cflag     => add("-fno-common"),
   1647         asm_arch         => 'ppc32',
   1648         perlasm_scheme   => "osx32",
   1649     },
   1650     "darwin64-ppc-cc" => { inherit_from => [ "darwin64-ppc" ] }, # Historic alias
   1651     "darwin64-ppc" => {
   1652         inherit_from     => [ "darwin-common" ],
   1653         cflags           => add("-arch ppc64 -std=gnu9x"),
   1654         lib_cppflags     => add("-DB_ENDIAN"),
   1655         bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
   1656         asm_arch         => 'ppc64',
   1657         perlasm_scheme   => "osx64",
   1658     },
   1659     "darwin-i386-cc" => { inherit_from => [ "darwin-i386" ] }, # Historic alias
   1660     "darwin-i386" => {
   1661         inherit_from     => [ "darwin-common" ],
   1662         CFLAGS           => add(picker(release => "-fomit-frame-pointer")),
   1663         cflags           => add("-arch i386"),
   1664         lib_cppflags     => add("-DL_ENDIAN"),
   1665         bn_ops           => "BN_LLONG RC4_INT",
   1666         asm_arch         => 'x86',
   1667         perlasm_scheme   => "macosx",
   1668     },
   1669     "darwin64-x86_64-cc" => { inherit_from => [ "darwin64-x86_64" ] }, # Historic alias
   1670     "darwin64-x86_64" => {
   1671         inherit_from     => [ "darwin-common" ],
   1672         CFLAGS           => add("-Wall"),
   1673         cflags           => add("-arch x86_64"),
   1674         lib_cppflags     => add("-DL_ENDIAN"),
   1675         bn_ops           => "SIXTY_FOUR_BIT_LONG",
   1676         asm_arch         => 'x86_64',
   1677         perlasm_scheme   => "macosx",
   1678     },
   1679     "darwin64-arm64-cc" => { inherit_from => [ "darwin64-arm64" ] }, # "Historic" alias
   1680     "darwin64-arm64" => {
   1681         inherit_from     => [ "darwin-common" ],
   1682         CFLAGS           => add("-Wall"),
   1683         cflags           => add("-arch arm64"),
   1684         lib_cppflags     => add("-DL_ENDIAN"),
   1685         bn_ops           => "SIXTY_FOUR_BIT_LONG",
   1686         asm_arch         => 'aarch64',
   1687         perlasm_scheme   => "ios64",
   1688     },
   1689 
   1690 ##### GNU Hurd
   1691     "hurd-x86" => {
   1692         inherit_from     => [ "BASE_unix" ],
   1693         CC               => "gcc",
   1694         CFLAGS           => "-O3 -fomit-frame-pointer -Wall",
   1695         cflags           => threads("-pthread"),
   1696         lib_cppflags     => "-DL_ENDIAN",
   1697         ex_libs          => add("-ldl", threads("-pthread")),
   1698         bn_ops           => "BN_LLONG",
   1699         asm_arch         => 'x86',
   1700         perlasm_scheme   => 'elf',
   1701         thread_scheme    => "pthreads",
   1702         dso_scheme       => "dlfcn",
   1703         shared_target    => "linux-shared",
   1704         shared_cflag     => "-fPIC",
   1705     },
   1706 
   1707 ##### VxWorks for various targets
   1708     "vxworks-ppc60x" => {
   1709         inherit_from     => [ "BASE_unix" ],
   1710         CC               => "ccppc",
   1711         CFLAGS           => "-O2 -Wall -fstrength-reduce",
   1712         cflags           => "-mrtp -mhard-float -mstrict-align -fno-implicit-fp -fno-builtin -fno-strict-aliasing",
   1713         cppflags         => combine("-D_REENTRANT -DPPC32_fp60x -DCPU=PPC32",
   1714                                     "_DTOOL_FAMILY=gnu -DTOOL=gnu",
   1715                                     "-I\$(WIND_BASE)/target/usr/h",
   1716                                     "-I\$(WIND_BASE)/target/usr/h/wrn/coreip"),
   1717         sys_id           => "VXWORKS",
   1718         lflags           => add("-L \$(WIND_BASE)/target/usr/lib/ppc/PPC32/common"),
   1719         ex_libs          => add("-Wl,--defsym,__wrs_rtp_base=0xe0000000"),
   1720     },
   1721     "vxworks-ppcgen" => {
   1722         inherit_from     => [ "BASE_unix" ],
   1723         CC               => "ccppc",
   1724         CFLAGS           => "-O1 -Wall",
   1725         cflags           => "-mrtp -msoft-float -mstrict-align -fno-builtin -fno-strict-aliasing",
   1726         cppflags         => combine("-D_REENTRANT -DPPC32 -DCPU=PPC32",
   1727                                     "-DTOOL_FAMILY=gnu -DTOOL=gnu",
   1728                                     "-I\$(WIND_BASE)/target/usr/h",
   1729                                     "-I\$(WIND_BASE)/target/usr/h/wrn/coreip"),
   1730         sys_id           => "VXWORKS",
   1731         lflags           => add("-L \$(WIND_BASE)/target/usr/lib/ppc/PPC32/sfcommon"),
   1732         ex_libs          => add("-Wl,--defsym,__wrs_rtp_base=0xe0000000"),
   1733     },
   1734     "vxworks-ppc405" => {
   1735         inherit_from     => [ "BASE_unix" ],
   1736         CC               => "ccppc",
   1737         CFLAGS           => "-g",
   1738         cflags           => "-msoft-float -mlongcall",
   1739         cppflags         => combine("-D_REENTRANT -DPPC32 -DCPU=PPC405",
   1740                                     "-DTOOL_FAMILY=gnu -DTOOL=gnu",
   1741                                     "-I\$(WIND_BASE)/target/h"),
   1742         sys_id           => "VXWORKS",
   1743         lflags           => add("-r"),
   1744     },
   1745     "vxworks-ppc750" => {
   1746         inherit_from     => [ "BASE_unix" ],
   1747         CC               => "ccppc",
   1748         CFLAGS           => "-ansi -fvolatile -Wall \$(DEBUG_FLAG)",
   1749         cflags           => "-nostdinc -fno-builtin -fno-for-scope -fsigned-char -msoft-float -mlongcall",
   1750         cppflags         => combine("-DPPC750 -D_REENTRANT -DCPU=PPC604",
   1751                                     "-I\$(WIND_BASE)/target/h"),
   1752         sys_id           => "VXWORKS",
   1753         lflags           => add("-r"),
   1754     },
   1755     "vxworks-ppc750-debug" => {
   1756         inherit_from     => [ "BASE_unix" ],
   1757         CC               => "ccppc",
   1758         CFLAGS           => "-ansi -fvolatile -Wall -g",
   1759         cflags           => "-nostdinc -fno-builtin -fno-for-scope -fsigned-char -msoft-float -mlongcall",
   1760         cppflags         => combine("-DPPC750 -D_REENTRANT -DCPU=PPC604",
   1761                                     "-DPEDANTIC -DDEBUG",
   1762                                     "-I\$(WIND_BASE)/target/h"),
   1763         sys_id           => "VXWORKS",
   1764         lflags           => add("-r"),
   1765     },
   1766     "vxworks-ppc860" => {
   1767         inherit_from     => [ "BASE_unix" ],
   1768         CC               => "ccppc",
   1769         cflags           => "-nostdinc -msoft-float",
   1770         cppflags         => combine("-DCPU=PPC860 -DNO_STRINGS_H",
   1771                                     "-I\$(WIND_BASE)/target/h"),
   1772         sys_id           => "VXWORKS",
   1773         lflags           => add("-r"),
   1774     },
   1775     "vxworks-simlinux" => {
   1776         inherit_from     => [ "BASE_unix" ],
   1777         CC               => "ccpentium",
   1778         cflags           => "-B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/ -fno-builtin -fno-defer-pop",
   1779         cppflags         => combine("-D_VSB_CONFIG_FILE=\"\$(WIND_BASE)/target/lib/h/config/vsbConfig.h\"",
   1780                                     "-DL_ENDIAN -DCPU=SIMLINUX -DNO_STRINGS_H",
   1781                                     "-DTOOL_FAMILY=gnu -DTOOL=gnu",
   1782                                     "-DOPENSSL_NO_HW_PADLOCK",
   1783                                     "-I\$(WIND_BASE)/target/h",
   1784                                     "-I\$(WIND_BASE)/target/h/wrn/coreip"),
   1785         sys_id           => "VXWORKS",
   1786         lflags           => add("-r"),
   1787         ranlib           => "ranlibpentium",
   1788     },
   1789     "vxworks-mips" => {
   1790         inherit_from     => [ "BASE_unix" ],
   1791         CC               => "ccmips",
   1792         CFLAGS           => "-O -G 0",
   1793         cflags           => "-mrtp -mips2 -B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/ -msoft-float -mno-branch-likely -fno-builtin -fno-defer-pop",
   1794         cppflags         => combine("-D_VSB_CONFIG_FILE=\"\$(WIND_BASE)/target/lib/h/config/vsbConfig.h\"",
   1795                                     "-DCPU=MIPS32 -DNO_STRINGS_H",
   1796                                     "-DTOOL_FAMILY=gnu -DTOOL=gnu",
   1797                                     "-DOPENSSL_NO_HW_PADLOCK",
   1798                                     threads("-D_REENTRANT"),
   1799                                     "-I\$(WIND_BASE)/target/h",
   1800                                     "-I\$(WIND_BASE)/target/h/wrn/coreip"),
   1801         sys_id           => "VXWORKS",
   1802         lflags           => add("-L \$(WIND_BASE)/target/usr/lib/mips/MIPSI32/sfcommon"),
   1803         ex_libs          => add("-Wl,--defsym,__wrs_rtp_base=0xe0000000"),
   1804         thread_scheme    => "pthreads",
   1805         asm_arch         => 'mips32',
   1806         perlasm_scheme   => "o32",
   1807         ranlib           => "ranlibmips",
   1808     },
   1809 
   1810 #### uClinux
   1811     "uClinux-dist" => {
   1812         inherit_from     => [ "BASE_unix" ],
   1813         CC               => sub { env('CC') },
   1814         cppflags         => threads("-D_REENTRANT"),
   1815         ex_libs          => add("\$(LDLIBS)"),
   1816         bn_ops           => "BN_LLONG",
   1817         thread_scheme    => "pthreads",
   1818         dso_scheme       => sub { env('LIBSSL_dlfcn') },
   1819         shared_target    => "linux-shared",
   1820         shared_cflag     => "-fPIC",
   1821         ranlib           => sub { env('RANLIB') },
   1822     },
   1823     "uClinux-dist64" => {
   1824         inherit_from     => [ "BASE_unix" ],
   1825         CC               => sub { env('CC') },
   1826         cppflags         => threads("-D_REENTRANT"),
   1827         ex_libs          => add("\$(LDLIBS)"),
   1828         bn_ops           => "SIXTY_FOUR_BIT_LONG",
   1829         thread_scheme    => "pthreads",
   1830         dso_scheme       => sub { env('LIBSSL_dlfcn') },
   1831         shared_target    => "linux-shared",
   1832         shared_cflag     => "-fPIC",
   1833         ranlib           => sub { env('RANLIB') },
   1834     },
   1835 
   1836     ##### VMS
   1837     # Most things happen in vms-generic.
   1838     # Note that vms_info extracts the pointer size from the end of
   1839     # the target name, and will assume that anything matching /-p\d+$/
   1840     # indicates the pointer size setting for the desired target.
   1841     "vms-generic" => {
   1842         inherit_from     => [ "BASE_VMS" ],
   1843         template         => 1,
   1844         CC               => "CC/DECC",
   1845         CPP              => '$(CC)/PREPROCESS_ONLY=SYS$OUTPUT:',
   1846         CFLAGS           =>
   1847             combine(picker(default => "/STANDARD=(ISOC94,RELAXED)/NOLIST/PREFIX=ALL",
   1848                            debug   => "/NOOPTIMIZE/DEBUG",
   1849                            release => "/OPTIMIZE/NODEBUG"),
   1850                     sub { my @warnings =
   1851                               @{vms_info()->{disable_warns}};
   1852                           @warnings
   1853                               ? "/WARNINGS=DISABLE=(".join(",",@warnings).")" : (); }),
   1854         cflag_incfirst   => '/FIRST_INCLUDE=',
   1855         lib_defines      =>
   1856             add("OPENSSL_USE_NODELETE",
   1857                 sub {
   1858                     return vms_info()->{def_zlib}
   1859                         ? "LIBZ=\"\"\"".vms_info()->{def_zlib}."\"\"\"" : ();
   1860                 }),
   1861         lflags           => picker(default => "/MAP='F\$PARSE(\".MAP\",\"\$\@\")'",
   1862                                    debug   => "/DEBUG/TRACEBACK",
   1863                                    release => "/NODEBUG/NOTRACEBACK"),
   1864         # Because of dso_cflags below, we can't set the generic |cflags| here,
   1865         # as it can't be overridden, so we set separate C flags for libraries
   1866         # and binaries instead.
   1867         bin_cflags       => add("/NAMES=(AS_IS,SHORTENED)/EXTERN_MODEL=STRICT_REFDEF"),
   1868         lib_cflags       => add("/NAMES=(AS_IS,SHORTENED)/EXTERN_MODEL=STRICT_REFDEF"),
   1869         # Strictly speaking, DSOs should not need to have name shortening,
   1870         # as all their exported symbols should be short enough to fit the
   1871         # linker's 31 character per symbol name limit.  However, providers
   1872         # may be composed of more than one object file, and internal symbols
   1873         # may and do surpass the 31 character limit.
   1874         dso_cflags       => add("/NAMES=(SHORTENED)"),
   1875         ex_libs          => add(sub { return vms_info()->{zlib} || (); }),
   1876         shared_target    => "vms-shared",
   1877         # def_flag made to empty string so a .opt file gets generated
   1878         shared_defflag   => '',
   1879         dso_scheme       => "vms",
   1880         thread_scheme    => "pthreads",
   1881 
   1882         makedep_scheme   => 'VMS C',
   1883         AS               => sub { vms_info()->{AS} },
   1884         ASFLAGS          => sub { vms_info()->{ASFLAGS} },
   1885         asoutflag        => sub { vms_info()->{asoutflag} },
   1886         asflags          => sub { vms_info()->{asflags} },
   1887         perlasm_scheme   => sub { vms_info()->{perlasm_scheme} },
   1888 
   1889         disable          => add('pinshared', 'loadereng'),
   1890 
   1891     },
   1892 
   1893     # From HELP CC/POINTER_SIZE:
   1894     #
   1895     # ----------
   1896     # LONG[=ARGV] The compiler assumes 64-bit pointers. If the ARGV option to
   1897     #             LONG or 64 is present, the main argument argv will be an
   1898     #             array of long pointers instead of an array of short pointers.
   1899     #
   1900     # 64[=ARGV]   Same as LONG.
   1901     # ----------
   1902     #
   1903     # We don't want the hassle of dealing with 32-bit pointers with argv, so
   1904     # we force it to have 64-bit pointers, see the added cflags in the -p64
   1905     # config targets below.
   1906 
   1907     "vms-alpha" => {
   1908         inherit_from     => [ "vms-generic" ],
   1909         bn_ops           => "SIXTY_FOUR_BIT RC4_INT",
   1910         pointer_size     => "",
   1911     },
   1912     "vms-alpha-p32" => {
   1913         inherit_from     => [ "vms-alpha" ],
   1914         cflags           => add("/POINTER_SIZE=32"),
   1915         pointer_size     => "32",
   1916     },
   1917     "vms-alpha-p64" => {
   1918         inherit_from     => [ "vms-alpha" ],
   1919         cflags           => add("/POINTER_SIZE=64=ARGV"),
   1920         pointer_size     => "64",
   1921     },
   1922     "vms-ia64" => {
   1923         inherit_from     => [ "vms-generic" ],
   1924         bn_ops           => "SIXTY_FOUR_BIT RC4_INT",
   1925         asm_arch         => sub { vms_info()->{AS} ? 'ia64' : undef },
   1926         perlasm_scheme   => 'ias',
   1927         pointer_size     => "",
   1928 
   1929     },
   1930     "vms-ia64-p32" => {
   1931         inherit_from     => [ "vms-ia64" ],
   1932         cflags           => add("/POINTER_SIZE=32"),
   1933         pointer_size     => "32",
   1934     },
   1935     "vms-ia64-p64" => {
   1936         inherit_from     => [ "vms-ia64" ],
   1937         cflags           => add("/POINTER_SIZE=64=ARGV"),
   1938         pointer_size     => "64",
   1939     },
   1940     "vms-x86_64" => {
   1941         inherit_from     => [ "vms-generic" ],
   1942         bn_ops           => "SIXTY_FOUR_BIT",
   1943         pointer_size     => "",
   1944     }
   1945 );
   1946