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