Remove the extra checks for Intel's C compiler
[openssl.git] / Configure
index dd3d88655fea81399c7503115b4de7be56c587d0..8beaabd9506b2a9be0f0b520800ca41e7802c7c5 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -192,7 +192,6 @@ my $zlib=1;      # but "no-zlib" is default
 my $no_rfc3779=0;
 my $no_asm=0;
 my $no_dso=0;
-my $Makefile="Makefile";
 my $default_ranlib;
 $config{fips}=0;
 
@@ -885,7 +884,7 @@ if (!$no_dso && $target{dso_scheme} ne "")
        $config{cflags} = "$dso_cflags $config{cflags}";
        }
 
-my $thread_cflags;
+my $thread_cflags = "";
 my @thread_defines;
 if ($target{thread_cflag} ne "(unknown)" && !$no_threads)
        {
@@ -903,21 +902,13 @@ if ($target{thread_cflag} eq "(unknown)" && $threads)
                print "provide any system-specific compiler options\n";
                exit(1);
                }
-       $thread_cflags="-DOPENSSL_THREADS $config{cflags}" ;
+       $thread_cflags="-DOPENSSL_THREADS" ;
        push @thread_defines, "OPENSSL_THREADS";
        }
 else
        {
-       $thread_cflags="-DOPENSSL_THREADS $target{thread_cflag} $config{cflags}";
+       $thread_cflags="-DOPENSSL_THREADS $target{thread_cflag}";
        push @thread_defines, "OPENSSL_THREADS";
-#      my $def;
-#      foreach $def (split ' ',$target{thread_cflag})
-#              {
-#              if ($def =~ s/^-D// && $def !~ /^_/)
-#                      {
-#                      push @thread_defines, "$def";
-#                      }
-#              }
        }
 
 $config{ex_libs}="$libs$config{ex_libs}" if ($libs ne "");
@@ -925,12 +916,11 @@ $config{ex_libs}="$libs$config{ex_libs}" if ($libs ne "");
 if ($no_asm)
        {
        $config{cflags}=~s/-D[BL]_ENDIAN//              if ($config{fips});
-       $thread_cflags=~s/-D[BL]_ENDIAN//       if ($config{fips});
        }
 
 if ($threads)
        {
-       $config{cflags}=$thread_cflags;
+       $config{cflags} = "$thread_cflags $config{cflags}" if $thread_cflags;
        push @{$config{openssl_thread_defines}}, @thread_defines;
        }
 
@@ -990,38 +980,6 @@ if ($target{build_scheme}->[0] ne "mk1mf")
 #
 # Platform fix-ups
 #
-if ($target =~ /-icc$/)        # Intel C compiler
-       {
-       my $iccver=0;
-       if (open(FD,"$target{cc} -V 2>&1 |"))
-               {
-               while(<FD>) { $iccver=$1 if (/Version ([0-9]+)\./); }
-               close(FD);
-               }
-       if ($iccver>=8)
-               {
-               $config{cflags}=~s/-KPIC/-fPIC/;
-               # Eliminate unnecessary dependency from libirc.a. This is
-               # essential for shared library support, as otherwise
-               # apps/openssl can end up in endless loop upon startup...
-               $config{cflags}.=" -Dmemcpy=__builtin_memcpy -Dmemset=__builtin_memset";
-               }
-       if ($iccver>=9)
-               {
-               $config{ex_libs}.=" -i-static";
-               $config{ex_libs}=~s/-no_cpprt/-no-cpprt/;
-               }
-       if ($iccver>=10)
-               {
-               $config{ex_libs}=~s/-i-static/-static-intel/;
-               }
-       if ($iccver>=11)
-               {
-               $config{cflags}.=" -no-intel-extensions";       # disable Cilk
-               $config{ex_libs}=~s/-no-cpprt/-no-cxxlib/;
-               }
-       }
-
 # Unlike other OSes (like Solaris, Linux, Tru64, IRIX) BSD run-time
 # linkers (tested OpenBSD, NetBSD and FreeBSD) "demand" RPATH set on
 # .so objects. Apparently application RPATH is not global and does
@@ -1124,20 +1082,23 @@ $config{bn_ll}                  =0;
 $config{export_var_as_fn}      =0;
 my $def_int="unsigned int";
 $config{rc4_int}               =$def_int;
-$config{rc2_int}               =$def_int;
 ($config{b64l},$config{b64},$config{b32})=(0,0,1);
 
+my $count = 0;
 foreach (sort split(/\s+/,$target{bn_ops})) {
-    $config{bn_ll}=1                           if /BN_LLONG/;
-    $config{rc4_int}="unsigned char"           if /RC4_CHAR/;
-    ($config{b64l},$config{b64},$config{b32},$config{b16},$config{b8})
-       =(0,1,0,0,0)                            if /SIXTY_FOUR_BIT/;
-    ($config{b64l},$config{b64},$config{b32},$config{b16},$config{b8})
-       =(1,0,0,0,0)                            if /SIXTY_FOUR_BIT_LONG/;
-    ($config{b64l},$config{b64},$config{b32},$config{b16},$config{b8})
-       =(0,0,1,0,0)                            if /THIRTY_TWO_BIT/;
-    $config{export_var_as_fn}=1                        if /EXPORT_VAR_AS_FN/;
+    $count++ if /SIXTY_FOUR_BIT|SIXTY_FOUR_BIT_LONG|THIRTY_TWO_BIT/;
+    $config{export_var_as_fn}=1                 if $_ eq 'EXPORT_VAR_AS_FN';
+    $config{bn_ll}=1                           if $_ eq 'BN_LLONG';
+    $config{rc4_int}="unsigned char"           if $_ eq 'RC4_CHAR';
+    ($config{b64l},$config{b64},$config{b32})
+       =(0,1,0)                                if $_ eq 'SIXTY_FOUR_BIT';
+    ($config{b64l},$config{b64},$config{b32})
+       =(1,0,0)                                if $_ eq 'SIXTY_FOUR_BIT_LONG';
+    ($config{b64l},$config{b64},$config{b32})
+       =(0,0,1)                                if $_ eq 'THIRTY_TWO_BIT';
 }
+die "Exactly one of SIXTY_FOUR_BIT|SIXTY_FOUR_BIT_LONG|THIRTY_TWO_BIT can be set in bn_ops\n"
+    if $count > 1;
 
 
 # Hack cflags for better warnings (dev option) #######################
@@ -1288,9 +1249,11 @@ print "SIXTY_FOUR_BIT mode\n" if $config{b64};
 print "THIRTY_TWO_BIT mode\n" if $config{b32};
 print "BN_LLONG mode\n" if $config{bn_ll};
 print "RC4 uses $config{rc4_int}\n" if $config{rc4_int} != $def_int;
-print "RC2 uses $config{rc2_int}\n" if $config{rc2_int} != $def_int;
 
-run_dofile("$Makefile.in","$Makefile");
+run_dofile("Makefile.in","Makefile");
+
+run_dofile("util/domd.in", "util/domd");
+chmod 0755, "util/domd";
 
 run_dofile("include/openssl/opensslconf.h.in", "include/openssl/opensslconf.h");
 
@@ -1302,23 +1265,30 @@ foreach my $alg ( 'bn' ) {
 # Copy all Makefile.in to Makefile (except top-level)
 use File::Find;
 use IO::File;
-find(sub {
-        return if ($_ ne "Makefile.in" || $File::Find::dir eq ".");
-        my $in = IO::File->new($_, "r") or
-            die sprintf "Error reading Makefile.in in %s: !$\n",
+find(
+    {
+        preprocess => sub {
+            grep(!/^\./, @_);
+        },
+        wanted => sub {
+            return if ($_ ne "Makefile.in" || $File::Find::dir eq ".");
+            my $in = IO::File->new($_, "r") or
+                die sprintf "Error reading Makefile.in in %s: !$\n",
                 $File::Find::dir;
-        my $out = IO::File->new("Makefile", "w") or
-            die sprintf "Error writing Makefile in %s: !$\n",
+            my $out = IO::File->new("Makefile", "w") or
+                die sprintf "Error writing Makefile in %s: !$\n",
                 $File::Find::dir;
-        print $out "# Generated from $_, do not edit\n";
-        while (my $line = <$in>) { print $out $line }
-        $in->close() or
-            die sprintf "Error reading Makefile.in in %s: !$\n",
+            print $out "# Generated from $_, do not edit\n";
+            while (my $line = <$in>) { print $out $line }
+            $in->close() or
+                die sprintf "Error reading Makefile.in in %s: !$\n",
                 $File::Find::dir;
-        $out->close() or
-            die sprintf "Error writing Makefile in %s: !$\n",
+            $out->close() or
+                die sprintf "Error writing Makefile in %s: !$\n",
                 $File::Find::dir;
-    }, ".");
+        },
+    },
+    ".");
 
 my %builders = (
     unixmake => sub {
@@ -1664,8 +1634,9 @@ sub run_dofile()
     my $in = shift;
     my $out = shift;
 
+    unlink $out || warn "Can't remove $out, $!"
+        if -f $out;
     die "Can't open $in, $!" unless -f $in;
-    # should we remove $out ?
     system("$config{perl} -I. -Mconfigdata util/dofile.pl -o\"Configure\" $in > $out.new");
     exit 1 if $? != 0;
     rename("$out.new", $out) || die "Can't rename $out.new, $!";