a28931badab026048383acc8584cd09c8736273d
[debian/amanda] / config / amanda / defaults.m4
1 # SYNOPSIS
2 #
3 #   Get default settings for various configuration and command-line options:
4 #       --with-index-server
5 #           define and substitute DEFAULT_SERVER
6 #       --with-config
7 #           define and substitute DEFAULT_CONFIG
8 #       --with-tape-server
9 #           define and substitute DEFAULT_TAPE_SERVER
10 #       --with-tape-device
11 #           define and substitute DEFAULT_TAPE_DEVICE; substitue EXAMPLE_TAPEDEV
12 #       --with-changer-device
13 #           define and substitute DEFAULT_CHANGER_DEVICE
14 #       --with-amandates
15 #           define and substitute DEFAULT_AMANDATES_FILE
16 #
17 AC_DEFUN([AMANDA_SETUP_DEFAULTS],
18 [
19     AC_ARG_WITH(index-server,
20         AS_HELP_STRING([--with-index-server=HOST],
21             [default amanda index server (default: `uname -n`)]),
22        [
23             case "$withval" in
24             "" | y | ye | yes | n | no)
25                 AC_MSG_ERROR([*** You must supply an argument to the --with-index-server option.])
26               ;;
27             *) DEFAULT_SERVER="$withval"
28               ;;
29             esac
30        ],
31        : ${DEFAULT_SERVER=`uname -n`}
32     )
33     AC_DEFINE_UNQUOTED(DEFAULT_SERVER,"$DEFAULT_SERVER",
34         [This is the default Amanda index server.])
35     AC_SUBST(DEFAULT_SERVER)
36
37     AC_ARG_WITH(config,
38         AS_HELP_STRING([--with-config=CONFIG],
39             [default amanda configuration (default: DailySet1)]),
40         [
41             case "$withval" in
42             "" | y | ye | yes | n | no)
43                 AC_MSG_ERROR([*** You must supply an argument to the --with-config option.])
44               ;;
45             *) DEFAULT_CONFIG="$withval"
46               ;;
47             esac
48         ],
49         : ${DEFAULT_CONFIG=DailySet1}
50     )
51     AC_DEFINE_UNQUOTED(DEFAULT_CONFIG,"$DEFAULT_CONFIG",
52         [This is the default Amanda configuration.])
53     AC_SUBST(DEFAULT_CONFIG)
54
55     AC_ARG_WITH(tape-server,
56         AS_HELP_STRING([--with-tape-server=HOST],
57             [default tape server for restore (default: same as index-server)]),
58         [
59             case "$withval" in
60             "" | y | ye | yes | n | no)
61                 AC_MSG_ERROR([*** You must supply an argument to the --with-tape-server option.])
62               ;;
63             *) DEFAULT_TAPE_SERVER="$withval"
64               ;;
65             esac
66         ],
67         : ${DEFAULT_TAPE_SERVER=$DEFAULT_SERVER}
68     )
69     AC_DEFINE_UNQUOTED(DEFAULT_TAPE_SERVER,"$DEFAULT_TAPE_SERVER",
70         [This is the default restoring Amanda tape server. ])
71     AC_SUBST(DEFAULT_TAPE_SERVER)
72
73     AC_ARG_WITH(tape-device,
74         AS_HELP_STRING([--with-tape-device=DEVICE],
75             [default device on restore tape server]),
76         [
77             case "$withval" in
78             "" | y | ye | yes | n | no)
79                 AC_MSG_ERROR([*** You must supply an argument to the --with-tape-device option.])
80               ;;
81             *) DEFAULT_TAPE_DEVICE="$withval"
82               ;;
83             esac
84         ]
85     )
86
87     AC_DEFINE_UNQUOTED(DEFAULT_TAPE_DEVICE,"$DEFAULT_TAPE_DEVICE",
88         [This is the default no-rewinding tape device. ])
89     AC_SUBST(DEFAULT_TAPE_DEVICE)
90
91     if test "${DEFAULT_TAPE_DEVICE+set}" = "set"; then
92         EXAMPLE_TAPEDEV="$DEFAULT_TAPE_DEVICE"
93     else
94         EXAMPLE_TAPEDEV="tape:/dev/YOUR-TAPE-DEVICE-HERE"
95     fi
96     AC_SUBST(EXAMPLE_TAPEDEV)
97
98     AC_ARG_WITH(changer-device,
99         AS_HELP_STRING([--with-changer-device=DEV],
100             [default tape changer device (default: /dev/ch0)]),
101         [
102             case "$withval" in
103             "" | y | ye | yes | n | no)
104                 AC_MSG_ERROR([*** You must supply an argument to the --with-changer-device option.])
105               ;;
106             *) DEFAULT_CHANGER_DEVICE="$withval"
107               ;;
108             esac
109         ]
110     )
111
112     if test -z "$DEFAULT_CHANGER_DEVICE"; then
113         DEFAULT_CHANGER_DEVICE=/dev/null
114         if test -f /dev/ch0; then
115             DEFAULT_CHANGER_DEVICE=/dev/ch0
116         fi
117     fi
118
119     AC_DEFINE_UNQUOTED(DEFAULT_CHANGER_DEVICE,"$DEFAULT_CHANGER_DEVICE",
120         [This is the default changer device. ])
121     AC_SUBST(DEFAULT_CHANGER_DEVICE)
122
123     AC_ARG_WITH(amandates,
124         AS_HELP_STRING([--with-amandates],
125             [default location for 'amandates' (default: $localstatedir/amanda/amandates)]),
126             [
127             case "$withval" in
128                 n | no) AC_MSG_ERROR([*** --without-amandates is not allowed.]);;
129                 y |  ye | yes) amandates='$localstatedir/amanda/amandates' ;;
130                 *) amandates="$withval";;
131             esac
132             ],
133             [amandates='$localstatedir/amanda/amandates']
134     )
135
136     AC_DEFINE_DIR([DEFAULT_AMANDATES_FILE], [amandates],
137         [Default location for 'amandates'])
138 ])