3 AC_CONFIG_AUX_DIR(config)
8 dnl This is to figure out the version number and the date....
10 E2FSPROGS_VERSION=`grep E2FSPROGS_VERSION ${srcdir}/version.h \
11 | awk '{print $3}' | tr \" " " | awk '{print $1}'`
12 DATE=`grep E2FSPROGS_DATE ${srcdir}/version.h | awk '{print $3}' \
14 E2FSPROGS_DAY=`echo $DATE | awk -F- '{print $1}'`
15 MONTH=`echo $DATE | awk -F- '{print $2}'`
16 YEAR=`echo $DATE | awk -F- '{print $3}'`
18 if expr $YEAR ">" 1900 > /dev/null ; then
20 elif expr $YEAR ">" 90 >/dev/null ; then
21 E2FSPROGS_YEAR=19$YEAR
23 E2FSPROGS_YEAR=20$YEAR
27 Jan) MONTH_NUM=01; E2FSPROGS_MONTH="January" ;;
28 Feb) MONTH_NUM=02; E2FSPROGS_MONTH="February" ;;
29 Mar) MONTH_NUM=03; E2FSPROGS_MONTH="March" ;;
30 Apr) MONTH_NUM=04; E2FSPROGS_MONTH="April" ;;
31 May) MONTH_NUM=05; E2FSPROGS_MONTH="May" ;;
32 Jun) MONTH_NUM=06; E2FSPROGS_MONTH="June" ;;
33 Jul) MONTH_NUM=07; E2FSPROGS_MONTH="July" ;;
34 Aug) MONTH_NUM=08; E2FSPROGS_MONTH="August" ;;
35 Sep) MONTH_NUM=09; E2FSPROGS_MONTH="September" ;;
36 Oct) MONTH_NUM=10; E2FSPROGS_MONTH="October" ;;
37 Nov) MONTH_NUM=11; E2FSPROGS_MONTH="November" ;;
38 Dec) MONTH_NUM=12; E2FSPROGS_MONTH="December" ;;
39 *) AC_MSG_WARN([Unknown month $MONTH??]) ;;
42 base_ver=`echo $E2FSPROGS_VERSION | \
43 sed -e 's/-WIP//' -e 's/pre-//' -e 's/-PLUS//'`
45 date_spec=${E2FSPROGS_YEAR}.${MONTH_NUM}.${E2FSPROGS_DAY}
47 case $E2FSPROGS_VERSION in
49 E2FSPROGS_PKGVER="$base_ver~WIP-$E2FSPROGS_YEAR-$MONTH_NUM-$E2FSPROGS_DAY"
52 E2FSPROGS_PKGVER="$base_ver"
56 unset DATE MONTH YEAR base_ver pre_vers date_spec
57 AC_MSG_RESULT([Generating configuration file for e2fsprogs version $E2FSPROGS_VERSION])
58 AC_MSG_RESULT([Release date is ${E2FSPROGS_MONTH}, ${E2FSPROGS_YEAR}])
59 AC_SUBST(E2FSPROGS_YEAR)
60 AC_SUBST(E2FSPROGS_MONTH)
61 AC_SUBST(E2FSPROGS_DAY)
62 AC_SUBST(E2FSPROGS_VERSION)
63 AC_SUBST(E2FSPROGS_PKGVER)
66 dnl Check to see if libdl exists for the sake of dlopen
69 AC_CHECK_LIB(dl, dlopen,
71 AC_DEFINE(HAVE_DLOPEN)])
77 AC_ARG_WITH([diet-libc],
78 [ --with-diet-libc use diet libc],
79 CC="diet cc -nostdinc"
81 AC_MSG_RESULT(CC=$CC))dnl
84 AC_HELP_STRING([--with-cc],[no longer supported, use CC= instead]),
85 AC_MSG_ERROR([--with-cc no longer supported; use CC= instead]))
88 AC_HELP_STRING([--with-ccopts],[no longer supported, use CFLAGS= instead]),
89 AC_MSG_ERROR([--with-ccopts no longer supported; use CFLAGS= instead]))
92 AC_HELP_STRING([--with-ldopts],[no longer supported, use LDFLAGS= instead]),
93 AC_MSG_ERROR([--with-ldopts no longer supported; use LDFLAGS= instead]))
96 if test "$GCC" = yes; then
102 dnl On systems without linux header files, we add an extra include directory
103 dnl that holds enough to fake it (hopefully). Note that the $(top_srcdir) here
104 dnl is quoted so that it gets expanded by make, not by configure.
106 AC_CHECK_HEADER(linux/fs.h, [linux_headers=yes], [linux_headers=no])
107 if test "$linux_headers" != yes; then
108 LINUX_INCLUDE='-I$(top_builddir)/include'
110 AC_SUBST(LINUX_INCLUDE)
112 dnl Alpha computers use fast and imprecise floating point code that may
113 dnl miss exceptions by default. Force sane options if we're using GCC.
114 AC_MSG_CHECKING(for additional special compiler flags)
118 alpha) addcflags="-mieee" ;;
121 if test "x$addcflags" != x
123 AC_MSG_RESULT($addcflags)
124 CFLAGS="$addcflags $CFLAGS"
126 AC_MSG_RESULT([[(none)]])
129 dnl Set default values for library extentions. Will be dealt with after
130 dnl parsing configuration opions, which may modify these
136 dnl Allow separate `root_prefix' to be specified
138 AC_ARG_WITH([root-prefix],
139 [ --with-root-prefix=PREFIX override prefix variable for files to be placed in the root],
140 root_prefix=$withval,
143 dnl handle --enable-maintainer-mode
145 AC_ARG_ENABLE([maintainer-mode],
146 [ --enable-maintainer-mode enable makefile rules useful for maintainers],
147 if test "$enableval" = "no"
150 AC_MSG_RESULT([Disabling maintainer mode])
153 AC_MSG_RESULT([Enabling maintainer mode])
157 AC_MSG_RESULT([Disabling maintainer mode by default])
159 AC_SUBST(MAINTAINER_CMT)
161 dnl handle --enable-symlink-install
163 AC_ARG_ENABLE([symlink-install],
164 [ --enable-symlink-install use symlinks when installing instead of hard links],
165 if test "$enableval" = "no"
167 LINK_INSTALL_FLAGS=-f
168 AC_MSG_RESULT([Disabling symlinks for install])
170 LINK_INSTALL_FLAGS=-sf
171 AC_MSG_RESULT([Enabling symlinks for install])
174 LINK_INSTALL_FLAGS=-f
175 AC_MSG_RESULT([Disabling symlinks for install])
177 AC_SUBST(LINK_INSTALL_FLAGS)
179 dnl handle --enable-symlink-build
181 AC_ARG_ENABLE([symlink-build],
182 [ --enable-symlink-build use symlinks while building instead of hard links],
183 if test "$enableval" = "no"
186 AC_MSG_RESULT([Disabling symlinks for build])
189 AC_MSG_RESULT([Enabling symlinks for build])
193 AC_MSG_RESULT([Disabling symlinks for build])
195 AC_SUBST(LINK_BUILD_FLAGS)
197 dnl handle --enable-verbose-makecmds
199 AC_ARG_ENABLE([verbose-makecmds],
200 [ --enable-verbose-makecmds enable verbose make command output],
201 if test "$enableval" = "no"
203 AC_MSG_RESULT([Disabling verbose make commands])
207 AC_MSG_RESULT([Enabling verbose make commands])
212 AC_MSG_RESULT([Disabling verbose make commands])
219 dnl handle --enable-compression
221 AC_ARG_ENABLE([compression],
222 [ --enable-compression enable EXPERIMENTAL compression support],
223 if test "$enableval" = "no"
225 AC_MSG_RESULT([Disabling compression support])
227 AC_DEFINE(ENABLE_COMPRESSION)
228 AC_MSG_RESULT([Enabling compression support])
229 AC_MSG_WARN([Compression support is experimental])
232 AC_MSG_RESULT([Disabling compression support by default])
235 dnl handle --enable-htree
237 AC_ARG_ENABLE([htree],
238 [ --enable-htree enable EXPERIMENTAL htree directory support],
239 if test "$enableval" = "no"
242 AC_MSG_RESULT([Disabling htree directory support])
245 AC_DEFINE(ENABLE_HTREE)
246 AC_MSG_RESULT([Enabling htree directory support])
250 AC_DEFINE(ENABLE_HTREE)
251 AC_MSG_RESULT([Enabling htree directory support by default])
255 dnl This needs to be before all of the --enable-*-shlibs options
257 E2_PKG_CONFIG_STATIC=--static
261 dnl handle --enable-elf-shlibs
263 AC_ARG_ENABLE([elf-shlibs],
264 [ --enable-elf-shlibs select ELF shared libraries],
265 if test "$enableval" = "no"
268 MAKEFILE_ELF=/dev/null
269 AC_MSG_RESULT([Disabling ELF shared libraries])
271 E2_PKG_CONFIG_STATIC=
273 MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib
276 MAKEFILE_ELF=$srcdir/lib/Makefile.solaris-lib
282 LDFLAG_DYNAMIC=['-Wl,-rpath-link,$(top_builddir)/lib']
283 AC_MSG_RESULT([Enabling ELF shared libraries])
286 MAKEFILE_ELF=/dev/null
288 AC_MSG_RESULT([Disabling ELF shared libraries by default])
291 AC_SUBST_FILE(MAKEFILE_ELF)
293 dnl handle --enable-bsd-shlibs
295 AC_ARG_ENABLE([bsd-shlibs],
296 [ --enable-bsd-shlibs select BSD shared libraries],
297 if test "$enableval" = "no"
300 MAKEFILE_BSDLIB=/dev/null
301 AC_MSG_RESULT([Disabling BSD shared libraries])
303 E2_PKG_CONFIG_STATIC=
305 MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib
309 MAKEFILE_BSDLIB=$srcdir/lib/Makefile.darwin-lib
313 AC_MSG_RESULT([Enabling BSD shared libraries])
316 MAKEFILE_BSDLIB=/dev/null
318 AC_MSG_RESULT([Disabling BSD shared libraries by default])
321 AC_SUBST_FILE(MAKEFILE_BSDLIB)
323 dnl handle --enable-profile
325 AC_ARG_ENABLE([profile],
326 [ --enable-profile build profiling libraries],
327 if test "$enableval" = "no"
330 MAKEFILE_PROFILE=/dev/null
331 AC_MSG_RESULT([Disabling profiling libraries])
334 MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile
335 PROFILED_LIB_EXT=_p.a
336 AC_MSG_RESULT([Building profiling libraries])
340 MAKEFILE_PROFILE=/dev/null
341 AC_MSG_RESULT([Disabling profiling libraries by default])
343 AC_SUBST(PROFILE_CMT)
344 AC_SUBST_FILE(MAKEFILE_PROFILE)
346 dnl handle --enable-checker
348 AC_ARG_ENABLE([checker],
349 [ --enable-checker build checker libraries],
350 if test "$enableval" = "no"
353 MAKEFILE_CHECKER=/dev/null
354 AC_MSG_RESULT([Disabling checker libraries])
357 MAKEFILE_CHECKER=$srcdir/lib/Makefile.checker
358 AC_MSG_RESULT([Building checker libraries])
362 MAKEFILE_CHECKER=/dev/null
363 AC_MSG_RESULT([Disabling checker libraries by default])
365 AC_SUBST(CHECKER_CMT)
366 AC_SUBST_FILE(MAKEFILE_CHECKER)
368 dnl Substitute library extensions
371 AC_SUBST(STATIC_LIB_EXT)
372 AC_SUBST(PROFILED_LIB_EXT)
373 AC_SUBST(LDFLAG_DYNAMIC)
374 AC_SUBST(PRIVATE_LIBS_CMT)
376 dnl handle --enable-jbd-debug
378 AC_ARG_ENABLE([jbd-debug],
379 [ --enable-jbd-debug enable journal debugging],
380 if test "$enableval" = "no"
382 AC_MSG_RESULT([Disabling journal debugging])
384 AC_DEFINE(CONFIG_JBD_DEBUG)
385 AC_MSG_RESULT([Enabling journal debugging])
388 AC_MSG_RESULT([Disabling journal debugging by default])
391 dnl handle --enable-blkid-debug
393 AC_ARG_ENABLE([blkid-debug],
394 [ --enable-blkid-debug enable blkid debugging],
395 if test "$enableval" = "no"
397 AC_MSG_RESULT([Disabling blkid debugging])
399 AC_DEFINE(CONFIG_BLKID_DEBUG)
400 AC_MSG_RESULT([Enabling blkid debugging])
403 AC_MSG_RESULT([Disabling blkid debugging by default])
406 dnl handle --enable-testio-debug
408 AC_ARG_ENABLE([testio-debug],
409 [ --disable-testio-debug disable the use of the test I/O manager for debugging],
410 if test "$enableval" = "no"
412 AC_MSG_RESULT([Disabling testio debugging])
416 AC_DEFINE(CONFIG_TESTIO_DEBUG)
417 AC_MSG_RESULT([Enabling testio debugging])
420 AC_MSG_RESULT([Enabling testio debugging by default])
421 AC_DEFINE(CONFIG_TESTIO_DEBUG)
424 AC_SUBST(TEST_IO_CMT)
426 dnl handle --disable-libuuid
436 AC_ARG_ENABLE([libuuid],
437 [ --disable-libuuid do not build private uuid library],
438 if test "$enableval" = "no"
440 if test -z "$PKG_CONFIG"; then
441 AC_MSG_ERROR([pkg-config not installed; please install it.])
444 AC_CHECK_LIB(uuid, uuid_generate,
445 [LIBUUID=`$PKG_CONFIG --libs uuid`;
446 STATIC_LIBUUID=`$PKG_CONFIG --static --libs uuid`],
447 [AC_MSG_ERROR([external uuid library not found])],
450 AC_MSG_RESULT([Disabling private uuid library])
452 LIBUUID='$(LIB)/libuuid'$LIB_EXT
454 STATIC_LIBUUID='$(LIB)/libuuid'$STATIC_LIB_EXT
455 DEPSTATIC_LIBUUID=$STATIC_LIBUUID
456 PROFILED_LIBUUID='$(LIB)/libuuid'$PROFILED_LIB_EXT
457 DEPPROFILED_LIBUUID=$PROFILED_LIBUUID
458 AC_MSG_RESULT([Enabling private uuid library])
461 LIBUUID='$(LIB)/libuuid'$LIB_EXT
463 STATIC_LIBUUID='$(LIB)/libuuid'$STATIC_LIB_EXT
464 DEPSTATIC_LIBUUID=$STATIC_LIBUUID
465 PROFILED_LIBUUID='$(LIB)/libuuid'$PROFILED_LIB_EXT
466 DEPPROFILED_LIBUUID=$PROFILED_LIBUUID
467 AC_MSG_RESULT([Enabling private uuid library by default])
471 AC_SUBST(STATIC_LIBUUID)
472 AC_SUBST(DEPSTATIC_LIBUUID)
473 AC_SUBST(PROFILED_LIBUUID)
474 AC_SUBST(DEPPROFILED_LIBUUID)
477 dnl handle --disable-libblkid
485 DEPPROFILED_LIBBLKID=
487 AC_ARG_ENABLE([libblkid],
488 [ --disable-libblkid do not build private blkid library],
489 if test "$enableval" = "no"
491 if test -z "$PKG_CONFIG"; then
492 AC_MSG_ERROR([pkg-config not installed; please install it.])
495 AC_CHECK_LIB(blkid, blkid_get_cache,
496 [LIBBLKID=`$PKG_CONFIG --libs blkid`;
497 STATIC_LIBBLKID=`$PKG_CONFIG --static --libs blkid`],
498 [AC_MSG_ERROR([external blkid library not found])],
501 AC_MSG_RESULT([Disabling private blkid library])
503 LIBBLKID='$(LIB)/libblkid'$LIB_EXT
504 DEPLIBBLKID=$LIBBLKID
505 STATIC_LIBBLKID='$(LIB)/libblkid'$STATIC_LIB_EXT
506 DEPSTATIC_LIBBLKID=$STATIC_LIBBLKID
507 PROFILED_LIBBLKID='$(LIB)/libblkid'$PROFILED_LIB_EXT
508 DEPPROFILED_LIBBLKID=$PROFILED_LIBBLKID
509 AC_DEFINE(CONFIG_BUILD_FINDFS)
510 AC_MSG_RESULT([Enabling private blkid library])
513 LIBBLKID='$(LIB)/libblkid'$LIB_EXT
514 DEPLIBBLKID=$LIBBLKID
515 STATIC_LIBBLKID='$(LIB)/libblkid'$STATIC_LIB_EXT
516 DEPSTATIC_LIBBLKID=$STATIC_LIBBLKID
517 PROFILED_LIBBLKID='$(LIB)/libblkid'$PROFILED_LIB_EXT
518 DEPPROFILED_LIBBLKID=$PROFILED_LIBBLKID
519 AC_DEFINE(CONFIG_BUILD_FINDFS)
520 AC_MSG_RESULT([Enabling private blkid library by default])
523 AC_SUBST(DEPLIBBLKID)
524 AC_SUBST(STATIC_LIBBLKID)
525 AC_SUBST(DEPSTATIC_LIBBLKID)
526 AC_SUBST(PROFILED_LIBBLKID)
527 AC_SUBST(DEPPROFILED_LIBBLKID)
530 dnl handle --enable-debugfs
532 AC_ARG_ENABLE([debugfs],
533 [ --disable-debugfs disable support of debugfs program],
534 if test "$enableval" = "no"
536 AC_MSG_RESULT([Disabling debugfs support])
540 AC_MSG_RESULT([Enabling debugfs support])
543 AC_MSG_RESULT([Enabling debugfs support by default])
546 AC_SUBST(DEBUGFS_CMT)
548 dnl handle --enable-imager
550 AC_ARG_ENABLE([imager],
551 [ --disable-imager disable support of e2image program],
552 if test "$enableval" = "no"
554 AC_MSG_RESULT([Disabling e2image support])
558 AC_MSG_RESULT([Enabling e2image support])
561 AC_MSG_RESULT([Enabling e2image support by default])
566 dnl handle --enable-resizer
568 AC_ARG_ENABLE([resizer],
569 [ --disable-resizer disable support of e2resize program],
570 if test "$enableval" = "no"
572 AC_MSG_RESULT([Disabling e2resize support])
576 AC_MSG_RESULT([Enabling e2resize support])
579 AC_MSG_RESULT([Enabling e2resize support by default])
582 AC_SUBST(RESIZER_CMT)
584 dnl handle --enable-defrag
586 AC_ARG_ENABLE([defrag],
587 [ --disable-defrag disable support of e4defrag program],
588 if test "$enableval" = "no"
590 AC_MSG_RESULT([Disabling e4defrag support])
594 AC_MSG_RESULT([Enabling e4defrag support])
597 AC_MSG_RESULT([Enabling e4defrag support by default])
602 dnl See whether to install the `fsck' wrapper program (that calls e2fsck)
604 AC_ARG_ENABLE([fsck],
605 [ --enable-fsck build fsck wrapper program],
606 [if test "$enableval" = "no"
608 FSCK_PROG='' FSCK_MAN=''
609 AC_MSG_RESULT([Not building fsck wrapper])
611 FSCK_PROG=fsck FSCK_MAN=fsck.8
612 AC_MSG_RESULT([Building fsck wrapper])
617 FSCK_PROG='' FSCK_MAN=''
618 AC_MSG_RESULT([Not building fsck wrapper by default])
621 FSCK_PROG=fsck FSCK_MAN=fsck.8
622 AC_MSG_RESULT([Building fsck wrapper by default])
628 dnl See whether to install the `e2initrd-helper' program
630 AC_ARG_ENABLE([e2initrd-helper],
631 [ --enable-e2initrd-helper build e2initrd-helper program],
632 [if test "$enableval" = "no"
634 E2INITRD_PROG='' E2INITRD_MAN=''
635 AC_MSG_RESULT([Not building e2initrd helper])
637 E2INITRD_PROG=e2initrd_helper E2INITRD_MAN=e2initrd_helper.8
638 AC_MSG_RESULT([Building e2initrd helper])
641 E2INITRD_PROG=e2initrd_helper E2INITRD_MAN=e2initrd_helper.8
642 AC_MSG_RESULT([Building e2initrd helper by default])
644 AC_SUBST(E2INITRD_PROG)
645 AC_SUBST(E2INITRD_MAN)
650 [ --disable-tls disable use of thread local support],
651 [if test "$enableval" = "no"
654 AC_MSG_RESULT([Disabling thread local support])
657 AC_MSG_RESULT([Enabling thread local support])
660 if test -n "$WITH_DIET_LIBC"
663 AC_MSG_RESULT([Diet libc does not support thread local support])
666 AC_MSG_RESULT([Try using thread local support by default])
669 if test "$try_tls" = "yes"
676 AC_ARG_ENABLE([uuidd],
677 [ --disable-uuidd disable building the uuid daemon],
678 [if test "$enableval" = "no"
680 AC_MSG_RESULT([Not building uuidd])
685 AC_MSG_RESULT([Building uuidd])
690 AC_MSG_RESULT([Building uuidd by default])
696 MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
697 AC_SUBST_FILE(MAKEFILE_LIBRARY)
699 dnl Add internationalization support, using gettext.
701 GETTEXT_PACKAGE=e2fsprogs
703 VERSION="$E2FSPROGS_VERSION"
705 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
706 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
707 AC_SUBST(GETTEXT_PACKAGE)
713 dnl End of configuration options
715 AC_SUBST(BINARY_TYPE)
718 AC_PATH_PROG(LN, ln, ln)
720 AC_PATH_PROG(MV, mv, mv)
721 AC_PATH_PROG(CP, cp, cp)
722 AC_PATH_PROG(RM, rm, rm)
723 AC_PATH_PROG(CHMOD, chmod, :)
726 AC_PATH_PROG(SED, sed, sed)
727 AC_PATH_PROG(PERL, perl, perl)
728 AC_PATH_PROG(LDCONFIG, ldconfig, :)
729 AC_CHECK_TOOL(AR, ar, ar)
730 AC_CHECK_TOOL(RANLIB, ranlib, :)
731 AC_CHECK_TOOL(STRIP, strip, :)
732 AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, )
733 if test "_$MAKEINFO" = "_"; then
734 MAKEINFO="@echo Makeinfo is missing. Info documentation will not be built.;true"
739 *** Makeinfo is missing. Info documentation will not be built.])
747 # See if we need a separate native compiler.
748 if test $cross_compiling = no; then
752 AC_CHECK_PROGS(BUILD_CC, gcc cc)
754 AC_CHECK_HEADERS(dirent.h errno.h execinfo.h getopt.h malloc.h mntent.h paths.h semaphore.h setjmp.h signal.h stdarg.h stdint.h stdlib.h termios.h termio.h unistd.h utime.h linux/fd.h linux/major.h net/if_dl.h netinet/in.h sys/disklabel.h sys/file.h sys/ioctl.h sys/mkdev.h sys/mman.h sys/prctl.h sys/queue.h sys/resource.h sys/select.h sys/socket.h sys/sockio.h sys/stat.h sys/syscall.h sys/sysmacros.h sys/time.h sys/types.h sys/un.h sys/wait.h)
755 AC_CHECK_HEADERS(sys/disk.h sys/mount.h,,,
758 #include <sys/queue.h>
761 AC_CHECK_HEADERS(net/if.h,,,
764 #include <sys/types.h>
767 #include <sys/socket.h>
771 dnl Check to see if dirent has member d_reclen. On cygwin those d_reclen
772 dnl is not decleared.
773 AC_CHECK_MEMBER(struct dirent.d_reclen,[AC_DEFINE(HAVE_RECLEN_DIRENT)],,
774 [#include <dirent.h>])
775 dnl Check to see if ssize_t was decleared
776 AC_CHECK_TYPE(ssize_t,[AC_DEFINE(HAVE_TYPE_SSIZE_T)],,
777 [#include <sys/types.h>])
779 dnl Check to see if llseek() is declared in unistd.h. On some libc's
780 dnl it is, and on others it isn't..... Thank you glibc developers....
782 AC_CHECK_DECL(llseek,[AC_DEFINE(HAVE_LLSEEK_PROTOTYPE)],,
783 [#include <unistd.h>])
785 dnl Check to see if lseek64() is declared in unistd.h. Glibc's header files
786 dnl are so convoluted that I can't tell whether it will always be defined,
787 dnl and if it isn't defined while lseek64 is defined in the library,
788 dnl disaster will strike.
790 dnl Warning! Use of --enable-gcc-wall may throw off this test.
793 AC_CHECK_DECL(lseek64,[AC_DEFINE(HAVE_LSEEK64_PROTOTYPE)],,
794 [#define _LARGEFILE_SOURCE
795 #define _LARGEFILE64_SOURCE
796 #include <unistd.h>])
800 AC_CHECK_SIZEOF(short)
802 AC_CHECK_SIZEOF(long)
803 AC_CHECK_SIZEOF(long long)
804 SIZEOF_SHORT=$ac_cv_sizeof_short
805 SIZEOF_INT=$ac_cv_sizeof_int
806 SIZEOF_LONG=$ac_cv_sizeof_long
807 SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
808 AC_SUBST(SIZEOF_SHORT)
810 AC_SUBST(SIZEOF_LONG)
811 AC_SUBST(SIZEOF_LONG_LONG)
813 BUILD_CC="$BUILD_CC" CPP="$CPP" /bin/sh $ac_aux_dir/parse-types.sh
814 ASM_TYPES_HEADER=./asm_types.h
815 AC_SUBST_FILE(ASM_TYPES_HEADER)
817 dnl Save the configuration #defines needed for the public ext2fs.h
820 echo "/* These defines are needed for the public ext2fs.h header file */" \
822 if grep HAVE_SYS_TYPES_H confdefs.h > tmp_config.$$; then
823 uniq tmp_config.$$ >> public_config.h
825 echo "#undef HAVE_SYS_TYPES_H" >> public_config.h
827 if grep WORDS_BIGENDIAN confdefs.h > tmp_config.$$; then
828 uniq tmp_config.$$ >> public_config.h
830 echo "#undef WORDS_BIGENDIAN" >> public_config.h
833 PUBLIC_CONFIG_HEADER=./public_config.h
834 AC_SUBST_FILE(PUBLIC_CONFIG_HEADER)
836 dnl See if we have inttypes.h and if intptr_t is defined
838 AC_CHECK_HEADERS([inttypes.h])
839 AC_CHECK_TYPES(intptr_t)
841 dnl See if struct stat has a st_flags field, in which case we can get file
842 dnl flags somewhat portably. Also check for the analogous setter, chflags().
844 AC_MSG_CHECKING(whether struct stat has a st_flags field)
845 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
846 AC_TRY_COMPILE([#include <sys/stat.h>],
847 [struct stat stat; stat.st_flags = 0;],
848 [e2fsprogs_cv_struct_st_flags=yes],
849 [e2fsprogs_cv_struct_st_flags=no]))
850 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
851 if test "$e2fsprogs_cv_struct_st_flags" = yes; then
852 AC_MSG_CHECKING(whether st_flags field is useful)
853 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags_immut,
854 AC_TRY_COMPILE([#include <sys/stat.h>],
855 [struct stat stat; stat.st_flags |= UF_IMMUTABLE;],
856 [e2fsprogs_cv_struct_st_flags_immut=yes],
857 [e2fsprogs_cv_struct_st_flags_immut=no]))
858 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags_immut)
859 if test "$e2fsprogs_cv_struct_st_flags_immut" = yes; then
860 AC_DEFINE(HAVE_STAT_FLAGS)
864 dnl Check for the presence of SA_LEN
866 AC_CHECK_MEMBER(struct sockaddr.sa_len,
867 AC_DEFINE_UNQUOTED(HAVE_SA_LEN,1,[Define if struct sockaddr contains sa_len]),,
868 [#include <sys/types.h>
869 #include <sys/socket.h>])
871 dnl This will add -lblkid to the AC_CHECK_FUNCS search if we are using
872 dnl the system-provided blkid library
874 if test -n "$BLKID_CMT"; then
875 AC_SEARCH_LIBS([blkid_probe_all], [blkid])
878 AC_CHECK_FUNCS(chflags getrusage llseek lseek64 open64 fstat64 ftruncate64 getmntinfo strtoull strcasecmp srandom jrand48 fchown mallinfo fdatasync strnlen strptime strdup sysconf pathconf posix_memalign memalign valloc __secure_getenv prctl mmap utime setresuid setresgid usleep nanosleep getdtablesize getrlimit sync_file_range posix_fadvise fallocate fallocate64 blkid_probe_get_topology mbstowcs backtrace)
880 dnl Check to see if -lsocket is required (solaris) to make something
881 dnl that uses socket() to compile; this is needed for the UUID library
884 AC_CHECK_LIB(socket, socket, [SOCKET_LIB=-lsocket])
887 dnl See if optreset exists
889 AC_MSG_CHECKING(for optreset)
890 AC_CACHE_VAL(ac_cv_have_optreset,
891 [AC_EGREP_HEADER(optreset, unistd.h,
892 ac_cv_have_optreset=yes, ac_cv_have_optreset=no)])dnl
893 AC_MSG_RESULT($ac_cv_have_optreset)
894 if test $ac_cv_have_optreset = yes; then
895 AC_DEFINE(HAVE_OPTRESET)
898 dnl Test for sem_init, and which library it might require:
901 AC_CHECK_FUNC(sem_init, ,
902 AC_CHECK_LIB(pthread, sem_init,
903 AC_DEFINE(HAVE_SEM_INIT)
904 SEM_INIT_LIB=-lpthread,
905 AC_CHECK_LIB(rt, sem_init,
906 AC_DEFINE(HAVE_SEM_INIT)
908 AC_CHECK_LIB(posix4, sem_init,
909 AC_DEFINE(HAVE_SEM_INIT)
910 SEM_INIT_LIB=-lposix4))))dnl
911 AC_SUBST(SEM_INIT_LIB)
913 dnl Check for unified diff
915 AC_MSG_CHECKING(for unified diff option)
916 if diff -u $0 $0 > /dev/null 2>&1 ; then
921 AC_MSG_RESULT($UNI_DIFF_OPTS)
922 AC_SUBST(UNI_DIFF_OPTS)
924 dnl We use the EXT2 ioctls only under Linux
928 AC_DEFINE(HAVE_EXT2_IOCTLS)
932 dnl OS-specific uncomment control
950 dnl Linux and Hurd places root files in the / by default
953 linux* | gnu* | k*bsd*-gnu)
954 if test "$prefix" = NONE -a "$root_prefix" = NONE ; then
956 AC_MSG_RESULT([On $host_os systems, root_prefix defaults to ''])
961 dnl On Linux/hurd, force the prefix to be /usr
964 linux* | gnu* | k*bsd*-gnu)
965 if test "$prefix" = NONE ; then
967 AC_MSG_RESULT([On $host_os systems, prefix defaults to /usr])
968 if test "$mandir" = '${prefix}/man' ; then
969 AC_MSG_RESULT([...and mandir defaults to /usr/share/man])
970 mandir=/usr/share/man
975 if test "$root_prefix" = NONE ; then
976 if test "$prefix" = NONE ; then
977 root_prefix="$ac_default_prefix"
979 root_prefix="$prefix"
982 root_sbindir=$sbindir
984 root_sysconfdir=$sysconfdir
986 root_bindir='${root_prefix}/bin'
987 root_sbindir='${root_prefix}/sbin'
988 root_libdir='${root_prefix}/lib'
989 root_sysconfdir='${root_prefix}/etc'
991 if test "$bindir" != '${exec_prefix}/bin'; then
993 AC_MSG_RESULT([Setting root_bindir to $root_bindir])
995 if test "$sbindir" != '${exec_prefix}/sbin'; then
996 root_sbindir=$sbindir
997 AC_MSG_RESULT([Setting root_sbindir to $root_sbindir])
999 if test "$libdir" != '${exec_prefix}/lib'; then
1001 AC_MSG_RESULT([Setting root_libdir to $root_libdir])
1003 if test "$sysconfdir" != '${prefix}/etc'; then
1004 root_sysconfdir=$sysconfdir
1005 AC_MSG_RESULT([Setting root_sysconfdir to $root_sysconfdir])
1007 AC_SUBST(root_prefix)
1008 AC_SUBST(root_bindir)
1009 AC_SUBST(root_sbindir)
1010 AC_SUBST(root_libdir)
1011 AC_SUBST(root_sysconfdir)
1013 dnl See if -static works.
1015 AC_MSG_CHECKING([whether linker accepts -static])
1016 AC_CACHE_VAL(ac_cv_e2fsprogs_use_static,
1017 [SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -static"
1018 AC_TRY_LINK([#include <stdio.h>],[fflush(stdout);],
1019 ac_cv_e2fsprogs_use_static=yes, ac_cv_e2fsprogs_use_static=no)
1020 LDFLAGS=$SAVE_LDFLAGS])
1022 dnl Regardless of how the test turns out, Solaris doesn't handle -static
1023 dnl This is caused by the socket library requiring the nsl library, which
1024 dnl requires the -dl library, which only works for dynamically linked
1025 dnl programs. It basically means you can't have statically linked programs
1026 dnl which use the network under Solaris.
1030 ac_cv_e2fsprogs_use_static=no
1033 AC_MSG_RESULT($ac_cv_e2fsprogs_use_static)
1035 if test $ac_cv_e2fsprogs_use_static = yes; then
1036 LDFLAG_STATIC=-static
1038 AC_SUBST(LDFLAG_STATIC)
1040 dnl Work around mysterious Darwin / GNU libintl problem
1041 dnl (__asm__ redirection doesn't work for some mysterious reason. Looks like
1042 dnl Apple hacked gcc somehow?)
1046 AC_MSG_RESULT([Using Apple Darwin / GNU libintl workaround])
1047 AC_DEFINE(_INTL_REDIRECT_MACROS)
1051 dnl Make the ss and et directories work correctly.
1053 SS_DIR=`cd ${srcdir}/lib/ss; pwd`
1054 ET_DIR=`cd ${srcdir}/lib/et; pwd`
1058 dnl Only try to run the test suite if we're not cross compiling.
1060 if test "$cross_compiling" = yes ; then
1065 AC_SUBST(DO_TEST_SUITE)
1067 dnl Only include the intl include files if we're building with them
1070 if test "$USE_INCLUDED_LIBINTL" = "yes" ; then
1071 INTL_FLAGS='-I$(top_builddir)/intl -I$(top_srcdir)/intl'
1073 AC_SUBST(INTL_FLAGS)
1077 if test $cross_compiling = no; then
1078 BUILD_CFLAGS="$CFLAGS"
1079 BUILD_LDFLAGS="$LDFLAGS"
1084 AC_SUBST(BUILD_CFLAGS)
1085 AC_SUBST(BUILD_LDFLAGS)
1087 dnl Make our output files, being sure that we create the some miscellaneous
1090 test -d lib || mkdir lib
1091 test -d include || mkdir include
1092 test -d include/linux || mkdir include/linux
1093 test -d include/asm || mkdir include/asm
1094 for i in MCONFIG Makefile e2fsprogs.spec \
1095 util/Makefile util/subst.conf util/gen-tarball \
1096 lib/et/Makefile lib/ss/Makefile lib/e2p/Makefile \
1097 lib/ext2fs/Makefile lib/ext2fs/ext2_types.h \
1098 lib/uuid/Makefile lib/uuid/uuid_types.h \
1099 lib/blkid/Makefile lib/blkid/blkid_types.h \
1100 lib/ss/ss.pc lib/uuid/uuid.pc lib/et/com_err.pc \
1101 lib/e2p/e2p.pc lib/blkid/blkid.pc lib/ext2fs/ext2fs.pc \
1102 misc/Makefile ext2ed/Makefile e2fsck/Makefile \
1103 debugfs/Makefile tests/Makefile tests/progs/Makefile \
1104 resize/Makefile doc/Makefile intl/Makefile \
1105 intl/libgnuintl.h po/Makefile.in ; do
1106 if test -d `dirname ${srcdir}/$i` ; then
1107 outlist="$outlist $i"
1111 if test -f util/gen-tarball; then chmod +x util/gen-tarball; fi