7 AC_CONFIG_HEADER(config.h)
10 dnl Check for programs
14 AC_PATH_PROG(CP, cp, cp)
15 AC_PATH_PROG(MV, mv, mv)
16 AC_PATH_PROG(RM, rm, rm)
17 AC_CHECK_TOOL(AR, ar, ar)
18 AC_CHECK_TOOL(RANLIB, ranlib, :)
19 AC_CHECK_TOOL(PATCH, patch, :)
23 AC_CHECK_HEADERS([sys/types.h])
25 CPPFLAGS="-D_BSD_SOURCE -D_USE_BSD_SIGNAL ${CPPFLAGS}"
28 dnl Handle --enable-debug
30 AC_ARG_ENABLE([debug],
31 [ --enable-debug include debugging code (default is NO)],
32 if test "$enableval" = "no"
36 echo "Not including debugging code"
38 DUMPDEBUG="-DFDEBUG -DTDEBUG -DWRITEDEBUG -DDIRDEBUG"
39 RESTOREDEBUG="-DDIRDEBUG"
40 echo "Including debugging code"
44 echo "Not including debugging code by default"
47 AC_SUBST(RESTOREDEBUG)
50 dnl Handle --enable-static
52 AC_ARG_ENABLE([static],
53 [ --enable-static link dump and restore statically (default is NO)],
54 if test "$enableval" = "no"
57 echo "Linking dump and restore dynamically"
60 echo "Linking dump and restore statically"
64 echo "Linking dump and restore dynamically by default"
69 dnl Handle --enable-staticz
71 AC_ARG_ENABLE([staticz],
72 [ --enable-staticz link libz and libbz2 statically (default is NO)],
73 if test "$enableval" = "no"
76 echo "Linking libz and libbz2 dynamically"
79 echo "Linking libz and libbz2 statically"
83 echo "Linking libz and libbz2 dynamically by default"
87 dnl Handle --enable-rmt
90 [ --enable-rmt compile and install rmt (default is YES)],
91 if test "$enableval" = "no"
95 echo "Not compiling rmt"
98 RMTMAKEFILE="rmt/Makefile"
103 RMTMAKEFILE="rmt/Makefile"
104 echo "Compiling rmt by default"
109 dnl Handle --enable-ermt
111 AC_ARG_ENABLE([ermt],
112 [ --enable-ermt compile ermt, an encrypting version of rmt (default is NO)],
113 if test "$enableval" = "no"
117 echo "Not compiling ermt"
119 if test "$RMTDIR" = ""
121 AC_MSG_ERROR(ermt requires --enable-rmt)
125 echo "Compiling ermt"
130 echo "Not compiling ermt by default"
136 dnl Handle --enable-kerberos
138 AC_ARG_ENABLE([kerberos],
139 [ --enable-kerberos compile kerberos extensions (default is NO)],
140 if test "$enableval" = "yes"
143 echo "Compiling kerberos extensions"
146 echo "Not compiling kerberos extensions"
150 echo "Not compiling kerberos extensions by default"
155 dnl Handle --enable-readline
157 AC_ARG_ENABLE([readline],
158 [ --enable-readline enable readline support in restore (default is YES)],
159 if test "$enableval" = "no"
162 echo "Not including readline support"
165 AC_DEFINE([HAVE_READLINE],1,[Define if you want to include readline support.])
166 echo "Including readline support"
170 AC_DEFINE([HAVE_READLINE],1,[Define if you want to include readline support.])
171 echo "Including readline support by default"
175 dnl Handle --enable-oldsylefscript
177 AC_ARG_ENABLE([oldstylefscript],
178 [ --enable-oldstylefscript enable old style F script (no arguments) (default is NO)],
179 if test "$enableval" = "yes"
181 AC_DEFINE([OLD_STYLE_FSCRIPT],1,[Define this is you want old style F script (no arguments).])
182 echo "Using old style F script"
184 echo "Using new style F script"
187 echo "Using new style F script by default"
191 dnl Handle --enable-largefile
193 AC_ARG_ENABLE([largefile],
194 [ --enable-largefile enable Large File System support (default is YES)],
195 if test "$enableval" = "yes"
197 AC_DEFINE([USE_LFS],1,[Define this if you want Large File System support.])
198 echo "Enabling Large File System support"
200 echo "Not enabling Large File System support"
203 AC_DEFINE([USE_LFS],1,[Define this if you want Large File System support.])
204 echo "Enabling Large File System support by default"
208 dnl Handle --enable-qfa
211 [ --enable-qfa enable Quick File Access support (default is YES)],
212 if test "$enableval" = "yes"
214 AC_DEFINE([USE_QFA],1,[Define this if you want Quick File Access support.])
215 echo "Enabling Quick File Access support"
217 echo "Not enabling Quick File Access support"
220 AC_DEFINE([USE_QFA],1,[Define this if you want Quick File Access support.])
221 echo "Enabling Quick File Access support by default"
225 dnl Handle --enable-qfadebug
227 AC_ARG_ENABLE([qfadebug],
228 [ --enable-qfadebug include Quick File Access debugging code (default is NO)],
229 if test "$enableval" = "yes"
231 AC_DEFINE([DEBUG_QFA],1,[Define this if you want to include Quick File Access debugging code.])
232 echo "Including Quick File Access debugging code"
234 echo "Not including Quick File Access debugging code"
237 echo "Not including Quick File Access debugging code by default"
241 dnl Handle --enable-macosx
243 AC_ARG_ENABLE([macosx],
244 [ --enable-macosx include Mac OSX restore compatibility (default is NO)],
245 if test "$enableval" = "yes"
247 AC_DEFINE([DUMP_MACOSX],1,[Define this if you want to include Mac OSX restore compatibility.])
248 echo "Including Mac OSX restore compatibility code"
250 echo "Not including Mac OSX restore compatibility code"
253 echo "Not including Mac OSX restore compatibility code by default"
258 dnl set $(CC) from --with-cc=value
261 [ --with-cc=COMPILER select compiler to use],
262 AC_MSG_RESULT(CC=$withval)
264 if test -z "$CC" ; then CC=cc; fi
265 [AC_MSG_RESULT(CC defaults to $CC)])dnl
270 dnl set $(LD) from --with-linker=value
272 AC_ARG_WITH([linker],
273 [ --with-linker=LINKER select linker to use],
274 AC_MSG_RESULT(LD=$withval)
276 if test -z "$LD" ; then LD=$CC; fi
277 [AC_MSG_RESULT(LD defaults to $LD)])dnl
282 dnl set $(CCOPTS) from --with-ccopts=value
284 AC_ARG_WITH([ccopts],
285 [ --with-ccopts=CCOPTS select compiler command line options],
286 AC_MSG_RESULT(CCOPTS is $withval)
288 CFLAGS="$CFLAGS $withval",
293 dnl set $(LDFLAGS) from --with-ldopts=value
295 AC_ARG_WITH([ldopts],
296 [ --with-ldopts=LDOPTS select linker command line options],
297 AC_MSG_RESULT(LDFLAGS is $withval)
299 LDFLAGS="$LDFLAGS $withval",
304 dnl set $(BINOWNER) from --with-binowner
306 AC_ARG_WITH([binowner],
307 [ --with-binowner=USER select owner for binaries],
308 AC_MSG_RESULT(BINOWNER is $withval)
311 echo "BINOWNER defaults to $BINOWNER"
316 dnl set $(BINGRP) from --with-bingrp
318 AC_ARG_WITH([bingrp],
319 [ --with-bingrp=GROUP select group for binaries],
320 AC_MSG_RESULT(BINGRP is $withval)
323 echo "BINGRP defaults to $BINGRP"
328 dnl set $(BINMODE) from --with-binmode
330 AC_ARG_WITH([binmode],
331 [ --with-binmode=MODE select mode for binaries],
332 AC_MSG_RESULT(BINMODE is $withval)
335 echo "BINMODE defaults to $BINMODE"
340 dnl set $(MANOWNER) from --with-manowner
342 AC_ARG_WITH([manowner],
343 [ --with-manowner=USER select owner for manual pages],
344 AC_MSG_RESULT(MANOWNER is $withval)
347 echo "MANOWNER defaults to $MANOWNER"
352 dnl set $(MANGRP) from --with-mangrp
354 AC_ARG_WITH([mangrp],
355 [ --with-mangrp=GROUP select group for manual pages],
356 AC_MSG_RESULT(MANGRP is $withval)
359 echo "MANGRP defaults to $MANGRP"
364 dnl set $(MANMODE) from --with-manmode
366 AC_ARG_WITH([manmode],
367 [ --with-manmode=MODE select mode for manual pages],
368 AC_MSG_RESULT(MANMODE is $withval)
371 echo "MANMODE defaults to $MANMODE"
376 dnl set $(DUMPDATESPATH) from --with-dumpdatespath
378 AC_ARG_WITH([dumpdatespath],
379 [ --with-dumpdatespath=PATH select path for dumpdates file],
380 AC_MSG_RESULT(DUMPDATESPATH is $withval)
381 DUMPDATESPATH=$withval,
382 DUMPDATESPATH="${sysconfdir}/dumpdates"
383 echo "DUMPDATESPATH defaults to $DUMPDATESPATH"
385 AC_SUBST(DUMPDATESPATH)
388 dnl Check for Ext2fs headers and libraries
390 AC_CHECK_HEADER(ext2fs/ext2fs.h, [ext2fs_h=yes], [ext2fs_h=no], [-])
391 AC_CHECK_LIB(ext2fs, ext2fs_open, [ext2fs_lib=yes], [ext2fs_lib=no], [-lcom_err])
392 if test "$ext2fs_h" = no -o "$ext2fs_lib" = no; then
393 AC_MSG_ERROR(You need to install the Ext2fs libraries from the E2fsprogs distribution first - hint: make install-libs)
397 dnl Try to use ext2_fs.h header from libext2fs instead of from the kernel
399 AC_CHECK_HEADERS(ext2fs/ext2_fs.h, [], [], [-])
402 dnl Check for ext2_ino_t type
404 AC_MSG_CHECKING(for ext2_ino_t type in libext2fs headers)
405 AC_TRY_COMPILE([#include <stdio.h>
406 #ifdef HAVE_EXT2FS_EXT2_FS_H
407 #include <ext2fs/ext2_fs.h>
409 #include <linux/ext2_fs.h>
411 #include <ext2fs/ext2fs.h>],
412 [ext2_ino_t ino = 0;],
413 [AC_DEFINE([HAVE_EXT2_INO_T],1,[Define if we have the ext2_ino_t type (from e2fsprogs 1.20+).])
418 dnl Check for s_journal_inum field in ext2_super_block struct
420 AC_MSG_CHECKING(for s_journal_inum field in ext2_super_block struct)
421 AC_TRY_COMPILE([#include <stdio.h>
422 #ifdef HAVE_EXT2FS_EXT2_FS_H
423 #include <ext2fs/ext2_fs.h>
425 #include <linux/ext2_fs.h>
427 #include <ext2fs/ext2fs.h>],
428 [struct ext2_super_block es; es.s_journal_inum = 0;],
429 [AC_DEFINE([HAVE_EXT2_JOURNAL_INUM],1,[Define if we have the s_journal_inum field in struct ext2_super_block.])
434 dnl Check for blkid headers libraries
436 AC_CHECK_HEADER(blkid/blkid.h, [blkid_h=yes], [blkid_h=no], [-])
437 AC_CHECK_LIB(blkid, blkid_get_devname, [blkid_lib=yes], [blkid_lib=no], [-luuid])
438 if test "$blkid_h" = yes -a "$blkid_lib" = yes; then
439 AC_DEFINE([HAVE_BLKID],1,[Define this if you have the blkid library.])
440 BLKID="-lblkid -luuid"
445 dnl Check for ncurses or termcap libraries
447 AC_CHECK_LIB(ncurses, tgetent, [ncurses_lib=yes], [ncurses_lib=no])
448 AC_CHECK_LIB(termcap, tgetent, [termcap_lib=yes], [termcap_lib=no])
450 if test "$ncurses_lib" = no -a "$termcap_lib" = no; then
451 if test "$READLINE" = "yes"; then
452 AC_MSG_ERROR(You need to install the ncurses or termcap library or configure without --enable-readline)
455 if test "$ncurses_lib" = yes; then
457 elif test "$termcap_lib" = yes; then
462 dnl Check for readline headers and libraries
464 AC_CHECK_HEADER(readline/readline.h, [readline_h=yes], [readline_h=no], [-])
465 AC_CHECK_LIB(readline, readline, [readline_lib=yes], [readline_lib=no], $rdllib)
466 if test "$readline_h" = no -o "$readline_lib" = no; then
467 if test "$READLINE" = "yes"; then
468 AC_MSG_ERROR(You need to install the GNU readline library or configure without --enable-readline)
471 if test "$READLINE" = yes; then
472 READLINE="-lreadline $rdllib"
477 dnl Check for rl_completion_matches
479 AC_CHECK_LIB(readline, rl_completion_matches, [rlcm=yes], [rlcm=no], "-ltermcap")
480 if test "$rlcm" = yes; then
481 AC_DEFINE([HAVE_READLINE_RLCM],1,[Define this if your readline libs have the rl_completion_matches library.])
485 dnl Check for rl_completion_append_character
487 AC_CHECK_LIB(readline, rl_completion_append_character, [rcac=yes], [rcac=no], "-ltermcap")
488 if test "$rcac" = yes; then
489 AC_DEFINE([HAVE_READLINE_CAC],1,[Define this if your readline libs have the rl_completion_append_character variable.])
493 dnl Check for zlib headers and libraries
495 AC_CHECK_HEADER(zlib.h, [zlib_h=yes], [zlib_h=no], [-])
496 AC_CHECK_LIB(z, compress2, [zlib_lib=yes], [zlib_lib=no])
497 if test "$zlib_h" = yes -a "$zlib_lib" = yes; then
498 if test "$STATICZ" = yes; then
499 ZLIB="-Wl,-Bstatic -lz -Wl,-Bdynamic"
503 AC_DEFINE([HAVE_ZLIB],1,[Define this if you have zlib compression library.])
510 dnl Check for bzlib headers and libraries
512 AC_CHECK_HEADER(bzlib.h, [bzlib_h=yes], [bzlib_h=no], [-])
513 AC_CHECK_LIB(bz2, BZ2_bzBuffToBuffCompress, [bzlib_lib=yes], [bzlib_lib=no])
514 if test "$bzlib_h" = yes -a "$bzlib_lib" = yes; then
515 if test "$STATICZ" = yes; then
516 BZLIB="-Wl,-Bstatic -lbz2 -Wl,-Bdynamic"
520 AC_DEFINE([HAVE_BZLIB],1,[Define this if you have bzlib compression library.])
527 dnl Check for library functions
529 AC_CHECK_FUNCS(err errx verr verrx vwarn vwarnx warn warnx realpath lchown)
533 dnl Check for GLOB_ALTDIRFUNC
535 AC_MSG_CHECKING(for extended glob routines)
536 if test "$ac_cv_func_glob" = "yes"; then
540 # ifdef GLOB_ALTDIRFUNC
545 AC_DEFINE([HAVE_GLOB],1,[Define if you have the glob function.])
550 echo "Your system does not support extended glob, will use the internal routines"
555 dnl Check for OpenSSL, for ermt
557 if test "$ERMT" != ""; then
558 AC_CHECK_HEADER(openssl/evp.h, [evp_h=yes], [evp_h=no])
559 AC_CHECK_LIB(crypto, EVP_CIPHER_CTX_set_padding, [crypto_lib=yes], [crypto_lib=no])
560 if test "$evp_h" = no -o "$crypto_lib" = no; then
561 AC_MSG_ERROR(You need to install the OpenSSL library (version 0.9.7a or later), or configure without --enable-ermt)
568 AC_CHECK_TYPE(quad_t, int64_t)
569 AC_CHECK_TYPE(u_quad_t, uint64_t)
572 dnl Compute top_buildir
574 top_builddir=`cd .; pwd`
575 AC_SUBST(top_builddir)
578 dnl Create directories
580 test -d compat || mkdir compat
581 test -d compat/lib || mkdir compat/lib
586 AC_OUTPUT(MCONFIG Makefile common/Makefile compat/include/Makefile compat/lib/Makefile dump/Makefile restore/Makefile $RMTMAKEFILE)