summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-04-21 10:35:24 (GMT)
committerGitHub <noreply@github.com>2017-04-21 10:35:24 (GMT)
commit35f3d240ee5f0958034bd500949b08764e36f4dc (patch)
tree3779ed8a8ce6d58afdbf3613ff54219840c392f2
parent28205b203a4742c40080b4a2b4b2dcd800716edc (diff)
downloadcpython-35f3d240ee5f0958034bd500949b08764e36f4dc.zip
cpython-35f3d240ee5f0958034bd500949b08764e36f4dc.tar.gz
cpython-35f3d240ee5f0958034bd500949b08764e36f4dc.tar.bz2
bpo-30104: configure now detects when cc is clang (#1233)
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.
-rwxr-xr-xconfigure29
-rw-r--r--configure.ac29
2 files changed, 42 insertions, 16 deletions
diff --git a/configure b/configure
index 40e64ad..1c90d31 100755
--- 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
diff --git a/configure.ac b/configure.ac
index cb79ea8..e5b7257 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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