]> git.wh0rd.org - dump.git/blob - configure.in
Fixed the configure scripts to only check not build headers
[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-kerberos
87 dnl
88 AC_ARG_ENABLE([kerberos],
89 [ --enable-kerberos compile kerberos extensions (default is NO)],
90 if test "$enableval" = "yes"
91 then
92 OPTDEFS="-DKERBEROS"
93 echo "Compiling kerberos extensions"
94 else
95 OPTDEFS=""
96 echo "Not compiling kerberos extensions"
97 fi
98 ,
99 OPTDEFS=""
100 echo "Not compiling kerberos extensions by default"
101 )
102 AC_SUBST(OPTDEFS)
103
104 dnl
105 dnl Handle --enable-readline
106 dnl
107 AC_ARG_ENABLE([readline],
108 [ --enable-readline enable readline support in restore (default is YES)],
109 if test "$enableval" = "no"
110 then
111 READLINE=""
112 echo "Not including readline support"
113 else
114 READLINE="-lreadline -ltermcap"
115 AC_DEFINE(HAVE_READLINE)
116 echo "Including readline support"
117 fi
118 ,
119 READLINE="-lreadline -ltermcap"
120 AC_DEFINE(HAVE_READLINE)
121 echo "Including readline support by default"
122 )
123 AC_SUBST(READLINE)
124
125 dnl
126 dnl Handle --enable-oldsylefscript
127 dnl
128 AC_ARG_ENABLE([oldstylefscript],
129 [ --enable-oldstylefscript enable old style F script (no arguments) (default is NO)],
130 if test "$enableval" = "yes"
131 then
132 AC_DEFINE(OLD_STYLE_FSCRIPT)
133 echo "Using old style F script"
134 else
135 echo "Using new style F script"
136 fi
137 ,
138 echo "Using new style F script by default"
139 )
140
141 dnl
142 dnl Handle --enable-largefile
143 dnl
144 AC_ARG_ENABLE([largefile],
145 [ --enable-largefile enable Large File System support (default is YES)],
146 if test "$enableval" = "yes"
147 then
148 AC_DEFINE(USE_LFS)
149 echo "Enabling Large File System support"
150 else
151 echo "Not enabling Large File System support"
152 fi
153 ,
154 AC_DEFINE(USE_LFS)
155 echo "Enabling Large File System support by default"
156 )
157
158 dnl
159 dnl Handle --enable-qfa
160 dnl
161 AC_ARG_ENABLE([qfa],
162 [ --enable-qfa enable Quick File Access support (default is YES)],
163 if test "$enableval" = "yes"
164 then
165 AC_DEFINE(USE_QFA)
166 echo "Enabling Quick File Access support"
167 else
168 echo "Not enabling Quick File Access support"
169 fi
170 ,
171 AC_DEFINE(USE_QFA)
172 echo "Enabling Quick File Access support by default"
173 )
174
175 dnl
176 dnl Handle --enable-qfadebug
177 dnl
178 AC_ARG_ENABLE([qfadebug],
179 [ --enable-qfadebug include Quick File Access debugging code (default is NO)],
180 if test "$enableval" = "yes"
181 then
182 AC_DEFINE(DEBUG_QFA)
183 echo "Including Quick File Access debugging code"
184 else
185 echo "Not including Quick File Access debugging code"
186 fi
187 ,
188 echo "Not including Quick File Access debugging code by default"
189 )
190
191 dnl
192 dnl set $(CC) from --with-cc=value
193 dnl
194 AC_ARG_WITH([cc],
195 [ --with-cc=COMPILER select compiler to use],
196 AC_MSG_RESULT(CC=$withval)
197 CC=$withval,
198 if test -z "$CC" ; then CC=cc; fi
199 [AC_MSG_RESULT(CC defaults to $CC)])dnl
200 export CC
201 AC_SUBST([CC])
202
203 dnl
204 dnl set $(LD) from --with-linker=value
205 dnl
206 AC_ARG_WITH([linker],
207 [ --with-linker=LINKER select linker to use],
208 AC_MSG_RESULT(LD=$withval)
209 LD=$withval,
210 if test -z "$LD" ; then LD=$CC; fi
211 [AC_MSG_RESULT(LD defaults to $LD)])dnl
212 export LD
213 AC_SUBST([LD])
214
215 dnl
216 dnl set $(CCOPTS) from --with-ccopts=value
217 dnl
218 AC_ARG_WITH([ccopts],
219 [ --with-ccopts=CCOPTS select compiler command line options],
220 AC_MSG_RESULT(CCOPTS is $withval)
221 CCOPTS=$withval
222 CFLAGS="$CFLAGS $withval",
223 CCOPTS=)dnl
224 AC_SUBST(CCOPTS)
225
226 dnl
227 dnl set $(LDFLAGS) from --with-ldopts=value
228 dnl
229 AC_ARG_WITH([ldopts],
230 [ --with-ldopts=LDOPTS select linker command line options],
231 AC_MSG_RESULT(LDFLAGS is $withval)
232 LDOPTS=$withval
233 LDFLAGS="$LDFLAGS $withval",
234 LDOPTS=)dnl
235 AC_SUBST(LDOPTS)
236
237 dnl
238 dnl set $(BINOWNER) from --with-binowner
239 dnl
240 AC_ARG_WITH([binowner],
241 [ --with-binowner=USER select owner for binaries],
242 AC_MSG_RESULT(BINOWNER is $withval)
243 BINOWNER=$withval,
244 BINOWNER=root
245 echo "BINOWNER defaults to $BINOWNER"
246 )dnl
247 AC_SUBST(BINOWNER)
248
249 dnl
250 dnl set $(BINGRP) from --with-bingrp
251 dnl
252 AC_ARG_WITH([bingrp],
253 [ --with-bingrp=GROUP select group for binaries],
254 AC_MSG_RESULT(BINGRP is $withval)
255 BINGRP=$withval,
256 BINGRP=tty
257 echo "BINGRP defaults to $BINGRP"
258 )dnl
259 AC_SUBST(BINGRP)
260
261 dnl
262 dnl set $(BINMODE) from --with-binmode
263 dnl
264 AC_ARG_WITH([binmode],
265 [ --with-binmode=MODE select mode for binaries],
266 AC_MSG_RESULT(BINMODE is $withval)
267 BINMODE=$withval,
268 BINMODE=0755
269 echo "BINMODE defaults to $BINMODE"
270 )dnl
271 AC_SUBST(BINMODE)
272
273 dnl
274 dnl set $(MANOWNER) from --with-manowner
275 dnl
276 AC_ARG_WITH([manowner],
277 [ --with-manowner=USER select owner for manual pages],
278 AC_MSG_RESULT(MANOWNER is $withval)
279 MANOWNER=$withval,
280 MANOWNER=man
281 echo "MANOWNER defaults to $MANOWNER"
282 )dnl
283 AC_SUBST(MANOWNER)
284
285 dnl
286 dnl set $(MANGRP) from --with-mangrp
287 dnl
288 AC_ARG_WITH([mangrp],
289 [ --with-mangrp=GROUP select group for manual pages],
290 AC_MSG_RESULT(MANGRP is $withval)
291 MANGRP=$withval,
292 MANGRP=tty
293 echo "MANGRP defaults to $MANGRP"
294 )dnl
295 AC_SUBST(MANGRP)
296
297 dnl
298 dnl set $(MANMODE) from --with-manmode
299 dnl
300 AC_ARG_WITH([manmode],
301 [ --with-manmode=MODE select mode for manual pages],
302 AC_MSG_RESULT(MANMODE is $withval)
303 MANMODE=$withval,
304 MANMODE=0644
305 echo "MANMODE defaults to $MANMODE"
306 )dnl
307 AC_SUBST(MANMODE)
308
309 dnl
310 dnl set $(DUMPDATESPATH) from --with-dumpdatespath
311 dnl
312 AC_ARG_WITH([dumpdatespath],
313 [ --with-dumpdatespath=PATH select path for dumpdates file],
314 AC_MSG_RESULT(DUMPDATESPATH is $withval)
315 DUMPDATESPATH=$withval,
316 DUMPDATESPATH="${sysconfdir}/dumpdates"
317 echo "DUMPDATESPATH defaults to $DUMPDATESPATH"
318 )dnl
319 AC_SUBST(DUMPDATESPATH)
320
321 dnl
322 dnl Check for Ext2fs headers and libraries
323 dnl
324 AC_CHECK_HEADER(ext2fs/ext2fs.h, [ext2fs_h=yes], [ext2fs_h=no], [-])
325 AC_CHECK_LIB(ext2fs, ext2fs_open, [ext2fs_lib=yes], [ext2fs_lib=no], [-lcom_err])
326 if test "$ext2fs_h" = no -o "$ext2fs_lib" = no; then
327 AC_MSG_ERROR(You need to install the Ext2fs libraries from the E2fsprogs distribution first - hint: make install-libs)
328 fi
329
330 dnl
331 dnl Try to use ext2_fs.h header from libext2fs instead of from the kernel
332 dnl
333 AC_CHECK_HEADERS(ext2fs/ext2_fs.h, [], [], [-])
334
335 dnl
336 dnl Check for ext2_ino_t type
337 dnl
338 AC_MSG_CHECKING(for ext2_ino_t type in libext2fs headers)
339 AC_TRY_COMPILE([#include <stdio.h>
340 #ifdef HAVE_EXT2FS_EXT2_FS_H
341 #include <ext2fs/ext2_fs.h>
342 #else
343 #include <linux/ext2_fs.h>
344 #endif
345 #include <ext2fs/ext2fs.h>],
346 [ext2_ino_t ino = 0;],
347 [AC_DEFINE(HAVE_EXT2_INO_T) AC_MSG_RESULT(yes)],
348 AC_MSG_RESULT(no))
349
350 dnl
351 dnl Check for s_journal_inum field in ext2_super_block struct
352 dnl
353 AC_MSG_CHECKING(for s_journal_inum field in ext2_super_block struct)
354 AC_TRY_COMPILE([#include <stdio.h>
355 #ifdef HAVE_EXT2FS_EXT2_FS_H
356 #include <ext2fs/ext2_fs.h>
357 #else
358 #include <linux/ext2_fs.h>
359 #endif
360 #include <ext2fs/ext2fs.h>],
361 [struct ext2_super_block es; es.s_journal_inum = 0;],
362 [AC_DEFINE(HAVE_EXT2_JOURNAL_INUM) AC_MSG_RESULT(yes)],
363 AC_MSG_RESULT(no))
364
365 dnl
366 dnl Check for termcap libraries
367 dnl
368 AC_CHECK_LIB(termcap, tgetent, [termcap_lib=yes], [termcap_lib=no])
369 if test "$termcap_lib" = no; then
370 if test "$READLINE" = "-lreadline -ltermcap"; then
371 AC_MSG_ERROR(You need to install the GNU termcap library or configure without --enable-readline)
372 fi
373 fi
374
375 dnl
376 dnl Check for readline headers and libraries
377 dnl
378 AC_CHECK_HEADER(readline/readline.h, [readline_h=yes], [readline_h=no], [-])
379 AC_CHECK_LIB(readline, readline, [readline_lib=yes], [readline_lib=no], "-ltermcap")
380 if test "$readline_h" = no -o "$readline_lib" = no; then
381 if test "$READLINE" = "-lreadline -ltermcap"; then
382 AC_MSG_ERROR(You need to install the GNU readline library or configure without --enable-readline)
383 fi
384 fi
385
386 dnl
387 dnl Check for rl_completion_matches
388 dnl
389 AC_CHECK_LIB(readline, rl_completion_matches, [rlcm=yes], [rlcm=no], "-ltermcap")
390 if test "$rlcm" = yes; then
391 AC_DEFINE(HAVE_READLINE_RLCM)
392 fi
393
394 dnl
395 dnl Check for rl_completion_append_character
396 dnl
397 AC_CHECK_LIB(readline, rl_completion_append_character, [rcac=yes], [rcac=no], "-ltermcap")
398 if test "$rcac" = yes; then
399 AC_DEFINE(HAVE_READLINE_CAC)
400 fi
401
402 dnl
403 dnl Check for zlib headers and libraries
404 dnl
405 AC_CHECK_HEADER(zlib.h, [zlib_h=yes], [zlib_h=no], [-])
406 AC_CHECK_LIB(z, compress2, [zlib_lib=yes], [zlib_lib=no])
407 if test "$zlib_h" = yes -a "$zlib_lib" = yes; then
408 ZLIB="-lz"
409 AC_DEFINE(HAVE_ZLIB)
410 else
411 ZLIB=""
412 fi
413 AC_SUBST(ZLIB)
414
415 dnl
416 dnl Check for bzlib headers and libraries
417 dnl
418 AC_CHECK_HEADER(bzlib.h, [bzlib_h=yes], [bzlib_h=no], [-])
419 AC_CHECK_LIB(bz2, BZ2_bzBuffToBuffCompress, [bzlib_lib=yes], [bzlib_lib=no])
420 if test "$bzlib_h" = yes -a "$bzlib_lib" = yes; then
421 BZLIB="-lbz2"
422 AC_DEFINE(HAVE_BZLIB)
423 else
424 BZLIB=""
425 fi
426 AC_SUBST(BZLIB)
427
428 dnl
429 dnl Check for library functions
430 dnl
431 AC_CHECK_FUNCS(err errx verr verrx vwarn vwarnx warn warnx realpath lchown)
432 AC_CHECK_FUNC(glob)
433
434 dnl
435 dnl Check for GLOB_ALTDIRFUNC
436 dnl
437 AC_MSG_CHECKING(for extended glob routines)
438 if 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
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 ])
454 fi
455
456 dnl
457 dnl Check for types
458 dnl
459 AC_CHECK_TYPE(quad_t, int64_t)
460 AC_CHECK_TYPE(u_quad_t, uint64_t)
461
462 dnl
463 dnl Compute top_buildir
464 dnl
465 top_builddir=`cd .; pwd`
466 AC_SUBST(top_builddir)
467
468 dnl
469 dnl Create directories
470 dnl
471 test -d compat || mkdir compat
472 test -d compat/lib || mkdir compat/lib
473
474 dnl
475 dnl Output files
476 dnl
477 AC_OUTPUT(MCONFIG Makefile common/Makefile compat/include/Makefile compat/lib/Makefile dump/Makefile restore/Makefile $RMTMAKEFILE)