Don't check for gcc or clang on VMS
[openssl.git] / Configure
index 2ba33cb0c5ae8cb7b28a2aef0e74cc16553aa5d3..c2df73417a075d9ad5bbfc308ff9f9ff059d913e 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -32,10 +32,6 @@ my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [experimenta
 #               This becomes the value of OPENSSLDIR in Makefile and in C.
 #               (Default: PREFIX/ssl)
 #
-# --install_prefix  Additional prefix for package builders (empty by
-#               default).  This needn't be set in advance, you can
-#               just as well use "make INSTALL_PREFIX=/whatever install".
-#
 # --cross-compile-prefix Add specified prefix to binutils components.
 #
 # --api         One of 0.9.8, 1.0.0 or 1.1.0.  Do not compile support for
@@ -80,20 +76,42 @@ my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [experimenta
 # Minimum warning options... any contributions to OpenSSL should at least get
 # past these.
 
-my $gcc_devteam_warn = "-Wall -pedantic -DPEDANTIC -Wno-long-long -Wsign-compare -Wmissing-prototypes -Wshadow -Wformat -Wtype-limits -Werror -DREF_DEBUG -DDEBUG_UNUSED";
+my $gcc_devteam_warn = "-DPEDANTIC -DREF_DEBUG -DDEBUG_UNUSED"
+        . " -pedantic"
+        . " -Wall"
+        . " -Wno-long-long"
+        . " -Wsign-compare"
+        . " -Wmissing-prototypes"
+        . " -Wshadow"
+        . " -Wformat"
+        . " -Wtype-limits"
+        . " -Werror"
+        ;
 
 # 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, -Wunused-macros, -Wmissing-field-initializers,
-# -Wcast-align,
-# -Wunreachable-code -Wunused-parameter -Wlanguage-extension-token
-# -Wextended-offsetof
-my $clang_devteam_warn = "-Wno-unused-parameter -Wno-missing-field-initializers -Wno-language-extension-token -Wno-extended-offsetof -Wconditional-uninitialized -Qunused-arguments -Wincompatible-pointer-types-discards-qualifiers -Wmissing-variable-declarations";
-
-# These are used in addition to $gcc_devteam_warn unless this is a mingw build.
-# This adds backtrace information to the memory leak info.
-my $memleak_devteam_backtrace = "-rdynamic -DCRYPTO_MDEBUG_BACKTRACE";
+#       -Wswitch-enum
+#       -Wunused-macros
+#       -Wcast-align
+#       -Wunreachable-code
+#       -Wlanguage-extension-token
+#       -Wextended-offsetof
+my $clang_devteam_warn = ""
+        . " -Qunused-arguments"
+        . " -Wextra"
+        . " -Wno-unused-parameter"
+        . " -Wno-missing-field-initializers"
+        . " -Wno-language-extension-token"
+        . " -Wno-extended-offsetof"
+        . " -Wconditional-uninitialized"
+        . " -Wincompatible-pointer-types-discards-qualifiers"
+        . " -Wmissing-variable-declarations"
+        ;
+
+# This adds backtrace information to the memory leak info.  Is only used
+# when crypto-mdebug-backtrace is enabled.
+my $memleak_devteam_backtrace = "-rdynamic";
 
 my $strict_warnings = 0;
 
@@ -184,7 +202,6 @@ $config{prefix}="";
 $config{openssldir}="";
 $config{processor}="";
 $config{libdir}="";
-$config{install_prefix}= "$ENV{'INSTALL_PREFIX'}";
 $config{cross_compile_prefix}="";
 $config{fipslibdir}="/usr/local/ssl/fips-2.0/lib/";
 my $nofipscanistercheck=0;
@@ -235,6 +252,7 @@ my @disablables = (
     "cms",
     "comp",
     "crypto-mdebug",
+    "crypto-mdebug-backtrace",
     "ct",
     "deprecated",
     "des",
@@ -360,6 +378,8 @@ my @disable_cascades = (
 
     # SRP and HEARTBEATS require TLSEXT
     "tlsext"           => [ "srp", "heartbeats" ],
+
+    "crypto-mdebug"     => [ "crypto-mdebug-backtrace" ],
     );
 
 # Avoid protocol support holes.  Also disable all versions below N, if version
@@ -481,6 +501,13 @@ $config{perlargv} = [ @argvcopy ];
 my %unsupported_options = ();
 foreach (@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.
+       if ($^O eq "VMS")
+               {
+               s/^([^=]*)/lc($1)/e;
+               }
        s /^-no-/no-/; # some people just can't read the instructions
 
        # rewrite some options in "enable-..." form
@@ -604,10 +631,6 @@ foreach (@argvcopy)
                        {
                        $config{openssldir}=$1;
                        }
-               elsif (/^--install.prefix=(.*)$/)
-                       {
-                       $config{install_prefix}=$1;
-                       }
                elsif (/^--with-zlib-lib=(.*)$/)
                        {
                        $withargs{zlib_lib}=$1;
@@ -887,11 +910,6 @@ my $no_shared_warn=0;
 my $no_user_cflags=0;
 my $no_user_defines=0;
 
-if ($user_cflags ne "") { $config{cflags}="$config{cflags}$user_cflags"; }
-else                    { $no_user_cflags=1;  }
-if (@user_defines) { $config{defines}=[ @{$config{defines}}, @user_defines ]; }
-else               { $no_user_defines=1;    }
-
 # The DSO code currently always implements all functions so that no
 # applications will have to worry about that from a compilation point
 # of view. However, the "method"s may return zero unless that platform
@@ -1084,18 +1102,20 @@ if (!$no_asm) {
     }
 }
 
-# Is the compiler gcc or clang?  $ecc is used below to see if error-checking
-# can be turned on.
 my $ecc = $target{cc};
-my $ccpcc = "$config{cross_compile_prefix}$target{cc}";
-$config{makedepprog} = 'makedepend';
-open(PIPE, "$ccpcc --version 2>&1 | head -2 |");
-while ( <PIPE> ) {
-    $config{makedepprog} = $ccpcc if /clang|gcc/;
-    $ecc = "clang" if /clang/;
-    $ecc = "gcc" if /gcc/;
+if ($^O ne "VMS") {
+    # Is the compiler gcc or clang?  $ecc is used below to see if
+    # error-checking can be turned on.
+    my $ccpcc = "$config{cross_compile_prefix}$target{cc}";
+    $config{makedepprog} = 'makedepend';
+    open(PIPE, "$ccpcc --version 2>&1 | head -2 |");
+    while ( <PIPE> ) {
+        $config{makedepprog} = $ccpcc if /clang|gcc/;
+        $ecc = "clang" if /clang/;
+        $ecc = "gcc" if /gcc/;
+    }
+    close(PIPE);
 }
-close(PIPE);
 
 $config{depflags} =~ s/^\s*//;
 
@@ -1141,34 +1161,40 @@ if (defined($config{api})) {
 if ($strict_warnings)
        {
        my $wopt;
-       my $addflags = '';
        die "ERROR --strict-warnings requires gcc or clang"
             unless $ecc eq 'gcc' || $ecc eq 'clang';
        foreach $wopt (split /\s+/, $gcc_devteam_warn)
                {
-               $addflags .= " $wopt" unless ($config{cflags} =~ /(^|\s)$wopt(\s|$)/)
+               $config{cflags} .= " $wopt" unless ($config{cflags} =~ /(^|\s)$wopt(\s|$)/)
                }
        if ($ecc eq "clang")
                {
                foreach $wopt (split /\s+/, $clang_devteam_warn)
                        {
-                       $addflags .= " $wopt" unless ($config{cflags} =~ /(^|\s)$wopt(\s|$)/)
+                       $config{cflags} .= " $wopt" unless ($config{cflags} =~ /(^|\s)$wopt(\s|$)/)
                        }
                }
-       if ($target !~ /^mingw/)
+       }
+
+unless ($disabled{"crypto-mdebug-backtrace"})
+       {
+       foreach my $wopt (split /\s+/, $memleak_devteam_backtrace)
+               {
+               $config{cflags} .= " $wopt" unless ($config{cflags} =~ /(^|\s)$wopt(\s|$)/)
+               }
+       if ($target =~ /^BSD-/)
                {
-               foreach $wopt (split /\s+/, $memleak_devteam_backtrace)
-                       {
-                       $addflags .= " $wopt" unless ($config{cflags} =~ /(^|\s)$wopt(\s|$)/)
-                       }
-               if ($target =~ /^BSD-/)
-                       {
-                       $config{ex_libs} .= " -lexecinfo";
-                       }
+               $config{ex_libs} .= " -lexecinfo";
                }
-       $config{cflags} = "$addflags $config{cflags}" if $addflags ne '';
        }
 
+if ($user_cflags ne "") { $config{cflags}="$config{cflags}$user_cflags"; }
+else                    { $no_user_cflags=1;  }
+if (@user_defines) { $config{defines}=[ @{$config{defines}}, @user_defines ]; }
+else               { $no_user_defines=1;    }
+
+# ALL MODIFICATIONS TO %config and %target MUST BE DONE FROM HERE ON
+
 # If we use the unified build, collect information from build.info files
 my %unified_info = ();