ee9c58cdbe0631f03f92c8d58a87801411a84de2
[debian/amanda] / config / amanda / dirs.m4
1 # SYNOPSIS
2 #
3 #   AMANDA_WITH_DUMPERDIR
4 #
5 # OVERVIEW
6 #
7 #   Define and substitute DUMPER_DIR with the result.
8 #
9 AC_DEFUN([AMANDA_WITH_DUMPERDIR],
10 [
11     AC_ARG_WITH(dumperdir,
12         AS_HELP_STRING([--with-dumperdir=DIR],
13             [where we install the dumpers (default: exec_prefix/dumper)]),
14         [
15             AMANDA_MSG_WARN([--with-dumperdir is no longer used.])
16         ]
17     )
18 ])
19
20 # SYNOPSIS
21 #
22 #   AMANDA_WITH_CONFIGDIR
23 #
24 # OVERVIEW
25 #
26 #   Allow user to specify the dumperdir, defaulting to ${exec_prefix}/dumper.
27 #   Define and substitute DUMPER_DIR with the result.
28 #
29 AC_DEFUN([AMANDA_WITH_CONFIGDIR],
30 [
31     AC_ARG_WITH(configdir,
32         AS_HELP_STRING([--with-configdir=DIR],
33             [runtime config files in DIR @<:@sysconfdir/amanda@:>@]),
34         [
35             case "$withval" in
36             "" | y | ye | yes | n | no)
37                 AC_MSG_ERROR([*** You must supply an argument to the --with-configdir option.])
38               ;;
39             *) CONFIG_DIR="$withval"
40               ;;
41             esac
42         ], [
43             : ${CONFIG_DIR='${sysconfdir}/amanda'} # (variable will be evaluated below)
44         ]
45     )
46     AC_DEFINE_DIR([CONFIG_DIR], [CONFIG_DIR],
47       [The directory in which configuration directories should be created. ])
48 ])
49
50 ## deprecated --with-*dir options
51
52 AC_DEFUN([AMANDA_WITH_INDEXDIR],
53 [
54     AC_ARG_WITH(indexdir,
55         AS_HELP_STRING([--with-indexdir], [deprecated: use indexdir in amanda.conf]),
56         [   AC_MSG_ERROR([*** --with-indexdir is deprecated; use indexdir in amanda.conf instead.])
57         ],)
58 ])
59
60 AC_DEFUN([AMANDA_WITH_DBDIR],
61 [
62     AC_ARG_WITH(dbdir,
63         AS_HELP_STRING([--with-dbdir], [deprecated: use infofile in amanda.conf]),
64         [   AC_MSG_ERROR([*** --with-dbdir is deprecated; use infofile in amanda.conf instead.])
65         ],)
66 ])
67
68 AC_DEFUN([AMANDA_WITH_LOGDIR],
69 [
70     AC_ARG_WITH(logdir,
71         AS_HELP_STRING([--with-logdir], [deprecated: use logfile in amanda.conf]),
72         [   AC_MSG_ERROR([*** --with-logdir is deprecated; use logfile in amanda.conf instead.])
73         ],)
74 ])
75
76 # SYNOPSIS
77 #
78 #   AMANDA_WITH_GNUTAR_LISTDIR
79 #
80 # OVERVIEW
81 #
82 #   Implements --with-gnutar-listdir.  Defines GNUTAR_LISTED_INCREMENTAL_DIR to the
83 #   value given or $localstatedir/amanda/gnutar-lists by default.  Any $xxxdir variables
84 #   are fully evaluated in the value.
85 #
86 AC_DEFUN([AMANDA_WITH_GNUTAR_LISTDIR], 
87 [
88     AC_ARG_WITH(gnutar-listdir,
89        AS_HELP_STRING([--with-gnutar-listdir=DIR],
90         [put gnutar directory lists in DIR (default: localstatedir/amanda/gnutar-lists)]),
91        [
92             case "$withval" in
93                 n | no) GNUTAR_LISTDIR= ;;
94                 y | ye | yes) GNUTAR_LISTDIR='${localstatedir}/amanda/gnutar-lists' ;;
95                 *) GNUTAR_LISTDIR="$withval" ;;
96             esac
97         ], [
98             GNUTAR_LISTDIR='${localstatedir}/amanda/gnutar-lists'
99         ]
100     )
101
102     # substitute $prefix, etc. if necessary
103     AC_DEFINE_DIR([GNUTAR_LISTED_INCREMENTAL_DIR], [GNUTAR_LISTDIR],
104         [The directory in which GNU tar should store directory lists for incrementals. ])
105     
106     # handle deprecated option
107     AC_ARG_WITH(gnutar-listed-incremental,
108         AS_HELP_STRING([--with-gnutar-listed-incremental], 
109             [deprecated; use --with-gnutar-listdir]),
110         [
111             AC_MSG_ERROR([*** The gnutar-listed-incremental option is deprecated; use --with-gnutar-listdir instead])
112         ]
113     )
114 ])
115
116 # SYNOPSIS
117 #
118 #   AMANDA_WITH_TMPDIR
119 #
120 # OVERVIEW
121 #
122 #   Implement --with-tmpdir.  Defines and substitutes AMANDA_TMPDIR.
123 #
124 AC_DEFUN([AMANDA_WITH_TMPDIR],
125 [
126     AC_ARG_WITH(tmpdir,
127         AS_HELP_STRING([--with-tmpdir],
128             [directory for temporary and debugging files (default: /tmp/amanda)]),
129         [
130             tmpdir="$withval"
131         ], [
132             tmpdir=yes
133         ]
134     )
135
136     case "$tmpdir" in
137         n | no) AC_MSG_ERROR([*** --without-tmpdir is not allowed.]);;
138         y |  ye | yes) AMANDA_TMPDIR="/tmp/amanda";;
139         *) AMANDA_TMPDIR="$tmpdir";;
140     esac
141
142     AC_DEFINE_DIR([AMANDA_TMPDIR], [AMANDA_TMPDIR],
143         [The directory in which Amanda should create temporary files. ])
144 ])
145
146 # SYNOPSIS
147 #
148 #   AMANDA_EXPAND_DIRS
149 #
150 # OVERVIEW
151 #
152 #   Expand any variable references in the following variables, then define them:
153 #   - bindir
154 #   - sbindir
155 #   - libexecdir
156 #   - mandir
157 #
158 #   Also defines the following directories and expands any variable references:
159 #   - amlibdir = --with-amlibdir or ${libdir}/amanda
160 #   - amlibexecdir = --with-amlibexecdir or ${libexecdir}/amanda
161 #   - amincludedir = ${includedir}/amanda
162 #   - amperldir = --with-amperldir or `perl -V:installsitearch`
163 #   - DUMPER_DIR = ${amlibexecdir}/application
164 #
165 AC_DEFUN([AMANDA_EXPAND_DIRS],
166 [
167     AC_REQUIRE([AMANDA_PROG_PERL])
168
169     AC_DEFINE_DIR([bindir], [bindir],
170         [Directory in which user binaries should be installed. ])
171
172     AC_DEFINE_DIR([sbindir], [sbindir],
173         [Directory in which administrator binaries should be installed. ])
174
175     AC_DEFINE_DIR([libexecdir], [libexecdir], 
176         [Directory in which internal binaries should be installed. ])
177
178     AC_DEFINE_DIR([mandir], [mandir],
179         [Directory in which man-pages should be installed])
180
181
182     # amanda-specific directories
183     AMLIBDIR=$libdir/amanda
184     AC_ARG_WITH(amlibdir,
185         AS_HELP_STRING([--with-amlibdir[[[[[=PATH]]]]]],
186                 [Where library are installed, default: $libdir/amanda])
187         AS_HELP_STRING([--without-amlibdir],
188                 [Library are installed in $libdir]),
189         [
190             case "$withval" in
191                 n | no) AMLIBDIR=$libdir ;;
192                 y | ye | yes) AMLIBDIR=$libdir/amanda ;;
193                 *) AMLIBDIR=$withval ;;
194             esac
195         ]
196     )
197     AC_DEFINE_DIR([amlibdir], [AMLIBDIR],
198         [Directory in which Amanda libraries should be installed])
199
200     AMLIBEXECDIR=$libexecdir/amanda
201     AC_ARG_WITH(amlibexecdir,
202         AS_HELP_STRING([--with-amlibexecdir[[[[[=PATH]]]]]],
203                 [Where amanda own programs are installed, default: $libexecdir/amanda])
204         AS_HELP_STRING([--without-amlibexecdir],
205                 [Amanda own programs are installed in $libexecdir]),
206         [
207             case "$withval" in
208                 n | no) AMLIBEXECDIR=$libexecdir ;;
209                 y | ye | yes) AMLIBEXECDIR=$libexecdir/amanda ;;
210                 *) AMLIBEXECDIR=$withval ;;
211             esac
212         ]
213     )
214     AC_DEFINE_DIR([amlibexecdir], [AMLIBEXECDIR],
215         [Directory in which Amanda own programs should be installed])
216
217     amincludedir="${includedir}/amanda"
218     AC_DEFINE_DIR([amincludedir], [amincludedir],
219         [Directory in which Amanda header files should be installed])
220
221     AC_ARG_WITH(amperldir,
222         AS_HELP_STRING([--with-amperldir[[[[[=PATH]]]]]],
223                 [Where amanda's perl modules are installed; default: installsitelib])
224         AS_HELP_STRING([--without-amperldir],
225                 [Install amanda's perl modules in $amlibdir/perl]),
226         [
227             case "$withval" in
228                 y | ye | yes) AMPERLLIB=DEFAULT ;;
229                 n | no) AMPERLLIB=$amlibdir/perl ;;
230                 *) AMPERLLIB=$withval ;;
231             esac
232         ], [
233             AMPERLLIB=DEFAULT
234         ]
235     )
236     # apply the default if no value was given.
237     if test x"$AMPERLLIB" = x"DEFAULT"; then
238         eval `$PERL -V:installsitelib`
239         AMPERLLIB=$installsitelib
240     fi
241     AC_DEFINE_DIR([amperldir], [AMPERLLIB],
242         [Directory in which perl modules should be installed])
243
244     DUMPER_DIR='${amlibexecdir}/application'
245     AC_DEFINE_DIR([DUMPER_DIR],[DUMPER_DIR],
246            [Directory in which dumper interfaces should be installed and searched. ])
247     # TODO: rename to APPLICATION_DIR, add to Amanda::Paths and 'amgtconf build.APPLICATION_DIR'
248 ])
249
250 # SYNOPSIS
251 #
252 #   AMANDA_SHOW_DIRS_SUMMARY
253 #
254 # OVERVIEW
255 #
256 #   Show a summary of the settings from this file.
257 #
258 AC_DEFUN([AMANDA_SHOW_DIRS_SUMMARY],
259 [
260     echo "Directories:"
261     echo "  Perl modules (amperldir): $amperldir"
262     echo "  Dumper: $DUMPER_DIR"
263     echo "  Configuration: $CONFIG_DIR"
264     echo "  GNU Tar lists: $GNUTAR_LISTED_INCREMENTAL_DIR"
265     echo "  Temporary: $AMANDA_TMPDIR"
266 ])