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-rmt
72 [ --enable-rmt compile and install rmt (default is YES)],
73 if test "$enableval" = "no"
77 echo "Not compiling rmt"
80 RMTMAKEFILE="rmt/Makefile"
85 RMTMAKEFILE="rmt/Makefile"
86 echo "Compiling rmt by default"
91 dnl Handle --enable-ermt
94 [ --enable-ermt compile ermt, an encrypting version of rmt (default is NO)],
95 if test "$enableval" = "no"
99 echo "Not compiling ermt"
101 if test "$RMTDIR" = ""
103 AC_MSG_ERROR(ermt requires --enable-rmt)
107 echo "Compiling ermt"
112 echo "Not compiling ermt by default"
118 dnl Handle --enable-kerberos
120 AC_ARG_ENABLE([kerberos],
121 [ --enable-kerberos compile kerberos extensions (default is NO)],
122 if test "$enableval" = "yes"
125 echo "Compiling kerberos extensions"
128 echo "Not compiling kerberos extensions"
132 echo "Not compiling kerberos extensions by default"
137 dnl Handle --enable-readline
139 AC_ARG_ENABLE([readline],
140 [ --enable-readline enable readline support in restore (default is YES)],
141 if test "$enableval" = "no"
144 echo "Not including readline support"
146 READLINE="-lreadline -ltermcap"
147 AC_DEFINE([HAVE_READLINE],1,[Define if you want to include readline support.])
148 echo "Including readline support"
151 READLINE="-lreadline -ltermcap"
152 AC_DEFINE([HAVE_READLINE],1,[Define if you want to include readline support.])
153 echo "Including readline support by default"
158 dnl Handle --enable-oldsylefscript
160 AC_ARG_ENABLE([oldstylefscript],
161 [ --enable-oldstylefscript enable old style F script (no arguments) (default is NO)],
162 if test "$enableval" = "yes"
164 AC_DEFINE([OLD_STYLE_FSCRIPT],1,[Define this is you want old style F script (no arguments).])
165 echo "Using old style F script"
167 echo "Using new style F script"
170 echo "Using new style F script by default"
174 dnl Handle --enable-largefile
176 AC_ARG_ENABLE([largefile],
177 [ --enable-largefile enable Large File System support (default is YES)],
178 if test "$enableval" = "yes"
180 AC_DEFINE([USE_LFS],1,[Define this if you want Large File System support.])
181 echo "Enabling Large File System support"
183 echo "Not enabling Large File System support"
186 AC_DEFINE([USE_LFS],1,[Define this if you want Large File System support.])
187 echo "Enabling Large File System support by default"
191 dnl Handle --enable-qfa
194 [ --enable-qfa enable Quick File Access support (default is YES)],
195 if test "$enableval" = "yes"
197 AC_DEFINE([USE_QFA],1,[Define this if you want Quick File Access support.])
198 echo "Enabling Quick File Access support"
200 echo "Not enabling Quick File Access support"
203 AC_DEFINE([USE_QFA],1,[Define this if you want Quick File Access support.])
204 echo "Enabling Quick File Access support by default"
208 dnl Handle --enable-qfadebug
210 AC_ARG_ENABLE([qfadebug],
211 [ --enable-qfadebug include Quick File Access debugging code (default is NO)],
212 if test "$enableval" = "yes"
214 AC_DEFINE([DEBUG_QFA],1,[Define this if you want to include Quick File Access debugging code.])
215 echo "Including Quick File Access debugging code"
217 echo "Not including Quick File Access debugging code"
220 echo "Not including Quick File Access debugging code by default"
224 dnl set $(CC) from --with-cc=value
227 [ --with-cc=COMPILER select compiler to use],
228 AC_MSG_RESULT(CC=$withval)
230 if test -z "$CC" ; then CC=cc; fi
231 [AC_MSG_RESULT(CC defaults to $CC)])dnl
236 dnl set $(LD) from --with-linker=value
238 AC_ARG_WITH([linker],
239 [ --with-linker=LINKER select linker to use],
240 AC_MSG_RESULT(LD=$withval)
242 if test -z "$LD" ; then LD=$CC; fi
243 [AC_MSG_RESULT(LD defaults to $LD)])dnl
248 dnl set $(CCOPTS) from --with-ccopts=value
250 AC_ARG_WITH([ccopts],
251 [ --with-ccopts=CCOPTS select compiler command line options],
252 AC_MSG_RESULT(CCOPTS is $withval)
254 CFLAGS="$CFLAGS $withval",
259 dnl set $(LDFLAGS) from --with-ldopts=value
261 AC_ARG_WITH([ldopts],
262 [ --with-ldopts=LDOPTS select linker command line options],
263 AC_MSG_RESULT(LDFLAGS is $withval)
265 LDFLAGS="$LDFLAGS $withval",
270 dnl set $(BINOWNER) from --with-binowner
272 AC_ARG_WITH([binowner],
273 [ --with-binowner=USER select owner for binaries],
274 AC_MSG_RESULT(BINOWNER is $withval)
277 echo "BINOWNER defaults to $BINOWNER"
282 dnl set $(BINGRP) from --with-bingrp
284 AC_ARG_WITH([bingrp],
285 [ --with-bingrp=GROUP select group for binaries],
286 AC_MSG_RESULT(BINGRP is $withval)
289 echo "BINGRP defaults to $BINGRP"
294 dnl set $(BINMODE) from --with-binmode
296 AC_ARG_WITH([binmode],
297 [ --with-binmode=MODE select mode for binaries],
298 AC_MSG_RESULT(BINMODE is $withval)
301 echo "BINMODE defaults to $BINMODE"
306 dnl set $(MANOWNER) from --with-manowner
308 AC_ARG_WITH([manowner],
309 [ --with-manowner=USER select owner for manual pages],
310 AC_MSG_RESULT(MANOWNER is $withval)
313 echo "MANOWNER defaults to $MANOWNER"
318 dnl set $(MANGRP) from --with-mangrp
320 AC_ARG_WITH([mangrp],
321 [ --with-mangrp=GROUP select group for manual pages],
322 AC_MSG_RESULT(MANGRP is $withval)
325 echo "MANGRP defaults to $MANGRP"
330 dnl set $(MANMODE) from --with-manmode
332 AC_ARG_WITH([manmode],
333 [ --with-manmode=MODE select mode for manual pages],
334 AC_MSG_RESULT(MANMODE is $withval)
337 echo "MANMODE defaults to $MANMODE"
342 dnl set $(DUMPDATESPATH) from --with-dumpdatespath
344 AC_ARG_WITH([dumpdatespath],
345 [ --with-dumpdatespath=PATH select path for dumpdates file],
346 AC_MSG_RESULT(DUMPDATESPATH is $withval)
347 DUMPDATESPATH=$withval,
348 DUMPDATESPATH="${sysconfdir}/dumpdates"
349 echo "DUMPDATESPATH defaults to $DUMPDATESPATH"
351 AC_SUBST(DUMPDATESPATH)
354 dnl Check for Ext2fs headers and libraries
356 AC_CHECK_HEADER(ext2fs/ext2fs.h, [ext2fs_h=yes], [ext2fs_h=no], [-])
357 AC_CHECK_LIB(ext2fs, ext2fs_open, [ext2fs_lib=yes], [ext2fs_lib=no], [-lcom_err])
358 if test "$ext2fs_h" = no -o "$ext2fs_lib" = no; then
359 AC_MSG_ERROR(You need to install the Ext2fs libraries from the E2fsprogs distribution first - hint: make install-libs)
363 dnl Try to use ext2_fs.h header from libext2fs instead of from the kernel
365 AC_CHECK_HEADERS(ext2fs/ext2_fs.h, [], [], [-])
368 dnl Check for ext2_ino_t type
370 AC_MSG_CHECKING(for ext2_ino_t type in libext2fs headers)
371 AC_TRY_COMPILE([#include <stdio.h>
372 #ifdef HAVE_EXT2FS_EXT2_FS_H
373 #include <ext2fs/ext2_fs.h>
375 #include <linux/ext2_fs.h>
377 #include <ext2fs/ext2fs.h>],
378 [ext2_ino_t ino = 0;],
379 [AC_DEFINE([HAVE_EXT2_INO_T],1,[Define if we have the ext2_ino_t type (from e2fsprogs 1.20+).])
384 dnl Check for s_journal_inum field in ext2_super_block struct
386 AC_MSG_CHECKING(for s_journal_inum field in ext2_super_block struct)
387 AC_TRY_COMPILE([#include <stdio.h>
388 #ifdef HAVE_EXT2FS_EXT2_FS_H
389 #include <ext2fs/ext2_fs.h>
391 #include <linux/ext2_fs.h>
393 #include <ext2fs/ext2fs.h>],
394 [struct ext2_super_block es; es.s_journal_inum = 0;],
395 [AC_DEFINE([HAVE_EXT2_JOURNAL_INUM],1,[Define if we have the s_journal_inum field in struct ext2_super_block.])
400 dnl Check for termcap libraries
402 AC_CHECK_LIB(termcap, tgetent, [termcap_lib=yes], [termcap_lib=no])
403 if test "$termcap_lib" = no; then
404 if test "$READLINE" = "-lreadline -ltermcap"; then
405 AC_MSG_ERROR(You need to install the GNU termcap library or configure without --enable-readline)
410 dnl Check for readline headers and libraries
412 AC_CHECK_HEADER(readline/readline.h, [readline_h=yes], [readline_h=no], [-])
413 AC_CHECK_LIB(readline, readline, [readline_lib=yes], [readline_lib=no], "-ltermcap")
414 if test "$readline_h" = no -o "$readline_lib" = no; then
415 if test "$READLINE" = "-lreadline -ltermcap"; then
416 AC_MSG_ERROR(You need to install the GNU readline library or configure without --enable-readline)
421 dnl Check for rl_completion_matches
423 AC_CHECK_LIB(readline, rl_completion_matches, [rlcm=yes], [rlcm=no], "-ltermcap")
424 if test "$rlcm" = yes; then
425 AC_DEFINE([HAVE_READLINE_RLCM],1,[Define this if your readline libs have the rl_completion_matches library.])
429 dnl Check for rl_completion_append_character
431 AC_CHECK_LIB(readline, rl_completion_append_character, [rcac=yes], [rcac=no], "-ltermcap")
432 if test "$rcac" = yes; then
433 AC_DEFINE([HAVE_READLINE_CAC],1,[Define this if your readline libs have the rl_completion_append_character variable.])
437 dnl Check for zlib headers and libraries
439 AC_CHECK_HEADER(zlib.h, [zlib_h=yes], [zlib_h=no], [-])
440 AC_CHECK_LIB(z, compress2, [zlib_lib=yes], [zlib_lib=no])
441 if test "$zlib_h" = yes -a "$zlib_lib" = yes; then
443 AC_DEFINE([HAVE_ZLIB],1,[Define this if you have zlib compression library.])
450 dnl Check for bzlib headers and libraries
452 AC_CHECK_HEADER(bzlib.h, [bzlib_h=yes], [bzlib_h=no], [-])
453 AC_CHECK_LIB(bz2, BZ2_bzBuffToBuffCompress, [bzlib_lib=yes], [bzlib_lib=no])
454 if test "$bzlib_h" = yes -a "$bzlib_lib" = yes; then
456 AC_DEFINE([HAVE_BZLIB],1,[Define this if you have bzlib compression library.])
463 dnl Check for library functions
465 AC_CHECK_FUNCS(err errx verr verrx vwarn vwarnx warn warnx realpath lchown)
469 dnl Check for GLOB_ALTDIRFUNC
471 AC_MSG_CHECKING(for extended glob routines)
472 if test "$ac_cv_func_glob" = "yes"; then
476 # ifdef GLOB_ALTDIRFUNC
481 AC_DEFINE([HAVE_GLOB],1,[Define if you have the glob function.])
486 echo "Your system does not support extended glob, will use the internal routines"
491 dnl Check for OpenSSL, for ermt
493 if test "$ERMT" != ""; then
494 AC_CHECK_HEADER(openssl/evp.h, [evp_h=yes], [evp_h=no])
495 AC_CHECK_LIB(crypto, EVP_CIPHER_CTX_set_padding, [crypto_lib=yes], [crypto_lib=no])
496 if test "$evp_h" = no -o "$crypto_lib" = no; then
497 AC_MSG_ERROR(You need to install the OpenSSL library (version 0.9.7a or later), or configure without --enable-ermt)
504 AC_CHECK_TYPE(quad_t, int64_t)
505 AC_CHECK_TYPE(u_quad_t, uint64_t)
508 dnl Compute top_buildir
510 top_builddir=`cd .; pwd`
511 AC_SUBST(top_builddir)
514 dnl Create directories
516 test -d compat || mkdir compat
517 test -d compat/lib || mkdir compat/lib
522 AC_OUTPUT(MCONFIG Makefile common/Makefile compat/include/Makefile compat/lib/Makefile dump/Makefile restore/Makefile $RMTMAKEFILE)