]> granicus.if.org Git - python/commitdiff
bpo-30104: configure now detects when cc is clang (#1233)
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 21 Apr 2017 10:35:24 +0000 (12:35 +0200)
committerGitHub <noreply@github.com>
Fri, 21 Apr 2017 10:35:24 +0000 (12:35 +0200)
Detect when the "cc" compiler (and the $CC variable) is the Clang
compiler. The test is needed to add the -fno-strict-aliasing option
on FreeBSD where cc is clang.

configure
configure.ac

index 40e64adc8a886d61e5c8a433e78a9115536a614b..1c90d3101c897743a29610c4269a2f902dde90c9 100755 (executable)
--- a/configure
+++ b/configure
@@ -6812,19 +6812,32 @@ then
            WRAP="-fwrapv"
         fi
 
-        # Clang also needs -fwrapv
         case $CC in
             *clang*)
-                WRAP="-fwrapv"
-                # bpo-30104: Python/dtoa.c requires to be build with
-                # -fno-strict-aliasing to fix compiler issue on the
-                # double/ULong[2] union using clang 4.0 and optimization level
-                # -O2 or higher
-                # https://bugs.llvm.org//show_bug.cgi?id=31928
-                ALIASING="-fno-strict-aliasing"
+                cc_is_clang=1
                 ;;
+            *)
+                if $CC --version 2>&1 | grep -q clang
+                then
+                    cc_is_clang=1
+                else
+                    cc_is_clang=
+                fi
         esac
 
+        if test -n "${cc_is_clang}"
+        then
+            # Clang also needs -fwrapv
+            WRAP="-fwrapv"
+
+            # bpo-30104: Python/dtoa.c requires to be build with
+            # -fno-strict-aliasing to fix compiler issue on the
+            # double/ULong[2] union using clang 4.0 and optimization level
+            # -O2 or higher
+            # https://bugs.llvm.org//show_bug.cgi?id=31928
+            ALIASING="-fno-strict-aliasing"
+        fi
+
        case $ac_cv_prog_cc_g in
        yes)
            if test "$Py_DEBUG" = 'true' ; then
index cb79ea891f4fc486913f9cba0c270ede5b584d66..e5b725795ad2c02ee08b391392c803fc1caa0bfd 100644 (file)
@@ -1452,19 +1452,32 @@ then
            WRAP="-fwrapv"
         fi
 
-        # Clang also needs -fwrapv
         case $CC in
             *clang*)
-                WRAP="-fwrapv"
-                # bpo-30104: Python/dtoa.c requires to be build with
-                # -fno-strict-aliasing to fix compiler issue on the
-                # double/ULong[2] union using clang 4.0 and optimization level
-                # -O2 or higher
-                # https://bugs.llvm.org//show_bug.cgi?id=31928
-                ALIASING="-fno-strict-aliasing"
+                cc_is_clang=1
                 ;;
+            *)
+                if $CC --version 2>&1 | grep -q clang
+                then
+                    cc_is_clang=1
+                else
+                    cc_is_clang=
+                fi
         esac
 
+        if test -n "${cc_is_clang}"
+        then
+            # Clang also needs -fwrapv
+            WRAP="-fwrapv"
+
+            # bpo-30104: Python/dtoa.c requires to be build with
+            # -fno-strict-aliasing to fix compiler issue on the
+            # double/ULong[2] union using clang 4.0 and optimization level
+            # -O2 or higher
+            # https://bugs.llvm.org//show_bug.cgi?id=31928
+            ALIASING="-fno-strict-aliasing"
+        fi
+
        case $ac_cv_prog_cc_g in
        yes)
            if test "$Py_DEBUG" = 'true' ; then