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)
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)
79 dnl On systems without linux header files, we add an extra include directory
80 dnl that holds enough to fake it (hopefully). Note that the $(top_srcdir) here
81 dnl is quoted so that it gets expanded by make, not by configure.
83 AC_CHECK_HEADER(linux/fs.h, [linux_headers=yes], [linux_headers=no])
84 if test "$linux_headers" != yes; then
85 LINUX_INCLUDE='-I$(top_builddir)/include'
87 AC_SUBST(LINUX_INCLUDE)
89 dnl Set default values for library extentions. Will be dealt with after
90 dnl parsing configuration opions, which may modify these
96 dnl set $(LDFLAGS) from --with-ldopts=value
99 [ --with-ldopts=LDOPTS select linker command line options],
100 AC_MSG_RESULT(LDFLAGS is $withval)
105 dnl Allow separate `root_prefix' to be specified
107 AC_ARG_WITH([root-prefix],
108 [ --with-root-prefix=PREFIX override prefix variable for files to be placed in the root],
109 root_prefix=$withval,
112 dnl handle --enable-compression
114 AC_ARG_ENABLE([compression],
115 [ --enable-compression enable EXPERIMENTAL compression support],
116 if test "$enableval" = "no"
118 echo "Disabling compression support"
120 AC_DEFINE(ENABLE_COMPRESSION)
121 echo "Enabling compression support"
122 echo "WARNING: Compression support is experimental"
125 echo "Disabling compression support by default"
128 dnl handle --enable-htree
130 AC_ARG_ENABLE([htree],
131 [ --enable-htree enable EXPERIMENTAL htree directory support],
132 if test "$enableval" = "no"
135 echo "Disabling htree directory support"
138 AC_DEFINE(ENABLE_HTREE)
139 echo "Enabling htree directory support"
143 AC_DEFINE(ENABLE_HTREE)
144 echo "Enabling htree directory support by default"
148 dnl handle --enable-clear-htree
150 AC_ARG_ENABLE([htree-clear],
151 [ --enable-htree-clear clear htree because we don't trust e2fsck],
152 if test "$enableval" = "no"
155 echo "Disabling htree clearing"
158 AC_DEFINE(ENABLE_HTREE_CLEAR)
159 echo "Enabling htree clearing"
163 echo "Disabling htree clearing by default"
165 AC_SUBST(HTREE_CLR_CMT)
167 dnl handle --enable-emvs-10
170 AC_ARG_ENABLE([evms-10],
171 [ --enable-evms-10 use EVMS 1.0 ABI (instead of EVMS 1.2)],
172 if test "$enableval" != "no"
175 echo "Enabling EVMS 1.0.0 ABI"
179 dnl handle --enable-emvs-11
181 AC_ARG_ENABLE([evms-11],
182 [ --enable-evms-11 use EVMS 1.1 ABI (instead of EVMS 1.1)],
183 if test "$enableval" != "no"
186 echo "Enabling EVMS 1.1.0 ABI"
189 if test "$EVMS_ABI_CODE" = "120"
191 echo "Using EVMS 1.2.0 ABI by default"
193 AC_SUBST(EVMS_ABI_CODE)
195 dnl handle --enable-dll-shlibs
197 AC_ARG_ENABLE([dll-shlibs],
198 [ --enable-dll-shlibs select DLL libraries],
199 if test "$enableval" = "no"
202 MAKEFILE_DLL=/dev/null
203 echo "Disabling DLL shared libraries"
206 MAKEFILE_DLL=$srcdir/lib/Makefile.dll-lib
209 echo "Enabling DLL shared libraries"
212 MAKEFILE_DLL=/dev/null
214 echo "Disabling DLL shared libraries by default"
217 AC_SUBST_FILE(MAKEFILE_DLL)
219 dnl handle --enable-elf-shlibs
221 AC_ARG_ENABLE([elf-shlibs],
222 [ --enable-elf-shlibs select ELF shared libraries],
223 if test "$enableval" = "no"
226 MAKEFILE_ELF=/dev/null
227 echo "Disabling ELF shared libraries"
230 MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib
233 MAKEFILE_ELF=$srcdir/lib/Makefile.solaris-lib
238 echo "Enabling ELF shared libraries"
241 MAKEFILE_ELF=/dev/null
243 echo "Disabling ELF shared libraries by default"
246 AC_SUBST_FILE(MAKEFILE_ELF)
248 dnl handle --enable-bsd-shlibs
250 AC_ARG_ENABLE([bsd-shlibs],
251 [ --enable-bsd-shlibs select BSD shared libraries],
252 if test "$enableval" = "no"
255 MAKEFILE_BSDLIB=/dev/null
256 echo "Disabling BSD shared libraries"
259 MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib
263 MAKEFILE_BSDLIB=$srcdir/lib/Makefile.darwin-lib
267 echo "Enabling BSD shared libraries"
270 MAKEFILE_BSDLIB=/dev/null
272 echo "Disabling BSD shared libraries by default"
275 AC_SUBST_FILE(MAKEFILE_BSDLIB)
277 dnl handle --enable-profile
279 AC_ARG_ENABLE([profile],
280 [ --enable-profile build profiling libraries],
281 if test "$enableval" = "no"
284 MAKEFILE_PROFILE=/dev/null
285 echo "Disabling profiling libraries"
288 MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile
289 PROFILED_LIB_EXT=_p.a
290 echo "Building profiling libraries"
294 MAKEFILE_PROFILE=/dev/null
295 echo "Disabling profiling libraries by default"
297 AC_SUBST(PROFILE_CMT)
298 AC_SUBST_FILE(MAKEFILE_PROFILE)
300 dnl handle --enable-checker
302 AC_ARG_ENABLE([checker],
303 [ --enable-checker build checker libraries],
304 if test "$enableval" = "no"
307 MAKEFILE_CHECKER=/dev/null
308 echo "Disabling checker libraries"
311 MAKEFILE_CHECKER=$srcdir/lib/Makefile.checker
312 echo "Building checker libraries"
316 MAKEFILE_CHECKER=/dev/null
317 echo "Disabling checker libraries by default"
319 AC_SUBST(CHECKER_CMT)
320 AC_SUBST_FILE(MAKEFILE_CHECKER)
322 dnl Substitute library extensions
325 AC_SUBST(STATIC_LIB_EXT)
326 AC_SUBST(PROFILED_LIB_EXT)
328 dnl handle --enable-jbd-debug
330 AC_ARG_ENABLE([jbd-debug],
331 [ --enable-jbd-debug enable journal debugging],
332 if test "$enableval" = "no"
334 echo "Disabling journal debugging"
336 AC_DEFINE(CONFIG_JBD_DEBUG)
337 echo "Enabling journal debugging"
340 echo "Disabling journal debugging by default"
343 dnl handle --enable-blkid-debug
345 AC_ARG_ENABLE([blkid-debug],
346 [ --enable-blkid-debug enable blkid debugging],
347 if test "$enableval" = "no"
349 echo "Disabling blkid debugging"
351 AC_DEFINE(CONFIG_BLKID_DEBUG)
352 echo "Enabling blkid debugging"
355 echo "Disabling blkid debugging by default"
358 dnl handle --enable-swapfs
360 AC_ARG_ENABLE([swapfs],
361 [ --disable-swapfs disable support of legacy byte-swapped filesystems],
362 if test "$enableval" = "no"
365 echo "Disabling swapfs support"
368 AC_DEFINE(ENABLE_SWAPFS)
369 echo "Enabling swapfs support"
373 echo "Enabling swapfs support by default"
374 AC_DEFINE(ENABLE_SWAPFS)
378 dnl handle --enable-debugfs
380 AC_ARG_ENABLE([debugfs],
381 [ --disable-debugfs disable support of debugfs program],
382 if test "$enableval" = "no"
384 echo "Disabling debugfs support"
388 echo "Enabling debugfs support"
391 echo "Enabling debugfs support by default"
394 AC_SUBST(DEBUGFS_CMT)
396 dnl handle --enable-imager
398 AC_ARG_ENABLE([imager],
399 [ --disable-imager disable support of e2image program],
400 if test "$enableval" = "no"
402 echo "Disabling e2image support"
406 echo "Enabling e2image support"
409 echo "Enabling e2image support by default"
414 dnl handle --enable-resizer
416 AC_ARG_ENABLE([resizer],
417 [ --disable-resizer disable support of e2resize program],
418 if test "$enableval" = "no"
420 echo "Disabling e2resize support"
424 echo "Enabling e2resize support"
427 echo "Enabling e2resize support by default"
430 AC_SUBST(RESIZER_CMT)
432 dnl handle --enable-dynamic-e2fsck
434 AC_ARG_ENABLE([dynamic-e2fsck],
435 [ --enable-dynamic-e2fsck build e2fsck dynamically],
436 if test "$enableval" = "no"
439 echo "Building e2fsck statically"
442 echo "Building e2fsck dynamically"
446 echo "Building e2fsck statically by default"
448 AC_SUBST(E2FSCK_TYPE)
450 dnl See whether to install the `fsck' wrapper program (that calls e2fsck)
452 AC_ARG_ENABLE([fsck],
453 [ --enable-fsck build fsck wrapper program],
454 [if test "$enableval" = "no"
456 FSCK_PROG='' FSCK_MAN=''
457 echo "Not building fsck wrapper"
459 FSCK_PROG=fsck FSCK_MAN=fsck.8
460 echo "Building fsck wrapper"
465 FSCK_PROG='' FSCK_MAN=''
466 echo "Not building fsck wrapper by default"
469 FSCK_PROG=fsck FSCK_MAN=fsck.8
470 echo "Building fsck wrapper by default"
477 MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
478 AC_SUBST_FILE(MAKEFILE_LIBRARY)
481 AC_ARG_ENABLE([old-bitops],
482 [ --enable-old-bitops Use old (non-standard but native) bitmask operations],
483 if test "$enableval" = "no"
485 echo "Using new (standard) bitmask operations"
487 AC_DEFINE(EXT2_OLD_BITOPS)
488 echo "Using old (native) bitmask operations"
492 echo "Using standard bitmask operations by default"
495 dnl Add internationalization support, using gettext.
498 VERSION="$E2FSPROGS_VERSION"
499 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
500 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
504 ALL_LINGUAS="it nyc tr de de-utf"
507 dnl End of configuration options
509 AC_SUBST(BINARY_TYPE)
511 AC_PATH_PROG(LN, ln, ln)
513 AC_PATH_PROG(MV, mv, mv)
514 AC_PATH_PROG(CP, cp, cp)
515 AC_PATH_PROG(RM, rm, rm)
516 AC_PATH_PROG(CHMOD, chmod, :)
517 AC_PATH_PROG(AWK, awk, awk)
518 AC_PATH_PROG(SED, sed, sed)
519 AC_PATH_PROG(PERL, perl, perl)
520 AC_PATH_PROG(LDCONFIG, ldconfig, :)
521 AC_CHECK_TOOL(AR, ar, ar)
522 AC_CHECK_TOOL(RANLIB, ranlib, :)
523 AC_CHECK_TOOL(STRIP, strip, :)
525 # See if we need a separate native compiler.
526 if test $cross_compiling = no; then
530 AC_CHECK_PROGS(BUILD_CC, gcc cc)
532 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)
535 dnl Check to see if llseek() is declared in unistd.h. On some libc's
536 dnl it is, and on others it isn't..... Thank you glibc developers....
538 dnl Warning! Use of --enable-gcc-wall may throw off this test.
541 AC_MSG_CHECKING(whether llseek declared in unistd.h)
542 AC_CACHE_VAL(e2fsprogs_cv_have_llseek_prototype,
544 [#include <unistd.h>], [extern int llseek(int);],
545 [e2fsprogs_cv_have_llseek_prototype=no],
546 [e2fsprogs_cv_have_llseek_prototype=yes]))
547 AC_MSG_RESULT($e2fsprogs_cv_have_llseek_prototype)
548 if test "$e2fsprogs_cv_have_llseek_prototype" = yes; then
549 AC_DEFINE(HAVE_LLSEEK_PROTOTYPE)
552 dnl Check to see if lseek64() is declared in unistd.h. Glibc's header files
553 dnl are so convoluted that I can't tell whether it will always be defined,
554 dnl and if it isn't defined while lseek64 is defined in the library,
555 dnl disaster will strike.
557 dnl Warning! Use of --enable-gcc-wall may throw off this test.
560 AC_MSG_CHECKING(whether lseek64 declared in unistd.h)
561 AC_CACHE_VAL(e2fsprogs_cv_have_lseek64_prototype,
563 [#define _LARGEFILE_SOURCE
564 #define _LARGEFILE64_SOURCE
565 #include <unistd.h>], [extern int lseek64(int);],
566 [e2fsprogs_cv_have_lseek64_prototype=no],
567 [e2fsprogs_cv_have_lseek64_prototype=yes]))
568 AC_MSG_RESULT($e2fsprogs_cv_have_lseek64_prototype)
569 if test "$e2fsprogs_cv_have_lseek64_prototype" = yes; then
570 AC_DEFINE(HAVE_LSEEK64_PROTOTYPE)
575 if test "$cross_compiling" = yes -a "$ac_cv_sizeof_long" = ""; then
576 # if cross-compiling, with no cached values, just assume something common.
580 ac_cv_sizeof_long_long=8
581 AC_MSG_WARN([Cross-compiling, so cannot check type sizes; assuming short=2, int=4, long=4, long long=8])
583 AC_CHECK_SIZEOF(short)
585 AC_CHECK_SIZEOF(long)
586 AC_CHECK_SIZEOF(long long)
587 SIZEOF_SHORT=$ac_cv_sizeof_short
588 SIZEOF_INT=$ac_cv_sizeof_int
589 SIZEOF_LONG=$ac_cv_sizeof_long
590 SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
591 AC_SUBST(SIZEOF_SHORT)
593 AC_SUBST(SIZEOF_LONG)
594 AC_SUBST(SIZEOF_LONG_LONG)
597 dnl See if struct stat has a st_flags field, in which case we can get file
598 dnl flags somewhat portably. Also check for the analogous setter, chflags().
600 AC_MSG_CHECKING(whether struct stat has a st_flags field)
601 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
602 AC_TRY_COMPILE([#include <sys/stat.h>],
603 [struct stat stat; stat.st_flags = 0;],
604 [e2fsprogs_cv_struct_st_flags=yes],
605 [e2fsprogs_cv_struct_st_flags=no]))
606 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
607 if test "$e2fsprogs_cv_struct_st_flags" = yes; then
608 AC_MSG_CHECKING(whether st_flags field is useful)
609 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags_immut,
610 AC_TRY_COMPILE([#include <sys/stat.h>],
611 [struct stat stat; stat.st_flags |= UF_IMMUTABLE;],
612 [e2fsprogs_cv_struct_st_flags_immut=yes],
613 [e2fsprogs_cv_struct_st_flags_immut=no]))
614 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags_immut)
615 if test "$e2fsprogs_cv_struct_st_flags_immut" = yes; then
616 AC_DEFINE(HAVE_STAT_FLAGS)
619 AC_CHECK_FUNCS(chflags getrusage llseek lseek64 open64 getmntinfo strtoull strcasecmp srandom fchown mallinfo fdatasync strnlen sysconf pathconf)
621 dnl Check to see if -lsocket is required (solaris) to make something
622 dnl that uses socket() to compile; this is needed for the UUID library
625 AC_CHECK_LIB(socket, socket, [SOCKET_LIB=-lsocket])
628 dnl See if optreset exists
630 AC_MSG_CHECKING(for optreset)
631 AC_CACHE_VAL(ac_cv_have_optreset,
632 [AC_EGREP_HEADER(optreset, unistd.h,
633 ac_cv_have_optreset=yes, ac_cv_have_optreset=no)])dnl
634 AC_MSG_RESULT($ac_cv_have_optreset)
635 if test $ac_cv_have_optreset = yes; then
636 AC_DEFINE(HAVE_OPTRESET)
639 dnl We use the EXT2 ioctls only under Linux
643 AC_DEFINE(HAVE_EXT2_IOCTLS)
647 dnl Uncomment only if Linux
657 dnl Linux and Hurd places root files in the / by default
661 if test "$prefix" = NONE -a "$root_prefix" = NONE ; then
663 echo "On $host_os systems, root_prefix defaults to ''"
668 dnl On Linux/hurd, force the prefix to be /usr
672 if test "$prefix" = NONE ; then
674 echo "On $host_os systems, prefix defaults to /usr"
675 if test "$mandir" = '${prefix}/man' ; then
676 echo "...and mandir defaults to /usr/share/man"
677 mandir=/usr/share/man
682 if test "$root_prefix" = NONE ; then
683 if test "$prefix" = NONE ; then
684 root_prefix="$ac_default_prefix"
686 root_prefix="$prefix"
689 root_sbindir=$sbindir
691 root_sysconfdir=$sysconfdir
693 root_bindir='${root_prefix}/bin'
694 root_sbindir='${root_prefix}/sbin'
695 root_libdir='${root_prefix}/lib'
696 root_sysconfdir='${root_prefix}/etc'
698 AC_SUBST(root_prefix)
699 AC_SUBST(root_bindir)
700 AC_SUBST(root_sbindir)
701 AC_SUBST(root_libdir)
702 AC_SUBST(root_sysconfdir)
704 dnl See if -static works.
706 AC_MSG_CHECKING([whether linker accepts -static])
707 AC_CACHE_VAL(ac_cv_e2fsprogs_use_static,
708 [SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -static"
709 AC_TRY_LINK([#include <stdio.h>],[fflush(stdout);],
710 ac_cv_e2fsprogs_use_static=yes, ac_cv_e2fsprogs_use_static=no)
711 LDFLAGS=$SAVE_LDFLAGS])
713 dnl Regardless of how the test turns out, Solaris doesn't handle -static
714 dnl This is caused by the socket library requiring the nsl library, which
715 dnl requires the -dl library, which only works for dynamically linked
716 dnl programs. It basically means you can't have statically linked programs
717 dnl which use the network under Solaris.
721 ac_cv_e2fsprogs_use_static=no
724 AC_MSG_RESULT($ac_cv_e2fsprogs_use_static)
726 if test $ac_cv_e2fsprogs_use_static = yes; then
727 LDFLAG_STATIC=-static
729 AC_SUBST(LDFLAG_STATIC)
731 dnl Make the ss and et directories work correctly.
733 SS_DIR=`cd ${srcdir}/lib/ss; pwd`
734 ET_DIR=`cd ${srcdir}/lib/et; pwd`
738 dnl Only try to run the test suite if we're not cross compiling.
740 if test "$cross_compiling" = yes ; then
745 AC_SUBST(DO_TEST_SUITE)
747 dnl Make our output files, being sure that we create the some miscellaneous
750 test -d lib || mkdir lib
751 test -d include || mkdir include
752 test -d include/linux || mkdir include/linux
753 test -d include/asm || mkdir include/asm
754 for i in MCONFIG Makefile util/Makefile util/subst.conf lib/et/Makefile \
755 lib/ss/Makefile lib/ext2fs/Makefile lib/e2p/Makefile \
756 lib/uuid/Makefile lib/uuid/uuid_types.h \
757 lib/blkid/Makefile lib/blkid/blkid_types.h \
758 lib/evms/Makefile misc/Makefile ext2ed/Makefile e2fsck/Makefile \
759 debugfs/Makefile tests/Makefile tests/progs/Makefile \
760 resize/Makefile doc/Makefile intl/Makefile po/Makefile.in ; do
761 if test -d `dirname ${srcdir}/$i` ; then
762 outlist="$outlist $i"