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