From d72006f5b83a1a8a76fca4a381327b0d52be14c0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 20 Sep 2015 02:23:06 +0200 Subject: [PATCH] Don't force the use of DEBUG on application in autoconf macros If WX_STANDARD_OPTIONS() is not used, we shouldn't add any debugging nor optimization options to C{,XX}FLAGS as the application presumably handles it on its own, it was completely unexpected to see -O2 appear in CXXFLAGS. Fix this by only doing anything if DEBUG variable is defined. Even this is not optimal as it's such a common name that it could clash with an unrelated variable in the application configure script, but doing anything else risks breaking existing scripts relying on it being named like this. --- wxwin.m4 | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/wxwin.m4 b/wxwin.m4 index 3e483c6e10..fd131a1972 100644 --- a/wxwin.m4 +++ b/wxwin.m4 @@ -928,11 +928,8 @@ AC_DEFUN([WX_DETECT_STANDARD_OPTION_VALUES], ]) fi - dnl now we can finally update the DEBUG,UNICODE,SHARED options - dnl to their final values if they were not already set - if test -z "$DEBUG" ; then - DEBUG=$WX_DEBUG - fi + dnl now we can finally update the options to their final values if they + dnl were not already set if test -z "$UNICODE" ; then UNICODE=$WX_UNICODE fi @@ -943,20 +940,17 @@ AC_DEFUN([WX_DETECT_STANDARD_OPTION_VALUES], TOOLKIT=$WX_PORT fi - dnl in case the user needs a BUILD=debug/release var... - if test "$DEBUG" = "1"; then - BUILD="debug" - elif test "$DEBUG" = "0" -o "$DEBUG" = ""; then - BUILD="release" - fi - - dnl respect the DEBUG variable adding the optimize/debug flags + dnl respect the DEBUG variable adding the optimize/debug flags and also + dnl define a BUILD variable in case the user wants to use it + dnl dnl NOTE: the CXXFLAGS are merged together with the CPPFLAGS so we dnl don't need to set them, too if test "$DEBUG" = "1"; then + BUILD="debug" CXXFLAGS="$CXXFLAGS -g -O0" CFLAGS="$CFLAGS -g -O0" - else + elif test "$DEBUG" = "0"; then + BUILD="release" CXXFLAGS="$CXXFLAGS -O2" CFLAGS="$CFLAGS -O2" fi