Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fix the test checking if the C compiler supports ``-Og`` option in the
``./configure`` script to also use ``-Og`` on clang which supports it. Patch
by Victor Stinner.
52 changes: 45 additions & 7 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 23 additions & 7 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1791,6 +1791,28 @@ case $CC in
fi
esac

# Check if CC supports -Og optimization level
_SAVE_VAR([CFLAGS])
CFLAGS="-Og"
AC_CACHE_CHECK([if $CC supports -Og optimization level],
[ac_cv_cc_supports_og],
AC_COMPILE_IFELSE(
[
AC_LANG_PROGRAM([[]], [[]])
],[
ac_cv_cc_supports_og=yes
],[
ac_cv_cc_supports_og=no
])
)
_RESTORE_VAR([CFLAGS])

# Optimization messes up debuggers, so turn it off for
# debug builds.
PYDEBUG_CFLAGS="-O0"
AS_VAR_IF([ac_cv_cc_supports_og], [yes],
[PYDEBUG_CFLAGS="-Og"])

# tweak OPT based on compiler and platform, only if the user didn't set
# it on the command line
AC_SUBST(OPT)
Expand All @@ -1816,13 +1838,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
Expand Down