Prepare for release 0.4b37
[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-staticz
70 dnl
71 AC_ARG_ENABLE([staticz],
72 [ --enable-staticz link libz and libbz2 statically (default is NO)],
73 if test "$enableval" = "no"
74 then
75 STATICZ="no"
76 echo "Linking libz and libbz2 dynamically"
77 else
78 STATICZ="yes"
79 echo "Linking libz and libbz2 statically"
80 fi
81 ,
82 STATICZ="no"
83 echo "Linking libz and libbz2 dynamically by default"
84 )
85
86 dnl
87 dnl Handle --enable-rmt
88 dnl
89 AC_ARG_ENABLE([rmt],
90 [ --enable-rmt compile and install rmt (default is YES)],
91 if test "$enableval" = "no"
92 then
93 RMTDIR=""
94 RMTMAKEFILE=""
95 echo "Not compiling rmt"
96 else
97 RMTDIR="rmt"
98 RMTMAKEFILE="rmt/Makefile"
99 echo "Compiling rmt"
100 fi
101 ,
102 RMTDIR="rmt"
103 RMTMAKEFILE="rmt/Makefile"
104 echo "Compiling rmt by default"
105 )
106 AC_SUBST(RMTDIR)
107
108 dnl
109 dnl Handle --enable-ermt
110 dnl
111 AC_ARG_ENABLE([ermt],
112 [ --enable-ermt compile ermt, an encrypting version of rmt (default is NO)],
113 if test "$enableval" = "no"
114 then
115 ERMT=""
116 CRYPTO=""
117 echo "Not compiling ermt"
118 else
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"
126 fi
127 ,
128 ERMT=""
129 CRYPTO=""
130 echo "Not compiling ermt by default"
131 )
132 AC_SUBST(ERMT)
133 AC_SUBST(CRYPTO)
134
135 dnl
136 dnl Handle --enable-kerberos
137 dnl
138 AC_ARG_ENABLE([kerberos],
139 [ --enable-kerberos compile kerberos extensions (default is NO)],
140 if test "$enableval" = "yes"
141 then
142 OPTDEFS="-DKERBEROS"
143 echo "Compiling kerberos extensions"
144 else
145 OPTDEFS=""
146 echo "Not compiling kerberos extensions"
147 fi
148 ,
149 OPTDEFS=""
150 echo "Not compiling kerberos extensions by default"
151 )
152 AC_SUBST(OPTDEFS)
153
154 dnl
155 dnl Handle --enable-readline
156 dnl
157 AC_ARG_ENABLE([readline],
158 [ --enable-readline enable readline support in restore (default is YES)],
159 if test "$enableval" = "no"
160 then
161 READLINE=""
162 echo "Not including readline support"
163 else
164 READLINE="-lreadline -ltermcap"
165 AC_DEFINE([HAVE_READLINE],1,[Define if you want to include readline support.])
166 echo "Including readline support"
167 fi
168 ,
169 READLINE="-lreadline -ltermcap"
170 AC_DEFINE([HAVE_READLINE],1,[Define if you want to include readline support.])
171 echo "Including readline support by default"
172 )
173 AC_SUBST(READLINE)
174
175 dnl
176 dnl Handle --enable-oldsylefscript
177 dnl
178 AC_ARG_ENABLE([oldstylefscript],
179 [ --enable-oldstylefscript enable old style F script (no arguments) (default is NO)],
180 if test "$enableval" = "yes"
181 then
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"
184 else
185 echo "Using new style F script"
186 fi
187 ,
188 echo "Using new style F script by default"
189 )
190
191 dnl
192 dnl Handle --enable-largefile
193 dnl
194 AC_ARG_ENABLE([largefile],
195 [ --enable-largefile enable Large File System support (default is YES)],
196 if test "$enableval" = "yes"
197 then
198 AC_DEFINE([USE_LFS],1,[Define this if you want Large File System support.])
199 echo "Enabling Large File System support"
200 else
201 echo "Not enabling Large File System support"
202 fi
203 ,
204 AC_DEFINE([USE_LFS],1,[Define this if you want Large File System support.])
205 echo "Enabling Large File System support by default"
206 )
207
208 dnl
209 dnl Handle --enable-qfa
210 dnl
211 AC_ARG_ENABLE([qfa],
212 [ --enable-qfa enable Quick File Access support (default is YES)],
213 if test "$enableval" = "yes"
214 then
215 AC_DEFINE([USE_QFA],1,[Define this if you want Quick File Access support.])
216 echo "Enabling Quick File Access support"
217 else
218 echo "Not enabling Quick File Access support"
219 fi
220 ,
221 AC_DEFINE([USE_QFA],1,[Define this if you want Quick File Access support.])
222 echo "Enabling Quick File Access support by default"
223 )
224
225 dnl
226 dnl Handle --enable-qfadebug
227 dnl
228 AC_ARG_ENABLE([qfadebug],
229 [ --enable-qfadebug include Quick File Access debugging code (default is NO)],
230 if test "$enableval" = "yes"
231 then
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"
234 else
235 echo "Not including Quick File Access debugging code"
236 fi
237 ,
238 echo "Not including Quick File Access debugging code by default"
239 )
240
241 dnl
242 dnl Handle --enable-macosx
243 dnl
244 AC_ARG_ENABLE([macosx],
245 [ --enable-macosx include Mac OSX restore compatibility (default is NO)],
246 if test "$enableval" = "yes"
247 then
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"
250 else
251 echo "Not including Mac OSX restore compatibility code"
252 fi
253 ,
254 echo "Not including Mac OSX restore compatibility code by default"
255 )
256
257
258 dnl
259 dnl set $(CC) from --with-cc=value
260 dnl
261 AC_ARG_WITH([cc],
262 [ --with-cc=COMPILER select compiler to use],
263 AC_MSG_RESULT(CC=$withval)
264 CC=$withval,
265 if test -z "$CC" ; then CC=cc; fi
266 [AC_MSG_RESULT(CC defaults to $CC)])dnl
267 export CC
268 AC_SUBST([CC])
269
270 dnl
271 dnl set $(LD) from --with-linker=value
272 dnl
273 AC_ARG_WITH([linker],
274 [ --with-linker=LINKER select linker to use],
275 AC_MSG_RESULT(LD=$withval)
276 LD=$withval,
277 if test -z "$LD" ; then LD=$CC; fi
278 [AC_MSG_RESULT(LD defaults to $LD)])dnl
279 export LD
280 AC_SUBST([LD])
281
282 dnl
283 dnl set $(CCOPTS) from --with-ccopts=value
284 dnl
285 AC_ARG_WITH([ccopts],
286 [ --with-ccopts=CCOPTS select compiler command line options],
287 AC_MSG_RESULT(CCOPTS is $withval)
288 CCOPTS=$withval
289 CFLAGS="$CFLAGS $withval",
290 CCOPTS=)dnl
291 AC_SUBST(CCOPTS)
292
293 dnl
294 dnl set $(LDFLAGS) from --with-ldopts=value
295 dnl
296 AC_ARG_WITH([ldopts],
297 [ --with-ldopts=LDOPTS select linker command line options],
298 AC_MSG_RESULT(LDFLAGS is $withval)
299 LDOPTS=$withval
300 LDFLAGS="$LDFLAGS $withval",
301 LDOPTS=)dnl
302 AC_SUBST(LDOPTS)
303
304 dnl
305 dnl set $(BINOWNER) from --with-binowner
306 dnl
307 AC_ARG_WITH([binowner],
308 [ --with-binowner=USER select owner for binaries],
309 AC_MSG_RESULT(BINOWNER is $withval)
310 BINOWNER=$withval,
311 BINOWNER=root
312 echo "BINOWNER defaults to $BINOWNER"
313 )dnl
314 AC_SUBST(BINOWNER)
315
316 dnl
317 dnl set $(BINGRP) from --with-bingrp
318 dnl
319 AC_ARG_WITH([bingrp],
320 [ --with-bingrp=GROUP select group for binaries],
321 AC_MSG_RESULT(BINGRP is $withval)
322 BINGRP=$withval,
323 BINGRP=tty
324 echo "BINGRP defaults to $BINGRP"
325 )dnl
326 AC_SUBST(BINGRP)
327
328 dnl
329 dnl set $(BINMODE) from --with-binmode
330 dnl
331 AC_ARG_WITH([binmode],
332 [ --with-binmode=MODE select mode for binaries],
333 AC_MSG_RESULT(BINMODE is $withval)
334 BINMODE=$withval,
335 BINMODE=0755
336 echo "BINMODE defaults to $BINMODE"
337 )dnl
338 AC_SUBST(BINMODE)
339
340 dnl
341 dnl set $(MANOWNER) from --with-manowner
342 dnl
343 AC_ARG_WITH([manowner],
344 [ --with-manowner=USER select owner for manual pages],
345 AC_MSG_RESULT(MANOWNER is $withval)
346 MANOWNER=$withval,
347 MANOWNER=man
348 echo "MANOWNER defaults to $MANOWNER"
349 )dnl
350 AC_SUBST(MANOWNER)
351
352 dnl
353 dnl set $(MANGRP) from --with-mangrp
354 dnl
355 AC_ARG_WITH([mangrp],
356 [ --with-mangrp=GROUP select group for manual pages],
357 AC_MSG_RESULT(MANGRP is $withval)
358 MANGRP=$withval,
359 MANGRP=tty
360 echo "MANGRP defaults to $MANGRP"
361 )dnl
362 AC_SUBST(MANGRP)
363
364 dnl
365 dnl set $(MANMODE) from --with-manmode
366 dnl
367 AC_ARG_WITH([manmode],
368 [ --with-manmode=MODE select mode for manual pages],
369 AC_MSG_RESULT(MANMODE is $withval)
370 MANMODE=$withval,
371 MANMODE=0644
372 echo "MANMODE defaults to $MANMODE"
373 )dnl
374 AC_SUBST(MANMODE)
375
376 dnl
377 dnl set $(DUMPDATESPATH) from --with-dumpdatespath
378 dnl
379 AC_ARG_WITH([dumpdatespath],
380 [ --with-dumpdatespath=PATH select path for dumpdates file],
381 AC_MSG_RESULT(DUMPDATESPATH is $withval)
382 DUMPDATESPATH=$withval,
383 DUMPDATESPATH="${sysconfdir}/dumpdates"
384 echo "DUMPDATESPATH defaults to $DUMPDATESPATH"
385 )dnl
386 AC_SUBST(DUMPDATESPATH)
387
388 dnl
389 dnl Check for Ext2fs headers and libraries
390 dnl
391 AC_CHECK_HEADER(ext2fs/ext2fs.h, [ext2fs_h=yes], [ext2fs_h=no], [-])
392 AC_CHECK_LIB(ext2fs, ext2fs_open, [ext2fs_lib=yes], [ext2fs_lib=no], [-lcom_err])
393 if 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)
395 fi
396
397 dnl
398 dnl Try to use ext2_fs.h header from libext2fs instead of from the kernel
399 dnl
400 AC_CHECK_HEADERS(ext2fs/ext2_fs.h, [], [], [-])
401
402 dnl
403 dnl Check for ext2_ino_t type
404 dnl
405 AC_MSG_CHECKING(for ext2_ino_t type in libext2fs headers)
406 AC_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)],
416 AC_MSG_RESULT(no))
417
418 dnl
419 dnl Check for s_journal_inum field in ext2_super_block struct
420 dnl
421 AC_MSG_CHECKING(for s_journal_inum field in ext2_super_block struct)
422 AC_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)],
432 AC_MSG_RESULT(no))
433
434 dnl
435 dnl Check for blkid headers libraries
436 dnl
437 AC_CHECK_HEADER(blkid/blkid.h, [blkid_h=yes], [blkid_h=no], [-])
438 AC_CHECK_LIB(blkid, blkid_get_devname, [blkid_lib=yes], [blkid_lib=no], [-luuid])
439 if test "$blkid_h" = yes -a "$blkid_lib" = yes; then
440 AC_DEFINE([HAVE_BLKID],1,[Define this if you have the blkid library.])
441 BLKID="-lblkid -luuid"
442 fi
443 AC_SUBST(BLKID)
444
445 dnl
446 dnl Check for termcap libraries
447 dnl
448 AC_CHECK_LIB(termcap, tgetent, [termcap_lib=yes], [termcap_lib=no])
449 if test "$termcap_lib" = no; then
450 if test "$READLINE" = "-lreadline -ltermcap"; then
451 AC_MSG_ERROR(You need to install the GNU termcap library or configure without --enable-readline)
452 fi
453 fi
454
455 dnl
456 dnl Check for readline headers and libraries
457 dnl
458 AC_CHECK_HEADER(readline/readline.h, [readline_h=yes], [readline_h=no], [-])
459 AC_CHECK_LIB(readline, readline, [readline_lib=yes], [readline_lib=no], "-ltermcap")
460 if test "$readline_h" = no -o "$readline_lib" = no; then
461 if test "$READLINE" = "-lreadline -ltermcap"; then
462 AC_MSG_ERROR(You need to install the GNU readline library or configure without --enable-readline)
463 fi
464 fi
465
466 dnl
467 dnl Check for rl_completion_matches
468 dnl
469 AC_CHECK_LIB(readline, rl_completion_matches, [rlcm=yes], [rlcm=no], "-ltermcap")
470 if test "$rlcm" = yes; then
471 AC_DEFINE([HAVE_READLINE_RLCM],1,[Define this if your readline libs have the rl_completion_matches library.])
472 fi
473
474 dnl
475 dnl Check for rl_completion_append_character
476 dnl
477 AC_CHECK_LIB(readline, rl_completion_append_character, [rcac=yes], [rcac=no], "-ltermcap")
478 if test "$rcac" = yes; then
479 AC_DEFINE([HAVE_READLINE_CAC],1,[Define this if your readline libs have the rl_completion_append_character variable.])
480 fi
481
482 dnl
483 dnl Check for zlib headers and libraries
484 dnl
485 AC_CHECK_HEADER(zlib.h, [zlib_h=yes], [zlib_h=no], [-])
486 AC_CHECK_LIB(z, compress2, [zlib_lib=yes], [zlib_lib=no])
487 if test "$zlib_h" = yes -a "$zlib_lib" = yes; then
488 if test "$STATICZ" = yes; then
489 ZLIB="-Wl,-Bstatic -lz -Wl,-Bdynamic"
490 else
491 ZLIB="-lz"
492 fi
493 AC_DEFINE([HAVE_ZLIB],1,[Define this if you have zlib compression library.])
494 else
495 ZLIB=""
496 fi
497 AC_SUBST(ZLIB)
498
499 dnl
500 dnl Check for bzlib headers and libraries
501 dnl
502 AC_CHECK_HEADER(bzlib.h, [bzlib_h=yes], [bzlib_h=no], [-])
503 AC_CHECK_LIB(bz2, BZ2_bzBuffToBuffCompress, [bzlib_lib=yes], [bzlib_lib=no])
504 if test "$bzlib_h" = yes -a "$bzlib_lib" = yes; then
505 if test "$STATICZ" = yes; then
506 BZLIB="-Wl,-Bstatic -lbz2 -Wl,-Bdynamic"
507 else
508 BZLIB="-lbz2"
509 fi
510 AC_DEFINE([HAVE_BZLIB],1,[Define this if you have bzlib compression library.])
511 else
512 BZLIB=""
513 fi
514 AC_SUBST(BZLIB)
515
516 dnl
517 dnl Check for library functions
518 dnl
519 AC_CHECK_FUNCS(err errx verr verrx vwarn vwarnx warn warnx realpath lchown)
520 AC_CHECK_FUNC(glob)
521
522 dnl
523 dnl Check for GLOB_ALTDIRFUNC
524 dnl
525 AC_MSG_CHECKING(for extended glob routines)
526 if test "$ac_cv_func_glob" = "yes"; then
527 AC_EGREP_CPP(yes,
528 [
529 # include <glob.h>
530 # ifdef GLOB_ALTDIRFUNC
531 yes
532 # endif
533 ],
534 [
535 AC_DEFINE([HAVE_GLOB],1,[Define if you have the glob function.])
536 AC_MSG_RESULT(yes)
537 ],
538 [
539 AC_MSG_RESULT(no)
540 echo "Your system does not support extended glob, will use the internal routines"
541 ])
542 fi
543
544 dnl
545 dnl Check for OpenSSL, for ermt
546 dnl
547 if test "$ERMT" != ""; then
548 AC_CHECK_HEADER(openssl/evp.h, [evp_h=yes], [evp_h=no])
549 AC_CHECK_LIB(crypto, EVP_CIPHER_CTX_set_padding, [crypto_lib=yes], [crypto_lib=no])
550 if test "$evp_h" = no -o "$crypto_lib" = no; then
551 AC_MSG_ERROR(You need to install the OpenSSL library (version 0.9.7a or later), or configure without --enable-ermt)
552 fi
553 fi
554
555 dnl
556 dnl Check for types
557 dnl
558 AC_CHECK_TYPE(quad_t, int64_t)
559 AC_CHECK_TYPE(u_quad_t, uint64_t)
560
561 dnl
562 dnl Compute top_buildir
563 dnl
564 top_builddir=`cd .; pwd`
565 AC_SUBST(top_builddir)
566
567 dnl
568 dnl Create directories
569 dnl
570 test -d compat || mkdir compat
571 test -d compat/lib || mkdir compat/lib
572
573 dnl
574 dnl Output files
575 dnl
576 AC_OUTPUT(MCONFIG Makefile common/Makefile compat/include/Makefile compat/lib/Makefile dump/Makefile restore/Makefile $RMTMAKEFILE)