7 dnl This is to figure out the version number and the date....
9 E2FSPROGS_VERSION=`grep E2FSPROGS_VERSION ${srcdir}/version.h \
10 | awk '{print $3}' | tr \" " " | awk '{print $1}'`
11 DATE=`grep E2FSPROGS_DATE ${srcdir}/version.h | awk '{print $3}' \
13 MONTH=`echo $DATE | awk -F- '{print $2}'`
14 YEAR=`echo $DATE | awk -F- '{print $3}'`
16 if expr $YEAR ">" 90 >/dev/null ; then
17 E2FSPROGS_YEAR=19$YEAR
19 E2FSPROGS_YEAR=20$YEAR
23 Jan) E2FSPROGS_MONTH="January" ;;
24 Feb) E2FSPROGS_MONTH="February" ;;
25 Mar) E2FSPROGS_MONTH="March" ;;
26 Apr) E2FSPROGS_MONTH="April" ;;
27 May) E2FSPROGS_MONTH="May" ;;
28 Jun) E2FSPROGS_MONTH="June" ;;
29 Jul) E2FSPROGS_MONTH="July" ;;
30 Aug) E2FSPROGS_MONTH="August" ;;
31 Sep) E2FSPROGS_MONTH="September" ;;
32 Oct) E2FSPROGS_MONTH="October" ;;
33 Nov) E2FSPROGS_MONTH="November" ;;
34 Dec) E2FSPROGS_MONTH="December" ;;
35 *) echo "Unknown month $MONTH??" ;;
39 echo "Generating configuration file for e2fsprogs version $E2FSPROGS_VERSION"
40 echo "Release date is ${E2FSPROGS_MONTH}, ${E2FSPROGS_YEAR}"
41 AC_SUBST(E2FSPROGS_YEAR)
42 AC_SUBST(E2FSPROGS_MONTH)
43 AC_SUBST(E2FSPROGS_VERSION)
44 AC_REQUIRE([AC_CANONICAL_HOST])
46 dnl set $(CC) from --with-cc=value
49 [ --with-cc=COMPILER select compiler to use],
50 AC_MSG_RESULT(CC=$withval)
52 if test -z "$CC" ; then CC=cc; fi
53 [AC_MSG_RESULT(CC defaults to $CC)])dnl
57 dnl set $(LD) from --with-linker=value
60 [ --with-linker=LINKER select linker to use],
61 AC_MSG_RESULT(LD=$withval)
63 if test -z "$LD" ; then LD=$CC; fi
64 [AC_MSG_RESULT(LD defaults to $LD)])dnl
68 dnl set $(CCOPTS) from --with-ccopts=value
71 [ --with-ccopts=CCOPTS select compiler command line options],
72 AC_MSG_RESULT(CCOPTS is $withval)
74 CFLAGS="$CFLAGS $withval",
78 dnl Set default values for library extentions. Will be dealt with after
79 dnl parsing configuration opions, which may modify these
85 dnl set $(LDFLAGS) from --with-ldopts=value
88 [ --with-ldopts=LDOPTS select linker command line options],
89 AC_MSG_RESULT(LDFLAGS is $withval)
94 dnl Allow separate `root_prefix' to be specified
96 AC_ARG_WITH([root-prefix],
97 [ --with-root-prefix=PREFIX override prefix variable for files to be placed in the root],
101 dnl handle --enable-dll-shlibs
103 AC_ARG_ENABLE([dll-shlibs],
104 [ --enable-dll-shlibs select DLL libraries],
105 if test "$enableval" = "no"
108 MAKEFILE_DLL=/dev/null
109 echo "Disabling DLL shared libraries"
112 MAKEFILE_DLL=$srcdir/lib/Makefile.dll-lib
115 echo "Enabling DLL shared libraries"
118 MAKEFILE_DLL=/dev/null
120 echo "Disabling DLL shared libraries by default"
123 AC_SUBST_FILE(MAKEFILE_DLL)
125 dnl handle --enable-elf-shlibs
127 AC_ARG_ENABLE([elf-shlibs],
128 [ --enable-elf-shlibs select ELF shared libraries],
129 if test "$enableval" = "no"
132 MAKEFILE_ELF=/dev/null
133 echo "Disabling ELF shared libraries"
136 MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib
139 echo "Enabling ELF shared libraries"
142 MAKEFILE_ELF=/dev/null
144 echo "Disabling ELF shared libraries by default"
147 AC_SUBST_FILE(MAKEFILE_ELF)
149 dnl handle --enable-bsd-shlibs
151 AC_ARG_ENABLE([bsd-shlibs],
152 [ --enable-bsd-shlibs select BSD shared libraries],
153 if test "$enableval" = "no"
156 MAKEFILE_BSDLIB=/dev/null
157 echo "Disabling BSD shared libraries"
160 MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib
162 echo "Enabling BSD shared libraries"
165 MAKEFILE_BSDLIB=/dev/null
167 echo "Disabling BSD shared libraries by default"
170 AC_SUBST_FILE(MAKEFILE_BSDLIB)
172 dnl handle --enable-profile
174 AC_ARG_ENABLE([profile],
175 [ --enable-profile build profiling libraries],
176 if test "$enableval" = "no"
179 MAKEFILE_PROFILE=/dev/null
180 echo "Disabling profiling libraries"
183 MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile
184 PROFILED_LIB_EXT=_p.a
185 echo "Building profiling libraries"
189 MAKEFILE_PROFILE=/dev/null
190 echo "Disabling profiling libraries by default"
192 AC_SUBST(PROFILE_CMT)
193 AC_SUBST_FILE(MAKEFILE_PROFILE)
195 dnl handle --enable-checker
197 AC_ARG_ENABLE([checker],
198 [ --enable-checker build checker libraries],
199 if test "$enableval" = "no"
202 MAKEFILE_CHECKER=/dev/null
203 echo "Disabling checker libraries"
206 MAKEFILE_CHECKER=$srcdir/lib/Makefile.checker
207 echo "Building checker libraries"
211 MAKEFILE_CHECKER=/dev/null
212 echo "Disabling checker libraries by default"
214 AC_SUBST(CHECKER_CMT)
215 AC_SUBST_FILE(MAKEFILE_CHECKER)
217 dnl Substitute library extensions
220 AC_SUBST(STATIC_LIB_EXT)
221 AC_SUBST(PROFILED_LIB_EXT)
223 dnl handle --enable-gcc-wall
225 AC_ARG_ENABLE([gcc-wall],
226 [ --enable-gcc-wall enable GCC anal warnings (DON'T USE IN PRODUCTION)],
227 if test "$enableval" = "no"
230 echo "Disabling GCC warnings"
233 echo "Enabling GCC warnings"
237 echo "Disabling GCC warnings by default"
240 AC_ARG_ENABLE([dynamic-e2fsck],
241 [ --enable-dynamic-e2fsck build e2fsck dynamically],
242 if test "$enableval" = "no"
245 echo "Building e2fsck statically"
248 echo "Building e2fsck dynamically"
252 echo "Building e2fsck statically by default"
254 AC_SUBST(E2FSCK_TYPE)
256 dnl See whether to install the `fsck' wrapper program (that calls e2fsck)
258 AC_ARG_ENABLE([fsck],
259 [ --enable-fsck build fsck wrapper program],
260 [if test "$enableval" = "no"
262 FSCK_PROG='' FSCK_MAN=''
263 echo "Not building fsck wrapper"
265 FSCK_PROG=fsck FSCK_MAN=fsck.8
266 echo "Building fsck wrapper"
271 FSCK_PROG='' FSCK_MAN=''
272 echo "Not building fsck wrapper by default"
275 FSCK_PROG=fsck FSCK_MAN=fsck.8
276 echo "Building fsck wrapper by default"
283 MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
284 AC_SUBST_FILE(MAKEFILE_LIBRARY)
287 AC_ARG_ENABLE([old-bitops],
288 [ --enable-old-bitops Use old (non-standard but native) bitmask operations],
289 if test "$enableval" = "no"
291 echo "Using new (standard) bitmask operations"
293 AC_DEFINE(EXT2_OLD_BITOPS)
294 echo "Using old (native) bitmask operations"
298 echo "Using standard bitmask operations by default"
301 dnl End of configuration options
303 AC_SUBST(BINARY_TYPE)
305 AC_PATH_PROG(LN, ln, ln)
307 AC_PATH_PROG(MV, mv, mv)
308 AC_PATH_PROG(CP, cp, cp)
309 AC_PATH_PROG(RM, rm, rm)
310 AC_PATH_PROG(CHMOD, chmod, :)
311 AC_PATH_PROG(AWK, awk, awk)
312 AC_PATH_PROG(SED, sed, sed)
313 AC_CHECK_TOOL(AR, ar, ar)
314 AC_CHECK_TOOL(RANLIB, ranlib, :)
315 AC_CHECK_TOOL(STRIP, strip, :)
319 AC_CHECK_HEADERS(stdlib.h unistd.h stdarg.h errno.h mntent.h dirent.h getopt.h setjmp.h linux/fd.h linux/major.h sys/disklabel.h sys/sockio.h sys/time.h sys/stat.h sys/types.h net/if.h netinet/in.h)
322 dnl See if struct dirent has a d_namlen field (like bsd systems), implying
323 dnl that the actual length of the structure may be grater than the declared
326 AC_MSG_CHECKING(whether struct dirent has a d_namlen field)
327 AC_CACHE_VAL(e2fsprogs_cv_struct_d_namlen,
329 [#include <sys/types.h>
330 #include <dirent.h>],
331 [struct dirent de; de.d_namlen = 0;],
332 [e2fsprogs_cv_struct_d_namlen=yes],
333 [e2fsprogs_cv_struct_d_namlen=no]))
334 AC_MSG_RESULT($e2fsprogs_cv_struct_d_namlen)
335 if test "$e2fsprogs_cv_struct_d_namlen" = yes; then
336 AC_DEFINE(HAVE_DIRENT_NAMLEN)
339 dnl Check to see if llseek() is declared in unistd.h. On some libc's
340 dnl it is, and on others it isn't..... Thank you glibc developers....
342 dnl Warning! Use of --enable-gcc-wall may throw off this test.
345 AC_MSG_CHECKING(whether llseek declared in unistd.h)
346 AC_CACHE_VAL(e2fsprogs_cv_have_llseek_prototype,
348 [#include <unistd.h>], [extern int llseek(int);],
349 [e2fsprogs_cv_have_llseek_prototype=no],
350 [e2fsprogs_cv_have_llseek_prototype=yes]))
351 AC_MSG_RESULT($e2fsprogs_cv_have_llseek_prototype)
352 if test "$e2fsprogs_cv_have_llseek_prototype" = yes; then
353 AC_DEFINE(HAVE_LLSEEK_PROTOTYPE)
358 if test "$cross_compiling" = yes -a "$ac_cv_sizeof_long" = ""; then
359 # if cross-compiling, with no cached values, just assume something common.
363 ac_cv_sizeof_long_long=0
364 AC_MSG_WARN([Cross-compiling, so cannot check type sizes; assuming short=2, int=4, long=4])
366 AC_CHECK_SIZEOF(short)
368 AC_CHECK_SIZEOF(long)
369 AC_CHECK_SIZEOF(long long)
370 SIZEOF_SHORT=$ac_cv_sizeof_short
371 SIZEOF_INT=$ac_cv_sizeof_int
372 SIZEOF_LONG=$ac_cv_sizeof_long
373 SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
374 AC_SUBST(SIZEOF_SHORT)
376 AC_SUBST(SIZEOF_LONG)
377 AC_SUBST(SIZEOF_LONG_LONG)
379 dnl See if struct stat has a st_flags field, in which case we can get file
380 dnl flags somewhat portably. Also check for the analogous setter, chflags().
382 AC_MSG_CHECKING(whether struct stat has a st_flags field)
383 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
384 AC_TRY_COMPILE([#include <sys/stat.h>],
385 [struct stat stat; stat.st_flags = 0;],
386 [e2fsprogs_cv_struct_st_flags=yes],
387 [e2fsprogs_cv_struct_st_flags=no]))
388 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
389 if test "$e2fsprogs_cv_struct_st_flags" = yes; then
390 AC_DEFINE(HAVE_STAT_FLAGS)
392 AC_CHECK_FUNCS(chflags getrusage llseek strdup getmntinfo strcasecmp srandom fchown)
394 dnl Check to see if ino_t is defined
396 AC_MSG_CHECKING(ino_t defined by sys/types.h)
397 AC_CACHE_VAL(e2fsprogs_cv_ino_t,
398 AC_TRY_COMPILE([#include <sys/types.h>],
399 [ino_t ino; ino = 0;],
400 [e2fsprogs_cv_ino_t=yes],
401 [e2fsprogs_cv_ino_t=no]))
402 AC_MSG_RESULT($e2fsprogs_cv_ino_t)
403 if test "$e2fsprogs_cv_ino_t" = yes; then
404 AC_DEFINE(HAVE_INO_T)
407 dnl On systems without linux header files, we add an extra include directory
408 dnl that holds enough to fake it (hopefully). Note that the $(top_srcdir) here
409 dnl is quoted so that it gets expanded by make, not by configure.
411 AC_CHECK_HEADER(linux/fs.h, [linux_headers=yes], [linux_headers=no])
412 if test "$linux_headers" = yes; then
413 AC_DEFINE(HAVE_LINUX_FS_H)
415 LINUX_INCLUDE='-I$(top_srcdir)/include -I$(top_builddir)/include'
416 # Use this include directory with test compiles in the configure script too.
417 CPPFLAGS="$CPPFLAGS -I$srcdir/include -I./include"
419 AC_SUBST(LINUX_INCLUDE)
421 dnl Check to see if -lsocket is required (solaris) to make something
422 dnl that uses socket() to compile; this is needed for the UUID library
425 AC_CHECK_LIB(socket, socket, [SOCKET_LIB=-lsocket])
428 dnl See if optreset exists
430 AC_MSG_CHECKING(for optreset)
431 AC_CACHE_VAL(ac_cv_have_optreset,
432 [AC_EGREP_HEADER(optreset, unistd.h,
433 ac_cv_have_optreset=yes, ac_cv_have_optreset=no)])dnl
434 AC_MSG_RESULT($ac_cv_have_optreset)
435 if test $ac_cv_have_optreset = yes; then
436 AC_DEFINE(HAVE_OPTRESET)
439 dnl See if using the EXT2 ioctls causes a compile-time barf (as on the hurd).
441 AC_MSG_CHECKING(whether the ext2 ioctls compile)
442 AC_CACHE_VAL(e2fsprogs_cv_ioctl_ext2,
443 AC_TRY_COMPILE([#include <linux/ext2_fs.h>
444 #include <sys/ioctl.h>],
445 [ioctl (0, EXT2_IOC_SETVERSION, 0);],
446 [e2fsprogs_cv_ioctl_ext2=yes],
447 [e2fsprogs_cv_ioctl_ext2=no]))
448 AC_MSG_RESULT($e2fsprogs_cv_ioctl_ext2)
449 if test "$e2fsprogs_cv_ioctl_ext2" = yes; then
450 AC_DEFINE(HAVE_EXT2_IOCTLS)
453 dnl Linux places root files in the / by default
457 if test "$prefix" = NONE -a "$root_prefix" = NONE ; then
459 echo "On $host_os systems, root_prefix defaults to ''"
464 dnl On Linux/hurd, force the prefix to be /usr
468 if test "$prefix" = NONE ; then
470 echo "On $host_os systems, prefix defaults to /usr"
474 if test "$root_prefix" = NONE ; then
475 if test "$prefix" = NONE ; then
476 root_prefix="$ac_default_prefix"
478 root_prefix="$prefix"
481 AC_SUBST(root_prefix)
483 dnl See if -static works.
485 AC_MSG_CHECKING([whether linker accepts -static])
486 AC_CACHE_VAL(ac_cv_e2fsprogs_use_static,
487 [SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -static"
488 AC_TRY_LINK([#include <stdio.h>],[fflush(stdout);],
489 ac_cv_e2fsprogs_use_static=yes, ac_cv_e2fsprogs_use_static=no)
490 LDFLAGS=$SAVE_LDFLAGS])
491 AC_MSG_RESULT($ac_cv_e2fsprogs_use_static)
493 if test $ac_cv_e2fsprogs_use_static = yes; then
494 LDFLAG_STATIC=-static
496 AC_SUBST(LDFLAG_STATIC)
498 dnl Make the ss and et directories work correctly.
500 SS_DIR=`cd ${srcdir}/lib/ss; pwd`
501 ET_DIR=`cd ${srcdir}/lib/et; pwd`
505 dnl Only try to run the test suite if we're not cross compiling.
507 if test "$cross_compiling" = yes ; then
512 AC_SUBST(DO_TEST_SUITE)
516 DO_SUBSTITUTE_SCRIPT=$srcdir/lib/do_substitute
517 AC_SUBST_FILE(DO_SUBSTITUTE_SCRIPT)
519 dnl Make our output files, being sure that we create the some miscellaneous
522 test -d lib || mkdir lib
523 test -d include || mkdir include
524 test -d include/linux || mkdir include/linux
526 if test -d ${srcdir}/resize ; then
527 rmakefile=resize/Makefile
529 AC_OUTPUT(MCONFIG Makefile util/Makefile util/subst.conf lib/et/Makefile
530 lib/ss/Makefile lib/ext2fs/Makefile lib/e2p/Makefile lib/uuid/Makefile
531 misc/Makefile e2fsck/Makefile debugfs/Makefile tests/Makefile
532 tests/progs/Makefile $rmakefile doc/Makefile)