Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
--- /dev/null
+``./configure`` now warns when ``--enable-optimizations`` and ``CFLAGS=-O0`` are both set, suggesting removing ``-O0`` from ``CFLAGS`` for optimal performance. Patch by Taegyun Kim.
if test "$Py_OPT" = 'true' ; then
+ # Check for conflicting CFLAGS=-O0 and --enable-optimizations
+ case "$CFLAGS" in
+ *-O0*)
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: CFLAGS contains -O0 which may conflict with --enable-optimizations. Consider removing -O0 from CFLAGS for optimal performance." >&5
+printf "%s\n" "$as_me: WARNING: CFLAGS contains -O0 which may conflict with --enable-optimizations. Consider removing -O0 from CFLAGS for optimal performance." >&2;}
+ ;;
+ esac
# Intentionally not forcing Py_LTO='true' here. Too many toolchains do not
# compile working code using it and both test_distutils and test_gdb are
# broken when you do manage to get a toolchain that works with it. People
[AC_MSG_RESULT([no])])
if test "$Py_OPT" = 'true' ; then
+ # Check for conflicting CFLAGS=-O0 and --enable-optimizations
+ case "$CFLAGS" in
+ *-O0*)
+ AC_MSG_WARN([m4_normalize([
+ CFLAGS contains -O0 which may conflict with --enable-optimizations.
+ Consider removing -O0 from CFLAGS for optimal performance.])])
+ ;;
+ esac
# Intentionally not forcing Py_LTO='true' here. Too many toolchains do not
# compile working code using it and both test_distutils and test_gdb are
# broken when you do manage to get a toolchain that works with it. People