https://github.com/python/cpython/commit/a5b94d066016be63d632cccee0ec2a2eb24536dc
commit: a5b94d066016be63d632cccee0ec2a2eb24536dc
branch: main
author: Erlend E. Aasland <[email protected]>
committer: erlend-aasland <[email protected]>
date: 2024-11-07T10:49:58+01:00
summary:
gh-96398: Improve accuracy of compiler checks in configure.ac (#117815)
The following variables are now used in compiler checks:
- $ac_cv_gcc_compat is set to 'yes' for GCC compatible compilers
(the C preprocessor defines the __GNUC__ macro)
- for compiler basename checks, use $CC_BASENAME
(may contain platform triplets)
- for the rest, use $ac_cv_cc_name
(does not contain platform triplets)
files:
M configure
M configure.ac
diff --git a/configure b/configure
index e0ab304570dfd4..1d5c0941247c30 100755
--- a/configure
+++ b/configure
@@ -6193,6 +6193,8 @@ printf "%s\n" "$ac_cv_path_EGREP" >&6; }
+CC_BASENAME=$(expr "//$CC" : '.*/\(.*\)')
+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for CC compiler name"
>&5
printf %s "checking for CC compiler name... " >&6; }
if test ${ac_cv_cc_name+y}
@@ -6220,9 +6222,10 @@ EOF
if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then
ac_cv_cc_name=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '`
- if test $(expr "//$CC" : '.*/\(.*\)') = "mpicc"; then
- ac_cv_cc_name="mpicc"
- fi
+ if test "x$CC_BASENAME" = xmpicc
+then :
+ ac_cv_cc_name=mpicc
+fi
else
ac_cv_cc_name="unknown"
fi
@@ -6440,7 +6443,7 @@ printf "%s\n" "$ac_cv_gcc_compat" >&6; }
preset_cxx="$CXX"
if test -z "$CXX"
then
- case "$CC" in
+ case "$ac_cv_cc_name" in
gcc) if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}g++", so it can be a program
name with args.
set dummy ${ac_tool_prefix}g++; ac_word=$2
@@ -6657,7 +6660,7 @@ else
CXX="$ac_cv_path_CXX"
fi
;;
- clang|*/clang) if test -n "$ac_tool_prefix"; then
+ clang) if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}clang++", so it can be a
program name with args.
set dummy ${ac_tool_prefix}clang++; ac_word=$2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -6765,7 +6768,7 @@ else
CXX="$ac_cv_path_CXX"
fi
;;
- icc|*/icc) if test -n "$ac_tool_prefix"; then
+ icc) if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}icpc", so it can be a program
name with args.
set dummy ${ac_tool_prefix}icpc; ac_word=$2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -7374,7 +7377,7 @@ rmdir CaseSensitiveTestDir
case $ac_sys_system in
hp*|HP*)
- case $CC in
+ case $ac_cv_cc_name in
cc|*/cc) CC="$CC -Ae";;
esac;;
esac
@@ -7467,7 +7470,7 @@ printf "%s\n" "$EXPORTSYMS" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
printf %s "checking for GNU ld... " >&6; }
ac_prog=ld
-if test "$GCC" = yes; then
+if test "$ac_cv_cc_name" = "gcc"; then
ac_prog=`$CC -print-prog-name=ld`
fi
case `"$ac_prog" -V 2>&1 < /dev/null` in
@@ -8338,8 +8341,9 @@ if test "$Py_OPT" = 'true' ; then
DEF_MAKE_ALL_RULE="profile-opt"
REQUIRE_PGO="yes"
DEF_MAKE_RULE="build_all"
- case $CC in
- *gcc*)
+ if test "x$ac_cv_gcc_compat" = xyes
+then :
+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C
compiler accepts -fno-semantic-interposition" >&5
printf %s "checking whether C compiler accepts -fno-semantic-interposition...
" >&6; }
if test ${ax_cv_check_cflags__Werror__fno_semantic_interposition+y}
@@ -8381,8 +8385,8 @@ else $as_nop
:
fi
- ;;
- esac
+
+fi
elif test "$ac_sys_system" = "Emscripten" -o "$ac_sys_system" = "WASI"; then
DEF_MAKE_ALL_RULE="build_wasm"
REQUIRE_PGO="no"
@@ -8409,7 +8413,7 @@ printf "%s\n" "$PROFILE_TASK" >&6; }
llvm_bin_dir=''
llvm_path="${PATH}"
-if test "${CC}" = "clang"
+if test "${ac_cv_cc_name}" = "clang"
then
clang_bin=`which clang`
# Some systems install clang elsewhere as a symlink to the real path
@@ -8467,8 +8471,8 @@ printf "%s\n" "no" >&6; }
fi
if test "$Py_LTO" = 'true' ; then
- case $CC in
- *clang*)
+ case $ac_cv_cc_name in
+ clang)
LDFLAGS_NOLTO="-fno-lto"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking
whether C compiler accepts -flto=thin" >&5
printf %s "checking whether C compiler accepts -flto=thin... " >&6; }
@@ -8748,14 +8752,14 @@ fi
;;
esac
;;
- *emcc*)
+ emcc)
if test "$Py_LTO_POLICY" != "default"; then
as_fn_error $? "emcc supports only default lto." "$LINENO" 5
fi
LTOFLAGS="-flto"
LTOCFLAGS="-flto"
;;
- *gcc*)
+ gcc)
if test $Py_LTO_POLICY = thin
then
as_fn_error $? "thin lto is not supported under gcc compiler."
"$LINENO" 5
@@ -8921,10 +8925,8 @@ printf "%s\n" "$as_me: llvm-profdata found via xcrun:
${LLVM_PROFDATA}" >&6;}
fi
LLVM_PROF_ERR=no
-# GNU Autoconf recommends the use of expr instead of basename.
-CC_BASENAME=$(expr "//$CC" : '.*/\(.*\)')
-case "$CC_BASENAME" in
- *clang*)
+case "$ac_cv_cc_name" in
+ clang)
# Any changes made here should be reflected in the GCC+Darwin case below
PGO_PROF_GEN_FLAG="-fprofile-instr-generate"
PGO_PROF_USE_FLAG="-fprofile-instr-use=\"\$(shell pwd)/code.profclangd\""
@@ -8939,31 +8941,13 @@ case "$CC_BASENAME" in
fi
fi
;;
- *gcc*)
- case $ac_sys_system in
- Darwin*)
- PGO_PROF_GEN_FLAG="-fprofile-instr-generate"
- PGO_PROF_USE_FLAG="-fprofile-instr-use=\"\$(shell
pwd)/code.profclangd\""
- LLVM_PROF_MERGER=" ${LLVM_PROFDATA} merge -output=\"\$(shell
pwd)/code.profclangd\" \"\$(shell pwd)\"/*.profclangr "
- LLVM_PROF_FILE="LLVM_PROFILE_FILE=\"\$(shell pwd)/code-%p.profclangr\""
- if test "${LLVM_PROF_FOUND}" = "not-found"
- then
- LLVM_PROF_ERR=yes
- if test "${REQUIRE_PGO}" = "yes"
- then
- as_fn_error $? "llvm-profdata is required for a
--enable-optimizations build but could not be found." "$LINENO" 5
- fi
- fi
- ;;
- *)
- PGO_PROF_GEN_FLAG="-fprofile-generate"
- PGO_PROF_USE_FLAG="-fprofile-use -fprofile-correction"
- LLVM_PROF_MERGER="true"
- LLVM_PROF_FILE=""
- ;;
- esac
+ gcc)
+ PGO_PROF_GEN_FLAG="-fprofile-generate"
+ PGO_PROF_USE_FLAG="-fprofile-use -fprofile-correction"
+ LLVM_PROF_MERGER="true"
+ LLVM_PROF_FILE=""
;;
- *icc*)
+ icc)
PGO_PROF_GEN_FLAG="-prof-gen"
PGO_PROF_USE_FLAG="-prof-use"
LLVM_PROF_MERGER="true"
@@ -9329,19 +9313,6 @@ printf "%s\n" "$BOLT_APPLY_FLAGS" >&6; }
# compiler and platform. BASECFLAGS tweaks need to be made even if the
# user set OPT.
-case $CC in
- *clang*)
- cc_is_clang=1
- ;;
- *)
- if $CC --version 2>&1 | grep -q clang
- then
- cc_is_clang=1
- else
- cc_is_clang=
- fi
-esac
-
save_CFLAGS=$CFLAGS
CFLAGS="-fstrict-overflow -fno-strict-overflow"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC supports
-fstrict-overflow and -fno-strict-overflow" >&5
@@ -9465,7 +9436,7 @@ if test "${OPT-unset}" = "unset"
then
case $GCC in
yes)
- if test -n "${cc_is_clang}"
+ if test "${ac_cv_cc_name}" != "clang"
then
# bpo-30104: disable strict aliasing to compile correctly dtoa.c,
# see Makefile.pre.in for more information
@@ -9964,8 +9935,9 @@ fi
fi
-case $GCC in
-yes)
+if test "x$ac_cv_gcc_compat" = xyes
+then :
+
CFLAGS_NODIST="$CFLAGS_NODIST -std=c11"
@@ -10083,8 +10055,8 @@ fi
# ICC doesn't recognize the option, but only emits a warning
## XXX does it emit an unused result warning and can it be disabled?
- case "$CC_BASENAME" in #(
- *icc*) :
+ case "$ac_cv_cc_name" in #(
+ icc) :
ac_cv_disable_unused_result_warning=no
@@ -10489,22 +10461,19 @@ fi
Darwin*)
# -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
# used to be here, but non-Apple gcc doesn't accept them.
- if test "${CC}" = gcc
- then
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking which
compiler should be used" >&5
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking which compiler
should be used" >&5
printf %s "checking which compiler should be used... " >&6; }
- case "${UNIVERSALSDK}" in
- */MacOSX10.4u.sdk)
- # Build using 10.4 SDK, force usage of gcc when the
- # compiler is gcc, otherwise the user will get very
- # confusing error messages when building on OSX 10.6
- CC=gcc-4.0
- CPP=cpp-4.0
- ;;
- esac
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+ case "${UNIVERSALSDK}" in
+ */MacOSX10.4u.sdk)
+ # Build using 10.4 SDK, force usage of gcc when the
+ # compiler is gcc, otherwise the user will get very
+ # confusing error messages when building on OSX 10.6
+ CC=gcc-4.0
+ CPP=cpp-4.0
+ ;;
+ esac
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
printf "%s\n" "$CC" >&6; }
- fi
LIPO_INTEL64_FLAGS=""
if test "${enable_universalsdk}"
@@ -10650,9 +10619,9 @@ rm -f core conftest.err conftest.$ac_objext
conftest.beam \
# end of Darwin* tests
;;
esac
- ;;
-*)
+else $as_nop
+
case $ac_sys_system in
OpenUNIX*|UnixWare*)
BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca "
@@ -10661,18 +10630,18 @@ rm -f core conftest.err conftest.$ac_objext
conftest.beam \
BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
;;
esac
- ;;
-esac
-case "$CC_BASENAME" in
-*mpicc*)
+fi
+
+case "$ac_cv_cc_name" in
+mpicc)
CFLAGS_NODIST="$CFLAGS_NODIST"
;;
-*icc*)
+icc)
# ICC needs -fp-model strict or floats behave badly
CFLAGS_NODIST="$CFLAGS_NODIST -fp-model strict"
;;
-*xlc*)
+xlc)
CFLAGS_NODIST="$CFLAGS_NODIST -qalias=noansi -qmaxmem=-1"
;;
esac
@@ -13195,7 +13164,7 @@ then
LDSHARED="\$(LIBPL)/ld_so_aix \$(CC) -bI:\$(LIBPL)/python.exp"
;;
SunOS/5*)
- if test "$GCC" = "yes" ; then
+ if test "$ac_cv_gcc_compat" = "yes" ; then
LDSHARED='$(CC) -shared'
LDCXXSHARED='$(CXX) -shared'
else
@@ -13203,7 +13172,7 @@ then
LDCXXSHARED='$(CXX) -G'
fi ;;
hp*|HP*)
- if test "$GCC" = "yes" ; then
+ if test "$ac_cv_gcc_compat" = "yes" ; then
LDSHARED='$(CC) -shared'
LDCXXSHARED='$(CXX) -shared'
else
@@ -13296,7 +13265,7 @@ then
LDSHARED='$(CC) -shared'
LDCXXSHARED='$(CXX) -shared';;
OpenUNIX*|UnixWare*)
- if test "$GCC" = "yes" ; then
+ if test "$ac_cv_gcc_compat" = "yes" ; then
LDSHARED='$(CC) -shared'
LDCXXSHARED='$(CXX) -shared'
else
@@ -13340,13 +13309,13 @@ printf %s "checking CCSHARED... " >&6; }
if test -z "$CCSHARED"
then
case $ac_sys_system/$ac_sys_release in
- SunOS*) if test "$GCC" = yes;
+ SunOS*) if test "$ac_cv_gcc_compat" = "yes";
then CCSHARED="-fPIC";
elif test `uname -p` = sparc;
then CCSHARED="-xcode=pic32";
else CCSHARED="-Kpic";
fi;;
- hp*|HP*) if test "$GCC" = yes;
+ hp*|HP*) if test "$ac_cv_gcc_compat" = "yes";
then CCSHARED="-fPIC";
else CCSHARED="+z";
fi;;
@@ -13361,12 +13330,12 @@ fi;;
FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";;
Haiku*) CCSHARED="-fPIC";;
OpenUNIX*|UnixWare*)
- if test "$GCC" = "yes"
+ if test "$ac_cv_gcc_compat" = "yes"
then CCSHARED="-fPIC"
else CCSHARED="-KPIC"
fi;;
SCO_SV*)
- if test "$GCC" = "yes"
+ if test "$ac_cv_gcc_compat" = "yes"
then CCSHARED="-fPIC"
else CCSHARED="-Kpic -belf"
fi;;
@@ -13426,13 +13395,13 @@ printf "%s\n" "#define THREAD_STACK_SIZE
0x$stack_size" >>confdefs.h
then
LINKFORSHARED="-Wl,--export-dynamic"
fi;;
- SunOS/5*) case $CC in
- *gcc*)
+ SunOS/5*) if test "$ac_cv_gcc_compat" = "yes"; then
if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
then
LINKFORSHARED="-Xlinker --export-dynamic"
- fi;;
- esac;;
+ fi
+ fi
+ ;;
CYGWIN*)
if test $enable_shared = "no"
then
@@ -15323,7 +15292,7 @@ esac
fi
elif test $ac_cv_sizeof_size_t -eq 4; then
if test "$ac_cv_gcc_asm_for_x87" = yes -a "$libmpdec_system" != sunos;
then
- case $CC in #(
+ case $ac_cv_cc_name in #(
*gcc*) :
libmpdec_machine=ppro ;; #(
*clang*) :
@@ -28206,8 +28175,8 @@ if test "$ac_cv_gcc_asm_for_x87" = yes; then
# Some versions of gcc miscompile inline asm:
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46491
# http://gcc.gnu.org/ml/gcc/2010-11/msg00366.html
- case $CC in
- *gcc*)
+ case $ac_cv_cc_name in
+ gcc)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gcc
ipa-pure-const bug" >&5
printf %s "checking for gcc ipa-pure-const bug... " >&6; }
saved_cflags="$CFLAGS"
diff --git a/configure.ac b/configure.ac
index da7d1ef68eefa8..ce5a5eb9c2891f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1048,6 +1048,9 @@ AC_PROG_GREP
AC_PROG_SED
AC_PROG_EGREP
+dnl GNU Autoconf recommends the use of expr instead of basename.
+AS_VAR_SET([CC_BASENAME], [$(expr "//$CC" : '.*/\(.*\)')])
+
dnl detect compiler name
dnl check for xlc before clang, newer xlc's can use clang as frontend.
dnl check for GCC last, other compilers set __GNUC__, too.
@@ -1073,9 +1076,7 @@ EOF
if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then
ac_cv_cc_name=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '`
- if test $(expr "//$CC" : '.*/\(.*\)') = "mpicc"; then
- ac_cv_cc_name="mpicc"
- fi
+ AS_VAR_IF([CC_BASENAME], [mpicc], [ac_cv_cc_name=mpicc])
else
ac_cv_cc_name="unknown"
fi
@@ -1104,11 +1105,11 @@ AC_SUBST([CXX])
preset_cxx="$CXX"
if test -z "$CXX"
then
- case "$CC" in
+ case "$ac_cv_cc_name" in
gcc) AC_PATH_TOOL([CXX], [g++], [g++], [notfound]) ;;
cc) AC_PATH_TOOL([CXX], [c++], [c++], [notfound]) ;;
- clang|*/clang) AC_PATH_TOOL([CXX], [clang++], [clang++],
[notfound]) ;;
- icc|*/icc) AC_PATH_TOOL([CXX], [icpc], [icpc], [notfound]) ;;
+ clang) AC_PATH_TOOL([CXX], [clang++], [clang++],
[notfound]) ;;
+ icc) AC_PATH_TOOL([CXX], [icpc], [icpc], [notfound]) ;;
esac
if test "$CXX" = "notfound"
then
@@ -1381,7 +1382,7 @@ rmdir CaseSensitiveTestDir
case $ac_sys_system in
hp*|HP*)
- case $CC in
+ case $ac_cv_cc_name in
cc|*/cc) CC="$CC -Ae";;
esac;;
esac
@@ -1467,7 +1468,7 @@ AC_MSG_RESULT([$EXPORTSYMS])
AC_SUBST([GNULD])
AC_MSG_CHECKING([for GNU ld])
ac_prog=ld
-if test "$GCC" = yes; then
+if test "$ac_cv_cc_name" = "gcc"; then
ac_prog=`$CC -print-prog-name=ld`
fi
case `"$ac_prog" -V 2>&1 < /dev/null` in
@@ -1874,14 +1875,12 @@ if test "$Py_OPT" = 'true' ; then
DEF_MAKE_ALL_RULE="profile-opt"
REQUIRE_PGO="yes"
DEF_MAKE_RULE="build_all"
- case $CC in
- *gcc*)
+ AS_VAR_IF([ac_cv_gcc_compat], [yes], [
AX_CHECK_COMPILE_FLAG([-fno-semantic-interposition],[
CFLAGS_NODIST="$CFLAGS_NODIST -fno-semantic-interposition"
LDFLAGS_NODIST="$LDFLAGS_NODIST -fno-semantic-interposition"
], [], [-Werror])
- ;;
- esac
+ ])
elif test "$ac_sys_system" = "Emscripten" -o "$ac_sys_system" = "WASI"; then
dnl Emscripten does not support shared extensions yet. Build
dnl "python.[js,wasm]", "pybuilddir.txt", and "platform" files.
@@ -1908,7 +1907,7 @@ AC_MSG_RESULT([$PROFILE_TASK])
llvm_bin_dir=''
llvm_path="${PATH}"
-if test "${CC}" = "clang"
+if test "${ac_cv_cc_name}" = "clang"
then
clang_bin=`which clang`
# Some systems install clang elsewhere as a symlink to the real path
@@ -1955,8 +1954,8 @@ esac
],
[AC_MSG_RESULT([no])])
if test "$Py_LTO" = 'true' ; then
- case $CC in
- *clang*)
+ case $ac_cv_cc_name in
+ clang)
LDFLAGS_NOLTO="-fno-lto"
dnl Clang linker requires -flto in order to link objects with LTO
information.
dnl Thin LTO is faster and works for object files with full LTO
information, too.
@@ -2019,14 +2018,14 @@ if test "$Py_LTO" = 'true' ; then
;;
esac
;;
- *emcc*)
+ emcc)
if test "$Py_LTO_POLICY" != "default"; then
AC_MSG_ERROR([emcc supports only default lto.])
fi
LTOFLAGS="-flto"
LTOCFLAGS="-flto"
;;
- *gcc*)
+ gcc)
if test $Py_LTO_POLICY = thin
then
AC_MSG_ERROR([thin lto is not supported under gcc compiler.])
@@ -2085,10 +2084,8 @@ then
fi
LLVM_PROF_ERR=no
-# GNU Autoconf recommends the use of expr instead of basename.
-AS_VAR_SET([CC_BASENAME], [$(expr "//$CC" : '.*/\(.*\)')])
-case "$CC_BASENAME" in
- *clang*)
+case "$ac_cv_cc_name" in
+ clang)
# Any changes made here should be reflected in the GCC+Darwin case below
PGO_PROF_GEN_FLAG="-fprofile-instr-generate"
PGO_PROF_USE_FLAG="-fprofile-instr-use=\"\$(shell pwd)/code.profclangd\""
@@ -2107,35 +2104,13 @@ case "$CC_BASENAME" in
fi
fi
;;
- *gcc*)
- case $ac_sys_system in
- Darwin*)
- PGO_PROF_GEN_FLAG="-fprofile-instr-generate"
- PGO_PROF_USE_FLAG="-fprofile-instr-use=\"\$(shell
pwd)/code.profclangd\""
- LLVM_PROF_MERGER=m4_normalize("
- ${LLVM_PROFDATA} merge
- -output=\"\$(shell pwd)/code.profclangd\"
- \"\$(shell pwd)\"/*.profclangr
- ")
- LLVM_PROF_FILE="LLVM_PROFILE_FILE=\"\$(shell pwd)/code-%p.profclangr\""
- if test "${LLVM_PROF_FOUND}" = "not-found"
- then
- LLVM_PROF_ERR=yes
- if test "${REQUIRE_PGO}" = "yes"
- then
- AC_MSG_ERROR([llvm-profdata is required for a
--enable-optimizations build but could not be found.])
- fi
- fi
- ;;
- *)
- PGO_PROF_GEN_FLAG="-fprofile-generate"
- PGO_PROF_USE_FLAG="-fprofile-use -fprofile-correction"
- LLVM_PROF_MERGER="true"
- LLVM_PROF_FILE=""
- ;;
- esac
+ gcc)
+ PGO_PROF_GEN_FLAG="-fprofile-generate"
+ PGO_PROF_USE_FLAG="-fprofile-use -fprofile-correction"
+ LLVM_PROF_MERGER="true"
+ LLVM_PROF_FILE=""
;;
- *icc*)
+ icc)
PGO_PROF_GEN_FLAG="-prof-gen"
PGO_PROF_USE_FLAG="-prof-use"
LLVM_PROF_MERGER="true"
@@ -2259,19 +2234,6 @@ AC_MSG_RESULT([$BOLT_APPLY_FLAGS])
# compiler and platform. BASECFLAGS tweaks need to be made even if the
# user set OPT.
-case $CC in
- *clang*)
- cc_is_clang=1
- ;;
- *)
- if $CC --version 2>&1 | grep -q clang
- then
- cc_is_clang=1
- else
- cc_is_clang=
- fi
-esac
-
dnl Historically, some of our code assumed that signed integer overflow
dnl is defined behaviour via twos-complement.
dnl Set STRICT_OVERFLOW_CFLAGS and NO_STRICT_OVERFLOW_CFLAGS depending on
compiler support.
@@ -2346,7 +2308,7 @@ if test "${OPT-unset}" = "unset"
then
case $GCC in
yes)
- if test -n "${cc_is_clang}"
+ if test "${ac_cv_cc_name}" != "clang"
then
# bpo-30104: disable strict aliasing to compile correctly dtoa.c,
# see Makefile.pre.in for more information
@@ -2526,8 +2488,7 @@ then
AX_CHECK_COMPILE_FLAG([-D_FORTIFY_SOURCE=3], [CFLAGS_NODIST="$CFLAGS_NODIST
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3"], [AC_MSG_WARN([-D_FORTIFY_SOURCE=3 not
supported])], [-Werror])
fi
-case $GCC in
-yes)
+AS_VAR_IF([ac_cv_gcc_compat], [yes], [
CFLAGS_NODIST="$CFLAGS_NODIST -std=c11"
PY_CHECK_CC_WARNING([enable], [extra], [if we can add -Wextra])
@@ -2568,8 +2529,8 @@ yes)
# ICC doesn't recognize the option, but only emits a warning
## XXX does it emit an unused result warning and can it be disabled?
- AS_CASE(["$CC_BASENAME"],
- [*icc*], [ac_cv_disable_unused_result_warning=no]
+ AS_CASE(["$ac_cv_cc_name"],
+ [icc], [ac_cv_disable_unused_result_warning=no]
[PY_CHECK_CC_WARNING([disable], [unused-result])])
AS_VAR_IF([ac_cv_disable_unused_result_warning], [yes],
[BASECFLAGS="$BASECFLAGS -Wno-unused-result"
@@ -2662,20 +2623,17 @@ yes)
Darwin*)
# -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
# used to be here, but non-Apple gcc doesn't accept them.
- if test "${CC}" = gcc
- then
- AC_MSG_CHECKING([which compiler should be used])
- case "${UNIVERSALSDK}" in
- */MacOSX10.4u.sdk)
- # Build using 10.4 SDK, force usage of gcc when the
- # compiler is gcc, otherwise the user will get very
- # confusing error messages when building on OSX 10.6
- CC=gcc-4.0
- CPP=cpp-4.0
- ;;
- esac
- AC_MSG_RESULT([$CC])
- fi
+ AC_MSG_CHECKING([which compiler should be used])
+ case "${UNIVERSALSDK}" in
+ */MacOSX10.4u.sdk)
+ # Build using 10.4 SDK, force usage of gcc when the
+ # compiler is gcc, otherwise the user will get very
+ # confusing error messages when building on OSX 10.6
+ CC=gcc-4.0
+ CPP=cpp-4.0
+ ;;
+ esac
+ AC_MSG_RESULT([$CC])
LIPO_INTEL64_FLAGS=""
if test "${enable_universalsdk}"
@@ -2800,9 +2758,7 @@ yes)
# end of Darwin* tests
;;
esac
- ;;
-
-*)
+], [
case $ac_sys_system in
OpenUNIX*|UnixWare*)
BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca "
@@ -2811,18 +2767,17 @@ yes)
BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
;;
esac
- ;;
-esac
+])
-case "$CC_BASENAME" in
-*mpicc*)
+case "$ac_cv_cc_name" in
+mpicc)
CFLAGS_NODIST="$CFLAGS_NODIST"
;;
-*icc*)
+icc)
# ICC needs -fp-model strict or floats behave badly
CFLAGS_NODIST="$CFLAGS_NODIST -fp-model strict"
;;
-*xlc*)
+xlc)
CFLAGS_NODIST="$CFLAGS_NODIST -qalias=noansi -qmaxmem=-1"
;;
esac
@@ -3430,7 +3385,7 @@ then
LDSHARED="\$(LIBPL)/ld_so_aix \$(CC) -bI:\$(LIBPL)/python.exp"
;;
SunOS/5*)
- if test "$GCC" = "yes" ; then
+ if test "$ac_cv_gcc_compat" = "yes" ; then
LDSHARED='$(CC) -shared'
LDCXXSHARED='$(CXX) -shared'
else
@@ -3438,7 +3393,7 @@ then
LDCXXSHARED='$(CXX) -G'
fi ;;
hp*|HP*)
- if test "$GCC" = "yes" ; then
+ if test "$ac_cv_gcc_compat" = "yes" ; then
LDSHARED='$(CC) -shared'
LDCXXSHARED='$(CXX) -shared'
else
@@ -3531,7 +3486,7 @@ then
LDSHARED='$(CC) -shared'
LDCXXSHARED='$(CXX) -shared';;
OpenUNIX*|UnixWare*)
- if test "$GCC" = "yes" ; then
+ if test "$ac_cv_gcc_compat" = "yes" ; then
LDSHARED='$(CC) -shared'
LDCXXSHARED='$(CXX) -shared'
else
@@ -3571,13 +3526,13 @@ AC_MSG_CHECKING([CCSHARED])
if test -z "$CCSHARED"
then
case $ac_sys_system/$ac_sys_release in
- SunOS*) if test "$GCC" = yes;
+ SunOS*) if test "$ac_cv_gcc_compat" = "yes";
then CCSHARED="-fPIC";
elif test `uname -p` = sparc;
then CCSHARED="-xcode=pic32";
else CCSHARED="-Kpic";
fi;;
- hp*|HP*) if test "$GCC" = yes;
+ hp*|HP*) if test "$ac_cv_gcc_compat" = "yes";
then CCSHARED="-fPIC";
else CCSHARED="+z";
fi;;
@@ -3589,12 +3544,12 @@ then
FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";;
Haiku*) CCSHARED="-fPIC";;
OpenUNIX*|UnixWare*)
- if test "$GCC" = "yes"
+ if test "$ac_cv_gcc_compat" = "yes"
then CCSHARED="-fPIC"
else CCSHARED="-KPIC"
fi;;
SCO_SV*)
- if test "$GCC" = "yes"
+ if test "$ac_cv_gcc_compat" = "yes"
then CCSHARED="-fPIC"
else CCSHARED="-Kpic -belf"
fi;;
@@ -3652,13 +3607,13 @@ then
then
LINKFORSHARED="-Wl,--export-dynamic"
fi;;
- SunOS/5*) case $CC in
- *gcc*)
+ SunOS/5*) if test "$ac_cv_gcc_compat" = "yes"; then
if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
then
LINKFORSHARED="-Xlinker --export-dynamic"
- fi;;
- esac;;
+ fi
+ fi
+ ;;
CYGWIN*)
if test $enable_shared = "no"
then
@@ -4228,7 +4183,7 @@ AS_VAR_IF(
fi
elif test $ac_cv_sizeof_size_t -eq 4; then
if test "$ac_cv_gcc_asm_for_x87" = yes -a "$libmpdec_system" != sunos;
then
- AS_CASE([$CC],
+ AS_CASE([$ac_cv_cc_name],
[*gcc*], [libmpdec_machine=ppro],
[*clang*], [libmpdec_machine=ppro],
[libmpdec_machine=ansi32]
@@ -7150,8 +7105,8 @@ if test "$ac_cv_gcc_asm_for_x87" = yes; then
# Some versions of gcc miscompile inline asm:
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46491
# http://gcc.gnu.org/ml/gcc/2010-11/msg00366.html
- case $CC in
- *gcc*)
+ case $ac_cv_cc_name in
+ gcc)
AC_MSG_CHECKING([for gcc ipa-pure-const bug])
saved_cflags="$CFLAGS"
CFLAGS="-O2"
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]