exptest dumps core. Optimizer bug?
[openssl.git] / Configure
index c1d906dbdb59c03cff699bc395f0c5ac3b644ebe..b4f12225b14595ca7d6902bb4e511a80aca2e0d2 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -20,16 +20,9 @@ my $usage="Usage: Configure [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [rsaref] [no
 # rsaref        use RSAref
 # no-asm        do not use assembler
 # 386           generate 80386 code
+# no-<cipher>   build without specified algorithm (rsa, idea, rc5, ...)
 # -D, -L, -l, -f, -K: compiler options are passed through 
 # 
-# -DRSAref     build to use RSAref
-# -DNO_IDEA    build with no IDEA algorithm
-# -DNO_RC4     build with no RC4 algorithm
-# -DNO_RC2     build with no RC2 algorithm
-# -DNO_BF      build with no Blowfish algorithm
-# -DNO_DES     build with no DES/3DES algorithm
-# -DNO_MD2     build with no MD2 algorithm
-#
 # DES_PTR      use pointer lookup vs arrays in the DES in crypto/des/des_locl.h
 # DES_RISC1    use different DES_ENCRYPT macro that helps reduce register
 #              dependancies but needs to more registers, good for RISC CPU's
@@ -113,7 +106,7 @@ my %table=(
 # -fast slows things like DES down quite a lot
 "solaris-sparc-sc4","cc:-xO5 -Xa -DB_ENDIAN:-lsocket -lnsl:\
        BN_LLONG RC4_CHAR DES_PTR DES_RISC1 DES_UNROLL BF_PTR:::",
-"solaris-usparc-sc4","cc:-xtarget=ultra -xarch=v8plus -Xa -xO5 -DB_ENDIAN:\
+"solaris-usparc-sc4","cc:-xtarget=ultra -xarch=v8plus -Xa -xO2 -DB_ENDIAN:\
        -lsocket -lnsl:\
        BN_LLONG RC4_CHAR DES_PTR DES_RISC1 DES_UNROLL BF_PTR:asm/sparcv8.o::",
 #"solaris-sparc-sc4-pic","cc:-xO5 -Xa -DB_ENDIAN -KPIC:-lsocket -lnsl:\
@@ -236,8 +229,8 @@ my %table=(
 "CygWin32", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::BN_LLONG $x86_gcc_des $x86_gcc_opts:",
 
 # Ultrix from Bernhard Simon <simon@zid.tuwien.ac.at>
-"ultrix","cc:-std1 -O -Olimit 1000 -DL_ENDIAN::::::",
-"ultrix-gcc","cc:-O3 -DL_ENDIAN::::::",
+"ultrix-cc","cc:-std1 -O -Olimit 1000 -DL_ENDIAN::::::",
+"ultrix-gcc","gcc:-O3 -DL_ENDIAN::::::",
 # K&R C is no longer supported; you need gcc on old Ultrix installations
 ##"ultrix","cc:-O2 -DNOPROTO -DNOCONST -DL_ENDIAN::::::",
 
@@ -255,6 +248,7 @@ my @WinTargets=qw(VC-NT VC-WIN32 VC-WIN16 VC-W31-16 VC-W31-32 VC-MSDOS BC-32
 my $installprefix="";
 my $openssldir="";
 my $no_asm=0;
+my @skip=();
 my $Makefile="Makefile.ssl";
 my $des_locl="crypto/des/des_locl.h";
 my $des        ="crypto/des/des.h";
@@ -284,12 +278,21 @@ $perl=&which("perl5") or $perl=&which("perl");
 &usage if ($#ARGV < 0);
 
 my $flags="";
+my $depflags="";
 my $libs="";
 my $target="";
 foreach (@ARGV)
        {
        if (/^no-asm$/)
                { $no_asm=1; }
+       elsif (/^no-(.+)$/)
+               {
+               my $algo=$1;
+               push @skip,$algo;
+               $algo =~ tr/[a-z]/[A-Z]/;
+               $flags .= "-DNO_$algo ";
+               $depflags .= "-DNO_$algo ";
+               }
        elsif (/^386$/)
                { $processor=386; }
        elsif (/^rsaref$/)
@@ -334,6 +337,8 @@ foreach (@ARGV)
 
 &usage if (!defined($table{$target}));
 
+my $IsWindows=scalar grep /^$target$/,@WinTargets;
+
 $openssldir="/usr/local/ssl" if ($openssldir eq "" and $installprefix eq "");
 $installprefix=$openssldir if $installprefix eq "";
 
@@ -343,7 +348,6 @@ chop $installprefix if $installprefix =~ /\/$/;
 $openssldir=$installprefix . "/ssl" if $openssldir eq "";
 $openssldir=$installprefix . "/" . $openssldir if $openssldir !~ /^\//;
 
-my $IsWindows=scalar grep /^$target$/,@WinTargets;
 
 print "IsWindows=$IsWindows\n";
 
@@ -387,16 +391,46 @@ if ($rmd160_obj =~ /\.o$/)
        $cflags.=" -DRMD160_ASM";
        }
 
+my $version = "unknown";
+my $major = "unknown";
+my $minor = "unknown";
+
+open(IN,'<crypto/opensslv.h') || die "unable to read opensslv.h:$!\n";
+while (<IN>)
+       {
+       $version=$1 if /OPENSSL.VERSION.TEXT.*OpenSSL (\S+) /;
+       }
+close(IN);
+
+if ($version =~ /(^[0-9]*)\.([\0-9\.]*)/)
+       {
+       $major=$1;
+       $minor=$2;
+       }
+
 open(IN,'<Makefile.org') || die "unable to read Makefile.org:$!\n";
 open(OUT,">$Makefile") || die "unable to create $Makefile:$!\n";
+my $sdirs=0;
 while (<IN>)
        {
        chop;
+       $sdirs = 1 if /^SDIRS=/;
+       $sdirs = 0 unless /\\$/;
+       if ($sdirs) {
+               my $dir;
+               foreach $dir (@skip) {
+                       s/$dir//;
+                       }
+               }
+       s/^VERSION=.*/VERSION=$version/;
+       s/^MAJOR=.*/MAJOR=$major/;
+       s/^MINOR=.*/MINOR=$minor/;
        s/^INSTALLTOP=.*$/INSTALLTOP=$installprefix/;
        s/^OPENSSLDIR=.*$/OPENSSLDIR=$openssldir/;
        s/^PLATFORM=.*$/PLATFORM=$target/;
        s/^CC=.*$/CC= $cc/;
        s/^CFLAG=.*$/CFLAG= $cflags/;
+       s/^DEPFLAG=.*$/DEPFLAG= $depflags/;
        s/^EX_LIBS=.*$/EX_LIBS= $lflags/;
        s/^BN_ASM=.*$/BN_ASM= $bn_obj/;
        s/^DES_ENC=.*$/DES_ENC= $des_obj/;
@@ -479,7 +513,7 @@ open(OUT,'>crypto/opensslconf.h') || die "unable to create crypto/opensslconf.h:
 while (<IN>)
        {
        if      (/^#define\s+OPENSSLDIR/)
-               { print OUT "#define OPENSSLDIR $openssldir\n"; }
+               { print OUT "#define OPENSSLDIR \"$openssldir\"\n"; }
        elsif   (/^#((define)|(undef))\s+SIXTY_FOUR_BIT_LONG/)
                { printf OUT "#%s SIXTY_FOUR_BIT_LONG\n",($b64l)?"define":"undef"; }
        elsif   (/^#((define)|(undef))\s+SIXTY_FOUR_BIT/)
@@ -548,18 +582,27 @@ if($IsWindows) {
        open (OUT,">crypto/date.h") || die "Can't open date.h";
        printf OUT "#define DATE \"%s\"\n", scalar gmtime();
        close(OUT);
+} else {
+       if ( $perl =~ /./ ) {
+               (system "make -f Makefile.ssl PERL=\'$perl\' links") == 0 or exit $?;
+       } else {
+               (system 'make -f Makefile.ssl links') == 0 or exit $?;
+       }
+       (system 'make depend') == 0 or exit $? if $depflags ne "";
+       &dofile("tools/c_rehash",$openssldir,'^DIR=',   'DIR=%s',);
+       &dofile("util/mk1mf.pl",$openssldir,
+                               ('^\$INSTALLTOP=','$INSTALLTOP="%s";',));
 }
 
-if (!$IsWindows)
-       {
-       (system 'make -f Makefile.ssl links') == 0 or exit $?;
-       }
 
-&dofile("tools/c_rehash",$openssldir,'^DIR=',  'DIR=%s',);
-&dofile("util/mk1mf.pl",$openssldir,('^\$INSTALLTOP=','$INSTALLTOP="%s";',));
+my $pwd;
 
-my $pwd=`pwd`;
-chop($pwd);
+if($IsWindows) {
+       $pwd="(include directory)";
+} else {
+       $pwd =`pwd`;
+       chop($pwd);
+}
 print <<EOF;
 
 NOTE: The OpenSSL header files have been moved from include/*.h