Disable MDC2 by default.
[openssl.git] / Configure
index 0cfc3ea36d5cfeb410e0aaf0be0eb6b8936face6..7eb1769f7b7a45153b4ae63ff2eb7c70f8fd3654 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -114,6 +114,7 @@ my $gcc_devteam_warn = "-DDEBUG_UNUSED"
         # it grew impossible to resolve this without sizeable additional
         # code, so we just tell compiler to be pedantic about everything
         # but 'long long' type.
         # it grew impossible to resolve this without sizeable additional
         # code, so we just tell compiler to be pedantic about everything
         # but 'long long' type.
+        . " -Wswitch"
         . " -DPEDANTIC -pedantic -Wno-long-long"
         . " -Wall"
         . " -Wsign-compare"
         . " -DPEDANTIC -pedantic -Wno-long-long"
         . " -Wall"
         . " -Wsign-compare"
@@ -127,7 +128,6 @@ my $gcc_devteam_warn = "-DDEBUG_UNUSED"
 # These are used in addition to $gcc_devteam_warn when the compiler is clang.
 # TODO(openssl-team): fix problems and investigate if (at least) the
 # following warnings can also be enabled:
 # These are used in addition to $gcc_devteam_warn when the compiler is clang.
 # TODO(openssl-team): fix problems and investigate if (at least) the
 # following warnings can also be enabled:
-#       -Wswitch-enum
 #       -Wcast-align
 #       -Wunreachable-code
 #       -Wlanguage-extension-token -- no, we use asm()
 #       -Wcast-align
 #       -Wunreachable-code
 #       -Wlanguage-extension-token -- no, we use asm()
@@ -136,6 +136,7 @@ my $gcc_devteam_warn = "-DDEBUG_UNUSED"
 my $clang_devteam_warn = ""
         . " -Qunused-arguments"
         . " -Wextra"
 my $clang_devteam_warn = ""
         . " -Qunused-arguments"
         . " -Wextra"
+        . " -Wswitch -Wswitch-default"
         . " -Wno-unused-parameter"
         . " -Wno-missing-field-initializers"
         . " -Wno-language-extension-token"
         . " -Wno-unused-parameter"
         . " -Wno-missing-field-initializers"
         . " -Wno-language-extension-token"
@@ -221,6 +222,8 @@ if (grep /^reconf(igure)?$/, @argvcopy) {
            if defined($configdata::config{cross_compile_prefix});
        $ENV{CC} = $configdata::config{cc}
            if defined($configdata::config{cc});
            if defined($configdata::config{cross_compile_prefix});
        $ENV{CC} = $configdata::config{cc}
            if defined($configdata::config{cc});
+       $ENV{CXX} = $configdata::config{cxx}
+           if defined($configdata::config{cxx});
        $ENV{BUILDFILE} = $configdata::config{build_file}
            if defined($configdata::config{build_file});
        $ENV{$local_config_envname} = $configdata::config{local_config_dir}
        $ENV{BUILDFILE} = $configdata::config{build_file}
            if defined($configdata::config{build_file});
        $ENV{$local_config_envname} = $configdata::config{local_config_dir}
@@ -230,6 +233,7 @@ if (grep /^reconf(igure)?$/, @argvcopy) {
        print "    CROSS_COMPILE = ",$ENV{CROSS_COMPILE},"\n"
            if $ENV{CROSS_COMPILE};
        print "    CC = ",$ENV{CC},"\n" if $ENV{CC};
        print "    CROSS_COMPILE = ",$ENV{CROSS_COMPILE},"\n"
            if $ENV{CROSS_COMPILE};
        print "    CC = ",$ENV{CC},"\n" if $ENV{CC};
+       print "    CXX = ",$ENV{CXX},"\n" if $ENV{CXX};
        print "    BUILDFILE = ",$ENV{BUILDFILE},"\n" if $ENV{BUILDFILE};
        print "    $local_config_envname = ",$ENV{$local_config_envname},"\n"
            if $ENV{$local_config_envname};
        print "    BUILDFILE = ",$ENV{BUILDFILE},"\n" if $ENV{BUILDFILE};
        print "    $local_config_envname = ",$ENV{$local_config_envname},"\n"
            if $ENV{$local_config_envname};
@@ -286,7 +290,7 @@ if (defined $ENV{$local_config_envname}) {
 }
 
 
 }
 
 
-print "Configuring OpenSSL version $config{version} (0x$config{version_num})\n";
+print "Configuring OpenSSL version $config{version} ($config{version_num})\n";
 
 $config{prefix}="";
 $config{openssldir}="";
 
 $config{prefix}="";
 $config{openssldir}="";
@@ -429,6 +433,7 @@ our %disabled = ( # "what"         => "comment"
                  "fuzz-afl"            => "default",
                  "heartbeats"          => "default",
                  "md2"                 => "default",
                  "fuzz-afl"            => "default",
                  "heartbeats"          => "default",
                  "md2"                 => "default",
+                 "mdc2"                => "default",
                   "msan"                => "default",
                  "rc5"                 => "default",
                  "sctp"                => "default",
                   "msan"                => "default",
                  "rc5"                 => "default",
                  "sctp"                => "default",
@@ -541,8 +546,9 @@ $config{build_type} = "release";
 
 my %unsupported_options = ();
 my %deprecated_options = ();
 
 my %unsupported_options = ();
 my %deprecated_options = ();
-foreach (@argvcopy)
+while (@argvcopy)
        {
        {
+       $_ = shift @argvcopy;
        # VMS is a case insensitive environment, and depending on settings
        # out of our control, we may receive options uppercased.  Let's
        # downcase at least the part before any equal sign.
        # VMS is a case insensitive environment, and depending on settings
        # out of our control, we may receive options uppercased.  Let's
        # downcase at least the part before any equal sign.
@@ -729,6 +735,14 @@ foreach (@argvcopy)
                        {
                        $libs.=$_." ";
                        }
                        {
                        $libs.=$_." ";
                        }
+               elsif (/^-rpath$/ or /^-R$/)
+                       # -rpath is the OSF1 rpath flag
+                       # -R is the old Solaris rpath flag
+                       {
+                       my $rpath = shift(@argvcopy) || "";
+                       $rpath .= " " if $rpath ne "";
+                       $libs.=$_." ".$rpath;
+                       }
                elsif (/^-static$/)
                        {
                        $libs.=$_." ";
                elsif (/^-static$/)
                        {
                        $libs.=$_." ";
@@ -926,6 +940,7 @@ my %conf_files = map { $_ => 1 } (@{$target{_conf_fname_int}});
 $config{conf_files} = [ sort keys %conf_files ];
 %target = ( %{$table{DEFAULTS}}, %target );
 
 $config{conf_files} = [ sort keys %conf_files ];
 %target = ( %{$table{DEFAULTS}}, %target );
 
+$target{cxxflags}=$target{cflags} unless defined $target{cxxflags};
 $target{exe_extension}="";
 $target{exe_extension}=".exe" if ($config{target} eq "DJGPP"
                                   || $config{target} =~ /^(?:Cygwin|mingw)/);
 $target{exe_extension}="";
 $target{exe_extension}=".exe" if ($config{target} eq "DJGPP"
                                   || $config{target} =~ /^(?:Cygwin|mingw)/);
@@ -948,6 +963,7 @@ $config{perl} =    ($^O ne "VMS" ? $^X : "perl");
 $config{hashbangperl} =
     $ENV{'HASHBANGPERL'}           || $ENV{'PERL'}     || "/usr/bin/env perl";
 $target{cc} =      $ENV{'CC'}      || $target{cc}      || "cc";
 $config{hashbangperl} =
     $ENV{'HASHBANGPERL'}           || $ENV{'PERL'}     || "/usr/bin/env perl";
 $target{cc} =      $ENV{'CC'}      || $target{cc}      || "cc";
+$target{cxx} =     $ENV{'CXX'}     || $target{cxx}     || "c++";
 $target{ranlib} =  $ENV{'RANLIB'}  || $target{ranlib}  ||
                    (which("$config{cross_compile_prefix}ranlib") ?
                           "\$(CROSS_COMPILE)ranlib" : "true");
 $target{ranlib} =  $ENV{'RANLIB'}  || $target{ranlib}  ||
                    (which("$config{cross_compile_prefix}ranlib") ?
                           "\$(CROSS_COMPILE)ranlib" : "true");
@@ -961,6 +977,7 @@ $target{build_file} = $ENV{BUILDFILE} || $target{build_file} || "Makefile";
 
 # Cache information necessary for reconfiguration
 $config{cc} = $target{cc};
 
 # Cache information necessary for reconfiguration
 $config{cc} = $target{cc};
+$config{cxx} = $target{cxx};
 $config{build_file} = $target{build_file};
 
 # For cflags, lflags, plib_lflags, ex_libs and defines, add the debug_
 $config{build_file} = $target{build_file};
 
 # For cflags, lflags, plib_lflags, ex_libs and defines, add the debug_
@@ -968,6 +985,7 @@ $config{build_file} = $target{build_file};
 # Do it in such a way that no spurious space is appended (hence the grep).
 $config{defines} = [];
 $config{cflags} = "";
 # Do it in such a way that no spurious space is appended (hence the grep).
 $config{defines} = [];
 $config{cflags} = "";
+$config{cxxflags} = "";
 $config{ex_libs} = "";
 $config{shared_ldflag} = "";
 
 $config{ex_libs} = "";
 $config{shared_ldflag} = "";
 
@@ -1746,9 +1764,11 @@ EOF
                 if (! -f $s) {
                     $s = cleanfile($buildd, $_, $blddir);
                 }
                 if (! -f $s) {
                     $s = cleanfile($buildd, $_, $blddir);
                 }
-                # We recognise C and asm files
-                if ($s =~ /\.[csS]\b$/) {
-                    (my $o = $_) =~ s/\.[csS]\b$/.o/;
+                # We recognise C++, C and asm files
+                if ($s =~ /\.(cc|cpp|c|s|S)$/) {
+                    my $o = $_;
+                    $o =~ s/\.[csS]$/.o/; # C and assembler
+                    $o =~ s/\.(cc|cpp)$/_cc.o/; # C++
                     $o = cleanfile($buildd, $o, $blddir);
                     $unified_info{sources}->{$ddest}->{$o} = 1;
                     $unified_info{sources}->{$o}->{$s} = 1;
                     $o = cleanfile($buildd, $o, $blddir);
                     $unified_info{sources}->{$ddest}->{$o} = 1;
                     $unified_info{sources}->{$o}->{$s} = 1;
@@ -1772,9 +1792,11 @@ EOF
                 if (! -f $s) {
                     $s = cleanfile($buildd, $_, $blddir);
                 }
                 if (! -f $s) {
                     $s = cleanfile($buildd, $_, $blddir);
                 }
-                # We recognise C and asm files
-                if ($s =~ /\.[csS]\b$/) {
-                    (my $o = $_) =~ s/\.[csS]\b$/.o/;
+                # We recognise C++, C and asm files
+                if ($s =~ /\.(cc|cpp|c|s|S)$/) {
+                    my $o = $_;
+                    $o =~ s/\.[csS]$/.o/; # C and assembler
+                    $o =~ s/\.(cc|cpp)$/_cc.o/; # C++
                     $o = cleanfile($buildd, $o, $blddir);
                     $unified_info{shared_sources}->{$ddest}->{$o} = 1;
                     $unified_info{sources}->{$o}->{$s} = 1;
                     $o = cleanfile($buildd, $o, $blddir);
                     $unified_info{shared_sources}->{$ddest}->{$o} = 1;
                     $unified_info{sources}->{$o}->{$s} = 1;
@@ -1897,7 +1919,9 @@ EOF
 foreach (grep /_(asm|aux)_src$/, keys %target) {
     my $src = $_;
     (my $obj = $_) =~ s/_(asm|aux)_src$/_obj/;
 foreach (grep /_(asm|aux)_src$/, keys %target) {
     my $src = $_;
     (my $obj = $_) =~ s/_(asm|aux)_src$/_obj/;
-    ($target{$obj} = $target{$src}) =~ s/\.[csS]\b/.o/g;
+    $target{$obj} = $target{$src};
+    $target{$obj} =~ s/\.[csS]\b/.o/g; # C and assembler
+    $target{$obj} =~ s/\.(cc|cpp)\b/_cc.o/g; # C++
 }
 
 # Write down our configuration where it fits #########################
 }
 
 # Write down our configuration where it fits #########################
@@ -2032,6 +2056,10 @@ print "PERLVERSION   =$Config{version} for $Config{archname}\n";
 print "HASHBANGPERL  =$config{hashbangperl}\n";
 print "CC            =$config{cross_compile_prefix}$target{cc}\n";
 print "CFLAG         =$target{cflags} $config{cflags}\n";
 print "HASHBANGPERL  =$config{hashbangperl}\n";
 print "CC            =$config{cross_compile_prefix}$target{cc}\n";
 print "CFLAG         =$target{cflags} $config{cflags}\n";
+print "CXX           =$config{cross_compile_prefix}$target{cxx}\n"
+    if defined $target{cxx};
+print "CXXFLAG       =$target{cxxflags} $config{cxxflags}\n"
+    if defined $target{cxx};
 print "DEFINES       =",join(" ", @{$target{defines}}, @{$config{defines}}),"\n";
 #print "RANLIB        =", $target{ranlib} eq '$(CROSS_COMPILE)ranlib' ?
 #                             "$config{cross_compile_prefix}ranlib" :
 print "DEFINES       =",join(" ", @{$target{defines}}, @{$config{defines}}),"\n";
 #print "RANLIB        =", $target{ranlib} eq '$(CROSS_COMPILE)ranlib' ?
 #                             "$config{cross_compile_prefix}ranlib" :