Imported Upstream version 2.6.0
[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_WITH_DEBUG_DAYS
62 #
63 # OVERVIEW
64 #
65 #   Handles the --with-debug-days flag.  Defines and substitutes AMANDA_DEBUG_DAYS.
66 #
67 AC_DEFUN([AMANDA_WITH_DEBUG_DAYS],
68 [
69     AC_ARG_WITH(debug_days,
70         AS_HELP_STRING([--with-debug-days=NN],
71             [number of days to keep debugging files (default: 4)]),
72         [
73             debug_days="$withval"
74         ], [
75             debug_days="yes"
76         ]
77     )
78     case "$debug_days" in
79         n | no) 
80             AMANDA_DEBUG_DAYS=0 ;;
81         y |  ye | yes) 
82             AMANDA_DEBUG_DAYS=4 ;;
83         [[0-9]] | [[0-9]][[0-9]] | [[0-9]][[0-9]][[0-9]]) 
84             AMANDA_DEBUG_DAYS="$debug_days" ;;
85         *) AC_MSG_ERROR([*** --with-debug-days value not numeric or out of range.])
86           ;;
87     esac
88     AC_DEFINE_UNQUOTED(AMANDA_DEBUG_DAYS,$AMANDA_DEBUG_DAYS,
89         [Number of days to keep debugging files. ])
90     AC_SUBST(AMANDA_DEBUG_DAYS)
91 ])
92
93 # SYNOPSIS
94 #
95 #   AMANDA_WITH_TESTING
96 #
97 # OVERVIEW
98 #
99 #   Handles the --with-testing flag.  Defines and substitutes SERVICE_SUFFIX, and
100 #   defines AMANDA_SERVICE_NAME and KAMANDA_SERVICE_NAME.
101 #
102 AC_DEFUN([AMANDA_WITH_TESTING],
103 [
104     AC_ARG_WITH(testing,
105         AS_HELP_STRING([--with-testing@<:@=SUFFIX@:>@],
106             [use alternate service names with suffix (default 'test')]),
107         [
108             TESTING="$withval"
109         ], [
110             TESTING="no"
111         ]
112     )
113     case "$TESTING" in
114         n | no) SERVICE_SUFFIX="";;
115         y |  ye | yes) SERVICE_SUFFIX="-test";;
116         *) SERVICE_SUFFIX="-$TESTING";;
117     esac
118
119     AMANDA_SERVICE_NAME="amanda$SERVICE_SUFFIX"
120     KAMANDA_SERVICE_NAME="kamanda$SERVICE_SUFFIX"
121
122     AC_SUBST(SERVICE_SUFFIX)
123     AC_DEFINE_UNQUOTED(SERVICE_SUFFIX, "$SERVICE_SUFFIX",
124         [A suffix that will be appended to service names.
125      * Useful for testing in parallel with a working version. ])
126     AC_DEFINE_UNQUOTED(AMANDA_SERVICE_NAME,  "$AMANDA_SERVICE_NAME", 
127         [The name for the Amanda service. ])
128     AC_DEFINE_UNQUOTED(KAMANDA_SERVICE_NAME, "$KAMANDA_SERVICE_NAME", 
129         [The name for the Kerberized Amanda service. ])
130 ])
131