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