Imported Upstream version 2.6.1
[debian/amanda] / config / amanda / dirs.m4
1 # SYNOPSIS
2 #
3 #   AMANDA_WITH_APPLICATIONDIR
4 #
5 # OVERVIEW
6 #
7 #   Define and substitute APPLICATION_DIR with the result.
8 #
9 AC_DEFUN([AMANDA_WITH_APPLICATIONDIR],
10 [
11     AC_ARG_WITH(dumperdir,
12         AS_HELP_STRING([--with-dumperdir=DIR],
13             [where we install the dumpers (deprecated)]),
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 APPLICATION_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 #   - amdatadir = --with-amdatadir or ${datadir}/amanda
160 #   - amlibdir = --with-amlibdir or ${libdir}/amanda
161 #   - amlibexecdir = --with-amlibexecdir or ${libexecdir}/amanda
162 #   - amincludedir = ${includedir}/amanda
163 #   - amperldir = --with-amperldir or `perl -V:installsitearch`
164 #   - APPLICATION_DIR = ${amlibexecdir}/application
165 #
166 AC_DEFUN([AMANDA_EXPAND_DIRS],
167 [
168     AC_REQUIRE([AMANDA_PROG_PERL])
169
170     AC_DEFINE_DIR([bindir], [bindir],
171         [Directory in which user binaries should be installed. ])
172
173     AC_DEFINE_DIR([sbindir], [sbindir],
174         [Directory in which administrator binaries should be installed. ])
175
176     AC_DEFINE_DIR([libexecdir], [libexecdir], 
177         [Directory in which internal binaries should be installed. ])
178
179     AC_DEFINE_DIR([mandir], [mandir],
180         [Directory in which man-pages should be installed])
181
182
183     # amanda-specific directories
184     AMLIBDIR=$libdir/amanda
185     AC_ARG_WITH(amlibdir,
186         AS_HELP_STRING([--with-amlibdir[[[[[=PATH]]]]]],
187                 [Where library are installed, default: $libdir/amanda])
188         AS_HELP_STRING([--without-amlibdir],
189                 [Library are installed in $libdir]),
190         [
191             case "$withval" in
192                 n | no) AMLIBDIR=$libdir ;;
193                 y | ye | yes) AMLIBDIR=$libdir/amanda ;;
194                 *) AMLIBDIR=$withval ;;
195             esac
196         ]
197     )
198     AC_DEFINE_DIR([amlibdir], [AMLIBDIR],
199         [Directory in which Amanda libraries should be installed])
200
201     AMLIBEXECDIR=$libexecdir/amanda
202     AC_ARG_WITH(amlibexecdir,
203         AS_HELP_STRING([--with-amlibexecdir[[[[[=PATH]]]]]],
204                 [Where amanda own programs are installed, default: $libexecdir/amanda])
205         AS_HELP_STRING([--without-amlibexecdir],
206                 [Amanda own programs are installed in $libexecdir]),
207         [
208             case "$withval" in
209                 n | no) AMLIBEXECDIR=$libexecdir ;;
210                 y | ye | yes) AMLIBEXECDIR=$libexecdir/amanda ;;
211                 *) AMLIBEXECDIR=$withval ;;
212             esac
213         ]
214     )
215     AC_DEFINE_DIR([amlibexecdir], [AMLIBEXECDIR],
216         [Directory in which Amanda own programs should be installed])
217
218     amincludedir="${includedir}/amanda"
219     AC_DEFINE_DIR([amincludedir], [amincludedir],
220         [Directory in which Amanda header files should be installed])
221
222     AC_ARG_WITH(amperldir,
223         AS_HELP_STRING([--with-amperldir[[[[[=PATH]]]]]],
224                 [Where amanda's perl modules are installed; default: installsitelib])
225         AS_HELP_STRING([--without-amperldir],
226                 [Install amanda's perl modules in $amlibdir/perl]),
227         [
228             case "$withval" in
229                 y | ye | yes) AMPERLLIB=DEFAULT ;;
230                 n | no) AMPERLLIB=$amlibdir/perl ;;
231                 *) AMPERLLIB=$withval ;;
232             esac
233         ], [
234             AMPERLLIB=DEFAULT
235         ]
236     )
237     # apply the default if no value was given.
238     if test x"$AMPERLLIB" = x"DEFAULT"; then
239         eval `$PERL -V:installsitelib`
240         AMPERLLIB=$installsitelib
241     fi
242     AC_DEFINE_DIR([amperldir], [AMPERLLIB],
243         [Directory in which perl modules should be installed])
244
245     APPLICATION_DIR='${amlibexecdir}/application'
246     AC_DEFINE_DIR([APPLICATION_DIR],[APPLICATION_DIR],
247            [Directory in which dumper interfaces should be installed and searched. ])
248
249     AC_ARG_WITH(amdatadir,
250         AS_HELP_STRING([--with-amdatadir[[[[[=PATH]]]]]],
251                 [Where amanda's templates and examples are installed; default: $datadir/amanda]),
252         [
253             AMDATADIR=$withval
254         ], [
255             AMDATADIR=$datadir/amanda
256         ]
257     )
258     AC_DEFINE_DIR([amdatadir], [AMDATADIR],
259         [Directory in which amanda's templates and examples are installed. ])
260 ])
261
262 # SYNOPSIS
263 #
264 #   AMANDA_SHOW_DIRS_SUMMARY
265 #
266 # OVERVIEW
267 #
268 #   Show a summary of the settings from this file.
269 #
270 AC_DEFUN([AMANDA_SHOW_DIRS_SUMMARY],
271 [
272     echo "Directories:"
273     echo "  Application: $APPLICATION_DIR"
274     echo "  Configuration: $CONFIG_DIR"
275     echo "  GNU Tar lists: $GNUTAR_LISTED_INCREMENTAL_DIR"
276     echo "  Perl modules (amperldir): $amperldir"
277     echo "  Template and example data files (amdatadir): $amdatadir"
278     echo "  Temporary: $AMANDA_TMPDIR"
279 ])