bpo-30104: configure now detects when cc is clang (#1233) · python/cpython@35f3d24 (original) (raw)

Original file line number Diff line number Diff line change
@@ -6812,19 +6812,32 @@ then
6812 6812 WRAP="-fwrapv"
6813 6813 fi
6814 6814
6815 -# Clang also needs -fwrapv
6816 6815 case $CC in
6817 6816 *clang*)
6818 - WRAP="-fwrapv"
6819 -# bpo-30104: Python/dtoa.c requires to be build with
6820 -# -fno-strict-aliasing to fix compiler issue on the
6821 -# double/ULong[2] union using clang 4.0 and optimization level
6822 -# -O2 or higher
6823 -# https://bugs.llvm.org//show\_bug.cgi?id=31928
6824 - ALIASING="-fno-strict-aliasing"
6817 + cc_is_clang=1
6825 6818 ;;
6819 +*)
6820 +if $CC --version 2>&1 | grep -q clang
6821 +then
6822 + cc_is_clang=1
6823 +else
6824 + cc_is_clang=
6825 +fi
6826 6826 esac
6827 6827
6828 +if test -n "${cc_is_clang}"
6829 +then
6830 +# Clang also needs -fwrapv
6831 + WRAP="-fwrapv"
6832 +
6833 +# bpo-30104: Python/dtoa.c requires to be build with
6834 +# -fno-strict-aliasing to fix compiler issue on the
6835 +# double/ULong[2] union using clang 4.0 and optimization level
6836 +# -O2 or higher
6837 +# https://bugs.llvm.org//show\_bug.cgi?id=31928
6838 + ALIASING="-fno-strict-aliasing"
6839 +fi
6840 +
6828 6841 case $ac_cv_prog_cc_g in
6829 6842 yes)
6830 6843 if test "$Py_DEBUG" = 'true' ; then