Peter Johansson wrote:
I use the following snippet in one my projects:
AC_ARG_ENABLE(debug,
[AS_HELP_STRING([--enable-debug],[turn on debug options and code])],
[SD_CXXFLAGS="$SD_CXXFLAGS -g -O"],
[SD_CPPFLAGS="-DNDEBUG" SD_CXXFLAGS="$SD_CXXFLAGS -O3"])
FWIW, as a user I find this setup slightly confusing
(--enable should enable a feature, so perhaps --with-debug
is more appropriate) so I switched awhile back to
doing AC_AR_VAR and allowing DEBUG=foo to set
-DDEBUG=foo (defaults to 1). It gives slightly
more flexibility to do DEBUG=3 or DEBUG=6 and
have leveled debugs in the code.
--
William Pursell