blob: 2c7d264da089f5dbd4df33bf71c0d3f6e9533863 [file] [log] [blame]
Andrew Geissler595f6302022-01-24 19:11:47 +00001From 9f68a27eb34394a00f1011c06900c609f15fb15c Mon Sep 17 00:00:00 2001
Brad Bishop19323692019-04-05 15:28:33 -04002From: Changqing Li <changqing.li@windriver.com>
3Date: Mon, 22 Oct 2018 15:19:51 +0800
4Subject: [PATCH] python3: use cc_basename to replace CC for checking compiler
5
6When working path contains "clang"/"gcc"/"icc", it might be part of $CC
7because of the "--sysroot" parameter. That could cause judgement error
8about clang/gcc/icc compilers. e.g.
9When "icc" is containded in working path, below errors are reported when
10compiling python3:
11x86_64-wrs-linux-gcc: error: strict: No such file or directory
12x86_64-wrs-linux-gcc: error: unrecognized command line option '-fp-model'
13
14Here use cc_basename to replace CC for checking compiler to avoid such
15kind of issue.
16
Patrick Williams92b42cb2022-09-03 06:53:57 -050017Upstream-Status: Submitted [https://github.com/python/cpython/pull/96399]
Brad Bishop19323692019-04-05 15:28:33 -040018
19Signed-off-by: Li Zhou <li.zhou@windriver.com>
20
21patch originally from Li Zhou, I just rework it to new version
22
23Signed-off-by: Changqing Li <changqing.li@windriver.com>
Andrew Geissler82c905d2020-04-13 13:39:40 -050024
Brad Bishop19323692019-04-05 15:28:33 -040025---
26 configure.ac | 19 ++++++++++---------
27 1 file changed, 10 insertions(+), 9 deletions(-)
28
29diff --git a/configure.ac b/configure.ac
Andrew Geissler595f6302022-01-24 19:11:47 +000030index 0c06914..299786b 100644
Brad Bishop19323692019-04-05 15:28:33 -040031--- a/configure.ac
32+++ b/configure.ac
Andrew Geissler595f6302022-01-24 19:11:47 +000033@@ -61,6 +61,7 @@ AC_CONFIG_HEADER(pyconfig.h)
Brad Bishop19323692019-04-05 15:28:33 -040034 AC_CANONICAL_HOST
35 AC_SUBST(build)
36 AC_SUBST(host)
37+LT_INIT
38
39 # pybuilddir.txt will be created by --generate-posix-vars in the Makefile
40 rm -f pybuilddir.txt
Andrew Geissler595f6302022-01-24 19:11:47 +000041@@ -688,7 +689,7 @@ AC_MSG_RESULT($with_cxx_main)
Brad Bishop19323692019-04-05 15:28:33 -040042 preset_cxx="$CXX"
43 if test -z "$CXX"
44 then
45- case "$CC" in
46+ case "$cc_basename" in
47 gcc) AC_PATH_TOOL(CXX, [g++], [g++], [notfound]) ;;
48 cc) AC_PATH_TOOL(CXX, [c++], [c++], [notfound]) ;;
49 clang|*/clang) AC_PATH_TOOL(CXX, [clang++], [clang++], [notfound]) ;;
Andrew Geissler595f6302022-01-24 19:11:47 +000050@@ -976,7 +977,7 @@ rmdir CaseSensitiveTestDir
Brad Bishop19323692019-04-05 15:28:33 -040051
52 case $ac_sys_system in
53 hp*|HP*)
54- case $CC in
55+ case $cc_basename in
56 cc|*/cc) CC="$CC -Ae";;
57 esac;;
58 esac
Andrew Geissler595f6302022-01-24 19:11:47 +000059@@ -1374,7 +1375,7 @@ else
Brad Bishop19323692019-04-05 15:28:33 -040060 fi],
61 [AC_MSG_RESULT(no)])
62 if test "$Py_LTO" = 'true' ; then
63- case $CC in
64+ case $cc_basename in
65 *clang*)
66 AC_SUBST(LLVM_AR)
Brad Bishop1d80a2e2019-11-15 16:35:03 -050067 AC_PATH_TOOL(LLVM_AR, llvm-ar, '', ${llvm_path})
Andrew Geissler595f6302022-01-24 19:11:47 +000068@@ -1467,7 +1468,7 @@ then
Brad Bishop19323692019-04-05 15:28:33 -040069 fi
70 fi
71 LLVM_PROF_ERR=no
72-case $CC in
73+case $cc_basename in
74 *clang*)
75 # Any changes made here should be reflected in the GCC+Darwin case below
76 PGO_PROF_GEN_FLAG="-fprofile-instr-generate"
Andrew Geissler595f6302022-01-24 19:11:47 +000077@@ -1528,7 +1529,7 @@ esac
Andrew Geissler82c905d2020-04-13 13:39:40 -050078 # compiler and platform. BASECFLAGS tweaks need to be made even if the
79 # user set OPT.
Brad Bishop19323692019-04-05 15:28:33 -040080
Andrew Geissler82c905d2020-04-13 13:39:40 -050081-case $CC in
82+case $cc_basename in
83 *clang*)
84 cc_is_clang=1
85 ;;
Andrew Geissler595f6302022-01-24 19:11:47 +000086@@ -1664,7 +1665,7 @@ yes)
Brad Bishop19323692019-04-05 15:28:33 -040087
88 # ICC doesn't recognize the option, but only emits a warning
89 ## XXX does it emit an unused result warning and can it be disabled?
90- case "$CC" in
91+ case "$cc_basename" in
92 *icc*)
93 ac_cv_disable_unused_result_warning=no
94 ;;
Andrew Geissler595f6302022-01-24 19:11:47 +000095@@ -2018,7 +2019,7 @@ yes)
Andrew Geissler6ce62a22020-11-30 19:58:47 -060096 ;;
Brad Bishop19323692019-04-05 15:28:33 -040097 esac
98
Brad Bishop19323692019-04-05 15:28:33 -040099-case "$CC" in
100+case "$cc_basename" in
101 *icc*)
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600102 # ICC needs -fp-model strict or floats behave badly
Brad Bishop19323692019-04-05 15:28:33 -0400103 CFLAGS_NODIST="$CFLAGS_NODIST -fp-model strict"
Andrew Geissler595f6302022-01-24 19:11:47 +0000104@@ -2836,7 +2837,7 @@ then
Brad Bishop19323692019-04-05 15:28:33 -0400105 then
106 LINKFORSHARED="-Wl,--export-dynamic"
107 fi;;
108- SunOS/5*) case $CC in
109+ SunOS/5*) case $cc_basename in
110 *gcc*)
111 if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
112 then
Andrew Geissler595f6302022-01-24 19:11:47 +0000113@@ -5622,7 +5623,7 @@ if test "$have_gcc_asm_for_x87" = yes; then
Brad Bishop19323692019-04-05 15:28:33 -0400114 # Some versions of gcc miscompile inline asm:
115 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46491
116 # http://gcc.gnu.org/ml/gcc/2010-11/msg00366.html
117- case $CC in
118+ case $cc_basename in
119 *gcc*)
120 AC_MSG_CHECKING(for gcc ipa-pure-const bug)
121 saved_cflags="$CFLAGS"