]> git.wh0rd.org - dump.git/blame_incremental - configure.in
Fixed an offset calculation leading to bread lseek errors.
[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="-lreadline -ltermcap"
165 AC_DEFINE([HAVE_READLINE],1,[Define if you want to include readline support.])
166 echo "Including readline support"
167fi
168,
169READLINE="-lreadline -ltermcap"
170AC_DEFINE([HAVE_READLINE],1,[Define if you want to include readline support.])
171echo "Including readline support by default"
172)
173AC_SUBST(READLINE)
174
175dnl
176dnl Handle --enable-oldsylefscript
177dnl
178AC_ARG_ENABLE([oldstylefscript],
179[ --enable-oldstylefscript enable old style F script (no arguments) (default is NO)],
180if test "$enableval" = "yes"
181then
182 AC_DEFINE([OLD_STYLE_FSCRIPT],1,[Define this is you want old style F script (no arguments).])
183 echo "Using old style F script"
184else
185 echo "Using new style F script"
186fi
187,
188echo "Using new style F script by default"
189)
190
191dnl
192dnl Handle --enable-largefile
193dnl
194AC_ARG_ENABLE([largefile],
195[ --enable-largefile enable Large File System support (default is YES)],
196if test "$enableval" = "yes"
197then
198 AC_DEFINE([USE_LFS],1,[Define this if you want Large File System support.])
199 echo "Enabling Large File System support"
200else
201 echo "Not enabling Large File System support"
202fi
203,
204AC_DEFINE([USE_LFS],1,[Define this if you want Large File System support.])
205echo "Enabling Large File System support by default"
206)
207
208dnl
209dnl Handle --enable-qfa
210dnl
211AC_ARG_ENABLE([qfa],
212[ --enable-qfa enable Quick File Access support (default is YES)],
213if test "$enableval" = "yes"
214then
215 AC_DEFINE([USE_QFA],1,[Define this if you want Quick File Access support.])
216 echo "Enabling Quick File Access support"
217else
218 echo "Not enabling Quick File Access support"
219fi
220,
221AC_DEFINE([USE_QFA],1,[Define this if you want Quick File Access support.])
222echo "Enabling Quick File Access support by default"
223)
224
225dnl
226dnl Handle --enable-qfadebug
227dnl
228AC_ARG_ENABLE([qfadebug],
229[ --enable-qfadebug include Quick File Access debugging code (default is NO)],
230if test "$enableval" = "yes"
231then
232 AC_DEFINE([DEBUG_QFA],1,[Define this if you want to include Quick File Access debugging code.])
233 echo "Including Quick File Access debugging code"
234else
235 echo "Not including Quick File Access debugging code"
236fi
237,
238echo "Not including Quick File Access debugging code by default"
239)
240
241dnl
242dnl Handle --enable-macosx
243dnl
244AC_ARG_ENABLE([macosx],
245[ --enable-macosx include Mac OSX restore compatibility (default is NO)],
246if test "$enableval" = "yes"
247then
248 AC_DEFINE([DUMP_MACOSX],1,[Define this if you want to include Mac OSX restore compatibility.])
249 echo "Including Mac OSX restore compatibility code"
250else
251 echo "Not including Mac OSX restore compatibility code"
252fi
253,
254echo "Not including Mac OSX restore compatibility code by default"
255)
256
257
258dnl
259dnl set $(CC) from --with-cc=value
260dnl
261AC_ARG_WITH([cc],
262[ --with-cc=COMPILER select compiler to use],
263AC_MSG_RESULT(CC=$withval)
264CC=$withval,
265if test -z "$CC" ; then CC=cc; fi
266[AC_MSG_RESULT(CC defaults to $CC)])dnl
267export CC
268AC_SUBST([CC])
269
270dnl
271dnl set $(LD) from --with-linker=value
272dnl
273AC_ARG_WITH([linker],
274[ --with-linker=LINKER select linker to use],
275AC_MSG_RESULT(LD=$withval)
276LD=$withval,
277if test -z "$LD" ; then LD=$CC; fi
278[AC_MSG_RESULT(LD defaults to $LD)])dnl
279export LD
280AC_SUBST([LD])
281
282dnl
283dnl set $(CCOPTS) from --with-ccopts=value
284dnl
285AC_ARG_WITH([ccopts],
286[ --with-ccopts=CCOPTS select compiler command line options],
287AC_MSG_RESULT(CCOPTS is $withval)
288CCOPTS=$withval
289CFLAGS="$CFLAGS $withval",
290CCOPTS=)dnl
291AC_SUBST(CCOPTS)
292
293dnl
294dnl set $(LDFLAGS) from --with-ldopts=value
295dnl
296AC_ARG_WITH([ldopts],
297[ --with-ldopts=LDOPTS select linker command line options],
298AC_MSG_RESULT(LDFLAGS is $withval)
299LDOPTS=$withval
300LDFLAGS="$LDFLAGS $withval",
301LDOPTS=)dnl
302AC_SUBST(LDOPTS)
303
304dnl
305dnl set $(BINOWNER) from --with-binowner
306dnl
307AC_ARG_WITH([binowner],
308[ --with-binowner=USER select owner for binaries],
309AC_MSG_RESULT(BINOWNER is $withval)
310BINOWNER=$withval,
311BINOWNER=root
312echo "BINOWNER defaults to $BINOWNER"
313)dnl
314AC_SUBST(BINOWNER)
315
316dnl
317dnl set $(BINGRP) from --with-bingrp
318dnl
319AC_ARG_WITH([bingrp],
320[ --with-bingrp=GROUP select group for binaries],
321AC_MSG_RESULT(BINGRP is $withval)
322BINGRP=$withval,
323BINGRP=tty
324echo "BINGRP defaults to $BINGRP"
325)dnl
326AC_SUBST(BINGRP)
327
328dnl
329dnl set $(BINMODE) from --with-binmode
330dnl
331AC_ARG_WITH([binmode],
332[ --with-binmode=MODE select mode for binaries],
333AC_MSG_RESULT(BINMODE is $withval)
334BINMODE=$withval,
335BINMODE=0755
336echo "BINMODE defaults to $BINMODE"
337)dnl
338AC_SUBST(BINMODE)
339
340dnl
341dnl set $(MANOWNER) from --with-manowner
342dnl
343AC_ARG_WITH([manowner],
344[ --with-manowner=USER select owner for manual pages],
345AC_MSG_RESULT(MANOWNER is $withval)
346MANOWNER=$withval,
347MANOWNER=man
348echo "MANOWNER defaults to $MANOWNER"
349)dnl
350AC_SUBST(MANOWNER)
351
352dnl
353dnl set $(MANGRP) from --with-mangrp
354dnl
355AC_ARG_WITH([mangrp],
356[ --with-mangrp=GROUP select group for manual pages],
357AC_MSG_RESULT(MANGRP is $withval)
358MANGRP=$withval,
359MANGRP=tty
360echo "MANGRP defaults to $MANGRP"
361)dnl
362AC_SUBST(MANGRP)
363
364dnl
365dnl set $(MANMODE) from --with-manmode
366dnl
367AC_ARG_WITH([manmode],
368[ --with-manmode=MODE select mode for manual pages],
369AC_MSG_RESULT(MANMODE is $withval)
370MANMODE=$withval,
371MANMODE=0644
372echo "MANMODE defaults to $MANMODE"
373)dnl
374AC_SUBST(MANMODE)
375
376dnl
377dnl set $(DUMPDATESPATH) from --with-dumpdatespath
378dnl
379AC_ARG_WITH([dumpdatespath],
380[ --with-dumpdatespath=PATH select path for dumpdates file],
381AC_MSG_RESULT(DUMPDATESPATH is $withval)
382DUMPDATESPATH=$withval,
383DUMPDATESPATH="${sysconfdir}/dumpdates"
384echo "DUMPDATESPATH defaults to $DUMPDATESPATH"
385)dnl
386AC_SUBST(DUMPDATESPATH)
387
388dnl
389dnl Check for Ext2fs headers and libraries
390dnl
391AC_CHECK_HEADER(ext2fs/ext2fs.h, [ext2fs_h=yes], [ext2fs_h=no], [-])
392AC_CHECK_LIB(ext2fs, ext2fs_open, [ext2fs_lib=yes], [ext2fs_lib=no], [-lcom_err])
393if test "$ext2fs_h" = no -o "$ext2fs_lib" = no; then
394 AC_MSG_ERROR(You need to install the Ext2fs libraries from the E2fsprogs distribution first - hint: make install-libs)
395fi
396
397dnl
398dnl Try to use ext2_fs.h header from libext2fs instead of from the kernel
399dnl
400AC_CHECK_HEADERS(ext2fs/ext2_fs.h, [], [], [-])
401
402dnl
403dnl Check for ext2_ino_t type
404dnl
405AC_MSG_CHECKING(for ext2_ino_t type in libext2fs headers)
406AC_TRY_COMPILE([#include <stdio.h>
407#ifdef HAVE_EXT2FS_EXT2_FS_H
408#include <ext2fs/ext2_fs.h>
409#else
410#include <linux/ext2_fs.h>
411#endif
412#include <ext2fs/ext2fs.h>],
413[ext2_ino_t ino = 0;],
414[AC_DEFINE([HAVE_EXT2_INO_T],1,[Define if we have the ext2_ino_t type (from e2fsprogs 1.20+).])
415 AC_MSG_RESULT(yes)],
416AC_MSG_RESULT(no))
417
418dnl
419dnl Check for s_journal_inum field in ext2_super_block struct
420dnl
421AC_MSG_CHECKING(for s_journal_inum field in ext2_super_block struct)
422AC_TRY_COMPILE([#include <stdio.h>
423#ifdef HAVE_EXT2FS_EXT2_FS_H
424#include <ext2fs/ext2_fs.h>
425#else
426#include <linux/ext2_fs.h>
427#endif
428#include <ext2fs/ext2fs.h>],
429[struct ext2_super_block es; es.s_journal_inum = 0;],
430[AC_DEFINE([HAVE_EXT2_JOURNAL_INUM],1,[Define if we have the s_journal_inum field in struct ext2_super_block.])
431 AC_MSG_RESULT(yes)],
432AC_MSG_RESULT(no))
433
434dnl
435dnl Check for termcap libraries
436dnl
437AC_CHECK_LIB(termcap, tgetent, [termcap_lib=yes], [termcap_lib=no])
438if test "$termcap_lib" = no; then
439 if test "$READLINE" = "-lreadline -ltermcap"; then
440 AC_MSG_ERROR(You need to install the GNU termcap library or configure without --enable-readline)
441 fi
442fi
443
444dnl
445dnl Check for readline headers and libraries
446dnl
447AC_CHECK_HEADER(readline/readline.h, [readline_h=yes], [readline_h=no], [-])
448AC_CHECK_LIB(readline, readline, [readline_lib=yes], [readline_lib=no], "-ltermcap")
449if test "$readline_h" = no -o "$readline_lib" = no; then
450 if test "$READLINE" = "-lreadline -ltermcap"; then
451 AC_MSG_ERROR(You need to install the GNU readline library or configure without --enable-readline)
452 fi
453fi
454
455dnl
456dnl Check for rl_completion_matches
457dnl
458AC_CHECK_LIB(readline, rl_completion_matches, [rlcm=yes], [rlcm=no], "-ltermcap")
459if test "$rlcm" = yes; then
460 AC_DEFINE([HAVE_READLINE_RLCM],1,[Define this if your readline libs have the rl_completion_matches library.])
461fi
462
463dnl
464dnl Check for rl_completion_append_character
465dnl
466AC_CHECK_LIB(readline, rl_completion_append_character, [rcac=yes], [rcac=no], "-ltermcap")
467if test "$rcac" = yes; then
468 AC_DEFINE([HAVE_READLINE_CAC],1,[Define this if your readline libs have the rl_completion_append_character variable.])
469fi
470
471dnl
472dnl Check for zlib headers and libraries
473dnl
474AC_CHECK_HEADER(zlib.h, [zlib_h=yes], [zlib_h=no], [-])
475AC_CHECK_LIB(z, compress2, [zlib_lib=yes], [zlib_lib=no])
476if test "$zlib_h" = yes -a "$zlib_lib" = yes; then
477 if test "$STATICZ" = yes; then
478 ZLIB="-Wl,-Bstatic -lz -Wl,-Bdynamic"
479 else
480 ZLIB="-lz"
481 fi
482 AC_DEFINE([HAVE_ZLIB],1,[Define this if you have zlib compression library.])
483else
484 ZLIB=""
485fi
486AC_SUBST(ZLIB)
487
488dnl
489dnl Check for bzlib headers and libraries
490dnl
491AC_CHECK_HEADER(bzlib.h, [bzlib_h=yes], [bzlib_h=no], [-])
492AC_CHECK_LIB(bz2, BZ2_bzBuffToBuffCompress, [bzlib_lib=yes], [bzlib_lib=no])
493if test "$bzlib_h" = yes -a "$bzlib_lib" = yes; then
494 if test "$STATICZ" = yes; then
495 BZLIB="-Wl,-Bstatic -lbz2 -Wl,-Bdynamic"
496 else
497 BZLIB="-lbz2"
498 fi
499 AC_DEFINE([HAVE_BZLIB],1,[Define this if you have bzlib compression library.])
500else
501 BZLIB=""
502fi
503AC_SUBST(BZLIB)
504
505dnl
506dnl Check for library functions
507dnl
508AC_CHECK_FUNCS(err errx verr verrx vwarn vwarnx warn warnx realpath lchown)
509AC_CHECK_FUNC(glob)
510
511dnl
512dnl Check for GLOB_ALTDIRFUNC
513dnl
514AC_MSG_CHECKING(for extended glob routines)
515if test "$ac_cv_func_glob" = "yes"; then
516 AC_EGREP_CPP(yes,
517 [
518# include <glob.h>
519# ifdef GLOB_ALTDIRFUNC
520 yes
521# endif
522 ],
523 [
524 AC_DEFINE([HAVE_GLOB],1,[Define if you have the glob function.])
525 AC_MSG_RESULT(yes)
526 ],
527 [
528 AC_MSG_RESULT(no)
529 echo "Your system does not support extended glob, will use the internal routines"
530 ])
531fi
532
533dnl
534dnl Check for OpenSSL, for ermt
535dnl
536if test "$ERMT" != ""; then
537 AC_CHECK_HEADER(openssl/evp.h, [evp_h=yes], [evp_h=no])
538 AC_CHECK_LIB(crypto, EVP_CIPHER_CTX_set_padding, [crypto_lib=yes], [crypto_lib=no])
539 if test "$evp_h" = no -o "$crypto_lib" = no; then
540 AC_MSG_ERROR(You need to install the OpenSSL library (version 0.9.7a or later), or configure without --enable-ermt)
541 fi
542fi
543
544dnl
545dnl Check for types
546dnl
547AC_CHECK_TYPE(quad_t, int64_t)
548AC_CHECK_TYPE(u_quad_t, uint64_t)
549
550dnl
551dnl Compute top_buildir
552dnl
553top_builddir=`cd .; pwd`
554AC_SUBST(top_builddir)
555
556dnl
557dnl Create directories
558dnl
559test -d compat || mkdir compat
560test -d compat/lib || mkdir compat/lib
561
562dnl
563dnl Output files
564dnl
565AC_OUTPUT(MCONFIG Makefile common/Makefile compat/include/Makefile compat/lib/Makefile dump/Makefile restore/Makefile $RMTMAKEFILE)