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