6 dnl This is to figure out the version number and the date....
8 E2FSPROGS_VERSION=`grep E2FSPROGS_VERSION ${srcdir}/version.h \
9 | awk '{print $3}' | tr \" " " | awk '{print $1}'`
10 DATE=`grep E2FSPROGS_DATE ${srcdir}/version.h | awk '{print $3}' \
12 MONTH=`echo $DATE | awk -F- '{print $2}'`
13 YEAR=`echo $DATE | awk -F- '{print $3}'`
15 if expr $YEAR ">" 90 >/dev/null ; then
16 E2FSPROGS_YEAR=19$YEAR
18 E2FSPROGS_YEAR=20$YEAR
22 Jan) E2FSPROGS_MONTH="January" ;;
23 Feb) E2FSPROGS_MONTH="February" ;;
24 Mar) E2FSPROGS_MONTH="March" ;;
25 Apr) E2FSPROGS_MONTH="April" ;;
26 May) E2FSPROGS_MONTH="May" ;;
27 Jun) E2FSPROGS_MONTH="June" ;;
28 Jul) E2FSPROGS_MONTH="July" ;;
29 Aug) E2FSPROGS_MONTH="August" ;;
30 Sep) E2FSPROGS_MONTH="September" ;;
31 Oct) E2FSPROGS_MONTH="October" ;;
32 Nov) E2FSPROGS_MONTH="November" ;;
33 Dec) E2FSPROGS_MONTH="December" ;;
34 *) echo "Unknown month $MONTH??" ;;
38 echo "Generating configuration file for e2fsprogs version $E2FSPROGS_VERSION"
39 echo "Release date is ${E2FSPROGS_MONTH}, ${E2FSPROGS_YEAR}"
40 AC_SUBST(E2FSPROGS_YEAR)
41 AC_SUBST(E2FSPROGS_MONTH)
42 AC_SUBST(E2FSPROGS_VERSION)
44 dnl set $(CC) from --with-cc=value
47 [ --with-cc=COMPILER select compiler to use],
48 AC_MSG_RESULT(CC=$withval)
50 if test -z "$CC" ; then CC=cc; fi
51 [AC_MSG_RESULT(CC defaults to $CC)])dnl
55 dnl set $(LD) from --with-linker=value
58 [ --with-linker=LINKER select linker to use],
59 AC_MSG_RESULT(LD=$withval)
61 if test -z "$LD" ; then LD=$CC; fi
62 [AC_MSG_RESULT(LD defaults to $LD)])dnl
66 dnl set $(CCOPTS) from --with-ccopts=value
69 [ --with-ccopts=CCOPTS select compiler command line options],
70 AC_MSG_RESULT(CCOPTS is $withval)
72 CFLAGS="$CFLAGS $withval",
76 dnl Set default values for library extentions. Will be dealt with after
77 dnl parsing configuration opions, which may modify these
83 dnl set $(LDFLAGS) from --with-ldopts=value
86 [ --with-ldopts=LDOPTS select linker command line options],
87 AC_MSG_RESULT(LDFLAGS is $withval)
92 dnl handle --enable-dll-shlibs
94 AC_ARG_ENABLE([dll-shlibs],
95 [ --enable-dll-shlibs select DLL libraries],
96 if test "$enableval" = "no"
99 MAKEFILE_DLL=/dev/null
100 echo "Disabling DLL shared libraries"
103 MAKEFILE_DLL=$srcdir/lib/Makefile.dll-lib
106 echo "Enabling DLL shared libraries"
109 MAKEFILE_DLL=/dev/null
111 echo "Disabling DLL shared libraries by default"
114 AC_SUBST_FILE(MAKEFILE_DLL)
116 dnl handle --enable-elf-shlibs
118 AC_ARG_ENABLE([elf-shlibs],
119 [ --enable-elf-shlibs select ELF shared libraries],
120 if test "$enableval" = "no"
123 MAKEFILE_ELF=/dev/null
124 echo "Disabling ELF shared libraries"
127 MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib
130 echo "Enabling ELF shared libraries"
133 MAKEFILE_ELF=/dev/null
135 echo "Disabling ELF shared libraries by default"
138 AC_SUBST_FILE(MAKEFILE_ELF)
140 dnl handle --enable-bsd-shlibs
142 AC_ARG_ENABLE([bsd-shlibs],
143 [ --enable-bsd-shlibs select BSD shared libraries],
144 if test "$enableval" = "no"
147 MAKEFILE_BSDLIB=/dev/null
148 echo "Disabling BSD shared libraries"
151 MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib
153 echo "Enabling BSD shared libraries"
156 MAKEFILE_BSDLIB=/dev/null
158 echo "Disabling BSD shared libraries by default"
161 AC_SUBST_FILE(MAKEFILE_BSDLIB)
163 dnl handle --enable-profile
165 AC_ARG_ENABLE([profile],
166 [ --enable-profile build profiling libraries],
167 if test "$enableval" = "no"
170 MAKEFILE_PROFILE=/dev/null
171 echo "Disabling profiling libraries"
174 MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile
175 PROFILED_LIB_EXT=_p.a
176 echo "Building profiling libraries"
180 MAKEFILE_PROFILE=/dev/null
181 echo "Disabling profiling libraries by default"
183 AC_SUBST(PROFILE_CMT)
184 AC_SUBST_FILE(MAKEFILE_PROFILE)
186 dnl handle --enable-checker
188 AC_ARG_ENABLE([checker],
189 [ --enable-checker build checker libraries],
190 if test "$enableval" = "no"
193 MAKEFILE_CHECKER=/dev/null
194 echo "Disabling checker libraries"
197 MAKEFILE_CHECKER=$srcdir/lib/Makefile.checker
198 echo "Building checker libraries"
202 MAKEFILE_CHECKER=/dev/null
203 echo "Disabling checker libraries by default"
205 AC_SUBST(CHECKER_CMT)
206 AC_SUBST_FILE(MAKEFILE_CHECKER)
208 dnl Substitute library extensions
211 AC_SUBST(STATIC_LIB_EXT)
212 AC_SUBST(PROFILED_LIB_EXT)
214 dnl handle --enable-gcc-wall
216 AC_ARG_ENABLE([gcc-wall],
217 [ --enable-gcc-wall enable GCC anal warnings],
218 if test "$enableval" = "no"
221 echo "Disabling GCC warnings"
224 echo "Enabling GCC warnings"
228 echo "Disabling GCC warnings by default"
231 AC_ARG_ENABLE([dynamic-e2fsck],
232 [ --enable-dynamic-e2fsck build e2fsck dynamically],
233 if test "$enableval" = "no"
236 echo "Building e2fsck statically"
239 echo "Building e2fsck dynamically"
243 echo "Building e2fsck statically by default"
245 AC_SUBST(E2FSCK_TYPE)
248 MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
249 AC_SUBST_FILE(MAKEFILE_LIBRARY)
251 dnl End of configuration options
253 AC_SUBST(BINARY_TYPE)
255 AC_PATH_PROG(LN, ln, ln)
256 AC_PATH_PROG(MV, mv, mv)
257 AC_PATH_PROG(CP, cp, cp)
258 AC_PATH_PROG(RM, rm, rm)
259 AC_PATH_PROG(CHMOD, chmod, :)
260 AC_PATH_PROG(AWK, awk, awk)
261 AC_PATH_PROG(SED, sed, sed)
262 AC_CHECK_TOOL(AR, ar, ar)
263 AC_CHECK_TOOL(RANLIB, ranlib, :)
264 AC_CHECK_TOOL(STRIP, strip, :)
268 AC_CHECK_HEADERS(stdlib.h unistd.h stdarg.h errno.h mntent.h dirent.h getopt.h linux/fd.h linux/major.h sys/disklabel.h)
271 dnl See if struct dirent has a d_namlen field (like bsd systems), implying
272 dnl that the actual length of the structure may be grater than the declared
275 AC_MSG_CHECKING(whether struct dirent has a d_namlen field)
276 AC_CACHE_VAL(e2fsprogs_cv_struct_d_namlen,
278 [#include <sys/types.h>
279 #include <dirent.h>],
280 [struct dirent de; de.d_namlen = 0;],
281 [e2fsprogs_cv_struct_d_namlen=yes],
282 [e2fsprogs_cv_struct_d_namlen=no]))
283 AC_MSG_RESULT($e2fsprogs_cv_struct_d_namlen)
284 if test "$e2fsprogs_cv_struct_d_namlen" = yes; then
285 AC_DEFINE(HAVE_DIRENT_NAMLEN)
290 if test "$cross_compiling" = yes -a "$ac_cv_sizeof_long" = ""; then
291 # if cross-compiling, with no cached values, just assume something common.
295 AC_MSG_WARN([Cross-compiling, so cannot check type sizes; assuming short=2, int=4, long=4])
297 AC_CHECK_SIZEOF(short)
299 AC_CHECK_SIZEOF(long)
300 SIZEOF_SHORT=$ac_cv_sizeof_short
301 SIZEOF_INT=$ac_cv_sizeof_int
302 SIZEOF_LONG=$ac_cv_sizeof_long
303 AC_SUBST(SIZEOF_SHORT)
305 AC_SUBST(SIZEOF_LONG)
307 dnl See if struct stat has a st_flags field, in which case we can get file
308 dnl flags somewhat portably. Also check for the analogous setter, chflags().
310 AC_MSG_CHECKING(whether struct stat has a st_flags field)
311 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
312 AC_TRY_COMPILE([#include <sys/stat.h>],
313 [struct stat stat; stat.st_flags = 0;],
314 [e2fsprogs_cv_struct_st_flags=yes],
315 [e2fsprogs_cv_struct_st_flags=no]))
316 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
317 if test "$e2fsprogs_cv_struct_st_flags" = yes; then
318 AC_DEFINE(HAVE_STAT_FLAGS)
320 AC_CHECK_FUNCS(chflags getrusage llseek strdup getmntinfo)
322 dnl On systems without linux header files, we add an extra include directory
323 dnl that holds enough to fake it (hopefully). Note that the $(top_srcdir) here
324 dnl is quoted so that it gets expanded by make, not by configure.
326 AC_CHECK_HEADER(linux/fs.h, [linux_headers=yes], [linux_headers=no])
327 AC_SUBST(EXTRA_PROGS)
328 if test "$linux_headers" = yes; then
329 AC_DEFINE(HAVE_LINUX_FS_H)
330 # These are some programs that depend on having linux headers around, and
331 # won't work otherwise. So we only compile them if we can.
332 EXTRA_PROGS="$EXTRA_PROGS flushb"
334 LINUX_INCLUDE='-I$(top_srcdir)/include -I$(top_builddir)/include'
335 # Use this include directory with test compiles in the configure script too.
336 CPPFLAGS="$CPPFLAGS -I$srcdir/include -I./include"
338 AC_SUBST(LINUX_INCLUDE)
340 dnl See if optreset exists
342 AC_MSG_CHECKING(for optreset)
343 AC_CACHE_VAL(ac_cv_have_optreset,
344 [AC_EGREP_HEADER(optreset, unistd.h,
345 ac_cv_have_optreset=yes, ac_cv_have_optreset=no)])dnl
346 AC_MSG_RESULT($ac_cv_have_optreset)
347 if test $ac_cv_have_optreset = yes; then
348 AC_DEFINE(HAVE_OPTRESET)
351 dnl See if our system has frags enabled (at least in the header file)
353 AC_MSG_CHECKING(whether struct ext2_inode has frags fields)
354 AC_CACHE_VAL(e2fsprogs_cv_struct_ext2_inode_frags,
355 AC_TRY_COMPILE([#include <linux/ext2_fs.h>],
356 [struct ext2_inode i; i.i_frag = i.i_fsize = 0;],
357 [e2fsprogs_cv_struct_ext2_inode_frags=yes],
358 [e2fsprogs_cv_struct_ext2_inode_frags=no]))
359 AC_MSG_RESULT($e2fsprogs_cv_struct_ext2_inode_frags)
360 if test "$e2fsprogs_cv_struct_ext2_inode_frags" = yes; then
361 AC_DEFINE(HAVE_EXT2_FRAGS)
364 dnl See if using the EXT2 ioctls causes a compile-time barf (as on the hurd).
366 AC_MSG_CHECKING(whether the ext2 ioctls compile)
367 AC_CACHE_VAL(e2fsprogs_cv_ioctl_ext2,
368 AC_TRY_COMPILE([#include <linux/ext2_fs.h>
369 #include <sys/ioctl.h>],
370 [ioctl (0, EXT2_IOC_SETVERSION, 0);],
371 [e2fsprogs_cv_ioctl_ext2=yes],
372 [e2fsprogs_cv_ioctl_ext2=no]))
373 AC_MSG_RESULT($e2fsprogs_cv_ioctl_ext2)
374 if test "$e2fsprogs_cv_ioctl_ext2" = yes; then
375 AC_DEFINE(HAVE_EXT2_IOCTLS)
378 dnl On linux, force the prefix to be '/'
380 AC_REQUIRE([AC_CANONICAL_HOST])
383 if test "$prefix" = NONE ; then
385 echo "On Linux systems, prefix defaults to '/'"
390 dnl See if -static works.
391 dnl XXX for now, assume that only Linux systems support -static
393 AC_REQUIRE([AC_CANONICAL_HOST])
397 LDFLAG_STATIC=-static
398 echo "On Linux systems, assume -static works"
401 AC_SUBST(LDFLAG_STATIC)
403 dnl Check to see if prefix is '/'
405 if test "$prefix" = / ; then
408 usr_prefix="\${prefix}"
412 dnl Make the ss and et directories work correctly.
414 SS_DIR=`cd ${srcdir}/lib/ss; pwd`
415 ET_DIR=`cd ${srcdir}/lib/et; pwd`
419 dnl Only try to run the test suite if we're not cross compiling.
421 if test "$cross_compiling" = yes ; then
426 AC_SUBST(DO_TEST_SUITE)
430 DO_SUBSTITUTE_SCRIPT=$srcdir/lib/do_substitute
431 AC_SUBST_FILE(DO_SUBSTITUTE_SCRIPT)
433 dnl Make our output files, being sure that we create the some miscellaneous
436 test -d lib || mkdir lib
437 test -d include || mkdir include
438 test -d include/linux || mkdir include/linux
439 AC_OUTPUT(MCONFIG lib/substitute_sh Makefile lib/et/Makefile
440 lib/ss/Makefile lib/ext2fs/Makefile lib/e2p/Makefile misc/Makefile
441 e2fsck/Makefile debugfs/Makefile tests/Makefile)