Refer to $table{$target} rather than $table{$t}.
[openssl.git] / Configure
index 705f4c686dd861c5383d8ecbab9ce86cd989d1c1..a574f5a7c7fa8cc600d89f2174cf9202fe352ecc 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -166,7 +166,6 @@ my $ppc32_asm=$ppc64_asm;
 # seems to be sufficient?
 my $BSDthreads="-pthread -D_THREAD_SAFE -D_REENTRANT";
 
-
 # table of known configurations, read in from files
 #
 # The content of each entry can take one of two forms:
@@ -349,29 +348,7 @@ my %table=(
     # Note: as long as someone might use old style configuration strings,
     # or we bother supporting that, those variables need to stay
 
-    # Filler used for when there are no asm files.
-    no_asm_filler => {
-       template        => 1,
-       cpuid_obj       => "",
-       bn_obj          => "",
-       ec_obj          => "",
-       des_obj         => "",
-       aes_obj         => "",
-       bf_obj          => "",
-       md5_obj         => "",
-       sha1_obj        => "",
-       cast_obj        => "",
-       rc4_obj         => "",
-       rmd160_obj      => "",
-       rc5_obj         => "",
-       wp_obj          => "",
-       cmll_obj        => "",
-       modes_obj       => "",
-       engines_obj     => "",
-       perlasm_scheme  => "void"
-    },
-
-    x86_asm_nocast => {
+    x86_asm => {
        template        => 1,
        cpuid_obj       => "x86cpuid.o",
        bn_obj          => "bn-586.o co-586.o x86-mont.o x86-gf2m.o",
@@ -389,26 +366,15 @@ my %table=(
        modes_obj       => "ghash-x86.o",
        engines_obj     => "e_padlock-x86.o"
     },
-    x86_asm => {
-       template        => 1,
-       inherit_from    => [ "x86_asm_nocast" ],
-       cast_obj        => "cast-586.o",
-    },
     x86_elf_asm => {
        template        => 1,
        inherit_from    => [ "x86_asm" ],
        perlasm_scheme  => "elf"
     },
-    android_x86_elf_asm => {
-       template        => 1,
-       inherit_from    => [ "x86_asm" ],
-       perlasm_scheme  => "android"
-    },
-
-    _x86_64_asm => {
+    x86_64_asm => {
        template        => 1,
        cpuid_obj       => "x86_64cpuid.o",
-       bn_obj          => "x86_64-mont.o x86_64-mont5.o x86_64-gf2m.o rsaz_exp.o rsaz-x86_64.o rsaz-avx2.o",
+       bn_obj          => "x86_64-gcc.o x86_64-mont.o x86_64-mont5.o x86_64-gf2m.o rsaz_exp.o rsaz-x86_64.o rsaz-avx2.o",
        ec_obj          => "ecp_nistz256.o ecp_nistz256-x86_64.o",
        aes_obj         => "aes-x86_64.o vpaes-x86_64.o bsaes-x86_64.o aesni-x86_64.o aesni-sha1-x86_64.o aesni-sha256-x86_64.o aesni-mb-x86_64.o",
        md5_obj         => "md5-x86_64.o",
@@ -419,16 +385,6 @@ my %table=(
        modes_obj       => "ghash-x86_64.o aesni-gcm-x86_64.o",
        engines_obj     => "e_padlock-x86_64.o"
     },
-    x86_64_asm => {
-       inherit_from    => [ "_x86_64_asm" ],
-       template        => 1,
-       bn_obj          => sub { join(" ","x86_64-gcc.o",@_) }
-    },
-    win_x86_64_asm => {
-       inherit_from    => [ "_x86_64_asm" ],
-       template        => 1,
-       bn_obj          => sub { join(" ","bn_asm.o",@_) }
-    },
     ia64_asm => {
        template        => 1,
        cpuid_obj       => "ia64cpuid.o",
@@ -478,25 +434,15 @@ my %table=(
        template        => 1,
        sha1_obj        => sub { join(" ", @_, "sha512-mips.o") }
     },
-    _s390x_asm => {
+    s390x_asm => {
        template        => 1,
        cpuid_obj       => "s390xcap.o s390xcpuid.o",
-       bn_obj          => "s390x-mont.o s390x-gf2m.o",
+       bn_obj          => "bn-s390x.o s390x-mont.o s390x-gf2m.o",
        aes_obj         => "aes-s390x.o aes-ctr.o aes-xts.o",
        sha1_obj        => "sha1-s390x.o sha256-s390x.o sha512-s390x.o",
        rc4_obj         => "rc4-s390x.o",
        modes_obj       => "ghash-s390x.o",
     },
-    s390x_asm => {
-       template        => 1,
-       inherit_from    => [ "_s390x_asm" ],
-       bn_obj          => sub { join(" ", "bn-s390x.o", @_) }
-    },
-    s390x_32_asm => {
-       template        => 1,
-       inherit_from    => [ "_s390x_asm" ],
-       bn_obj          => sub { join(" ", "bn_asm.o", @_) }
-    },
     armv4_asm => {
        template        => 1,
        cpuid_obj       => "armcap.o armv4cpuid.o",
@@ -524,26 +470,10 @@ my %table=(
        modes_obj       => "ghash-parisc.o",
        perlasm_scheme  => "32"
     },
-    _parisc20_asm => {
-       template        => 1,
-       cpuid_obj       => "pariscid.o",
-       bn_obj          => "parisc-mont.o",
-       aes_obj         => "aes_core.o aes_cbc.o aes-parisc.o",
-       sha1_obj        => "sha1-parisc.o sha256-parisc.o sha512-parisc.o",
-       rc4_obj         => "rc4-parisc.o",
-       modes_obj       => "ghash-parisc.o",
-       perlasm_scheme  => "64"
-    },
-    parisc20_32_asm => {
-       template        => 1,
-       inherit_from    => [ "_parisc20_asm" ],
-       bn_obj          => sub { join(" ", "pa-risc2.o", @_) },
-       perlasm_scheme  => "32",
-    },
     parisc20_64_asm => {
        template        => 1,
-       inherit_from    => [ "_parisc20_asm" ],
-       bn_obj          => sub { join(" ", "pa-risc2W.o", @_) },
+       inherit_from    => [ "parisc11_asm" ],
+       bn_obj          => sub { my $r=join(" ",@_); $r=~s/bn_asm/pa-risc2W/; $r; },
        perlasm_scheme  => "64",
     },
     ppc64_asm => {
@@ -560,6 +490,12 @@ my %table=(
     },
 );
 
+{   my $no_asm_templates=0;
+    foreach (@ARGV) { $no_asm_templates=1 if (/^\-?no\-asm$/); }
+    sub asm { $no_asm_templates?():@_; }
+}
+
+
 sub stringtohash {
     my $in = shift @_;
     if (ref($in) eq "HASH") {
@@ -946,6 +882,7 @@ my $options;
 my $symlink;
 my $make_depend=0;
 my %withargs=();
+my $build_prefix = "release_";
 
 my @argvcopy=@ARGV;
 my $argvstring="";
@@ -1020,10 +957,18 @@ PROCESS_ARGS:
                        {
                        exit(&test_sanity());
                        }
-               elsif (/^--strict-warnings/)
+               elsif (/^--strict-warnings$/)
                        {
                        $strict_warnings = 1;
                        }
+               elsif (/^--debug$/)
+                       {
+                       $build_prefix = "debug_";
+                       }
+               elsif (/^--release$/)
+                       {
+                       $build_prefix = "release_";
+                       }
                elsif (/^reconfigure/ || /^reconf/)
                        {
                        if (open(IN,"<$Makefile"))
@@ -1234,10 +1179,10 @@ if ($target =~ m/^CygWin32(-.*)$/) {
 
 print "Configuring for $target\n";
 
+# Support for legacy targets having a name starting with 'debug-'
 my ($d, $t) = $target =~ m/^(debug-)?(.*)$/;
-my $debug_prefix = "release_";
 if ($d) {
-    $debug_prefix = "debug_";
+    $build_prefix = "debug_";
 
     # If we do not find debug-foo in the table, the target is set to foo,
     # but only if the foo target has a noon-empty debug_cflags or debug_lflags
@@ -1248,7 +1193,12 @@ if ($d) {
     }
 }
 
-&usage if (!defined($table{$target}) || $table{$target}->{template});
+&usage if (!defined($table{$target})
+          || $table{$target}->{template}
+          || ($build_prefix eq "debug_"
+              && $target !~ /^debug-/
+              && !($table{$target}->{debug_cflags}
+                   || $table{$target}->{debug_lflags})));
 
 if ($fips)
        {
@@ -1353,47 +1303,47 @@ $openssldir=$prefix . "/" . $openssldir if $openssldir !~ /(^\/|^[a-zA-Z]:[\\\/]
 print "IsMK1MF=$IsMK1MF\n";
 
 # Allow environment CC to override compiler...
-my $cc = $ENV{CC} || $table{$t}->{cc};
+my $cc = $ENV{CC} || $table{$target}->{cc};
 
 # For cflags and lflags, add the debug_ or release_ attributes
 # Do it in such a way that no spurious space is appended (hence the grep).
 my $cflags = join(" ",
-                 grep { $_ } ($table{$t}->{cflags},
-                              $table{$t}->{$debug_prefix."cflags"}));
+                 grep { $_ } ($table{$target}->{cflags},
+                              $table{$target}->{$build_prefix."cflags"}));
 my $lflags = join(" ",
-                 grep { $_ } ($table{$t}->{lflags},
-                              $table{$t}->{$debug_prefix."lflags"}));
-
-my $unistd = $table{$t}->{unistd};
-my $thread_cflag = $table{$t}->{thread_cflag};
-my $sys_id = $table{$t}->{sys_id};
-my $bn_ops = $table{$t}->{bn_ops};
-my $cpuid_obj = $table{$t}->{cpuid_obj};
-my $bn_obj = $table{$t}->{bn_obj};
-my $ec_obj = $table{$t}->{ec_obj};
-my $des_obj = $table{$t}->{des_obj};
-my $aes_obj = $table{$t}->{aes_obj};
-my $bf_obj = $table{$t}->{bf_obj};
-my $md5_obj = $table{$t}->{md5_obj};
-my $sha1_obj = $table{$t}->{sha1_obj};
-my $cast_obj = $table{$t}->{cast_obj};
-my $rc4_obj = $table{$t}->{rc4_obj};
-my $rmd160_obj = $table{$t}->{rmd160_obj};
-my $rc5_obj = $table{$t}->{rc5_obj};
-my $wp_obj = $table{$t}->{wp_obj};
-my $cmll_obj = $table{$t}->{cmll_obj};
-my $modes_obj = $table{$t}->{modes_obj};
-my $engines_obj = $table{$t}->{engines_obj};
-my $perlasm_scheme = $table{$t}->{perlasm_scheme};
-my $dso_scheme = $table{$t}->{dso_scheme};
-my $shared_target = $table{$t}->{shared_target};
-my $shared_cflag = $table{$t}->{shared_cflag};
-my $shared_ldflag = $table{$t}->{shared_ldflag};
-my $shared_extension = $table{$t}->{shared_extension};
-my $ranlib = $ENV{'RANLIB'} || $table{$t}->{ranlib};
+                 grep { $_ } ($table{$target}->{lflags},
+                              $table{$target}->{$build_prefix."lflags"}));
+
+my $unistd = $table{$target}->{unistd};
+my $thread_cflag = $table{$target}->{thread_cflag};
+my $sys_id = $table{$target}->{sys_id};
+my $bn_ops = $table{$target}->{bn_ops};
+my $cpuid_obj = $table{$target}->{cpuid_obj};
+my $bn_obj = $table{$target}->{bn_obj};
+my $ec_obj = $table{$target}->{ec_obj};
+my $des_obj = $table{$target}->{des_obj};
+my $aes_obj = $table{$target}->{aes_obj};
+my $bf_obj = $table{$target}->{bf_obj};
+my $md5_obj = $table{$target}->{md5_obj};
+my $sha1_obj = $table{$target}->{sha1_obj};
+my $cast_obj = $table{$target}->{cast_obj};
+my $rc4_obj = $table{$target}->{rc4_obj};
+my $rmd160_obj = $table{$target}->{rmd160_obj};
+my $rc5_obj = $table{$target}->{rc5_obj};
+my $wp_obj = $table{$target}->{wp_obj};
+my $cmll_obj = $table{$target}->{cmll_obj};
+my $modes_obj = $table{$target}->{modes_obj};
+my $engines_obj = $table{$target}->{engines_obj};
+my $perlasm_scheme = $table{$target}->{perlasm_scheme};
+my $dso_scheme = $table{$target}->{dso_scheme};
+my $shared_target = $table{$target}->{shared_target};
+my $shared_cflag = $table{$target}->{shared_cflag};
+my $shared_ldflag = $table{$target}->{shared_ldflag};
+my $shared_extension = $table{$target}->{shared_extension};
+my $ranlib = $ENV{'RANLIB'} || $table{$target}->{ranlib};
 my $ar = $ENV{'AR'} || "ar";
-my $arflags = $table{$t}->{arflags};
-my $multilib = $table{$t}->{multilib};
+my $arflags = $table{$target}->{arflags};
+my $multilib = $table{$target}->{multilib};
 
 # if $prefix/lib$multilib is not an existing directory, then
 # assume that it's not searched by linker automatically, in