gh-108465: Use compiler basename when determining compiler flags (#108392)

Note:
GNU Autoconf discourages the use of 'basename', and recommends 'expr' instead.

Co-authored-by: Erlend E. Aasland <erlend@python.org>
This commit is contained in:
John Micco 2023-08-27 14:07:09 -07:00 committed by GitHub
parent 38afa4af9b
commit fecb9faf0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 6 deletions

9
configure generated vendored
View File

@ -8562,7 +8562,10 @@ printf "%s\n" "$as_me: llvm-profdata found via xcrun: ${LLVM_PROFDATA}" >&6;}
fi fi
fi fi
LLVM_PROF_ERR=no LLVM_PROF_ERR=no
case $CC in
# GNU Autoconf recommends the use of expr instead of basename.
CC_BASENAME=$(expr "//$CC" : '.*/\(.*\)')
case "$CC_BASENAME" in
*clang*) *clang*)
# Any changes made here should be reflected in the GCC+Darwin case below # Any changes made here should be reflected in the GCC+Darwin case below
PGO_PROF_GEN_FLAG="-fprofile-instr-generate" PGO_PROF_GEN_FLAG="-fprofile-instr-generate"
@ -9391,7 +9394,7 @@ fi
# ICC doesn't recognize the option, but only emits a warning # ICC doesn't recognize the option, but only emits a warning
## XXX does it emit an unused result warning and can it be disabled? ## XXX does it emit an unused result warning and can it be disabled?
case $CC in #( case "$CC_BASENAME" in #(
*icc*) : *icc*) :
ac_cv_disable_unused_result_warning=no ac_cv_disable_unused_result_warning=no
@ -9972,7 +9975,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \
;; ;;
esac esac
case "$CC" in case "$CC_BASENAME" in
*mpicc*) *mpicc*)
CFLAGS_NODIST="$CFLAGS_NODIST" CFLAGS_NODIST="$CFLAGS_NODIST"
;; ;;

View File

@ -1794,7 +1794,10 @@ then
fi fi
fi fi
LLVM_PROF_ERR=no LLVM_PROF_ERR=no
case $CC in
# GNU Autoconf recommends the use of expr instead of basename.
AS_VAR_SET([CC_BASENAME], [$(expr "//$CC" : '.*/\(.*\)')])
case "$CC_BASENAME" in
*clang*) *clang*)
# Any changes made here should be reflected in the GCC+Darwin case below # Any changes made here should be reflected in the GCC+Darwin case below
PGO_PROF_GEN_FLAG="-fprofile-instr-generate" PGO_PROF_GEN_FLAG="-fprofile-instr-generate"
@ -2225,7 +2228,7 @@ yes)
# ICC doesn't recognize the option, but only emits a warning # ICC doesn't recognize the option, but only emits a warning
## XXX does it emit an unused result warning and can it be disabled? ## XXX does it emit an unused result warning and can it be disabled?
AS_CASE([$CC], AS_CASE(["$CC_BASENAME"],
[*icc*], [ac_cv_disable_unused_result_warning=no] [*icc*], [ac_cv_disable_unused_result_warning=no]
[PY_CHECK_CC_WARNING([disable], [unused-result])]) [PY_CHECK_CC_WARNING([disable], [unused-result])])
AS_VAR_IF([ac_cv_disable_unused_result_warning], [yes], AS_VAR_IF([ac_cv_disable_unused_result_warning], [yes],
@ -2471,7 +2474,7 @@ yes)
;; ;;
esac esac
case "$CC" in case "$CC_BASENAME" in
*mpicc*) *mpicc*)
CFLAGS_NODIST="$CFLAGS_NODIST" CFLAGS_NODIST="$CFLAGS_NODIST"
;; ;;