Imported Upstream version 3.2.0
[debian/amanda] / config / amanda / debugging.m4
index 6793c8f066df2fdc43bce0c6b92c2ffbc5c70c6d..2ec2258edc9d7e845ad0970eb1f1b9cf91efcbe7 100644 (file)
@@ -4,10 +4,12 @@
 #
 # OVERVIEW
 #
-#   Handles the --with-assertions flag.  Defines ASSERTIONS if the flag is given.
+#   Handles the --with-assertions flag.  Defines and substitutes ASSERTIONS
+#   if the flag is given.
 #
 AC_DEFUN([AMANDA_WITH_ASSERTIONS],
 [
+    ASSERTIONS=
     AC_ARG_WITH(assertions,
         AS_HELP_STRING([--with-assertions],
             [compile assertions into code]),
@@ -15,6 +17,7 @@ AC_DEFUN([AMANDA_WITH_ASSERTIONS],
             case "$withval" in
                 n | no) : ;;
                 y |  ye | yes)
+                   ASSERTIONS=1
                     AC_DEFINE(ASSERTIONS,1,
                         [Define if you want assertion checking. ])
                   ;;
@@ -23,6 +26,7 @@ AC_DEFUN([AMANDA_WITH_ASSERTIONS],
             esac
         ]
     )
+    AC_SUBST(ASSERTIONS)
 ])
 
 # SYNOPSIS
@@ -56,6 +60,23 @@ AC_DEFUN([AMANDA_WITH_DEBUGGING],
        [Location of Amanda directories and files. ])
 ])
 
+# SYNOPSIS
+#
+#   AMANDA_GLIBC_BACKTRACE
+#
+# OVERVIEW
+#
+#   Check for glibc's backtrace support, and define HAVE_GLIBC_BACKTRACE if it is present.
+AC_DEFUN([AMANDA_GLIBC_BACKTRACE],
+[
+    AC_CHECK_HEADER([execinfo.h], [
+       AC_CHECK_FUNC([backtrace_symbols_fd], [
+           AC_DEFINE(HAVE_GLIBC_BACKTRACE, 1,
+               [Define this if glibc's backtrace functionality (execinfo.h) is present])
+       ])
+    ])
+])
+
 # SYNOPSIS
 #
 #   AMANDA_WITH_DEBUG_DAYS
@@ -129,3 +150,32 @@ AC_DEFUN([AMANDA_WITH_TESTING],
         [The name for the Kerberized Amanda service. ])
 ])
 
+# SYNOPSIS
+#
+#   AMANDA_ENABLE_SYNTAX_CHECKS
+#
+# OVERVIEW
+#
+#   Handles the --enable-syntax-checks flag, which triggers syntax checks
+#   for most 'make' targets, but causes spurious errors in all but the most
+#   carefully-constructed build environments.
+
+AC_DEFUN([AMANDA_DISABLE_SYNTAX_CHECKS],
+[
+    AC_ARG_ENABLE(syntax-checks,
+       AS_HELP_STRING([--enable-syntax-checks],
+           [Perform syntax checks when installing - developers only]),
+       [
+           case "$enableval" in
+               no) SYNTAX_CHECKS=false;;
+               *)
+                   SYNTAX_CHECKS=true
+                   AMANDA_MSG_WARN([--enable-syntax-checks can cause build failures and should only be used by developers])
+                   ;;
+           esac
+       ], [
+           SYNTAX_CHECKS=false
+       ])
+
+    AM_CONDITIONAL(SYNTAX_CHECKS, $SYNTAX_CHECKS)
+])