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