8076f279124d6f6615f8ece17c96cd5855f53a71
[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     #allow configure CONFIG_CLOBBER_MY_CONFIG= to be used by make.
20     CONFIG_CLOBBER_MY_CONFIG=$CLOBBER_MY_CONFIG
21     AC_SUBST(CONFIG_CLOBBER_MY_CONFIG)
22
23     AC_ARG_WITH(index-server,
24         AS_HELP_STRING([--with-index-server=HOST],
25             [default amanda index server (default: `uname -n`)]),
26        [
27             case "$withval" in
28             "" | y | ye | yes | n | no)
29                 AC_MSG_ERROR([*** You must supply an argument to the --with-index-server option.])
30               ;;
31             *) DEFAULT_SERVER="$withval"
32               ;;
33             esac
34        ],
35        : ${DEFAULT_SERVER=`uname -n`}
36     )
37     AC_DEFINE_UNQUOTED(DEFAULT_SERVER,"$DEFAULT_SERVER",
38         [This is the default Amanda index server.])
39     AC_SUBST(DEFAULT_SERVER)
40
41     AC_ARG_WITH(config,
42         AS_HELP_STRING([--with-config=CONFIG],
43             [default amanda configuration (default: DailySet1)]),
44         [
45             case "$withval" in
46             "" | y | ye | yes | n | no)
47                 AC_MSG_ERROR([*** You must supply an argument to the --with-config option.])
48               ;;
49             *) DEFAULT_CONFIG="$withval"
50               ;;
51             esac
52         ],
53         : ${DEFAULT_CONFIG=DailySet1}
54     )
55     AC_DEFINE_UNQUOTED(DEFAULT_CONFIG,"$DEFAULT_CONFIG",
56         [This is the default Amanda configuration.])
57     AC_SUBST(DEFAULT_CONFIG)
58
59     AC_ARG_WITH(tape-server,
60         AS_HELP_STRING([--with-tape-server=HOST],
61             [default tape server for restore (default: same as index-server)]),
62         [
63             case "$withval" in
64             "" | y | ye | yes | n | no)
65                 AC_MSG_ERROR([*** You must supply an argument to the --with-tape-server option.])
66               ;;
67             *) DEFAULT_TAPE_SERVER="$withval"
68               ;;
69             esac
70         ],
71         : ${DEFAULT_TAPE_SERVER=$DEFAULT_SERVER}
72     )
73     AC_DEFINE_UNQUOTED(DEFAULT_TAPE_SERVER,"$DEFAULT_TAPE_SERVER",
74         [This is the default restoring Amanda tape server. ])
75     AC_SUBST(DEFAULT_TAPE_SERVER)
76
77     AC_ARG_WITH(tape-device,
78         AS_HELP_STRING([--with-tape-device=DEVICE],
79             [default device on restore tape server]),
80         [
81             case "$withval" in
82             "" | y | ye | yes | n | no)
83                 AC_MSG_ERROR([*** You must supply an argument to the --with-tape-device option.])
84               ;;
85             *) DEFAULT_TAPE_DEVICE="$withval"
86               ;;
87             esac
88         ]
89     )
90
91     AC_DEFINE_UNQUOTED(DEFAULT_TAPE_DEVICE,"$DEFAULT_TAPE_DEVICE",
92         [This is the default no-rewinding tape device. ])
93     AC_SUBST(DEFAULT_TAPE_DEVICE)
94
95     if test "${DEFAULT_TAPE_DEVICE+set}" = "set"; then
96         EXAMPLE_TAPEDEV="$DEFAULT_TAPE_DEVICE"
97     else
98         EXAMPLE_TAPEDEV="tape:/dev/YOUR-TAPE-DEVICE-HERE"
99     fi
100     AC_SUBST(EXAMPLE_TAPEDEV)
101
102     AC_ARG_WITH(changer-device,
103         AS_HELP_STRING([--with-changer-device=DEV],
104             [default tape changer device (default: /dev/ch0)]),
105         [
106             case "$withval" in
107             "" | y | ye | yes | n | no)
108                 AC_MSG_ERROR([*** You must supply an argument to the --with-changer-device option.])
109               ;;
110             *) DEFAULT_CHANGER_DEVICE="$withval"
111               ;;
112             esac
113         ]
114     )
115
116     if test -z "$DEFAULT_CHANGER_DEVICE"; then
117         DEFAULT_CHANGER_DEVICE=/dev/null
118         if test -f /dev/ch0; then
119             DEFAULT_CHANGER_DEVICE=/dev/ch0
120         fi
121     fi
122
123     AC_DEFINE_UNQUOTED(DEFAULT_CHANGER_DEVICE,"$DEFAULT_CHANGER_DEVICE",
124         [This is the default changer device. ])
125     AC_SUBST(DEFAULT_CHANGER_DEVICE)
126
127     AC_ARG_WITH(amandates,
128         AS_HELP_STRING([--with-amandates],
129             [default location for 'amandates' (default: $localstatedir/amanda/amandates)]),
130             [
131             case "$withval" in
132                 n | no) AC_MSG_ERROR([*** --without-amandates is not allowed.]);;
133                 y |  ye | yes) amandates='$localstatedir/amanda/amandates' ;;
134                 *) amandates="$withval";;
135             esac
136             ],
137             [amandates='$localstatedir/amanda/amandates']
138     )
139
140     AC_DEFINE_DIR([DEFAULT_AMANDATES_FILE], [amandates],
141         [Default location for 'amandates'])
142
143     DEFAULT_FSF_AFTER_FILEMARK="FALSE"
144     case "$target" in
145         *-solaris*) DEFAULT_FSF_AFTER_FILEMARK="TRUE"
146                     ;;
147     esac
148     AC_DEFINE_UNQUOTED(DEFAULT_FSF_AFTER_FILEMARK, $DEFAULT_FSF_AFTER_FILEMARK,
149         [Define if a FSF is needed on filemark.])
150 ])