make no-gost work on Windows
[openssl.git] / util / mk1mf.pl
index 93d10a59e91de9e42c5a0fa1a43811eefe0389f2..68a415a399c64c687544cc9a7a508d1b28f3e260 100755 (executable)
@@ -13,6 +13,7 @@ $banner="\t\@echo Building OpenSSL";
 
 my $no_static_engine = 1;
 my $engines = "";
+my $otherlibs = "";
 local $zlib_opt = 0;   # 0 = no zlib, 1 = static, 2 = dynamic
 local $zlib_lib = "";
 local $perl_asm = 0;   # 1 to autobuild asm files from perl scripts
@@ -54,6 +55,8 @@ while(<IN>) {
 }
 close(IN);
 
+$debug = 1 if $mf_platform =~ /^debug-/;
+
 die "Makefile is not the toplevel Makefile!\n" if $ssl_version eq "";
 
 $infile="MINFO";
@@ -264,9 +267,10 @@ $cflags.=" -DOPENSSL_NO_KRB5" if $no_krb5;
 $cflags.=" -DOPENSSL_NO_EC"   if $no_ec;
 $cflags.=" -DOPENSSL_NO_ECDSA" if $no_ecdsa;
 $cflags.=" -DOPENSSL_NO_ECDH" if $no_ecdh;
+$cflags.=" -DOPENSSL_NO_GOST" if $no_gost;
 $cflags.=" -DOPENSSL_NO_ENGINE"   if $no_engine;
 $cflags.=" -DOPENSSL_NO_HW"   if $no_hw;
-
+$cflags.=" -DOPENSSL_NO_JPAKE"    if $no_jpake;
 $cflags.= " -DZLIB" if $zlib_opt;
 $cflags.= " -DZLIB_SHARED" if $zlib_opt == 2;
 
@@ -354,6 +358,12 @@ for (;;)
                $lib=$val;
                $lib =~ s/^.*\/([^\/]+)$/$1/;
                }
+       if ($key eq "LIBNAME" && $no_static_engine)
+               {
+               $lib=$val;
+               $lib =~ s/^.*\/([^\/]+)$/$1/;
+               $otherlibs .= " $lib";
+               }
 
        if ($key eq "EXHEADER")
                { $exheader.=&var_add($dir,$val, 1); }
@@ -636,7 +646,8 @@ foreach (values %lib_nam)
        }
 
 # hack to add version info on MSVC
-if (($platform eq "VC-WIN32") || ($platform eq "VC-NT")) {
+if (($platform eq "VC-WIN32") || ($platform eq "VC-WIN64A")
+       || ($platform eq "VC-WIN64I") || ($platform eq "VC-NT")) {
     $rules.= <<"EOF";
 \$(OBJ_D)\\\$(CRYPTO).res: ms\\version32.rc
        \$(RSC) /fo"\$(OBJ_D)\\\$(CRYPTO).res" /d CRYPTO ms\\version32.rc
@@ -655,7 +666,7 @@ foreach (split(/\s+/,$test))
        $rules.=&do_link_rule("\$(TEST_D)$o$t$exep",$tt,"\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)");
        }
 
-$defs.=&do_defs("E_SHLIB",$engines,"\$(ENG_D)",$shlibp);
+$defs.=&do_defs("E_SHLIB",$engines . $otherlibs,"\$(ENG_D)",$shlibp);
 
 foreach (split(/\s+/,$engines))
        {
@@ -668,6 +679,14 @@ foreach (split(/\s+/,$engines))
 $rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)");
 $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)");
 
+foreach (split(/\s+/,$otherlibs))
+       {
+       my $uc = $_;
+       $uc =~ tr /a-z/A-Z/;    
+       $rules.= &do_lib_rule("\$(${uc}OBJ)","\$(ENG_D)$o$_$shlibp", "", $shlib, "");
+
+       }
+
 $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)");
 
 print $defs;
@@ -705,7 +724,9 @@ sub var_add
        return("") if $no_dsa  && $dir =~ /\/dsa/;
        return("") if $no_dh   && $dir =~ /\/dh/;
        return("") if $no_ec   && $dir =~ /\/ec/;
+       return("") if $no_gost   && $dir =~ /\/ccgost/;
        return("") if $no_cms  && $dir =~ /\/cms/;
+       return("") if $no_jpake  && $dir =~ /\/jpake/;
        if ($no_des && $dir =~ /\/des/)
                {
                if ($val =~ /read_pwd/)
@@ -735,8 +756,8 @@ sub var_add
        @a=grep(!/^e_camellia$/,@a) if $no_camellia;
        @a=grep(!/^e_seed$/,@a) if $no_seed;
 
-       @a=grep(!/(^s2_)|(^s23_)/,@a) if $no_ssl2;
-       @a=grep(!/(^s3_)|(^s23_)/,@a) if $no_ssl3;
+       #@a=grep(!/(^s2_)|(^s23_)/,@a) if $no_ssl2;
+       #@a=grep(!/(^s3_)|(^s23_)/,@a) if $no_ssl3;
 
        @a=grep(!/(_sock$)|(_acpt$)|(_conn$)|(^pxy_)/,@a) if $no_sock;
 
@@ -827,7 +848,7 @@ sub do_defs
                $ret.=$t;
                }
        # hack to add version info on MSVC
-       if ($shlib && (($platform eq "VC-WIN32") || ($platform eq "VC-NT")))
+       if ($shlib && (($platform eq "VC-WIN32") || ($platfrom eq "VC-WIN64I") || ($platform eq "VC-WIN64A") || ($platform eq "VC-NT")))
                {
                if ($var eq "CRYPTOOBJ")
                        { $ret.="\$(OBJ_D)\\\$(CRYPTO).res "; }
@@ -1036,12 +1057,14 @@ sub read_options
                "no-ssl3" => \$no_ssl3,
                "no-tlsext" => \$no_tlsext,
                "no-cms" => \$no_cms,
+               "no-jpake" => \$no_jpake,
                "no-err" => \$no_err,
                "no-sock" => \$no_sock,
                "no-krb5" => \$no_krb5,
                "no-ec" => \$no_ec,
                "no-ecdsa" => \$no_ecdsa,
                "no-ecdh" => \$no_ecdh,
+               "no-gost" => \$no_gost,
                "no-engine" => \$no_engine,
                "no-hw" => \$no_hw,
                "just-ssl" =>
@@ -1060,6 +1083,7 @@ sub read_options
                "no-rfc3779" => 0,
                "no-montasm" => 0,
                "no-shared" => 0,
+               "no-store" => 0,
                "no-zlib" => 0,
                "no-zlib-dynamic" => 0,
                );
@@ -1102,6 +1126,18 @@ 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 (/^--with-krb5-flavor=(.*)$/)
                {