]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- in no debug sets NDEBUG to remove asserts.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 14 Jan 2008 09:51:20 +0000 (09:51 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 14 Jan 2008 09:51:20 +0000 (09:51 +0000)
       - configure --enable-debug is needed for dependency generation
         for assertions and for compiler warnings.
       - ldns.tgz updated with ldns-trunk (where buffer.h is updated).

git-svn-id: file:///svn/unbound/trunk@845 be551aaa-1e26-0410-a405-d3ace91eadb9

Makefile.in
config.h.in
configure
configure.ac
doc/Changelog
ldns-src.tar.gz
util/log.h

index fedf9faa654cc3b49ccc0da79ddea37bfbe51ace..a5db3dcec3b2739ed4bd36e23aef688e0336c19f 100644 (file)
@@ -1,9 +1,13 @@
 # Copyright 2007 NLnet Labs
 # See the file LICENSE for the license
-# 
-# Standard installation pathnames
 
-QUIET=yes
+debug_enabled=@debug_enabled@
+ifeq ($(debug_enabled),yes)
+  QUIET=yes
+else
+  QUIET=no
+endif
+
 ifeq "$(QUIET)" "yes"
   Q=@
   INFO=@echo
@@ -262,6 +266,8 @@ $(BUILD)%.d: $(srcdir)/%.c
 
 ifneq ($(MAKECMDGOALS),clean)
 ifneq ($(MAKECMDGOALS),realclean)
+ifeq ($(debug_enabled),yes)
 -include $(addprefix $(BUILD),$(ALL_SRC:.c=.d))
 endif
 endif
+endif
index 8d92639d58e1022ac99e75ac9be4316633c87f24..8739093c2f3ca6d8f6e573879b2809be3ea2f037 100644 (file)
 /* use statistics for allocs and frees, for debug use */
 #undef UNBOUND_ALLOC_STATS
 
+/* define this to enable debug checks. */
+#undef UNBOUND_DEBUG
+
 /* Define if you want to use internal select based events */
 #undef USE_MINI_EVENT
 
 #undef vfork
 
 
+#ifndef UNBOUND_DEBUG
+#  define NDEBUG
+#endif
+
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
index 3e3ff5b76aa0cee10f41fcbda0fa639a3994ce76..45b97120b39595a351e61498a327dafc775b6446 100755 (executable)
--- a/configure
+++ b/configure
@@ -812,6 +812,7 @@ CPP
 GREP
 EGREP
 ub_conf_file
+debug_enabled
 libtool
 AR
 doxygen
@@ -1430,6 +1431,8 @@ if test -n "$ac_init_help"; then
 Optional Features:
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-debug          Enable debug warnings, asserts,
+                          makefile-dependencies
   --enable-shared[=PKGS]  build shared libraries [default=yes]
   --enable-static[=PKGS]  build static libraries [default=yes]
   --enable-fast-install[=PKGS]
@@ -4179,6 +4182,15 @@ echo "${ECHO_T}no" >&6; }
 fi
 
 # flag warnings.
+# Check whether --enable-debug was given.
+if test "${enable_debug+set}" = set; then
+  enableval=$enable_debug;
+fi
+
+debug_enabled="$enable_debug"
+
+case "$enable_debug" in
+        yes)
 
 
 { echo "$as_me:$LINENO: checking whether $CC supports -W" >&5
@@ -4304,6 +4316,16 @@ echo "${ECHO_T}no" >&6; }
 fi
 
 
+cat >>confdefs.h <<\_ACEOF
+#define UNBOUND_DEBUG
+_ACEOF
+
+               ;;
+       no|*)
+               # nothing to do.
+               ;;
+esac
+
 { echo "$as_me:$LINENO: checking for inline" >&5
 echo $ECHO_N "checking for inline... $ECHO_C" >&6; }
 if test "${ac_cv_c_inline+set}" = set; then
@@ -5628,7 +5650,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 5631 "configure"' > conftest.$ac_ext
+  echo '#line 5653 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -6930,11 +6952,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:6933: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:6955: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:6937: \$? = $ac_status" >&5
+   echo "$as_me:6959: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -7198,11 +7220,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7201: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7223: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7205: \$? = $ac_status" >&5
+   echo "$as_me:7227: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -7302,11 +7324,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7305: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7327: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:7309: \$? = $ac_status" >&5
+   echo "$as_me:7331: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -8767,7 +8789,7 @@ linux*)
   libsuff=
   case "$host_cpu" in
   x86_64*|s390x*|powerpc64*)
-    echo '#line 8770 "configure"' > conftest.$ac_ext
+    echo '#line 8792 "configure"' > conftest.$ac_ext
     if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -9631,7 +9653,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 9634 "configure"
+#line 9656 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -9731,7 +9753,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 9734 "configure"
+#line 9756 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12067,11 +12089,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:12070: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:12092: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:12074: \$? = $ac_status" >&5
+   echo "$as_me:12096: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -12171,11 +12193,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:12174: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:12196: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:12178: \$? = $ac_status" >&5
+   echo "$as_me:12200: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -12707,7 +12729,7 @@ linux*)
   libsuff=
   case "$host_cpu" in
   x86_64*|s390x*|powerpc64*)
-    echo '#line 12710 "configure"' > conftest.$ac_ext
+    echo '#line 12732 "configure"' > conftest.$ac_ext
     if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -13762,11 +13784,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:13765: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:13787: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:13769: \$? = $ac_status" >&5
+   echo "$as_me:13791: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -13866,11 +13888,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:13869: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:13891: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:13873: \$? = $ac_status" >&5
+   echo "$as_me:13895: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -15311,7 +15333,7 @@ linux*)
   libsuff=
   case "$host_cpu" in
   x86_64*|s390x*|powerpc64*)
-    echo '#line 15314 "configure"' > conftest.$ac_ext
+    echo '#line 15336 "configure"' > conftest.$ac_ext
     if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -16085,11 +16107,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16088: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16110: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:16092: \$? = $ac_status" >&5
+   echo "$as_me:16114: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -16353,11 +16375,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16356: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16378: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:16360: \$? = $ac_status" >&5
+   echo "$as_me:16382: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -16457,11 +16479,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16460: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16482: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:16464: \$? = $ac_status" >&5
+   echo "$as_me:16486: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -17922,7 +17944,7 @@ linux*)
   libsuff=
   case "$host_cpu" in
   x86_64*|s390x*|powerpc64*)
-    echo '#line 17925 "configure"' > conftest.$ac_ext
+    echo '#line 17947 "configure"' > conftest.$ac_ext
     if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -25241,6 +25263,7 @@ CPP!$CPP$ac_delim
 GREP!$GREP$ac_delim
 EGREP!$EGREP$ac_delim
 ub_conf_file!$ub_conf_file$ac_delim
+debug_enabled!$debug_enabled$ac_delim
 libtool!$libtool$ac_delim
 AR!$AR$ac_delim
 doxygen!$doxygen$ac_delim
@@ -25275,7 +25298,7 @@ ldnsdir!$ldnsdir$ac_delim
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 80; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 81; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
index 992e80d621ed1bcb2bf6d8558c4affe3500f4c19..850162a7c86e718273ec48c093d88ae07dfa5c98 100644 (file)
@@ -223,10 +223,21 @@ int test() {
 CHECK_COMPILER_FLAG(xO4, [CFLAGS="$CFLAGS -xO4"])
 CHECK_COMPILER_FLAG(xtarget=generic, [CFLAGS="$CFLAGS -xtarget=generic"])
 # flag warnings.
-CHECK_COMPILER_FLAG(W, [CFLAGS="$CFLAGS -W"])
-CHECK_COMPILER_FLAG(Wall, [CFLAGS="$CFLAGS -Wall"])
-CHECK_COMPILER_FLAG(Wextra, [CFLAGS="$CFLAGS -Wextra"])
-CHECK_COMPILER_FLAG(Wdeclaration-after-statement, [CFLAGS="$CFLAGS -Wdeclaration-after-statement"])
+AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Enable debug warnings, asserts, makefile-dependencies]))
+debug_enabled="$enable_debug"
+AC_SUBST(debug_enabled)
+case "$enable_debug" in
+        yes)
+               CHECK_COMPILER_FLAG(W, [CFLAGS="$CFLAGS -W"])
+               CHECK_COMPILER_FLAG(Wall, [CFLAGS="$CFLAGS -Wall"])
+               CHECK_COMPILER_FLAG(Wextra, [CFLAGS="$CFLAGS -Wextra"])
+               CHECK_COMPILER_FLAG(Wdeclaration-after-statement, [CFLAGS="$CFLAGS -Wdeclaration-after-statement"])
+               AC_DEFINE([UNBOUND_DEBUG], [], [define this to enable debug checks.])
+               ;;
+       no|*)
+               # nothing to do.
+               ;;
+esac
 
 AC_C_INLINE
 
@@ -620,6 +631,10 @@ AC_DEFINE(HAVE_GETADDRINFO)
 AC_DEFINE_UNQUOTED([MAXSYSLOGMSGLEN], [5120], [Define to the maximum message length to pass to syslog.])
 
 AH_BOTTOM([
+#ifndef UNBOUND_DEBUG
+#  define NDEBUG
+#endif
+
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
index 7081617f7cc7a9c3e7171f20ce1cbbb6ada48583..978392fe06e71f26a0ddba0abb7c9b8175049388 100644 (file)
@@ -1,3 +1,9 @@
+14 January 2008: Wouter
+       - in no debug sets NDEBUG to remove asserts.
+       - configure --enable-debug is needed for dependency generation
+         for assertions and for compiler warnings.
+       - ldns.tgz updated with ldns-trunk (where buffer.h is updated).
+       
 11 January 2008: Wouter
        - man page, warning removed.
        - added text describing the use of stub zones for private zones.
index 79cba33f195c913b58346ab49d231e39c8488a03..89c19869fc55b626f3e713d32af8bc776a5df485 100644 (file)
Binary files a/ldns-src.tar.gz and b/ldns-src.tar.gz differ
index fb4096375621c96916b0cca899be143d25c7f8ac..f69af339dbdeee86e4455d31525f1af36a595b24 100644 (file)
@@ -151,12 +151,10 @@ void fatal_exit(const char* format, ...) ATTR_FORMAT(printf, 1, 2);
  */
 void log_vmsg(int pri, const char* type, const char* format, va_list args);
 
-/** always assert for now. */
-#define UNBOUND_ASSERT 1
 /**
  * an assertion that is thrown to the logfile.
  */
-#ifdef UNBOUND_ASSERT
+#ifdef UNBOUND_DEBUG
 #  define log_assert(x) \
        do { if(!(x)) \
                fatal_exit("%s:%d: %s: assertion %s failed", \