[Snort-devel] --disable-debug enables debug

Bob Perkins rnpnj at ...398...
Mon Jun 24 14:36:03 EDT 2002


After running ./configure with the --disable-debug command line argument,
make compiles programs with "-DDEBUG -ggdb" arguments.  Similar results
happen when other '--disable-<option>' or 'enable-<option>=no' arguments
are used - the options are enabled.

This is a result of the way configure.in is set up and the configure file
generated by autoconf.

In configure.in, the parameters for debug are:
================================
AC_ARG_ENABLE(debug,
[  --enable-debug       enable debugging options (bugreports and developers only)],
                [ if test -n "$GCC"; then
                    CFLAGS="$CFLAGS -DDEBUG -ggdb"
                  else
                    CLFLAGS="$CFLAGS -DDEBUG"
                  fi
                ],)
================================

This generates the following lines in configure:
================================
# Check whether --enable-debug or --disable-debug was given.
if test "${enable_debug+set}" = set; then
  enableval="$enable_debug"
   if test -n "$GCC"; then
                    CFLAGS="$CFLAGS -DDEBUG -ggdb"
                  else
                    CLFLAGS="$CFLAGS -DDEBUG"
                  fi

fi
================================
The problem comes from the fact that ${enable_debug+set} is
equal to "set" whenever any form of enable-debug or disable-debug
is used as an argument.  Adding a line to configure.in to check the
actual value of $enable-debug solves the problem:

=================================
AC_ARG_ENABLE(debug,
[  --enable-debug       enable debugging options (bugreports and developers only)],
                [ if test "$enable_debug" = "yes"; then
                    if test -n "$GCC"; then
                      CFLAGS="$CFLAGS -DDEBUG -ggdb"
                    else
                      CLFLAGS="$CFLAGS -DDEBUG"
                    fi
                  fi
                ],)
=================================
generates the following lines in configure:
=================================
# Check whether --enable-debug or --disable-debug was given.
if test "${enable_debug+set}" = set; then
  enableval="$enable_debug"
   if test "$enable_debug" = "yes"; then
                    if test -n "$GCC"; then
                      CFLAGS="$CFLAGS -DDEBUG -ggdb"
                    else
                      CLFLAGS="$CFLAGS -DDEBUG"
                    fi
                  fi

fi;
=================================The result is that the debug options are set in CFLAGS only when
'enable-debug' or 'enable-debug=yes' are used.

It looks like similar changes need to be made for the other enable/disable
options:  idmef, smbalerts and flexresp.
BTW, is "CLFLAGS" correct in the 'CLFLAGS="$CFLAGS -DDEBUG"' lines above,
or should it be "CFLAGS"?
Bob

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com




More information about the Snort-devel mailing list