diff options
author | Victor Stinner <vstinner@python.org> | 2022-02-01 13:47:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-01 13:47:12 (GMT) |
commit | 0515eafe55ce7699e3bbc3c1555f08073d43b790 (patch) | |
tree | b649b51226c6403f8436e7dab3fd521c83f9b455 /configure | |
parent | b9ebde8db7e176e021103745cd012bae700828b5 (diff) | |
download | cpython-0515eafe55ce7699e3bbc3c1555f08073d43b790.zip cpython-0515eafe55ce7699e3bbc3c1555f08073d43b790.tar.gz cpython-0515eafe55ce7699e3bbc3c1555f08073d43b790.tar.bz2 |
bpo-46600: ./configure --with-pydebug uses -Og with clang (GH-31052)
Fix the test checking if the C compiler supports -Og option in the
./configure script to also use -Og on clang which supports it.
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 52 |
1 files changed, 45 insertions, 7 deletions
@@ -7623,6 +7623,50 @@ case $CC in fi esac +# Check if CC supports -Og optimization level +save_CFLAGS=$CFLAGS +CFLAGS="-Og" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Og optimization level" >&5 +$as_echo_n "checking if $CC supports -Og optimization level... " >&6; } +if ${ac_cv_cc_supports_og+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_cc_supports_og=yes + +else + + ac_cv_cc_supports_og=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cc_supports_og" >&5 +$as_echo "$ac_cv_cc_supports_og" >&6; } +CFLAGS=$save_CFLAGS + +# Optimization messes up debuggers, so turn it off for +# debug builds. +PYDEBUG_CFLAGS="-O0" +if test "x$ac_cv_cc_supports_og" = xyes; then : + PYDEBUG_CFLAGS="-Og" +fi + # tweak OPT based on compiler and platform, only if the user didn't set # it on the command line @@ -7648,13 +7692,7 @@ then case $ac_cv_prog_cc_g in yes) if test "$Py_DEBUG" = 'true' ; then - # Optimization messes up debuggers, so turn it off for - # debug builds. - if "$CC" -v --help 2>/dev/null |grep -- -Og > /dev/null; then - OPT="-g -Og -Wall" - else - OPT="-g -O0 -Wall" - fi + OPT="-g $PYDEBUG_CFLAGS -Wall" else OPT="-g $WRAP -O3 -Wall" fi |