Fix no-rmd160 classic Windows build
[openssl.git] / util / mk1mf.pl
index 41441305677e8add95f4fa002c333f62e9ede3f6..209113fea14e730dc07cb399467ceb222d164ba1 100755 (executable)
@@ -53,6 +53,7 @@ my %mf_import = (
        CC             => \$mf_cc,
        CFLAG          => \$mf_cflag,
        CFLAG_Q        => \$mf_cflag_q,
+       SHARED_CFLAG   => \$mf_shared_cflag,
         DEPFLAG        => \$mf_depflag,
        CPUID_OBJ      => \$mf_cpuid_asm,
        BN_ASM         => \$mf_bn_asm,
@@ -133,7 +134,7 @@ foreach (@ARGV)
                print STDERR <<"EOF";
 and [options] can be one of
        no-md2 no-md4 no-md5 no-sha no-mdc2     - Skip this digest
-       no-ripemd
+       no-rmd160
        no-rc2 no-rc4 no-rc5 no-idea no-des     - Skip this symetric cipher
        no-bf no-cast no-aes no-camellia no-seed
        no-rsa no-dsa no-dh                     - Skip this public key cipher
@@ -175,8 +176,6 @@ foreach (grep(!/^$/, split(/ /, $OPTIONS)))
        print STDERR "unknown option - $_\n" if !&read_options;
        }
 
-$no_static_engine = 0 if (!$shlib);
-
 $no_mdc2=1 if ($no_des);
 
 $no_ssl3=1 if ($no_md5);
@@ -306,10 +305,10 @@ $cflags.=" -DOPENSSL_NO_ASYNC" if $no_async;
 $cflags.=" -DOPENSSL_NO_AUTOALGINIT" if $no_autoalginit;
 $cflags.=" -DOPENSSL_NO_AUTOERRINIT" if $no_autoerrinit;
 $cflags.=" -DOPENSSL_FIPS"    if $fips;
-$cflags.=" -DOPENSSL_NO_JPAKE"    if $no_jpake;
 $cflags.=" -DOPENSSL_NO_EC2M"    if $no_ec2m;
 $cflags.= " -DZLIB" if $zlib_opt;
 $cflags.= " -DZLIB_SHARED" if $zlib_opt == 2;
+$cflags.=" -DOPENSSL_PIC";
 
 if ($no_static_engine)
        {
@@ -328,7 +327,7 @@ else
        { $cflags="$c_flags$cflags" if ($c_flags ne ""); }
 
 if ($orig_platform eq 'copy') {
-    $cflags = $mf_cflag;
+    $cflags = "$mf_cflag $mf_shared_cflag";
     $cc = $mf_cc;
 }
 
@@ -553,8 +552,10 @@ if ($fips)
                        {
                        open (IN, "util/fipslib_path.txt") || fipslib_error();
                        $fipslibdir = <IN>;
-                       chomp $fipslibdir;
                        close IN;
+                       $fipslibdir = "" unless defined($fipslibdir);
+                       $fipslibdir =~ s{\R$}{};
+                       fipslib_error() if ($fipslibdir eq "");
                        }
                fips_check_files($fipslibdir,
                                "fipscanister.lib", "fipscanister.lib.sha1",
@@ -805,7 +806,7 @@ reallyclean:
 
 EOF
 
-$rules .= &do_rehash_rule("rehash.time", "certs/demo apps tools");
+$rules .= &do_rehash_rule("rehash.time", "apps tools");
 $rules .= &do_test_rule("test", "rehash.time", "run_tests.pl");
 
 $rules .= <<"EOF";
@@ -1034,7 +1035,6 @@ sub var_add
        return("") if $no_dh   && $dir =~ /\/dh/;
        return("") if $no_ec   && $dir =~ /\/ec/;
        return("") if $no_cms  && $dir =~ /\/cms/;
-       return("") if $no_jpake  && $dir =~ /\/jpake/;
        return("") if !$fips   && $dir =~ /^fips/;
        if ($no_des && $dir =~ /\/des/)
                {
@@ -1159,7 +1159,7 @@ sub do_defs
                elsif ($var eq "SSLOBJ")
                        { $ret.="\$(OBJ_D)\\\$(SSL).res "; }
                }
-       chomp($ret);
+       chomp($ret);            # Does this actually do something? /RL
        $ret.="\n\n";
        return($ret);
        }
@@ -1230,7 +1230,7 @@ sub perlasm_compile_target
        my($ret);
        $bname =~ s/(.*)\.[^\.]$/$1/;
        $ret ="\$(TMP_D)$o$bname$asm_suffix: $source\n";
-       $ret.="\t\$(PERL) $source $asmtype \$(CFLAG) >\$\@\n";
+       $ret.="\t\$(PERL) $source $asmtype \$(CFLAG) \$\@\n";
        if ($fipscanisteronly)
                {
                $ret .= "\t\$(PERL) util$o.pl . \$@ norunasm \$(CFLAG)\n";
@@ -1295,7 +1295,7 @@ sub do_asm_rule
                        my $plasm = $objfile;
                        $plasm =~ s/${obj}/.pl/;
                        $ret.="$srcfile: $plasm\n";
-                       $ret.="\t\$(PERL) $plasm $asmtype \$(CFLAG) >$srcfile\n\n";
+                       $ret.="\t\$(PERL) $plasm $asmtype \$(CFLAG) $srcfile\n\n";
                        }
 
                $ret.="$objfile: $srcfile\n";
@@ -1377,7 +1377,7 @@ sub read_options
                "no-md2" => \$no_md2,
                "no-md4" => \$no_md4,
                "no-md5" => \$no_md5,
-               "no-ripemd" => \$no_ripemd,
+               "no-rmd160" => \$no_ripemd,
                "no-mdc2" => \$no_mdc2,
                "no-whirlpool" => \$no_whirlpool,
                "no-patents" => 
@@ -1392,9 +1392,9 @@ sub read_options
                "gaswin" => \$gaswin,
                "no-ssl3" => \$no_ssl3,
                "no-ssl3-method" => 0,
+               "no-weak-ssl-ciphers" => 0,
                "no-srp" => \$no_srp,
                "no-cms" => \$no_cms,
-               "no-jpake" => \$no_jpake,
                "no-ec2m" => \$no_ec2m,
                "no-ec_nistp_64_gcc_128" => 0,
                "no-err" => \$no_err,
@@ -1403,6 +1403,7 @@ sub read_options
                "no-gost" => \$no_gost,
                "no-engine" => \$no_engine,
                "no-egd" => 0,
+               "no-heartbeats" => 0,
                "no-hw" => \$no_hw,
                "no-async" => \$no_async,
                "no-autoalginit" => \$no_autoalginit,
@@ -1416,6 +1417,7 @@ sub read_options
                "gcc" => \$gcc,
                "debug" => \$debug,
                "--debug" => \$debug,
+               "--classic" => 0,
                "profile" => \$profile,
                "shlib" => \$shlib,
                "dll" => \$shlib,
@@ -1434,6 +1436,7 @@ sub read_options
                "no-deprecated" => 0,
                "no-ocb" => 0,
                "no-crypto-mdebug" => 0,
+               "no-crypto-mdebug-backtrace" => 0,
                "fips" => \$fips,
                "fipscanisterbuild" => [\$fips, \$fipscanisterbuild],
                "fipscanisteronly" => [\$fips, \$fipscanisterbuild, \$fipscanisteronly],
@@ -1460,11 +1463,11 @@ sub read_options
                {
                $zlib_opt = 2;
                }
-       elsif (/^no-static-engine/)
+       elsif (/^no-static-engine/ or /^enable-dynamic-engine/)
                {
                $no_static_engine = 1;
                }
-       elsif (/^enable-static-engine/)
+       elsif (/^no-dynamic-engine/ or /^enable-static-engine/)
                {
                $no_static_engine = 0;
                }
@@ -1478,18 +1481,6 @@ sub read_options
                if (exists $valid_options{$t})
                        {return 1;}
                return 0;
-               }
-       # experimental-xxx is mostly like enable-xxx, but opensslconf.v
-       # will still set OPENSSL_NO_xxx unless we set OPENSSL_EXPERIMENTAL_xxx.
-       # (No need to fail if we don't know the algorithm -- this is for adventurous users only.)
-       elsif (/^experimental-/)
-               {
-               my $algo, $ALGO;
-               ($algo = $_) =~ s/^experimental-//;
-               ($ALGO = $algo) =~ tr/[a-z]/[A-Z]/;
-
-               $xcflags="-DOPENSSL_EXPERIMENTAL_$ALGO $xcflags";
-               
                }
        elsif (/^([^=]*)=(.*)$/){ $VARS{$1}=$2; }
        elsif (/^-[lL].*$/)     { $l_flags.="$_ "; }