From: Ripduman Sohan <[email protected]> Changed default configuration behaviour so user has to explicitly ask for a debug build (--enable-debug configure parameter).
Signed-off-by: Ripduman Sohan <[email protected]> --- configure.ac | 13 +++++++++++++ programs/testapp.c | 7 ++++++- 2 files changed, 19 insertions(+), 1 deletions(-) diff --git a/configure.ac b/configure.ac index 50e02c0..4dca521 100644 --- a/configure.ac +++ b/configure.ac @@ -508,6 +508,19 @@ AC_ARG_ENABLE([breakdancer], AM_CONDITIONAL(ENABLE_BREAKDANCE, test "x$ac_cv_enable_breakdancer" = "xyes" -a "x$PYTHON" != "xno") +dnl add an option to enable debug builds +AC_MSG_CHECKING([for debug build parameter]) +AC_ARG_ENABLE([debug], + [AS_HELP_STRING([--enable-debug], + [Include debug assertions and information])]) +if test x"$enable_debug" = x"" +then + CFLAGS="$CFLAGS -DNDEBUG" + AC_MSG_RESULT([no]) +else + AC_MSG_RESULT([yes]) +fi + dnl Generate output files CPPFLAGS="-I\${top_srcdir}/include ${CPPFLAGS}" AC_CONFIG_FILES(Makefile config/Doxyfile config/Doxyfile-api) diff --git a/programs/testapp.c b/programs/testapp.c index d49c8a7..04d1e0c 100644 --- a/programs/testapp.c +++ b/programs/testapp.c @@ -1,5 +1,10 @@ /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ #include "config.h" +/* Necessary for conditionally excluding tests that rely on external variables + * only declared in debug mode */ +#ifdef NDEBUG +#define NONDEBUG_BUILD +#endif #undef NDEBUG #include <pthread.h> #include <sys/types.h> @@ -158,7 +163,7 @@ static enum test_return test_issue_161(void) static enum test_return cache_redzone_test(void) { -#ifndef HAVE_UMEM_H +#if !(defined(HAVE_UMEM_H) || defined(NONDEBUG_BUILD)) cache_t *cache = cache_create("test", sizeof(uint32_t), sizeof(char*), NULL, NULL); -- 1.7.1
