blob: 5349abc3b83663f8be1f42cfe49ef387e532cba8 [file] [log] [blame]
Theodore Ts'o50e1e101997-04-26 13:58:21 +00001AC_INIT(version.h)
2MCONFIG=./MCONFIG
3AC_SUBST_FILE(MCONFIG)
4dnl
5dnl handle --enable-dll-shlibs
6dnl
7AC_ARG_ENABLE([dll-shlibs],
8[ --enable-dll-shlibs select DLL libraries],
9if test "$enableval" = "no"
10then
11 DLL_CMT=#
12 MAKEFILE_DLL=/dev/null
13 echo "Disabling DLL shared libraries"
14else
15 DLL_CMT=
16 MAKEFILE_DLL=$srcdir/lib/Makefile.dll-lib
17 echo "Enabling DLL shared libraries"
18fi
19,
20MAKEFILE_DLL=/dev/null
21DLL_CMT=#
22echo "Disabling DLL shared libraries by default"
23)
24AC_SUBST(DLL_CMT)
25AC_SUBST_FILE(MAKEFILE_DLL)
26dnl
27dnl handle --enable-elf-shlibs
28dnl
29AC_ARG_ENABLE([elf-shlibs],
30[ --enable-elf-shlibs select ELF shared libraries],
31if test "$enableval" = "no"
32then
33 ELF_CMT=#
34 MAKEFILE_ELF=/dev/null
35 echo "Disabling ELF shared libraries"
36else
37 ELF_CMT=
38 MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib
39 echo "Enabling ELF shared libraries"
40fi
41,
42MAKEFILE_ELF=/dev/null
43ELF_CMT=#
44echo "Disabling ELF shared libraries by default"
45)
46AC_SUBST(ELF_CMT)
47AC_SUBST_FILE(MAKEFILE_ELF)
48dnl
49dnl handle --enable-bsd-shlibs
50dnl
51AC_ARG_ENABLE([bsd-shlibs],
52[ --enable-bsd-shlibs select BSD shared libraries],
53if test "$enableval" = "no"
54then
55 BSDLIB_CMT=#
56 MAKEFILE_BSDLIB=/dev/null
57 echo "Disabling BSD shared libraries"
58else
59 BSDLIB_CMT=
60 MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib
61 echo "Enabling BSD shared libraries"
62fi
63,
64MAKEFILE_BSDLIB=/dev/null
65BSDLIB_CMT=#
66echo "Disabling BSD shared libraries by default"
67)
68AC_SUBST(BSDLIB_CMT)
69AC_SUBST_FILE(MAKEFILE_BSDLIB)
70dnl
71dnl handle --enable-profile
72dnl
73AC_ARG_ENABLE([profile],
74[ --enable-profile build profiling libraries],
75if test "$enableval" = "no"
76then
77 PROFILE_CMT=#
78 MAKEFILE_PROFILE=/dev/null
79 echo "Disabling profiling libraries"
80else
81 PROFILE_CMT=
82 MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile
83 echo "Building profiling libraries"
84fi
85,
86PROFILE_CMT=#
87MAKEFILE_PROFILE=/dev/null
88echo "Disabling profiling libraries by default"
89)
90AC_SUBST(PROFILE_CMT)
91AC_SUBST_FILE(MAKEFILE_PROFILE)
92dnl
93dnl handle --enable-checker
94dnl
95AC_ARG_ENABLE([checker],
96[ --enable-checker build checker libraries],
97if test "$enableval" = "no"
98then
99 CHECKER_CMT=#
100 MAKEFILE_CHECKER=/dev/null
101 echo "Disabling checker libraries"
102else
103 CHECKER_CMT=
104 MAKEFILE_CHECKER=$srcdir/lib/Makefile.checker
105 echo "Building checker libraries"
106fi
107,
108CHECKER_CMT=#
109MAKEFILE_CHECKER=/dev/null
110echo "Disabling checker libraries by default"
111)
112AC_SUBST(CHECKER_CMT)
113AC_SUBST_FILE(MAKEFILE_CHECKER)
114dnl
115dnl handle --enable-gcc-wall
116dnl
117AC_ARG_ENABLE([gcc-wall],
118[ --enable-gcc-wall enable GCC anal warnings],
119if test "$enableval" = "no"
120then
121 W=#
122 echo "Disabling GCC warnings"
123else
124 W=
125 echo "Enabling GCC warnings"
126fi
127,
128W=#
129echo "Disabling GCC warnings by default"
130)
131AC_SUBST(W)
132dnl
133dnl
134MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
135AC_SUBST_FILE(MAKEFILE_LIBRARY)
136dnl
137dnl End of configuration options
138dnl
139AC_PROG_MAKE_SET
140AC_PATH_PROG(LN, ln, ln)
141AC_PATH_PROG(MV, mv, mv)
142AC_PATH_PROG(CP, cp, cp)
143AC_PATH_PROG(RM, rm, rm)
144AC_PATH_PROG(CHMOD, chmod, :)
145AC_PATH_PROG(AWK, awk, awk)
146AC_PATH_PROG(SED, sed, sed)
147AC_CHECK_TOOL(AR, ar, ar)
148AC_CHECK_TOOL(RANLIB, ranlib, :)
149AC_CHECK_TOOL(STRIP, strip, :)
150AC_PROG_CC
151AC_PROG_INSTALL
152AC_C_CROSS
153AC_CHECK_HEADERS(stdlib.h unistd.h stdarg.h errno.h mntent.h dirent.h getopt.h linux/fd.h sys/disklabel.h)
154AC_FUNC_VPRINTF
155dnl
156dnl See if struct dirent has a d_namlen field (like bsd systems), implying
157dnl that the actual length of the structure may be grater than the declared
158dnl length.
159dnl
160AC_MSG_CHECKING(whether struct dirent has a d_namlen field)
161AC_CACHE_VAL(e2fsprogs_cv_struct_d_namlen,
162 AC_TRY_COMPILE(
163[#include <sys/types.h>
164#include <dirent.h>],
165 [struct dirent de; de.d_namlen = 0;],
166 [e2fsprogs_cv_struct_d_namlen=yes],
167 [e2fsprogs_cv_struct_d_namlen=no]))
168AC_MSG_RESULT($e2fsprogs_cv_struct_d_namlen)
169if test "$e2fsprogs_cv_struct_d_namlen" = yes; then
170 AC_DEFINE(HAVE_DIRENT_NAMLEN)
171fi
172dnl
173dnl Word sizes...
174dnl
175if test "$cross_compiling" = yes -a "$ac_cv_sizeof_long" = ""; then
176 # if cross-compiling, with no cached values, just assume something common.
177 ac_cv_sizeof_short=2
178 ac_cv_sizeof_int=4
179 ac_cv_sizeof_long=4
180 AC_MSG_WARN([Cross-compiling, so cannot check type sizes; assuming short=2, int=4, long=4])
181fi
182AC_CHECK_SIZEOF(short)
183AC_CHECK_SIZEOF(int)
184AC_CHECK_SIZEOF(long)
185SIZEOF_SHORT=$ac_cv_sizeof_short
186SIZEOF_INT=$ac_cv_sizeof_int
187SIZEOF_LONG=$ac_cv_sizeof_long
188AC_SUBST(SIZEOF_SHORT)
189AC_SUBST(SIZEOF_INT)
190AC_SUBST(SIZEOF_LONG)
191dnl
192dnl See if struct stat has a st_flags field, in which case we can get file
193dnl flags somewhat portably. Also check for the analogous setter, chflags().
194dnl
195AC_MSG_CHECKING(whether struct stat has a st_flags field)
196AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
197 AC_TRY_COMPILE([#include <sys/stat.h>],
198 [struct stat stat; stat.st_flags = 0;],
199 [e2fsprogs_cv_struct_st_flags=yes],
200 [e2fsprogs_cv_struct_st_flags=no]))
201AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
202if test "$e2fsprogs_cv_struct_st_flags" = yes; then
203 AC_DEFINE(HAVE_STAT_FLAGS)
204fi
205AC_CHECK_FUNCS(chflags getrusage llseek strdup getmntinfo)
206dnl
207dnl On systems without linux header files, we add an extra include directory
208dnl that holds enough to fake it (hopefully). Note that the $(top_srcdir) here
209dnl is quoted so that it gets expanded by make, not by configure.
210dnl
211AC_CHECK_HEADER(linux/fs.h, [linux_headers=yes], [linux_headers=no])
212AC_SUBST(EXTRA_PROGS)
213if test "$linux_headers" = yes; then
214 AC_DEFINE(HAVE_LINUX_FS_H)
215 # These are some programs that depend on having linux headers around, and
216 # won't work otherwise. So we only compile them if we can.
217 EXTRA_PROGS="$EXTRA_PROGS flushb"
218else
219 LINUX_INCLUDE='-I$(top_srcdir)/include -I$(top_builddir)/include'
220 # Use this include directory with test compiles in the configure script too.
221 CPPFLAGS="$CPPFLAGS -I$srcdir/include -I./include"
222fi
223AC_SUBST(LINUX_INCLUDE)
224dnl
225dnl See if optreset exists
226dnl
227AC_MSG_CHECKING(for optreset)
228AC_CACHE_VAL(ac_cv_have_optreset,
229[AC_EGREP_HEADER(optreset, unistd.h,
230 ac_cv_have_optreset=yes, ac_cv_have_optreset=no)])dnl
231AC_MSG_RESULT($ac_cv_have_optreset)
232if test $ac_cv_have_optreset = yes; then
233 AC_DEFINE(HAVE_OPTRESET)
234fi
235dnl
236dnl See if our system has frags enabled (at least in the header file)
237dnl
238AC_MSG_CHECKING(whether struct ext2_inode has frags fields)
239AC_CACHE_VAL(e2fsprogs_cv_struct_ext2_inode_frags,
240 AC_TRY_COMPILE([#include <linux/ext2_fs.h>],
241 [struct ext2_inode i; i.i_frag = i.i_fsize = 0;],
242 [e2fsprogs_cv_struct_ext2_inode_frags=yes],
243 [e2fsprogs_cv_struct_ext2_inode_frags=no]))
244AC_MSG_RESULT($e2fsprogs_cv_struct_ext2_inode_frags)
245if test "$e2fsprogs_cv_struct_ext2_inode_frags" = yes; then
246 AC_DEFINE(HAVE_EXT2_FRAGS)
247fi
248dnl
249dnl See if using the EXT2 ioctls causes a compile-time barf (as on the hurd).
250dnl
251AC_MSG_CHECKING(whether the ext2 ioctls compile)
252AC_CACHE_VAL(e2fsprogs_cv_ioctl_ext2,
253 AC_TRY_COMPILE([#include <linux/ext2_fs.h>
254#include <sys/ioctl.h>],
255 [ioctl (0, EXT2_IOC_SETVERSION, 0);],
256 [e2fsprogs_cv_ioctl_ext2=yes],
257 [e2fsprogs_cv_ioctl_ext2=no]))
258AC_MSG_RESULT($e2fsprogs_cv_ioctl_ext2)
259if test "$e2fsprogs_cv_ioctl_ext2" = yes; then
260 AC_DEFINE(HAVE_EXT2_IOCTLS)
261fi
262dnl
263dnl On linux, force the prefix to be '/'
264dnl
265AC_REQUIRE([AC_CANONICAL_HOST])
266case "$host_os" in
267linux*)
268 if test "$prefix" = NONE ; then
269 prefix='/';
270 echo "On Linux systems, prefix defaults to '/'"
271 fi
272;;
273esac
274dnl
275dnl See if -static works.
276dnl XXX for now, assume that only Linux systems support -static
277dnl
278AC_REQUIRE([AC_CANONICAL_HOST])
279LDFALG_STATIC=
280case "$host_os" in
281linux*)
282 LDFLAG_STATIC=-static
283 echo "On Linux systems, assume -static works"
284;;
285esac
286AC_SUBST(LDFLAG_STATIC)
287dnl
288dnl Check to see if prefix is '/'
289dnl
290if test "$prefix" = / ; then
291 usr_prefix=/usr
292else
293 usr_prefix="\${prefix}"
294fi
295AC_SUBST(usr_prefix)
296dnl
297dnl Make the ss and et directories work correctly.
298dnl
299SS_DIR=`cd ${srcdir}/lib/ss; pwd`
300ET_DIR=`cd ${srcdir}/lib/et; pwd`
301AC_SUBST(SS_DIR)
302AC_SUBST(ET_DIR)
303dnl
304dnl Only try to run the test suite if we're not cross compiling.
305dnl
306if test "$cross_compiling" = yes ; then
307 DO_TEST_SUITE=
308else
309 DO_TEST_SUITE=check
310fi
311AC_SUBST(DO_TEST_SUITE)
312dnl
313dnl Make our output files, being sure that we create the some miscellaneous
314dnl directories
315dnl
316test -d lib || mkdir lib
317test -d include || mkdir include
318test -d include/linux || mkdir include/linux
319AC_OUTPUT(MCONFIG include/linux/types.h Makefile lib/et/Makefile
320 lib/et/compile_et.sh lib/ss/Makefile lib/ss/mk_cmds.sh
321 lib/ext2fs/Makefile lib/e2p/Makefile misc/Makefile
322 e2fsck/Makefile debugfs/Makefile tests/Makefile)