]> git.wh0rd.org - dump.git/blob - configure.in
Get the install paths from configure.
[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(_FILE_OFFSET_BITS,64)
133 fi
134 ,
135 echo "Not enabling Large File System support"
136 )
137
138 dnl
139 dnl set $(CC) from --with-cc=value
140 dnl
141 AC_ARG_WITH([cc],
142 [ --with-cc=COMPILER select compiler to use],
143 AC_MSG_RESULT(CC=$withval)
144 CC=$withval,
145 if test -z "$CC" ; then CC=cc; fi
146 [AC_MSG_RESULT(CC defaults to $CC)])dnl
147 export CC
148 AC_SUBST([CC])
149
150 dnl
151 dnl set $(LD) from --with-linker=value
152 dnl
153 AC_ARG_WITH([linker],
154 [ --with-linker=LINKER select linker to use],
155 AC_MSG_RESULT(LD=$withval)
156 LD=$withval,
157 if test -z "$LD" ; then LD=$CC; fi
158 [AC_MSG_RESULT(LD defaults to $LD)])dnl
159 export LD
160 AC_SUBST([LD])
161
162 dnl
163 dnl set $(CCOPTS) from --with-ccopts=value
164 dnl
165 AC_ARG_WITH([ccopts],
166 [ --with-ccopts=CCOPTS select compiler command line options],
167 AC_MSG_RESULT(CCOPTS is $withval)
168 CCOPTS=$withval
169 CFLAGS="$CFLAGS $withval",
170 CCOPTS=)dnl
171 AC_SUBST(CCOPTS)
172
173 dnl
174 dnl set $(LDFLAGS) from --with-ldopts=value
175 dnl
176 AC_ARG_WITH([ldopts],
177 [ --with-ldopts=LDOPTS select linker command line options],
178 AC_MSG_RESULT(LDFLAGS is $withval)
179 LDFLAGS=$withval,
180 LDFLAGS=)dnl
181 AC_SUBST(LDFLAGS)
182
183 dnl
184 dnl set $(BINOWNER) from --with-binowner
185 dnl
186 AC_ARG_WITH([binowner],
187 [ --with-binowner=USER select owner for binaries],
188 AC_MSG_RESULT(BINOWNER is $withval)
189 BINOWNER=$withval,
190 BINOWNER=root
191 echo "BINOWNER defaults to $BINOWNER"
192 )dnl
193 AC_SUBST(BINOWNER)
194
195 dnl
196 dnl set $(BINGRP) from --with-bingrp
197 dnl
198 AC_ARG_WITH([bingrp],
199 [ --with-bingrp=GROUP select group for binaries],
200 AC_MSG_RESULT(BINGRP is $withval)
201 BINGRP=$withval,
202 BINGRP=tty
203 echo "BINGRP defaults to $BINGRP"
204 )dnl
205 AC_SUBST(BINGRP)
206
207 dnl
208 dnl set $(BINMODE) from --with-binmode
209 dnl
210 AC_ARG_WITH([binmode],
211 [ --with-binmode=MODE select mode for binaries],
212 AC_MSG_RESULT(BINMODE is $withval)
213 BINMODE=$withval,
214 BINMODE=0755
215 echo "BINMODE defaults to $BINMODE"
216 )dnl
217 AC_SUBST(BINMODE)
218
219 dnl
220 dnl set $(MANOWNER) from --with-manowner
221 dnl
222 AC_ARG_WITH([manowner],
223 [ --with-manowner=USER select owner for manual pages],
224 AC_MSG_RESULT(MANOWNER is $withval)
225 MANOWNER=$withval,
226 MANOWNER=man
227 echo "MANOWNER defaults to $MANOWNER"
228 )dnl
229 AC_SUBST(MANOWNER)
230
231 dnl
232 dnl set $(MANGRP) from --with-mangrp
233 dnl
234 AC_ARG_WITH([mangrp],
235 [ --with-mangrp=GROUP select group for manual pages],
236 AC_MSG_RESULT(MANGRP is $withval)
237 MANGRP=$withval,
238 MANGRP=tty
239 echo "MANGRP defaults to $MANGRP"
240 )dnl
241 AC_SUBST(MANGRP)
242
243 dnl
244 dnl set $(MANMODE) from --with-manmode
245 dnl
246 AC_ARG_WITH([manmode],
247 [ --with-manmode=MODE select mode for manual pages],
248 AC_MSG_RESULT(MANMODE is $withval)
249 MANMODE=$withval,
250 MANMODE=0644
251 echo "MANMODE defaults to $MANMODE"
252 )dnl
253 AC_SUBST(MANMODE)
254
255 dnl
256 dnl set $(DUMPDATESPATH) from --with-dumpdatespath
257 dnl
258 AC_ARG_WITH([dumpdatespath],
259 [ --with-dumpdatespath=PATH select path for dumpdates file],
260 AC_MSG_RESULT(DUMPDATESPATH is $withval)
261 DUMPDATESPATH=$withval,
262 DUMPDATESPATH="${sysconfdir}/dumpdates"
263 echo "DUMPDATESPATH defaults to $DUMPDATESPATH"
264 )dnl
265 AC_SUBST(DUMPDATESPATH)
266
267 dnl
268 dnl Check for Ext2fs headers and libraries
269 dnl
270 AC_CHECK_HEADER(ext2fs/ext2fs.h, [ext2fs_h=yes], [ext2fs_h=no])
271 AC_CHECK_LIB(ext2fs, ext2fs_open, [ext2fs_lib=yes], [ext2fs_lib=no], [-lcom_err])
272 if test "$ext2fs_h" = no -o "$ext2fs_lib" = no; then
273 AC_MSG_ERROR(You need to install the Ext2fs libraries from the E2fsprogs distribution first - hint: make install-libs)
274 fi
275
276 dnl
277 dnl Check for ext2_ino_t type
278 dnl
279 AC_MSG_CHECKING(for ext2_ino_t type in libext2fs headers)
280 AC_TRY_COMPILE([#include <stdio.h>
281 #include <linux/ext2_fs.h>
282 #include <ext2fs/ext2fs.h>],
283 [ext2_ino_t ino = 0;],
284 [AC_DEFINE(HAVE_EXT2_INO_T) AC_MSG_RESULT(yes)],
285 AC_MSG_RESULT(no))
286
287 dnl
288 dnl Check for s_journal_inum field in ext2_super_block struct
289 dnl
290 AC_MSG_CHECKING(for s_journal_inum field in ext2_super_block struct)
291 AC_TRY_COMPILE([#include <stdio.h>
292 #include <linux/ext2_fs.h>
293 #include <ext2fs/ext2fs.h>],
294 [struct ext2_super_block es; es.s_journal_inum = 0;],
295 [AC_DEFINE(HAVE_EXT2_JOURNAL_INUM) AC_MSG_RESULT(yes)],
296 AC_MSG_RESULT(no))
297
298 dnl
299 dnl Check for termcap libraries
300 dnl
301 AC_CHECK_LIB(termcap, tgetent, [termcap_lib=yes], [termcap_lib=no])
302 if test "$termcap_lib" = no; then
303 if test "$READLINE" = "-lreadline -ltermcap"; then
304 AC_MSG_ERROR(You need to install the GNU termcap libraries first)
305 fi
306 fi
307
308 dnl
309 dnl Check for readline headers and libraries
310 dnl
311 AC_CHECK_HEADER(readline/readline.h, [readline_h=yes], [readline_h=no])
312 AC_CHECK_LIB(readline, readline, [readline_lib=yes], [readline_lib=no], "-ltermcap")
313 if test "$readline_h" = no -o "$readline_lib" = no; then
314 if test "$READLINE" = "-lreadline -ltermcap"; then
315 AC_MSG_ERROR(You need to install the GNU readline libraries first)
316 fi
317 fi
318
319 dnl
320 dnl Check for zlib headers and libraries
321 dnl
322 AC_CHECK_HEADER(zlib.h, [zlib_h=yes], [zlib_h=no])
323 AC_CHECK_LIB(z, compress2, [zlib_lib=yes], [zlib_lib=no])
324 if test "$zlib_h" = yes -a "$zlib_lib" = yes; then
325 ZLIB="-lz"
326 AC_DEFINE(HAVE_ZLIB)
327 else
328 ZLIB=""
329 fi
330 AC_SUBST(ZLIB)
331
332 dnl
333 dnl Check for library functions
334 dnl
335 AC_CHECK_FUNCS(err errx verr verrx vwarn vwarnx warn warnx realpath lchown)
336 AC_CHECK_FUNC(glob)
337
338 dnl
339 dnl Check for GLOB_ALTDIRFUNC
340 dnl
341 AC_MSG_CHECKING(for extended glob routines)
342 if test "$ac_cv_func_glob" = "yes"; then
343 AC_EGREP_CPP(yes,
344 [
345 # include <glob.h>
346 # ifdef GLOB_ALTDIRFUNC
347 yes
348 # endif
349 ],
350 [
351 AC_DEFINE(HAVE_GLOB)
352 AC_MSG_RESULT(yes)
353 ],
354 [
355 AC_MSG_RESULT(no)
356 echo "Your system does not support extended glob, will use the internal routines"
357 ])
358 fi
359
360 dnl
361 dnl Check for types
362 dnl
363 AC_CHECK_TYPE(quad_t, __s64)
364 AC_CHECK_TYPE(u_quad_t, __u64)
365
366 dnl
367 dnl Compute top_buildir
368 dnl
369 top_builddir=`cd .; pwd`
370 AC_SUBST(top_builddir)
371
372 dnl
373 dnl Create directories
374 dnl
375 test -d compat || mkdir compat
376 test -d compat/lib || mkdir compat/lib
377
378 dnl
379 dnl Output files
380 dnl
381 AC_OUTPUT(MCONFIG Makefile common/Makefile compat/include/Makefile compat/lib/Makefile dump/Makefile restore/Makefile $RMTMAKEFILE)