@@ -323,6 +323,15 @@ AC_ARG_ENABLE([external-signer],
323323
324324AC_LANG_PUSH ( [ C++] )
325325
326+ dnl Always set -g -O2 in our CXXFLAGS. Autoconf will try and set CXXFLAGS to "-g -O2" by default,
327+ dnl so we suppress that (if CXXFLAGS hasn't been overridden by the user), given we are adding it
328+ dnl ourselves.
329+ CORE_CXXFLAGS="$CORE_CXXFLAGS -g -O2"
330+
331+ if test "$CXXFLAGS_overridden" = "no"; then
332+ CXXFLAGS=""
333+ fi
334+
326335dnl Check for a flag to turn compiler warnings into errors. This is helpful for checks which may
327336dnl appear to succeed because by default they merely emit warnings when they fail.
328337dnl
@@ -347,12 +356,6 @@ case $host in
347356esac
348357
349358if test "$enable_debug" = "yes"; then
350- dnl If debugging is enabled, and the user hasn't overridden CXXFLAGS, clear
351- dnl them, to prevent autoconfs "-g -O2" being added. Otherwise we'd end up
352- dnl with "-O0 -g3 -g -O2".
353- if test "$CXXFLAGS_overridden" = "no"; then
354- CXXFLAGS=""
355- fi
356359
357360 dnl Disable all optimizations
358361 AX_CHECK_COMPILE_FLAG ( [ -O0] , [ DEBUG_CXXFLAGS="$DEBUG_CXXFLAGS -O0"] , [ ] , [ $CXXFLAG_WERROR] )
@@ -859,12 +862,6 @@ if test "$use_lcov" = "yes"; then
859862 [ AC_MSG_ERROR ( [ lcov testing requested but --coverage linker flag does not work] ) ] )
860863 AX_CHECK_COMPILE_FLAG ( [ --coverage] ,[ CORE_CXXFLAGS="$CORE_CXXFLAGS --coverage"] ,
861864 [ AC_MSG_ERROR ( [ lcov testing requested but --coverage flag does not work] ) ] )
862- dnl If coverage is enabled, and the user hasn't overridden CXXFLAGS, clear
863- dnl them, to prevent autoconfs "-g -O2" being added. Otherwise we'd end up
864- dnl with "--coverage -Og -O0 -g -O2".
865- if test "$CXXFLAGS_overridden" = "no"; then
866- CXXFLAGS=""
867- fi
868865 CORE_CXXFLAGS="$CORE_CXXFLAGS -Og -O0"
869866fi
870867
@@ -1996,7 +1993,7 @@ echo " CC = $CC"
19961993echo " CFLAGS = $PTHREAD_CFLAGS $CFLAGS"
19971994echo " CPPFLAGS = $DEBUG_CPPFLAGS $HARDENED_CPPFLAGS $CORE_CPPFLAGS $CPPFLAGS"
19981995echo " CXX = $CXX"
1999- echo " CXXFLAGS = $DEBUG_CXXFLAGS $HARDENED_CXXFLAGS $WARN_CXXFLAGS $NOWARN_CXXFLAGS $ERROR_CXXFLAGS $GPROF_CXXFLAGS $CORE_CXXFLAGS $CXXFLAGS"
1996+ echo " CXXFLAGS = $CORE_CXXFLAGS $ DEBUG_CXXFLAGS $HARDENED_CXXFLAGS $WARN_CXXFLAGS $NOWARN_CXXFLAGS $ERROR_CXXFLAGS $GPROF_CXXFLAGS $CXXFLAGS"
20001997echo " LDFLAGS = $PTHREAD_LIBS $HARDENED_LDFLAGS $GPROF_LDFLAGS $CORE_LDFLAGS $LDFLAGS"
20011998echo " AR = $AR"
20021999echo " ARFLAGS = $ARFLAGS"
0 commit comments