[openssl] master update

Richard Levitte levitte at openssl.org
Tue Feb 23 08:35:08 UTC 2021


The branch master has been updated
       via  f627561cf5cc4963698bf975df8694543bcf826c (commit)
       via  9e1094ad3df16a7d9a1224925ed8a9c3f76b9bba (commit)
      from  444b25b1e96fa444ffe3a67671796cfc1b599735 (commit)


- Log -----------------------------------------------------------------
commit f627561cf5cc4963698bf975df8694543bcf826c
Author: Richard Levitte <levitte at openssl.org>
Date:   Mon Feb 22 07:37:06 2021 +0100

    util/perl/OpenSSL/config.pm: Add VMS specific C compiler settings
    
    That includes proper compiler version detection.
    
    Partially fixes #14247
    
    Reviewed-by: Paul Dale <pauli at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/14270)

commit 9e1094ad3df16a7d9a1224925ed8a9c3f76b9bba
Author: Richard Levitte <levitte at openssl.org>
Date:   Mon Feb 22 07:29:03 2021 +0100

    util/perl/OpenSSL/config.pm: Fix determine_compiler_settings()
    
    There may be times when a compiler can't be detected, in which case
    determine_compiler_settings() bailed out too early, before platform
    specific fallbacks have a chance to set the record straight.  That
    bail out has been moved to be done after the platform specific
    fallbacks.
    
    Furthermore, the attempt to check for gcc or clang and get their
    version number was done even if no compiler had been automatically
    detected or pre-specified via $CC.  It now only does this when there
    is a compiler specified or detected.  The platform specific fallbacks
    check the versions separately.
    
    Reviewed-by: Paul Dale <pauli at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/14270)

-----------------------------------------------------------------------

Summary of changes:
 util/perl/OpenSSL/config.pm | 110 ++++++++++++++++++++++++++------------------
 1 file changed, 65 insertions(+), 45 deletions(-)

diff --git a/util/perl/OpenSSL/config.pm b/util/perl/OpenSSL/config.pm
index 776e448df4..d09d017c87 100755
--- a/util/perl/OpenSSL/config.pm
+++ b/util/perl/OpenSSL/config.pm
@@ -193,6 +193,8 @@ sub maybe_abort {
 
 # Look for ISC/SCO with its unique uname program
 sub is_sco_uname {
+    return undef unless IPC::Cmd::can_run('uname');
+
     open UNAME, "uname -X 2>/dev/null|" or return '';
     my $line = "";
     while ( <UNAME> ) {
@@ -200,9 +202,11 @@ sub is_sco_uname {
         $line = $_ if m@^Release@;
     }
     close UNAME;
-    return "" if $line eq '';
+
+    return undef if $line eq '';
+
     my @fields = split(/\s+/, $line);
-    return $fields[2] // '';
+    return $fields[2];
 }
 
 sub get_sco_type {
@@ -237,7 +241,7 @@ sub guess_system {
 
     # Special-cases for ISC, SCO, Unixware
     my $REL = is_sco_uname();
-    if ( $REL ne "" ) {
+    if ( defined $REL ) {
         my $result = get_sco_type($REL);
         return eval "\"$result\"" if $result ne '';
     }
@@ -276,8 +280,8 @@ sub _pairs (@) {
 
 # Figure out CC, GCCVAR, etc.
 sub determine_compiler_settings {
-    # Make a copy and don't touch it.  That helps determine if we're
-    # finding the compiler here
+    # Make a copy and don't touch it.  That helps determine if we're finding
+    # the compiler here (false), or if it was set by the user (true.
     my $cc = $CC;
 
     # Set certain default
@@ -293,51 +297,59 @@ sub determine_compiler_settings {
         }
     }
 
-    # Find the compiler vendor and version number for certain compilers
-    foreach my $pair (_pairs @cc_version) {
-        # Try to get the version number.
-        # Failure gets us undef or an empty string
-        my ( $k, $v ) = @$pair;
-        $v = $v->();
-
-        # If we got a version number, process it
-        if ($v) {
-            $CCVENDOR = $k;
-
-            # The returned version is expected to be one of
-            #
-            # MAJOR
-            # MAJOR.MINOR
-            # MAJOR.MINOR.{whatever}
-            #
-            # We don't care what comes after MAJOR.MINOR.  All we need is to
-            # have them calculated into a single number, using this formula:
-            #
-            # MAJOR * 100 + MINOR
-            # Here are a few examples of what we should get:
-            #
-            # 2.95.1    => 295
-            # 3.1       => 301
-            # 9         => 900
-            my @numbers = split /\./, $v;
-            my @factors = (100, 1);
-            while (@numbers && @factors) {
-                $CCVER += shift(@numbers) * shift(@factors)
+    if ( $CC ) {
+        # Find the compiler vendor and version number for certain compilers
+        foreach my $pair (_pairs @cc_version) {
+            # Try to get the version number.
+            # Failure gets us undef or an empty string
+            my ( $k, $v ) = @$pair;
+            $v = $v->();
+
+            # If we got a version number, process it
+            if ($v) {
+                $CCVENDOR = $k;
+
+                # The returned version is expected to be one of
+                #
+                # MAJOR
+                # MAJOR.MINOR
+                # MAJOR.MINOR.{whatever}
+                #
+                # We don't care what comes after MAJOR.MINOR.  All we need is
+                # to have them calculated into a single number, using this
+                # formula:
+                #
+                # MAJOR * 100 + MINOR
+                # Here are a few examples of what we should get:
+                #
+                # 2.95.1    => 295
+                # 3.1       => 301
+                # 9         => 900
+                my @numbers = split /\./, $v;
+                my @factors = (100, 1);
+                while (@numbers && @factors) {
+                    $CCVER += shift(@numbers) * shift(@factors)
+                }
+                last;
             }
-            last;
         }
     }
 
-    # If no C compiler has been determined at this point, we die.  Hard.
-    die <<_____
-ERROR!
-No C compiler found, please specify one with the environment variable CC,
-or configure with an explicit configuration target.
-_____
-        unless $CC;
-
-    # Vendor specific overrides, only if we determined the compiler here
+    # Vendor specific overrides, only if we didn't determine the compiler here
     if ( ! $cc ) {
+        if ( $SYSTEM eq 'OpenVMS' ) {
+            my $v = `CC/VERSION NLA0:`;
+            if ($? == 0) {
+                my ($vendor, $version) =
+                    ( $v =~ m/^([A-Z]+) C V([0-9\.-]+) on / );
+                my ($major, $minor, $patch) =
+                    ( $version =~ m/^([0-9]+)\.([0-9]+)-0*?(0|[1-9][0-9]*)$/ );
+                $CC = 'CC';
+                $CCVENDOR = $vendor;
+                $CCVER = ( $major * 100 + $minor ) * 100 + $patch;
+            }
+        }
+
         if ( ${SYSTEM} eq 'AIX' ) {
             # favor vendor cc over gcc
             if (IPC::Cmd::can_run('cc')) {
@@ -375,6 +387,14 @@ EOF
         }
     }
 
+    # If no C compiler has been determined at this point, we die.  Hard.
+    die <<_____
+ERROR!
+No C compiler found, please specify one with the environment variable CC,
+or configure with an explicit configuration target.
+_____
+        unless $CC;
+
     # On some systems, we assume a cc vendor if it's not already determined
 
     if ( ! $CCVENDOR ) {


More information about the openssl-commits mailing list