0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. From 82576cdb9d6d9736ba122592974b0e7727216a3f 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
  5. When working path contains "clang"/"gcc"/"icc", it might be part of $CC
  6. because of the "--sysroot" parameter. That could cause judgement error
  7. about clang/gcc/icc compilers. e.g.
  8. When "icc" is containded in working path, below errors are reported when
  9. compiling python3:
  10. x86_64-wrs-linux-gcc: error: strict: No such file or directory
  11. x86_64-wrs-linux-gcc: error: unrecognized command line option '-fp-model'
  12. Here use cc_basename to replace CC for checking compiler to avoid such
  13. kind of issue.
  14. Upstream-Status: Submitted [https://github.com/python/cpython/pull/96399]
  15. Signed-off-by: Li Zhou <li.zhou@windriver.com>
  16. patch originally from Li Zhou, I just rework it to new version
  17. Signed-off-by: Changqing Li <changqing.li@windriver.com>
  18. ---
  19. configure.ac | 19 ++++++++++---------
  20. 1 file changed, 10 insertions(+), 9 deletions(-)
  21. diff --git a/configure.ac b/configure.ac
  22. index 9270b5f..955daad 100644
  23. --- a/configure.ac
  24. +++ b/configure.ac
  25. @@ -137,6 +137,7 @@ AC_CONFIG_HEADERS([pyconfig.h])
  26. AC_CANONICAL_HOST
  27. AC_SUBST([build])
  28. AC_SUBST([host])
  29. +LT_INIT
  30. AS_VAR_IF([cross_compiling], [maybe],
  31. [AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])]
  32. @@ -896,7 +897,7 @@ AC_SUBST([CXX])
  33. preset_cxx="$CXX"
  34. if test -z "$CXX"
  35. then
  36. - case "$CC" in
  37. + case "$cc_basename" in
  38. gcc) AC_PATH_TOOL([CXX], [g++], [g++], [notfound]) ;;
  39. cc) AC_PATH_TOOL([CXX], [c++], [c++], [notfound]) ;;
  40. clang|*/clang) AC_PATH_TOOL([CXX], [clang++], [clang++], [notfound]) ;;
  41. @@ -1331,7 +1332,7 @@ rmdir CaseSensitiveTestDir
  42. case $ac_sys_system in
  43. hp*|HP*)
  44. - case $CC in
  45. + case $cc_basename in
  46. cc|*/cc) CC="$CC -Ae";;
  47. esac;;
  48. esac
  49. @@ -1857,7 +1858,7 @@ esac
  50. ],
  51. [AC_MSG_RESULT([no])])
  52. if test "$Py_LTO" = 'true' ; then
  53. - case $CC in
  54. + case $cc_basename in
  55. *clang*)
  56. LDFLAGS_NOLTO="-fno-lto"
  57. dnl Clang linker requires -flto in order to link objects with LTO information.
  58. @@ -1986,7 +1987,7 @@ then
  59. fi
  60. fi
  61. LLVM_PROF_ERR=no
  62. -case $CC in
  63. +case $cc_basename in
  64. *clang*)
  65. # Any changes made here should be reflected in the GCC+Darwin case below
  66. PGO_PROF_GEN_FLAG="-fprofile-instr-generate"
  67. @@ -2179,7 +2180,7 @@ AC_MSG_RESULT([$BOLT_APPLY_FLAGS])
  68. # compiler and platform. BASECFLAGS tweaks need to be made even if the
  69. # user set OPT.
  70. -case $CC in
  71. +case $cc_basename in
  72. *clang*)
  73. cc_is_clang=1
  74. ;;
  75. @@ -2451,7 +2452,7 @@ yes)
  76. # ICC doesn't recognize the option, but only emits a warning
  77. ## XXX does it emit an unused result warning and can it be disabled?
  78. - AS_CASE([$CC],
  79. + AS_CASE([$cc_basename],
  80. [*icc*], [ac_cv_disable_unused_result_warning=no]
  81. [PY_CHECK_CC_WARNING([disable], [unused-result])])
  82. AS_VAR_IF([ac_cv_disable_unused_result_warning], [yes],
  83. @@ -2697,7 +2698,7 @@ yes)
  84. ;;
  85. esac
  86. -case "$CC" in
  87. +case "$cc_basename" in
  88. *mpicc*)
  89. CFLAGS_NODIST="$CFLAGS_NODIST"
  90. ;;
  91. @@ -3532,7 +3533,7 @@ then
  92. then
  93. LINKFORSHARED="-Wl,--export-dynamic"
  94. fi;;
  95. - SunOS/5*) case $CC in
  96. + SunOS/5*) case $cc_basename in
  97. *gcc*)
  98. if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
  99. then
  100. @@ -6853,7 +6854,7 @@ if test "$ac_cv_gcc_asm_for_x87" = yes; then
  101. # Some versions of gcc miscompile inline asm:
  102. # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46491
  103. # http://gcc.gnu.org/ml/gcc/2010-11/msg00366.html
  104. - case $CC in
  105. + case $cc_basename in
  106. *gcc*)
  107. AC_MSG_CHECKING([for gcc ipa-pure-const bug])
  108. saved_cflags="$CFLAGS"