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