1 From f834492007487e9e87b3d3f1f3c5cc440e6ec5e2 Mon Sep 17 00:00:00 2001
2 From: Changqing Li <changqing.li@windriver.com>
3 Date: Mon, 22 Oct 2018 15:19:51 +0800
4 Subject: [PATCH] python3: use cc_basename to replace CC for checking compiler
6 When working path contains "clang"/"gcc"/"icc", it might be part of $CC
7 because of the "--sysroot" parameter. That could cause judgement error
8 about clang/gcc/icc compilers. e.g.
9 When "icc" is containded in working path, below errors are reported when
11 x86_64-wrs-linux-gcc: error: strict: No such file or directory
12 x86_64-wrs-linux-gcc: error: unrecognized command line option '-fp-model'
14 Here use cc_basename to replace CC for checking compiler to avoid such
17 Upstream-Status: Submitted [https://github.com/python/cpython/pull/96399]
19 Signed-off-by: Li Zhou <li.zhou@windriver.com>
21 patch originally from Li Zhou, I just rework it to new version
23 Signed-off-by: Changqing Li <changqing.li@windriver.com>
25 configure.ac | 19 ++++++++++---------
26 1 file changed, 10 insertions(+), 9 deletions(-)
28 diff --git a/configure.ac b/configure.ac
29 index d0d5405..093f8b5 100644
32 @@ -137,6 +137,7 @@ AC_CONFIG_HEADERS([pyconfig.h])
38 AS_VAR_IF([cross_compiling], [maybe],
39 [AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])]
40 @@ -896,7 +897,7 @@ AC_SUBST([CXX])
45 + case "$cc_basename" in
46 gcc) AC_PATH_TOOL([CXX], [g++], [g++], [notfound]) ;;
47 cc) AC_PATH_TOOL([CXX], [c++], [c++], [notfound]) ;;
48 clang|*/clang) AC_PATH_TOOL([CXX], [clang++], [clang++], [notfound]) ;;
49 @@ -1328,7 +1329,7 @@ rmdir CaseSensitiveTestDir
51 case $ac_sys_system in
54 + case $cc_basename in
55 cc|*/cc) CC="$CC -Ae";;
58 @@ -1854,7 +1855,7 @@ esac
60 [AC_MSG_RESULT([no])])
61 if test "$Py_LTO" = 'true' ; then
63 + case $cc_basename in
65 LDFLAGS_NOLTO="-fno-lto"
66 dnl Clang linker requires -flto in order to link objects with LTO information.
67 @@ -1983,7 +1984,7 @@ then
74 # Any changes made here should be reflected in the GCC+Darwin case below
75 PGO_PROF_GEN_FLAG="-fprofile-instr-generate"
76 @@ -2155,7 +2156,7 @@ AC_MSG_RESULT([$BOLT_APPLY_FLAGS])
77 # compiler and platform. BASECFLAGS tweaks need to be made even if the
85 @@ -2427,7 +2428,7 @@ yes)
87 # ICC doesn't recognize the option, but only emits a warning
88 ## XXX does it emit an unused result warning and can it be disabled?
90 + AS_CASE([$cc_basename],
91 [*icc*], [ac_cv_disable_unused_result_warning=no]
92 [PY_CHECK_CC_WARNING([disable], [unused-result])])
93 AS_VAR_IF([ac_cv_disable_unused_result_warning], [yes],
94 @@ -2673,7 +2674,7 @@ yes)
99 +case "$cc_basename" in
101 CFLAGS_NODIST="$CFLAGS_NODIST"
103 @@ -3508,7 +3509,7 @@ then
105 LINKFORSHARED="-Wl,--export-dynamic"
107 - SunOS/5*) case $CC in
108 + SunOS/5*) case $cc_basename in
110 if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
112 @@ -6831,7 +6832,7 @@ if test "$ac_cv_gcc_asm_for_x87" = yes; then
113 # Some versions of gcc miscompile inline asm:
114 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46491
115 # http://gcc.gnu.org/ml/gcc/2010-11/msg00366.html
117 + case $cc_basename in
119 AC_MSG_CHECKING([for gcc ipa-pure-const bug])
120 saved_cflags="$CFLAGS"