blob: a0ea897f4e848908ec0ec161e154b4cc632d7cbd [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001From 2645317fef09afe31b01bb2c1d4fe5b9afdbb11a Mon Sep 17 00:00:00 2001
2From: 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
17Upstream-Status: Pending
18
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>
24---
25 configure.ac | 19 ++++++++++---------
26 1 file changed, 10 insertions(+), 9 deletions(-)
27
28diff --git a/configure.ac b/configure.ac
29index a7de901..4a3681f 100644
30--- a/configure.ac
31+++ b/configure.ac
32@@ -54,6 +54,7 @@ AC_CONFIG_HEADER(pyconfig.h)
33 AC_CANONICAL_HOST
34 AC_SUBST(build)
35 AC_SUBST(host)
36+LT_INIT
37
38 # pybuilddir.txt will be created by --generate-posix-vars in the Makefile
39 rm -f pybuilddir.txt
40@@ -695,7 +696,7 @@ AC_MSG_RESULT($with_cxx_main)
41 preset_cxx="$CXX"
42 if test -z "$CXX"
43 then
44- case "$CC" in
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@@ -979,7 +980,7 @@ rmdir CaseSensitiveTestDir
50
51 case $ac_sys_system in
52 hp*|HP*)
53- case $CC in
54+ case $cc_basename in
55 cc|*/cc) CC="$CC -Ae";;
56 esac;;
57 esac
58@@ -1336,7 +1337,7 @@ else
59 fi],
60 [AC_MSG_RESULT(no)])
61 if test "$Py_LTO" = 'true' ; then
62- case $CC in
63+ case $cc_basename in
64 *clang*)
65 AC_SUBST(LLVM_AR)
Brad Bishop1d80a2e2019-11-15 16:35:03 -050066 AC_PATH_TOOL(LLVM_AR, llvm-ar, '', ${llvm_path})
Brad Bishop19323692019-04-05 15:28:33 -040067@@ -1426,7 +1427,7 @@ then
68 fi
69 fi
70 LLVM_PROF_ERR=no
71-case $CC in
72+case $cc_basename in
73 *clang*)
74 # Any changes made here should be reflected in the GCC+Darwin case below
75 PGO_PROF_GEN_FLAG="-fprofile-instr-generate"
76@@ -1500,7 +1501,7 @@ then
77 WRAP="-fwrapv"
78 fi
79
80- case $CC in
81+ case $cc_basename in
82 *clang*)
83 cc_is_clang=1
84 ;;
85@@ -1623,7 +1624,7 @@ yes)
86
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?
89- case "$CC" in
90+ case "$cc_basename" in
91 *icc*)
92 ac_cv_disable_unused_result_warning=no
93 ;;
94@@ -1965,7 +1966,7 @@ yes)
95 esac
96
97 # ICC needs -fp-model strict or floats behave badly
98-case "$CC" in
99+case "$cc_basename" in
100 *icc*)
101 CFLAGS_NODIST="$CFLAGS_NODIST -fp-model strict"
102 ;;
103@@ -2727,7 +2728,7 @@ then
104 then
105 LINKFORSHARED="-Wl,--export-dynamic"
106 fi;;
107- SunOS/5*) case $CC in
108+ SunOS/5*) case $cc_basename in
109 *gcc*)
110 if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
111 then
112@@ -5429,7 +5430,7 @@ if test "$have_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
116- case $CC in
117+ case $cc_basename in
118 *gcc*)
119 AC_MSG_CHECKING(for gcc ipa-pure-const bug)
120 saved_cflags="$CFLAGS"