4a499dc553469401ec7ee40d2321d4eef9635d65
[debian/amanda] / config / amanda / debugging.m4
1 # SYNOPSIS
2 #
3 #   AMANDA_WITH_ASSERTIONS
4 #
5 # OVERVIEW
6 #
7 #   Handles the --with-assertions flag.  Defines ASSERTIONS if the flag is given.
8 #
9 AC_DEFUN([AMANDA_WITH_ASSERTIONS],
10 [
11     AC_ARG_WITH(assertions,
12         AS_HELP_STRING([--with-assertions],
13             [compile assertions into code]),
14         [
15             case "$withval" in
16                 n | no) : ;;
17                 y |  ye | yes)
18                     AC_DEFINE(ASSERTIONS,1,
19                         [Define if you want assertion checking. ])
20                   ;;
21                 *) AC_MSG_ERROR([*** You must not supply an argument to --with-assertions option.])
22                   ;;
23             esac
24         ]
25     )
26 ])
27
28 # SYNOPSIS
29 #
30 #   AMANDA_WITH_DEBUGGING
31 #
32 # OVERVIEW
33 #
34 #   Handles the --with[out]-debugging flag.  If debugging is not disabled, then define
35 #   DEBUG_CODE, and define and substitute AMANDA_DBGDIR to either the location the
36 #   user gave, or AMANDA_TMPDIR.
37 #
38 AC_DEFUN([AMANDA_WITH_DEBUGGING],
39 [
40     AC_REQUIRE([AMANDA_WITH_TMPDIR])
41     AC_ARG_WITH(debugging,
42         AS_HELP_STRING([--with-debugging=DIR]
43             [put debug logs in DIR (default same as --with-tmpdir)]), 
44         [ debugging="$withval" ],
45         [ debugging="yes" ]
46     )
47
48     case "$debugging" in
49         n | no) AC_MSG_ERROR([Amanda no longer supports building with debugging disabled]);;
50         y | ye | yes) AMANDA_DBGDIR="$AMANDA_TMPDIR";;
51         *) AMANDA_DBGDIR="$debugging";;
52     esac
53
54     # evaluate any extra variables in the directory
55     AC_DEFINE_DIR([AMANDA_DBGDIR], [AMANDA_DBGDIR],
56         [Location of Amanda directories and files. ])
57 ])
58
59 # SYNOPSIS
60 #
61 #   AMANDA_GLIBC_BACKTRACE
62 #
63 # OVERVIEW
64 #
65 #   Check for glibc's backtrace support, and define HAVE_GLIBC_BACKTRACE if it is present.
66 AC_DEFUN([AMANDA_GLIBC_BACKTRACE],
67 [
68     AC_CHECK_HEADER([execinfo.h], [
69         AC_CHECK_FUNC([backtrace_symbols_fd], [
70             AC_DEFINE(HAVE_GLIBC_BACKTRACE, 1,
71                 [Define this if glibc's backtrace functionality (execinfo.h) is present])
72         ])
73     ])
74 ])
75
76 # SYNOPSIS
77 #
78 #   AMANDA_WITH_DEBUG_DAYS
79 #
80 # OVERVIEW
81 #
82 #   Handles the --with-debug-days flag.  Defines and substitutes AMANDA_DEBUG_DAYS.
83 #
84 AC_DEFUN([AMANDA_WITH_DEBUG_DAYS],
85 [
86     AC_ARG_WITH(debug_days,
87         AS_HELP_STRING([--with-debug-days=NN],
88             [number of days to keep debugging files (default: 4)]),
89         [
90             debug_days="$withval"
91         ], [
92             debug_days="yes"
93         ]
94     )
95     case "$debug_days" in
96         n | no) 
97             AMANDA_DEBUG_DAYS=0 ;;
98         y |  ye | yes) 
99             AMANDA_DEBUG_DAYS=4 ;;
100         [[0-9]] | [[0-9]][[0-9]] | [[0-9]][[0-9]][[0-9]]) 
101             AMANDA_DEBUG_DAYS="$debug_days" ;;
102         *) AC_MSG_ERROR([*** --with-debug-days value not numeric or out of range.])
103           ;;
104     esac
105     AC_DEFINE_UNQUOTED(AMANDA_DEBUG_DAYS,$AMANDA_DEBUG_DAYS,
106         [Number of days to keep debugging files. ])
107     AC_SUBST(AMANDA_DEBUG_DAYS)
108 ])
109
110 # SYNOPSIS
111 #
112 #   AMANDA_WITH_TESTING
113 #
114 # OVERVIEW
115 #
116 #   Handles the --with-testing flag.  Defines and substitutes SERVICE_SUFFIX, and
117 #   defines AMANDA_SERVICE_NAME and KAMANDA_SERVICE_NAME.
118 #
119 AC_DEFUN([AMANDA_WITH_TESTING],
120 [
121     AC_ARG_WITH(testing,
122         AS_HELP_STRING([--with-testing@<:@=SUFFIX@:>@],
123             [use alternate service names with suffix (default 'test')]),
124         [
125             TESTING="$withval"
126         ], [
127             TESTING="no"
128         ]
129     )
130     case "$TESTING" in
131         n | no) SERVICE_SUFFIX="";;
132         y |  ye | yes) SERVICE_SUFFIX="-test";;
133         *) SERVICE_SUFFIX="-$TESTING";;
134     esac
135
136     AMANDA_SERVICE_NAME="amanda$SERVICE_SUFFIX"
137     KAMANDA_SERVICE_NAME="kamanda$SERVICE_SUFFIX"
138
139     AC_SUBST(SERVICE_SUFFIX)
140     AC_DEFINE_UNQUOTED(SERVICE_SUFFIX, "$SERVICE_SUFFIX",
141         [A suffix that will be appended to service names.
142      * Useful for testing in parallel with a working version. ])
143     AC_DEFINE_UNQUOTED(AMANDA_SERVICE_NAME,  "$AMANDA_SERVICE_NAME", 
144         [The name for the Amanda service. ])
145     AC_DEFINE_UNQUOTED(KAMANDA_SERVICE_NAME, "$KAMANDA_SERVICE_NAME", 
146         [The name for the Kerberized Amanda service. ])
147 ])
148