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