]> git.wh0rd.org - dump.git/blob - configure.in
Bug in getvol() when making a wrong answer to the 'Mount next volume' prompt.
[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],
27 if test "$enableval" = "no"
28 then
29 DUMPDEBUG=""
30 RESTOREDEBUG=""
31 else
32 DUMPDEBUG="-DFDEBUG -DTDEBUG -DWRITEDEBUG -DDIRDEBUG"
33 RESTOREDEBUG="-DDIRDEBUG"
34 fi,
35 DUMPDEBUG=""
36 RESTOREDEBUG=""
37 )
38 AC_SUBST(DUMPDEBUG)
39 AC_SUBST(RESTOREDEBUG)
40
41 dnl
42 dnl Handle --enable-static
43 dnl
44 AC_ARG_ENABLE([static],
45 [ --enable-static link dump and restore statically],
46 if test "$enableval" = "no"
47 then
48 STATIC=""
49 else
50 STATIC="-static"
51 fi
52 ,
53 STATIC=""
54 echo "Linking dump and restore dynamically by default"
55 )
56 AC_SUBST(STATIC)
57
58 dnl
59 dnl Handle --enable-rmt
60 dnl
61 AC_ARG_ENABLE([rmt],
62 [ --enable-rmt compile and install rmt],
63 if test "$enableval" = "no"
64 then
65 RMTDIR=""
66 RMTMAKEFILE=""
67 else
68 RMTDIR="rmt"
69 RMTMAKEFILE="rmt/Makefile"
70 fi
71 ,
72 RMTDIR=""
73 echo "Not compiling rmt by default"
74 )
75 AC_SUBST(RMTDIR)
76
77 dnl
78 dnl Handle --enable-kerberos
79 dnl
80 AC_ARG_ENABLE([kerberos],
81 [ --enable-kerberos compile kerberos extensions],
82 if test "$enableval" = "yes"
83 then
84 OPTDEFS="-DKERBEROS"
85 else
86 OPTDEFS=""
87 fi
88 ,
89 OPTDEFS=""
90 echo "Not compiling kerberos extensions by default"
91 )
92 AC_SUBST(OPTDEFS)
93
94 dnl
95 dnl Handle --enable-readline
96 dnl
97 AC_ARG_ENABLE([readline],
98 [ --enable-readline enable readline support in restore],
99 if test "$enableval" = "no"
100 then
101 READLINE=""
102 else
103 READLINE="-lreadline -ltermcap"
104 AC_DEFINE(HAVE_READLINE)
105 fi
106 ,
107 READLINE=""
108 echo "Not including readline support by default"
109 )
110 AC_SUBST(READLINE)
111
112 dnl
113 dnl Handle --enable-oldsylefscript
114 dnl
115 AC_ARG_ENABLE([oldstylefscript],
116 [ --enable-oldstylefscript enable old style F script (no arguments)],
117 if test "$enableval" = "yes"
118 then
119 AC_DEFINE(OLD_STYLE_FSCRIPT)
120 fi
121 ,
122 echo "Using new style F script"
123 )
124
125 dnl
126 dnl Handle --enable-largefile
127 dnl
128 AC_ARG_ENABLE([largefile],
129 [ --enable-largefile enable Large File System support (your glibc needs to support it)],
130 if test "$enableval" = "yes"
131 then
132 AC_DEFINE(USE_LFS)
133 fi
134 ,
135 echo "Not enabling Large File System support"
136 )
137
138 dnl
139 dnl Handle --enable-qfa
140 dnl
141 AC_ARG_ENABLE([qfa],
142 [ --enable-qfa enable Quick File Access support],
143 if test "$enableval" = "yes"
144 then
145 AC_DEFINE(USE_QFA)
146 fi
147 ,
148 echo "Not enabling Quick File Access support"
149 )
150
151 dnl
152 dnl Handle --enable-qfadebug
153 dnl
154 AC_ARG_ENABLE([qfadebug],
155 [ --enable-qfadebug include Quick File Access debugging code],
156 if test "$enableval" = "yes"
157 then
158 AC_DEFINE(DEBUG_QFA)
159 fi
160 ,
161 echo "Not including Quick File Access debugging code"
162 )
163
164 dnl
165 dnl set $(CC) from --with-cc=value
166 dnl
167 AC_ARG_WITH([cc],
168 [ --with-cc=COMPILER select compiler to use],
169 AC_MSG_RESULT(CC=$withval)
170 CC=$withval,
171 if test -z "$CC" ; then CC=cc; fi
172 [AC_MSG_RESULT(CC defaults to $CC)])dnl
173 export CC
174 AC_SUBST([CC])
175
176 dnl
177 dnl set $(LD) from --with-linker=value
178 dnl
179 AC_ARG_WITH([linker],
180 [ --with-linker=LINKER select linker to use],
181 AC_MSG_RESULT(LD=$withval)
182 LD=$withval,
183 if test -z "$LD" ; then LD=$CC; fi
184 [AC_MSG_RESULT(LD defaults to $LD)])dnl
185 export LD
186 AC_SUBST([LD])
187
188 dnl
189 dnl set $(CCOPTS) from --with-ccopts=value
190 dnl
191 AC_ARG_WITH([ccopts],
192 [ --with-ccopts=CCOPTS select compiler command line options],
193 AC_MSG_RESULT(CCOPTS is $withval)
194 CCOPTS=$withval
195 CFLAGS="$CFLAGS $withval",
196 CCOPTS=)dnl
197 AC_SUBST(CCOPTS)
198
199 dnl
200 dnl set $(LDFLAGS) from --with-ldopts=value
201 dnl
202 AC_ARG_WITH([ldopts],
203 [ --with-ldopts=LDOPTS select linker command line options],
204 AC_MSG_RESULT(LDFLAGS is $withval)
205 LDFLAGS=$withval,
206 LDFLAGS=)dnl
207 AC_SUBST(LDFLAGS)
208
209 dnl
210 dnl set $(BINOWNER) from --with-binowner
211 dnl
212 AC_ARG_WITH([binowner],
213 [ --with-binowner=USER select owner for binaries],
214 AC_MSG_RESULT(BINOWNER is $withval)
215 BINOWNER=$withval,
216 BINOWNER=root
217 echo "BINOWNER defaults to $BINOWNER"
218 )dnl
219 AC_SUBST(BINOWNER)
220
221 dnl
222 dnl set $(BINGRP) from --with-bingrp
223 dnl
224 AC_ARG_WITH([bingrp],
225 [ --with-bingrp=GROUP select group for binaries],
226 AC_MSG_RESULT(BINGRP is $withval)
227 BINGRP=$withval,
228 BINGRP=tty
229 echo "BINGRP defaults to $BINGRP"
230 )dnl
231 AC_SUBST(BINGRP)
232
233 dnl
234 dnl set $(BINMODE) from --with-binmode
235 dnl
236 AC_ARG_WITH([binmode],
237 [ --with-binmode=MODE select mode for binaries],
238 AC_MSG_RESULT(BINMODE is $withval)
239 BINMODE=$withval,
240 BINMODE=0755
241 echo "BINMODE defaults to $BINMODE"
242 )dnl
243 AC_SUBST(BINMODE)
244
245 dnl
246 dnl set $(MANOWNER) from --with-manowner
247 dnl
248 AC_ARG_WITH([manowner],
249 [ --with-manowner=USER select owner for manual pages],
250 AC_MSG_RESULT(MANOWNER is $withval)
251 MANOWNER=$withval,
252 MANOWNER=man
253 echo "MANOWNER defaults to $MANOWNER"
254 )dnl
255 AC_SUBST(MANOWNER)
256
257 dnl
258 dnl set $(MANGRP) from --with-mangrp
259 dnl
260 AC_ARG_WITH([mangrp],
261 [ --with-mangrp=GROUP select group for manual pages],
262 AC_MSG_RESULT(MANGRP is $withval)
263 MANGRP=$withval,
264 MANGRP=tty
265 echo "MANGRP defaults to $MANGRP"
266 )dnl
267 AC_SUBST(MANGRP)
268
269 dnl
270 dnl set $(MANMODE) from --with-manmode
271 dnl
272 AC_ARG_WITH([manmode],
273 [ --with-manmode=MODE select mode for manual pages],
274 AC_MSG_RESULT(MANMODE is $withval)
275 MANMODE=$withval,
276 MANMODE=0644
277 echo "MANMODE defaults to $MANMODE"
278 )dnl
279 AC_SUBST(MANMODE)
280
281 dnl
282 dnl set $(DUMPDATESPATH) from --with-dumpdatespath
283 dnl
284 AC_ARG_WITH([dumpdatespath],
285 [ --with-dumpdatespath=PATH select path for dumpdates file],
286 AC_MSG_RESULT(DUMPDATESPATH is $withval)
287 DUMPDATESPATH=$withval,
288 DUMPDATESPATH="${sysconfdir}/dumpdates"
289 echo "DUMPDATESPATH defaults to $DUMPDATESPATH"
290 )dnl
291 AC_SUBST(DUMPDATESPATH)
292
293 dnl
294 dnl Check for Ext2fs headers and libraries
295 dnl
296 AC_CHECK_HEADER(ext2fs/ext2fs.h, [ext2fs_h=yes], [ext2fs_h=no])
297 AC_CHECK_LIB(ext2fs, ext2fs_open, [ext2fs_lib=yes], [ext2fs_lib=no], [-lcom_err])
298 if test "$ext2fs_h" = no -o "$ext2fs_lib" = no; then
299 AC_MSG_ERROR(You need to install the Ext2fs libraries from the E2fsprogs distribution first - hint: make install-libs)
300 fi
301
302 dnl
303 dnl Try to use ext2_fs.h header from libext2fs instead of from the kernel
304 dnl
305 AC_CHECK_HEADERS(ext2fs/ext2_fs.h)
306
307 dnl
308 dnl Check for ext2_ino_t type
309 dnl
310 AC_MSG_CHECKING(for ext2_ino_t type in libext2fs headers)
311 AC_TRY_COMPILE([#include <stdio.h>
312 #ifdef HAVE_EXT2FS_EXT2_FS_H
313 #include <ext2fs/ext2_fs.h>
314 #else
315 #include <linux/ext2_fs.h>
316 #endif
317 #include <ext2fs/ext2fs.h>],
318 [ext2_ino_t ino = 0;],
319 [AC_DEFINE(HAVE_EXT2_INO_T) AC_MSG_RESULT(yes)],
320 AC_MSG_RESULT(no))
321
322 dnl
323 dnl Check for s_journal_inum field in ext2_super_block struct
324 dnl
325 AC_MSG_CHECKING(for s_journal_inum field in ext2_super_block struct)
326 AC_TRY_COMPILE([#include <stdio.h>
327 #ifdef HAVE_EXT2FS_EXT2_FS_H
328 #include <ext2fs/ext2_fs.h>
329 #else
330 #include <linux/ext2_fs.h>
331 #endif
332 #include <ext2fs/ext2fs.h>],
333 [struct ext2_super_block es; es.s_journal_inum = 0;],
334 [AC_DEFINE(HAVE_EXT2_JOURNAL_INUM) AC_MSG_RESULT(yes)],
335 AC_MSG_RESULT(no))
336
337 dnl
338 dnl Check for termcap libraries
339 dnl
340 AC_CHECK_LIB(termcap, tgetent, [termcap_lib=yes], [termcap_lib=no])
341 if test "$termcap_lib" = no; then
342 if test "$READLINE" = "-lreadline -ltermcap"; then
343 AC_MSG_ERROR(You need to install the GNU termcap libraries first)
344 fi
345 fi
346
347 dnl
348 dnl Check for readline headers and libraries
349 dnl
350 AC_CHECK_HEADER(readline/readline.h, [readline_h=yes], [readline_h=no])
351 AC_CHECK_LIB(readline, readline, [readline_lib=yes], [readline_lib=no], "-ltermcap")
352 if test "$readline_h" = no -o "$readline_lib" = no; then
353 if test "$READLINE" = "-lreadline -ltermcap"; then
354 AC_MSG_ERROR(You need to install the GNU readline libraries first)
355 fi
356 fi
357
358 dnl
359 dnl Check for zlib headers and libraries
360 dnl
361 AC_CHECK_HEADER(zlib.h, [zlib_h=yes], [zlib_h=no])
362 AC_CHECK_LIB(z, compress2, [zlib_lib=yes], [zlib_lib=no])
363 if test "$zlib_h" = yes -a "$zlib_lib" = yes; then
364 ZLIB="-lz"
365 AC_DEFINE(HAVE_ZLIB)
366 else
367 ZLIB=""
368 fi
369 AC_SUBST(ZLIB)
370
371 dnl
372 dnl Check for library functions
373 dnl
374 AC_CHECK_FUNCS(err errx verr verrx vwarn vwarnx warn warnx realpath lchown)
375 AC_CHECK_FUNC(glob)
376
377 dnl
378 dnl Check for GLOB_ALTDIRFUNC
379 dnl
380 AC_MSG_CHECKING(for extended glob routines)
381 if test "$ac_cv_func_glob" = "yes"; then
382 AC_EGREP_CPP(yes,
383 [
384 # include <glob.h>
385 # ifdef GLOB_ALTDIRFUNC
386 yes
387 # endif
388 ],
389 [
390 AC_DEFINE(HAVE_GLOB)
391 AC_MSG_RESULT(yes)
392 ],
393 [
394 AC_MSG_RESULT(no)
395 echo "Your system does not support extended glob, will use the internal routines"
396 ])
397 fi
398
399 dnl
400 dnl Check for types
401 dnl
402 AC_CHECK_TYPE(quad_t, __s64)
403 AC_CHECK_TYPE(u_quad_t, __u64)
404
405 dnl
406 dnl Compute top_buildir
407 dnl
408 top_builddir=`cd .; pwd`
409 AC_SUBST(top_builddir)
410
411 dnl
412 dnl Create directories
413 dnl
414 test -d compat || mkdir compat
415 test -d compat/lib || mkdir compat/lib
416
417 dnl
418 dnl Output files
419 dnl
420 AC_OUTPUT(MCONFIG Makefile common/Makefile compat/include/Makefile compat/lib/Makefile dump/Makefile restore/Makefile $RMTMAKEFILE)