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