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 ">" 1900 > /dev/null ; then
18 elif expr $YEAR ">" 90 >/dev/null ; then
19 E2FSPROGS_YEAR=19$YEAR
21 E2FSPROGS_YEAR=20$YEAR
25 Jan) E2FSPROGS_MONTH="January" ;;
26 Feb) E2FSPROGS_MONTH="February" ;;
27 Mar) E2FSPROGS_MONTH="March" ;;
28 Apr) E2FSPROGS_MONTH="April" ;;
29 May) E2FSPROGS_MONTH="May" ;;
30 Jun) E2FSPROGS_MONTH="June" ;;
31 Jul) E2FSPROGS_MONTH="July" ;;
32 Aug) E2FSPROGS_MONTH="August" ;;
33 Sep) E2FSPROGS_MONTH="September" ;;
34 Oct) E2FSPROGS_MONTH="October" ;;
35 Nov) E2FSPROGS_MONTH="November" ;;
36 Dec) E2FSPROGS_MONTH="December" ;;
37 *) echo "Unknown month $MONTH??" ;;
41 echo "Generating configuration file for e2fsprogs version $E2FSPROGS_VERSION"
42 echo "Release date is ${E2FSPROGS_MONTH}, ${E2FSPROGS_YEAR}"
43 AC_SUBST(E2FSPROGS_YEAR)
44 AC_SUBST(E2FSPROGS_MONTH)
45 AC_SUBST(E2FSPROGS_VERSION)
46 AC_REQUIRE([AC_CANONICAL_HOST])
48 dnl set $(CC) from --with-cc=value
51 [ --with-cc=COMPILER select compiler to use],
52 AC_MSG_RESULT(CC=$withval)
54 if test -z "$CC" ; then CC=cc; fi
55 [AC_MSG_RESULT(CC defaults to $CC)])dnl
60 dnl set $(LD) from --with-linker=value
63 [ --with-linker=LINKER select linker to use],
64 AC_MSG_RESULT(LD=$withval)
66 if test -z "$LD" ; then LD=$CC; fi
67 [AC_MSG_RESULT(LD defaults to $LD)])dnl
71 dnl set $(CCOPTS) from --with-ccopts=value
74 [ --with-ccopts=CCOPTS select compiler command line options],
75 AC_MSG_RESULT(CCOPTS is $withval)
77 CFLAGS="$CFLAGS $withval",
81 dnl On systems without linux header files, we add an extra include directory
82 dnl that holds enough to fake it (hopefully). Note that the $(top_srcdir) here
83 dnl is quoted so that it gets expanded by make, not by configure.
85 AC_CHECK_HEADER(linux/fs.h, [linux_headers=yes], [linux_headers=no])
86 if test "$linux_headers" != yes; then
87 LINUX_INCLUDE='-I$(top_builddir)/include'
89 AC_SUBST(LINUX_INCLUDE)
91 dnl Set default values for library extentions. Will be dealt with after
92 dnl parsing configuration opions, which may modify these
98 dnl set $(LDFLAGS) from --with-ldopts=value
100 AC_ARG_WITH([ldopts],
101 [ --with-ldopts=LDOPTS select linker command line options],
102 AC_MSG_RESULT(LDFLAGS is $withval)
107 dnl Allow separate `root_prefix' to be specified
109 AC_ARG_WITH([root-prefix],
110 [ --with-root-prefix=PREFIX override prefix variable for files to be placed in the root],
111 root_prefix=$withval,
114 dnl handle --enable-compression
116 AC_ARG_ENABLE([compression],
117 [ --enable-compression enable EXPERIMENTAL compression support],
118 if test "$enableval" = "no"
120 echo "Disabling compression support"
122 AC_DEFINE(ENABLE_COMPRESSION)
123 echo "Enabling compression support"
124 echo "WARNING: Compression support is experimental"
127 echo "Disabling compression support by default"
130 dnl handle --enable-dll-shlibs
132 AC_ARG_ENABLE([dll-shlibs],
133 [ --enable-dll-shlibs select DLL libraries],
134 if test "$enableval" = "no"
137 MAKEFILE_DLL=/dev/null
138 echo "Disabling DLL shared libraries"
141 MAKEFILE_DLL=$srcdir/lib/Makefile.dll-lib
144 echo "Enabling DLL shared libraries"
147 MAKEFILE_DLL=/dev/null
149 echo "Disabling DLL shared libraries by default"
152 AC_SUBST_FILE(MAKEFILE_DLL)
154 dnl handle --enable-elf-shlibs
156 AC_ARG_ENABLE([elf-shlibs],
157 [ --enable-elf-shlibs select ELF shared libraries],
158 if test "$enableval" = "no"
161 MAKEFILE_ELF=/dev/null
162 echo "Disabling ELF shared libraries"
165 MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib
168 MAKEFILE_ELF=$srcdir/lib/Makefile.solaris-lib
173 echo "Enabling ELF shared libraries"
176 MAKEFILE_ELF=/dev/null
178 echo "Disabling ELF shared libraries by default"
181 AC_SUBST_FILE(MAKEFILE_ELF)
183 dnl handle --enable-bsd-shlibs
185 AC_ARG_ENABLE([bsd-shlibs],
186 [ --enable-bsd-shlibs select BSD shared libraries],
187 if test "$enableval" = "no"
190 MAKEFILE_BSDLIB=/dev/null
191 echo "Disabling BSD shared libraries"
194 MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib
196 echo "Enabling BSD shared libraries"
199 MAKEFILE_BSDLIB=/dev/null
201 echo "Disabling BSD shared libraries by default"
204 AC_SUBST_FILE(MAKEFILE_BSDLIB)
206 dnl handle --enable-jfs-debug
208 AC_ARG_ENABLE([jfs-debug],
209 [ --enable-jfs-debug enable journal debugging],
210 if test "$enableval" = "no"
212 echo "Disabling journal debugging"
215 echo "Enabling journal debugging"
218 echo "Disabling journal debugging by default"
221 dnl Add internationalization support, using gettext.
224 VERSION="$E2FSPROGS_VERSION"
225 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
226 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
233 dnl handle --enable-profile
235 AC_ARG_ENABLE([profile],
236 [ --enable-profile build profiling libraries],
237 if test "$enableval" = "no"
240 MAKEFILE_PROFILE=/dev/null
241 echo "Disabling profiling libraries"
244 MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile
245 PROFILED_LIB_EXT=_p.a
246 echo "Building profiling libraries"
250 MAKEFILE_PROFILE=/dev/null
251 echo "Disabling profiling libraries by default"
253 AC_SUBST(PROFILE_CMT)
254 AC_SUBST_FILE(MAKEFILE_PROFILE)
256 dnl handle --enable-checker
258 AC_ARG_ENABLE([checker],
259 [ --enable-checker build checker libraries],
260 if test "$enableval" = "no"
263 MAKEFILE_CHECKER=/dev/null
264 echo "Disabling checker libraries"
267 MAKEFILE_CHECKER=$srcdir/lib/Makefile.checker
268 echo "Building checker libraries"
272 MAKEFILE_CHECKER=/dev/null
273 echo "Disabling checker libraries by default"
275 AC_SUBST(CHECKER_CMT)
276 AC_SUBST_FILE(MAKEFILE_CHECKER)
278 dnl Substitute library extensions
281 AC_SUBST(STATIC_LIB_EXT)
282 AC_SUBST(PROFILED_LIB_EXT)
284 dnl handle --enable-dynamic-e2fsck
286 AC_ARG_ENABLE([dynamic-e2fsck],
287 [ --enable-dynamic-e2fsck build e2fsck dynamically],
288 if test "$enableval" = "no"
291 echo "Building e2fsck statically"
294 echo "Building e2fsck dynamically"
298 echo "Building e2fsck statically by default"
300 AC_SUBST(E2FSCK_TYPE)
302 dnl See whether to install the `fsck' wrapper program (that calls e2fsck)
304 AC_ARG_ENABLE([fsck],
305 [ --enable-fsck build fsck wrapper program],
306 [if test "$enableval" = "no"
308 FSCK_PROG='' FSCK_MAN=''
309 echo "Not building fsck wrapper"
311 FSCK_PROG=fsck FSCK_MAN=fsck.8
312 echo "Building fsck wrapper"
317 FSCK_PROG='' FSCK_MAN=''
318 echo "Not building fsck wrapper by default"
321 FSCK_PROG=fsck FSCK_MAN=fsck.8
322 echo "Building fsck wrapper by default"
329 MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
330 AC_SUBST_FILE(MAKEFILE_LIBRARY)
333 AC_ARG_ENABLE([old-bitops],
334 [ --enable-old-bitops Use old (non-standard but native) bitmask operations],
335 if test "$enableval" = "no"
337 echo "Using new (standard) bitmask operations"
339 AC_DEFINE(EXT2_OLD_BITOPS)
340 echo "Using old (native) bitmask operations"
344 echo "Using standard bitmask operations by default"
347 dnl End of configuration options
349 AC_SUBST(BINARY_TYPE)
351 AC_PATH_PROG(LN, ln, ln)
353 AC_PATH_PROG(MV, mv, mv)
354 AC_PATH_PROG(CP, cp, cp)
355 AC_PATH_PROG(RM, rm, rm)
356 AC_PATH_PROG(CHMOD, chmod, :)
357 AC_PATH_PROG(AWK, awk, awk)
358 AC_PATH_PROG(SED, sed, sed)
359 AC_PATH_PROG(PERL, perl, perl)
360 AC_CHECK_TOOL(AR, ar, ar)
361 AC_CHECK_TOOL(RANLIB, ranlib, :)
362 AC_CHECK_TOOL(STRIP, strip, :)
364 # See if we need a separate native compiler.
365 if test $cross_compiling = no; then
369 AC_CHECK_PROGS(BUILD_CC, gcc cc)
371 AC_CHECK_HEADERS(stdlib.h unistd.h stdarg.h errno.h malloc.h mntent.h paths.h dirent.h getopt.h setjmp.h signal.h termios.h linux/fd.h linux/major.h sys/disklabel.h sys/ioctl.h sys/mkdev.h sys/mount.h sys/sockio.h sys/sysmacros.h sys/time.h sys/stat.h sys/types.h net/if.h netinet/in.h)
374 dnl See if struct dirent has a d_namlen field (like bsd systems), implying
375 dnl that the actual length of the structure may be grater than the declared
378 AC_MSG_CHECKING(whether struct dirent has a d_namlen field)
379 AC_CACHE_VAL(e2fsprogs_cv_struct_d_namlen,
381 [#include <sys/types.h>
382 #include <dirent.h>],
383 [struct dirent de; de.d_namlen = 0;],
384 [e2fsprogs_cv_struct_d_namlen=yes],
385 [e2fsprogs_cv_struct_d_namlen=no]))
386 AC_MSG_RESULT($e2fsprogs_cv_struct_d_namlen)
387 if test "$e2fsprogs_cv_struct_d_namlen" = yes; then
388 AC_DEFINE(HAVE_DIRENT_NAMLEN)
391 dnl Check to see if llseek() is declared in unistd.h. On some libc's
392 dnl it is, and on others it isn't..... Thank you glibc developers....
394 dnl Warning! Use of --enable-gcc-wall may throw off this test.
397 AC_MSG_CHECKING(whether llseek declared in unistd.h)
398 AC_CACHE_VAL(e2fsprogs_cv_have_llseek_prototype,
400 [#include <unistd.h>], [extern int llseek(int);],
401 [e2fsprogs_cv_have_llseek_prototype=no],
402 [e2fsprogs_cv_have_llseek_prototype=yes]))
403 AC_MSG_RESULT($e2fsprogs_cv_have_llseek_prototype)
404 if test "$e2fsprogs_cv_have_llseek_prototype" = yes; then
405 AC_DEFINE(HAVE_LLSEEK_PROTOTYPE)
408 dnl Check to see if lseek64() is declared in unistd.h. Glibc's header files
409 dnl are so convoluted that I can't tell whether it will always be defined,
410 dnl and if it isn't defined while lseek64 is defined in the library,
411 dnl disaster will strike.
413 dnl Warning! Use of --enable-gcc-wall may throw off this test.
416 AC_MSG_CHECKING(whether lseek64 declared in unistd.h)
417 AC_CACHE_VAL(e2fsprogs_cv_have_lseek64_prototype,
419 [#define _LARGEFILE_SOURCE
420 #define _LARGEFILE64_SOURCE
421 #include <unistd.h>], [extern int lseek64(int);],
422 [e2fsprogs_cv_have_lseek64_prototype=no],
423 [e2fsprogs_cv_have_lseek64_prototype=yes]))
424 AC_MSG_RESULT($e2fsprogs_cv_have_lseek64_prototype)
425 if test "$e2fsprogs_cv_have_lseek64_prototype" = yes; then
426 AC_DEFINE(HAVE_LSEEK64_PROTOTYPE)
431 if test "$cross_compiling" = yes -a "$ac_cv_sizeof_long" = ""; then
432 # if cross-compiling, with no cached values, just assume something common.
436 ac_cv_sizeof_long_long=8
437 AC_MSG_WARN([Cross-compiling, so cannot check type sizes; assuming short=2, int=4, long=4, long long=8])
439 AC_CHECK_SIZEOF(short)
441 AC_CHECK_SIZEOF(long)
442 AC_CHECK_SIZEOF(long long)
443 SIZEOF_SHORT=$ac_cv_sizeof_short
444 SIZEOF_INT=$ac_cv_sizeof_int
445 SIZEOF_LONG=$ac_cv_sizeof_long
446 SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
447 AC_SUBST(SIZEOF_SHORT)
449 AC_SUBST(SIZEOF_LONG)
450 AC_SUBST(SIZEOF_LONG_LONG)
452 dnl See if struct stat has a st_flags field, in which case we can get file
453 dnl flags somewhat portably. Also check for the analogous setter, chflags().
455 AC_MSG_CHECKING(whether struct stat has a st_flags field)
456 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
457 AC_TRY_COMPILE([#include <sys/stat.h>],
458 [struct stat stat; stat.st_flags = 0;],
459 [e2fsprogs_cv_struct_st_flags=yes],
460 [e2fsprogs_cv_struct_st_flags=no]))
461 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
462 if test "$e2fsprogs_cv_struct_st_flags" = yes; then
463 AC_MSG_CHECKING(whether st_flags field is useful)
464 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags_immut,
465 AC_TRY_COMPILE([#include <sys/stat.h>],
466 [struct stat stat; stat.st_flags |= UF_IMMUTABLE;],
467 [e2fsprogs_cv_struct_st_flags_immut=yes],
468 [e2fsprogs_cv_struct_st_flags_immut=no]))
469 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags_immut)
470 if test "$e2fsprogs_cv_struct_st_flags_immut" = yes; then
471 AC_DEFINE(HAVE_STAT_FLAGS)
474 AC_CHECK_FUNCS(chflags getrusage llseek lseek64 open64 strdup getmntinfo strcasecmp srandom fchown mallinfo fdatasync)
476 dnl Check to see if -lsocket is required (solaris) to make something
477 dnl that uses socket() to compile; this is needed for the UUID library
480 AC_CHECK_LIB(socket, socket, [SOCKET_LIB=-lsocket])
483 dnl See if optreset exists
485 AC_MSG_CHECKING(for optreset)
486 AC_CACHE_VAL(ac_cv_have_optreset,
487 [AC_EGREP_HEADER(optreset, unistd.h,
488 ac_cv_have_optreset=yes, ac_cv_have_optreset=no)])dnl
489 AC_MSG_RESULT($ac_cv_have_optreset)
490 if test $ac_cv_have_optreset = yes; then
491 AC_DEFINE(HAVE_OPTRESET)
494 dnl We use the EXT2 ioctls only under Linux
498 AC_DEFINE(HAVE_EXT2_IOCTLS)
502 dnl Linux and Hurd places root files in the / by default
506 if test "$prefix" = NONE -a "$root_prefix" = NONE ; then
508 echo "On $host_os systems, root_prefix defaults to ''"
513 dnl On Linux/hurd, force the prefix to be /usr
517 if test "$prefix" = NONE ; then
519 echo "On $host_os systems, prefix defaults to /usr"
523 if test "$root_prefix" = NONE ; then
524 if test "$prefix" = NONE ; then
525 root_prefix="$ac_default_prefix"
527 root_prefix="$prefix"
530 AC_SUBST(root_prefix)
532 dnl See if -static works.
534 AC_MSG_CHECKING([whether linker accepts -static])
535 AC_CACHE_VAL(ac_cv_e2fsprogs_use_static,
536 [SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -static"
537 AC_TRY_LINK([#include <stdio.h>],[fflush(stdout);],
538 ac_cv_e2fsprogs_use_static=yes, ac_cv_e2fsprogs_use_static=no)
539 LDFLAGS=$SAVE_LDFLAGS])
541 dnl Regardless of how the test turns out, Solaris doesn't handle -static
542 dnl This is caused by the socket library requiring the nsl library, which
543 dnl requires the -dl library, which only works for dynamically linked
544 dnl programs. It basically means you can't have statically linked programs
545 dnl which use the network under Solaris.
549 ac_cv_e2fsprogs_use_static=no
552 AC_MSG_RESULT($ac_cv_e2fsprogs_use_static)
554 if test $ac_cv_e2fsprogs_use_static = yes; then
555 LDFLAG_STATIC=-static
557 AC_SUBST(LDFLAG_STATIC)
559 dnl Make the ss and et directories work correctly.
561 SS_DIR=`cd ${srcdir}/lib/ss; pwd`
562 ET_DIR=`cd ${srcdir}/lib/et; pwd`
566 dnl Only try to run the test suite if we're not cross compiling.
568 if test "$cross_compiling" = yes ; then
573 AC_SUBST(DO_TEST_SUITE)
575 dnl Make our output files, being sure that we create the some miscellaneous
578 test -d lib || mkdir lib
579 test -d include || mkdir include
580 test -d include/linux || mkdir include/linux
581 test -d include/asm || mkdir include/asm
583 if test -d ${srcdir}/resize ; then
584 rmakefile=resize/Makefile
586 AC_OUTPUT(MCONFIG Makefile util/Makefile util/subst.conf lib/et/Makefile
587 lib/ss/Makefile lib/ext2fs/Makefile lib/e2p/Makefile lib/uuid/Makefile
589 misc/Makefile e2fsck/Makefile debugfs/Makefile tests/Makefile
590 tests/progs/Makefile $rmakefile doc/Makefile
591 intl/Makefile po/Makefile.in)