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"
116 echo "Not compiling ermt"
118 if test "$RMTDIR" = ""
120 AC_MSG_ERROR(ermt requires --enable-rmt)
123 echo "Compiling ermt"
127 echo "Not compiling ermt by default"
132 dnl Handle --enable-kerberos
134 AC_ARG_ENABLE([kerberos],
135 [ --enable-kerberos compile kerberos extensions (default is NO)],
136 if test "$enableval" = "yes"
139 echo "Compiling kerberos extensions"
142 echo "Not compiling kerberos extensions"
146 echo "Not compiling kerberos extensions by default"
151 dnl Handle --enable-readline
153 AC_ARG_ENABLE([readline],
154 [ --enable-readline enable readline support in restore (default is YES)],
155 if test "$enableval" = "no"
158 echo "Not including readline support"
161 AC_DEFINE([HAVE_READLINE],1,[Define if you want to include readline support.])
162 echo "Including readline support"
166 AC_DEFINE([HAVE_READLINE],1,[Define if you want to include readline support.])
167 echo "Including readline support by default"
171 dnl Handle --enable-oldsylefscript
173 AC_ARG_ENABLE([oldstylefscript],
174 [ --enable-oldstylefscript enable old style F script (no arguments) (default is NO)],
175 if test "$enableval" = "yes"
177 AC_DEFINE([OLD_STYLE_FSCRIPT],1,[Define this is you want old style F script (no arguments).])
178 echo "Using old style F script"
180 echo "Using new style F script"
183 echo "Using new style F script by default"
187 dnl Handle --enable-largefile
189 AC_ARG_ENABLE([largefile],
190 [ --enable-largefile enable Large File System support (default is YES)],
191 if test "$enableval" = "yes"
193 AC_DEFINE([USE_LFS],1,[Define this if you want Large File System support.])
194 echo "Enabling Large File System support"
196 echo "Not enabling Large File System support"
199 AC_DEFINE([USE_LFS],1,[Define this if you want Large File System support.])
200 echo "Enabling Large File System support by default"
204 dnl Handle --enable-qfa
207 [ --enable-qfa enable Quick File Access support (default is YES)],
208 if test "$enableval" = "yes"
210 AC_DEFINE([USE_QFA],1,[Define this if you want Quick File Access support.])
211 echo "Enabling Quick File Access support"
213 echo "Not enabling Quick File Access support"
216 AC_DEFINE([USE_QFA],1,[Define this if you want Quick File Access support.])
217 echo "Enabling Quick File Access support by default"
221 dnl Handle --enable-qfadebug
223 AC_ARG_ENABLE([qfadebug],
224 [ --enable-qfadebug include Quick File Access debugging code (default is NO)],
225 if test "$enableval" = "yes"
227 AC_DEFINE([DEBUG_QFA],1,[Define this if you want to include Quick File Access debugging code.])
228 echo "Including Quick File Access debugging code"
230 echo "Not including Quick File Access debugging code"
233 echo "Not including Quick File Access debugging code by default"
237 dnl Handle --enable-macosx
239 AC_ARG_ENABLE([macosx],
240 [ --enable-macosx include Mac OSX restore compatibility (default is NO)],
241 if test "$enableval" = "yes"
243 AC_DEFINE([DUMP_MACOSX],1,[Define this if you want to include Mac OSX restore compatibility.])
244 echo "Including Mac OSX restore compatibility code"
246 echo "Not including Mac OSX restore compatibility code"
249 echo "Not including Mac OSX restore compatibility code by default"
253 dnl Handle --enable-transselinux
255 AC_ARG_ENABLE([transselinux],
256 [ --enable-transselinux restore can translate SELinux EAs (default is YES)],
257 if test "$enableval" = "yes"
259 LTRANSSELINUX="-lselinux"
260 CCTRANSSELINUX="-DTRANSSELINUX"
261 echo "restore can translate SELinux EAs"
265 echo "restore can not translate SELinux EAs"
268 LTRANSSELINUX="-lselinux"
269 CCTRANSSELINUX="-DTRANSSELINUX"
270 echo "restore can translate SELinux EAs by default"
272 AC_SUBST(LTRANSSELINUX)
273 AC_SUBST(CCTRANSSELINUX)
277 dnl set $(CC) from --with-cc=value
280 [ --with-cc=COMPILER select compiler to use],
281 AC_MSG_RESULT(CC=$withval)
283 if test -z "$CC" ; then CC=cc; fi
284 [AC_MSG_RESULT(CC defaults to $CC)])dnl
289 dnl set $(LD) from --with-linker=value
291 AC_ARG_WITH([linker],
292 [ --with-linker=LINKER select linker to use],
293 AC_MSG_RESULT(LD=$withval)
295 if test -z "$LD" ; then LD=$CC; fi
296 [AC_MSG_RESULT(LD defaults to $LD)])dnl
301 dnl set $(CCOPTS) from --with-ccopts=value
303 AC_ARG_WITH([ccopts],
304 [ --with-ccopts=CCOPTS select compiler command line options],
305 AC_MSG_RESULT(CCOPTS is $withval)
307 CFLAGS="$CFLAGS $withval",
312 dnl set $(LDFLAGS) from --with-ldopts=value
314 AC_ARG_WITH([ldopts],
315 [ --with-ldopts=LDOPTS select linker command line options],
316 AC_MSG_RESULT(LDFLAGS is $withval)
318 LDFLAGS="$LDFLAGS $withval",
323 dnl set $(BINOWNER) from --with-binowner
325 AC_ARG_WITH([binowner],
326 [ --with-binowner=USER select owner for binaries],
327 AC_MSG_RESULT(BINOWNER is $withval)
330 echo "BINOWNER defaults to $BINOWNER"
335 dnl set $(BINGRP) from --with-bingrp
337 AC_ARG_WITH([bingrp],
338 [ --with-bingrp=GROUP select group for binaries],
339 AC_MSG_RESULT(BINGRP is $withval)
342 echo "BINGRP defaults to $BINGRP"
347 dnl set $(BINMODE) from --with-binmode
349 AC_ARG_WITH([binmode],
350 [ --with-binmode=MODE select mode for binaries],
351 AC_MSG_RESULT(BINMODE is $withval)
354 echo "BINMODE defaults to $BINMODE"
359 dnl set $(MANOWNER) from --with-manowner
361 AC_ARG_WITH([manowner],
362 [ --with-manowner=USER select owner for manual pages],
363 AC_MSG_RESULT(MANOWNER is $withval)
366 echo "MANOWNER defaults to $MANOWNER"
371 dnl set $(MANGRP) from --with-mangrp
373 AC_ARG_WITH([mangrp],
374 [ --with-mangrp=GROUP select group for manual pages],
375 AC_MSG_RESULT(MANGRP is $withval)
378 echo "MANGRP defaults to $MANGRP"
383 dnl set $(MANMODE) from --with-manmode
385 AC_ARG_WITH([manmode],
386 [ --with-manmode=MODE select mode for manual pages],
387 AC_MSG_RESULT(MANMODE is $withval)
390 echo "MANMODE defaults to $MANMODE"
395 dnl set $(DUMPDATESPATH) from --with-dumpdatespath
397 AC_ARG_WITH([dumpdatespath],
398 [ --with-dumpdatespath=PATH select path for dumpdates file],
399 AC_MSG_RESULT(DUMPDATESPATH is $withval)
400 DUMPDATESPATH=$withval,
401 DUMPDATESPATH="${sysconfdir}/dumpdates"
402 echo "DUMPDATESPATH defaults to $DUMPDATESPATH"
404 AC_SUBST(DUMPDATESPATH)
407 dnl Check for Ext2fs headers and libraries
409 AC_CHECK_HEADER(ext2fs/ext2fs.h, [ext2fs_h=yes], [ext2fs_h=no], [-])
410 PKG_CHECK_MODULES(EXT2FS, [ext2fs])
411 if test -n "$STATIC" ; then
412 EXT2FS_LIBS=`$PKG_CONFIG --libs --static ext2fs`
414 if test "$ext2fs_h" = no -o "x$EXT2FS_LIBS" = "x"; then
415 AC_MSG_ERROR(You need to install the Ext2fs libraries from the E2fsprogs distribution first - hint: make install-libs)
419 dnl Check for ext2fs_read_inode_full
421 AC_CHECK_LIB(ext2fs, ext2fs_read_inode_full, [rif=yes], [rif=no], [-lcom_err])
422 if test "$rif" = yes; then
423 AC_DEFINE([HAVE_EXT2FS_READ_INODE_FULL],1,[Define this if your ext2fs libs have the ext2fs_read_inode_full function.])
427 dnl Try to use ext2_fs.h header from libext2fs instead of from the kernel
429 AC_CHECK_HEADERS(ext2fs/ext2_fs.h, [], [], [-])
432 dnl Check for ext2_ino_t type
434 AC_MSG_CHECKING(for ext2_ino_t type in libext2fs headers)
435 AC_TRY_COMPILE([#include <stdio.h>
436 #ifdef HAVE_EXT2FS_EXT2_FS_H
437 #include <ext2fs/ext2_fs.h>
439 #include <linux/ext2_fs.h>
441 #include <ext2fs/ext2fs.h>],
442 [ext2_ino_t ino = 0;],
443 [AC_DEFINE([HAVE_EXT2_INO_T],1,[Define if we have the ext2_ino_t type (from e2fsprogs 1.20+).])
448 dnl Check for s_journal_inum field in ext2_super_block struct
450 AC_MSG_CHECKING(for s_journal_inum field in ext2_super_block struct)
451 AC_TRY_COMPILE([#include <stdio.h>
452 #ifdef HAVE_EXT2FS_EXT2_FS_H
453 #include <ext2fs/ext2_fs.h>
455 #include <linux/ext2_fs.h>
457 #include <ext2fs/ext2fs.h>],
458 [struct ext2_super_block es; es.s_journal_inum = 0;],
459 [AC_DEFINE([HAVE_EXT2_JOURNAL_INUM],1,[Define if we have the s_journal_inum field in struct ext2_super_block.])
464 dnl Check for blkid headers libraries
466 AC_CHECK_HEADER(blkid/blkid.h, [blkid_h=yes], [blkid_h=no], [-])
467 PKG_CHECK_EXISTS([blkid],
469 if test -n $STATIC ; then
470 BLKID=`$PKG_CONFIG --libs --static blkid`
472 BLKID=`$PKG_CONFIG --libs blkid`
474 if test "$blkid_h" = yes ; then
475 AC_DEFINE([HAVE_BLKID],1,[Define this if you have the blkid library.])
481 dnl Check for ncurses or termcap libraries
483 AC_CHECK_LIB(ncurses, tgetent, [ncurses_lib=yes], [ncurses_lib=no])
484 AC_CHECK_LIB(termcap, tgetent, [termcap_lib=yes], [termcap_lib=no])
485 AC_CHECK_LIB(tinfo, tgetent, [tinfo_lib=yes], [tinfo_lib=no])
487 if test "$ncurses_lib" = no -a "$termcap_lib" = no -a "$tinfo_lib" = no; then
488 if test "$READLINE" = "yes"; then
489 AC_MSG_ERROR(You need to install the ncurses or termcap library or configure without --enable-readline)
492 if test "$tinfo_lib" = yes; then
494 elif test "$ncurses_lib" = yes; then
496 elif test "$termcap_lib" = yes; then
501 dnl Check for readline headers and libraries
503 AC_CHECK_HEADER(readline/readline.h, [readline_h=yes], [readline_h=no], [-])
504 AC_CHECK_LIB(readline, readline, [readline_lib=yes], [readline_lib=no], $rdllib)
505 if test "$readline_h" = no -o "$readline_lib" = no; then
506 if test "$READLINE" = "yes"; then
507 AC_MSG_ERROR(You need to install the GNU readline library or configure without --enable-readline)
510 if test "$READLINE" = yes; then
511 READLINE="-lreadline $rdllib"
516 dnl Check for rl_completion_matches
518 AC_CHECK_LIB(readline, rl_completion_matches, [rlcm=yes], [rlcm=no], "-ltermcap")
519 if test "$rlcm" = yes; then
520 AC_DEFINE([HAVE_READLINE_RLCM],1,[Define this if your readline libs have the rl_completion_matches library.])
524 dnl Check for rl_completion_append_character
526 AC_CHECK_LIB(readline, rl_completion_append_character, [rcac=yes], [rcac=no], "-ltermcap")
527 if test "$rcac" = yes; then
528 AC_DEFINE([HAVE_READLINE_CAC],1,[Define this if your readline libs have the rl_completion_append_character variable.])
532 dnl Check for zlib headers and libraries
534 AC_CHECK_HEADER(zlib.h, [zlib_h=yes], [zlib_h=no], [-])
535 AC_CHECK_LIB(z, zlibVersion, [zlib_lib=yes], [zlib_lib=no])
536 if test "$zlib_h" = yes -a "$zlib_lib" = yes; then
537 if test "$STATICZ" = yes; then
538 ZLIB="-Wl,-Bstatic -lz -Wl,-Bdynamic"
542 AC_DEFINE([HAVE_ZLIB],1,[Define this if you have zlib compression library.])
549 dnl Check for bzlib headers and libraries
551 AC_CHECK_HEADER(bzlib.h, [bzlib_h=yes], [bzlib_h=no], [-])
552 AC_CHECK_LIB(bz2, BZ2_bzBuffToBuffCompress, [bzlib_lib=yes], [bzlib_lib=no])
553 if test "$bzlib_h" = yes -a "$bzlib_lib" = yes; then
554 if test "$STATICZ" = yes; then
555 BZLIB="-Wl,-Bstatic -lbz2 -Wl,-Bdynamic"
559 AC_DEFINE([HAVE_BZLIB],1,[Define this if you have bzlib compression library.])
566 dnl Check for library functions
568 AC_CHECK_FUNCS(err errx verr verrx vwarn vwarnx warn warnx realpath lchown)
572 dnl Check for GLOB_ALTDIRFUNC
574 AC_MSG_CHECKING(for extended glob routines)
575 if test "$ac_cv_func_glob" = "yes"; then
579 # ifdef GLOB_ALTDIRFUNC
584 AC_DEFINE([HAVE_GLOB],1,[Define if you have the glob function.])
589 echo "Your system does not support extended glob, will use the internal routines"
594 dnl Check for OpenSSL, for ermt
596 if test "$ERMT" != ""; then
597 AC_CHECK_HEADER(openssl/evp.h, [evp_h=yes], [evp_h=no])
598 AC_CHECK_LIB(crypto, EVP_CIPHER_CTX_set_padding, [crypto_lib=yes], [crypto_lib=no])
599 PKG_CHECK_EXISTS([libcrypto],
601 if test -n $STATIC ; then
602 CRYPTO=`$PKG_CONFIG --libs --static libcrypto`
604 CRYPTO=`$PKG_CONFIG --libs libcrypto`
607 if test "$evp_h" = no -o "x$CRYPTO" = "x"; then
608 AC_MSG_ERROR(You need to install the OpenSSL library (version 0.9.7a or later), or configure without --enable-ermt)
616 AC_CHECK_TYPE(quad_t, int64_t)
617 AC_CHECK_TYPE(u_quad_t, uint64_t)
620 dnl Compute top_buildir
622 top_builddir=`cd .; pwd`
623 AC_SUBST(top_builddir)
626 dnl Create directories
628 test -d compat || mkdir compat
629 test -d compat/lib || mkdir compat/lib
634 AC_OUTPUT(MCONFIG Makefile common/Makefile compat/include/Makefile compat/lib/Makefile dump/Makefile restore/Makefile $RMTMAKEFILE)