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.
This commit is contained in:
Vadim Zeitlin
2015-09-20 02:23:06 +02:00
parent 9589eaa113
commit d72006f5b8

View File

@@ -928,11 +928,8 @@ AC_DEFUN([WX_DETECT_STANDARD_OPTION_VALUES],
]) ])
fi fi
dnl now we can finally update the DEBUG,UNICODE,SHARED options dnl now we can finally update the options to their final values if they
dnl to their final values if they were not already set dnl were not already set
if test -z "$DEBUG" ; then
DEBUG=$WX_DEBUG
fi
if test -z "$UNICODE" ; then if test -z "$UNICODE" ; then
UNICODE=$WX_UNICODE UNICODE=$WX_UNICODE
fi fi
@@ -943,20 +940,17 @@ AC_DEFUN([WX_DETECT_STANDARD_OPTION_VALUES],
TOOLKIT=$WX_PORT TOOLKIT=$WX_PORT
fi fi
dnl in case the user needs a BUILD=debug/release var... dnl respect the DEBUG variable adding the optimize/debug flags and also
if test "$DEBUG" = "1"; then dnl define a BUILD variable in case the user wants to use it
BUILD="debug" dnl
elif test "$DEBUG" = "0" -o "$DEBUG" = ""; then
BUILD="release"
fi
dnl respect the DEBUG variable adding the optimize/debug flags
dnl NOTE: the CXXFLAGS are merged together with the CPPFLAGS so we dnl NOTE: the CXXFLAGS are merged together with the CPPFLAGS so we
dnl don't need to set them, too dnl don't need to set them, too
if test "$DEBUG" = "1"; then if test "$DEBUG" = "1"; then
BUILD="debug"
CXXFLAGS="$CXXFLAGS -g -O0" CXXFLAGS="$CXXFLAGS -g -O0"
CFLAGS="$CFLAGS -g -O0" CFLAGS="$CFLAGS -g -O0"
else elif test "$DEBUG" = "0"; then
BUILD="release"
CXXFLAGS="$CXXFLAGS -O2" CXXFLAGS="$CXXFLAGS -O2"
CFLAGS="$CFLAGS -O2" CFLAGS="$CFLAGS -O2"
fi fi