Imported Upstream version 2.4.4p3
[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.4p3)
18 AM_CONFIG_HEADER(config/config.h)
19
20 AC_PREREQ(2.57)         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 AC_HEADER_TIME
1658 AC_CHECK_HEADERS(\
1659         arpa/inet.h \
1660         camlib.h \
1661         cam/cam.h \
1662         cam/scsi/scsi_message.h \
1663         chio.h \
1664         db.h \
1665         dbm.h \
1666         fcntl.h \
1667         fnmatch.h \
1668         fstab.h \
1669         grp.h \
1670         history.h \
1671         libc.h \
1672         limits.h \
1673         linux/zftape.h \
1674         mntent.h \
1675         mnttab.h \
1676         ndbm.h \
1677         netdb.h \
1678         netinet/in_systm.h \
1679         readline.h \
1680         readline/history.h \
1681         readline/readline.h \
1682         scsi/sg.h \
1683         scsi/scsi_ioctl.h \
1684         stdlib.h \
1685         string.h \
1686         strings.h \
1687         sys/chio.h \
1688         sys/dsreq.h \
1689         sys/fcntl.h \
1690         sys/file.h \
1691         sys/ioctl.h \
1692         sys/ipc.h \
1693         sys/mman.h \
1694         sys/mntent.h \
1695         sys/mtio.h \
1696         sys/param.h \
1697         sys/scarray.h \
1698         sys/gscdds.h \
1699         sys/scsiio.h \
1700         sys/scsi.h \
1701         sys/scsi/impl/uscsi.h \
1702         sys/scsi/scsi/ioctl.h \
1703         sys/select.h \
1704         sys/shm.h \
1705         sys/stat.h \
1706         sys/statfs.h \
1707         sys/statvfs.h \
1708         sys/tape.h \
1709         sys/time.h \
1710         sys/types.h \
1711         sys/vfs.h \
1712         sys/vfstab.h \
1713         syslog.h \
1714         unistd.h \
1715         vtblc.h \
1716 )
1717
1718 AC_CHECK_HEADERS(netinet/ip.h,,,
1719 [[#include <sys/socket.h>
1720 #if HAVE_SYS_TYPES_H
1721 #include <sys/types.h>
1722 #endif
1723 #ifdef HAVE_NETINET_IN_SYSTM_H
1724 #include <netinet/in_systm.h>
1725 #endif
1726 #include <netinet/in.h>
1727 ]])
1728
1729 AC_CHECK_HEADERS(sys/mount.h,,,
1730 [[#ifdef HAVE_SYS_PARAM_H
1731 #include <sys/param.h>
1732 #endif
1733 ]])
1734
1735 NO_SCSI_CHANGER_MODE=true
1736 NO_CHIO_CHANGER_MODE=true
1737
1738 AC_C_BIGENDIAN
1739
1740 dnl
1741 dnl chio support
1742 dnl
1743 if test x"$ac_cv_header_sys_scsi_h" = x"yes"; then
1744     AC_CACHE_CHECK([for HP/UX-like scsi changer support],
1745         amanda_cv_hpux_scsi_chio,
1746         [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1747 #include <sys/scsi.h>
1748 ]], [[
1749         static struct element_addresses changer_info;
1750         int i = SIOC_ELEMENT_ADDRESSES;
1751         int j = SIOC_ELEMENT_STATUS;
1752         int k = SIOC_MOVE_MEDIUM;
1753 ]])],[amanda_cv_hpux_scsi_chio=yes],[amanda_cv_hpux_scsi_chio=no])])
1754     if test x"$amanda_cv_hpux_scsi_chio" = x"yes"; then
1755         AC_DEFINE(HAVE_HPUX_SCSI_CHIO,1,[Define to enable HPUX chio based changer support. ])
1756         NO_SCSI_CHANGER_MODE=false
1757     fi
1758 fi
1759
1760 dnl
1761 dnl Linux SCSI based on ioctl
1762 dnl
1763 if test x"$ac_cv_header_sys_mtio_h" = x"yes" &&
1764    test x"$ac_cv_header_scsi_scsi_ioctl_h" = x"yes"; then 
1765         AC_CACHE_CHECK([for Linux like scsi support (ioctl)],
1766         amanda_cv_linux_scsi,
1767         [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1768 #include <scsi/scsi_ioctl.h>
1769 #include <sys/mtio.h>
1770 ]], [[
1771         int device;
1772         char *Command;
1773         ioctl(device, SCSI_IOCTL_SEND_COMMAND, Command);
1774 ]])],[amanda_cv_linux_scsi=yes],[amanda_cv_linux_scsi=no])])
1775 fi
1776
1777 dnl
1778 dnl Linux SCSI based on sg
1779 dnl
1780 if test x"$ac_cv_header_sys_mtio_h" = x"yes" &&
1781    test x"$ac_cv_header_scsi_sg_h" = x"yes"; then 
1782         AC_CACHE_CHECK([for Linux like scsi support (sg)],
1783         amanda_cv_linux_sg_scsi,
1784         [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1785 #include <scsi/sg.h>
1786 #include <sys/mtio.h>
1787 ]], [[
1788         int device;
1789         struct sg_header *psg_header;
1790         char *buffer;
1791         write(device, buffer, 1);
1792 ]])],[amanda_cv_linux_sg_scsi=yes],[amanda_cv_linux_sg_scsi=no])])
1793 fi
1794
1795 if test x"$amanda_cv_linux_scsi" = x"yes" ||
1796  test x"$amanda_cv_linux_sg_scsi" = x"yes";then
1797         AC_DEFINE(HAVE_LINUX_LIKE_SCSI,1,[Define to enable Linux tape-changer support.])
1798         NO_SCSI_CHANGER_MODE=false
1799 fi
1800
1801 dnl
1802 dnl HP-UX SCSI
1803 dnl
1804 if test x"$ac_cv_header_sys_mtio_h" = x"yes" &&
1805    test x"$ac_cv_header_sys_scsi_h" = x"yes"; then 
1806         AC_CACHE_CHECK([for HP-UX like scsi support],
1807         amanda_cv_hpux_scsi,
1808         [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1809 #include <stdio.h>
1810 #include <sys/ioctl.h>
1811 #include <sys/scsi.h>
1812 #include <sys/mtio.h>
1813 ]], [[
1814         int device;
1815         char *Command;
1816         ioctl(device, SIOC_IO, Command);
1817 ]])],[amanda_cv_hpux_scsi=yes],[amanda_cv_hpux_scsi=no])])
1818         if test x"$amanda_cv_hpux_scsi" = x"yes";then
1819                 AC_DEFINE(HAVE_HPUX_LIKE_SCSI,1,[Define to enable HPUX tape-changer support. ])
1820                 NO_SCSI_CHANGER_MODE=false
1821                 NO_CHIO_CHANGER_MODE=false
1822         fi
1823 fi
1824
1825 dnl
1826 dnl IRIX SCSI
1827 dnl
1828 if test x"$ac_cv_header_sys_mtio_h" = x"yes" &&
1829    test x"$ac_cv_header_sys_dsreq_h" = x"yes"; then 
1830         AC_CACHE_CHECK([for Irix like scsi support],
1831         amanda_cv_irix_scsi,
1832         [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1833 #include <sys/types.h>
1834 #include <sys/dsreq.h>
1835 #include <sys/mtio.h>
1836 ]], [[
1837         int device=1;
1838         char Command;
1839         ioctl(device, DS_ENTER, &Command);
1840 ]])],[amanda_cv_irix_scsi=yes],[amanda_cv_irix_scsi=no])])
1841         if test x"$amanda_cv_irix_scsi" = x"yes";then
1842                 AC_DEFINE(HAVE_IRIX_LIKE_SCSI,1,[Define to enable IRIX tape-changer support])
1843                 NO_SCSI_CHANGER_MODE=false
1844         fi
1845 fi
1846
1847 dnl
1848 dnl Solaris  SCSI
1849 dnl
1850 if test x"$ac_cv_header_sys_mtio_h" = x"yes" &&
1851    test x"$ac_cv_header_sys_scsi_impl_uscsi_h" = x"yes"; then 
1852         AC_CACHE_CHECK([for Solaris like scsi support],
1853         amanda_cv_solaris_scsi,
1854         [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1855 #include <sys/types.h>
1856 #include <sys/scsi/impl/uscsi.h>
1857 #include <sys/mtio.h>
1858 ]], [[
1859         int device;
1860         char *Command;
1861         ioctl(device, USCSICMD, Command);
1862 ]])],[amanda_cv_solaris_scsi=yes],[amanda_cv_solaris_scsi=no])])
1863         if test x"$amanda_cv_solaris_scsi" = x"yes";then
1864                 AC_DEFINE(HAVE_SOLARIS_LIKE_SCSI,1,[Define to enable Solaris tape-changer support])
1865                 NO_SCSI_CHANGER_MODE=false
1866         fi
1867 fi
1868
1869 dnl
1870 dnl AIX SCSI
1871 dnl
1872 if test x"$ac_cv_header_sys_tape_h" = x"yes" &&
1873    test x"$ac_cv_header_sys_scarray_h" = x"yes" &&
1874    test x"$ac_cv_header_sys_gscdds_h" = x"yes"; then 
1875         AC_CACHE_CHECK([for AIX like scsi support],
1876         amanda_cv_aix_scsi,
1877         [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1878 #include <sys/types.h>
1879 #include <sys/scarray.h>
1880 #include <sys/tape.h>
1881 ]], [[
1882         int device;
1883         char *Command;
1884         ioctl(device, STIOCMD, Command);
1885 ]])],[amanda_cv_aix_scsi=yes],[amanda_cv_aix_scsi=no])])
1886         if test x"$amanda_cv_aix_scsi" = x"yes";then
1887                 AC_DEFINE(HAVE_AIX_LIKE_SCSI,1,[Define to enable AIX tape-changer support])
1888                 NO_SCSI_CHANGER_MODE=false
1889         fi
1890 fi
1891 dnl
1892 dnl BSD CAM SCSI
1893 dnl
1894 if test x"$ac_cv_header_cam_cam_h" = x"yes";then
1895         AC_CACHE_CHECK([for CAM like scsi support],
1896         amanda_cv_cam_scsi,
1897         [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1898 #include <stdio.h>
1899 # include <fcntl.h>
1900 # include <cam/cam.h>
1901 # include <cam/cam_ccb.h>
1902 # include <cam/scsi/scsi_message.h>
1903 # include <cam/scsi/scsi_pass.h>
1904 # include <camlib.h>
1905 ]], [[
1906         struct cam_device *curdev;
1907
1908         curdev = cam_open_pass("", O_RDWR, NULL);
1909 ]])],[amanda_cv_cam_scsi=yes],[amanda_cv_cam_scsi=no])])
1910         if test x"$amanda_cv_cam_scsi" = x"yes";then
1911                 AC_DEFINE(HAVE_CAM_LIKE_SCSI,1,[Define to enable CAM tape-changer support])
1912                 NO_SCSI_CHANGER_MODE=false
1913                 AC_CHECK_LIB(cam,main)
1914         fi
1915 fi
1916
1917 dnl
1918 dnl BSD SCSI
1919 dnl
1920 if test x"$ac_cv_header_sys_mtio_h" = x"yes" &&
1921    test x"$ac_cv_header_sys_scsiio_h" = x"yes"; then
1922     AC_CACHE_CHECK([for BSD like scsi support],
1923     amanda_cv_bsd_scsi,
1924     [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1925 #include <sys/types.h>
1926 #include <sys/scsiio.h>
1927 #include <sys/mtio.h>
1928 ]], [[
1929     int device=1;
1930     char Command;
1931     ioctl(device, SCIOCCOMMAND, &Command);
1932 ]])],[amanda_cv_bsd_scsi=yes],[amanda_cv_bsd_scsi=no])])
1933     if test x"$amanda_cv_bsd_scsi" = x"yes";then
1934        AC_DEFINE(HAVE_BSD_LIKE_SCSI,1,[Define to enable BSD tape-changer support])
1935        NO_SCSI_CHANGER_MODE=false
1936     fi
1937 fi
1938
1939 dnl Do not build chg-scsi-chio if we cannot find the needed support
1940 dnl include files for the SCSI interfaces
1941 dnl chio.h and sys/chio.h are chio based systems
1942 if test x"$ac_cv_header_chio_h" = x"yes" ||
1943    test x"$ac_cv_header_sys_chio_h" = x"yes"; then
1944    dnl chg-scsi does not support FreeBSD 3.0's chio.h; it became backward
1945    dnl incompatible with the introduction of camlib.h
1946    if test x"$ac_cv_header_camlib_h" != x"yes"; then
1947      if $NO_SCSI_CHANGER_MODE; then
1948        NO_SCSI_CHANGER_MODE=false
1949      else
1950        NO_CHIO_CHANGER_MODE=false
1951      fi
1952    fi
1953 fi
1954
1955 dnl cur_colr is on some HP's
1956 AC_CHECK_LIB(cur_colr,main)
1957
1958 AC_CHECK_LIB(intl,main)
1959
1960 dnl Make sure we don't use -lnsl and -lsun on Irix systems.
1961 case "$target" in
1962     *sgi-irix*)
1963                         AC_CHECK_LIB(socket,main)
1964                         ;;
1965     *)
1966                         AC_CHECK_LIB(nsl,main)
1967                         AC_CHECK_LIB(socket,main)
1968                         AC_CHECK_LIB(sun,main)
1969                         ;;
1970 esac
1971
1972 AC_CHECK_LIB(termcap,tgetent)
1973 if test "$ac_cv_lib_termcap_tgetent" != yes; then
1974     AC_CHECK_LIB(curses,tgetent)
1975     if test "$ac_cv_lib_curses_tgetent" != yes; then
1976         AC_CHECK_LIB(ncurses,tgetent)
1977     fi
1978 fi
1979 if test "$ac_cv_lib_termcap_tgetent" = yes ||
1980    test "$ac_cv_lib_curses_tgetent" = yes ||
1981    test "$ac_cv_lib_ncurses_tgetent" = yes; then
1982     AC_CHECK_LIB(readline,readline)
1983     if test "$ac_cv_lib_readline_readline" != yes; then
1984         AC_MSG_WARN([*** No readline library, no history and command line editing in amrecover!])
1985     fi
1986 else
1987     AC_MSG_WARN([*** No terminal library, no history and command line editing in amrecover!])
1988 fi
1989
1990 if test "$ac_cv_lib_readline_readline" = yes; then
1991     READLINE_LIBS=-lreadline
1992     LIBS=`echo $LIBS | sed s/-lreadline//`
1993     AC_SUBST(READLINE_LIBS)
1994 fi
1995
1996 if test "$ac_cv_header_linux_zftape_h" = yes; then
1997     if test "$ac_cv_header_vtblc_h" = yes; then
1998         AC_CHECK_LIB(vtblc,main)
1999         if test "$ac_cv_lib_vtblc_main" != yes; then
2000             AC_MSG_WARN([*** vtblc library not found - no QIC volume table support!])
2001         fi
2002     else
2003         AC_MSG_WARN([*** vtblc headers not found - no QIC volume table support!])
2004     fi
2005 fi
2006
2007 AC_CHECK_LIB(m,modf)
2008
2009 dnl Check for various "mt status" related structure elements.
2010
2011 AC_MSG_CHECKING(for mt_flags mtget structure element)
2012 mt_flags_result="found"
2013 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2014 #include <stdio.h>
2015 #include <sys/types.h>
2016 #include <sys/mtio.h>
2017 ]], [[
2018     struct mtget buf;
2019     long ds;
2020
2021     ds = buf.mt_flags;
2022 ]])],[AC_DEFINE(HAVE_MT_FLAGS,1,Define if the mtget structure has an mt_flags field)],[mt_flags_result="not found"])
2023 AC_MSG_RESULT($mt_flags_result)
2024
2025 AC_MSG_CHECKING(for mt_fileno mtget structure element)
2026 mt_fileno_result="found"
2027 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2028 #include <stdio.h>
2029 #include <sys/types.h>
2030 #include <sys/mtio.h>
2031 ]], [[
2032     struct mtget buf;
2033     long ds;
2034
2035     ds = buf.mt_fileno;
2036 ]])],[AC_DEFINE(HAVE_MT_FILENO,1,Define if the mtget structure has an mt_fileno field)],[mt_fileno_result="not found"])
2037 AC_MSG_RESULT($mt_fileno_result)
2038
2039 AC_MSG_CHECKING(for mt_blkno mtget structure element)
2040 mt_blkno_result="found"
2041 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2042 #include <stdio.h>
2043 #include <sys/types.h>
2044 #include <sys/mtio.h>
2045 ]], [[
2046     struct mtget buf;
2047     long ds;
2048
2049     ds = buf.mt_blkno;
2050 ]])],[AC_DEFINE(HAVE_MT_BLKNO,1,Define if the mtget structure has an mt_blkno field)],[mt_blkno_result="not found"])
2051 AC_MSG_RESULT($mt_blkno_result)
2052
2053 AC_MSG_CHECKING(for mt_dsreg mtget structure element)
2054 mt_dsreg_result="found"
2055 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2056 #include <stdio.h>
2057 #include <sys/types.h>
2058 #include <sys/mtio.h>
2059 ]], [[
2060     struct mtget buf;
2061     long ds;
2062
2063     ds = buf.mt_dsreg;
2064 ]])],[AC_DEFINE(HAVE_MT_DSREG,1,Define if the mtget structure has an mt_dsreg field)],[mt_dsreg_result="not found"])
2065 AC_MSG_RESULT($mt_dsreg_result)
2066
2067 AC_MSG_CHECKING(for mt_erreg mtget structure element)
2068 mt_erreg_result="found"
2069 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2070 #include <stdio.h>
2071 #include <sys/types.h>
2072 #include <sys/mtio.h>
2073 ]], [[
2074     struct mtget buf;
2075     long ds;
2076
2077     ds = buf.mt_erreg;
2078 ]])],[AC_DEFINE(HAVE_MT_ERREG,1,Define if the mtget structure has an mt_erreg field)],[mt_erreg_result="not found"])
2079 AC_MSG_RESULT($mt_erreg_result)
2080
2081 dnl
2082
2083 dnl Check if the system does support the user requested database library.
2084 dnl Begin by checking for the header file.  If it is not there, then do
2085 dnl not use the library.  If the header file is there, then try to link
2086 dnl against the library.   If it's not there, then try to link using
2087 dnl just the -lc library.  If the link against -lc fails, then do not
2088 dnl use this library.
2089 DB_HEADER=
2090 DB_LIB=
2091
2092 dnl Testing if libc contains the dbm_open routine is tested for a
2093 dnl lot of times below.  We do it once here now.
2094 save_LIBS="$LIBS"
2095 AC_CHECK_LIB(c,dbm_open)
2096 LIBS="$save_LIBS"
2097
2098 case "$DB_STYLE" in
2099     db)
2100         if test "$ac_cv_header_db_h" = yes; then
2101             AC_CHECK_LIB(db,main)
2102             if test "$ac_cv_lib_db_main" = yes; then
2103                 AC_CHECK_LIB(db,dbm_open)
2104                 if test "$ac_cv_lib_db_dbm_open" = yes; then
2105                     DB_HEADER=db.h
2106                     DB_LIB=db
2107                 else
2108                     DB_STYLE=
2109                     AC_MSG_WARN([*** db database library requested but dbm_open not found in -ldb.])
2110                 fi
2111             else
2112                 if test "$ac_cv_lib_c_dbm_open" = yes; then
2113                     DB_HEADER=db.h
2114                     DB_LIB=c
2115                 else
2116                     DB_STYLE=
2117                     AC_MSG_WARN([*** db library requested but -ldb doesn't exist and dbm_open cannot be found.])
2118                 fi
2119             fi
2120         else
2121             DB_STYLE=
2122             AC_MSG_WARN([*** db database library requested but db.h not found.])
2123         fi
2124         ;;
2125
2126     dbm)
2127         if test "$ac_cv_header_dbm_h" = yes; then
2128             AC_CHECK_LIB(dbm,main)
2129             if test "$ac_cv_lib_dbm_main" = yes; then
2130                 AC_CHECK_LIB(dbm,dbm_open)
2131                 if test "$ac_cv_lib_dbm_dbm_open" = yes; then
2132                     DB_HEADER=dbm.h
2133                     DB_LIB=dbm
2134                 else
2135                     DB_STYLE=
2136                     AC_MSG_WARN([*** dbm database library requested but dbm_open not found in -ldbm.])
2137                 fi
2138             else
2139                 if test "$ac_cv_lib_c_dbm_open" = yes; then
2140                     DB_HEADER=dbm.h
2141                     DB_LIB=c
2142                 else
2143                     DB_STYLE=
2144                     AC_MSG_WARN([*** dbm library requested but -ldbm doesn't exist and dbm_open cannot be found.])
2145                 fi
2146             fi
2147         else
2148             DB_STYLE=
2149             AC_MSG_WARN([*** dbm database library requested but dbm.h not found.])
2150         fi
2151         ;;
2152
2153     gdbm)
2154         if test "$ac_cv_header_ndbm_h" = yes; then
2155             AC_CHECK_LIB(gdbm,main)
2156             if test "$ac_cv_lib_gdbm_main" = yes; then
2157                 AC_CHECK_LIB(gdbm,dbm_open)
2158                 if test "$ac_cv_lib_gdbm_dbm_open" = yes; then
2159                     DB_HEADER=ndbm.h
2160                     DB_LIB=gdbm
2161                 else
2162                     DB_STYLE=
2163                     AC_MSG_WARN([*** gdbm database library requested but -lgdbm not found.])
2164                 fi
2165             else
2166                 if test "$ac_cv_lib_c_dbm_open" = yes; then
2167                     DB_HEADER=ndbm.h
2168                     DB_LIB=c
2169                 else
2170                     DB_STYLE=
2171                     AC_MSG_WARN([*** gdbm library requested but -lgdbm doesn't exist and dbm_open cannot be found.])
2172                 fi
2173             fi
2174         else
2175             DB_STYLE=
2176             AC_MSG_WARN([*** gdbm database library requested but ndbm.h not found.])
2177         fi
2178         ;;
2179
2180     ndbm)
2181         if test "$ac_cv_header_ndbm_h" = yes; then
2182             AC_CHECK_LIB(ndbm,main)
2183             if test "$ac_cv_lib_ndbm_main" = yes; then
2184                 AC_CHECK_LIB(ndbm,dbm_open)
2185                 if test "$ac_cv_lib_ndbm_dbm_open" = yes; then
2186                     DB_HEADER=ndbm.h
2187                     DB_LIB=ndbm
2188                 else
2189                     DB_STYLE=
2190                     AC_MSG_WARN([*** ndbm database library requested but -lndbm not found.])
2191                 fi
2192             else
2193                 if test "$ac_cv_lib_c_dbm_open" = yes; then
2194                     DB_HEADER=ndbm.h
2195                     DB_LIB=c
2196                 else
2197                     DB_STYLE=
2198                     AC_MSG_WARN([*** ndbm library requested but -lndbm doesn't exist and dbm_open cannot be found.])
2199                 fi
2200             fi
2201         else
2202             DB_STYLE=
2203             AC_MSG_WARN([*** ndbm database library requested but ndbm.h not found.])
2204         fi
2205         ;;
2206     text)
2207         DB_HEADER=
2208         DB_LIB=
2209         ;;
2210 esac
2211
2212 dnl If a database style was not specified select an appropriate one
2213 dnl automatically.
2214 dnl Nowadays we default to our own internal text database, but I have left
2215 dnl the code that does the testing here just in case it is needed one day.
2216
2217 if test -z "$DB_STYLE"; then
2218     DB_STYLE=text
2219     DB_HEADER=
2220     DB_LIB=
2221 fi
2222
2223 dnl if test -z "$DB_STYLE" -a "$ac_cv_header_ndbm_h" = yes; then
2224 dnl     AC_CHECK_LIB(ndbm,dbm_open)
2225 dnl     if test "$ac_cv_lib_ndbm_dbm_open" = yes; then
2226 dnl     DB_STYLE=ndbm
2227 dnl     DB_HEADER=ndbm.h
2228 dnl     DB_LIB=ndbm
2229 dnl     elif test "$ac_cv_lib_c_dbm_open" = yes; then
2230 dnl     DB_STYLE=ndbm
2231 dnl     DB_HEADER=ndbm.h
2232 dnl     DB_LIB=c
2233 dnl    fi
2234 dnl fi
2235 dnl
2236 dnl if test -z "$DB_STYLE" -a "$ac_cv_header_db_h" = yes; then
2237 dnl    AC_CHECK_LIB(db,dbm_open)
2238 dnl    if test "$ac_cv_lib_db_dbm_open" = yes; then
2239 dnl     DB_STYLE=db
2240 dnl     DB_HEADER=db.h
2241 dnl     DB_LIB=db
2242 dnl    elif test "$ac_cv_lib_c_dbm_open" = yes; then
2243 dnl     DB_STYLE=db
2244 dnl     DB_HEADER=db.h
2245 dnl     DB_LIB=c
2246 dnl    fi
2247 dnl fi
2248 dnl
2249 dnl if test -z "$DB_STYLE" -a "$ac_cv_header_dbm_h" = yes; then
2250 dnl    AC_CHECK_LIB(dbm,dbm_open)
2251 dnl    if test "$ac_cv_lib_db_dbm_open" = yes; then
2252 dnl     DB_STYLE=dbm
2253 dnl     DB_HEADER=dbm.h
2254 dnl     DB_LIB=dbm
2255 dnl    elif test "$ac_cv_lib_c_dbm_open" = yes; then
2256 dnl     DB_STYLE=dbm
2257 dnl     DB_HEADER=dbm.h
2258 dnl     DB_LIB=c
2259 dnl    fi
2260 dnl fi
2261 dnl
2262 dnl if test -z "$DB_STYLE" -a "$ac_cv_header_ndbm_h" = yes; then
2263 dnl    AC_CHECK_LIB(gdbm,dbm_open)
2264 dnl    if test "$ac_cv_lib_gdbm_dbm_open" = yes; then
2265 dnl     DB_STYLE=gdbm
2266 dnl     DB_HEADER=ndbm.h
2267 dnl     DB_LIB=gdbm
2268 dnl    elif test "$ac_cv_lib_c_dbm_open" = yes; then
2269 dnl     DB_STYLE=gdbm
2270 dnl     DB_HEADER=ndbm.h
2271 dnl     DB_LIB=c
2272 dnl    fi
2273 dnl fi
2274 dnl
2275 dnl if test -z "$DB_STYLE"; then
2276 dnl    if test "$ac_cv_lib_c_dbm_open" = yes; then
2277 dnl     AC_MSG_WARN([*** A dbm_open() routine was found in -lc, but no header])
2278 dnl     AC_MSG_WARN([*** files exist.  Please remedy the situation.])
2279 dnl    else
2280 dnl     AC_MSG_WARN([*** No dbm_open() routine found!])
2281 dnl    fi
2282 dnl    AC_MSG_WARN([*** You may want to install the gdbm library from])
2283 dnl    AC_MSG_WARN([*** ftp://prep.ai.mit.edu/pub/gnu/gdbm-1.7.3.tar.gz.])
2284 dnl
2285 dnl    AC_MSG_WARN([*** Using the built-in text database.])
2286 dnl    DB_STYLE=text
2287 dnl    DB_HEADER=
2288 dnl    DB_LIB=
2289 dnl fi
2290
2291 if test "$DB_STYLE" = text; then
2292     AC_DEFINE(TEXTDB,1,[Define to enable the text-based database format. ])
2293 else
2294     AC_MSG_CHECKING([for database])
2295     AC_MSG_RESULT([header is $DB_HEADER, linking against -l$DB_LIB])
2296     case "$DB_STYLE" in
2297         db)     AC_DEFINE(USE_DB_H,1,[Define to enable db databases. ])   ;;
2298         dbm)    AC_DEFINE(USE_DBM_H,1,[Define to enable dbm databases. ])  ;;
2299         gdbm)   AC_DEFINE(USE_GDBM_H,1,[Define to enable gdbm databases. ]) ;;
2300         ndbm)   AC_DEFINE(USE_NDBM_H,1,[Define to enable ndbm databases. ]) ;;
2301     esac
2302
2303     AC_CACHE_CHECK(
2304         [for struct datum declared in header files],
2305         amanda_cv_struct_datum,
2306         [
2307             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2308 #if defined(USE_DB_H)
2309 #  include <db.h>
2310 #else
2311 #  if defined(USE_DBM_H)
2312 #    include <dbm.h>
2313 #  else
2314 #    if defined(USE_NDBM_H)
2315 #      include <ndbm.h>
2316 #    endif
2317 #  endif
2318 #endif
2319                 ]], [[
2320                     datum a;
2321                 ]])],[amanda_cv_struct_datum=yes],[amanda_cv_struct_datum=no
2322             ])
2323         ])
2324     if test "$amanda_cv_struct_datum" = yes; then
2325         AC_DEFINE(HAVE_STRUCT_DATUM,1,[Define if the database header declares struct datum. ])
2326     fi
2327 fi
2328
2329 case "$DB_STYLE" in
2330     db) DB_EXT=.db;;
2331     gdbm) DB_EXT='""';;
2332     dbm | ndbm) DB_EXT=".dir .pag";;
2333     text) DB_EXT='""';;
2334     *) DB_EXT=;;
2335 esac
2336 AC_SUBST(DB_EXT)
2337
2338 AC_CACHE_CHECK(whether _POSIX2_RE_DUP_MAX is defined,
2339     amanda_cv_have__posix2_re_dup_max,
2340     AC_EGREP_CPP(yes, [
2341 #include <limits.h>
2342 #ifdef _POSIX2_RE_DUP_MAX
2343   yes
2344 #endif
2345 ], amanda_cv_have__posix2_re_dup_max=yes, amanda_cv_have__posix2_re_dup_max=no))
2346 if test "$amanda_cv_have__posix2_re_dup_max" = yes; then
2347     AC_DEFINE(HAVE__POSIX2_RE_DUP_MAX,1,[Define if limits.h defines _POSIX2_RE_DUP_MAX. ])
2348 fi
2349
2350 AC_CACHE_CHECK(whether CHAR_MIN is defined,
2351     amanda_cv_have_char_min,
2352     AC_EGREP_CPP(yes, [
2353 #include <limits.h>
2354 #ifdef CHAR_MIN
2355   yes
2356 #endif
2357 ], amanda_cv_have_char_min=yes, amanda_cv_have_char_min=no))
2358 if test "$amanda_cv_have_char_min" = yes; then
2359     AC_DEFINE(HAVE_CHAR_MIN,1,[Define if limits.h defines CHAR_MIN. ])
2360 fi
2361
2362 AC_CACHE_CHECK(whether CHAR_MAX is defined,
2363     amanda_cv_have_char_max,
2364     AC_EGREP_CPP(yes, [
2365 #include <limits.h>
2366 #ifdef CHAR_MAX
2367   yes
2368 #endif
2369 ], amanda_cv_have_char_max=yes, amanda_cv_have_char_max=no))
2370 if test "$amanda_cv_have_char_max" = yes; then
2371     AC_DEFINE(HAVE_CHAR_MAX,1,[Define if limits.h defines CHAR_MAX. ])
2372 fi
2373
2374 AC_CACHE_CHECK(whether CHAR_BIT is defined,
2375     amanda_cv_have_char_bit,
2376     AC_EGREP_CPP(yes, [
2377 #include <limits.h>
2378 #ifdef CHAR_BIT
2379   yes
2380 #endif
2381 ], amanda_cv_have_char_bit=yes, amanda_cv_have_char_bit=no))
2382 if test "$amanda_cv_have_char_bit" = yes; then
2383     AC_DEFINE(HAVE_CHAR_BIT,1,[Define if limits.h defines CHAR_BIT. ])
2384 fi
2385
2386 dnl Checks for library functions and if the function is declared in
2387 dnl an appropriate header file.  Add some of the missing functions
2388 dnl to LIBOBJS.
2389 ICE_CHECK_DECL(accept,sys/types.h sys/socket.h)
2390 AC_FUNC_ALLOCA
2391 AC_CHECK_FUNCS(atexit)
2392 ICE_CHECK_DECL(atof,stdlib.h)
2393 AC_CHECK_FUNCS(basename)
2394 ICE_CHECK_DECL(bind,sys/types.h sys/socket.h)
2395 ICE_CHECK_DECL(bcopy,string.h strings.h stdlib.h)
2396 ICE_CHECK_DECL(bzero,string.h strings.h stdlib.h)
2397 AC_FUNC_CLOSEDIR_VOID
2398 ICE_CHECK_DECL(closelog,syslog.h)
2399 ICE_CHECK_DECL(connect,sys/types.h sys/socket.h)
2400 ICE_CHECK_DECL(dbm_open,${DB_HEADER-no/db/header/file})
2401 AC_CHECK_FUNCS(endmntent)
2402 ICE_CHECK_DECL(fclose,stdio.h)
2403 ICE_CHECK_DECL(fflush,stdio.h)
2404 ICE_CHECK_DECL(flock,sys/file.h)
2405 ICE_CHECK_DECL(fprintf,stdio.h)
2406 ICE_CHECK_DECL(fputc,stdio.h)
2407 ICE_CHECK_DECL(fputs,stdio.h)
2408 ICE_CHECK_DECL(fread,stdio.h stdlib.h)
2409 ICE_CHECK_DECL(fseek,stdio.h)
2410 ICE_CHECK_DECL(fwrite,stdio.h stdlib.h)
2411 AC_REPLACE_FUNCS(getcwd)
2412 AC_CHECK_FUNCS(getfsent)
2413 ICE_CHECK_DECL(gethostname,unistd.h)
2414 AC_FUNC_GETMNTENT
2415 ICE_CHECK_DECL(getopt,stdlib.h unistd.h libc.h)
2416 ICE_CHECK_DECL(getpeername,sys/types.h sys/socket.h)
2417 AC_CHECK_FUNCS(getpgrp)
2418 AC_FUNC_GETPGRP
2419 ICE_CHECK_DECL(getsockname,sys/types.h sys/socket.h)
2420 ICE_CHECK_DECL(getsockopt,sys/types.h sys/socket.h)
2421 ICE_CHECK_DECL(gettimeofday,time.h sys/time.h)
2422 AMANDA_FUNC_GETTIMEOFDAY_ARGS
2423 AC_CHECK_FUNCS(getvfsent initgroups isascii)
2424 ICE_CHECK_DECL(initgroups,grp.h sys/types.h unistd.h libc.h)
2425 ICE_CHECK_DECL(ioctl,sys/ioctl.h unistd.h libc.h)
2426 ICE_CHECK_DECL(listen,sys/types.h sys/socket.h)
2427 ICE_CHECK_DECL(lstat,sys/types.h sys/stat.h)
2428 ICE_CHECK_DECL(malloc,stdlib.h)
2429 AC_REPLACE_FUNCS(memmove)
2430 ICE_CHECK_DECL(memmove,string.h strings.h)
2431 ICE_CHECK_DECL(memset,string.h strings.h)
2432 AC_CHECK_FUNCS(mkdir)
2433 ICE_CHECK_DECL(mktemp,stdlib.h)
2434 AC_REPLACE_FUNCS(mktime)
2435 ICE_CHECK_DECL(mktime,time.h sys/time.h)
2436 AC_FUNC_MMAP
2437 dnl atexit() is prefered, sunos (maybe others?) define on_exit
2438 AC_CHECK_FUNCS(on_exit)
2439 ICE_CHECK_DECL(openlog,syslog.h)
2440 ICE_CHECK_DECL(pclose,stdio.h)
2441 ICE_CHECK_DECL(perror,stdio.h)
2442 ICE_CHECK_DECL(printf,stdio.h)
2443 AC_CHECK_FUNCS(putenv)
2444 ICE_CHECK_DECL(puts,stdio.h)
2445 ICE_CHECK_DECL(realloc,stdlib.h)
2446 ICE_CHECK_DECL(recvfrom,sys/types.h sys/socket.h)
2447 ICE_CHECK_DECL(remove,stdio.h)
2448 ICE_CHECK_DECL(rename,stdio.h)
2449 ICE_CHECK_DECL(rewind,stdio.h)
2450 AC_CHECK_FUNCS(rmdir)
2451 ICE_CHECK_DECL(ruserok,netdb.h sys/socket.h libc.h unistd.h)
2452 ICE_CHECK_DECL(select,sys/types.h sys/socket.h sys/select.h time.h sys/time.h)
2453 AMANDA_FUNC_SELECT_ARG_TYPE
2454 ICE_CHECK_DECL(sendto,sys/types.h sys/socket.h)
2455 ICE_CHECK_DECL(setegid,unistd.h)
2456 ICE_CHECK_DECL(seteuid,unistd.h)
2457 AC_CHECK_FUNCS(setmntent)
2458 ICE_CHECK_DECL(setresgid,unistd.h)
2459 ICE_CHECK_DECL(setresuid,unistd.h)
2460
2461 dnl arguments for setpgrp or not
2462 AC_CHECK_FUNC(setpgid, [
2463         AC_DEFINE(HAVE_SETPGID,1,[Define if setpgid() is available. ])
2464         ICE_CHECK_DECL(setpgid,sys/types.h unistd.h)
2465 ])
2466 AC_CHECK_FUNC(setpgrp,[AC_FUNC_SETPGRP])
2467 ICE_CHECK_DECL(setpgrp,sys/types.h unistd.h libc.h)
2468
2469 ICE_CHECK_DECL(setsockopt,sys/types.h sys/socket.h)
2470
2471 AC_CHECK_FUNCS(shmget,
2472     [
2473         AMANDA_FUNC_SHM_ARG_TYPE
2474         case "$FORCE_MMAP" in
2475         n | no)
2476             AC_DEFINE(HAVE_SYSVSHM,1,[Define if SysV shared-memory functions are available. ])
2477           ;;
2478         esac
2479     ]
2480 )
2481 ICE_CHECK_DECL(shmat,sys/types.h sys/ipc.h sys/shm.h)
2482 ICE_CHECK_DECL(shmctl,sys/types.h sys/ipc.h sys/shm.h)
2483 ICE_CHECK_DECL(shmdt,sys/types.h sys/ipc.h sys/shm.h)
2484 ICE_CHECK_DECL(shmget,sys/types.h sys/ipc.h sys/shm.h)
2485
2486 if test "$ac_cv_func_mmap_fixed_mapped" != yes; then
2487     case "$FORCE_MMAP" in
2488     n | no)
2489         if test "$ac_cv_func_shmget" != yes; then
2490             AC_MSG_WARN([*** Neither shmget() nor mmap() found!])
2491             AC_MSG_WARN([*** This system will not support the Amanda server.])
2492             NO_SERVER_MODE=true
2493         fi
2494       ;;
2495     y | ye | yes)
2496         AC_MSG_WARN([*** --with-mmap used on a system with no mmap() support!])
2497         AC_MSG_WARN([*** This system will not support the Amanda server.])
2498         NO_SERVER_MODE=true
2499       ;;
2500     esac
2501 fi
2502
2503 ICE_CHECK_DECL(shquote, stdlib.h)
2504
2505 dnl Some systems have snprintf but not vsnprintf.  If either snprintf or
2506 dnl vsnprintf are missing, then use the snprintf.c we provide.
2507 ICE_CHECK_DECL(snprintf,stdio.h)
2508 ICE_CHECK_DECL(vsnprintf,stdio.h)
2509 if test x"$ice_have_snprintf" != x"yes" ||
2510    test x"$ice_have_vsnprintf" != x"yes"; then
2511     AC_LIBOBJ([snprintf])
2512     if false; then :
2513         dnl so that automake includes snprintf.c in the distribution
2514         AC_REPLACE_FUNCS(snprintf) 
2515     fi
2516 fi
2517
2518 AC_CHECK_FUNCS(sigaction sigemptyset sigvec)
2519 ICE_CHECK_DECL(socket,sys/types.h sys/socket.h)
2520 ICE_CHECK_DECL(socketpair,sys/types.h sys/socket.h)
2521 ICE_CHECK_DECL(sscanf,stdio.h)
2522 AC_CHECK_FUNCS(statfs statvfs)
2523 AC_REPLACE_FUNCS(strerror)
2524 ICE_CHECK_DECL(strerror,string.h strings.h)
2525 AC_FUNC_STRFTIME
2526 AC_REPLACE_FUNCS(strftime)
2527 ICE_CHECK_DECL(strftime,time.h sys/time.h)
2528 AC_REPLACE_FUNCS(strncasecmp)
2529 ICE_CHECK_DECL(strncasecmp,string.h strings.h)
2530 AC_REPLACE_FUNCS(strstr)
2531 ICE_CHECK_DECL(syslog,syslog.h)
2532 ICE_CHECK_DECL(system,stdlib.h)
2533 ICE_CHECK_DECL(time,time.h sys/time.h)
2534 ICE_CHECK_DECL(tolower,ctype.h)
2535 ICE_CHECK_DECL(toupper,ctype.h)
2536 ICE_CHECK_DECL(ungetc,stdio.h)
2537 AC_FUNC_VPRINTF
2538 ICE_CHECK_DECL(vfprintf,stdio.h stdlib.h)
2539 ICE_CHECK_DECL(vprintf,stdio.h stdlib.h)
2540 ICE_CHECK_DECL(vsprintf,stdio.h stdlib.h)
2541 AC_CHECK_FUNC(wait4)
2542 AC_REPLACE_FUNCS(waitpid)
2543 AC_REPLACE_FUNCS(strcasecmp)
2544 ICE_CHECK_DECL(strcasecmp,string.h strings.h)
2545
2546 AC_CHECK_FUNCS(fnmatch)
2547
2548 if test "$ac_cv_func_fnmatch" != yes -a "$USE_QUICK_AND_DIRTY_ESTIMATES" != yes ; then
2549     AC_MSG_WARN([--with-qde and no fnmatch -- gnutar exclude files will not work])
2550 fi
2551
2552 dnl disk device prefixes
2553 AC_MSG_CHECKING(disk device prefixes)
2554 dnl Use df to find the mount point for the root filesystem.  Use
2555 dnl the positional parameters to find the particular line from df
2556 dnl that contains the root paritition.  We put it in a subshell so
2557 dnl that the original positional parameters are not messed with.
2558 dfline=`(
2559     df / | while read line; do
2560         set -- $line
2561         while test $# -gt 0; do
2562             if test "$1" = "/"; then
2563                 echo $line
2564                 break 2
2565             fi
2566             shift
2567         done
2568     done
2569 ) | sed 's/(//' | sed 's/)//' `
2570
2571 dnl Search for the mount point by using expr to find the parameter
2572 dnl with dev in it.
2573 mount=`(
2574     set -- $dfline
2575     while test $# -gt 0; do
2576         if expr "$1" : '.*dev' >/dev/null 2>&1; then
2577             echo $1
2578             break
2579         fi
2580         shift
2581     done
2582 )`
2583
2584 if test "$DEV_PREFIX" && test "$RDEV_PREFIX"; then
2585     AC_MSG_RESULT((predefined) $DEV_PREFIX - $RDEV_PREFIX)
2586 else
2587     if test -d /dev/dsk; then
2588         DEV_PREFIX=/dev/dsk/
2589         if test -d /dev/rdsk; then
2590             RDEV_PREFIX=/dev/rdsk/
2591         else
2592             RDEV_PREFIX=/dev/dsk/
2593         fi
2594     elif test -d /dev; then
2595         case "$target" in
2596             *-sni-sysv4)
2597                 dev_prefix=/dev/dsk/
2598                 rdev_prefix=/dev/rdsk/
2599                 AC_MSG_WARN("*** Run amsinixfixdevs on Sinix systems using VxFS.")
2600                 ;;
2601
2602             *)
2603                 DEV_PREFIX=/dev/
2604                 # Some systems, notably Linux, do not have raw disk devices
2605                 # names.  Check this by trying to see if a raw disk device name
2606                 # exists using the normal raw device path prepended to the
2607                 # mount point of the root filesystem.
2608                 if test "$mount"; then
2609                     dev_name="/dev/r`basename $mount`"
2610                     if test -b $dev_name -o -c $dev_name; then
2611                         RDEV_PREFIX=/dev/r
2612                     else
2613                         RDEV_PREFIX=/dev/
2614                     fi
2615                 else
2616                     RDEV_PREFIX=/dev/r
2617                 fi
2618                 ;;
2619         esac
2620     else
2621         DEV_PREFIX=/
2622         RDEV_PREFIX=/
2623     fi
2624     AC_MSG_RESULT($DEV_PREFIX - $RDEV_PREFIX)
2625 fi
2626
2627 AC_DEFINE_UNQUOTED(DEV_PREFIX,"${DEV_PREFIX}",[Define as the prefix for disk devices, commonly /dev/ or /dev/dsk/ ])
2628 AC_DEFINE_UNQUOTED(RDEV_PREFIX,"${RDEV_PREFIX}",[Define as the prefix for raw disk devices, commonly /dev/r or /dev/rdsk/ ])
2629
2630 case $mount in
2631     /dev/vg*)
2632         AC_MSG_WARN("*** Run amhpfixdevs on HP-UX systems using /dev/vg??.")
2633         ;;
2634 esac
2635
2636 dnl lock/flock/fcntl
2637 AC_CACHE_CHECK(
2638    [whether posix fcntl locking works],
2639    amanda_cv_posix_filelocking,
2640    [
2641         AC_RUN_IFELSE([AC_LANG_SOURCE([[
2642 #undef  ASSERTIONS
2643 #define CONFIGURE_TEST
2644 #define USE_POSIX_FCNTL
2645 #include "${srcdir-.}/common-src/amflock.c"
2646 ]])],[
2647         amanda_cv_posix_filelocking=yes
2648 ],[
2649         amanda_cv_posix_filelocking="no"
2650 ],[
2651         amanda_cv_posix_filelocking="no (cannot run test)"
2652 ])
2653     rm -f /tmp/conftest.lock
2654 ])
2655 if test "$amanda_cv_posix_filelocking" = yes; then
2656     AC_DEFINE(USE_POSIX_FCNTL,1,[Define to use Posix fcntl for file locking.])
2657     HAS_WORKING_FILE_LOCK=1
2658 fi
2659
2660 if test -z "$HAS_WORKING_FILE_LOCK"; then
2661     AC_CACHE_CHECK(
2662         [whether flock locking works],
2663         amanda_cv_flock_filelocking,
2664         [
2665             AC_RUN_IFELSE([AC_LANG_SOURCE([[
2666 #undef  ASSERTIONS
2667 #define CONFIGURE_TEST
2668 #define USE_FLOCK
2669 #include "${srcdir-.}/common-src/amflock.c"
2670 ]])],[
2671                     amanda_cv_flock_filelocking="yes"
2672 ],[
2673                     amanda_cv_flock_filelocking="no"
2674 ],[
2675                     amanda_cv_flock_filelocking="no (cannot run test)"
2676 ])
2677         rm -f /tmp/conftest.lock
2678 ])
2679     if test "$amanda_cv_flock_filelocking" = yes; then
2680         AC_DEFINE(USE_FLOCK,1,[Define to use flock for file locking.])
2681         HAS_WORKING_FILE_LOCK=1
2682     fi
2683 fi
2684
2685 if test -z "$HAS_WORKING_FILE_LOCK"; then
2686     AC_CACHE_CHECK(
2687         [whether lockf locking works],
2688         amanda_cv_lockf_filelocking,
2689         [
2690             AC_RUN_IFELSE([AC_LANG_SOURCE([[
2691 #undef  ASSERTIONS
2692 #define CONFIGURE_TEST
2693 #define USE_LOCKF
2694 #include "${srcdir-.}/common-src/amflock.c"
2695 ]])],[
2696                     amanda_cv_lockf_filelocking="yes"
2697 ],[
2698                     amanda_cv_lockf_filelocking="no"
2699 ],[
2700                     amanda_cv_lockf_filelocking="no (cannot run test)"
2701 ])
2702         rm -f /tmp/conftest.lock
2703 ])
2704     if test "$amanda_cv_lockf_filelocking" = yes; then
2705         AC_DEFINE(USE_LOCKF,1,[Define to use lockf for file locking.])
2706         HAS_WORKING_FILE_LOCK=1
2707     fi
2708 fi
2709
2710 if test -z "$HAS_WORKING_FILE_LOCK"; then
2711     AC_CACHE_CHECK(
2712         [whether lnlock locking works],
2713         amanda_cv_lnlock_filelocking,
2714         [
2715             AC_RUN_IFELSE([AC_LANG_SOURCE([[
2716 #undef  ASSERTIONS
2717 #define CONFIGURE_TEST
2718 #define USE_LNLOCK
2719 #include "${srcdir-.}/common-src/amflock.c"
2720 #include "${srcdir-.}/common-src/alloc.c"
2721 #include "${srcdir-.}/common-src/error.c"
2722 #include "${srcdir-.}/common-src/snprintf.c"
2723 ]])],[
2724                     amanda_cv_lnlock_filelocking="yes"
2725 ],[
2726                     amanda_cv_lnlock_filelocking="no"
2727 ],[
2728                     amanda_cv_lnlock_filelocking="no (cannot run test)"
2729 ])
2730         rm -f /tmp/conftest.lock
2731 ])
2732     if test "$amanda_cv_lnlock_filelocking" = yes; then
2733         AC_DEFINE(USE_LNLOCK,1,[Define to use a hard-link based approach for file locking.])
2734         HAS_WORKING_FILE_LOCK=1
2735     fi
2736 fi
2737
2738 if test -z "$HAS_WORKING_FILE_LOCK"; then
2739     AC_MSG_WARN([*** No working file locking capability found!])
2740     AC_MSG_WARN([*** Be VERY VERY careful.])
2741 fi
2742
2743 dnl extra substitution parameters
2744 AC_SUBST(CHS)
2745 AC_SUBST(MTX)
2746 AC_SUBST(MCUTIL)
2747 AC_SUBST(ac_n)
2748 AC_SUBST(ac_c)
2749
2750 AM_CONDITIONAL(WANT_CLIENT, test x"$NO_CLIENT_MODE" != x"true")
2751 AM_CONDITIONAL(WANT_SAMBA, test ! -z "$SAMBA_CLIENT")
2752 AM_CONDITIONAL(WANT_RESTORE, test x"$NO_RESTORE_MODE" != x"true")
2753 AM_CONDITIONAL(WANT_SERVER, test x"$NO_SERVER_MODE" != x"true")
2754 AM_CONDITIONAL(WANT_RECOVER, test x"$NO_RECOVER_MODE" != x"true" && test x"$NO_CLIENT_MODE" != x"true")
2755 AM_CONDITIONAL(WANT_TAPE, test x"$NO_SERVER_MODE" != x"true" || test x"$NO_RESTORE_MODE" != x"true")
2756 AM_CONDITIONAL(WANT_AMPLOT, test x"$NO_AMPLOT_MODE" != x"true")
2757 AM_CONDITIONAL(WANT_CHG_SCSI, test x"$NO_SCSI_CHANGER_MODE" != x"true")
2758 AM_CONDITIONAL(WANT_CHIO_SCSI, test x"$NO_CHIO_CHANGER_MODE" != x"true")
2759 AM_CONDITIONAL(WANT_RUNTIME_PSEUDO_RELOC, test x"$NEED_RUNTIME_PSEUDO_RELOC" = x"true")
2760 AM_CONDITIONAL(WANT_SETUID_CLIENT, test x"$NEED_SETUID_CLIENT" != x"false")
2761
2762 case "${FORCE_USE_RUNDUMP-${USE_RUNDUMP}}" in
2763 y |  ye | yes) AC_DEFINE(USE_RUNDUMP,1,[Define to invoke rundump (setuid-root) instead of DUMP program directly. ]);;
2764 esac
2765
2766 # This is necessary so that .o files in LIBOBJS are also built via
2767 # the ANSI2KNR-filtering rules.
2768 LIB@&t@OBJS=`echo "$LIB@&t@OBJS" |
2769              sed 's,\.[[^.]]* ,$U&,g;s,\.[[^.]]*$,$U&,'`
2770 LTLIBOBJS=`echo "$LIB@&t@OBJS" |
2771            sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
2772 AC_SUBST(LTLIBOBJS)
2773
2774 LTALLOCA=`echo "$ALLOCA" | sed 's/\.'"${ac_objext}"'/\.lo/g'`
2775 AC_SUBST(LTALLOCA)
2776
2777 AC_CONFIG_FILES([\
2778         amplot/amcat.awk                amplot/amplot.sh                \
2779         amplot/Makefile                                                 \
2780                                                                         \
2781         changer-src/chg-manual.sh       changer-src/chg-multi.sh        \
2782         changer-src/chg-mtx.sh          changer-src/chg-chs.sh          \
2783         changer-src/chg-rth.pl          changer-src/chg-chio.pl         \
2784         changer-src/chg-zd-mtx.sh       changer-src/Makefile            \
2785         changer-src/chg-juke.sh         changer-src/chg-rait.sh         \
2786         changer-src/chg-null.sh         changer-src/chg-mcutil.sh       \
2787         changer-src/chg-disk.sh         changer-src/chg-iomega.pl       \
2788                                                                         \
2789         client-src/patch-system.sh      client-src/Makefile             \
2790                                                                         \
2791         common-src/versuff.c            common-src/Makefile             \
2792                                                                         \
2793         example/amanda.conf             example/Makefile                \
2794         example/amanda.conf.chg-scsi    example/chg-scsi-linux.conf     \
2795         example/chg-scsi-solaris.conf   example/chg-scsi-hpux.conf      \
2796         example/chg-mcutil.conf                                         \
2797                                                                         \
2798         man/amadmin.8                   man/amanda.8                    \
2799         man/amcheck.8                   man/amcheckdb.8                 \
2800         man/amcleanup.8                 man/amdump.8                    \
2801         man/amflush.8                   man/amlabel.8                   \
2802         man/amoverview.8                man/amrecover.8                 \
2803         man/amrmtape.8                  man/amtoc.8                     \
2804         man/amverify.8                  man/Makefile                    \
2805         man/amstatus.8                  man/amreport.8                  \
2806         man/amgetconf.8                 man/amverifyrun.8               \
2807         man/amtapetype.8                                                \
2808                                                                         \
2809         docs/Makefile                                                   \
2810                                                                         \
2811         recover-src/Makefile                                            \
2812                                                                         \
2813         restore-src/Makefile                                            \
2814                                                                         \
2815         server-src/amcheckdb.sh         server-src/amcleanup.sh         \
2816         server-src/amdump.sh            server-src/amfreetapes.sh       \
2817         server-src/amoverview.pl        server-src/amrmtape.sh          \
2818         server-src/amtoc.pl             server-src/amverify.sh          \
2819         server-src/Makefile             server-src/amstatus.pl          \
2820         server-src/amverifyrun.sh                                       \
2821                                                                         \
2822         tape-src/Makefile                                               \
2823                                                                         \
2824         config/Makefile                 Makefile])
2825 AC_OUTPUT