]> git.wh0rd.org - dump.git/blame_incremental - configure.in
Security fixes from Antonomasia.
[dump.git] / configure.in
... / ...
CommitLineData
1AC_INIT(dump/dump.h)
2
3MCONFIG=./MCONFIG
4AC_SUBST_FILE(MCONFIG)
5
6AC_CONFIG_HEADER(config.h)
7
8dnl
9dnl Check for programs
10dnl
11AC_PROG_MAKE_SET
12AC_PROG_LN_S
13AC_PATH_PROG(CP, cp, cp)
14AC_PATH_PROG(MV, mv, mv)
15AC_PATH_PROG(RM, rm, rm)
16AC_CHECK_TOOL(AR, ar, ar)
17AC_CHECK_TOOL(RANLIB, ranlib, :)
18AC_CHECK_TOOL(PATCH, patch, :)
19AC_PROG_CC
20AC_PROG_INSTALL
21
22dnl
23dnl Handle --enable-debug
24dnl
25AC_ARG_ENABLE([debug],
26[ --enable-debug include debugging code (default is NO)],
27if test "$enableval" = "no"
28then
29 DUMPDEBUG=""
30 RESTOREDEBUG=""
31 echo "Not including debugging code"
32else
33 DUMPDEBUG="-DFDEBUG -DTDEBUG -DWRITEDEBUG -DDIRDEBUG"
34 RESTOREDEBUG="-DDIRDEBUG"
35 echo "Including debugging code"
36fi,
37DUMPDEBUG=""
38RESTOREDEBUG=""
39echo "Not including debugging code by default"
40)
41AC_SUBST(DUMPDEBUG)
42AC_SUBST(RESTOREDEBUG)
43
44dnl
45dnl Handle --enable-static
46dnl
47AC_ARG_ENABLE([static],
48[ --enable-static link dump and restore statically (default is NO)],
49if test "$enableval" = "no"
50then
51 STATIC=""
52 echo "Linking dump and restore dynamically"
53else
54 STATIC="-static"
55 echo "Linking dump and restore statically"
56fi
57,
58STATIC=""
59echo "Linking dump and restore dynamically by default"
60)
61AC_SUBST(STATIC)
62
63dnl
64dnl Handle --enable-rmt
65dnl
66AC_ARG_ENABLE([rmt],
67[ --enable-rmt compile and install rmt (default is YES)],
68if test "$enableval" = "no"
69then
70 RMTDIR=""
71 RMTMAKEFILE=""
72 echo "Not compiling rmt"
73else
74 RMTDIR="rmt"
75 RMTMAKEFILE="rmt/Makefile"
76 echo "Compiling rmt"
77fi
78,
79RMTDIR="rmt"
80RMTMAKEFILE="rmt/Makefile"
81echo "Compiling rmt by default"
82)
83AC_SUBST(RMTDIR)
84
85dnl
86dnl Handle --enable-kerberos
87dnl
88AC_ARG_ENABLE([kerberos],
89[ --enable-kerberos compile kerberos extensions (default is NO)],
90if test "$enableval" = "yes"
91then
92 OPTDEFS="-DKERBEROS"
93 echo "Compiling kerberos extensions"
94else
95 OPTDEFS=""
96 echo "Not compiling kerberos extensions"
97fi
98,
99OPTDEFS=""
100echo "Not compiling kerberos extensions by default"
101)
102AC_SUBST(OPTDEFS)
103
104dnl
105dnl Handle --enable-readline
106dnl
107AC_ARG_ENABLE([readline],
108[ --enable-readline enable readline support in restore (default is YES)],
109if test "$enableval" = "no"
110then
111 READLINE=""
112 echo "Not including readline support"
113else
114 READLINE="-lreadline -ltermcap"
115 AC_DEFINE(HAVE_READLINE)
116 echo "Including readline support"
117fi
118,
119READLINE="-lreadline -ltermcap"
120AC_DEFINE(HAVE_READLINE)
121echo "Including readline support by default"
122)
123AC_SUBST(READLINE)
124
125dnl
126dnl Handle --enable-oldsylefscript
127dnl
128AC_ARG_ENABLE([oldstylefscript],
129[ --enable-oldstylefscript enable old style F script (no arguments) (default is NO)],
130if test "$enableval" = "yes"
131then
132 AC_DEFINE(OLD_STYLE_FSCRIPT)
133 echo "Using old style F script"
134else
135 echo "Using new style F script"
136fi
137,
138echo "Using new style F script by default"
139)
140
141dnl
142dnl Handle --enable-largefile
143dnl
144AC_ARG_ENABLE([largefile],
145[ --enable-largefile enable Large File System support (default is YES)],
146if test "$enableval" = "yes"
147then
148 AC_DEFINE(USE_LFS)
149 echo "Enabling Large File System support"
150else
151 echo "Not enabling Large File System support"
152fi
153,
154AC_DEFINE(USE_LFS)
155echo "Enabling Large File System support by default"
156)
157
158dnl
159dnl Handle --enable-qfa
160dnl
161AC_ARG_ENABLE([qfa],
162[ --enable-qfa enable Quick File Access support (default is YES)],
163if test "$enableval" = "yes"
164then
165 AC_DEFINE(USE_QFA)
166 echo "Enabling Quick File Access support"
167else
168 echo "Not enabling Quick File Access support"
169fi
170,
171AC_DEFINE(USE_QFA)
172echo "Enabling Quick File Access support by default"
173)
174
175dnl
176dnl Handle --enable-qfadebug
177dnl
178AC_ARG_ENABLE([qfadebug],
179[ --enable-qfadebug include Quick File Access debugging code (default is NO)],
180if test "$enableval" = "yes"
181then
182 AC_DEFINE(DEBUG_QFA)
183 echo "Including Quick File Access debugging code"
184else
185 echo "Not including Quick File Access debugging code"
186fi
187,
188echo "Not including Quick File Access debugging code by default"
189)
190
191dnl
192dnl set $(CC) from --with-cc=value
193dnl
194AC_ARG_WITH([cc],
195[ --with-cc=COMPILER select compiler to use],
196AC_MSG_RESULT(CC=$withval)
197CC=$withval,
198if test -z "$CC" ; then CC=cc; fi
199[AC_MSG_RESULT(CC defaults to $CC)])dnl
200export CC
201AC_SUBST([CC])
202
203dnl
204dnl set $(LD) from --with-linker=value
205dnl
206AC_ARG_WITH([linker],
207[ --with-linker=LINKER select linker to use],
208AC_MSG_RESULT(LD=$withval)
209LD=$withval,
210if test -z "$LD" ; then LD=$CC; fi
211[AC_MSG_RESULT(LD defaults to $LD)])dnl
212export LD
213AC_SUBST([LD])
214
215dnl
216dnl set $(CCOPTS) from --with-ccopts=value
217dnl
218AC_ARG_WITH([ccopts],
219[ --with-ccopts=CCOPTS select compiler command line options],
220AC_MSG_RESULT(CCOPTS is $withval)
221CCOPTS=$withval
222CFLAGS="$CFLAGS $withval",
223CCOPTS=)dnl
224AC_SUBST(CCOPTS)
225
226dnl
227dnl set $(LDFLAGS) from --with-ldopts=value
228dnl
229AC_ARG_WITH([ldopts],
230[ --with-ldopts=LDOPTS select linker command line options],
231AC_MSG_RESULT(LDFLAGS is $withval)
232LDOPTS=$withval
233LDFLAGS="$LDFLAGS $withval",
234LDOPTS=)dnl
235AC_SUBST(LDOPTS)
236
237dnl
238dnl set $(BINOWNER) from --with-binowner
239dnl
240AC_ARG_WITH([binowner],
241[ --with-binowner=USER select owner for binaries],
242AC_MSG_RESULT(BINOWNER is $withval)
243BINOWNER=$withval,
244BINOWNER=root
245echo "BINOWNER defaults to $BINOWNER"
246)dnl
247AC_SUBST(BINOWNER)
248
249dnl
250dnl set $(BINGRP) from --with-bingrp
251dnl
252AC_ARG_WITH([bingrp],
253[ --with-bingrp=GROUP select group for binaries],
254AC_MSG_RESULT(BINGRP is $withval)
255BINGRP=$withval,
256BINGRP=tty
257echo "BINGRP defaults to $BINGRP"
258)dnl
259AC_SUBST(BINGRP)
260
261dnl
262dnl set $(BINMODE) from --with-binmode
263dnl
264AC_ARG_WITH([binmode],
265[ --with-binmode=MODE select mode for binaries],
266AC_MSG_RESULT(BINMODE is $withval)
267BINMODE=$withval,
268BINMODE=0755
269echo "BINMODE defaults to $BINMODE"
270)dnl
271AC_SUBST(BINMODE)
272
273dnl
274dnl set $(MANOWNER) from --with-manowner
275dnl
276AC_ARG_WITH([manowner],
277[ --with-manowner=USER select owner for manual pages],
278AC_MSG_RESULT(MANOWNER is $withval)
279MANOWNER=$withval,
280MANOWNER=man
281echo "MANOWNER defaults to $MANOWNER"
282)dnl
283AC_SUBST(MANOWNER)
284
285dnl
286dnl set $(MANGRP) from --with-mangrp
287dnl
288AC_ARG_WITH([mangrp],
289[ --with-mangrp=GROUP select group for manual pages],
290AC_MSG_RESULT(MANGRP is $withval)
291MANGRP=$withval,
292MANGRP=tty
293echo "MANGRP defaults to $MANGRP"
294)dnl
295AC_SUBST(MANGRP)
296
297dnl
298dnl set $(MANMODE) from --with-manmode
299dnl
300AC_ARG_WITH([manmode],
301[ --with-manmode=MODE select mode for manual pages],
302AC_MSG_RESULT(MANMODE is $withval)
303MANMODE=$withval,
304MANMODE=0644
305echo "MANMODE defaults to $MANMODE"
306)dnl
307AC_SUBST(MANMODE)
308
309dnl
310dnl set $(DUMPDATESPATH) from --with-dumpdatespath
311dnl
312AC_ARG_WITH([dumpdatespath],
313[ --with-dumpdatespath=PATH select path for dumpdates file],
314AC_MSG_RESULT(DUMPDATESPATH is $withval)
315DUMPDATESPATH=$withval,
316DUMPDATESPATH="${sysconfdir}/dumpdates"
317echo "DUMPDATESPATH defaults to $DUMPDATESPATH"
318)dnl
319AC_SUBST(DUMPDATESPATH)
320
321dnl
322dnl Check for Ext2fs headers and libraries
323dnl
324AC_CHECK_HEADER(ext2fs/ext2fs.h, [ext2fs_h=yes], [ext2fs_h=no], [-])
325AC_CHECK_LIB(ext2fs, ext2fs_open, [ext2fs_lib=yes], [ext2fs_lib=no], [-lcom_err])
326if test "$ext2fs_h" = no -o "$ext2fs_lib" = no; then
327 AC_MSG_ERROR(You need to install the Ext2fs libraries from the E2fsprogs distribution first - hint: make install-libs)
328fi
329
330dnl
331dnl Try to use ext2_fs.h header from libext2fs instead of from the kernel
332dnl
333AC_CHECK_HEADERS(ext2fs/ext2_fs.h, [], [], [-])
334
335dnl
336dnl Check for ext2_ino_t type
337dnl
338AC_MSG_CHECKING(for ext2_ino_t type in libext2fs headers)
339AC_TRY_COMPILE([#include <stdio.h>
340#ifdef HAVE_EXT2FS_EXT2_FS_H
341#include <ext2fs/ext2_fs.h>
342#else
343#include <linux/ext2_fs.h>
344#endif
345#include <ext2fs/ext2fs.h>],
346[ext2_ino_t ino = 0;],
347[AC_DEFINE(HAVE_EXT2_INO_T) AC_MSG_RESULT(yes)],
348AC_MSG_RESULT(no))
349
350dnl
351dnl Check for s_journal_inum field in ext2_super_block struct
352dnl
353AC_MSG_CHECKING(for s_journal_inum field in ext2_super_block struct)
354AC_TRY_COMPILE([#include <stdio.h>
355#ifdef HAVE_EXT2FS_EXT2_FS_H
356#include <ext2fs/ext2_fs.h>
357#else
358#include <linux/ext2_fs.h>
359#endif
360#include <ext2fs/ext2fs.h>],
361[struct ext2_super_block es; es.s_journal_inum = 0;],
362[AC_DEFINE(HAVE_EXT2_JOURNAL_INUM) AC_MSG_RESULT(yes)],
363AC_MSG_RESULT(no))
364
365dnl
366dnl Check for termcap libraries
367dnl
368AC_CHECK_LIB(termcap, tgetent, [termcap_lib=yes], [termcap_lib=no])
369if test "$termcap_lib" = no; then
370 if test "$READLINE" = "-lreadline -ltermcap"; then
371 AC_MSG_ERROR(You need to install the GNU termcap library or configure without --enable-readline)
372 fi
373fi
374
375dnl
376dnl Check for readline headers and libraries
377dnl
378AC_CHECK_HEADER(readline/readline.h, [readline_h=yes], [readline_h=no], [-])
379AC_CHECK_LIB(readline, readline, [readline_lib=yes], [readline_lib=no], "-ltermcap")
380if test "$readline_h" = no -o "$readline_lib" = no; then
381 if test "$READLINE" = "-lreadline -ltermcap"; then
382 AC_MSG_ERROR(You need to install the GNU readline library or configure without --enable-readline)
383 fi
384fi
385
386dnl
387dnl Check for rl_completion_matches
388dnl
389AC_CHECK_LIB(readline, rl_completion_matches, [rlcm=yes], [rlcm=no], "-ltermcap")
390if test "$rlcm" = yes; then
391 AC_DEFINE(HAVE_READLINE_RLCM)
392fi
393
394dnl
395dnl Check for rl_completion_append_character
396dnl
397AC_CHECK_LIB(readline, rl_completion_append_character, [rcac=yes], [rcac=no], "-ltermcap")
398if test "$rcac" = yes; then
399 AC_DEFINE(HAVE_READLINE_CAC)
400fi
401
402dnl
403dnl Check for zlib headers and libraries
404dnl
405AC_CHECK_HEADER(zlib.h, [zlib_h=yes], [zlib_h=no], [-])
406AC_CHECK_LIB(z, compress2, [zlib_lib=yes], [zlib_lib=no])
407if test "$zlib_h" = yes -a "$zlib_lib" = yes; then
408 ZLIB="-lz"
409 AC_DEFINE(HAVE_ZLIB)
410else
411 ZLIB=""
412fi
413AC_SUBST(ZLIB)
414
415dnl
416dnl Check for bzlib headers and libraries
417dnl
418AC_CHECK_HEADER(bzlib.h, [bzlib_h=yes], [bzlib_h=no], [-])
419AC_CHECK_LIB(bz2, BZ2_bzBuffToBuffCompress, [bzlib_lib=yes], [bzlib_lib=no])
420if test "$bzlib_h" = yes -a "$bzlib_lib" = yes; then
421 BZLIB="-lbz2"
422 AC_DEFINE(HAVE_BZLIB)
423else
424 BZLIB=""
425fi
426AC_SUBST(BZLIB)
427
428dnl
429dnl Check for library functions
430dnl
431AC_CHECK_FUNCS(err errx verr verrx vwarn vwarnx warn warnx realpath lchown)
432AC_CHECK_FUNC(glob)
433
434dnl
435dnl Check for GLOB_ALTDIRFUNC
436dnl
437AC_MSG_CHECKING(for extended glob routines)
438if test "$ac_cv_func_glob" = "yes"; then
439 AC_EGREP_CPP(yes,
440 [
441# include <glob.h>
442# ifdef GLOB_ALTDIRFUNC
443 yes
444# endif
445 ],
446 [
447 AC_DEFINE(HAVE_GLOB)
448 AC_MSG_RESULT(yes)
449 ],
450 [
451 AC_MSG_RESULT(no)
452 echo "Your system does not support extended glob, will use the internal routines"
453 ])
454fi
455
456dnl
457dnl Check for types
458dnl
459AC_CHECK_TYPE(quad_t, int64_t)
460AC_CHECK_TYPE(u_quad_t, uint64_t)
461
462dnl
463dnl Compute top_buildir
464dnl
465top_builddir=`cd .; pwd`
466AC_SUBST(top_builddir)
467
468dnl
469dnl Create directories
470dnl
471test -d compat || mkdir compat
472test -d compat/lib || mkdir compat/lib
473
474dnl
475dnl Output files
476dnl
477AC_OUTPUT(MCONFIG Makefile common/Makefile compat/include/Makefile compat/lib/Makefile dump/Makefile restore/Makefile $RMTMAKEFILE)