]> git.wh0rd.org - dump.git/blob - configure.in
Use lchown instead of chown (security problem of symlinks ownership)
[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 set $(CC) from --with-cc=value
79 dnl
80 AC_ARG_WITH([cc],
81 [ --with-cc=COMPILER select compiler to use],
82 AC_MSG_RESULT(CC=$withval)
83 CC=$withval,
84 if test -z "$CC" ; then CC=cc; fi
85 [AC_MSG_RESULT(CC defaults to $CC)])dnl
86 export CC
87 AC_SUBST([CC])
88
89 dnl
90 dnl set $(LD) from --with-linker=value
91 dnl
92 AC_ARG_WITH([linker],
93 [ --with-linker=LINKER select linker to use],
94 AC_MSG_RESULT(LD=$withval)
95 LD=$withval,
96 if test -z "$LD" ; then LD=$CC; fi
97 [AC_MSG_RESULT(LD defaults to $LD)])dnl
98 export LD
99 AC_SUBST([LD])
100
101 dnl
102 dnl set $(CCOPTS) from --with-ccopts=value
103 dnl
104 AC_ARG_WITH([ccopts],
105 [ --with-ccopts=CCOPTS select compiler command line options],
106 AC_MSG_RESULT(CCOPTS is $withval)
107 CCOPTS=$withval
108 CFLAGS="$CFLAGS $withval",
109 CCOPTS=)dnl
110 AC_SUBST(CCOPTS)
111
112 dnl
113 dnl set $(LDFLAGS) from --with-ldopts=value
114 dnl
115 AC_ARG_WITH([ldopts],
116 [ --with-ldopts=LDOPTS select linker command line options],
117 AC_MSG_RESULT(LDFLAGS is $withval)
118 LDFLAGS=$withval,
119 LDFLAGS=)dnl
120 AC_SUBST(LDFLAGS)
121
122 dnl
123 dnl set $(BINOWNER) from --with-binowner
124 dnl
125 AC_ARG_WITH([binowner],
126 [ --with-binowner=USER select owner for binaries],
127 AC_MSG_RESULT(BINOWNER is $withval)
128 BINOWNER=$withval,
129 BINOWNER=root
130 echo "BINOWNER defaults to $BINOWNER"
131 )dnl
132 AC_SUBST(BINOWNER)
133
134 dnl
135 dnl set $(BINGRP) from --with-bingrp
136 dnl
137 AC_ARG_WITH([bingrp],
138 [ --with-bingrp=GROUP select group for binaries],
139 AC_MSG_RESULT(BINGRP is $withval)
140 BINGRP=$withval,
141 BINGRP=tty
142 echo "BINGRP defaults to $BINGRP"
143 )dnl
144 AC_SUBST(BINGRP)
145
146 dnl
147 dnl set $(BINMODE) from --with-binmode
148 dnl
149 AC_ARG_WITH([binmode],
150 [ --with-binmode=MODE select mode for binaries],
151 AC_MSG_RESULT(BINMODE is $withval)
152 BINMODE=$withval,
153 BINMODE=6555
154 echo "BINMODE defaults to $BINMODE"
155 )dnl
156 AC_SUBST(BINMODE)
157
158 dnl
159 dnl set $(MANOWNER) from --with-manowner
160 dnl
161 AC_ARG_WITH([manowner],
162 [ --with-manowner=USER select owner for manual pages],
163 AC_MSG_RESULT(MANOWNER is $withval)
164 MANOWNER=$withval,
165 MANOWNER=man
166 echo "MANOWNER defaults to $MANOWNER"
167 )dnl
168 AC_SUBST(MANOWNER)
169
170 dnl
171 dnl set $(MANGRP) from --with-mangrp
172 dnl
173 AC_ARG_WITH([mangrp],
174 [ --with-mangrp=group select group for manual pages],
175 AC_MSG_RESULT(MANGRP is $withval)
176 MANGRP=$withval,
177 MANGRP=tty
178 echo "MANGRP defaults to $MANGRP"
179 )dnl
180 AC_SUBST(MANGRP)
181
182 dnl
183 dnl set $(MANMODE) from --with-manmode
184 dnl
185 AC_ARG_WITH([manmode],
186 [ --with-manmode=MODE select mode for manual pages],
187 AC_MSG_RESULT(MANMODE is $withval)
188 MANMODE=$withval,
189 MANMODE=0444
190 echo "MANMODE defaults to $MANMODE"
191 )dnl
192 AC_SUBST(MANMODE)
193
194 dnl
195 dnl set $(DUMPDATESPATH) from --with-dumpdatespath
196 dnl
197 AC_ARG_WITH([dumpdatespath],
198 [ --with-dumpdatespath=path select path for dumpdates file],
199 AC_MSG_RESULT(DUMPDATESPATH is $withval)
200 DUMPDATESPATH=$withval,
201 DUMPDATESPATH="/etc/dumpdates"
202 echo "DUMPDATESPATH defaults to $DUMPDATESPATH"
203 )dnl
204 AC_SUBST(DUMPDATESPATH)
205
206 dnl
207 dnl Check for Ext2fs headers and libraries
208 dnl
209 AC_CHECK_HEADER(ext2fs/ext2fs.h, [ext2fs_h=yes], [ext2fs_h=no])
210 AC_CHECK_LIB(ext2fs, ext2fs_open, [ext2fs_lib=yes], [ext2fs_lib=no], [-lcom_err])
211 if test "$ext2fs_h" = no -o "$ext2fs_lib" = no; then
212 AC_MSG_ERROR(You need to install the Ext2fs libraries from the E2fsprogs distribution first)
213 fi
214
215 dnl
216 dnl Check for library functions
217 dnl
218 AC_CHECK_FUNCS(err errx verr verrx vwarn vwarnx warn warnx realpath glob lchown)
219
220 dnl
221 dnl Check for types
222 dnl
223 AC_CHECK_TYPE(quad_t, __s64)
224 AC_CHECK_TYPE(u_quad_t, __u64)
225
226 dnl
227 dnl Compute top_buildir
228 dnl
229 top_builddir=`cd .; pwd`
230 AC_SUBST(top_builddir)
231
232 dnl
233 dnl Create directories
234 dnl
235 test -d compat || mkdir compat
236 test -d compat/lib || mkdir compat/lib
237
238 dnl
239 dnl Output files
240 dnl
241 AC_OUTPUT(MCONFIG Makefile common/Makefile compat/include/Makefile compat/lib/Makefile dump/Makefile restore/Makefile $RMTMAKEFILE)