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 $(LDFLAGS) from --with-ldopts=value
79 [ --with-ldopts=LDOPTS select linker command line options],
80 AC_MSG_RESULT(LDFLAGS is $withval)
85 dnl handle --enable-dll-shlibs
87 AC_ARG_ENABLE([dll-shlibs],
88 [ --enable-dll-shlibs select DLL libraries],
89 if test "$enableval" = "no"
92 MAKEFILE_DLL=/dev/null
93 echo "Disabling DLL shared libraries"
96 MAKEFILE_DLL=$srcdir/lib/Makefile.dll-lib
98 echo "Enabling DLL shared libraries"
101 MAKEFILE_DLL=/dev/null
103 echo "Disabling DLL shared libraries by default"
106 AC_SUBST_FILE(MAKEFILE_DLL)
108 dnl handle --enable-elf-shlibs
110 AC_ARG_ENABLE([elf-shlibs],
111 [ --enable-elf-shlibs select ELF shared libraries],
112 if test "$enableval" = "no"
115 MAKEFILE_ELF=/dev/null
116 echo "Disabling ELF shared libraries"
119 MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib
121 echo "Enabling ELF shared libraries"
124 MAKEFILE_ELF=/dev/null
126 echo "Disabling ELF shared libraries by default"
129 AC_SUBST_FILE(MAKEFILE_ELF)
131 dnl handle --enable-bsd-shlibs
133 AC_ARG_ENABLE([bsd-shlibs],
134 [ --enable-bsd-shlibs select BSD shared libraries],
135 if test "$enableval" = "no"
138 MAKEFILE_BSDLIB=/dev/null
139 echo "Disabling BSD shared libraries"
142 MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib
143 echo "Enabling BSD shared libraries"
146 MAKEFILE_BSDLIB=/dev/null
148 echo "Disabling BSD shared libraries by default"
151 AC_SUBST_FILE(MAKEFILE_BSDLIB)
153 dnl handle --enable-profile
155 AC_ARG_ENABLE([profile],
156 [ --enable-profile build profiling libraries],
157 if test "$enableval" = "no"
160 MAKEFILE_PROFILE=/dev/null
161 echo "Disabling profiling libraries"
164 MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile
165 echo "Building profiling libraries"
169 MAKEFILE_PROFILE=/dev/null
170 echo "Disabling profiling libraries by default"
172 AC_SUBST(PROFILE_CMT)
173 AC_SUBST_FILE(MAKEFILE_PROFILE)
175 dnl handle --enable-checker
177 AC_ARG_ENABLE([checker],
178 [ --enable-checker build checker libraries],
179 if test "$enableval" = "no"
182 MAKEFILE_CHECKER=/dev/null
183 echo "Disabling checker libraries"
186 MAKEFILE_CHECKER=$srcdir/lib/Makefile.checker
187 echo "Building checker libraries"
191 MAKEFILE_CHECKER=/dev/null
192 echo "Disabling checker libraries by default"
194 AC_SUBST(CHECKER_CMT)
195 AC_SUBST_FILE(MAKEFILE_CHECKER)
197 dnl handle --enable-gcc-wall
199 AC_ARG_ENABLE([gcc-wall],
200 [ --enable-gcc-wall enable GCC anal warnings],
201 if test "$enableval" = "no"
204 echo "Disabling GCC warnings"
207 echo "Enabling GCC warnings"
211 echo "Disabling GCC warnings by default"
216 MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
217 AC_SUBST_FILE(MAKEFILE_LIBRARY)
219 dnl End of configuration options
221 AC_SUBST(BINARY_TYPE)
223 AC_PATH_PROG(LN, ln, ln)
224 AC_PATH_PROG(MV, mv, mv)
225 AC_PATH_PROG(CP, cp, cp)
226 AC_PATH_PROG(RM, rm, rm)
227 AC_PATH_PROG(CHMOD, chmod, :)
228 AC_PATH_PROG(AWK, awk, awk)
229 AC_PATH_PROG(SED, sed, sed)
230 AC_CHECK_TOOL(AR, ar, ar)
231 AC_CHECK_TOOL(RANLIB, ranlib, :)
232 AC_CHECK_TOOL(STRIP, strip, :)
236 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)
239 dnl See if struct dirent has a d_namlen field (like bsd systems), implying
240 dnl that the actual length of the structure may be grater than the declared
243 AC_MSG_CHECKING(whether struct dirent has a d_namlen field)
244 AC_CACHE_VAL(e2fsprogs_cv_struct_d_namlen,
246 [#include <sys/types.h>
247 #include <dirent.h>],
248 [struct dirent de; de.d_namlen = 0;],
249 [e2fsprogs_cv_struct_d_namlen=yes],
250 [e2fsprogs_cv_struct_d_namlen=no]))
251 AC_MSG_RESULT($e2fsprogs_cv_struct_d_namlen)
252 if test "$e2fsprogs_cv_struct_d_namlen" = yes; then
253 AC_DEFINE(HAVE_DIRENT_NAMLEN)
258 if test "$cross_compiling" = yes -a "$ac_cv_sizeof_long" = ""; then
259 # if cross-compiling, with no cached values, just assume something common.
263 AC_MSG_WARN([Cross-compiling, so cannot check type sizes; assuming short=2, int=4, long=4])
265 AC_CHECK_SIZEOF(short)
267 AC_CHECK_SIZEOF(long)
268 SIZEOF_SHORT=$ac_cv_sizeof_short
269 SIZEOF_INT=$ac_cv_sizeof_int
270 SIZEOF_LONG=$ac_cv_sizeof_long
271 AC_SUBST(SIZEOF_SHORT)
273 AC_SUBST(SIZEOF_LONG)
275 dnl See if struct stat has a st_flags field, in which case we can get file
276 dnl flags somewhat portably. Also check for the analogous setter, chflags().
278 AC_MSG_CHECKING(whether struct stat has a st_flags field)
279 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
280 AC_TRY_COMPILE([#include <sys/stat.h>],
281 [struct stat stat; stat.st_flags = 0;],
282 [e2fsprogs_cv_struct_st_flags=yes],
283 [e2fsprogs_cv_struct_st_flags=no]))
284 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
285 if test "$e2fsprogs_cv_struct_st_flags" = yes; then
286 AC_DEFINE(HAVE_STAT_FLAGS)
288 AC_CHECK_FUNCS(chflags getrusage llseek strdup getmntinfo)
290 dnl On systems without linux header files, we add an extra include directory
291 dnl that holds enough to fake it (hopefully). Note that the $(top_srcdir) here
292 dnl is quoted so that it gets expanded by make, not by configure.
294 AC_CHECK_HEADER(linux/fs.h, [linux_headers=yes], [linux_headers=no])
295 AC_SUBST(EXTRA_PROGS)
296 if test "$linux_headers" = yes; then
297 AC_DEFINE(HAVE_LINUX_FS_H)
298 # These are some programs that depend on having linux headers around, and
299 # won't work otherwise. So we only compile them if we can.
300 EXTRA_PROGS="$EXTRA_PROGS flushb"
302 LINUX_INCLUDE='-I$(top_srcdir)/include -I$(top_builddir)/include'
303 # Use this include directory with test compiles in the configure script too.
304 CPPFLAGS="$CPPFLAGS -I$srcdir/include -I./include"
306 AC_SUBST(LINUX_INCLUDE)
308 dnl See if optreset exists
310 AC_MSG_CHECKING(for optreset)
311 AC_CACHE_VAL(ac_cv_have_optreset,
312 [AC_EGREP_HEADER(optreset, unistd.h,
313 ac_cv_have_optreset=yes, ac_cv_have_optreset=no)])dnl
314 AC_MSG_RESULT($ac_cv_have_optreset)
315 if test $ac_cv_have_optreset = yes; then
316 AC_DEFINE(HAVE_OPTRESET)
319 dnl See if our system has frags enabled (at least in the header file)
321 AC_MSG_CHECKING(whether struct ext2_inode has frags fields)
322 AC_CACHE_VAL(e2fsprogs_cv_struct_ext2_inode_frags,
323 AC_TRY_COMPILE([#include <linux/ext2_fs.h>],
324 [struct ext2_inode i; i.i_frag = i.i_fsize = 0;],
325 [e2fsprogs_cv_struct_ext2_inode_frags=yes],
326 [e2fsprogs_cv_struct_ext2_inode_frags=no]))
327 AC_MSG_RESULT($e2fsprogs_cv_struct_ext2_inode_frags)
328 if test "$e2fsprogs_cv_struct_ext2_inode_frags" = yes; then
329 AC_DEFINE(HAVE_EXT2_FRAGS)
332 dnl See if using the EXT2 ioctls causes a compile-time barf (as on the hurd).
334 AC_MSG_CHECKING(whether the ext2 ioctls compile)
335 AC_CACHE_VAL(e2fsprogs_cv_ioctl_ext2,
336 AC_TRY_COMPILE([#include <linux/ext2_fs.h>
337 #include <sys/ioctl.h>],
338 [ioctl (0, EXT2_IOC_SETVERSION, 0);],
339 [e2fsprogs_cv_ioctl_ext2=yes],
340 [e2fsprogs_cv_ioctl_ext2=no]))
341 AC_MSG_RESULT($e2fsprogs_cv_ioctl_ext2)
342 if test "$e2fsprogs_cv_ioctl_ext2" = yes; then
343 AC_DEFINE(HAVE_EXT2_IOCTLS)
346 dnl On linux, force the prefix to be '/'
348 AC_REQUIRE([AC_CANONICAL_HOST])
351 if test "$prefix" = NONE ; then
353 echo "On Linux systems, prefix defaults to '/'"
358 dnl See if -static works.
359 dnl XXX for now, assume that only Linux systems support -static
361 AC_REQUIRE([AC_CANONICAL_HOST])
365 LDFLAG_STATIC=-static
366 echo "On Linux systems, assume -static works"
369 AC_SUBST(LDFLAG_STATIC)
371 dnl Check to see if prefix is '/'
373 if test "$prefix" = / ; then
376 usr_prefix="\${prefix}"
380 dnl Make the ss and et directories work correctly.
382 SS_DIR=`cd ${srcdir}/lib/ss; pwd`
383 ET_DIR=`cd ${srcdir}/lib/et; pwd`
387 dnl Only try to run the test suite if we're not cross compiling.
389 if test "$cross_compiling" = yes ; then
394 AC_SUBST(DO_TEST_SUITE)
396 dnl Make our output files, being sure that we create the some miscellaneous
399 test -d lib || mkdir lib
400 test -d include || mkdir include
401 test -d include/linux || mkdir include/linux
402 AC_OUTPUT(MCONFIG include/linux/types.h Makefile lib/et/Makefile
403 lib/et/compile_et.sh lib/ss/Makefile lib/ss/mk_cmds.sh
404 lib/ext2fs/Makefile lib/e2p/Makefile misc/Makefile
405 e2fsck/Makefile debugfs/Makefile tests/Makefile lib/ext2fs/ext2_err.et
406 debugfs/debugfs.8 e2fsck/e2fsck.8 misc/tune2fs.8 misc/lsattr.1
407 misc/chattr.1 misc/badblocks.8 misc/dumpe2fs.8 misc/mke2fs.8
408 misc/fsck.8 misc/mklost+found.8)