From: Malte S. Stretz Date: Fri, 3 Sep 2010 14:15:59 +0000 (+0200) Subject: Add --disable-debug to switch on NDEBUG and -g0. X-Git-Tag: 3.0.714~65 X-Git-Url: https://unix4lyfe.org/gitweb/darkstat/commitdiff_plain/db8ddd7f6ca3a8bcb5fc8170a1b05427dc5e83c9 Add --disable-debug to switch on NDEBUG and -g0. --- diff --git a/Makefile.in b/Makefile.in index fb16631..b871342 100644 --- a/Makefile.in +++ b/Makefile.in @@ -22,7 +22,7 @@ datarootdir = @datarootdir@ mandir = @mandir@ # Optimizations FIXME: dead code. push into autoconf? -#CPPFLAGS += -D__OPTIMIZE__ -DNDEBUG +#CPPFLAGS += -D__OPTIMIZE__ SRCS = \ acct.c \ diff --git a/configure.ac b/configure.ac index ebe3107..805570c 100644 --- a/configure.ac +++ b/configure.ac @@ -40,6 +40,21 @@ AC_DEFINE_UNQUOTED(PRIVDROP_USER, "$_pdu", [User to privdrop to.]) AC_PROG_INSTALL AC_PROG_CC +# Let user disable debugging symbols so we create smaller binaries. +AC_MSG_CHECKING(if we want debug code) +AC_ARG_ENABLE(debug, AS_HELP_STRING([--disable-debug], + [turn off debugging code and asserts]), + [if test "x$enableval" = "xno" ; then + CFLAGS="$CFLAGS -DNDEBUG -g0" + AC_MSG_RESULT(nope) + elif test "x$enableval" = "xyes" ; then + AC_MSG_RESULT(sure) + else + CFLAGS="$CFLAGS -g$enableval" + AC_MSG_RESULT(sure ($enableval)) + fi], + [AC_MSG_RESULT(sure)]) + # Augment CFLAGS for fun. echo "int main(void){return 1;}" > conftest.$ac_ext