У меня в configure.ac есть следующий блок:
dnl #######################################################################
dnl # Debugging support
dnl #######################################################################
AC_ARG_ENABLE(debug, [AC_HELP_STRING([--enable-debug],
[compile with debugging support])], , enable_debug=no)
if test "x$enable_debug" = "xyes" ; then
AC_DEFINE(DEBUG, 1, [Define if debugging is enabled.])
fi
if test "x$enable_debug" = "xyes"; then
CFLAGS="$CFLAGS -g"
fi