]> git.wh0rd.org - dump.git/blame - configure.in
Security fixes from Antonomasia.
[dump.git] / configure.in
CommitLineData
1227625a
SP
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
1227625a
SP
22dnl
23dnl Handle --enable-debug
24dnl
25AC_ARG_ENABLE([debug],
1daf06b9 26[ --enable-debug include debugging code (default is NO)],
1227625a
SP
27if test "$enableval" = "no"
28then
29 DUMPDEBUG=""
30 RESTOREDEBUG=""
1daf06b9 31 echo "Not including debugging code"
1227625a
SP
32else
33 DUMPDEBUG="-DFDEBUG -DTDEBUG -DWRITEDEBUG -DDIRDEBUG"
34 RESTOREDEBUG="-DDIRDEBUG"
1daf06b9 35 echo "Including debugging code"
1227625a
SP
36fi,
37DUMPDEBUG=""
38RESTOREDEBUG=""
1daf06b9 39echo "Not including debugging code by default"
1227625a
SP
40)
41AC_SUBST(DUMPDEBUG)
42AC_SUBST(RESTOREDEBUG)
43
44dnl
45dnl Handle --enable-static
46dnl
47AC_ARG_ENABLE([static],
1daf06b9 48[ --enable-static link dump and restore statically (default is NO)],
1227625a
SP
49if test "$enableval" = "no"
50then
51 STATIC=""
1daf06b9 52 echo "Linking dump and restore dynamically"
1227625a
SP
53else
54 STATIC="-static"
1daf06b9 55 echo "Linking dump and restore statically"
1227625a
SP
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],
1daf06b9 67[ --enable-rmt compile and install rmt (default is YES)],
1227625a
SP
68if test "$enableval" = "no"
69then
70 RMTDIR=""
71 RMTMAKEFILE=""
1daf06b9 72 echo "Not compiling rmt"
1227625a
SP
73else
74 RMTDIR="rmt"
75 RMTMAKEFILE="rmt/Makefile"
1daf06b9 76 echo "Compiling rmt"
1227625a
SP
77fi
78,
1daf06b9
SP
79RMTDIR="rmt"
80RMTMAKEFILE="rmt/Makefile"
81echo "Compiling rmt by default"
1227625a
SP
82)
83AC_SUBST(RMTDIR)
84
2ed89fda
SP
85dnl
86dnl Handle --enable-kerberos
87dnl
88AC_ARG_ENABLE([kerberos],
1daf06b9 89[ --enable-kerberos compile kerberos extensions (default is NO)],
2ed89fda
SP
90if test "$enableval" = "yes"
91then
92 OPTDEFS="-DKERBEROS"
1daf06b9 93 echo "Compiling kerberos extensions"
2ed89fda
SP
94else
95 OPTDEFS=""
1daf06b9 96 echo "Not compiling kerberos extensions"
2ed89fda
SP
97fi
98,
99OPTDEFS=""
100echo "Not compiling kerberos extensions by default"
101)
102AC_SUBST(OPTDEFS)
103
c38e5b6a
SP
104dnl
105dnl Handle --enable-readline
106dnl
107AC_ARG_ENABLE([readline],
1daf06b9 108[ --enable-readline enable readline support in restore (default is YES)],
c38e5b6a
SP
109if test "$enableval" = "no"
110then
111 READLINE=""
1daf06b9 112 echo "Not including readline support"
c38e5b6a 113else
5e04cc92 114 READLINE="-lreadline -ltermcap"
c38e5b6a 115 AC_DEFINE(HAVE_READLINE)
1daf06b9 116 echo "Including readline support"
c38e5b6a
SP
117fi
118,
1daf06b9
SP
119READLINE="-lreadline -ltermcap"
120AC_DEFINE(HAVE_READLINE)
121echo "Including readline support by default"
c38e5b6a
SP
122)
123AC_SUBST(READLINE)
124
d8574d45
SP
125dnl
126dnl Handle --enable-oldsylefscript
127dnl
128AC_ARG_ENABLE([oldstylefscript],
1daf06b9 129[ --enable-oldstylefscript enable old style F script (no arguments) (default is NO)],
d8574d45
SP
130if test "$enableval" = "yes"
131then
132 AC_DEFINE(OLD_STYLE_FSCRIPT)
1daf06b9
SP
133 echo "Using old style F script"
134else
135 echo "Using new style F script"
d8574d45
SP
136fi
137,
1daf06b9 138echo "Using new style F script by default"
d8574d45
SP
139)
140
d6967896
SP
141dnl
142dnl Handle --enable-largefile
143dnl
144AC_ARG_ENABLE([largefile],
1daf06b9 145[ --enable-largefile enable Large File System support (default is YES)],
d6967896
SP
146if test "$enableval" = "yes"
147then
95c74f38 148 AC_DEFINE(USE_LFS)
1daf06b9
SP
149 echo "Enabling Large File System support"
150else
151 echo "Not enabling Large File System support"
d6967896
SP
152fi
153,
1daf06b9
SP
154AC_DEFINE(USE_LFS)
155echo "Enabling Large File System support by default"
d6967896
SP
156)
157
35b24fb7
SP
158dnl
159dnl Handle --enable-qfa
160dnl
161AC_ARG_ENABLE([qfa],
1daf06b9 162[ --enable-qfa enable Quick File Access support (default is YES)],
35b24fb7
SP
163if test "$enableval" = "yes"
164then
165 AC_DEFINE(USE_QFA)
1daf06b9
SP
166 echo "Enabling Quick File Access support"
167else
168 echo "Not enabling Quick File Access support"
35b24fb7
SP
169fi
170,
1daf06b9
SP
171AC_DEFINE(USE_QFA)
172echo "Enabling Quick File Access support by default"
35b24fb7
SP
173)
174
175dnl
176dnl Handle --enable-qfadebug
177dnl
178AC_ARG_ENABLE([qfadebug],
1daf06b9 179[ --enable-qfadebug include Quick File Access debugging code (default is NO)],
35b24fb7
SP
180if test "$enableval" = "yes"
181then
182 AC_DEFINE(DEBUG_QFA)
1daf06b9
SP
183 echo "Including Quick File Access debugging code"
184else
185 echo "Not including Quick File Access debugging code"
35b24fb7
SP
186fi
187,
1daf06b9 188echo "Not including Quick File Access debugging code by default"
35b24fb7
SP
189)
190
1227625a
SP
191dnl
192dnl set $(CC) from --with-cc=value
193dnl
194AC_ARG_WITH([cc],
d8574d45 195[ --with-cc=COMPILER select compiler to use],
1227625a
SP
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],
d8574d45 207[ --with-linker=LINKER select linker to use],
1227625a
SP
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],
d8574d45 219[ --with-ccopts=CCOPTS select compiler command line options],
1227625a
SP
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],
d8574d45 230[ --with-ldopts=LDOPTS select linker command line options],
1227625a 231AC_MSG_RESULT(LDFLAGS is $withval)
e95b2aff
SP
232LDOPTS=$withval
233LDFLAGS="$LDFLAGS $withval",
234LDOPTS=)dnl
235AC_SUBST(LDOPTS)
1227625a
SP
236
237dnl
238dnl set $(BINOWNER) from --with-binowner
239dnl
240AC_ARG_WITH([binowner],
d8574d45 241[ --with-binowner=USER select owner for binaries],
1227625a
SP
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],
d8574d45 253[ --with-bingrp=GROUP select group for binaries],
1227625a
SP
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],
d8574d45 265[ --with-binmode=MODE select mode for binaries],
1227625a
SP
266AC_MSG_RESULT(BINMODE is $withval)
267BINMODE=$withval,
882090d1 268BINMODE=0755
1227625a
SP
269echo "BINMODE defaults to $BINMODE"
270)dnl
271AC_SUBST(BINMODE)
272
273dnl
274dnl set $(MANOWNER) from --with-manowner
275dnl
276AC_ARG_WITH([manowner],
d8574d45 277[ --with-manowner=USER select owner for manual pages],
1227625a
SP
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],
d8574d45 289[ --with-mangrp=GROUP select group for manual pages],
1227625a
SP
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],
d8574d45 301[ --with-manmode=MODE select mode for manual pages],
1227625a
SP
302AC_MSG_RESULT(MANMODE is $withval)
303MANMODE=$withval,
882090d1 304MANMODE=0644
1227625a
SP
305echo "MANMODE defaults to $MANMODE"
306)dnl
307AC_SUBST(MANMODE)
308
8d4197bb
SP
309dnl
310dnl set $(DUMPDATESPATH) from --with-dumpdatespath
311dnl
312AC_ARG_WITH([dumpdatespath],
d8574d45 313[ --with-dumpdatespath=PATH select path for dumpdates file],
8d4197bb
SP
314AC_MSG_RESULT(DUMPDATESPATH is $withval)
315DUMPDATESPATH=$withval,
60d46c35 316DUMPDATESPATH="${sysconfdir}/dumpdates"
8d4197bb
SP
317echo "DUMPDATESPATH defaults to $DUMPDATESPATH"
318)dnl
319AC_SUBST(DUMPDATESPATH)
320
1227625a
SP
321dnl
322dnl Check for Ext2fs headers and libraries
323dnl
d3e542e7 324AC_CHECK_HEADER(ext2fs/ext2fs.h, [ext2fs_h=yes], [ext2fs_h=no], [-])
1227625a
SP
325AC_CHECK_LIB(ext2fs, ext2fs_open, [ext2fs_lib=yes], [ext2fs_lib=no], [-lcom_err])
326if test "$ext2fs_h" = no -o "$ext2fs_lib" = no; then
d3393043 327 AC_MSG_ERROR(You need to install the Ext2fs libraries from the E2fsprogs distribution first - hint: make install-libs)
1227625a
SP
328fi
329
e4a8bde4
SP
330dnl
331dnl Try to use ext2_fs.h header from libext2fs instead of from the kernel
332dnl
d3e542e7 333AC_CHECK_HEADERS(ext2fs/ext2_fs.h, [], [], [-])
e4a8bde4 334
a4f547cd
SP
335dnl
336dnl Check for ext2_ino_t type
337dnl
7422942f 338AC_MSG_CHECKING(for ext2_ino_t type in libext2fs headers)
a4f547cd 339AC_TRY_COMPILE([#include <stdio.h>
e4a8bde4
SP
340#ifdef HAVE_EXT2FS_EXT2_FS_H
341#include <ext2fs/ext2_fs.h>
342#else
a4f547cd 343#include <linux/ext2_fs.h>
e4a8bde4
SP
344#endif
345#include <ext2fs/ext2fs.h>],
a4f547cd 346[ext2_ino_t ino = 0;],
7422942f 347[AC_DEFINE(HAVE_EXT2_INO_T) AC_MSG_RESULT(yes)],
a4f547cd
SP
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>
e4a8bde4
SP
355#ifdef HAVE_EXT2FS_EXT2_FS_H
356#include <ext2fs/ext2_fs.h>
357#else
a4f547cd 358#include <linux/ext2_fs.h>
e4a8bde4 359#endif
a4f547cd
SP
360#include <ext2fs/ext2fs.h>],
361[struct ext2_super_block es; es.s_journal_inum = 0;],
7422942f 362[AC_DEFINE(HAVE_EXT2_JOURNAL_INUM) AC_MSG_RESULT(yes)],
a4f547cd
SP
363AC_MSG_RESULT(no))
364
3e815572
SP
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
e68dc63e 371 AC_MSG_ERROR(You need to install the GNU termcap library or configure without --enable-readline)
3e815572
SP
372 fi
373fi
374
c38e5b6a
SP
375dnl
376dnl Check for readline headers and libraries
377dnl
d3e542e7 378AC_CHECK_HEADER(readline/readline.h, [readline_h=yes], [readline_h=no], [-])
3e815572 379AC_CHECK_LIB(readline, readline, [readline_lib=yes], [readline_lib=no], "-ltermcap")
c38e5b6a 380if test "$readline_h" = no -o "$readline_lib" = no; then
3e815572 381 if test "$READLINE" = "-lreadline -ltermcap"; then
e68dc63e 382 AC_MSG_ERROR(You need to install the GNU readline library or configure without --enable-readline)
c38e5b6a
SP
383 fi
384fi
385
bcecd677
SP
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
4d5ed2f3
SP
402dnl
403dnl Check for zlib headers and libraries
404dnl
d3e542e7 405AC_CHECK_HEADER(zlib.h, [zlib_h=yes], [zlib_h=no], [-])
4d5ed2f3
SP
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
88ef261e
SP
415dnl
416dnl Check for bzlib headers and libraries
417dnl
d3e542e7 418AC_CHECK_HEADER(bzlib.h, [bzlib_h=yes], [bzlib_h=no], [-])
88ef261e
SP
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
1227625a
SP
428dnl
429dnl Check for library functions
430dnl
5c1faba5
SP
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
a4f547cd 437AC_MSG_CHECKING(for extended glob routines)
5c1faba5
SP
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
a4f547cd
SP
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 ])
5c1faba5 454fi
1227625a
SP
455
456dnl
457dnl Check for types
458dnl
1a886de8
SP
459AC_CHECK_TYPE(quad_t, int64_t)
460AC_CHECK_TYPE(u_quad_t, uint64_t)
1227625a
SP
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
8d4197bb 477AC_OUTPUT(MCONFIG Makefile common/Makefile compat/include/Makefile compat/lib/Makefile dump/Makefile restore/Makefile $RMTMAKEFILE)