Imported Upstream version 2.4.5p1
[debian/amanda] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2
3 AC_INIT
4 AC_CONFIG_SRCDIR([common-src/amanda.h])
5 AC_CONFIG_AUX_DIR(config)
6 AC_CANONICAL_TARGET([])
7
8
9 CONFIGURE_COMMAND="'$0'"
10 for arg in "$@"; do
11   CONFIGURE_COMMAND="$CONFIGURE_COMMAND '$arg'"
12 done
13 AC_DEFINE_UNQUOTED(CONFIGURE_COMMAND,"$CONFIGURE_COMMAND",
14           [Saves the original ./configure command line arguments])
15 AC_SUBST(CONFIGURE_COMMAND)
16
17 AM_INIT_AUTOMAKE(amanda, 2.4.5p1)
18 AM_CONFIG_HEADER(config/config.h)
19
20 AC_PREREQ(2.59)         dnl Minimum Autoconf version required.
21
22 if test -f "$srcdir/SNAPSHOT"; then
23   cat < "$srcdir/SNAPSHOT"
24 changequote(,)
25   snapdate=`sed -n '/^Snapshot Date: \([0-9]*\)/ s//\1/p' < $srcdir/SNAPSHOT`
26 changequote([,])
27   test -z "$snapdate" || VERSION="$VERSION-$snapdate"
28   SNAPSHOT_STAMP=SNAPSHOT
29 else
30   SNAPSHOT_STAMP=
31 fi
32 AC_SUBST(SNAPSHOT_STAMP)
33
34 if test -f config.local; then
35     echo "running local script ./config.local"
36     . ./config.local
37 fi
38
39 dnl
40 dnl Set the version number of this release of Amanda from the VERSION
41 dnl string, which is set in AM_INIT_AUTOMAKE.
42 dnl
43 changequote(,)
44 VERSION_MAJOR=`expr "$VERSION" : '\([0-9]*\)'`
45 VERSION_MINOR=`expr "$VERSION" : '[0-9]*\.\([0-9]*\)'`
46 VERSION_PATCH=`expr "$VERSION" : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
47 VERSION_COMMENT=\"`expr "$VERSION" : '[0-9]*\.[0-9]*\.[0-9]*\(.*\)'`\"
48 changequote([,])
49
50 VERSION_SUFFIX="$VERSION"
51 AC_SUBST(VERSION_MAJOR)
52 AC_SUBST(VERSION_MINOR)
53 AC_SUBST(VERSION_PATCH)
54 AC_SUBST(VERSION_COMMENT)
55 AC_SUBST(VERSION_SUFFIX)
56
57 dnl
58 dnl runtime and compile time
59 dnl
60 SYSPATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb:/usr/bsd:/etc:/usr/etc"
61 LOCPATH=`(
62     test "x$prefix" = xNONE && prefix=$ac_default_prefix
63     test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
64     eval echo "$libexecdir:$PATH:/usr/local/sbin:/usr/local/bin"
65 )`
66 SYSLOCPATH="$SYSPATH:$LOCPATH"
67 LOCSYSPATH="$LOCPATH:$SYSPATH"
68
69 AC_ARG_WITH(includes,
70     [  --with-includes=DIR    site header files for readline, etc in DIR],
71     [
72         case "$withval" in
73         "" | y | ye | yes | n | no)
74             AC_MSG_ERROR([*** You must supply an argument to the --with-includes option.])
75           ;;
76         esac
77         INCLUDE_DIRS="$withval"
78     ])
79
80 if test "$INCLUDE_DIRS"; then
81         for dir in $INCLUDE_DIRS; do
82             if test -d "$dir"; then
83                 AMANDA_CPPFLAGS="$AMANDA_CPPFLAGS -I$dir"
84             else
85                 AC_MSG_WARN([*** Include directory $dir does not exist.])
86             fi
87         done
88 fi
89
90 AC_ARG_WITH(libraries,
91     [  --with-libraries=DIR   site library directories for readline, etc in DIR],
92     [
93         case "$withval" in
94         "" | y | ye | yes | n | no)
95             AC_MSG_ERROR([*** You must supply an argument to the --with-libraries option.])
96           ;;
97         esac
98         LIBRARY_DIRS="$withval"
99     ])
100
101 if test "$LIBRARY_DIRS"; then
102         for dir in $LIBRARY_DIRS; do
103             if test -d "$dir"; then
104                 case "$target" in
105                   *-solaris2*)
106                         AMANDA_LDFLAGS="$AMANDA_LDFLAGS -R$dir"
107                         ;;
108                 esac
109                 AMANDA_LDFLAGS="$AMANDA_LDFLAGS -L$dir"
110             else
111                 AC_MSG_WARN([*** Library directory $dir does not exist.])
112             fi
113         done
114 fi
115
116 AC_ARG_WITH(configdir,
117     [  --with-configdir=DIR   runtime config files in DIR [sysconfdir/amanda]],
118     [
119         case "$withval" in
120         "" | y | ye | yes | n | no)
121             AC_MSG_ERROR([*** You must supply an argument to the --with-configdir option.])
122           ;;
123         *) CONFIG_DIR="$withval"
124           ;;
125         esac
126     ],
127     : ${CONFIG_DIR=$sysconfdir/amanda}
128 )
129 CONFIG_DIR=`(
130     test "x$prefix" = xNONE && prefix=$ac_default_prefix
131     test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
132     eval echo "$CONFIG_DIR"
133 )`
134 AC_DEFINE_UNQUOTED(CONFIG_DIR,"$CONFIG_DIR",
135   [The directory in which configuration directories should be created. ])
136 AC_SUBST(CONFIG_DIR)
137
138 AC_ARG_WITH(indexdir,
139     [  --with-indexdir        deprecated, use indexdir in amanda.conf],
140     [   AC_MSG_ERROR([*** --with-indexdir is deprecated, use indexdir in amanda.conf instead.])
141     ],)
142
143 AC_ARG_WITH(dbdir,
144     [  --with-dbdir           deprecated, use infofile in amanda.conf],
145     [   AC_MSG_ERROR([*** --with-dbdir is deprecated, use infofile in amanda.conf instead.])
146     ],)
147
148 AC_ARG_WITH(logdir,
149     [  --with-logdir          deprecated, use logfile in amanda.conf],
150     [   AC_MSG_ERROR([*** --with-logdir is deprecated, use logdir in amanda.conf instead.])
151     ],)
152
153 AC_ARG_WITH(suffixes,
154     [  --with-suffixes        install binaries with version string appended to name],
155     USE_VERSION_SUFFIXES=$withval,
156     : ${USE_VERSION_SUFFIXES=no}
157 )
158 case "$USE_VERSION_SUFFIXES" in
159 y | ye | yes)
160     AC_DEFINE(USE_VERSION_SUFFIXES, 1,
161         [Define to have programs use version suffixes when calling other programs.])
162
163     program_suffix="-$VERSION"
164     # This is from the output of configure.in.
165     if test "$program_transform_name" = s,x,x,; then
166         program_transform_name=
167     else
168         # Double any \ or $.  echo might interpret backslashes.
169         cat <<\EOF_SED > conftestsed
170 s,\\,\\\\,g; s,\$,$$,g
171 EOF_SED
172         program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
173         rm -f conftestsed
174     fi
175     test "$program_prefix" != NONE &&
176         program_transform_name="s,^,${program_prefix},; $program_transform_name"
177     # Use a double $ so make ignores it.
178     test "$program_suffix" != NONE &&
179         program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
180
181     # sed with no file args requires a program.
182     test "$program_transform_name" = "" && program_transform_name="s,x,x,"
183     # Remove empty command
184     cat <<\EOF_SED > conftestsed
185 s,\;\;,\;,g; s,\; \$,,g; s,\;$,,g
186 EOF_SED
187     program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
188     rm -f conftestsed
189   ;;
190 n | no) USE_VERSION_SUFFIXES=no
191   ;;
192 *) AC_MSG_ERROR([*** You must not supply an argument to --with-suffixes option.])
193   ;;
194 esac
195 AC_SUBST(USE_VERSION_SUFFIXES)
196
197 case "$target" in
198     *-hp-*)
199         CLIENT_SCRIPTS_OPT=amhpfixdevs
200         ;;
201     *-sni-sysv4)
202         CLIENT_SCRIPTS_OPT=amsinixfixdevs
203         ;;
204     *)
205         CLIENT_SCRIPTS_OPT=
206         ;;
207 esac
208
209 AC_SUBST(CLIENT_SCRIPTS_OPT)
210
211 AC_ARG_WITH(client-only,
212     [  --with-client-only     deprecated, use --without-server],
213     [   AC_MSG_ERROR([*** --with-client-only is deprecated, use --without-server instead.])
214     ],)
215 AC_ARG_WITH(server-only,
216     [  --with-server-only     deprecated, use --without-client],
217     [   AC_MSG_ERROR([*** --with-server-only is deprecated, use --without-client instead.])
218     ],)
219
220 AC_ARG_WITH(client,
221     [  --without-client       do not build client stuff],
222     [
223         case "$withval" in
224         y | ye | yes) NO_CLIENT_MODE=false;;
225         n | no) NO_CLIENT_MODE=true;;
226         *)
227             AC_MSG_ERROR([*** You must not supply an argument to --with-client option.])
228           ;;
229         esac
230     ]
231 )
232
233 AC_ARG_WITH(server,
234     [  --without-server       do not build server stuff (set --without-restore)],
235     [
236         case "$withval" in
237         y | ye | yes) NO_SERVER_MODE=false ;;
238         n | no) NO_SERVER_MODE=true;NO_RESTORE_MODE=true;;
239         *)
240             AC_MSG_ERROR([*** You must not supply an argument to --with-server option.  Maybe you meant --with-index-server=$withval])
241           ;;
242         esac
243     ]
244 )
245 if test "x${NO_SERVER_MODE+set}" != xset ; then
246    NO_SERVER_MODE=false
247 fi
248
249 AC_ARG_WITH(restore,
250     [  --without-restore      do not build amrestore nor amidxtaped],
251     [
252         case "$withval" in
253         y | ye | yes) NO_RESTORE_MODE=false;;
254         n | no) NO_RESTORE_MODE=true;;
255         *)
256             AC_MSG_ERROR([*** You must not supply an argument to --with-restore option.])
257           ;;
258         esac
259     ]
260 )
261 if test "x${NO_RESTORE_MODE+set}" != xset ; then
262    NO_RESTORE_MODE=${NO_SERVER_MODE-false}
263 fi
264
265 if ${NO_SERVER_MODE-false}; then
266    if ${NO_RESTORE_MODE-false}; then
267       dnl
268       dnl --without-server and --without-restore is OK
269       dnl
270       true
271    else
272       AC_MSG_ERROR([*** --without-server requires --without-restore])
273    fi
274 fi
275
276 AC_ARG_WITH(amrecover,
277     [  --without-amrecover    do not build amrecover],
278     [
279         case "$withval" in
280         y | ye | yes)
281             if ${NO_CLIENT_MODE-false}; then
282                 AC_MSG_ERROR([*** --without-client and --with-amrecover are incompatible])
283             fi
284             NO_RECOVER_MODE=false;;
285         n | no) NO_RECOVER_MODE=true;;
286         *)
287             AC_MSG_ERROR([*** You must not supply an argument to --with-amrecover option.])
288           ;;
289         esac
290     ]
291 )
292
293 AC_ARG_WITH(index-server,
294    [  --with-index-server=HOST default amanda index server [`uname -n`]],
295    [
296         case "$withval" in
297         "" | y | ye | yes | n | no)
298             AC_MSG_ERROR([*** You must supply an argument to the --with-index-server option.])
299           ;;
300         *) DEFAULT_SERVER="$withval"
301           ;;
302         esac
303    ],
304    : ${DEFAULT_SERVER=`uname -n`}
305 )
306 AC_DEFINE_UNQUOTED(DEFAULT_SERVER,"$DEFAULT_SERVER",
307   [This is the default Amanda index server. ])
308 AC_SUBST(DEFAULT_SERVER)
309
310 AC_ARG_WITH(force-uid,
311     [  --without-force-uid    do not force the uid to --with-user],
312     FORCE_USERID="$withval",
313     : ${FORCE_USERID=yes}
314 )
315 case "$FORCE_USERID" in
316 y | ye | yes) AC_DEFINE(FORCE_USERID, 1,
317         [Define to force to another user on client machines. ])
318   ;;
319 n | no) :
320   ;;
321 *) AC_MSG_ERROR([*** You must not supply an argument to --with-force-uid option.])
322 esac
323
324 AC_ARG_WITH(user,
325     [  --with-user=USER       force execution to USER on client systems [required]],
326     [
327         case "$withval" in
328         "" | y | ye | yes | n | no)
329             AC_MSG_ERROR([*** You must supply an argument to the --with-user option.])
330           ;;
331         *) CLIENT_LOGIN="$withval"
332           ;;
333         esac
334     ]
335 )
336 if test "x${CLIENT_LOGIN+set}" != xset; then
337     AC_MSG_ERROR([*** --with-user=USER is missing])
338 fi
339 AC_DEFINE_UNQUOTED(CLIENT_LOGIN,"$CLIENT_LOGIN",
340   [Define as a the user to force to on client machines. ])
341 AC_SUBST(CLIENT_LOGIN)
342
343 AC_ARG_WITH(group,
344     [  --with-group=GROUP     group allowed to execute setuid-root programs [required]],
345     [
346         case "$withval" in
347         "" | y | ye | yes | n | no)
348             AC_MSG_ERROR([*** You must supply an argument to the --with-group option.])
349           ;;
350         *) SETUID_GROUP="$withval"
351           ;;
352         esac
353     ]
354 )
355 if test "x${SETUID_GROUP+set}" != xset; then
356     AC_MSG_ERROR([*** --with-group=GROUP is missing])
357 fi
358 AC_SUBST(SETUID_GROUP)
359
360 AC_ARG_WITH(owner,
361     [  --with-owner=USER       force ownership of files to USER [default == --with-user value]],
362     [
363         case "$withval" in
364         "" | y | ye | yes | n | no)
365             AC_MSG_ERROR([*** You must supply an argument to the --with-owner option.])
366           ;;
367         *) BINARY_OWNER="$withval"
368           ;;
369         esac
370     ]
371 )
372 if test "x${BINARY_OWNER+set}" != xset ; then
373    BINARY_OWNER=$CLIENT_LOGIN
374 fi
375 AC_DEFINE_UNQUOTED(BINARY_OWNER,"$BINARY_OWNER",
376   [Define as the user who owns installed binaries. ])
377 AC_SUBST(BINARY_OWNER)
378
379 AC_ARG_WITH(rundump,
380     [  --with-rundump         use rundump (setuid-root) to invoke dump],
381     [
382     case "$withval" in
383         n | no | y | ye | yes) FORCE_USE_RUNDUMP="$withval";;
384         *) AC_MSG_ERROR([*** You must not supply an argument to --with-rundump option.]);;
385     esac
386     ]
387 )
388
389 AC_ARG_WITH(config,
390    [  --with-config=CONFIG   default configuration [DailySet1]],
391    [
392         case "$withval" in
393         "" | y | ye | yes | n | no)
394             AC_MSG_ERROR([*** You must supply an argument to the --with-config option.])
395           ;;
396         *) DEFAULT_CONFIG="$withval"
397           ;;
398         esac
399    ],
400    : ${DEFAULT_CONFIG=DailySet1}
401 )
402 AC_DEFINE_UNQUOTED(DEFAULT_CONFIG,"$DEFAULT_CONFIG",
403   [This is the default Amanda configuration. ])
404 AC_SUBST(DEFAULT_CONFIG)
405
406 AC_ARG_WITH(tape-server,
407     [  --with-tape-server=HOST default restoring tape server is HOST [same as --with-index-server]],
408     [
409         case "$withval" in
410         "" | y | ye | yes | n | no)
411             AC_MSG_ERROR([*** You must supply an argument to the --with-tape-server option.])
412           ;;
413         *) DEFAULT_TAPE_SERVER="$withval"
414           ;;
415         esac
416     ],
417     : ${DEFAULT_TAPE_SERVER=$DEFAULT_SERVER}
418 )
419 AC_DEFINE_UNQUOTED(DEFAULT_TAPE_SERVER,"$DEFAULT_TAPE_SERVER",[This is the default restoring Amanda tape server. ])
420 AC_SUBST(DEFAULT_TAPE_SERVER)
421
422 AC_ARG_WITH(tape-device,
423     [  --with-tape-device=ARG restoring tape server HOST's no rewinding tape drive],
424     [
425         case "$withval" in
426         "" | y | ye | yes | n | no)
427             AC_MSG_ERROR([*** You must supply an argument to the --with-tape-device option.])
428           ;;
429         *) DEFAULT_TAPE_DEVICE="$withval"
430           ;;
431         esac
432     ],
433     [
434         if test -z "$DEFAULT_TAPE_DEVICE"; then
435             AC_MSG_CHECKING(for non-rewinding tape device)
436             dnl Check for the /dev/rmt directory and use what's in there.
437             dnl Otherwise look for tape devices in /dev.  For the devices
438             dnl in /dev/rmt, we want to use the Berkeley behavior of
439             dnl reading the first record of the next tape file after 0
440             dnl bytes are returned upon reading to the next tape mark,
441             dnl instead of returning an error.  Look for devices that have
442             dnl a 'b' in their name.
443             tape_dev=/dev/null
444             nr_tape_dev=/dev/null
445             if test -d /dev/rmt; then
446
447                 dnl See if we can find two devices, one being the norewind
448                 dnl version of the other.  Devices in this directory are
449                 dnl normally a digit followed by some characters.  We also
450                 dnl want the Berkely behavior, since Amanda needs it for
451                 dnl amrestore.
452
453                 for num in 9 8 7 6 5 4 3 2 1 0; do
454                     td=/dev/rmt/${num}b
455                     ntd=/dev/rmt/${num}bn
456                     if test -r $td -a -r $ntd; then
457                         tape_dev=$td
458                         nr_tape_dev=$ntd
459                     fi
460                 done
461             else
462                 dnl Look for tape devices in /dev.
463                 for num in 9 8 7 6 5 4 3 2 1 0; do
464                     td=/dev/rst${num}
465                     ntd=/dev/nrst${num}
466                     if test -r $td -a -r $ntd; then
467                         tape_dev=$td
468                         nr_tape_dev=$ntd
469                     fi
470                 done
471             fi
472             DEFAULT_TAPE_DEVICE=$nr_tape_dev
473             AC_MSG_RESULT($DEFAULT_TAPE_DEVICE)
474         fi
475     ]
476 )
477
478 if test -z "$DEFAULT_TAPE_DEVICE"; then
479     DEFAULT_TAPE_DEVICE=/dev/null
480 fi
481
482 AC_DEFINE_UNQUOTED(DEFAULT_TAPE_DEVICE,"$DEFAULT_TAPE_DEVICE",[This is the default no-rewinding tape device. ])
483 AC_SUBST(DEFAULT_TAPE_DEVICE)
484
485 AC_ARG_WITH(ftape-raw-device,
486     [  --with-ftape-rawdevice=ARG raw device on tape server HOST's if using Linux ftape >=3.04d],
487     [
488         case "$withval" in
489         "" | y | ye | yes | n | no)
490             AC_MSG_ERROR([*** You must supply an argument to the --with-ftape-rawdevice option.])
491           ;;
492         *) DEFAULT_RAW_TAPE_DEVICE="$withval"
493           ;;
494         esac
495     ],
496     [
497         if test -z "$DEFAULT_RAW_TAPE_DEVICE"; then
498             AC_MSG_CHECKING(for raw ftape device)
499             dnl Look for tape devices in /dev.  
500             raw_tape_dev=/dev/null
501                 dnl Look for tape devices in /dev.
502                 for num in 3 2 1 0 ; do
503                     td=/dev/rawft${num}
504                     if test -r $td; then
505                         raw_tape_dev=$td
506                     fi
507                 done
508             DEFAULT_RAW_TAPE_DEVICE=$raw_tape_dev
509             AC_MSG_RESULT($DEFAULT_RAW_TAPE_DEVICE)
510         fi
511     ]
512 )
513
514 if test -z "$DEFAULT_RAW_TAPE_DEVICE"; then
515     DEFAULT_RAW_TAPE_DEVICE=/dev/null
516 fi
517
518 AC_DEFINE_UNQUOTED(DEFAULT_RAW_TAPE_DEVICE,"$DEFAULT_RAW_TAPE_DEVICE",[For Linux systems with floppy tapes: 
519  * QIC volume table support via raw tape device. ])
520 AC_SUBST(DEFAULT_RAW_TAPE_DEVICE)
521
522 AC_ARG_WITH(rew-tape,
523     [  --with-rew-tape        deprecated, use --with-tape-device],
524     [   AC_MSG_ERROR([*** --with-rew-tape is deprecated, use --with-tape-device instead.])
525     ],)
526
527 AC_ARG_WITH(norew-tape,
528     [  --with-norew-tape=ARG  deprecated, use --with-tape-device],
529     [   AC_MSG_ERROR([*** --with-norew-tape is deprecated, use --with-tape-device instead.])
530     ],)
531
532 AC_ARG_WITH(changer-device,
533     [  --with-changer-device=ARG default tape changer device [/dev/ch0 if it exists]],
534     [
535         case "$withval" in
536         "" | y | ye | yes | n | no)
537             AC_MSG_ERROR([*** You must supply an argument to the --with-changer-device option.])
538           ;;
539         *) DEFAULT_CHANGER_DEVICE="$withval"
540           ;;
541         esac
542     ],
543     [
544         if test -z "$DEFAULT_CHANGER_DEVICE" &&
545            test -f /dev/ch0; then
546             DEFAULT_CHANGER_DEVICE=/dev/ch0
547         fi
548     ]
549 )
550
551 if test -z "$DEFAULT_CHANGER_DEVICE"; then
552     DEFAULT_CHANGER_DEVICE=/dev/null
553 fi
554
555 AC_DEFINE_UNQUOTED(DEFAULT_CHANGER_DEVICE,"$DEFAULT_CHANGER_DEVICE",[This is the default changer device. ])
556 AC_SUBST(DEFAULT_CHANGER_DEVICE)
557
558 AC_ARG_WITH(fqdn,
559     [  --with-fqdn            use FQDN's to backup multiple networks],
560     USE_FQDN=$withval,
561     : ${USE_FQDN=no}
562 )
563 case "$USE_FQDN" in
564 n | no) : ;;
565 y |  ye | yes) AC_DEFINE(USE_FQDN,1,[Define for backups being done on a multiple networks and FQDNs are used. ])
566   ;;
567 *) AC_MSG_ERROR([*** You must not supply an argument to --with-fqdn option.])
568   ;;
569 esac
570
571 AC_ARG_WITH(broken-fsf,
572     [  --with-broken-fsf      only enable if tape fsf calls fail mid-file],
573     HAVE_BROKEN_FSF=$withval,
574     : ${HAVE_BROKEN_FSF=no}
575 )
576 case "$HAVE_BROKEN_FSF" in
577 n | no) : ;;
578 y |  ye | yes) AC_DEFINE(HAVE_BROKEN_FSF,1,[Define this if issuing a fsf on a tape fails when you are not at a tape
579  * mark, for instance, if amrecover gives I/O errors when skipping.
580 ])
581   ;;
582 *) AC_MSG_ERROR([*** You must not supply an argument to --with-broken-fsf option.])
583   ;;
584 esac
585
586 AC_ARG_WITH(gnutar,
587     [  --with-gnutar[=PROG]     use PROG as GNU tar executable [default: looks for one]],
588     [
589         case "$withval" in
590             /*) GNUTAR="$withval";;
591             y|ye|yes) :;;
592             n|no) GNUTAR=;;
593             *)  AC_MSG_ERROR([*** You must supply a full pathname to --with-gnutar]);;
594         esac
595     ]
596 )
597
598 AC_ARG_WITH(qde,
599     [   --with-qde                use quick-and-dirty estimates for gnutar ],
600     USE_QUICK_AND_DIRTY_ESTIMATES=$withval,
601     : ${USE_QUICK_AND_DIRTY_ESTIMATES=no}
602 )
603 case "$USE_QUICK_AND_DIRTY_ESTIMATES" in
604 n | no) : USE_QUICK_AND_DIRTY_ESTIMATES=no;;
605 y |  ye | yes) : USE_QUICK_AND_DIRTY_ESTIMATES=yes
606         AC_DEFINE(USE_QUICK_AND_DIRTY_ESTIMATES,1,[ Define if you want to use amqde instead of gnutar for estimates ])
607   ;;
608 *) AC_MSG_ERROR([*** You must not supply an argument to --with-qde option.])
609   ;;
610 esac
611
612
613 AC_ARG_WITH(smbclient,
614     [  --with-smbclient[=PROG]   use PROG as Samba's smbclient executable [default: looks for one]],
615     [
616         case "$withval" in
617             /*) SAMBA_CLIENT="$withval";;
618             y|ye|yes) :;;
619             n|no) SAMBA_CLIENT="no";;
620             *)  AC_MSG_ERROR([*** You must supply a full pathname to --with-smbclient]);;
621         esac
622     ]
623 )
624
625 AC_ARG_WITH(samba-user,
626    [  --with-samba-user was deprecated],
627    [    AC_MSG_ERROR([*** The samba-user option was deprecated, the username go in the amandapass])
628    ]
629 )
630
631 AC_ARG_WITH(gnutar-listdir,
632    [  --with-gnutar-listdir=DIR  gnutar directory lists go in DIR [localstatedir/amanda/gnutar-lists]],
633    [
634         case "$withval" in
635             n | no)             unset GNUTAR_LISTDIR ;;
636             y | ye | yes)       : ${GNUTAR_LISTDIR=$localstatedir/amanda/gnutar-lists} ;;
637             /*)                 GNUTAR_LISTDIR="$withval" ;;
638             *)                  AC_MSG_ERROR([*** You must supply a full pathname to --with-gnutar-listdir])
639         esac
640     ],
641     : ${GNUTAR_LISTDIR=$localstatedir/amanda/gnutar-lists}
642 )
643 if test "$GNUTAR_LISTDIR"; then
644     GNUTAR_LISTDIR=`(
645         test "x$prefix" = xNONE && prefix=$ac_default_prefix
646         eval echo "$GNUTAR_LISTDIR"
647     )`
648     AC_DEFINE_UNQUOTED(GNUTAR_LISTED_INCREMENTAL_DIR,"$GNUTAR_LISTDIR",[The directory in which GNU tar should store directory lists for incrementals. ])
649     GNUTAR_LISTED_INCREMENTAL_DIRX=$GNUTAR_LISTDIR
650 else
651     GNUTAR_LISTED_INCREMENTAL_DIRX=
652 fi
653 AC_SUBST(GNUTAR_LISTED_INCREMENTAL_DIRX)
654
655 AC_ARG_WITH(gnutar-listed-incremental,
656    [  --with-gnutar-listed-incremental was deprecated, use --with-gnutar-listdir],
657    [    AC_MSG_ERROR([*** The gnutar-listed-incremental option was deprecated, use gnutar-listdir instead])
658    ]
659 )
660
661 AC_ARG_WITH(bsd-security,
662     [  --without-bsd-security do not use BSD rsh/rlogin style security],
663     BSD_SECURITY=$withval,
664     : ${BSD_SECURITY=yes}
665 )
666 case "$BSD_SECURITY" in
667 n | no) : ;;
668 y |  ye | yes) AC_DEFINE(BSD_SECURITY,1,[Define to use BSD .rhosts/.amandahosts security. ])
669   ;;
670 *) AC_MSG_ERROR([*** You must not supply an argument to --with-bsd-security option.])
671   ;;
672 esac
673
674 AC_ARG_WITH(amandahosts,
675     [  --without-amandahosts  use .rhosts instead of .amandahosts],
676     USE_AMANDAHOSTS=$withval,
677     : ${USE_AMANDAHOSTS=yes}
678 )
679 case "$USE_AMANDAHOSTS" in
680 n | no) : ;;
681 y |  ye | yes) :
682   case "$BSD_SECURITY" in
683   y | ye | yes) AC_DEFINE(USE_AMANDAHOSTS,1,[Define if you want to use the .amandahosts for BSD security. ])
684     ;;
685   esac
686   ;;
687 *) AC_MSG_ERROR([*** You must not supply an argument to --with-amandahosts option.])
688   ;;
689 esac
690
691 dnl Specify --with-krb4-security if Kerberos software is in somewhere
692 dnl other than the listed KRB4_SPOTS.  We only compile kerberos support in
693 dnl if the right files are there.
694
695 : ${KRB4_SPOTS="/usr/kerberos /usr/cygnus /usr /opt/kerberos"}
696
697 AC_ARG_WITH(krb4-security,
698     [  --with-krb4-security=DIR   Location of Kerberos software [/usr/kerberos /usr/cygnus /usr /opt/kerberos]],
699     KRB4_SECURITY="$withval",
700     : ${KRB4_SECURITY=no}
701 )
702
703 case "$KRB4_SECURITY" in
704 n | no) KRB4_SECURITY=no ;;
705 y | ye | yes) : ;;
706 *) KRB4_SPOTS="$KRB4_SECURITY"
707    KRB4_SECURITY=yes
708    ;;
709 esac
710
711 AC_MSG_CHECKING(for Kerberos and Amanda kerberos4 bits)
712 if test "${KRB4_SECURITY}" = yes -a -f  ${srcdir-.}/common-src/krb4-security.c ; then
713     for dir in $KRB4_SPOTS; do
714         if test -f ${dir}/lib/libkrb.a -a -f ${dir}/lib/libdes.a ; then
715             #
716             # This is the original Kerberos 4.
717             #
718             AC_MSG_RESULT(found in $dir)
719             KRB4_SECURITY=yes
720             AC_DEFINE(KRB4_SECURITY, 1, [Enable Kerberos security. ])
721             if test -d $dir/include/kerberosIV ; then
722                 #
723                 # This handles BSD/OS.
724                 #
725                 KRB4INCLUDES=-I$dir/include/kerberosIV
726             else
727                 KRB4INCLUDES=-I$dir/include
728             fi
729             KRB4LDFLAGS=-L$dir/lib
730             KRB4LIBS="-lkrb -ldes"
731             if test -f ${dir}/lib/libcom_err.a ; then
732                 KRB4LIBS="$KRB4LIBS -lcom_err"
733             fi
734             if test -f ${dir}/lib/libroken.a ; then
735                 KRB4LIBS="$KRB4LIBS -lroken"
736             fi
737             break
738         elif test -f ${dir}/lib/libkrb4.a &&
739              test -f ${dir}/lib/libcrypto.a &&
740              test -f ${dir}/lib/libdes425.a ; then
741             #
742             # This is Kerberos 5 with Kerberos 4 back-support.
743             #
744             AC_MSG_RESULT(found in $dir)
745             KRB4_SECURITY=yes
746             AC_DEFINE(KRB4_SECURITY, 1, [Enable Kerberos security. ])
747             KRB4INCLUDES="-I$dir/include -I$dir/include/kerberosIV"
748             KRB4LDFLAGS=-L$dir/lib
749             if test -f ${dir}/lib/libkrb5.a &&
750                test -f ${dir}/lib/libcom_err.a; then
751                 KRB4LIBS="-lkrb4 -lkrb5 -lcrypto -ldes425 -lcom_err"
752             else
753                 KRB4LIBS="-lkrb4 -lcrypto -ldes425"
754             fi
755             break
756         elif test -f ${dir}/lib/libkrb4.dylib &&
757              test -f ${dir}/lib/libcrypto.dylib &&
758              test -f ${dir}/lib/libdes425.dylib ; then
759             #
760             # This is Kerberos 5 with Kerberos 4 back-support for Mac OS X.
761             #
762             AC_MSG_RESULT(found in $dir)
763             KRB4_SECURITY=yes
764             AC_DEFINE(KRB4_SECURITY, 1, [Enable Kerberos security. ])
765             KRB4INCLUDES="-I$dir/include -I$dir/include/kerberosIV"
766             KRB4LDFLAGS=-L$dir/lib
767             if test -f ${dir}/lib/libkrb5.dylib &&
768                test -f ${dir}/lib/libcom_err.dylib; then
769                 KRB4LIBS="-lkrb4 -lkrb5 -lcrypto -ldes425 -lcom_err"
770             else
771                 KRB4LIBS="-lkrb4 -lcrypto -ldes425"
772             fi
773             break
774         fi
775     done
776
777     if test "$KRB4LDFLAGS" = "" ; then
778         AC_MSG_ERROR([*** Kerberos IV not found.])
779     fi
780 else
781     AC_MSG_RESULT(no)
782 fi
783
784 AC_ARG_WITH(server-principal,
785     [    --with-server-principal=ARG    server host principal  ["amanda"]],
786     [
787         case "$withval" in
788         "" | y | ye | yes | n | no)
789             AC_MSG_ERROR([*** You must supply an argument to the --with-server-principal option.])
790           ;;
791         *)
792             SERVER_HOST_PRINCIPLE="$withval"
793           ;;
794         esac
795     ],
796     : ${SERVER_HOST_PRINCIPLE="amanda"}
797 )
798 AC_DEFINE_UNQUOTED(SERVER_HOST_PRINCIPLE,"$SERVER_HOST_PRINCIPLE",[The Kerberos server principle. ])
799
800 AC_ARG_WITH(server-instance,
801     [    --with-server-instance=ARG     server host instance   ["amanda"]],
802     [
803         case "$withval" in
804         "" | y | ye | yes | n | no)
805             AC_MSG_ERROR([*** You must supply an argument to the --with-server-instance option.])
806           ;;
807         *) SERVER_HOST_INSTANCE="$withval"
808           ;;
809         esac
810     ],
811     : ${SERVER_HOST_INSTANCE="amanda"}
812 )
813 AC_DEFINE_UNQUOTED(SERVER_HOST_INSTANCE,"$SERVER_HOST_INSTANCE",[The Kerberos server instance. ])
814
815 AC_ARG_WITH(server-keyfile,
816     [    --with-server-keyfile=ARG      server host key file   ["/.amanda"]],
817     [
818         case "$withval" in
819         "" | y | ye | yes | n | no)
820             AC_MSG_ERROR([*** You must supply an argument to the --with-server-keyfile option.])
821           ;;
822         *) SERVER_HOST_KEY_FILE="$withval"
823           ;;
824         esac
825     ],
826     : ${SERVER_HOST_KEY_FILE="/.amanda"}
827 )
828 AC_DEFINE_UNQUOTED(SERVER_HOST_KEY_FILE,"$SERVER_HOST_KEY_FILE",[The Kerberos server key file. ])
829
830 AC_ARG_WITH(client-principal,
831     [    --with-client-principal=ARG    client host principal  ["rcmd"]],
832     [
833         case "$withval" in
834         "" | y | ye | yes | n | no)
835             AC_MSG_ERROR([*** You must supply an argument to the --with-client-principal option.])
836           ;;
837         *) CLIENT_HOST_PRINCIPLE="$withval"
838           ;;
839         esac
840     ],
841     : ${CLIENT_HOST_PRINCIPLE="rcmd"}
842 )
843 AC_DEFINE_UNQUOTED(CLIENT_HOST_PRINCIPLE,"$CLIENT_HOST_PRINCIPLE",[The Kerberos client host principle. ])
844
845 AC_ARG_WITH(client-instance,
846     [    --with-client-instance=ARG     client host instance   [HOSTNAME_INSTANCE]],
847     [
848         case "$withval" in
849         "" | y | ye | yes | n | no)
850             AC_MSG_ERROR([*** You must supply an argument to the --with-client-instance option.])
851           ;;
852         *) CLIENT_HOST_INSTANCE="$withval"
853           ;;
854         esac
855     ],
856     : ${CLIENT_HOST_INSTANCE=HOSTNAME_INSTANCE}
857 )
858 AC_DEFINE_UNQUOTED(CLIENT_HOST_INSTANCE,$CLIENT_HOST_INSTANCE,[The Kerberos client host instance. ])
859
860 AC_ARG_WITH(client-keyfile,
861     [    --with-client-keyfile=ARG      client host key file   [KEYFILE]],
862     [
863         case "$withval" in
864         "" | y | ye | yes | n | no)
865             AC_MSG_ERROR([*** You must supply an argument to the --with-client-keyfile option.])
866           ;;
867         *) CLIENT_HOST_KEY_FILE="$withval"
868           ;;
869         esac
870     ],
871     : ${CLIENT_HOST_KEY_FILE=KEYFILE}
872 )
873
874 # Assume it's either KEYFILE (defined in krb.h), or a string filename...
875 if test "$CLIENT_HOST_KEY_FILE" != "KEYFILE"; then
876   CLIENT_HOST_KEY_FILE="\"$CLIENT_HOST_KEY_FILE\""
877 fi
878
879 AC_DEFINE_UNQUOTED(CLIENT_HOST_KEY_FILE,$CLIENT_HOST_KEY_FILE,[The Kerberos client host key file. ])
880
881 AC_ARG_WITH(ticket-lifetime,
882     [    --with-ticket-lifetime=ARG     ticket lifetime        [128]],
883     [
884         case "$withval" in
885         "" | y | ye | yes | n | no)
886             AC_MSG_ERROR([*** You must supply an argument to the --with-ticket-lifetime option.])
887           ;;
888         *) TICKET_LIFETIME="$withval"
889           ;;
890         esac
891     ],
892     : ${TICKET_LIFETIME=128}
893 )
894 AC_DEFINE_UNQUOTED(TICKET_LIFETIME,$TICKET_LIFETIME,[The Kerberos ticket lifetime. ])
895
896
897 AC_ARG_WITH(portrange,
898     [  --with-portrange=low,high     bind unreserved TCP server sockets to ports within this range [unlimited]],
899     [
900         TCPPORTRANGE="$withval"
901     ]
902 )
903 AC_ARG_WITH(tcpportrange,
904     [  --with-tcpportrange=low,high  bind unreserved TCP server sockets to ports within this range [unlimited]],
905     [
906         TCPPORTRANGE="$withval"
907     ]
908 )
909 if test x"${TCPPORTRANGE+set}" = x"set"; then
910     if test x`echo "$TCPPORTRANGE" | sed 's/[[0-9]][[0-9]]*,[[0-9]][[0-9]]*//'` != x""; then
911         AC_MSG_ERROR([*** --with-tcpportrange requires two comma-separated positive numbers])
912     fi
913     min_tcp_port=`echo "$TCPPORTRANGE" | sed 's/,.*//'`
914     max_tcp_port=`echo "$TCPPORTRANGE" | sed 's/.*,//'`
915     if test $min_tcp_port -gt $max_tcp_port; then
916         AC_MSG_ERROR([*** the second TCP port number must be greater than the first in --with-tcpportrange])
917     fi
918     if test $min_tcp_port -lt 1024; then
919         AC_MSG_WARN([*** the TCP port range should be 1024 or greater in --with-tcpportrange])
920     fi
921     if test $max_tcp_port -ge 65536; then
922         AC_MSG_WARN([*** the TCP port range should be less than 65536 in --with-tcpportrange])
923     fi
924     AC_DEFINE_UNQUOTED(TCPPORTRANGE,$TCPPORTRANGE,[A comma-separated list of two integers, determining the minimum and
925    maximum unreserved TCP port numbers sockets should be bound to. ])
926 fi
927
928 AC_ARG_WITH(udpportrange,
929     [  --with-udpportrange=low,high  bind reserved UDP server sockets to ports within this range [unlimited]],
930     [
931         UDPPORTRANGE="$withval"
932     ]
933 )
934 if test x"${UDPPORTRANGE+set}" = x"set"; then
935     if test x`echo "$UDPPORTRANGE" | sed 's/[[0-9]][[0-9]]*,[[0-9]][[0-9]]*//'` != x""; then
936         AC_MSG_ERROR([*** --with-udpportrange requires two comma-separated positive numbers])
937     fi
938     min_udp_port=`echo "$UDPPORTRANGE" | sed 's/,.*//'`
939     max_udp_port=`echo "$UDPPORTRANGE" | sed 's/.*,//'`
940     if test $min_udp_port -gt $max_udp_port; then
941         AC_MSG_ERROR([*** the second UDP port number must be greater than the first in --with-udpportrange])
942     fi
943     if test $max_udp_port -ge 1024; then
944         AC_MSG_WARN([*** the UDP port range should be less than 1024 in --with-udpportrange])
945     fi
946     if test $min_udp_port -le 0; then
947         AC_MSG_WARN([*** the UDP port range should be greater than 0 in --with-udpportrange])
948     fi
949     AC_DEFINE_UNQUOTED(UDPPORTRANGE,$UDPPORTRANGE,[A comma-separated list of two integers, determining the minimum and
950    maximum reserved UDP port numbers sockets should be bound to. ])
951 fi
952
953 AC_ARG_WITH(maxtapeblocksize,
954     [  --with-maxtapeblocksize=kb            Maximum size of a tape block],
955     [
956         MAXTAPEBLOCKSIZE="$withval"
957     ],
958     : ${MAXTAPEBLOCKSIZE=32}
959 )
960
961 AC_DEFINE_UNQUOTED(MAX_TAPE_BLOCK_KB,($MAXTAPEBLOCKSIZE),[Maximum size of a tape block in KBytes.])
962 AC_SUBST(MAXTAPEBLOCKSIZE)
963
964 AC_ARG_WITH(db,
965     [  --with-db={text,db,dbm,gdbm,ndbm} use the selected database format [text]],
966     [
967         case "$withval" in
968         "" | y | ye | yes | n | no)
969             AC_MSG_ERROR([*** You must supply an argument to the --with-db option.])
970           ;;
971         *) DB_STYLE="$withval"
972           ;;
973         esac
974     ]
975 )
976 if test "$DB_STYLE"; then
977     case "$DB_STYLE" in
978         db | dbm | gdbm | ndbm | text)  ;;
979         *)
980             AC_MSG_ERROR([*** Unknown argument $DB_STYLE given to --with-db.  Choose from db, dbm, gdbm, ndbm, text.])
981             DB_STYLE=
982             ;;
983     esac
984 fi
985
986 AC_ARG_WITH(mmap,
987     [  --with-mmap            force use of mmap instead of shared memory support],
988     FORCE_MMAP=$withval,
989     : ${FORCE_MMAP=no}
990 )
991 case "$FORCE_MMAP" in
992 y | ye | yes | n | no) : ;;
993 *) AC_MSG_ERROR([*** You must not supply an argument to --with-mmap.])
994   ;;
995 esac
996
997 AC_ARG_WITH(buffered-dump,
998     [  --with-buffered-dump   buffer the dumping sockets on the server for speed],
999     DUMPER_SOCKET_BUFFERING=$withval,
1000     : ${DUMPER_SOCKET_BUFFERING=no}
1001 )
1002 case "$DUMPER_SOCKET_BUFFERING" in
1003 n | no) :
1004   ;;
1005 y | ye | yes) AC_DEFINE(DUMPER_SOCKET_BUFFERING,1,[Define if dumper should buffer the sockets for faster throughput. ])
1006   ;;
1007 *) AC_MSG_ERROR([*** You must not supply an argument to --with-buffered-dump.])
1008   ;;
1009 esac
1010
1011 AC_ARG_WITH(assertions,
1012     [  --with-assertions      compile assertions into code],
1013     ASSERTIONS="$withval",
1014     : ${ASSERTIONS=no}
1015 )
1016 case "$ASSERTIONS" in
1017 n | no) : ;;
1018 y |  ye | yes) AC_DEFINE(ASSERTIONS,1,[Define if you want assertion checking. ])
1019   ;;
1020 *) AC_MSG_ERROR([*** You must not supply an argument to --with-assertions option.])
1021   ;;
1022 esac
1023
1024 AC_ARG_WITH(tmpdir,
1025     [  --with-tmpdir[=/temp/dir] area Amanda can use for temp files [/tmp/amanda]],
1026     tmpdir="$withval",
1027     : ${tmpdir=yes}
1028 )
1029 tmpdir=`(
1030     test "x$prefix" = xNONE && prefix=$ac_default_prefix
1031     test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
1032     eval echo "$tmpdir"
1033 )`
1034 case "$tmpdir" in
1035 n | no) AC_MSG_ERROR([*** --without-tmpdir is not allowed.]);;
1036 y |  ye | yes)
1037         AMANDA_TMPDIR="/tmp/amanda";;
1038 /*)
1039         AMANDA_TMPDIR="$tmpdir";;
1040 *) AC_MSG_ERROR([*** You must supply a full pathname to --with-tmpdir option.]);;
1041 esac
1042 AC_DEFINE_UNQUOTED(AMANDA_TMPDIR,"$AMANDA_TMPDIR",[The directory in which Amanda should create temporary files. ])
1043 AC_SUBST(AMANDA_TMPDIR)
1044
1045 AC_ARG_WITH(debugging,
1046     [  --with[out]-debugging[=/debug/dir] [do not] record runtime debugging information in specified directory [--with-tmpdir]],
1047     debugging="$withval",
1048     : ${debugging=yes}
1049 )
1050 debugging=`(
1051     test "x$prefix" = xNONE && prefix=$ac_default_prefix
1052     test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
1053     eval echo "$debugging"
1054 )`
1055 case "$debugging" in
1056 n | no) AMANDA_DBGDIR="";;
1057 y |  ye | yes) AMANDA_DBGDIR="$AMANDA_TMPDIR" ;;
1058 /*) AMANDA_DBGDIR="$debugging" ;;
1059 *) AC_MSG_ERROR([*** You must supply a full pathname to --with-debugging option.])
1060   ;;
1061 esac
1062 case "$AMANDA_DBGDIR" in
1063 "") :;;
1064 *) AC_DEFINE(DEBUG_CODE,1,[Define if you want debugging. ])
1065    AC_DEFINE_UNQUOTED(AMANDA_DBGDIR,"$AMANDA_DBGDIR",[Location of Amanda directories and files. ])
1066    AC_SUBST(AMANDA_DBGDIR);;
1067 esac
1068
1069 AC_ARG_WITH(debug_days,
1070     [  --with-debug-days=NN    number of days to keep debugging files [default=4]],
1071     debug_days="$withval",
1072     : ${debug_days=4}
1073 )
1074 case "$debug_days" in
1075 n | no) AMANDA_DEBUG_DAYS=0 ;;
1076 y |  ye | yes) AMANDA_DEBUG_DAYS=4 ;;
1077 [[0-9]] | [[0-9]][[0-9]] | [[0-9]][[0-9]][[0-9]]) AMANDA_DEBUG_DAYS="$debug_days" ;;
1078 *) AC_MSG_ERROR([*** --with-debug-days value not numeric or out of range.])
1079   ;;
1080 esac
1081 AC_DEFINE_UNQUOTED(AMANDA_DEBUG_DAYS,$AMANDA_DEBUG_DAYS,[Number of days to keep debugging files. ])
1082 AC_SUBST(AMANDA_DEBUG_DAYS)
1083
1084 AC_ARG_WITH(testing,
1085     [  --with-testing[=suffix] use alternate service names],
1086     TESTING="$withval",
1087     : ${TESTING=no}
1088 )
1089 case "$TESTING" in
1090 n | no) SERVICE_SUFFIX="";;
1091 y |  ye | yes) SERVICE_SUFFIX="-test";;
1092 *) SERVICE_SUFFIX="-$TESTING";;
1093 esac
1094 AMANDA_SERVICE_NAME="amanda$SERVICE_SUFFIX"
1095 KAMANDA_SERVICE_NAME="kamanda$SERVICE_SUFFIX"
1096 AC_SUBST(SERVICE_SUFFIX)
1097 AC_DEFINE_UNQUOTED(SERVICE_SUFFIX, "$SERVICE_SUFFIX",[A suffix that will be appended to service names.
1098  * Useful for testing in parallel with a working version. ])
1099 AC_DEFINE_UNQUOTED(AMANDA_SERVICE_NAME,  "$AMANDA_SERVICE_NAME", [The name for the Amanda service. ])
1100 AC_DEFINE_UNQUOTED(KAMANDA_SERVICE_NAME, "$KAMANDA_SERVICE_NAME", [The name for the Kerberized Amanda service. ])
1101
1102 (
1103     test "x$prefix" = xNONE && prefix=$ac_default_prefix
1104     test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
1105
1106     tmp=`eval echo "$bindir"`
1107     AC_DEFINE_UNQUOTED(bindir,"$tmp",[Directory in which user binaries should be installed. ])
1108
1109     tmp=`eval echo "$sbindir"`
1110     AC_DEFINE_UNQUOTED(sbindir,"$tmp",[Directory in which administrator binaries should be installed. ])
1111
1112     tmp=`eval echo "$libexecdir"`
1113     AC_DEFINE_UNQUOTED(libexecdir,"$tmp",[Directory in which internal binaries should be installed. ])
1114
1115     tmp=`eval echo $mandir`
1116     AC_DEFINE_UNQUOTED(mandir,"$tmp",[Directory in which man-pages should be installed])
1117 )
1118
1119 AC_PROG_CC
1120 AC_OBJEXT
1121 AC_EXEEXT
1122
1123 dnl Set the order of dump programs to look for.  Finding the proper file
1124 dnl system dumping program is problematic.  Some systems, notably HP-UX
1125 dnl and AIX, have both the backup and dump programs.  HP-UX can't use the
1126 dnl the backup program while AIX systems can't use the dump program.  So
1127 dnl a variable is set up here to specify the order of dump programs to
1128 dnl search for on the system.
1129 DUMP_PROGRAMS="ufsdump dump backup"
1130 GETCONF_LFS="LFS"
1131
1132 dump_returns_1=
1133 xenix_tapeio=
1134 case "$target" in
1135     *-dec-osf*)
1136                         AC_DEFINE(STATFS_OSF1,1,[Define on OSF1. ])
1137                         ;;
1138     *-dg-*)
1139                         DUMP_PROGRAMS="dump "$DUMP_PROGRAMS
1140                         : ${USE_RUNDUMP=yes}
1141                         dump_returns_1=yes
1142                         ;;
1143     *-netbsd*)
1144                         ;;
1145     *-freebsd*)
1146                         ;;
1147     *-openbsd*)
1148                         ;;
1149     *-hp-*)
1150                         MT_FILE_FLAG="-t"
1151                         GETCONF_LFS="XBS5_ILP32_OFFBIG"
1152                         case "$CC" in
1153                             *gcc*)
1154                                 AMANDA_CPPFLAGS="-D__STDC_EXT__ $AMANDA_CPPFLAGS"
1155                                 ;;
1156                             *cc*)
1157                                 AMANDA_CFLAGS="-Ae $AMANDA_CFLAGS"
1158                                 ;;
1159                         esac
1160                         ;;
1161   *-ibm-aix*)
1162                         GETCONF_LFS="XBS5_ILP32_OFFBIG"
1163                         DUMP_PROGRAMS="backup "$DUMP_PROGRAMS
1164                         AC_DEFINE(AIX_TAPEIO,1,[Define on AIX. ])
1165                         AC_DEFINE(AIX_BACKUP,1,[Define on AIX. ])
1166                         ;;
1167   m88k-motorola-sysv4)
1168                         ;;
1169   *-nextstep3)
1170                         ;;
1171   *-pc-bsdi*)
1172                         ;;
1173   *-pc-linux-*)
1174                         ;;
1175   alpha*-*-linux-*)
1176                         ;;
1177   sparc*-*-linux-*)
1178                         ;;
1179   powerpc-*-linux-*)
1180                         ;;
1181   *-sgi-irix3*)
1182                         dnl The old cc won't work!
1183                         CC=gcc
1184                         ;;
1185   *-sgi-irix4*)
1186                         ;;
1187   *-sgi-irix5*)
1188                         ;;
1189   *-sgi-irix6*)
1190                         ;;
1191   *-solaris2*)
1192                         ;;
1193   *-sun-sunos4.1*)
1194                         ;;
1195   *-ultrix*)
1196                         : ${USE_RUNDUMP=yes}
1197                         AC_DEFINE(STATFS_ULTRIX,1,[Define on Ultrix. ])
1198                         dump_returns_1=yes
1199                         ;;
1200   *-sysv4.2uw2*)
1201                         AC_DEFINE(UWARE_TAPEIO,1,[Define on UnixWare. ])
1202                         ;;
1203   *-sco3.2v4*)
1204                         DEV_PREFIX=/dev/
1205                         RDEV_PREFIX=/dev/
1206                         ;;
1207   *-sco3.2v5*)
1208                         xenix_tapeio=yes
1209                         AC_DEFINE(STATFS_SCO_OS5,1,[Define on SCO OS5. ])
1210                         ;;
1211   i386-pc-isc4*)
1212                         xenix_tapeio=yes
1213                         ;;
1214   *-sni-sysv4)
1215                         ;;
1216   *-pc-cygwin)
1217                         AC_DEFINE(IGNORE_TAR_ERRORS,1,[Define on Cygwin. ])
1218                         # Cygwin needs PATH to find cygwin1.dll
1219                         AC_DEFINE(NEED_PATH_ENV,1,[Define on Cygwin. ])
1220                         AC_DEFINE(IGNORE_UID_CHECK,1,[Define on Cygwin. ])
1221                         AC_DEFINE(IGNORE_FSTAB,1,[Define on Cygwin. ])
1222                         AC_DEFINE(DONT_SUID_ROOT,1,[Define on Cygwin. ])
1223                         NEED_SETUID_CLIENT=false
1224                         NEED_RUNTIME_PSEUDO_RELOC=true
1225                         ;;
1226   *)
1227                         cat <<END
1228
1229 *****
1230 This machine, target type $target, is not known
1231 to be fully supported by this configure script.  If the
1232 installation of Amanda on this system succeeds or needed
1233 any patches, please email amanda-hackers@amanda.org with
1234 the patches or an indication of the sucess or failure of
1235 the Amanda installation on your system.
1236 *****
1237
1238 END
1239                 ;;
1240 esac
1241
1242 if test -n "$dump_returns_1"; then
1243   AC_DEFINE(DUMP_RETURNS_1,1,[Define this if this system's dump exits with 1 as a success code. ])
1244 fi
1245
1246 if test -n "$xenix_tapeio"; then
1247   AC_DEFINE(XENIX_TAPEIO,1,[Define on XENIX/ISC. ])
1248 fi
1249
1250 AMANDA_CFLAGS="$AMANDA_CFLAGS $KRB4INCLUDES"
1251 AMANDA_CPPFLAGS="$AMANDA_CPPFLAGS $KRB4INCLUDES"
1252 AMANDA_LDFLAGS="$AMANDA_LDFLAGS $KRB4LDFLAGS"
1253 AMANDA_LIBS="$KRB4LIBS $AMANDA_LIBS"
1254 CFLAGS="$CFLAGS $AMANDA_CFLAGS"
1255 CPPFLAGS="$CPPFLAGS $AMANDA_CPPFLAGS"
1256 LDFLAGS="$LDFLAGS $AMANDA_LDFLAGS"
1257 LIBS="$AMANDA_LIBS $LIBS"
1258
1259
1260 dnl This specifies the flag for mt that tells mt the proper tape drive
1261 dnl to use.
1262 : ${MT_FILE_FLAG="-f"}
1263 AC_SUBST(MT_FILE_FLAG)
1264 AC_DEFINE_UNQUOTED(MT_FILE_FLAG, "$MT_FILE_FLAG",[Defined to the switch to be used when invoking mt to specify the
1265  * tape device. ])
1266
1267 AX_CREATE_STDINT_H(common-src/amanda-int.h)
1268
1269 dnl Check for programs.
1270 AC_PATH_PROGS(AR,ar,,$LOCSYSPATH)
1271
1272 AC_PROG_AWK
1273 AMANDA_PROG_AWK_VAR
1274 if test "$amanda_cv_awk_var_assignment" = no; then
1275     NO_AMPLOT_MODE=true
1276     AC_MSG_WARN([*** Your $awk cannot do command line variable assignment.  Amplot will not be installed.])
1277 fi
1278
1279 AC_PROG_YACC
1280 AC_PATH_PROGS(CAT,cat,,$LOCSYSPATH)
1281 if test -z "$CAT"; then
1282     CAT=cat
1283 fi
1284 AC_PATH_PROGS(COMPRESS,compress,,$LOCSYSPATH)
1285 AC_PATH_PROGS(DD,dd,,$LOCSYSPATH)
1286 AC_PATH_PROGS(EGREP,egrep,,$LOCSYSPATH)
1287 AC_PATH_PROGS(GETCONF,getconf,,$SYSPATH)
1288
1289 AC_PATH_PROGS(GNUPLOT,gnuplot,,$LOCSYSPATH)
1290 if test -z "$GNUPLOT"; then
1291     NO_AMPLOT_MODE=true
1292     AC_MSG_WARN([*** You do not have gnuplot.  Amplot will not be installed.])
1293 fi
1294
1295 AC_PATH_PROGS(GREP,grep,,$LOCSYSPATH)
1296 if test -z "$GREP"; then
1297     GREP=grep
1298 fi
1299 AC_DEFINE_UNQUOTED(GREP,"$GREP",[Define the location of the grep program. ])
1300
1301 AC_PATH_PROGS(GNUTAR,gtar gnutar tar,,$LOCSYSPATH)
1302 if test ! -z "$GNUTAR"; then
1303   case "`\"$GNUTAR\" --version 2>&1`" in
1304    *GNU*tar* | *Free*paxutils* )
1305                 AC_DEFINE_UNQUOTED(GNUTAR,"$GNUTAR",[Define to the location of Gnu tar. ])
1306                 ;;
1307    *)
1308                 AC_MSG_WARN([*** $GNUTAR is not GNU tar, so it will not be used.])
1309                 GNUTAR=
1310                 ;;
1311   esac
1312 fi
1313
1314 if test "x$SAMBA_CLIENT" != "xno"
1315 then AC_PATH_PROGS(SAMBA_CLIENT,smbclient,,$LOCSYSPATH)
1316 else SAMBA_CLIENT=
1317 fi
1318 if test ! -z "$SAMBA_CLIENT"; then
1319   case "`\"$SAMBA_CLIENT\" '\\\\not.a.host.name\\notashare' -U nosuchuser -N -Tx /dev/null 2>&1`" in
1320   *"Unknown host"*)
1321                 smbversion=1
1322                 ;;
1323   *"Connection to not.a.host.name failed"*)
1324                 smbversion=2
1325                 ;;
1326   *)
1327                 AC_MSG_WARN([*** $SAMBA_CLIENT does not seem to be smbclient, so it will not be used.])
1328                 SAMBA_CLIENT=
1329                 ;;
1330   esac
1331   if test -n "$SAMBA_CLIENT"; then
1332     AC_DEFINE_UNQUOTED(SAMBA_CLIENT,"$SAMBA_CLIENT",[Define the location of smbclient for backing up Samba PC clients. ])
1333     AC_DEFINE_UNQUOTED(SAMBA_VERSION, $smbversion,
1334       [Not the actual samba version, just a number that should be increased whenever we start to rely on a new samba feature. ])
1335   fi
1336
1337 fi
1338
1339
1340 AC_PATH_PROGS(GZIP,gzip,,$LOCSYSPATH)
1341 if test "$GZIP"; then
1342     AC_DEFINE(HAVE_GZIP,1,[Define if Amanda is using the gzip program. ])
1343     COMPRESS_PATH="$GZIP"
1344     COMPRESS_SUFFIX=".gz"
1345     COMPRESS_FAST_OPT="--fast"
1346     COMPRESS_BEST_OPT="--best"
1347     UNCOMPRESS_PATH="$GZIP"
1348     UNCOMPRESS_OPT="-dc"
1349 else
1350     if test "$COMPRESS"; then
1351         COMPRESS_PATH="$COMPRESS"
1352         COMPRESS_SUFFIX=".Z"
1353         COMPRESS_FAST_OPT="-f"
1354         COMPRESS_BEST_OPT="-f"
1355         UNCOMPRESS_PATH="$COMPRESS"
1356         UNCOMPRESS_OPT="-dc"
1357     else
1358         dnl If we have to use cat, we don't define COMPRESS_FAST_OPT,
1359         dnl COMPRESS_BEST_OPT, or UNCOMPRESS_OPT as "" since cat will look
1360         dnl look for a file by the name of "".
1361         AC_MSG_WARN([*** Cannot find either gzip or compress.  Using cat. ***])
1362         COMPRESS_PATH="$CAT"
1363         COMPRESS_SUFFIX=""
1364         COMPRESS_FAST_OPT=""
1365         COMPRESS_BEST_OPT=""
1366         UNCOMPRESS_PATH="$CAT"
1367         UNCOMPRESS_OPT=""
1368     fi
1369 fi
1370 AC_DEFINE_UNQUOTED(COMPRESS_PATH,"$COMPRESS_PATH",[Define to the exact path to the gzip or the compress program. ])
1371 AC_DEFINE_UNQUOTED(COMPRESS_SUFFIX,"$COMPRESS_SUFFIX",[Define to the suffix for the COMPRESS_PATH compression program. ])
1372 AC_DEFINE_UNQUOTED(COMPRESS_FAST_OPT,"$COMPRESS_FAST_OPT",[Define as the command line option for fast compression. ])
1373 AC_DEFINE_UNQUOTED(COMPRESS_BEST_OPT,"$COMPRESS_BEST_OPT",[Define as the command line option for best compression. ])
1374 AC_DEFINE_UNQUOTED(UNCOMPRESS_PATH,"$UNCOMPRESS_PATH",[Define as the exact path to the gzip or compress command. ])
1375 AC_DEFINE_UNQUOTED(UNCOMPRESS_OPT,"$UNCOMPRESS_OPT",[Define as any optional arguments to get UNCOMPRESS_PATH to uncompress. ])
1376
1377 AC_PATH_PROGS(MAILER,Mail mailx mail)
1378 if test -z "$MAILER"; then
1379     if $NO_SERVER_MODE; then
1380         MAILER="NONE"
1381         AC_MSG_WARN([*** WARNING: Amanda cannot send mail reports without these programs.])
1382     else
1383         AC_MSG_ERROR([Set MAILER to some program that accepts -s subject user < message_file.])
1384     fi
1385 fi
1386 AC_DEFINE_UNQUOTED(MAILER,"$MAILER",[Define to a program that understands -s "subject" user < message_file])
1387
1388 AC_PATH_PROGS(MT,mt,mt,$LOCSYSPATH)
1389
1390 AC_PATH_PROGS(CHIO,chio,chio,$LOCSYSPATH)
1391
1392 AC_PATH_PROGS(CHS,chs,chs,$LOCSYSPATH)
1393
1394 AC_PATH_PROGS(MTX,mtx,mtx,$LOCSYSPATH)
1395
1396 AC_PATH_PROGS(MCUTIL,mcutil,mcutil,$LOCSYSPATH)
1397
1398 AC_PATH_PROGS(PRINT, lpr lp)
1399 if test ! -z "$PRINT"; then
1400     AC_DEFINE_UNQUOTED(LPRCMD, "$PRINT",[Command for starting printing jobs. ])
1401     AC_CACHE_CHECK([which flag to use to select a printer],
1402         amanda_cv_printer_flag, [
1403         amanda_cv_printer_flag=$PRINTER_FLAG
1404         case "$PRINT" in
1405         lpr|*/lpr) amanda_cv_printer_flag="-P";;
1406         lp|*/lp) amanda_cv_printer_flag="-d";;
1407         esac
1408     ])
1409     if test ! -z "$amanda_cv_printer_flag"; then
1410         AC_DEFINE_UNQUOTED(LPRFLAG, "$amanda_cv_printer_flag",[LPRCMD switch for specifying a printer name. ])
1411     else
1412         AC_MSG_WARN([*** WARNING: amanda will always print to the default printer])
1413     fi
1414 fi
1415
1416 AC_PATH_PROGS(PCAT,pcat,,$LOCSYSPATH)
1417 AC_PATH_PROGS(PERL,perl5 perl,,$LOCSYSPATH)
1418
1419 dnl AC_PATH_PROGS(MAKEINFO,makeinfo,,$LOCSYSPATH)
1420 dnl AC_PATH_PROGS(TEXI2DVI,texi2dvi,,$LOCSYSPATH)
1421
1422 AC_PATH_PROGS(DUMP,$DUMP_PROGRAMS,,$SYSLOCPATH)
1423 AC_PATH_PROGS(RESTORE,ufsrestore restore,,$SYSLOCPATH)
1424 if test "$DUMP" -a "$RESTORE"; then
1425     AC_DEFINE_UNQUOTED(DUMP,"$DUMP",[Define the location of the ufsdump, backup, or dump program. ])
1426     AC_DEFINE_UNQUOTED(RESTORE,"$RESTORE",[Define the location of the ufsrestore or restore program. ])
1427     if test -x $DUMP; then
1428         AC_CACHE_CHECK(
1429             [whether $DUMP supports -E or -S for estimates],
1430             amanda_cv_dump_estimate,
1431             [
1432                 case "$DUMP" in
1433                 *dump)
1434                     AC_TRY_COMMAND($DUMP 9Ef /dev/null /dev/null/invalid/fs 2>&1
1435                         | $GREP -v Dumping
1436                         | $GREP -v Date
1437                         | $GREP -v Label >conftest.d-E 2>&1)
1438                     cat conftest.d-E >&AS_MESSAGE_LOG_FD()
1439                     AC_TRY_COMMAND($DUMP 9Sf /dev/null /dev/null/invalid/fs 2>&1
1440                         | $GREP -v Dumping
1441                         | $GREP -v Date
1442                         | $GREP -v Label >conftest.d-S 2>&1)
1443                     cat conftest.d-S >&AS_MESSAGE_LOG_FD()
1444                     AC_TRY_COMMAND($DUMP 9f /dev/null /dev/null/invalid/fs 2>&1
1445                         | $GREP -v Dumping
1446                         | $GREP -v Date
1447                         | $GREP -v Label >conftest.d 2>&1)
1448                     cat conftest.d >&AS_MESSAGE_LOG_FD()
1449                     if AC_TRY_COMMAND(cmp conftest.d-E conftest.d 1>&2); then
1450                         amanda_cv_dump_estimate=E
1451                     elif AC_TRY_COMMAND(cmp conftest.d-S conftest.d 1>&2); then
1452                         amanda_cv_dump_estimate=S
1453                     else
1454                         amanda_cv_dump_estimate=no
1455                     fi
1456                     rm -f conftest.d conftest.d-E conftest.d-S
1457                   ;;
1458                 *) amanda_cv_dump_estimate=no
1459                   ;;
1460                 esac
1461             ])
1462     else
1463         AC_MSG_WARN([*** $DUMP is not executable, cannot run -E/-S test])
1464         amanda_cv_dump_estimate=no
1465     fi
1466     if test "$amanda_cv_dump_estimate" != no; then
1467         AC_DEFINE_UNQUOTED(HAVE_DUMP_ESTIMATE, "$amanda_cv_dump_estimate",[Define to the string that enables dump estimates. ])
1468     fi
1469
1470     AC_ARG_WITH(dump-honor-nodump,
1471     [  --with-dump-honor-nodump  if dump supports -h, use it for level0s too],
1472     [ if test -x $DUMP; then
1473         AC_CACHE_CHECK(
1474           [whether $DUMP supports -h (honor nodump flag)],
1475           amanda_cv_honor_nodump,
1476           [
1477             case "$DUMP" in
1478             *dump)
1479                 AC_TRY_COMMAND($DUMP 9hf 0 /dev/null /dev/null/invalid/fs 2>&1
1480                     | $GREP -v Dumping
1481                     | $GREP -v Date
1482                     | $GREP -v Label >conftest.d-h 2>&1)
1483                 cat conftest.d-h >&AS_MESSAGE_LOG_FD()
1484                 AC_TRY_COMMAND($DUMP 9f /dev/null /dev/null/invalid/fs 2>&1
1485                     | $GREP -v Dumping
1486                     | $GREP -v Date
1487                     | $GREP -v Label >conftest.d 2>&1)
1488                 cat conftest.d >&AS_MESSAGE_LOG_FD()
1489                 if AC_TRY_COMMAND(diff conftest.d-h conftest.d 1>&2); then
1490                     amanda_cv_honor_nodump=yes
1491                 else
1492                     amanda_cv_honor_nodump=no
1493                 fi
1494                 rm -f conftest.d conftest.d-h
1495               ;;
1496             *) amanda_cv_honor_nodump=no
1497               ;;
1498             esac
1499           ])
1500       else
1501         AC_MSG_WARN([*** $DUMP is not executable, cannot run -h test])
1502         amanda_cv_honor_nodump=no
1503       fi
1504       if test "$amanda_cv_honor_nodump" = yes; then
1505         AC_DEFINE(HAVE_HONOR_NODUMP,1,[Define this if dump accepts -h for honoring nodump. ])
1506       fi
1507     ])
1508 fi
1509
1510 AC_PATH_PROGS(XFSDUMP,xfsdump,,$SYSLOCPATH)
1511 AC_PATH_PROGS(XFSRESTORE,xfsrestore,,$SYSLOCPATH)
1512 if test "$XFSDUMP" -a "$XFSRESTORE"; then
1513     AC_DEFINE_UNQUOTED(XFSDUMP,"$XFSDUMP",[Define the location of the xfsdump program on Irix hosts. ])
1514     AC_DEFINE_UNQUOTED(XFSRESTORE,"$XFSRESTORE",[Define the location of the xfsrestore program on Irix hosts. ])
1515     AC_MSG_WARN([*** xfsdump causes the setuid-root rundump program to be enabled])
1516     AC_MSG_WARN([[*** to disable it, just #undef XFSDUMP in config/config.h]])
1517 fi
1518
1519 VXSYSLOCPATH="$SYSLOCPATH:/usr/lib/fs/vxfs"
1520 AC_PATH_PROGS(VXDUMP,vxdump,,$VXSYSLOCPATH)
1521 AC_PATH_PROGS(VXRESTORE,vxrestore,,$VXSYSLOCPATH)
1522 if test "$VXDUMP" -a "$VXRESTORE"; then
1523     AC_DEFINE_UNQUOTED(VXDUMP,"$VXDUMP",[Define the location of the vxdump program on HPUX and SINIX hosts or on
1524  * other hosts where the Veritas filesystem (vxfs) has been installed. ])
1525     AC_DEFINE_UNQUOTED(VXRESTORE,"$VXRESTORE",[Define the location of the vxrestore program on HPUX and SINIX hosts or on
1526  * other hosts where the Veritas filesystem (vxfs) has been installed. ])
1527 fi
1528
1529 AC_PATH_PROGS(VDUMP,vdump,,$SYSLOCPATH)
1530 AC_PATH_PROGS(VRESTORE,vrestore,,$SYSLOCPATH)
1531 if test "$VDUMP" -a "$VRESTORE"; then
1532     AC_DEFINE_UNQUOTED(VDUMP,"$VDUMP",[Define the location of the vdump program. ])
1533     AC_DEFINE_UNQUOTED(VRESTORE,"$VRESTORE",[Define the location of the vrestore program. ])
1534 fi
1535
1536 dnl Handle all of the substitutions to make amplot work.
1537 if test "$PCAT"; then
1538     AMPLOT_CAT_PACK="if(o==\"z\")print \"$PCAT\"; else"
1539 else
1540     AMPLOT_CAT_PACK=
1541 fi
1542 if test "$COMPRESS"; then
1543     AMPLOT_COMPRESS=$COMPRESS
1544     AMPLOT_CAT_COMPRESS="if(o==\"Z\")print \"$COMPRESS -dc\"; else"
1545 else
1546     AMPLOT_CAT_COMPRESS=
1547 fi
1548 if test "$GZIP"; then
1549     AMPLOT_COMPRESS=$GZIP
1550     AMPLOT_CAT_GZIP="if(o==\"gz\")print \"$GZIP -dc\"; else"
1551 else
1552     AMPLOT_CAT_GZIP=
1553 fi
1554 AC_SUBST(AMPLOT_COMPRESS)
1555 AC_SUBST(AMPLOT_CAT_GZIP)
1556 AC_SUBST(AMPLOT_CAT_COMPRESS)
1557 AC_SUBST(AMPLOT_CAT_PACK)
1558
1559 dnl Empty GZIP so that make dist works.
1560 GZIP=
1561
1562 dnl Checks for compilers, typedefs, structures, and compiler characteristics.
1563 dnl Check for large file compilation environment.
1564 need_resetofs=yes
1565 AC_CACHE_CHECK(
1566     [for large file compilation CFLAGS],
1567     amanda_cv_LFS_CFLAGS,
1568     [
1569         amanda_cv_LFS_CFLAGS=
1570         if test "$GETCONF"; then
1571             if $GETCONF ${GETCONF_LFS}_CFLAGS >/dev/null 2>&1; then
1572                 amanda_cv_LFS_CFLAGS=`$GETCONF ${GETCONF_LFS}_CFLAGS 2>/dev/null`
1573                 need_resetofs=no
1574             fi
1575         fi
1576     ]
1577 )
1578 AC_CACHE_CHECK(
1579     [for large file compilation LDFLAGS],
1580     amanda_cv_LFS_LDFLAGS,
1581     [
1582         amanda_cv_LFS_LDFLAGS=
1583         if test "$GETCONF"; then
1584             if $GETCONF ${GETCONF_LFS}_LDFLAGS >/dev/null 2>&1; then
1585                 amanda_cv_LFS_LDFLAGS=`$GETCONF ${GETCONF_LFS}_LDFLAGS 2>/dev/null`
1586                 need_resetofs=no
1587             fi
1588         fi
1589     ]
1590 )
1591 AC_CACHE_CHECK(
1592     [for large file compilation LIBS],
1593     amanda_cv_LFS_LIBS,
1594     [
1595         amanda_cv_LFS_LIBS=
1596         if test "$GETCONF"; then
1597             if $GETCONF ${GETCONF_LFS}_LIBS >/dev/null 2>&1; then
1598                 amanda_cv_LFS_LIBS=`$GETCONF ${GETCONF_LFS}_LIBS 2>/dev/null`
1599                 need_resetofs=no
1600             fi
1601         fi
1602     ]
1603 )
1604 if test "$need_resetofs" = yes; then
1605     AC_DEFINE(NEED_RESETOFS,1,[Define if we have to reset tape offsets when reacing 2GB. ])
1606 fi
1607 CFLAGS="$amanda_cv_LFS_CFLAGS $CFLAGS"
1608 CPPFLAGS="$amanda_cv_LFS_CFLAGS $CPPFLAGS"
1609 LDFLAGS="$amanda_cv_LFS_LDFLAGS $LDFLAGS"
1610 LIBS="$amanda_cv_LFS_LIBS $LIBS"
1611
1612 AM_PROG_LIBTOOL
1613 AC_SUBST(LIBTOOL_DEPS)
1614
1615 AC_PROG_GCC_TRADITIONAL
1616 AC_C_CONST
1617 AMANDA_C_VOLATILE
1618 AMANDA_C_UNSIGNED_LONG_CONSTANTS
1619 AC_TYPE_OFF_T
1620 AC_TYPE_PID_T
1621 AC_TYPE_SIZE_T
1622
1623 dnl We don't have an acconfig.h template since we moved all define templates
1624 dnl into the third argument of AC_DEFINE.  However, AC_CHECK_TYPE calls
1625 dnl AC_DEFINE without such an argument, so autoheader complains about no
1626 dnl template being available.  This is an ugly work-around.
1627
1628 pushdef([AC_DEFINE_SAVED],defn([AC_DEFINE]))
1629 pushdef([AC_DEFINE],[AC_DEFINE_SAVED([$1],[$2],[Define to $2 if $1 is not defined])])
1630
1631 AC_CHECK_TYPE(ssize_t, int)
1632
1633 dnl there is a push to avoid depending on long longs, so in general it's
1634 dnl better to convert numbers to kilobytes for consistancies sake.  This
1635 dnl is primarily checked for for client-src/amqde.c
1636 AC_CHECK_TYPES(unsigned long long)
1637
1638 popdef([AC_DEFINE])
1639 popdef([AC_DEFINE_SAVED])
1640
1641 dnl End ugly AC_CHECK_TYPE work-around.
1642
1643 AC_TYPE_UID_T
1644 AC_TYPE_SIGNAL
1645 AC_STRUCT_TM
1646 AM_PROG_LEX
1647
1648 dnl AC_CHECK_TYPE does not work for socklen_t because it does not look
1649 dnl in <sys/socket.h>, so this is a variant that adds another header.
1650 AC_DEFUN([AMANDA_CHECK_TYPE],
1651 [AC_REQUIRE([AC_HEADER_STDC])dnl
1652 AC_MSG_CHECKING(for $1)
1653 AC_CACHE_VAL(ac_cv_type_$1,
1654 [AC_EGREP_CPP(dnl
1655 changequote(<<,>>)dnl
1656 <<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl
1657 changequote([,]), [#include <sys/types.h>
1658 #if STDC_HEADERS
1659 #include <stdlib.h>
1660 #include <stddef.h>
1661 #endif
1662 #include <$3>], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
1663 AC_MSG_RESULT($ac_cv_type_$1)
1664 if test $ac_cv_type_$1 = no; then
1665   AC_DEFINE($1, $2, [Define if $1 is not a standard system type])
1666 fi
1667 ])
1668 AMANDA_CHECK_TYPE(socklen_t, int, sys/socket.h)
1669
1670 dnl Checks for header files.
1671 AC_HEADER_STDC
1672 AC_HEADER_DIRENT
1673 CF_WAIT
1674 CF_WAIT_INT
1675 AC_HEADER_TIME
1676 AC_CHECK_HEADERS(\
1677         arpa/inet.h \
1678         camlib.h \
1679         cam/cam.h \
1680         cam/scsi/scsi_message.h \
1681         chio.h \
1682         db.h \
1683         dbm.h \
1684         fcntl.h \
1685         fnmatch.h \
1686         fstab.h \
1687         grp.h \
1688         history.h \
1689         libc.h \
1690         limits.h \
1691         linux/zftape.h \
1692         mntent.h \
1693         mnttab.h \
1694         ndbm.h \
1695         netdb.h \
1696         netinet/in_systm.h \
1697         readline.h \
1698         readline/history.h \
1699         readline/readline.h \
1700         scsi/sg.h \
1701         scsi/scsi_ioctl.h \
1702         stdlib.h \
1703         string.h \
1704         strings.h \
1705         sys/chio.h \
1706         sys/dsreq.h \
1707         sys/fcntl.h \
1708         sys/file.h \
1709         sys/ioctl.h \
1710         sys/ipc.h \
1711         sys/mman.h \
1712         sys/mntent.h \
1713         sys/mtio.h \
1714         sys/param.h \
1715         sys/scarray.h \
1716         sys/gscdds.h \
1717         sys/scsiio.h \
1718         sys/scsi.h \
1719         sys/scsi/impl/uscsi.h \
1720         sys/scsi/scsi/ioctl.h \
1721         sys/select.h \
1722         sys/shm.h \
1723         sys/stat.h \
1724         sys/statfs.h \
1725         sys/statvfs.h \
1726         sys/tape.h \
1727         sys/time.h \
1728         sys/types.h \
1729         sys/vfs.h \
1730         sys/vfstab.h \
1731         syslog.h \
1732         unistd.h \
1733         vtblc.h \
1734 )
1735
1736 AC_CHECK_HEADERS(netinet/ip.h,,,
1737 [[#include <sys/socket.h>
1738 #if HAVE_SYS_TYPES_H
1739 #include <sys/types.h>
1740 #endif
1741 #ifdef HAVE_NETINET_IN_SYSTM_H
1742 #include <netinet/in_systm.h>
1743 #endif
1744 #include <netinet/in.h>
1745 ]])
1746
1747 AC_CHECK_HEADERS(sys/mount.h,,,
1748 [[#ifdef HAVE_SYS_PARAM_H
1749 #include <sys/param.h>
1750 #endif
1751 ]])
1752
1753 NO_SCSI_CHANGER_MODE=true
1754 NO_CHIO_CHANGER_MODE=true
1755
1756 AC_C_BIGENDIAN
1757
1758 dnl
1759 dnl chio support
1760 dnl
1761 if test x"$ac_cv_header_sys_scsi_h" = x"yes"; then
1762     AC_CACHE_CHECK([for HP/UX-like scsi changer support],
1763         amanda_cv_hpux_scsi_chio,
1764         [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1765 #include <sys/scsi.h>
1766 ]], [[
1767         static struct element_addresses changer_info;
1768         int i = SIOC_ELEMENT_ADDRESSES;
1769         int j = SIOC_ELEMENT_STATUS;
1770         int k = SIOC_MOVE_MEDIUM;
1771 ]])],[amanda_cv_hpux_scsi_chio=yes],[amanda_cv_hpux_scsi_chio=no])])
1772     if test x"$amanda_cv_hpux_scsi_chio" = x"yes"; then
1773         AC_DEFINE(HAVE_HPUX_SCSI_CHIO,1,[Define to enable HPUX chio based changer support. ])
1774         NO_SCSI_CHANGER_MODE=false
1775     fi
1776 fi
1777
1778 dnl
1779 dnl Linux SCSI based on ioctl
1780 dnl
1781 if test x"$ac_cv_header_sys_mtio_h" = x"yes" &&
1782    test x"$ac_cv_header_scsi_scsi_ioctl_h" = x"yes"; then 
1783         AC_CACHE_CHECK([for Linux like scsi support (ioctl)],
1784         amanda_cv_linux_scsi,
1785         [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1786 #include <scsi/scsi_ioctl.h>
1787 #include <sys/mtio.h>
1788 ]], [[
1789         int device;
1790         char *Command;
1791         ioctl(device, SCSI_IOCTL_SEND_COMMAND, Command);
1792 ]])],[amanda_cv_linux_scsi=yes],[amanda_cv_linux_scsi=no])])
1793 fi
1794
1795 dnl
1796 dnl Linux SCSI based on sg
1797 dnl
1798 if test x"$ac_cv_header_sys_mtio_h" = x"yes" &&
1799    test x"$ac_cv_header_scsi_sg_h" = x"yes"; then 
1800         AC_CACHE_CHECK([for Linux like scsi support (sg)],
1801         amanda_cv_linux_sg_scsi,
1802         [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1803 #include <sys/types.h>
1804 #include <scsi/sg.h>
1805 #include <sys/mtio.h>
1806 ]], [[
1807         int device;
1808         struct sg_header *psg_header;
1809         char *buffer;
1810         write(device, buffer, 1);
1811 ]])],[amanda_cv_linux_sg_scsi=yes],[amanda_cv_linux_sg_scsi=no])])
1812 fi
1813
1814 if test x"$amanda_cv_linux_scsi" = x"yes" ||
1815  test x"$amanda_cv_linux_sg_scsi" = x"yes";then
1816         AC_DEFINE(HAVE_LINUX_LIKE_SCSI,1,[Define to enable Linux tape-changer support.])
1817         NO_SCSI_CHANGER_MODE=false
1818 fi
1819
1820 dnl
1821 dnl HP-UX SCSI
1822 dnl
1823 if test x"$ac_cv_header_sys_mtio_h" = x"yes" &&
1824    test x"$ac_cv_header_sys_scsi_h" = x"yes"; then 
1825         AC_CACHE_CHECK([for HP-UX like scsi support],
1826         amanda_cv_hpux_scsi,
1827         [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1828 #include <stdio.h>
1829 #include <sys/ioctl.h>
1830 #include <sys/scsi.h>
1831 #include <sys/mtio.h>
1832 ]], [[
1833         int device;
1834         char *Command;
1835         ioctl(device, SIOC_IO, Command);
1836 ]])],[amanda_cv_hpux_scsi=yes],[amanda_cv_hpux_scsi=no])])
1837         if test x"$amanda_cv_hpux_scsi" = x"yes";then
1838                 AC_DEFINE(HAVE_HPUX_LIKE_SCSI,1,[Define to enable HPUX tape-changer support. ])
1839                 NO_SCSI_CHANGER_MODE=false
1840                 NO_CHIO_CHANGER_MODE=false
1841         fi
1842 fi
1843
1844 dnl
1845 dnl IRIX SCSI
1846 dnl
1847 if test x"$ac_cv_header_sys_mtio_h" = x"yes" &&
1848    test x"$ac_cv_header_sys_dsreq_h" = x"yes"; then 
1849         AC_CACHE_CHECK([for Irix like scsi support],
1850         amanda_cv_irix_scsi,
1851         [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1852 #include <sys/types.h>
1853 #include <sys/dsreq.h>
1854 #include <sys/mtio.h>
1855 ]], [[
1856         int device=1;
1857         char Command;
1858         ioctl(device, DS_ENTER, &Command);
1859 ]])],[amanda_cv_irix_scsi=yes],[amanda_cv_irix_scsi=no])])
1860         if test x"$amanda_cv_irix_scsi" = x"yes";then
1861                 AC_DEFINE(HAVE_IRIX_LIKE_SCSI,1,[Define to enable IRIX tape-changer support])
1862                 NO_SCSI_CHANGER_MODE=false
1863         fi
1864 fi
1865
1866 dnl
1867 dnl Solaris  SCSI
1868 dnl
1869 if test x"$ac_cv_header_sys_mtio_h" = x"yes" &&
1870    test x"$ac_cv_header_sys_scsi_impl_uscsi_h" = x"yes"; then 
1871         AC_CACHE_CHECK([for Solaris like scsi support],
1872         amanda_cv_solaris_scsi,
1873         [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1874 #include <sys/types.h>
1875 #include <sys/scsi/impl/uscsi.h>
1876 #include <sys/mtio.h>
1877 ]], [[
1878         int device;
1879         char *Command;
1880         ioctl(device, USCSICMD, Command);
1881 ]])],[amanda_cv_solaris_scsi=yes],[amanda_cv_solaris_scsi=no])])
1882         if test x"$amanda_cv_solaris_scsi" = x"yes";then
1883                 AC_DEFINE(HAVE_SOLARIS_LIKE_SCSI,1,[Define to enable Solaris tape-changer support])
1884                 NO_SCSI_CHANGER_MODE=false
1885         fi
1886 fi
1887
1888 dnl
1889 dnl AIX SCSI
1890 dnl
1891 if test x"$ac_cv_header_sys_tape_h" = x"yes" &&
1892    test x"$ac_cv_header_sys_scarray_h" = x"yes" &&
1893    test x"$ac_cv_header_sys_gscdds_h" = x"yes"; then 
1894         AC_CACHE_CHECK([for AIX like scsi support],
1895         amanda_cv_aix_scsi,
1896         [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1897 #include <sys/types.h>
1898 #include <sys/scarray.h>
1899 #include <sys/tape.h>
1900 ]], [[
1901         int device;
1902         char *Command;
1903         ioctl(device, STIOCMD, Command);
1904 ]])],[amanda_cv_aix_scsi=yes],[amanda_cv_aix_scsi=no])])
1905         if test x"$amanda_cv_aix_scsi" = x"yes";then
1906                 AC_DEFINE(HAVE_AIX_LIKE_SCSI,1,[Define to enable AIX tape-changer support])
1907                 NO_SCSI_CHANGER_MODE=false
1908         fi
1909 fi
1910 dnl
1911 dnl BSD CAM SCSI
1912 dnl
1913 if test x"$ac_cv_header_cam_cam_h" = x"yes";then
1914         AC_CACHE_CHECK([for CAM like scsi support],
1915         amanda_cv_cam_scsi,
1916         [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1917 #include <stdio.h>
1918 # include <fcntl.h>
1919 # include <cam/cam.h>
1920 # include <cam/cam_ccb.h>
1921 # include <cam/scsi/scsi_message.h>
1922 # include <cam/scsi/scsi_pass.h>
1923 # include <camlib.h>
1924 ]], [[
1925         struct cam_device *curdev;
1926
1927         curdev = cam_open_pass("", O_RDWR, NULL);
1928 ]])],[amanda_cv_cam_scsi=yes],[amanda_cv_cam_scsi=no])])
1929         if test x"$amanda_cv_cam_scsi" = x"yes";then
1930                 AC_DEFINE(HAVE_CAM_LIKE_SCSI,1,[Define to enable CAM tape-changer support])
1931                 NO_SCSI_CHANGER_MODE=false
1932                 AC_CHECK_LIB(cam,main)
1933         fi
1934 fi
1935
1936 dnl
1937 dnl BSD SCSI
1938 dnl
1939 if test x"$ac_cv_header_sys_mtio_h" = x"yes" &&
1940    test x"$ac_cv_header_sys_scsiio_h" = x"yes"; then
1941     AC_CACHE_CHECK([for BSD like scsi support],
1942     amanda_cv_bsd_scsi,
1943     [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1944 #include <sys/types.h>
1945 #include <sys/scsiio.h>
1946 #include <sys/mtio.h>
1947 ]], [[
1948     int device=1;
1949     char Command;
1950     ioctl(device, SCIOCCOMMAND, &Command);
1951 ]])],[amanda_cv_bsd_scsi=yes],[amanda_cv_bsd_scsi=no])])
1952     if test x"$amanda_cv_bsd_scsi" = x"yes";then
1953        AC_DEFINE(HAVE_BSD_LIKE_SCSI,1,[Define to enable BSD tape-changer support])
1954        NO_SCSI_CHANGER_MODE=false
1955     fi
1956 fi
1957
1958 dnl Do not build chg-scsi-chio if we cannot find the needed support
1959 dnl include files for the SCSI interfaces
1960 dnl chio.h and sys/chio.h are chio based systems
1961 if test x"$ac_cv_header_chio_h" = x"yes" ||
1962    test x"$ac_cv_header_sys_chio_h" = x"yes"; then
1963    dnl chg-scsi does not support FreeBSD 3.0's chio.h; it became backward
1964    dnl incompatible with the introduction of camlib.h
1965    if test x"$ac_cv_header_camlib_h" != x"yes"; then
1966      if $NO_SCSI_CHANGER_MODE; then
1967        NO_SCSI_CHANGER_MODE=false
1968      else
1969        NO_CHIO_CHANGER_MODE=false
1970      fi
1971    fi
1972 fi
1973
1974 dnl cur_colr is on some HP's
1975 AC_CHECK_LIB(cur_colr,main)
1976
1977 AC_CHECK_LIB(intl,main)
1978
1979 dnl Make sure we don't use -lnsl and -lsun on Irix systems.
1980 case "$target" in
1981     *sgi-irix*)
1982                         AC_CHECK_LIB(socket,main)
1983                         ;;
1984     *)
1985                         AC_CHECK_LIB(nsl,main)
1986                         AC_CHECK_LIB(socket,main)
1987                         AC_CHECK_LIB(sun,main)
1988                         ;;
1989 esac
1990
1991 AC_CHECK_LIB(termcap,tgetent)
1992 if test "$ac_cv_lib_termcap_tgetent" != yes; then
1993     AC_CHECK_LIB(curses,tgetent)
1994     if test "$ac_cv_lib_curses_tgetent" != yes; then
1995         AC_CHECK_LIB(ncurses,tgetent)
1996     fi
1997 fi
1998 if test "$ac_cv_lib_termcap_tgetent" = yes ||
1999    test "$ac_cv_lib_curses_tgetent" = yes ||
2000    test "$ac_cv_lib_ncurses_tgetent" = yes; then
2001     AC_CHECK_LIB(readline,readline)
2002     if test "$ac_cv_lib_readline_readline" != yes; then
2003         AC_MSG_WARN([*** No readline library, no history and command line editing in amrecover!])
2004     fi
2005 else
2006     AC_MSG_WARN([*** No terminal library, no history and command line editing in amrecover!])
2007 fi
2008
2009 if test "$ac_cv_lib_readline_readline" = yes; then
2010     READLINE_LIBS=-lreadline
2011     LIBS=`echo $LIBS | sed s/-lreadline//`
2012     AC_SUBST(READLINE_LIBS)
2013 fi
2014
2015 if test "$ac_cv_header_linux_zftape_h" = yes; then
2016     if test "$ac_cv_header_vtblc_h" = yes; then
2017         AC_CHECK_LIB(vtblc,main)
2018         if test "$ac_cv_lib_vtblc_main" != yes; then
2019             AC_MSG_WARN([*** vtblc library not found - no QIC volume table support!])
2020         fi
2021     else
2022         AC_MSG_WARN([*** vtblc headers not found - no QIC volume table support!])
2023     fi
2024 fi
2025
2026 AC_CHECK_LIB(m,modf)
2027
2028 dnl Check for various "mt status" related structure elements.
2029
2030 AC_MSG_CHECKING(for mt_flags mtget structure element)
2031 mt_flags_result="found"
2032 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2033 #include <stdio.h>
2034 #include <sys/types.h>
2035 #include <sys/mtio.h>
2036 ]], [[
2037     struct mtget buf;
2038     long ds;
2039
2040     ds = buf.mt_flags;
2041 ]])],[AC_DEFINE(HAVE_MT_FLAGS,1,Define if the mtget structure has an mt_flags field)],[mt_flags_result="not found"])
2042 AC_MSG_RESULT($mt_flags_result)
2043
2044 AC_MSG_CHECKING(for mt_fileno mtget structure element)
2045 mt_fileno_result="found"
2046 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2047 #include <stdio.h>
2048 #include <sys/types.h>
2049 #include <sys/mtio.h>
2050 ]], [[
2051     struct mtget buf;
2052     long ds;
2053
2054     ds = buf.mt_fileno;
2055 ]])],[AC_DEFINE(HAVE_MT_FILENO,1,Define if the mtget structure has an mt_fileno field)],[mt_fileno_result="not found"])
2056 AC_MSG_RESULT($mt_fileno_result)
2057
2058 AC_MSG_CHECKING(for mt_blkno mtget structure element)
2059 mt_blkno_result="found"
2060 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2061 #include <stdio.h>
2062 #include <sys/types.h>
2063 #include <sys/mtio.h>
2064 ]], [[
2065     struct mtget buf;
2066     long ds;
2067
2068     ds = buf.mt_blkno;
2069 ]])],[AC_DEFINE(HAVE_MT_BLKNO,1,Define if the mtget structure has an mt_blkno field)],[mt_blkno_result="not found"])
2070 AC_MSG_RESULT($mt_blkno_result)
2071
2072 AC_MSG_CHECKING(for mt_dsreg mtget structure element)
2073 mt_dsreg_result="found"
2074 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2075 #include <stdio.h>
2076 #include <sys/types.h>
2077 #include <sys/mtio.h>
2078 ]], [[
2079     struct mtget buf;
2080     long ds;
2081
2082     ds = buf.mt_dsreg;
2083 ]])],[AC_DEFINE(HAVE_MT_DSREG,1,Define if the mtget structure has an mt_dsreg field)],[mt_dsreg_result="not found"])
2084 AC_MSG_RESULT($mt_dsreg_result)
2085
2086 AC_MSG_CHECKING(for mt_erreg mtget structure element)
2087 mt_erreg_result="found"
2088 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2089 #include <stdio.h>
2090 #include <sys/types.h>
2091 #include <sys/mtio.h>
2092 ]], [[
2093     struct mtget buf;
2094     long ds;
2095
2096     ds = buf.mt_erreg;
2097 ]])],[AC_DEFINE(HAVE_MT_ERREG,1,Define if the mtget structure has an mt_erreg field)],[mt_erreg_result="not found"])
2098 AC_MSG_RESULT($mt_erreg_result)
2099
2100 dnl
2101
2102 dnl Check if the system does support the user requested database library.
2103 dnl Begin by checking for the header file.  If it is not there, then do
2104 dnl not use the library.  If the header file is there, then try to link
2105 dnl against the library.   If it's not there, then try to link using
2106 dnl just the -lc library.  If the link against -lc fails, then do not
2107 dnl use this library.
2108 DB_HEADER=
2109 DB_LIB=
2110
2111 dnl Testing if libc contains the dbm_open routine is tested for a
2112 dnl lot of times below.  We do it once here now.
2113 save_LIBS="$LIBS"
2114 AC_CHECK_LIB(c,dbm_open)
2115 LIBS="$save_LIBS"
2116
2117 case "$DB_STYLE" in
2118     db)
2119         if test "$ac_cv_header_db_h" = yes; then
2120             AC_CHECK_LIB(db,main)
2121             if test "$ac_cv_lib_db_main" = yes; then
2122                 AC_CHECK_LIB(db,dbm_open)
2123                 if test "$ac_cv_lib_db_dbm_open" = yes; then
2124                     DB_HEADER=db.h
2125                     DB_LIB=db
2126                 else
2127                     DB_STYLE=
2128                     AC_MSG_WARN([*** db database library requested but dbm_open not found in -ldb.])
2129                 fi
2130             else
2131                 if test "$ac_cv_lib_c_dbm_open" = yes; then
2132                     DB_HEADER=db.h
2133                     DB_LIB=c
2134                 else
2135                     DB_STYLE=
2136                     AC_MSG_WARN([*** db library requested but -ldb doesn't exist and dbm_open cannot be found.])
2137                 fi
2138             fi
2139         else
2140             DB_STYLE=
2141             AC_MSG_WARN([*** db database library requested but db.h not found.])
2142         fi
2143         ;;
2144
2145     dbm)
2146         if test "$ac_cv_header_dbm_h" = yes; then
2147             AC_CHECK_LIB(dbm,main)
2148             if test "$ac_cv_lib_dbm_main" = yes; then
2149                 AC_CHECK_LIB(dbm,dbm_open)
2150                 if test "$ac_cv_lib_dbm_dbm_open" = yes; then
2151                     DB_HEADER=dbm.h
2152                     DB_LIB=dbm
2153                 else
2154                     DB_STYLE=
2155                     AC_MSG_WARN([*** dbm database library requested but dbm_open not found in -ldbm.])
2156                 fi
2157             else
2158                 if test "$ac_cv_lib_c_dbm_open" = yes; then
2159                     DB_HEADER=dbm.h
2160                     DB_LIB=c
2161                 else
2162                     DB_STYLE=
2163                     AC_MSG_WARN([*** dbm library requested but -ldbm doesn't exist and dbm_open cannot be found.])
2164                 fi
2165             fi
2166         else
2167             DB_STYLE=
2168             AC_MSG_WARN([*** dbm database library requested but dbm.h not found.])
2169         fi
2170         ;;
2171
2172     gdbm)
2173         if test "$ac_cv_header_ndbm_h" = yes; then
2174             AC_CHECK_LIB(gdbm,main)
2175             if test "$ac_cv_lib_gdbm_main" = yes; then
2176                 AC_CHECK_LIB(gdbm,dbm_open)
2177                 if test "$ac_cv_lib_gdbm_dbm_open" = yes; then
2178                     DB_HEADER=ndbm.h
2179                     DB_LIB=gdbm
2180                 else
2181                     DB_STYLE=
2182                     AC_MSG_WARN([*** gdbm database library requested but -lgdbm not found.])
2183                 fi
2184             else
2185                 if test "$ac_cv_lib_c_dbm_open" = yes; then
2186                     DB_HEADER=ndbm.h
2187                     DB_LIB=c
2188                 else
2189                     DB_STYLE=
2190                     AC_MSG_WARN([*** gdbm library requested but -lgdbm doesn't exist and dbm_open cannot be found.])
2191                 fi
2192             fi
2193         else
2194             DB_STYLE=
2195             AC_MSG_WARN([*** gdbm database library requested but ndbm.h not found.])
2196         fi
2197         ;;
2198
2199     ndbm)
2200         if test "$ac_cv_header_ndbm_h" = yes; then
2201             AC_CHECK_LIB(ndbm,main)
2202             if test "$ac_cv_lib_ndbm_main" = yes; then
2203                 AC_CHECK_LIB(ndbm,dbm_open)
2204                 if test "$ac_cv_lib_ndbm_dbm_open" = yes; then
2205                     DB_HEADER=ndbm.h
2206                     DB_LIB=ndbm
2207                 else
2208                     DB_STYLE=
2209                     AC_MSG_WARN([*** ndbm database library requested but -lndbm not found.])
2210                 fi
2211             else
2212                 if test "$ac_cv_lib_c_dbm_open" = yes; then
2213                     DB_HEADER=ndbm.h
2214                     DB_LIB=c
2215                 else
2216                     DB_STYLE=
2217                     AC_MSG_WARN([*** ndbm library requested but -lndbm doesn't exist and dbm_open cannot be found.])
2218                 fi
2219             fi
2220         else
2221             DB_STYLE=
2222             AC_MSG_WARN([*** ndbm database library requested but ndbm.h not found.])
2223         fi
2224         ;;
2225     text)
2226         DB_HEADER=
2227         DB_LIB=
2228         ;;
2229 esac
2230
2231 dnl If a database style was not specified select an appropriate one
2232 dnl automatically.
2233 dnl Nowadays we default to our own internal text database, but I have left
2234 dnl the code that does the testing here just in case it is needed one day.
2235
2236 if test -z "$DB_STYLE"; then
2237     DB_STYLE=text
2238     DB_HEADER=
2239     DB_LIB=
2240 fi
2241
2242 dnl if test -z "$DB_STYLE" -a "$ac_cv_header_ndbm_h" = yes; then
2243 dnl     AC_CHECK_LIB(ndbm,dbm_open)
2244 dnl     if test "$ac_cv_lib_ndbm_dbm_open" = yes; then
2245 dnl     DB_STYLE=ndbm
2246 dnl     DB_HEADER=ndbm.h
2247 dnl     DB_LIB=ndbm
2248 dnl     elif test "$ac_cv_lib_c_dbm_open" = yes; then
2249 dnl     DB_STYLE=ndbm
2250 dnl     DB_HEADER=ndbm.h
2251 dnl     DB_LIB=c
2252 dnl    fi
2253 dnl fi
2254 dnl
2255 dnl if test -z "$DB_STYLE" -a "$ac_cv_header_db_h" = yes; then
2256 dnl    AC_CHECK_LIB(db,dbm_open)
2257 dnl    if test "$ac_cv_lib_db_dbm_open" = yes; then
2258 dnl     DB_STYLE=db
2259 dnl     DB_HEADER=db.h
2260 dnl     DB_LIB=db
2261 dnl    elif test "$ac_cv_lib_c_dbm_open" = yes; then
2262 dnl     DB_STYLE=db
2263 dnl     DB_HEADER=db.h
2264 dnl     DB_LIB=c
2265 dnl    fi
2266 dnl fi
2267 dnl
2268 dnl if test -z "$DB_STYLE" -a "$ac_cv_header_dbm_h" = yes; then
2269 dnl    AC_CHECK_LIB(dbm,dbm_open)
2270 dnl    if test "$ac_cv_lib_db_dbm_open" = yes; then
2271 dnl     DB_STYLE=dbm
2272 dnl     DB_HEADER=dbm.h
2273 dnl     DB_LIB=dbm
2274 dnl    elif test "$ac_cv_lib_c_dbm_open" = yes; then
2275 dnl     DB_STYLE=dbm
2276 dnl     DB_HEADER=dbm.h
2277 dnl     DB_LIB=c
2278 dnl    fi
2279 dnl fi
2280 dnl
2281 dnl if test -z "$DB_STYLE" -a "$ac_cv_header_ndbm_h" = yes; then
2282 dnl    AC_CHECK_LIB(gdbm,dbm_open)
2283 dnl    if test "$ac_cv_lib_gdbm_dbm_open" = yes; then
2284 dnl     DB_STYLE=gdbm
2285 dnl     DB_HEADER=ndbm.h
2286 dnl     DB_LIB=gdbm
2287 dnl    elif test "$ac_cv_lib_c_dbm_open" = yes; then
2288 dnl     DB_STYLE=gdbm
2289 dnl     DB_HEADER=ndbm.h
2290 dnl     DB_LIB=c
2291 dnl    fi
2292 dnl fi
2293 dnl
2294 dnl if test -z "$DB_STYLE"; then
2295 dnl    if test "$ac_cv_lib_c_dbm_open" = yes; then
2296 dnl     AC_MSG_WARN([*** A dbm_open() routine was found in -lc, but no header])
2297 dnl     AC_MSG_WARN([*** files exist.  Please remedy the situation.])
2298 dnl    else
2299 dnl     AC_MSG_WARN([*** No dbm_open() routine found!])
2300 dnl    fi
2301 dnl    AC_MSG_WARN([*** You may want to install the gdbm library from])
2302 dnl    AC_MSG_WARN([*** ftp://prep.ai.mit.edu/pub/gnu/gdbm-1.7.3.tar.gz.])
2303 dnl
2304 dnl    AC_MSG_WARN([*** Using the built-in text database.])
2305 dnl    DB_STYLE=text
2306 dnl    DB_HEADER=
2307 dnl    DB_LIB=
2308 dnl fi
2309
2310 if test "$DB_STYLE" = text; then
2311     AC_DEFINE(TEXTDB,1,[Define to enable the text-based database format. ])
2312 else
2313     AC_MSG_CHECKING([for database])
2314     AC_MSG_RESULT([header is $DB_HEADER, linking against -l$DB_LIB])
2315     case "$DB_STYLE" in
2316         db)     AC_DEFINE(USE_DB_H,1,[Define to enable db databases. ])   ;;
2317         dbm)    AC_DEFINE(USE_DBM_H,1,[Define to enable dbm databases. ])  ;;
2318         gdbm)   AC_DEFINE(USE_GDBM_H,1,[Define to enable gdbm databases. ]) ;;
2319         ndbm)   AC_DEFINE(USE_NDBM_H,1,[Define to enable ndbm databases. ]) ;;
2320     esac
2321
2322     AC_CACHE_CHECK(
2323         [for struct datum declared in header files],
2324         amanda_cv_struct_datum,
2325         [
2326             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2327 #if defined(USE_DB_H)
2328 #  include <db.h>
2329 #else
2330 #  if defined(USE_DBM_H)
2331 #    include <dbm.h>
2332 #  else
2333 #    if defined(USE_NDBM_H)
2334 #      include <ndbm.h>
2335 #    endif
2336 #  endif
2337 #endif
2338                 ]], [[
2339                     datum a;
2340                 ]])],[amanda_cv_struct_datum=yes],[amanda_cv_struct_datum=no
2341             ])
2342         ])
2343     if test "$amanda_cv_struct_datum" = yes; then
2344         AC_DEFINE(HAVE_STRUCT_DATUM,1,[Define if the database header declares struct datum. ])
2345     fi
2346 fi
2347
2348 case "$DB_STYLE" in
2349     db) DB_EXT=.db;;
2350     gdbm) DB_EXT='""';;
2351     dbm | ndbm) DB_EXT=".dir .pag";;
2352     text) DB_EXT='""';;
2353     *) DB_EXT=;;
2354 esac
2355 AC_SUBST(DB_EXT)
2356
2357 AC_CACHE_CHECK(whether _POSIX2_RE_DUP_MAX is defined,
2358     amanda_cv_have__posix2_re_dup_max,
2359     AC_EGREP_CPP(yes, [
2360 #include <limits.h>
2361 #ifdef _POSIX2_RE_DUP_MAX
2362   yes
2363 #endif
2364 ], amanda_cv_have__posix2_re_dup_max=yes, amanda_cv_have__posix2_re_dup_max=no))
2365 if test "$amanda_cv_have__posix2_re_dup_max" = yes; then
2366     AC_DEFINE(HAVE__POSIX2_RE_DUP_MAX,1,[Define if limits.h defines _POSIX2_RE_DUP_MAX. ])
2367 fi
2368
2369 AC_CACHE_CHECK(whether CHAR_MIN is defined,
2370     amanda_cv_have_char_min,
2371     AC_EGREP_CPP(yes, [
2372 #include <limits.h>
2373 #ifdef CHAR_MIN
2374   yes
2375 #endif
2376 ], amanda_cv_have_char_min=yes, amanda_cv_have_char_min=no))
2377 if test "$amanda_cv_have_char_min" = yes; then
2378     AC_DEFINE(HAVE_CHAR_MIN,1,[Define if limits.h defines CHAR_MIN. ])
2379 fi
2380
2381 AC_CACHE_CHECK(whether CHAR_MAX is defined,
2382     amanda_cv_have_char_max,
2383     AC_EGREP_CPP(yes, [
2384 #include <limits.h>
2385 #ifdef CHAR_MAX
2386   yes
2387 #endif
2388 ], amanda_cv_have_char_max=yes, amanda_cv_have_char_max=no))
2389 if test "$amanda_cv_have_char_max" = yes; then
2390     AC_DEFINE(HAVE_CHAR_MAX,1,[Define if limits.h defines CHAR_MAX. ])
2391 fi
2392
2393 AC_CACHE_CHECK(whether CHAR_BIT is defined,
2394     amanda_cv_have_char_bit,
2395     AC_EGREP_CPP(yes, [
2396 #include <limits.h>
2397 #ifdef CHAR_BIT
2398   yes
2399 #endif
2400 ], amanda_cv_have_char_bit=yes, amanda_cv_have_char_bit=no))
2401 if test "$amanda_cv_have_char_bit" = yes; then
2402     AC_DEFINE(HAVE_CHAR_BIT,1,[Define if limits.h defines CHAR_BIT. ])
2403 fi
2404
2405 dnl Checks for library functions and if the function is declared in
2406 dnl an appropriate header file.  Add some of the missing functions
2407 dnl to LIBOBJS.
2408 ICE_CHECK_DECL(accept,sys/types.h sys/socket.h)
2409 AC_FUNC_ALLOCA
2410 AC_CHECK_FUNCS(atexit)
2411 ICE_CHECK_DECL(atof,stdlib.h)
2412 AC_CHECK_FUNCS(basename)
2413 ICE_CHECK_DECL(bind,sys/types.h sys/socket.h)
2414 ICE_CHECK_DECL(bcopy,string.h strings.h stdlib.h)
2415 ICE_CHECK_DECL(bzero,string.h strings.h stdlib.h)
2416 AC_FUNC_CLOSEDIR_VOID
2417 ICE_CHECK_DECL(closelog,syslog.h)
2418 ICE_CHECK_DECL(connect,sys/types.h sys/socket.h)
2419 ICE_CHECK_DECL(dbm_open,${DB_HEADER-no/db/header/file})
2420 AC_CHECK_FUNCS(endmntent)
2421 ICE_CHECK_DECL(fclose,stdio.h)
2422 ICE_CHECK_DECL(fflush,stdio.h)
2423 ICE_CHECK_DECL(flock,sys/file.h)
2424 ICE_CHECK_DECL(fprintf,stdio.h)
2425 ICE_CHECK_DECL(fputc,stdio.h)
2426 ICE_CHECK_DECL(fputs,stdio.h)
2427 ICE_CHECK_DECL(fread,stdio.h stdlib.h)
2428 ICE_CHECK_DECL(fseek,stdio.h)
2429 ICE_CHECK_DECL(fwrite,stdio.h stdlib.h)
2430 AC_REPLACE_FUNCS(getcwd)
2431 AC_CHECK_FUNCS(getfsent)
2432 ICE_CHECK_DECL(gethostname,unistd.h)
2433 AC_FUNC_GETMNTENT
2434 ICE_CHECK_DECL(getopt,stdlib.h unistd.h libc.h)
2435 ICE_CHECK_DECL(getpeername,sys/types.h sys/socket.h)
2436 AC_CHECK_FUNCS(getpgrp)
2437 AC_FUNC_GETPGRP
2438 ICE_CHECK_DECL(getsockname,sys/types.h sys/socket.h)
2439 ICE_CHECK_DECL(getsockopt,sys/types.h sys/socket.h)
2440 ICE_CHECK_DECL(gettimeofday,time.h sys/time.h)
2441 AMANDA_FUNC_GETTIMEOFDAY_ARGS
2442 AC_CHECK_FUNCS(getvfsent initgroups isascii)
2443 ICE_CHECK_DECL(initgroups,grp.h sys/types.h unistd.h libc.h)
2444 ICE_CHECK_DECL(ioctl,sys/ioctl.h unistd.h libc.h)
2445 ICE_CHECK_DECL(listen,sys/types.h sys/socket.h)
2446 ICE_CHECK_DECL(lstat,sys/types.h sys/stat.h)
2447 ICE_CHECK_DECL(malloc,stdlib.h)
2448 AC_REPLACE_FUNCS(memmove)
2449 ICE_CHECK_DECL(memmove,string.h strings.h)
2450 ICE_CHECK_DECL(memset,string.h strings.h)
2451 AC_CHECK_FUNCS(mkdir)
2452 ICE_CHECK_DECL(mktemp,stdlib.h)
2453 AC_REPLACE_FUNCS(mktime)
2454 ICE_CHECK_DECL(mktime,time.h sys/time.h)
2455 AC_FUNC_MMAP
2456 dnl atexit() is prefered, sunos (maybe others?) define on_exit
2457 AC_CHECK_FUNCS(on_exit)
2458 ICE_CHECK_DECL(openlog,syslog.h)
2459 ICE_CHECK_DECL(pclose,stdio.h)
2460 ICE_CHECK_DECL(perror,stdio.h)
2461 ICE_CHECK_DECL(printf,stdio.h)
2462 AC_CHECK_FUNCS(putenv)
2463 ICE_CHECK_DECL(puts,stdio.h)
2464 ICE_CHECK_DECL(realloc,stdlib.h)
2465 ICE_CHECK_DECL(recvfrom,sys/types.h sys/socket.h)
2466 ICE_CHECK_DECL(remove,stdio.h)
2467 ICE_CHECK_DECL(rename,stdio.h)
2468 ICE_CHECK_DECL(rewind,stdio.h)
2469 AC_CHECK_FUNCS(rmdir)
2470 ICE_CHECK_DECL(ruserok,netdb.h sys/socket.h libc.h unistd.h)
2471 ICE_CHECK_DECL(select,sys/types.h sys/socket.h sys/select.h time.h sys/time.h)
2472 AMANDA_FUNC_SELECT_ARG_TYPE
2473 ICE_CHECK_DECL(sendto,sys/types.h sys/socket.h)
2474 ICE_CHECK_DECL(setegid,unistd.h)
2475 ICE_CHECK_DECL(seteuid,unistd.h)
2476 AC_CHECK_FUNCS(setmntent)
2477 ICE_CHECK_DECL(setresgid,unistd.h)
2478 ICE_CHECK_DECL(setresuid,unistd.h)
2479
2480 dnl arguments for setpgrp or not
2481 AC_CHECK_FUNC(setpgid, [
2482         AC_DEFINE(HAVE_SETPGID,1,[Define if setpgid() is available. ])
2483         ICE_CHECK_DECL(setpgid,sys/types.h unistd.h)
2484 ])
2485 AC_CHECK_FUNC(setpgrp,[AC_FUNC_SETPGRP])
2486 ICE_CHECK_DECL(setpgrp,sys/types.h unistd.h libc.h)
2487
2488 ICE_CHECK_DECL(setsockopt,sys/types.h sys/socket.h)
2489
2490 AC_CHECK_FUNCS(shmget,
2491     [
2492         AMANDA_FUNC_SHM_ARG_TYPE
2493         case "$FORCE_MMAP" in
2494         n | no)
2495             AC_DEFINE(HAVE_SYSVSHM,1,[Define if SysV shared-memory functions are available. ])
2496           ;;
2497         esac
2498     ]
2499 )
2500 ICE_CHECK_DECL(shmat,sys/types.h sys/ipc.h sys/shm.h)
2501 ICE_CHECK_DECL(shmctl,sys/types.h sys/ipc.h sys/shm.h)
2502 ICE_CHECK_DECL(shmdt,sys/types.h sys/ipc.h sys/shm.h)
2503 ICE_CHECK_DECL(shmget,sys/types.h sys/ipc.h sys/shm.h)
2504
2505 if test "$ac_cv_func_mmap_fixed_mapped" != yes; then
2506     case "$FORCE_MMAP" in
2507     n | no)
2508         if test "$ac_cv_func_shmget" != yes; then
2509             AC_MSG_WARN([*** Neither shmget() nor mmap() found!])
2510             AC_MSG_WARN([*** This system will not support the Amanda server.])
2511             NO_SERVER_MODE=true
2512         fi
2513       ;;
2514     y | ye | yes)
2515         AC_MSG_WARN([*** --with-mmap used on a system with no mmap() support!])
2516         AC_MSG_WARN([*** This system will not support the Amanda server.])
2517         NO_SERVER_MODE=true
2518       ;;
2519     esac
2520 fi
2521
2522 ICE_CHECK_DECL(shquote, stdlib.h)
2523
2524 dnl Some systems have snprintf but not vsnprintf.  If either snprintf or
2525 dnl vsnprintf are missing, then use the snprintf.c we provide.
2526 ICE_CHECK_DECL(snprintf,stdio.h)
2527 ICE_CHECK_DECL(vsnprintf,stdio.h)
2528 if test x"$ice_have_snprintf" != x"yes" ||
2529    test x"$ice_have_vsnprintf" != x"yes"; then
2530     AC_LIBOBJ([snprintf])
2531     if false; then :
2532         dnl so that automake includes snprintf.c in the distribution
2533         AC_REPLACE_FUNCS(snprintf) 
2534     fi
2535 fi
2536
2537 AC_CHECK_FUNCS(sigaction sigemptyset sigvec)
2538 ICE_CHECK_DECL(socket,sys/types.h sys/socket.h)
2539 ICE_CHECK_DECL(socketpair,sys/types.h sys/socket.h)
2540 ICE_CHECK_DECL(sscanf,stdio.h)
2541 AC_CHECK_FUNCS(statfs statvfs)
2542 AC_REPLACE_FUNCS(strerror)
2543 ICE_CHECK_DECL(strerror,string.h strings.h)
2544 AC_FUNC_STRFTIME
2545 AC_REPLACE_FUNCS(strftime)
2546 ICE_CHECK_DECL(strftime,time.h sys/time.h)
2547 AC_REPLACE_FUNCS(strncasecmp)
2548 ICE_CHECK_DECL(strncasecmp,string.h strings.h)
2549 AC_REPLACE_FUNCS(strstr)
2550 ICE_CHECK_DECL(syslog,syslog.h)
2551 ICE_CHECK_DECL(system,stdlib.h)
2552 ICE_CHECK_DECL(time,time.h sys/time.h)
2553 ICE_CHECK_DECL(tolower,ctype.h)
2554 ICE_CHECK_DECL(toupper,ctype.h)
2555 ICE_CHECK_DECL(ungetc,stdio.h)
2556 AC_FUNC_VPRINTF
2557 ICE_CHECK_DECL(vfprintf,stdio.h stdlib.h)
2558 ICE_CHECK_DECL(vprintf,stdio.h stdlib.h)
2559 ICE_CHECK_DECL(vsprintf,stdio.h stdlib.h)
2560 AC_CHECK_FUNC(wait4)
2561 AC_REPLACE_FUNCS(waitpid)
2562 AC_REPLACE_FUNCS(strcasecmp)
2563 ICE_CHECK_DECL(strcasecmp,string.h strings.h)
2564
2565 AC_CHECK_FUNCS(fnmatch)
2566
2567 if test "$ac_cv_func_fnmatch" != yes -a "$USE_QUICK_AND_DIRTY_ESTIMATES" != yes ; then
2568     AC_MSG_WARN([--with-qde and no fnmatch -- gnutar exclude files will not work])
2569 fi
2570
2571 dnl disk device prefixes
2572 AC_MSG_CHECKING(disk device prefixes)
2573 dnl Use df to find the mount point for the root filesystem.  Use
2574 dnl the positional parameters to find the particular line from df
2575 dnl that contains the root paritition.  We put it in a subshell so
2576 dnl that the original positional parameters are not messed with.
2577 dfline=`(
2578     df / | while read line; do
2579         set -- $line
2580         while test $# -gt 0; do
2581             if test "$1" = "/"; then
2582                 echo $line
2583                 break 2
2584             fi
2585             shift
2586         done
2587     done
2588 ) | sed 's/(//' | sed 's/)//' `
2589
2590 dnl Search for the mount point by using expr to find the parameter
2591 dnl with dev in it.
2592 mount=`(
2593     set -- $dfline
2594     while test $# -gt 0; do
2595         if expr "$1" : '.*dev' >/dev/null 2>&1; then
2596             echo $1
2597             break
2598         fi
2599         shift
2600     done
2601 )`
2602
2603 if test "$DEV_PREFIX" && test "$RDEV_PREFIX"; then
2604     AC_MSG_RESULT((predefined) $DEV_PREFIX - $RDEV_PREFIX)
2605 else
2606     if test -d /dev/dsk; then
2607         DEV_PREFIX=/dev/dsk/
2608         if test -d /dev/rdsk; then
2609             RDEV_PREFIX=/dev/rdsk/
2610         else
2611             RDEV_PREFIX=/dev/dsk/
2612         fi
2613     elif test -d /dev; then
2614         case "$target" in
2615             *-sni-sysv4)
2616                 dev_prefix=/dev/dsk/
2617                 rdev_prefix=/dev/rdsk/
2618                 AC_MSG_WARN("*** Run amsinixfixdevs on Sinix systems using VxFS.")
2619                 ;;
2620
2621             *)
2622                 DEV_PREFIX=/dev/
2623                 # Some systems, notably Linux, do not have raw disk devices
2624                 # names.  Check this by trying to see if a raw disk device name
2625                 # exists using the normal raw device path prepended to the
2626                 # mount point of the root filesystem.
2627                 if test "$mount"; then
2628                     dev_name="/dev/r`basename $mount`"
2629                     if test -b $dev_name -o -c $dev_name; then
2630                         RDEV_PREFIX=/dev/r
2631                     else
2632                         RDEV_PREFIX=/dev/
2633                     fi
2634                 else
2635                     RDEV_PREFIX=/dev/r
2636                 fi
2637                 ;;
2638         esac
2639     else
2640         DEV_PREFIX=/
2641         RDEV_PREFIX=/
2642     fi
2643     AC_MSG_RESULT($DEV_PREFIX - $RDEV_PREFIX)
2644 fi
2645
2646 AC_DEFINE_UNQUOTED(DEV_PREFIX,"${DEV_PREFIX}",[Define as the prefix for disk devices, commonly /dev/ or /dev/dsk/ ])
2647 AC_DEFINE_UNQUOTED(RDEV_PREFIX,"${RDEV_PREFIX}",[Define as the prefix for raw disk devices, commonly /dev/r or /dev/rdsk/ ])
2648
2649 case $mount in
2650     /dev/vg*)
2651         AC_MSG_WARN("*** Run amhpfixdevs on HP-UX systems using /dev/vg??.")
2652         ;;
2653 esac
2654
2655 dnl lock/flock/fcntl
2656 AC_CACHE_CHECK(
2657    [whether posix fcntl locking works],
2658    amanda_cv_posix_filelocking,
2659    [
2660         AC_RUN_IFELSE([AC_LANG_SOURCE([[
2661 #undef  ASSERTIONS
2662 #define CONFIGURE_TEST
2663 #define USE_POSIX_FCNTL
2664 #include "${srcdir-.}/common-src/amflock.c"
2665 ]])],[
2666         amanda_cv_posix_filelocking=yes
2667 ],[
2668         amanda_cv_posix_filelocking="no"
2669 ],[
2670         amanda_cv_posix_filelocking="no (cannot run test)"
2671 ])
2672     rm -f /tmp/conftest.lock
2673 ])
2674 if test "$amanda_cv_posix_filelocking" = yes; then
2675     AC_DEFINE(USE_POSIX_FCNTL,1,[Define to use Posix fcntl for file locking.])
2676     HAS_WORKING_FILE_LOCK=1
2677 fi
2678
2679 if test -z "$HAS_WORKING_FILE_LOCK"; then
2680     AC_CACHE_CHECK(
2681         [whether flock locking works],
2682         amanda_cv_flock_filelocking,
2683         [
2684             AC_RUN_IFELSE([AC_LANG_SOURCE([[
2685 #undef  ASSERTIONS
2686 #define CONFIGURE_TEST
2687 #define USE_FLOCK
2688 #include "${srcdir-.}/common-src/amflock.c"
2689 ]])],[
2690                     amanda_cv_flock_filelocking="yes"
2691 ],[
2692                     amanda_cv_flock_filelocking="no"
2693 ],[
2694                     amanda_cv_flock_filelocking="no (cannot run test)"
2695 ])
2696         rm -f /tmp/conftest.lock
2697 ])
2698     if test "$amanda_cv_flock_filelocking" = yes; then
2699         AC_DEFINE(USE_FLOCK,1,[Define to use flock for file locking.])
2700         HAS_WORKING_FILE_LOCK=1
2701     fi
2702 fi
2703
2704 if test -z "$HAS_WORKING_FILE_LOCK"; then
2705     AC_CACHE_CHECK(
2706         [whether lockf locking works],
2707         amanda_cv_lockf_filelocking,
2708         [
2709             AC_RUN_IFELSE([AC_LANG_SOURCE([[
2710 #undef  ASSERTIONS
2711 #define CONFIGURE_TEST
2712 #define USE_LOCKF
2713 #include "${srcdir-.}/common-src/amflock.c"
2714 ]])],[
2715                     amanda_cv_lockf_filelocking="yes"
2716 ],[
2717                     amanda_cv_lockf_filelocking="no"
2718 ],[
2719                     amanda_cv_lockf_filelocking="no (cannot run test)"
2720 ])
2721         rm -f /tmp/conftest.lock
2722 ])
2723     if test "$amanda_cv_lockf_filelocking" = yes; then
2724         AC_DEFINE(USE_LOCKF,1,[Define to use lockf for file locking.])
2725         HAS_WORKING_FILE_LOCK=1
2726     fi
2727 fi
2728
2729 if test -z "$HAS_WORKING_FILE_LOCK"; then
2730     AC_CACHE_CHECK(
2731         [whether lnlock locking works],
2732         amanda_cv_lnlock_filelocking,
2733         [
2734             AC_RUN_IFELSE([AC_LANG_SOURCE([[
2735 #undef  ASSERTIONS
2736 #define CONFIGURE_TEST
2737 #define USE_LNLOCK
2738 #include "${srcdir-.}/common-src/amflock.c"
2739 #include "${srcdir-.}/common-src/alloc.c"
2740 #include "${srcdir-.}/common-src/error.c"
2741 #include "${srcdir-.}/common-src/snprintf.c"
2742 ]])],[
2743                     amanda_cv_lnlock_filelocking="yes"
2744 ],[
2745                     amanda_cv_lnlock_filelocking="no"
2746 ],[
2747                     amanda_cv_lnlock_filelocking="no (cannot run test)"
2748 ])
2749         rm -f /tmp/conftest.lock
2750 ])
2751     if test "$amanda_cv_lnlock_filelocking" = yes; then
2752         AC_DEFINE(USE_LNLOCK,1,[Define to use a hard-link based approach for file locking.])
2753         HAS_WORKING_FILE_LOCK=1
2754     fi
2755 fi
2756
2757 if test -z "$HAS_WORKING_FILE_LOCK"; then
2758     AC_MSG_WARN([*** No working file locking capability found!])
2759     AC_MSG_WARN([*** Be VERY VERY careful.])
2760 fi
2761
2762 dnl extra substitution parameters
2763 AC_SUBST(CHS)
2764 AC_SUBST(MTX)
2765 AC_SUBST(MCUTIL)
2766 AC_SUBST(ac_n)
2767 AC_SUBST(ac_c)
2768
2769 AM_CONDITIONAL(WANT_CLIENT, test x"$NO_CLIENT_MODE" != x"true")
2770 AM_CONDITIONAL(WANT_SAMBA, test ! -z "$SAMBA_CLIENT")
2771 AM_CONDITIONAL(WANT_RESTORE, test x"$NO_RESTORE_MODE" != x"true")
2772 AM_CONDITIONAL(WANT_SERVER, test x"$NO_SERVER_MODE" != x"true")
2773 AM_CONDITIONAL(WANT_RECOVER, test x"$NO_RECOVER_MODE" != x"true" && test x"$NO_CLIENT_MODE" != x"true")
2774 AM_CONDITIONAL(WANT_TAPE, test x"$NO_SERVER_MODE" != x"true" || test x"$NO_RESTORE_MODE" != x"true")
2775 AM_CONDITIONAL(WANT_AMPLOT, test x"$NO_AMPLOT_MODE" != x"true")
2776 AM_CONDITIONAL(WANT_CHG_SCSI, test x"$NO_SCSI_CHANGER_MODE" != x"true")
2777 AM_CONDITIONAL(WANT_CHIO_SCSI, test x"$NO_CHIO_CHANGER_MODE" != x"true")
2778 AM_CONDITIONAL(WANT_RUNTIME_PSEUDO_RELOC, test x"$NEED_RUNTIME_PSEUDO_RELOC" = x"true")
2779 AM_CONDITIONAL(WANT_SETUID_CLIENT, test x"$NEED_SETUID_CLIENT" != x"false")
2780
2781 case "${FORCE_USE_RUNDUMP-${USE_RUNDUMP}}" in
2782 y |  ye | yes) AC_DEFINE(USE_RUNDUMP,1,[Define to invoke rundump (setuid-root) instead of DUMP program directly. ]);;
2783 esac
2784
2785 # This is necessary so that .o files in LIBOBJS are also built via
2786 # the ANSI2KNR-filtering rules.
2787 LIB@&t@OBJS=`echo "$LIB@&t@OBJS" |
2788              sed 's,\.[[^.]]* ,$U&,g;s,\.[[^.]]*$,$U&,'`
2789 LTLIBOBJS=`echo "$LIB@&t@OBJS" |
2790            sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
2791 AC_SUBST(LTLIBOBJS)
2792
2793 LTALLOCA=`echo "$ALLOCA" | sed 's/\.'"${ac_objext}"'/\.lo/g'`
2794 AC_SUBST(LTALLOCA)
2795
2796 AC_CONFIG_FILES([\
2797         amplot/amcat.awk                amplot/amplot.sh                \
2798         amplot/Makefile                                                 \
2799                                                                         \
2800         changer-src/chg-manual.sh       changer-src/chg-multi.sh        \
2801         changer-src/chg-mtx.sh          changer-src/chg-chs.sh          \
2802         changer-src/chg-rth.pl          changer-src/chg-chio.pl         \
2803         changer-src/chg-zd-mtx.sh       changer-src/Makefile            \
2804         changer-src/chg-juke.sh         changer-src/chg-rait.sh         \
2805         changer-src/chg-null.sh         changer-src/chg-mcutil.sh       \
2806         changer-src/chg-disk.sh         changer-src/chg-iomega.pl       \
2807                                                                         \
2808         client-src/patch-system.sh      client-src/Makefile             \
2809                                                                         \
2810         common-src/versuff.c            common-src/Makefile             \
2811                                                                         \
2812         example/amanda.conf             example/Makefile                \
2813         example/amanda.conf.chg-scsi    example/chg-scsi-linux.conf     \
2814         example/chg-scsi-solaris.conf   example/chg-scsi-hpux.conf      \
2815         example/chg-mcutil.conf                                         \
2816                                                                         \
2817         man/Makefile                                                    \
2818                                                                         \
2819         docs/Makefile                                                   \
2820                                                                         \
2821         recover-src/Makefile                                            \
2822                                                                         \
2823         restore-src/Makefile                                            \
2824                                                                         \
2825         server-src/amcheckdb.sh         server-src/amcleanup.sh         \
2826         server-src/amdump.sh            server-src/amfreetapes.sh       \
2827         server-src/amoverview.pl        server-src/amrmtape.sh          \
2828         server-src/amtoc.pl             server-src/amverify.sh          \
2829         server-src/Makefile             server-src/amstatus.pl          \
2830         server-src/amverifyrun.sh                                       \
2831                                                                         \
2832         tape-src/Makefile                                               \
2833                                                                         \
2834         config/Makefile                 Makefile])
2835 AC_OUTPUT