Kaydet (Commit) 35f3d240 authored tarafından Victor Stinner's avatar Victor Stinner Kaydeden (comit) GitHub

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.
üst 28205b20
...@@ -6812,18 +6812,31 @@ then ...@@ -6812,18 +6812,31 @@ then
WRAP="-fwrapv" WRAP="-fwrapv"
fi fi
# Clang also needs -fwrapv
case $CC in case $CC in
*clang*) *clang*)
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" WRAP="-fwrapv"
# bpo-30104: Python/dtoa.c requires to be build with # bpo-30104: Python/dtoa.c requires to be build with
# -fno-strict-aliasing to fix compiler issue on the # -fno-strict-aliasing to fix compiler issue on the
# double/ULong[2] union using clang 4.0 and optimization level # double/ULong[2] union using clang 4.0 and optimization level
# -O2 or higher # -O2 or higher
# https://bugs.llvm.org//show_bug.cgi?id=31928 # https://bugs.llvm.org//show_bug.cgi?id=31928
ALIASING="-fno-strict-aliasing" ALIASING="-fno-strict-aliasing"
;; fi
esac
case $ac_cv_prog_cc_g in case $ac_cv_prog_cc_g in
yes) yes)
......
...@@ -1452,18 +1452,31 @@ then ...@@ -1452,18 +1452,31 @@ then
WRAP="-fwrapv" WRAP="-fwrapv"
fi fi
# Clang also needs -fwrapv
case $CC in case $CC in
*clang*) *clang*)
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" WRAP="-fwrapv"
# bpo-30104: Python/dtoa.c requires to be build with # bpo-30104: Python/dtoa.c requires to be build with
# -fno-strict-aliasing to fix compiler issue on the # -fno-strict-aliasing to fix compiler issue on the
# double/ULong[2] union using clang 4.0 and optimization level # double/ULong[2] union using clang 4.0 and optimization level
# -O2 or higher # -O2 or higher
# https://bugs.llvm.org//show_bug.cgi?id=31928 # https://bugs.llvm.org//show_bug.cgi?id=31928
ALIASING="-fno-strict-aliasing" ALIASING="-fno-strict-aliasing"
;; fi
esac
case $ac_cv_prog_cc_g in case $ac_cv_prog_cc_g in
yes) yes)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment