]> git.wh0rd.org - dump.git/blame_incremental - configure.in
Fix SELinux xattr handling.
[dump.git] / configure.in
... / ...
CommitLineData
1AC_INIT(dump/dump.h)
2AC_PREREQ(2.57)
3
4MCONFIG=./MCONFIG
5AC_SUBST_FILE(MCONFIG)
6
7AC_CONFIG_HEADER(config.h)
8
9dnl
10dnl Check for programs
11dnl
12AC_PROG_MAKE_SET
13AC_PROG_LN_S
14AC_PATH_PROG(CP, cp, cp)
15AC_PATH_PROG(MV, mv, mv)
16AC_PATH_PROG(RM, rm, rm)
17AC_CHECK_TOOL(AR, ar, ar)
18AC_CHECK_TOOL(RANLIB, ranlib, :)
19AC_CHECK_TOOL(PATCH, patch, :)
20AC_PROG_CC
21AC_PROG_INSTALL
22
23AC_CHECK_HEADERS([sys/types.h])
24
25CPPFLAGS="-D_BSD_SOURCE -D_USE_BSD_SIGNAL ${CPPFLAGS}"
26
27dnl
28dnl Handle --enable-debug
29dnl
30AC_ARG_ENABLE([debug],
31[ --enable-debug include debugging code (default is NO)],
32if test "$enableval" = "no"
33then
34 DUMPDEBUG=""
35 RESTOREDEBUG=""
36 echo "Not including debugging code"
37else
38 DUMPDEBUG="-DFDEBUG -DTDEBUG -DWRITEDEBUG -DDIRDEBUG"
39 RESTOREDEBUG="-DDIRDEBUG"
40 echo "Including debugging code"
41fi,
42DUMPDEBUG=""
43RESTOREDEBUG=""
44echo "Not including debugging code by default"
45)
46AC_SUBST(DUMPDEBUG)
47AC_SUBST(RESTOREDEBUG)
48
49dnl
50dnl Handle --enable-static
51dnl
52AC_ARG_ENABLE([static],
53[ --enable-static link dump and restore statically (default is NO)],
54if test "$enableval" = "no"
55then
56 STATIC=""
57 echo "Linking dump and restore dynamically"
58else
59 STATIC="-static"
60 echo "Linking dump and restore statically"
61fi
62,
63STATIC=""
64echo "Linking dump and restore dynamically by default"
65)
66AC_SUBST(STATIC)
67
68dnl
69dnl Handle --enable-staticz
70dnl
71AC_ARG_ENABLE([staticz],
72[ --enable-staticz link libz and libbz2 statically (default is NO)],
73if test "$enableval" = "no"
74then
75 STATICZ="no"
76 echo "Linking libz and libbz2 dynamically"
77else
78 STATICZ="yes"
79 echo "Linking libz and libbz2 statically"
80fi
81,
82STATICZ="no"
83echo "Linking libz and libbz2 dynamically by default"
84)
85
86dnl
87dnl Handle --enable-rmt
88dnl
89AC_ARG_ENABLE([rmt],
90[ --enable-rmt compile and install rmt (default is YES)],
91if test "$enableval" = "no"
92then
93 RMTDIR=""
94 RMTMAKEFILE=""
95 echo "Not compiling rmt"
96else
97 RMTDIR="rmt"
98 RMTMAKEFILE="rmt/Makefile"
99 echo "Compiling rmt"
100fi
101,
102RMTDIR="rmt"
103RMTMAKEFILE="rmt/Makefile"
104echo "Compiling rmt by default"
105)
106AC_SUBST(RMTDIR)
107
108dnl
109dnl Handle --enable-ermt
110dnl
111AC_ARG_ENABLE([ermt],
112[ --enable-ermt compile ermt, an encrypting version of rmt (default is NO)],
113if test "$enableval" = "no"
114then
115 ERMT=""
116 CRYPTO=""
117 echo "Not compiling ermt"
118else
119 if test "$RMTDIR" = ""
120 then
121 AC_MSG_ERROR(ermt requires --enable-rmt)
122 fi
123 ERMT="ermt"
124 CRYPTO="-lcrypto"
125 echo "Compiling ermt"
126fi
127,
128ERMT=""
129CRYPTO=""
130echo "Not compiling ermt by default"
131)
132AC_SUBST(ERMT)
133AC_SUBST(CRYPTO)
134
135dnl
136dnl Handle --enable-kerberos
137dnl
138AC_ARG_ENABLE([kerberos],
139[ --enable-kerberos compile kerberos extensions (default is NO)],
140if test "$enableval" = "yes"
141then
142 OPTDEFS="-DKERBEROS"
143 echo "Compiling kerberos extensions"
144else
145 OPTDEFS=""
146 echo "Not compiling kerberos extensions"
147fi
148,
149OPTDEFS=""
150echo "Not compiling kerberos extensions by default"
151)
152AC_SUBST(OPTDEFS)
153
154dnl
155dnl Handle --enable-readline
156dnl
157AC_ARG_ENABLE([readline],
158[ --enable-readline enable readline support in restore (default is YES)],
159if test "$enableval" = "no"
160then
161 READLINE=""
162 echo "Not including readline support"
163else
164 READLINE="yes"
165 AC_DEFINE([HAVE_READLINE],1,[Define if you want to include readline support.])
166 echo "Including readline support"
167fi
168,
169READLINE="yes"
170AC_DEFINE([HAVE_READLINE],1,[Define if you want to include readline support.])
171echo "Including readline support by default"
172)
173
174dnl
175dnl Handle --enable-oldsylefscript
176dnl
177AC_ARG_ENABLE([oldstylefscript],
178[ --enable-oldstylefscript enable old style F script (no arguments) (default is NO)],
179if test "$enableval" = "yes"
180then
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"
183else
184 echo "Using new style F script"
185fi
186,
187echo "Using new style F script by default"
188)
189
190dnl
191dnl Handle --enable-largefile
192dnl
193AC_ARG_ENABLE([largefile],
194[ --enable-largefile enable Large File System support (default is YES)],
195if test "$enableval" = "yes"
196then
197 AC_DEFINE([USE_LFS],1,[Define this if you want Large File System support.])
198 echo "Enabling Large File System support"
199else
200 echo "Not enabling Large File System support"
201fi
202,
203AC_DEFINE([USE_LFS],1,[Define this if you want Large File System support.])
204echo "Enabling Large File System support by default"
205)
206
207dnl
208dnl Handle --enable-qfa
209dnl
210AC_ARG_ENABLE([qfa],
211[ --enable-qfa enable Quick File Access support (default is YES)],
212if test "$enableval" = "yes"
213then
214 AC_DEFINE([USE_QFA],1,[Define this if you want Quick File Access support.])
215 echo "Enabling Quick File Access support"
216else
217 echo "Not enabling Quick File Access support"
218fi
219,
220AC_DEFINE([USE_QFA],1,[Define this if you want Quick File Access support.])
221echo "Enabling Quick File Access support by default"
222)
223
224dnl
225dnl Handle --enable-qfadebug
226dnl
227AC_ARG_ENABLE([qfadebug],
228[ --enable-qfadebug include Quick File Access debugging code (default is NO)],
229if test "$enableval" = "yes"
230then
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"
233else
234 echo "Not including Quick File Access debugging code"
235fi
236,
237echo "Not including Quick File Access debugging code by default"
238)
239
240dnl
241dnl Handle --enable-macosx
242dnl
243AC_ARG_ENABLE([macosx],
244[ --enable-macosx include Mac OSX restore compatibility (default is NO)],
245if test "$enableval" = "yes"
246then
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"
249else
250 echo "Not including Mac OSX restore compatibility code"
251fi
252,
253echo "Not including Mac OSX restore compatibility code by default"
254)
255
256dnl
257dnl Handle --enable-transselinux
258dnl
259AC_ARG_ENABLE([transselinux],
260[ --enable-transselinux restore can translate SELinux EAs (default is YES)],
261if test "$enableval" = "yes"
262then
263 LTRANSSELINUX="-lselinux"
264 CCTRANSSELINUX="-DTRANSSELINUX"
265 echo "restore can translate SELinux EAs"
266else
267 LTRANSSELINUX=""
268 CCTRANSSELINUX=""
269 echo "restore can not translate SELinux EAs"
270fi
271,
272LTRANSSELINUX="-lselinux"
273CCTRANSSELINUX="-DTRANSSELINUX"
274echo "restore can translate SELinux EAs by default"
275)
276AC_SUBST(LTRANSSELINUX)
277AC_SUBST(CCTRANSSELINUX)
278
279
280dnl
281dnl set $(CC) from --with-cc=value
282dnl
283AC_ARG_WITH([cc],
284[ --with-cc=COMPILER select compiler to use],
285AC_MSG_RESULT(CC=$withval)
286CC=$withval,
287if test -z "$CC" ; then CC=cc; fi
288[AC_MSG_RESULT(CC defaults to $CC)])dnl
289export CC
290AC_SUBST([CC])
291
292dnl
293dnl set $(LD) from --with-linker=value
294dnl
295AC_ARG_WITH([linker],
296[ --with-linker=LINKER select linker to use],
297AC_MSG_RESULT(LD=$withval)
298LD=$withval,
299if test -z "$LD" ; then LD=$CC; fi
300[AC_MSG_RESULT(LD defaults to $LD)])dnl
301export LD
302AC_SUBST([LD])
303
304dnl
305dnl set $(CCOPTS) from --with-ccopts=value
306dnl
307AC_ARG_WITH([ccopts],
308[ --with-ccopts=CCOPTS select compiler command line options],
309AC_MSG_RESULT(CCOPTS is $withval)
310CCOPTS=$withval
311CFLAGS="$CFLAGS $withval",
312CCOPTS=)dnl
313AC_SUBST(CCOPTS)
314
315dnl
316dnl set $(LDFLAGS) from --with-ldopts=value
317dnl
318AC_ARG_WITH([ldopts],
319[ --with-ldopts=LDOPTS select linker command line options],
320AC_MSG_RESULT(LDFLAGS is $withval)
321LDOPTS=$withval
322LDFLAGS="$LDFLAGS $withval",
323LDOPTS=)dnl
324AC_SUBST(LDOPTS)
325
326dnl
327dnl set $(BINOWNER) from --with-binowner
328dnl
329AC_ARG_WITH([binowner],
330[ --with-binowner=USER select owner for binaries],
331AC_MSG_RESULT(BINOWNER is $withval)
332BINOWNER=$withval,
333BINOWNER=root
334echo "BINOWNER defaults to $BINOWNER"
335)dnl
336AC_SUBST(BINOWNER)
337
338dnl
339dnl set $(BINGRP) from --with-bingrp
340dnl
341AC_ARG_WITH([bingrp],
342[ --with-bingrp=GROUP select group for binaries],
343AC_MSG_RESULT(BINGRP is $withval)
344BINGRP=$withval,
345BINGRP=tty
346echo "BINGRP defaults to $BINGRP"
347)dnl
348AC_SUBST(BINGRP)
349
350dnl
351dnl set $(BINMODE) from --with-binmode
352dnl
353AC_ARG_WITH([binmode],
354[ --with-binmode=MODE select mode for binaries],
355AC_MSG_RESULT(BINMODE is $withval)
356BINMODE=$withval,
357BINMODE=0755
358echo "BINMODE defaults to $BINMODE"
359)dnl
360AC_SUBST(BINMODE)
361
362dnl
363dnl set $(MANOWNER) from --with-manowner
364dnl
365AC_ARG_WITH([manowner],
366[ --with-manowner=USER select owner for manual pages],
367AC_MSG_RESULT(MANOWNER is $withval)
368MANOWNER=$withval,
369MANOWNER=man
370echo "MANOWNER defaults to $MANOWNER"
371)dnl
372AC_SUBST(MANOWNER)
373
374dnl
375dnl set $(MANGRP) from --with-mangrp
376dnl
377AC_ARG_WITH([mangrp],
378[ --with-mangrp=GROUP select group for manual pages],
379AC_MSG_RESULT(MANGRP is $withval)
380MANGRP=$withval,
381MANGRP=tty
382echo "MANGRP defaults to $MANGRP"
383)dnl
384AC_SUBST(MANGRP)
385
386dnl
387dnl set $(MANMODE) from --with-manmode
388dnl
389AC_ARG_WITH([manmode],
390[ --with-manmode=MODE select mode for manual pages],
391AC_MSG_RESULT(MANMODE is $withval)
392MANMODE=$withval,
393MANMODE=0644
394echo "MANMODE defaults to $MANMODE"
395)dnl
396AC_SUBST(MANMODE)
397
398dnl
399dnl set $(DUMPDATESPATH) from --with-dumpdatespath
400dnl
401AC_ARG_WITH([dumpdatespath],
402[ --with-dumpdatespath=PATH select path for dumpdates file],
403AC_MSG_RESULT(DUMPDATESPATH is $withval)
404DUMPDATESPATH=$withval,
405DUMPDATESPATH="${sysconfdir}/dumpdates"
406echo "DUMPDATESPATH defaults to $DUMPDATESPATH"
407)dnl
408AC_SUBST(DUMPDATESPATH)
409
410dnl
411dnl Check for Ext2fs headers and libraries
412dnl
413AC_CHECK_HEADER(ext2fs/ext2fs.h, [ext2fs_h=yes], [ext2fs_h=no], [-])
414AC_CHECK_LIB(ext2fs, ext2fs_open, [ext2fs_lib=yes], [ext2fs_lib=no], [-lcom_err])
415if test "$ext2fs_h" = no -o "$ext2fs_lib" = no; then
416 AC_MSG_ERROR(You need to install the Ext2fs libraries from the E2fsprogs distribution first - hint: make install-libs)
417fi
418
419dnl
420dnl Check for ext2fs_read_inode_full
421dnl
422AC_CHECK_LIB(ext2fs, ext2fs_read_inode_full, [rif=yes], [rif=no], [-lcom_err])
423if test "$rif" = yes; then
424 AC_DEFINE([HAVE_EXT2FS_READ_INODE_FULL],1,[Define this if your ext2fs libs have the ext2fs_read_inode_full function.])
425fi
426
427dnl
428dnl Try to use ext2_fs.h header from libext2fs instead of from the kernel
429dnl
430AC_CHECK_HEADERS(ext2fs/ext2_fs.h, [], [], [-])
431
432dnl
433dnl Check for ext2_ino_t type
434dnl
435AC_MSG_CHECKING(for ext2_ino_t type in libext2fs headers)
436AC_TRY_COMPILE([#include <stdio.h>
437#ifdef HAVE_EXT2FS_EXT2_FS_H
438#include <ext2fs/ext2_fs.h>
439#else
440#include <linux/ext2_fs.h>
441#endif
442#include <ext2fs/ext2fs.h>],
443[ext2_ino_t ino = 0;],
444[AC_DEFINE([HAVE_EXT2_INO_T],1,[Define if we have the ext2_ino_t type (from e2fsprogs 1.20+).])
445 AC_MSG_RESULT(yes)],
446AC_MSG_RESULT(no))
447
448dnl
449dnl Check for s_journal_inum field in ext2_super_block struct
450dnl
451AC_MSG_CHECKING(for s_journal_inum field in ext2_super_block struct)
452AC_TRY_COMPILE([#include <stdio.h>
453#ifdef HAVE_EXT2FS_EXT2_FS_H
454#include <ext2fs/ext2_fs.h>
455#else
456#include <linux/ext2_fs.h>
457#endif
458#include <ext2fs/ext2fs.h>],
459[struct ext2_super_block es; es.s_journal_inum = 0;],
460[AC_DEFINE([HAVE_EXT2_JOURNAL_INUM],1,[Define if we have the s_journal_inum field in struct ext2_super_block.])
461 AC_MSG_RESULT(yes)],
462AC_MSG_RESULT(no))
463
464dnl
465dnl Check for blkid headers libraries
466dnl
467AC_CHECK_HEADER(blkid/blkid.h, [blkid_h=yes], [blkid_h=no], [-])
468AC_CHECK_LIB(blkid, blkid_get_devname, [blkid_lib=yes], [blkid_lib=no], [-luuid])
469if test "$blkid_h" = yes -a "$blkid_lib" = yes; then
470 AC_DEFINE([HAVE_BLKID],1,[Define this if you have the blkid library.])
471 BLKID="-lblkid -luuid -ldevmapper -lselinux -lsepol"
472fi
473AC_SUBST(BLKID)
474
475dnl
476dnl Check for ncurses or termcap libraries
477dnl
478AC_CHECK_LIB(ncurses, tgetent, [ncurses_lib=yes], [ncurses_lib=no])
479AC_CHECK_LIB(termcap, tgetent, [termcap_lib=yes], [termcap_lib=no])
480
481if test "$ncurses_lib" = no -a "$termcap_lib" = no; then
482 if test "$READLINE" = "yes"; then
483 AC_MSG_ERROR(You need to install the ncurses or termcap library or configure without --enable-readline)
484 fi
485fi
486if test "$ncurses_lib" = yes; then
487 rdllib="-lncurses"
488elif test "$termcap_lib" = yes; then
489 rdllib="-ltermcap"
490fi
491
492dnl
493dnl Check for readline headers and libraries
494dnl
495AC_CHECK_HEADER(readline/readline.h, [readline_h=yes], [readline_h=no], [-])
496AC_CHECK_LIB(readline, readline, [readline_lib=yes], [readline_lib=no], $rdllib)
497if test "$readline_h" = no -o "$readline_lib" = no; then
498 if test "$READLINE" = "yes"; then
499 AC_MSG_ERROR(You need to install the GNU readline library or configure without --enable-readline)
500 fi
501fi
502if test "$READLINE" = yes; then
503 READLINE="-lreadline $rdllib"
504fi
505AC_SUBST(READLINE)
506
507dnl
508dnl Check for rl_completion_matches
509dnl
510AC_CHECK_LIB(readline, rl_completion_matches, [rlcm=yes], [rlcm=no], "-ltermcap")
511if test "$rlcm" = yes; then
512 AC_DEFINE([HAVE_READLINE_RLCM],1,[Define this if your readline libs have the rl_completion_matches library.])
513fi
514
515dnl
516dnl Check for rl_completion_append_character
517dnl
518AC_CHECK_LIB(readline, rl_completion_append_character, [rcac=yes], [rcac=no], "-ltermcap")
519if test "$rcac" = yes; then
520 AC_DEFINE([HAVE_READLINE_CAC],1,[Define this if your readline libs have the rl_completion_append_character variable.])
521fi
522
523dnl
524dnl Check for zlib headers and libraries
525dnl
526AC_CHECK_HEADER(zlib.h, [zlib_h=yes], [zlib_h=no], [-])
527AC_CHECK_LIB(z, compress2, [zlib_lib=yes], [zlib_lib=no])
528if test "$zlib_h" = yes -a "$zlib_lib" = yes; then
529 if test "$STATICZ" = yes; then
530 ZLIB="-Wl,-Bstatic -lz -Wl,-Bdynamic"
531 else
532 ZLIB="-lz"
533 fi
534 AC_DEFINE([HAVE_ZLIB],1,[Define this if you have zlib compression library.])
535else
536 ZLIB=""
537fi
538AC_SUBST(ZLIB)
539
540dnl
541dnl Check for bzlib headers and libraries
542dnl
543AC_CHECK_HEADER(bzlib.h, [bzlib_h=yes], [bzlib_h=no], [-])
544AC_CHECK_LIB(bz2, BZ2_bzBuffToBuffCompress, [bzlib_lib=yes], [bzlib_lib=no])
545if test "$bzlib_h" = yes -a "$bzlib_lib" = yes; then
546 if test "$STATICZ" = yes; then
547 BZLIB="-Wl,-Bstatic -lbz2 -Wl,-Bdynamic"
548 else
549 BZLIB="-lbz2"
550 fi
551 AC_DEFINE([HAVE_BZLIB],1,[Define this if you have bzlib compression library.])
552else
553 BZLIB=""
554fi
555AC_SUBST(BZLIB)
556
557dnl
558dnl Check for library functions
559dnl
560AC_CHECK_FUNCS(err errx verr verrx vwarn vwarnx warn warnx realpath lchown)
561AC_CHECK_FUNC(glob)
562
563dnl
564dnl Check for GLOB_ALTDIRFUNC
565dnl
566AC_MSG_CHECKING(for extended glob routines)
567if test "$ac_cv_func_glob" = "yes"; then
568 AC_EGREP_CPP(yes,
569 [
570# include <glob.h>
571# ifdef GLOB_ALTDIRFUNC
572 yes
573# endif
574 ],
575 [
576 AC_DEFINE([HAVE_GLOB],1,[Define if you have the glob function.])
577 AC_MSG_RESULT(yes)
578 ],
579 [
580 AC_MSG_RESULT(no)
581 echo "Your system does not support extended glob, will use the internal routines"
582 ])
583fi
584
585dnl
586dnl Check for OpenSSL, for ermt
587dnl
588if test "$ERMT" != ""; then
589 AC_CHECK_HEADER(openssl/evp.h, [evp_h=yes], [evp_h=no])
590 AC_CHECK_LIB(crypto, EVP_CIPHER_CTX_set_padding, [crypto_lib=yes], [crypto_lib=no])
591 if test "$evp_h" = no -o "$crypto_lib" = no; then
592 AC_MSG_ERROR(You need to install the OpenSSL library (version 0.9.7a or later), or configure without --enable-ermt)
593 fi
594fi
595
596dnl
597dnl Check for types
598dnl
599AC_CHECK_TYPE(quad_t, int64_t)
600AC_CHECK_TYPE(u_quad_t, uint64_t)
601
602dnl
603dnl Compute top_buildir
604dnl
605top_builddir=`cd .; pwd`
606AC_SUBST(top_builddir)
607
608dnl
609dnl Create directories
610dnl
611test -d compat || mkdir compat
612test -d compat/lib || mkdir compat/lib
613
614dnl
615dnl Output files
616dnl
617AC_OUTPUT(MCONFIG Makefile common/Makefile compat/include/Makefile compat/lib/Makefile dump/Makefile restore/Makefile $RMTMAKEFILE)