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]))
98 dnl On systems without linux header files, we add an extra include directory
99 dnl that holds enough to fake it (hopefully). Note that the $(top_srcdir) here
100 dnl is quoted so that it gets expanded by make, not by configure.
102 AC_CHECK_HEADER(linux/fs.h, [linux_headers=yes], [linux_headers=no])
103 if test "$linux_headers" != yes; then
104 LINUX_INCLUDE='-I$(top_builddir)/include'
106 AC_SUBST(LINUX_INCLUDE)
108 dnl Alpha computers use fast and imprecise floating point code that may
109 dnl miss exceptions by default. Force sane options if we're using GCC.
110 AC_MSG_CHECKING(for additional special compiler flags)
114 alpha) addcflags="-mieee" ;;
117 if test "x$addcflags" != x
119 AC_MSG_RESULT($addcflags)
120 CFLAGS="$addcflags $CFLAGS"
122 AC_MSG_RESULT([[(none)]])
125 dnl Set default values for library extentions. Will be dealt with after
126 dnl parsing configuration opions, which may modify these
132 dnl Allow separate `root_prefix' to be specified
134 AC_ARG_WITH([root-prefix],
135 [ --with-root-prefix=PREFIX override prefix variable for files to be placed in the root],
136 root_prefix=$withval,
139 dnl handle --enable-maintainer-mode
141 AC_ARG_ENABLE([maintainer-mode],
142 [ --enable-maintainer-mode enable makefile rules useful for maintainers],
143 if test "$enableval" = "no"
146 AC_MSG_RESULT([Disabling maintainer mode])
149 AC_MSG_RESULT([Enabling maintainer mode])
153 AC_MSG_RESULT([Disabling maintainer mode by default])
155 AC_SUBST(MAINTAINER_CMT)
157 dnl handle --enable-symlink-install
159 AC_ARG_ENABLE([symlink-install],
160 [ --enable-symlink-install use symlinks when installing instead of hard links],
161 if test "$enableval" = "no"
163 LINK_INSTALL_FLAGS=-f
164 AC_MSG_RESULT([Disabling symlinks for install])
166 LINK_INSTALL_FLAGS=-sf
167 AC_MSG_RESULT([Enabling symlinks for install])
170 LINK_INSTALL_FLAGS=-f
171 AC_MSG_RESULT([Disabling symlinks for install])
173 AC_SUBST(LINK_INSTALL_FLAGS)
175 dnl handle --enable-symlink-build
177 AC_ARG_ENABLE([symlink-build],
178 [ --enable-symlink-build use symlinks while building instead of hard links],
179 if test "$enableval" = "no"
182 AC_MSG_RESULT([Disabling symlinks for build])
185 AC_MSG_RESULT([Enabling symlinks for build])
189 AC_MSG_RESULT([Disabling symlinks for build])
191 AC_SUBST(LINK_BUILD_FLAGS)
193 dnl handle --enable-verbose-makecmds
195 AC_ARG_ENABLE([verbose-makecmds],
196 [ --enable-verbose-makecmds enable verbose make command output],
197 if test "$enableval" = "no"
199 AC_MSG_RESULT([Disabling verbose make commands])
203 AC_MSG_RESULT([Enabling verbose make commands])
208 AC_MSG_RESULT([Disabling verbose make commands])
215 dnl handle --enable-compression
217 AC_ARG_ENABLE([compression],
218 [ --enable-compression enable EXPERIMENTAL compression support],
219 if test "$enableval" = "no"
221 AC_MSG_RESULT([Disabling compression support])
223 AC_DEFINE(ENABLE_COMPRESSION)
224 AC_MSG_RESULT([Enabling compression support])
225 AC_MSG_WARN([Compression support is experimental])
228 AC_MSG_RESULT([Disabling compression support by default])
231 dnl handle --enable-htree
233 AC_ARG_ENABLE([htree],
234 [ --enable-htree enable EXPERIMENTAL htree directory support],
235 if test "$enableval" = "no"
238 AC_MSG_RESULT([Disabling htree directory support])
241 AC_DEFINE(ENABLE_HTREE)
242 AC_MSG_RESULT([Enabling htree directory support])
246 AC_DEFINE(ENABLE_HTREE)
247 AC_MSG_RESULT([Enabling htree directory support by default])
251 dnl This needs to be before all of the --enable-*-shlibs options
253 E2_PKG_CONFIG_STATIC=--static
257 dnl handle --enable-elf-shlibs
259 AC_ARG_ENABLE([elf-shlibs],
260 [ --enable-elf-shlibs select ELF shared libraries],
261 if test "$enableval" = "no"
264 MAKEFILE_ELF=/dev/null
265 AC_MSG_RESULT([Disabling ELF shared libraries])
267 E2_PKG_CONFIG_STATIC=
269 MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib
272 MAKEFILE_ELF=$srcdir/lib/Makefile.solaris-lib
278 LDFLAG_DYNAMIC=['-Wl,-rpath-link,$(top_builddir)/lib']
279 AC_MSG_RESULT([Enabling ELF shared libraries])
282 MAKEFILE_ELF=/dev/null
284 AC_MSG_RESULT([Disabling ELF shared libraries by default])
287 AC_SUBST_FILE(MAKEFILE_ELF)
289 dnl handle --enable-bsd-shlibs
291 AC_ARG_ENABLE([bsd-shlibs],
292 [ --enable-bsd-shlibs select BSD shared libraries],
293 if test "$enableval" = "no"
296 MAKEFILE_BSDLIB=/dev/null
297 AC_MSG_RESULT([Disabling BSD shared libraries])
299 E2_PKG_CONFIG_STATIC=
301 MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib
305 MAKEFILE_BSDLIB=$srcdir/lib/Makefile.darwin-lib
309 AC_MSG_RESULT([Enabling BSD shared libraries])
312 MAKEFILE_BSDLIB=/dev/null
314 AC_MSG_RESULT([Disabling BSD shared libraries by default])
317 AC_SUBST_FILE(MAKEFILE_BSDLIB)
319 dnl handle --enable-profile
321 AC_ARG_ENABLE([profile],
322 [ --enable-profile build profiling libraries],
323 if test "$enableval" = "no"
326 MAKEFILE_PROFILE=/dev/null
327 AC_MSG_RESULT([Disabling profiling libraries])
330 MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile
331 PROFILED_LIB_EXT=_p.a
332 AC_MSG_RESULT([Building profiling libraries])
336 MAKEFILE_PROFILE=/dev/null
337 AC_MSG_RESULT([Disabling profiling libraries by default])
339 AC_SUBST(PROFILE_CMT)
340 AC_SUBST_FILE(MAKEFILE_PROFILE)
342 dnl handle --enable-checker
344 AC_ARG_ENABLE([checker],
345 [ --enable-checker build checker libraries],
346 if test "$enableval" = "no"
349 MAKEFILE_CHECKER=/dev/null
350 AC_MSG_RESULT([Disabling checker libraries])
353 MAKEFILE_CHECKER=$srcdir/lib/Makefile.checker
354 AC_MSG_RESULT([Building checker libraries])
358 MAKEFILE_CHECKER=/dev/null
359 AC_MSG_RESULT([Disabling checker libraries by default])
361 AC_SUBST(CHECKER_CMT)
362 AC_SUBST_FILE(MAKEFILE_CHECKER)
364 dnl Substitute library extensions
367 AC_SUBST(STATIC_LIB_EXT)
368 AC_SUBST(PROFILED_LIB_EXT)
369 AC_SUBST(LDFLAG_DYNAMIC)
370 AC_SUBST(PRIVATE_LIBS_CMT)
372 dnl handle --enable-jbd-debug
374 AC_ARG_ENABLE([jbd-debug],
375 [ --enable-jbd-debug enable journal debugging],
376 if test "$enableval" = "no"
378 AC_MSG_RESULT([Disabling journal debugging])
380 AC_DEFINE(CONFIG_JBD_DEBUG)
381 AC_MSG_RESULT([Enabling journal debugging])
384 AC_MSG_RESULT([Disabling journal debugging by default])
387 dnl handle --enable-blkid-debug
389 AC_ARG_ENABLE([blkid-debug],
390 [ --enable-blkid-debug enable blkid debugging],
391 if test "$enableval" = "no"
393 AC_MSG_RESULT([Disabling blkid debugging])
395 AC_DEFINE(CONFIG_BLKID_DEBUG)
396 AC_MSG_RESULT([Enabling blkid debugging])
399 AC_MSG_RESULT([Disabling blkid debugging by default])
402 dnl handle --enable-testio-debug
404 AC_ARG_ENABLE([testio-debug],
405 [ --disable-testio-debug disable the use of the test I/O manager for debugging],
406 if test "$enableval" = "no"
408 AC_MSG_RESULT([Disabling testio debugging])
412 AC_DEFINE(CONFIG_TESTIO_DEBUG)
413 AC_MSG_RESULT([Enabling testio debugging])
416 AC_MSG_RESULT([Enabling testio debugging by default])
417 AC_DEFINE(CONFIG_TESTIO_DEBUG)
420 AC_SUBST(TEST_IO_CMT)
422 dnl handle --disable-libuuid
432 AC_ARG_ENABLE([libuuid],
433 [ --disable-libuuid do not build private uuid library],
434 if test "$enableval" = "no"
436 if test -z "$PKG_CONFIG"; then
437 AC_MSG_ERROR([pkg-config not installed; please install it.])
440 AC_CHECK_LIB(uuid, uuid_generate,
441 [LIBUUID=`$PKG_CONFIG --libs uuid`;
442 STATIC_LIBUUID=`$PKG_CONFIG --static --libs uuid`],
443 [AC_MSG_ERROR([external uuid library not found])],
446 AC_MSG_RESULT([Disabling private uuid library])
448 LIBUUID='$(LIB)/libuuid'$LIB_EXT
450 STATIC_LIBUUID='$(LIB)/libuuid'$STATIC_LIB_EXT
451 DEPSTATIC_LIBUUID=$STATIC_LIBUUID
452 PROFILED_LIBUUID='$(LIB)/libuuid'$PROFILED_LIB_EXT
453 DEPPROFILED_LIBUUID=$PROFILED_LIBUUID
454 AC_MSG_RESULT([Enabling private uuid library])
457 LIBUUID='$(LIB)/libuuid'$LIB_EXT
459 STATIC_LIBUUID='$(LIB)/libuuid'$STATIC_LIB_EXT
460 DEPSTATIC_LIBUUID=$STATIC_LIBUUID
461 PROFILED_LIBUUID='$(LIB)/libuuid'$PROFILED_LIB_EXT
462 DEPPROFILED_LIBUUID=$PROFILED_LIBUUID
463 AC_MSG_RESULT([Enabling private uuid library by default])
467 AC_SUBST(STATIC_LIBUUID)
468 AC_SUBST(DEPSTATIC_LIBUUID)
469 AC_SUBST(PROFILED_LIBUUID)
470 AC_SUBST(DEPPROFILED_LIBUUID)
473 dnl handle --disable-libblkid
481 DEPPROFILED_LIBBLKID=
483 AC_ARG_ENABLE([libblkid],
484 [ --disable-libblkid do not build private blkid library],
485 if test "$enableval" = "no"
487 if test -z "$PKG_CONFIG"; then
488 AC_MSG_ERROR([pkg-config not installed; please install it.])
491 AC_CHECK_LIB(blkid, blkid_get_cache,
492 [LIBBLKID=`$PKG_CONFIG --libs blkid`;
493 STATIC_LIBBLKID=`$PKG_CONFIG --static --libs blkid`],
494 [AC_MSG_ERROR([external blkid library not found])],
497 AC_MSG_RESULT([Disabling private blkid library])
499 LIBBLKID='$(LIB)/libblkid'$LIB_EXT
500 DEPLIBBLKID=$LIBBLKID
501 STATIC_LIBBLKID='$(LIB)/libblkid'$STATIC_LIB_EXT
502 DEPSTATIC_LIBBLKID=$STATIC_LIBBLKID
503 PROFILED_LIBBLKID='$(LIB)/libblkid'$PROFILED_LIB_EXT
504 DEPPROFILED_LIBBLKID=$PROFILED_LIBBLKID
505 AC_DEFINE(CONFIG_BUILD_FINDFS)
506 AC_MSG_RESULT([Enabling private blkid library])
509 LIBBLKID='$(LIB)/libblkid'$LIB_EXT
510 DEPLIBBLKID=$LIBBLKID
511 STATIC_LIBBLKID='$(LIB)/libblkid'$STATIC_LIB_EXT
512 DEPSTATIC_LIBBLKID=$STATIC_LIBBLKID
513 PROFILED_LIBBLKID='$(LIB)/libblkid'$PROFILED_LIB_EXT
514 DEPPROFILED_LIBBLKID=$PROFILED_LIBBLKID
515 AC_DEFINE(CONFIG_BUILD_FINDFS)
516 AC_MSG_RESULT([Enabling private blkid library by default])
519 AC_SUBST(DEPLIBBLKID)
520 AC_SUBST(STATIC_LIBBLKID)
521 AC_SUBST(DEPSTATIC_LIBBLKID)
522 AC_SUBST(PROFILED_LIBBLKID)
523 AC_SUBST(DEPPROFILED_LIBBLKID)
526 dnl handle --enable-debugfs
528 AC_ARG_ENABLE([debugfs],
529 [ --disable-debugfs disable support of debugfs program],
530 if test "$enableval" = "no"
532 AC_MSG_RESULT([Disabling debugfs support])
536 AC_MSG_RESULT([Enabling debugfs support])
539 AC_MSG_RESULT([Enabling debugfs support by default])
542 AC_SUBST(DEBUGFS_CMT)
544 dnl handle --enable-imager
546 AC_ARG_ENABLE([imager],
547 [ --disable-imager disable support of e2image program],
548 if test "$enableval" = "no"
550 AC_MSG_RESULT([Disabling e2image support])
554 AC_MSG_RESULT([Enabling e2image support])
557 AC_MSG_RESULT([Enabling e2image support by default])
562 dnl handle --enable-resizer
564 AC_ARG_ENABLE([resizer],
565 [ --disable-resizer disable support of e2resize program],
566 if test "$enableval" = "no"
568 AC_MSG_RESULT([Disabling e2resize support])
572 AC_MSG_RESULT([Enabling e2resize support])
575 AC_MSG_RESULT([Enabling e2resize support by default])
578 AC_SUBST(RESIZER_CMT)
580 dnl See whether to install the `fsck' wrapper program (that calls e2fsck)
582 AC_ARG_ENABLE([fsck],
583 [ --enable-fsck build fsck wrapper program],
584 [if test "$enableval" = "no"
586 FSCK_PROG='' FSCK_MAN=''
587 AC_MSG_RESULT([Not building fsck wrapper])
589 FSCK_PROG=fsck FSCK_MAN=fsck.8
590 AC_MSG_RESULT([Building fsck wrapper])
595 FSCK_PROG='' FSCK_MAN=''
596 AC_MSG_RESULT([Not building fsck wrapper by default])
599 FSCK_PROG=fsck FSCK_MAN=fsck.8
600 AC_MSG_RESULT([Building fsck wrapper by default])
606 dnl See whether to install the `e2initrd-helper' program
608 AC_ARG_ENABLE([e2initrd-helper],
609 [ --enable-e2initrd-helper build e2initrd-helper program],
610 [if test "$enableval" = "no"
612 E2INITRD_PROG='' E2INITRD_MAN=''
613 AC_MSG_RESULT([Not building e2initrd helper])
615 E2INITRD_PROG=e2initrd_helper E2INITRD_MAN=e2initrd_helper.8
616 AC_MSG_RESULT([Building e2initrd helper])
619 E2INITRD_PROG=e2initrd_helper E2INITRD_MAN=e2initrd_helper.8
620 AC_MSG_RESULT([Building e2initrd helper by default])
622 AC_SUBST(E2INITRD_PROG)
623 AC_SUBST(E2INITRD_MAN)
628 [ --disable-tls disable use of thread local support],
629 [if test "$enableval" = "no"
632 AC_MSG_RESULT([Disabling thread local support])
635 AC_MSG_RESULT([Enabling thread local support])
638 if test -n "$WITH_DIET_LIBC"
641 AC_MSG_RESULT([Diet libc does not support thread local support])
644 AC_MSG_RESULT([Try using thread local support by default])
647 if test "$try_tls" = "yes"
654 AC_ARG_ENABLE([uuidd],
655 [ --disable-uuidd disable building the uuid daemon],
656 [if test "$enableval" = "no"
658 AC_MSG_RESULT([Not building uuidd])
663 AC_MSG_RESULT([Building uuidd])
668 AC_MSG_RESULT([Building uuidd by default])
674 MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
675 AC_SUBST_FILE(MAKEFILE_LIBRARY)
677 dnl Add internationalization support, using gettext.
679 GETTEXT_PACKAGE=e2fsprogs
681 VERSION="$E2FSPROGS_VERSION"
683 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
684 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
685 AC_SUBST(GETTEXT_PACKAGE)
691 dnl End of configuration options
693 AC_SUBST(BINARY_TYPE)
696 AC_PATH_PROG(LN, ln, ln)
698 AC_PATH_PROG(MV, mv, mv)
699 AC_PATH_PROG(CP, cp, cp)
700 AC_PATH_PROG(RM, rm, rm)
701 AC_PATH_PROG(CHMOD, chmod, :)
704 AC_PATH_PROG(SED, sed, sed)
705 AC_PATH_PROG(PERL, perl, perl)
706 AC_PATH_PROG(LDCONFIG, ldconfig, :)
707 AC_CHECK_TOOL(AR, ar, ar)
708 AC_CHECK_TOOL(RANLIB, ranlib, :)
709 AC_CHECK_TOOL(STRIP, strip, :)
710 AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, )
711 if test "_$MAKEINFO" = "_"; then
712 MAKEINFO="@echo Makeinfo is missing. Info documentation will not be built.;true"
717 *** Makeinfo is missing. Info documentation will not be built.])
725 # See if we need a separate native compiler.
726 if test $cross_compiling = no; then
730 AC_CHECK_PROGS(BUILD_CC, gcc cc)
732 AC_CHECK_HEADERS(dirent.h errno.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)
733 AC_CHECK_HEADERS(sys/disk.h sys/mount.h,,,
736 #include <sys/queue.h>
739 AC_CHECK_HEADERS(net/if.h,,,
742 #include <sys/types.h>
745 #include <sys/socket.h>
749 dnl Check to see if dirent has member d_reclen. On cygwin those d_reclen
750 dnl is not decleared.
751 AC_CHECK_MEMBER(struct dirent.d_reclen,[AC_DEFINE(HAVE_RECLEN_DIRENT)],,
752 [#include <dirent.h>])
753 dnl Check to see if ssize_t was decleared
754 AC_CHECK_TYPE(ssize_t,[AC_DEFINE(HAVE_TYPE_SSIZE_T)],,
755 [#include <sys/types.h>])
757 dnl Check to see if llseek() is declared in unistd.h. On some libc's
758 dnl it is, and on others it isn't..... Thank you glibc developers....
760 AC_CHECK_DECL(llseek,[AC_DEFINE(HAVE_LLSEEK_PROTOTYPE)],,
761 [#include <unistd.h>])
763 dnl Check to see if lseek64() is declared in unistd.h. Glibc's header files
764 dnl are so convoluted that I can't tell whether it will always be defined,
765 dnl and if it isn't defined while lseek64 is defined in the library,
766 dnl disaster will strike.
768 dnl Warning! Use of --enable-gcc-wall may throw off this test.
771 AC_CHECK_DECL(lseek64,[AC_DEFINE(HAVE_LSEEK64_PROTOTYPE)],,
772 [#define _LARGEFILE_SOURCE
773 #define _LARGEFILE64_SOURCE
774 #include <unistd.h>])
778 AC_CHECK_SIZEOF(short)
780 AC_CHECK_SIZEOF(long)
781 AC_CHECK_SIZEOF(long long)
782 SIZEOF_SHORT=$ac_cv_sizeof_short
783 SIZEOF_INT=$ac_cv_sizeof_int
784 SIZEOF_LONG=$ac_cv_sizeof_long
785 SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
786 AC_SUBST(SIZEOF_SHORT)
788 AC_SUBST(SIZEOF_LONG)
789 AC_SUBST(SIZEOF_LONG_LONG)
791 BUILD_CC="$BUILD_CC" CPP="$CPP" /bin/sh $ac_aux_dir/parse-types.sh
792 ASM_TYPES_HEADER=./asm_types.h
793 AC_SUBST_FILE(ASM_TYPES_HEADER)
795 dnl Save the configuration #defines needed for the public ext2fs.h
798 echo "/* These defines are needed for the public ext2fs.h header file */" \
800 if grep HAVE_SYS_TYPES_H confdefs.h > tmp_config.$$; then
801 uniq tmp_config.$$ >> public_config.h
803 echo "#undef HAVE_SYS_TYPES_H" >> public_config.h
805 if grep WORDS_BIGENDIAN confdefs.h > tmp_config.$$; then
806 uniq tmp_config.$$ >> public_config.h
808 echo "#undef WORDS_BIGENDIAN" >> public_config.h
811 PUBLIC_CONFIG_HEADER=./public_config.h
812 AC_SUBST_FILE(PUBLIC_CONFIG_HEADER)
814 dnl See if we have inttypes.h and if intptr_t is defined
816 AC_CHECK_HEADERS([inttypes.h])
817 AC_CHECK_TYPES(intptr_t)
819 dnl See if struct stat has a st_flags field, in which case we can get file
820 dnl flags somewhat portably. Also check for the analogous setter, chflags().
822 AC_MSG_CHECKING(whether struct stat has a st_flags field)
823 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
824 AC_TRY_COMPILE([#include <sys/stat.h>],
825 [struct stat stat; stat.st_flags = 0;],
826 [e2fsprogs_cv_struct_st_flags=yes],
827 [e2fsprogs_cv_struct_st_flags=no]))
828 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
829 if test "$e2fsprogs_cv_struct_st_flags" = yes; then
830 AC_MSG_CHECKING(whether st_flags field is useful)
831 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags_immut,
832 AC_TRY_COMPILE([#include <sys/stat.h>],
833 [struct stat stat; stat.st_flags |= UF_IMMUTABLE;],
834 [e2fsprogs_cv_struct_st_flags_immut=yes],
835 [e2fsprogs_cv_struct_st_flags_immut=no]))
836 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags_immut)
837 if test "$e2fsprogs_cv_struct_st_flags_immut" = yes; then
838 AC_DEFINE(HAVE_STAT_FLAGS)
842 dnl Check for the presence of SA_LEN
844 AC_CHECK_MEMBER(struct sockaddr.sa_len,
845 AC_DEFINE_UNQUOTED(HAVE_SA_LEN,1,[Define if struct sockaddr contains sa_len]),,
846 [#include <sys/types.h>
847 #include <sys/socket.h>])
849 dnl This will add -lblkid to the AC_CHECK_FUNCS search if we are using
850 dnl the system-provided blkid library
852 if test -n "$BLKID_CMT"; then
853 AC_SEARCH_LIBS([blkid_probe_all], [blkid])
856 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 blkid_probe_get_topology)
858 dnl Check to see if -lsocket is required (solaris) to make something
859 dnl that uses socket() to compile; this is needed for the UUID library
862 AC_CHECK_LIB(socket, socket, [SOCKET_LIB=-lsocket])
865 dnl See if optreset exists
867 AC_MSG_CHECKING(for optreset)
868 AC_CACHE_VAL(ac_cv_have_optreset,
869 [AC_EGREP_HEADER(optreset, unistd.h,
870 ac_cv_have_optreset=yes, ac_cv_have_optreset=no)])dnl
871 AC_MSG_RESULT($ac_cv_have_optreset)
872 if test $ac_cv_have_optreset = yes; then
873 AC_DEFINE(HAVE_OPTRESET)
876 dnl Test for sem_init, and which library it might require:
879 AC_CHECK_FUNC(sem_init, ,
880 AC_CHECK_LIB(pthread, sem_init,
881 AC_DEFINE(HAVE_SEM_INIT)
882 SEM_INIT_LIB=-lpthread,
883 AC_CHECK_LIB(rt, sem_init,
884 AC_DEFINE(HAVE_SEM_INIT)
886 AC_CHECK_LIB(posix4, sem_init,
887 AC_DEFINE(HAVE_SEM_INIT)
888 SEM_INIT_LIB=-lposix4))))dnl
889 AC_SUBST(SEM_INIT_LIB)
891 dnl Check for unified diff
893 AC_MSG_CHECKING(for unified diff option)
894 if diff -u $0 $0 > /dev/null 2>&1 ; then
899 AC_MSG_RESULT($UNI_DIFF_OPTS)
900 AC_SUBST(UNI_DIFF_OPTS)
902 dnl We use the EXT2 ioctls only under Linux
906 AC_DEFINE(HAVE_EXT2_IOCTLS)
910 dnl OS-specific uncomment control
928 dnl Linux and Hurd places root files in the / by default
931 linux* | gnu* | k*bsd*-gnu)
932 if test "$prefix" = NONE -a "$root_prefix" = NONE ; then
934 AC_MSG_RESULT([On $host_os systems, root_prefix defaults to ''])
939 dnl On Linux/hurd, force the prefix to be /usr
942 linux* | gnu* | k*bsd*-gnu)
943 if test "$prefix" = NONE ; then
945 AC_MSG_RESULT([On $host_os systems, prefix defaults to /usr])
946 if test "$mandir" = '${prefix}/man' ; then
947 AC_MSG_RESULT([...and mandir defaults to /usr/share/man])
948 mandir=/usr/share/man
953 if test "$root_prefix" = NONE ; then
954 if test "$prefix" = NONE ; then
955 root_prefix="$ac_default_prefix"
957 root_prefix="$prefix"
960 root_sbindir=$sbindir
962 root_sysconfdir=$sysconfdir
964 root_bindir='${root_prefix}/bin'
965 root_sbindir='${root_prefix}/sbin'
966 root_libdir='${root_prefix}/lib'
967 root_sysconfdir='${root_prefix}/etc'
969 if test "$bindir" != '${exec_prefix}/bin'; then
971 AC_MSG_RESULT([Setting root_bindir to $root_bindir])
973 if test "$sbindir" != '${exec_prefix}/sbin'; then
974 root_sbindir=$sbindir
975 AC_MSG_RESULT([Setting root_sbindir to $root_sbindir])
977 if test "$libdir" != '${exec_prefix}/lib'; then
979 AC_MSG_RESULT([Setting root_libdir to $root_libdir])
981 if test "$sysconfdir" != '${prefix}/etc'; then
982 root_sysconfdir=$sysconfdir
983 AC_MSG_RESULT([Setting root_sysconfdir to $root_sysconfdir])
985 AC_SUBST(root_prefix)
986 AC_SUBST(root_bindir)
987 AC_SUBST(root_sbindir)
988 AC_SUBST(root_libdir)
989 AC_SUBST(root_sysconfdir)
991 dnl See if -static works.
993 AC_MSG_CHECKING([whether linker accepts -static])
994 AC_CACHE_VAL(ac_cv_e2fsprogs_use_static,
995 [SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -static"
996 AC_TRY_LINK([#include <stdio.h>],[fflush(stdout);],
997 ac_cv_e2fsprogs_use_static=yes, ac_cv_e2fsprogs_use_static=no)
998 LDFLAGS=$SAVE_LDFLAGS])
1000 dnl Regardless of how the test turns out, Solaris doesn't handle -static
1001 dnl This is caused by the socket library requiring the nsl library, which
1002 dnl requires the -dl library, which only works for dynamically linked
1003 dnl programs. It basically means you can't have statically linked programs
1004 dnl which use the network under Solaris.
1008 ac_cv_e2fsprogs_use_static=no
1011 AC_MSG_RESULT($ac_cv_e2fsprogs_use_static)
1013 if test $ac_cv_e2fsprogs_use_static = yes; then
1014 LDFLAG_STATIC=-static
1016 AC_SUBST(LDFLAG_STATIC)
1018 dnl Work around mysterious Darwin / GNU libintl problem
1019 dnl (__asm__ redirection doesn't work for some mysterious reason. Looks like
1020 dnl Apple hacked gcc somehow?)
1024 AC_MSG_RESULT([Using Apple Darwin / GNU libintl workaround])
1025 AC_DEFINE(_INTL_REDIRECT_MACROS)
1029 dnl Make the ss and et directories work correctly.
1031 SS_DIR=`cd ${srcdir}/lib/ss; pwd`
1032 ET_DIR=`cd ${srcdir}/lib/et; pwd`
1036 dnl Only try to run the test suite if we're not cross compiling.
1038 if test "$cross_compiling" = yes ; then
1043 AC_SUBST(DO_TEST_SUITE)
1045 dnl Only include the intl include files if we're building with them
1048 if test "$USE_INCLUDED_LIBINTL" = "yes" ; then
1049 INTL_FLAGS='-I$(top_builddir)/intl -I$(top_srcdir)/intl'
1051 AC_SUBST(INTL_FLAGS)
1055 if test $cross_compiling = no; then
1056 BUILD_CFLAGS="$CFLAGS"
1057 BUILD_LDFLAGS="$LDFLAGS"
1062 AC_SUBST(BUILD_CFLAGS)
1063 AC_SUBST(BUILD_LDFLAGS)
1065 dnl Make our output files, being sure that we create the some miscellaneous
1068 test -d lib || mkdir lib
1069 test -d include || mkdir include
1070 test -d include/linux || mkdir include/linux
1071 test -d include/asm || mkdir include/asm
1072 for i in MCONFIG Makefile e2fsprogs.spec \
1073 util/Makefile util/subst.conf util/gen-tarball \
1074 lib/et/Makefile lib/ss/Makefile lib/e2p/Makefile \
1075 lib/ext2fs/Makefile lib/ext2fs/ext2_types.h \
1076 lib/uuid/Makefile lib/uuid/uuid_types.h \
1077 lib/blkid/Makefile lib/blkid/blkid_types.h \
1078 lib/ss/ss.pc lib/uuid/uuid.pc lib/et/com_err.pc \
1079 lib/e2p/e2p.pc lib/blkid/blkid.pc lib/ext2fs/ext2fs.pc \
1080 misc/Makefile ext2ed/Makefile e2fsck/Makefile \
1081 debugfs/Makefile tests/Makefile tests/progs/Makefile \
1082 resize/Makefile doc/Makefile intl/Makefile \
1083 intl/libgnuintl.h po/Makefile.in ; do
1084 if test -d `dirname ${srcdir}/$i` ; then
1085 outlist="$outlist $i"
1089 if test -f util/gen-tarball; then chmod +x util/gen-tarball; fi