Support additional Win32 compilers.
[openssl.git] / util / mk1mf.pl
index 8992d1683d2ed10df7a4d6c3eb98360136798464..7749505c508d28f2bbfb3119f6c385335f93af0a 100755 (executable)
@@ -7,17 +7,19 @@
 
 $INSTALLTOP="/usr/local/ssl";
 
-$ssl_version="0.8.2";
+$ssl_version="0.9.2b";
 
 $infile="MINFO";
 
 %ops=(
-       "VC-WIN32",   "Microsoft Visual C++ 4.[01] - Windows NT [34].x",
+       "VC-WIN32",   "Microsoft Visual C++ [4-6] - Windows NT or 9X",
+       "VC-NT",   "Microsoft Visual C++ [4-6] - Windows NT ONLY",
        "VC-W31-16",  "Microsoft Visual C++ 1.52 - Windows 3.1 - 286",
        "VC-WIN16",   "Alias for VC-W31-32",
        "VC-W31-32",  "Microsoft Visual C++ 1.52 - Windows 3.1 - 386+",
        "VC-MSDOS","Microsoft Visual C++ 1.52 - MSDOS",
-       "BC-NT",   "Borland C++ 4.5 - Windows NT  - PROBABLY NOT WORKING",
+       "Mingw32", "GNU C++ - Windows NT or 9x",
+       "BC-NT",   "Borland C++ 4.5 - Windows NT",
        "BC-W31",  "Borland C++ 4.5 - Windows 3.1 - PROBABLY NOT WORKING",
        "BC-MSDOS","Borland C++ 4.5 - MSDOS",
        "linux-elf","Linux elf",
@@ -126,6 +128,8 @@ $bin_dir=(defined($VARS{'BIN'}))?$VARS{'BIN'}:'';
 
 # $bin_dir.=$o causes a core dump on my sparc :-(
 
+$NT=0;
+
 push(@INC,"util/pl","pl");
 if ($platform eq "VC-MSDOS")
        {
@@ -147,8 +151,13 @@ elsif (($platform eq "VC-W31-32") || ($platform eq "VC-WIN16"))
        }
 elsif (($platform eq "VC-WIN32") || ($platform eq "VC-NT"))
        {
+       $NT = 1 if $platform eq "VC-NT";
        require 'VC-32.pl';
        }
+elsif ($platform eq "Mingw32")
+       {
+       require 'Mingw32.pl';
+       }
 elsif ($platform eq "BC-NT")
        {
        $bc=1;
@@ -210,9 +219,9 @@ $cflags.=" -DNO_MD2"  if $no_md2;
 $cflags.=" -DNO_MD5"  if $no_md5;
 $cflags.=" -DNO_SHA"  if $no_sha;
 $cflags.=" -DNO_SHA1" if $no_sha1;
-$cflags.=" -DNO_RMD160" if $no_rmd160;
+$cflags.=" -DNO_RIPEMD" if $no_rmd160;
 $cflags.=" -DNO_MDC2" if $no_mdc2;
-$cflags.=" -DNO_BLOWFISH"  if $no_bf;
+$cflags.=" -DNO_BF"  if $no_bf;
 $cflags.=" -DNO_CAST" if $no_cast;
 $cflags.=" -DNO_DES"  if $no_des;
 $cflags.=" -DNO_RSA"  if $no_rsa;
@@ -230,11 +239,6 @@ else       { $cflags="$c_flags$cflags" if ($c_flags ne ""); }
 
 $ex_libs="$l_flags$ex_libs" if ($l_flags ne "");
 
-if ($ranlib ne "")
-       {
-       $ranlib="\$(SRC_D)$o$ranlib";
-       }
-
 if ($msdos)
        {
        $banner ="\t\@echo Make sure you have run 'perl Configure $platform' in the\n";
@@ -249,8 +253,8 @@ $link="$bin_dir$link" if ($link !~ /^\$/);
 $INSTALLTOP =~ s|/|$o|g;
 
 $defs= <<"EOF";
-# This makefile has been automatically generated from the SSLeay distribution.
-# This single makefile will build the complete SSLeay distribution and
+# This makefile has been automatically generated from the OpenSSL distribution.
+# This single makefile will build the complete OpenSSL distribution and
 # by default leave the 'intertesting' output files in .${o}out and the stuff
 # that needs deleting in .${o}tmp.
 # The file was generated by running 'make makefile.one', which
@@ -277,7 +281,7 @@ SHLIB_EX_OBJ=$shlib_ex_obj
 # be added
 EX_LIBS=$ex_libs
 
-# The SSLeay directory
+# The OpenSSL directory
 SRC_D=$src_dir
 
 LINK=$link
@@ -308,6 +312,7 @@ OUT_D=$out_dir
 TMP_D=$tmp_dir
 # The output directory for the header files
 INC_D=$inc_dir
+INCO_D=$inc_dir${o}openssl
 
 CP=$cp
 RM=$rm
@@ -321,7 +326,7 @@ ASM=$bin_dir$asm
 # You should not need to touch anything below this point
 ######################################################
 
-E_EXE=ssleay
+E_EXE=openssl
 SSL=$ssl
 CRYPTO=$crypto
 RSAGLUE=$RSAglue
@@ -329,6 +334,9 @@ RSAGLUE=$RSAglue
 # BIN_D  - Binary output directory
 # TEST_D - Binary test file output directory
 # LIB_D  - library output directory
+# Note: if you change these point to different directories then uncomment out
+# the lines around the 'NB' comment below.
+# 
 BIN_D=\$(OUT_D)
 TEST_D=\$(OUT_D)
 LIB_D=\$(OUT_D)
@@ -343,8 +351,8 @@ O_CRYPTO=  \$(LIB_D)$o$plib\$(CRYPTO)$shlibp
 O_RSAGLUE= \$(LIB_D)$o$plib\$(RSAGLUE)$libp
 SO_SSL=    $plib\$(SSL)$so_shlibp
 SO_CRYPTO= $plib\$(CRYPTO)$so_shlibp
-L_SSL=     \$(LIB_D)$o\$(SSL)$libp
-L_CRYPTO=  \$(LIB_D)$o\$(CRYPTO)$libp
+L_SSL=     \$(LIB_D)$o$plib\$(SSL)$libp
+L_CRYPTO=  \$(LIB_D)$o$plib\$(CRYPTO)$libp
 
 L_LIBS= \$(L_SSL) \$(L_CRYPTO)
 #L_LIBS= \$(O_SSL) \$(O_RSAGLUE) -lrsaref \$(O_CRYPTO)
@@ -363,23 +371,26 @@ LIBS_DEP=\$(O_CRYPTO) \$(O_RSAGLUE) \$(O_SSL)
 EOF
 
 $rules=<<"EOF";
-all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INC_D) headers lib exe
+all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers lib exe
 
 banner:
 $banner
 
 \$(TMP_D):
        \$(MKDIR) \$(TMP_D)
-
-\$(BIN_D):
-       \$(MKDIR) \$(BIN_D)
-
-\$(TEST_D):
-       \$(MKDIR) \$(TEST_D)
+# NB: uncomment out these lines if BIN_D, TEST_D and LIB_D are different
+#\$(BIN_D):
+#      \$(MKDIR) \$(BIN_D)
+#
+#\$(TEST_D):
+#      \$(MKDIR) \$(TEST_D)
 
 \$(LIB_D):
        \$(MKDIR) \$(LIB_D)
 
+\$(INCO_D): \$(INC_D)
+       \$(MKDIR) \$(INCO_D)
+
 \$(INC_D):
        \$(MKDIR) \$(INC_D)
 
@@ -393,8 +404,9 @@ install:
        \$(MKDIR) \$(INSTALLTOP)
        \$(MKDIR) \$(INSTALLTOP)${o}bin
        \$(MKDIR) \$(INSTALLTOP)${o}include
+       \$(MKDIR) \$(INSTALLTOP)${o}include${o}openssl
        \$(MKDIR) \$(INSTALLTOP)${o}lib
-       \$(CP) \$(INC_D)${o}*.\[ch\] \$(INSTALLTOP)${o}include
+       \$(CP) \$(INCO_D)${o}*.\[ch\] \$(INSTALLTOP)${o}include${o}openssl
        \$(CP) \$(BIN_D)$o\$(E_EXE)$exep \$(INSTALLTOP)${o}bin
        \$(CP) \$(O_SSL) \$(INSTALLTOP)${o}lib
        \$(CP) \$(O_CRYPTO) \$(INSTALLTOP)${o}lib
@@ -474,8 +486,8 @@ chop($h); $header=$h;
 $defs.=&do_defs("HEADER",$header,"\$(INCL_D)",".h");
 $rules.=&do_copy_rule("\$(INCL_D)",$header,".h");
 
-$defs.=&do_defs("EXHEADER",$exheader,"\$(INC_D)",".h");
-$rules.=&do_copy_rule("\$(INC_D)",$exheader,".h");
+$defs.=&do_defs("EXHEADER",$exheader,"\$(INCO_D)",".h");
+$rules.=&do_copy_rule("\$(INCO_D)",$exheader,".h");
 
 $defs.=&do_defs("T_OBJ",$test,"\$(OBJ_D)",$obj);
 $rules.=&do_compile_rule("\$(OBJ_D)",$test,"\$(APP_CFLAGS)");
@@ -638,7 +650,7 @@ sub var_add
        @a=grep(!/(^sha1)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1;
        @a=grep(!/_mdc2$/,@a) if $no_mdc2;
 
-       @a=grep(!/(^rsa$)|(^genrsa$)|(^req$)|(^ca$)/,@a) if $no_rsa;
+       @a=grep(!/(^rsa$)|(^genrsa$)/,@a) if $no_rsa;
        @a=grep(!/(^dsa$)|(^gendsa$)|(^dsaparam$)/,@a) if $no_dsa;
        @a=grep(!/^gendsa$/,@a) if $no_sha1;
        @a=grep(!/(^dh$)|(^gendh$)/,@a) if $no_dh;
@@ -737,7 +749,7 @@ sub cc_compile_target
        local($ret);
        
        # EAY EAY
-       $ex_flags.=' -DCFLAGS="\"$(CC) $(CFLAG)\"" -DPLATFORM="\"$(PLATFORM)\""' if ($source =~ /cversion/);
+       $ex_flags.=' -DCFLAGS="\"$(CC) $(CFLAG)\"" -DPLATFORM="\"$(PLATFORM)\""' if ($source =~ /cversion/ and $dcflags ne 'n');
        $target =~ s/\//$o/g if $o ne "/";
        $source =~ s/\//$o/g if $o ne "/";
        $ret ="$target: \$(SRC_D)$o$source\n\t";