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)
69 AC_ARG_WITH([diet-libc],
70 [ --with-diet-libc use diet libc],
71 CC="diet cc -nostdinc"
73 AC_MSG_RESULT(CC=$CC))dnl
76 AC_HELP_STRING([--with-cc],[no longer supported, use CC= instead]),
77 AC_MSG_ERROR([--with-cc no longer supported; use CC= instead]))
80 AC_HELP_STRING([--with-ccopts],[no longer supported, use CFLAGS= instead]),
81 AC_MSG_ERROR([--with-ccopts no longer supported; use CFLAGS= instead]))
84 AC_HELP_STRING([--with-ldopts],[no longer supported, use LDFLAGS= instead]),
85 AC_MSG_ERROR([--with-ldopts no longer supported; use LDFLAGS= instead]))
90 dnl On systems without linux header files, we add an extra include directory
91 dnl that holds enough to fake it (hopefully). Note that the $(top_srcdir) here
92 dnl is quoted so that it gets expanded by make, not by configure.
94 AC_CHECK_HEADER(linux/fs.h, [linux_headers=yes], [linux_headers=no])
95 if test "$linux_headers" != yes; then
96 LINUX_INCLUDE='-I$(top_builddir)/include'
98 AC_SUBST(LINUX_INCLUDE)
100 dnl Alpha computers use fast and imprecise floating point code that may
101 dnl miss exceptions by default. Force sane options if we're using GCC.
102 AC_MSG_CHECKING(for additional special compiler flags)
106 alpha) addcflags="-mieee" ;;
109 if test "x$addcflags" != x
111 AC_MSG_RESULT($addcflags)
112 CFLAGS="$addcflags $CFLAGS"
114 AC_MSG_RESULT([[(none)]])
117 dnl Set default values for library extentions. Will be dealt with after
118 dnl parsing configuration opions, which may modify these
124 dnl Allow separate `root_prefix' to be specified
126 AC_ARG_WITH([root-prefix],
127 [ --with-root-prefix=PREFIX override prefix variable for files to be placed in the root],
128 root_prefix=$withval,
131 dnl handle --enable-maintainer-mode
133 AC_ARG_ENABLE([maintainer-mode],
134 [ --enable-maintainer-mode enable makefile rules useful for maintainers],
135 if test "$enableval" = "no"
138 AC_MSG_RESULT([Disabling maintainer mode])
141 AC_MSG_RESULT([Enabling maintainer mode])
145 AC_MSG_RESULT([Disabling maintainer mode by default])
147 AC_SUBST(MAINTAINER_CMT)
149 dnl handle --enable-verbose-makecmds
151 AC_ARG_ENABLE([verbose-makecmds],
152 [ --enable-verbose-makecmds enable verbose make command output],
153 if test "$enableval" = "no"
155 AC_MSG_RESULT([Disabling verbose make commands])
159 AC_MSG_RESULT([Enabling verbose make commands])
164 AC_MSG_RESULT([Disabling verbose make commands])
171 dnl handle --enable-compression
173 AC_ARG_ENABLE([compression],
174 [ --enable-compression enable EXPERIMENTAL compression support],
175 if test "$enableval" = "no"
177 AC_MSG_RESULT([Disabling compression support])
179 AC_DEFINE(ENABLE_COMPRESSION)
180 AC_MSG_RESULT([Enabling compression support])
181 AC_MSG_WARN([Compression support is experimental])
184 AC_MSG_RESULT([Disabling compression support by default])
187 dnl handle --enable-htree
189 AC_ARG_ENABLE([htree],
190 [ --enable-htree enable EXPERIMENTAL htree directory support],
191 if test "$enableval" = "no"
194 AC_MSG_RESULT([Disabling htree directory support])
197 AC_DEFINE(ENABLE_HTREE)
198 AC_MSG_RESULT([Enabling htree directory support])
202 AC_DEFINE(ENABLE_HTREE)
203 AC_MSG_RESULT([Enabling htree directory support by default])
207 dnl This needs to be before all of the --enable-*-shlibs options
209 E2_PKG_CONFIG_STATIC=--static
213 dnl handle --enable-elf-shlibs
215 AC_ARG_ENABLE([elf-shlibs],
216 [ --enable-elf-shlibs select ELF shared libraries],
217 if test "$enableval" = "no"
220 MAKEFILE_ELF=/dev/null
221 AC_MSG_RESULT([Disabling ELF shared libraries])
223 E2_PKG_CONFIG_STATIC=
225 MAKEFILE_ELF=$srcdir/lib/Makefile.elf-lib
228 MAKEFILE_ELF=$srcdir/lib/Makefile.solaris-lib
234 LDFLAG_DYNAMIC=['-Wl,-rpath-link,$(top_builddir)/lib']
235 AC_MSG_RESULT([Enabling ELF shared libraries])
238 MAKEFILE_ELF=/dev/null
240 AC_MSG_RESULT([Disabling ELF shared libraries by default])
243 AC_SUBST_FILE(MAKEFILE_ELF)
245 dnl handle --enable-bsd-shlibs
247 AC_ARG_ENABLE([bsd-shlibs],
248 [ --enable-bsd-shlibs select BSD shared libraries],
249 if test "$enableval" = "no"
252 MAKEFILE_BSDLIB=/dev/null
253 AC_MSG_RESULT([Disabling BSD shared libraries])
255 E2_PKG_CONFIG_STATIC=
257 MAKEFILE_BSDLIB=$srcdir/lib/Makefile.bsd-lib
261 MAKEFILE_BSDLIB=$srcdir/lib/Makefile.darwin-lib
265 AC_MSG_RESULT([Enabling BSD shared libraries])
268 MAKEFILE_BSDLIB=/dev/null
270 AC_MSG_RESULT([Disabling BSD shared libraries by default])
273 AC_SUBST_FILE(MAKEFILE_BSDLIB)
275 dnl handle --enable-profile
277 AC_ARG_ENABLE([profile],
278 [ --enable-profile build profiling libraries],
279 if test "$enableval" = "no"
282 MAKEFILE_PROFILE=/dev/null
283 AC_MSG_RESULT([Disabling profiling libraries])
286 MAKEFILE_PROFILE=$srcdir/lib/Makefile.profile
287 PROFILED_LIB_EXT=_p.a
288 AC_MSG_RESULT([Building profiling libraries])
292 MAKEFILE_PROFILE=/dev/null
293 AC_MSG_RESULT([Disabling profiling libraries by default])
295 AC_SUBST(PROFILE_CMT)
296 AC_SUBST_FILE(MAKEFILE_PROFILE)
298 dnl handle --enable-checker
300 AC_ARG_ENABLE([checker],
301 [ --enable-checker build checker libraries],
302 if test "$enableval" = "no"
305 MAKEFILE_CHECKER=/dev/null
306 AC_MSG_RESULT([Disabling checker libraries])
309 MAKEFILE_CHECKER=$srcdir/lib/Makefile.checker
310 AC_MSG_RESULT([Building checker libraries])
314 MAKEFILE_CHECKER=/dev/null
315 AC_MSG_RESULT([Disabling checker libraries by default])
317 AC_SUBST(CHECKER_CMT)
318 AC_SUBST_FILE(MAKEFILE_CHECKER)
320 dnl Substitute library extensions
323 AC_SUBST(STATIC_LIB_EXT)
324 AC_SUBST(PROFILED_LIB_EXT)
325 AC_SUBST(LDFLAG_DYNAMIC)
326 AC_SUBST(PRIVATE_LIBS_CMT)
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 AC_MSG_RESULT([Disabling journal debugging])
336 AC_DEFINE(CONFIG_JBD_DEBUG)
337 AC_MSG_RESULT([Enabling journal debugging])
340 AC_MSG_RESULT([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 AC_MSG_RESULT([Disabling blkid debugging])
351 AC_DEFINE(CONFIG_BLKID_DEBUG)
352 AC_MSG_RESULT([Enabling blkid debugging])
355 AC_MSG_RESULT([Disabling blkid debugging by default])
358 dnl handle --enable-testio-debug
360 AC_ARG_ENABLE([testio-debug],
361 [ --disable-testio-debug disable the use of the test I/O manager for debugging],
362 if test "$enableval" = "no"
364 AC_MSG_RESULT([Disabling testio debugging])
368 AC_DEFINE(CONFIG_TESTIO_DEBUG)
369 AC_MSG_RESULT([Enabling testio debugging])
372 AC_MSG_RESULT([Enabling testio debugging by default])
373 AC_DEFINE(CONFIG_TESTIO_DEBUG)
376 AC_SUBST(TEST_IO_CMT)
378 dnl handle --disable-libuuid
388 AC_ARG_ENABLE([libuuid],
389 [ --disable-libuuid do not build private uuid library],
390 if test "$enableval" = "no"
392 if test -z "$PKG_CONFIG"; then
393 AC_MSG_ERROR([pkg-config not installed; please install it.])
396 AC_CHECK_LIB(uuid, uuid_generate,
397 [LIBUUID=`$PKG_CONFIG --libs uuid`;
398 STATIC_LIBUUID=`$PKG_CONFIG --static --libs uuid`],
399 [AC_MSG_ERROR([external uuid library not found])],
402 AC_MSG_RESULT([Disabling private uuid library])
404 LIBUUID='$(LIB)/libuuid'$LIB_EXT
406 STATIC_LIBUUID='$(LIB)/libuuid'$STATIC_LIB_EXT
407 DEPSTATIC_LIBUUID=$STATIC_LIBUUID
408 PROFILED_LIBUUID='$(LIB)/libuuid'$PROFILED_LIB_EXT
409 DEPPROFILED_LIBUUID=$PROFILED_LIBUUID
410 AC_MSG_RESULT([Enabling private uuid library])
413 LIBUUID='$(LIB)/libuuid'$LIB_EXT
415 STATIC_LIBUUID='$(LIB)/libuuid'$STATIC_LIB_EXT
416 DEPSTATIC_LIBUUID=$STATIC_LIBUUID
417 PROFILED_LIBUUID='$(LIB)/libuuid'$PROFILED_LIB_EXT
418 DEPPROFILED_LIBUUID=$PROFILED_LIBUUID
419 AC_MSG_RESULT([Enabling private uuid library by default])
423 AC_SUBST(STATIC_LIBUUID)
424 AC_SUBST(DEPSTATIC_LIBUUID)
425 AC_SUBST(PROFILED_LIBUUID)
426 AC_SUBST(DEPPROFILED_LIBUUID)
429 dnl handle --disable-libblkid
437 DEPPROFILED_LIBBLKID=
439 AC_ARG_ENABLE([libblkid],
440 [ --disable-libblkid do not build private blkid library],
441 if test "$enableval" = "no"
443 if test -z "$PKG_CONFIG"; then
444 AC_MSG_ERROR([pkg-config not installed; please install it.])
447 AC_CHECK_LIB(blkid, blkid_get_cache,
448 [LIBBLKID=`$PKG_CONFIG --libs blkid`;
449 STATIC_LIBBLKID=`$PKG_CONFIG --static --libs blkid`],
450 [AC_MSG_ERROR([external blkid library not found])],
453 AC_MSG_RESULT([Disabling private blkid library])
455 LIBBLKID='$(LIB)/libblkid'$LIB_EXT
456 DEPLIBBLKID=$LIBBLKID
457 STATIC_LIBBLKID='$(LIB)/libblkid'$STATIC_LIB_EXT
458 DEPSTATIC_LIBBLKID=$STATIC_LIBBLKID
459 PROFILED_LIBBLKID='$(LIB)/libblkid'$PROFILED_LIB_EXT
460 DEPPROFILED_LIBBLKID=$PROFILED_LIBBLKID
461 AC_DEFINE(CONFIG_BUILD_FINDFS)
462 AC_MSG_RESULT([Enabling private blkid library])
465 LIBBLKID='$(LIB)/libblkid'$LIB_EXT
466 DEPLIBBLKID=$LIBBLKID
467 STATIC_LIBBLKID='$(LIB)/libblkid'$STATIC_LIB_EXT
468 DEPSTATIC_LIBBLKID=$STATIC_LIBBLKID
469 PROFILED_LIBBLKID='$(LIB)/libblkid'$PROFILED_LIB_EXT
470 DEPPROFILED_LIBBLKID=$PROFILED_LIBBLKID
471 AC_DEFINE(CONFIG_BUILD_FINDFS)
472 AC_MSG_RESULT([Enabling private blkid library by default])
475 AC_SUBST(DEPLIBBLKID)
476 AC_SUBST(STATIC_LIBBLKID)
477 AC_SUBST(DEPSTATIC_LIBBLKID)
478 AC_SUBST(PROFILED_LIBBLKID)
479 AC_SUBST(DEPPROFILED_LIBBLKID)
482 dnl handle --enable-debugfs
484 AC_ARG_ENABLE([debugfs],
485 [ --disable-debugfs disable support of debugfs program],
486 if test "$enableval" = "no"
488 AC_MSG_RESULT([Disabling debugfs support])
492 AC_MSG_RESULT([Enabling debugfs support])
495 AC_MSG_RESULT([Enabling debugfs support by default])
498 AC_SUBST(DEBUGFS_CMT)
500 dnl handle --enable-imager
502 AC_ARG_ENABLE([imager],
503 [ --disable-imager disable support of e2image program],
504 if test "$enableval" = "no"
506 AC_MSG_RESULT([Disabling e2image support])
510 AC_MSG_RESULT([Enabling e2image support])
513 AC_MSG_RESULT([Enabling e2image support by default])
518 dnl handle --enable-resizer
520 AC_ARG_ENABLE([resizer],
521 [ --disable-resizer disable support of e2resize program],
522 if test "$enableval" = "no"
524 AC_MSG_RESULT([Disabling e2resize support])
528 AC_MSG_RESULT([Enabling e2resize support])
531 AC_MSG_RESULT([Enabling e2resize support by default])
534 AC_SUBST(RESIZER_CMT)
536 dnl See whether to install the `fsck' wrapper program (that calls e2fsck)
538 AC_ARG_ENABLE([fsck],
539 [ --enable-fsck build fsck wrapper program],
540 [if test "$enableval" = "no"
542 FSCK_PROG='' FSCK_MAN=''
543 AC_MSG_RESULT([Not building fsck wrapper])
545 FSCK_PROG=fsck FSCK_MAN=fsck.8
546 AC_MSG_RESULT([Building fsck wrapper])
551 FSCK_PROG='' FSCK_MAN=''
552 AC_MSG_RESULT([Not building fsck wrapper by default])
555 FSCK_PROG=fsck FSCK_MAN=fsck.8
556 AC_MSG_RESULT([Building fsck wrapper by default])
562 dnl See whether to install the `e2initrd-helper' program
564 AC_ARG_ENABLE([e2initrd-helper],
565 [ --enable-e2initrd-helper build e2initrd-helper program],
566 [if test "$enableval" = "no"
568 E2INITRD_PROG='' E2INITRD_MAN=''
569 AC_MSG_RESULT([Not building e2initrd helper])
571 E2INITRD_PROG=e2initrd_helper E2INITRD_MAN=e2initrd_helper.8
572 AC_MSG_RESULT([Building e2initrd helper])
575 E2INITRD_PROG=e2initrd_helper E2INITRD_MAN=e2initrd_helper.8
576 AC_MSG_RESULT([Building e2initrd helper by default])
578 AC_SUBST(E2INITRD_PROG)
579 AC_SUBST(E2INITRD_MAN)
584 [ --disable-tls disable use of thread local support],
585 [if test "$enableval" = "no"
588 AC_MSG_RESULT([Disabling thread local support])
591 AC_MSG_RESULT([Enabling thread local support])
594 if test -n "$WITH_DIET_LIBC"
597 AC_MSG_RESULT([Diet libc does not support thread local support])
600 AC_MSG_RESULT([Try using thread local support by default])
603 if test "$try_tls" = "yes"
610 AC_ARG_ENABLE([uuidd],
611 [ --disable-uuidd disable building the uuid daemon],
612 [if test "$enableval" = "no"
614 AC_MSG_RESULT([Not building uuidd])
619 AC_MSG_RESULT([Building uuidd])
624 AC_MSG_RESULT([Building uuidd by default])
630 MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
631 AC_SUBST_FILE(MAKEFILE_LIBRARY)
633 dnl Add internationalization support, using gettext.
635 GETTEXT_PACKAGE=e2fsprogs
637 VERSION="$E2FSPROGS_VERSION"
639 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
640 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
641 AC_SUBST(GETTEXT_PACKAGE)
647 dnl End of configuration options
649 AC_SUBST(BINARY_TYPE)
652 AC_PATH_PROG(LN, ln, ln)
654 AC_PATH_PROG(MV, mv, mv)
655 AC_PATH_PROG(CP, cp, cp)
656 AC_PATH_PROG(RM, rm, rm)
657 AC_PATH_PROG(CHMOD, chmod, :)
660 AC_PATH_PROG(SED, sed, sed)
661 AC_PATH_PROG(PERL, perl, perl)
662 AC_PATH_PROG(LDCONFIG, ldconfig, :)
663 AC_CHECK_TOOL(AR, ar, ar)
664 AC_CHECK_TOOL(RANLIB, ranlib, :)
665 AC_CHECK_TOOL(STRIP, strip, :)
666 AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, )
667 if test "_$MAKEINFO" = "_"; then
668 MAKEINFO="@echo Makeinfo is missing. Info documentation will not be built.;true"
673 *** Makeinfo is missing. Info documentation will not be built.])
681 # See if we need a separate native compiler.
682 if test $cross_compiling = no; then
686 AC_CHECK_PROGS(BUILD_CC, gcc cc)
688 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)
689 AC_CHECK_HEADERS(sys/disk.h sys/mount.h,,,
692 #include <sys/queue.h>
695 AC_CHECK_HEADERS(net/if.h,,,
698 #include <sys/types.h>
701 #include <sys/socket.h>
705 dnl Check to see if dirent has member d_reclen. On cygwin those d_reclen
706 dnl is not decleared.
707 AC_CHECK_MEMBER(struct dirent.d_reclen,[AC_DEFINE(HAVE_RECLEN_DIRENT)],,
708 [#include <dirent.h>])
709 dnl Check to see if ssize_t was decleared
710 AC_CHECK_TYPE(ssize_t,[AC_DEFINE(HAVE_TYPE_SSIZE_T)],,
711 [#include <sys/types.h>])
713 dnl Check to see if llseek() is declared in unistd.h. On some libc's
714 dnl it is, and on others it isn't..... Thank you glibc developers....
716 AC_CHECK_DECL(llseek,[AC_DEFINE(HAVE_LLSEEK_PROTOTYPE)],,
717 [#include <unistd.h>])
719 dnl Check to see if lseek64() is declared in unistd.h. Glibc's header files
720 dnl are so convoluted that I can't tell whether it will always be defined,
721 dnl and if it isn't defined while lseek64 is defined in the library,
722 dnl disaster will strike.
724 dnl Warning! Use of --enable-gcc-wall may throw off this test.
727 AC_CHECK_DECL(lseek64,[AC_DEFINE(HAVE_LSEEK64_PROTOTYPE)],,
728 [#define _LARGEFILE_SOURCE
729 #define _LARGEFILE64_SOURCE
730 #include <unistd.h>])
734 AC_CHECK_SIZEOF(short)
736 AC_CHECK_SIZEOF(long)
737 AC_CHECK_SIZEOF(long long)
738 SIZEOF_SHORT=$ac_cv_sizeof_short
739 SIZEOF_INT=$ac_cv_sizeof_int
740 SIZEOF_LONG=$ac_cv_sizeof_long
741 SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
742 AC_SUBST(SIZEOF_SHORT)
744 AC_SUBST(SIZEOF_LONG)
745 AC_SUBST(SIZEOF_LONG_LONG)
747 BUILD_CC="$BUILD_CC" CPP="$CPP" /bin/sh $ac_aux_dir/parse-types.sh
748 ASM_TYPES_HEADER=./asm_types.h
749 AC_SUBST_FILE(ASM_TYPES_HEADER)
751 dnl Save the configuration #defines needed for the public ext2fs.h
754 echo "/* These defines are needed for the public ext2fs.h header file */" \
756 if grep HAVE_SYS_TYPES_H confdefs.h > tmp_config.$$; then
757 uniq tmp_config.$$ >> public_config.h
759 echo "#undef HAVE_SYS_TYPES_H" >> public_config.h
761 if grep WORDS_BIGENDIAN confdefs.h > tmp_config.$$; then
762 uniq tmp_config.$$ >> public_config.h
764 echo "#undef WORDS_BIGENDIAN" >> public_config.h
767 PUBLIC_CONFIG_HEADER=./public_config.h
768 AC_SUBST_FILE(PUBLIC_CONFIG_HEADER)
770 dnl See if we have inttypes.h and if intptr_t is defined
772 AC_CHECK_HEADERS([inttypes.h])
773 AC_CHECK_TYPES(intptr_t)
775 dnl See if struct stat has a st_flags field, in which case we can get file
776 dnl flags somewhat portably. Also check for the analogous setter, chflags().
778 AC_MSG_CHECKING(whether struct stat has a st_flags field)
779 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
780 AC_TRY_COMPILE([#include <sys/stat.h>],
781 [struct stat stat; stat.st_flags = 0;],
782 [e2fsprogs_cv_struct_st_flags=yes],
783 [e2fsprogs_cv_struct_st_flags=no]))
784 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
785 if test "$e2fsprogs_cv_struct_st_flags" = yes; then
786 AC_MSG_CHECKING(whether st_flags field is useful)
787 AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags_immut,
788 AC_TRY_COMPILE([#include <sys/stat.h>],
789 [struct stat stat; stat.st_flags |= UF_IMMUTABLE;],
790 [e2fsprogs_cv_struct_st_flags_immut=yes],
791 [e2fsprogs_cv_struct_st_flags_immut=no]))
792 AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags_immut)
793 if test "$e2fsprogs_cv_struct_st_flags_immut" = yes; then
794 AC_DEFINE(HAVE_STAT_FLAGS)
798 dnl Check for the presence of SA_LEN
800 AC_CHECK_MEMBER(struct sockaddr.sa_len,
801 AC_DEFINE_UNQUOTED(HAVE_SA_LEN,1,[Define if struct sockaddr contains sa_len]),,
802 [#include <sys/types.h>
803 #include <sys/socket.h>])
805 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)
807 dnl Check to see if -lsocket is required (solaris) to make something
808 dnl that uses socket() to compile; this is needed for the UUID library
811 AC_CHECK_LIB(socket, socket, [SOCKET_LIB=-lsocket])
814 dnl Check to see if libdl exists for the sake of dlopen
817 AC_CHECK_LIB(dl, dlopen,
819 AC_DEFINE(HAVE_DLOPEN)])
822 dnl See if optreset exists
824 AC_MSG_CHECKING(for optreset)
825 AC_CACHE_VAL(ac_cv_have_optreset,
826 [AC_EGREP_HEADER(optreset, unistd.h,
827 ac_cv_have_optreset=yes, ac_cv_have_optreset=no)])dnl
828 AC_MSG_RESULT($ac_cv_have_optreset)
829 if test $ac_cv_have_optreset = yes; then
830 AC_DEFINE(HAVE_OPTRESET)
833 dnl Test for sem_init, and which library it might require:
836 AC_CHECK_FUNC(sem_init, ,
837 AC_CHECK_LIB(pthread, sem_init,
838 AC_DEFINE(HAVE_SEM_INIT)
839 SEM_INIT_LIB=-lpthread,
840 AC_CHECK_LIB(rt, sem_init,
841 AC_DEFINE(HAVE_SEM_INIT)
843 AC_CHECK_LIB(posix4, sem_init,
844 AC_DEFINE(HAVE_SEM_INIT)
845 SEM_INIT_LIB=-lposix4))))dnl
846 AC_SUBST(SEM_INIT_LIB)
848 dnl Check for unified diff
850 AC_MSG_CHECKING(for unified diff option)
851 if diff -u $0 $0 > /dev/null 2>&1 ; then
856 AC_MSG_RESULT($UNI_DIFF_OPTS)
857 AC_SUBST(UNI_DIFF_OPTS)
859 dnl We use the EXT2 ioctls only under Linux
863 AC_DEFINE(HAVE_EXT2_IOCTLS)
867 dnl OS-specific uncomment control
885 dnl Linux and Hurd places root files in the / by default
888 linux* | gnu* | k*bsd*-gnu)
889 if test "$prefix" = NONE -a "$root_prefix" = NONE ; then
891 AC_MSG_RESULT([On $host_os systems, root_prefix defaults to ''])
896 dnl On Linux/hurd, force the prefix to be /usr
899 linux* | gnu* | k*bsd*-gnu)
900 if test "$prefix" = NONE ; then
902 AC_MSG_RESULT([On $host_os systems, prefix defaults to /usr])
903 if test "$mandir" = '${prefix}/man' ; then
904 AC_MSG_RESULT([...and mandir defaults to /usr/share/man])
905 mandir=/usr/share/man
910 if test "$root_prefix" = NONE ; then
911 if test "$prefix" = NONE ; then
912 root_prefix="$ac_default_prefix"
914 root_prefix="$prefix"
917 root_sbindir=$sbindir
919 root_sysconfdir=$sysconfdir
921 root_bindir='${root_prefix}/bin'
922 root_sbindir='${root_prefix}/sbin'
923 root_libdir='${root_prefix}/lib'
924 root_sysconfdir='${root_prefix}/etc'
926 if test "$bindir" != '${exec_prefix}/bin'; then
928 AC_MSG_RESULT([Setting root_bindir to $root_bindir])
930 if test "$sbindir" != '${exec_prefix}/sbin'; then
931 root_sbindir=$sbindir
932 AC_MSG_RESULT([Setting root_sbindir to $root_sbindir])
934 if test "$libdir" != '${exec_prefix}/lib'; then
936 AC_MSG_RESULT([Setting root_libdir to $root_libdir])
938 if test "$sysconfdir" != '${prefix}/etc'; then
939 root_sysconfdir=$sysconfdir
940 AC_MSG_RESULT([Setting root_sysconfdir to $root_sysconfdir])
942 AC_SUBST(root_prefix)
943 AC_SUBST(root_bindir)
944 AC_SUBST(root_sbindir)
945 AC_SUBST(root_libdir)
946 AC_SUBST(root_sysconfdir)
948 dnl See if -static works.
950 AC_MSG_CHECKING([whether linker accepts -static])
951 AC_CACHE_VAL(ac_cv_e2fsprogs_use_static,
952 [SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -static"
953 AC_TRY_LINK([#include <stdio.h>],[fflush(stdout);],
954 ac_cv_e2fsprogs_use_static=yes, ac_cv_e2fsprogs_use_static=no)
955 LDFLAGS=$SAVE_LDFLAGS])
957 dnl Regardless of how the test turns out, Solaris doesn't handle -static
958 dnl This is caused by the socket library requiring the nsl library, which
959 dnl requires the -dl library, which only works for dynamically linked
960 dnl programs. It basically means you can't have statically linked programs
961 dnl which use the network under Solaris.
965 ac_cv_e2fsprogs_use_static=no
968 AC_MSG_RESULT($ac_cv_e2fsprogs_use_static)
970 if test $ac_cv_e2fsprogs_use_static = yes; then
971 LDFLAG_STATIC=-static
973 AC_SUBST(LDFLAG_STATIC)
975 dnl Work around mysterious Darwin / GNU libintl problem
976 dnl (__asm__ redirection doesn't work for some mysterious reason. Looks like
977 dnl Apple hacked gcc somehow?)
981 AC_MSG_RESULT([Using Apple Darwin / GNU libintl workaround])
982 AC_DEFINE(_INTL_REDIRECT_MACROS)
986 dnl Make the ss and et directories work correctly.
988 SS_DIR=`cd ${srcdir}/lib/ss; pwd`
989 ET_DIR=`cd ${srcdir}/lib/et; pwd`
993 dnl Only try to run the test suite if we're not cross compiling.
995 if test "$cross_compiling" = yes ; then
1000 AC_SUBST(DO_TEST_SUITE)
1002 dnl Only include the intl include files if we're building with them
1005 if test "$USE_INCLUDED_LIBINTL" = "yes" ; then
1006 INTL_FLAGS='-I$(top_builddir)/intl -I$(top_srcdir)/intl'
1008 AC_SUBST(INTL_FLAGS)
1012 if test $cross_compiling = no; then
1013 BUILD_CFLAGS="$CFLAGS"
1014 BUILD_LDFLAGS="$LDFLAGS"
1019 AC_SUBST(BUILD_CFLAGS)
1020 AC_SUBST(BUILD_LDFLAGS)
1022 dnl Make our output files, being sure that we create the some miscellaneous
1025 test -d lib || mkdir lib
1026 test -d include || mkdir include
1027 test -d include/linux || mkdir include/linux
1028 test -d include/asm || mkdir include/asm
1029 for i in MCONFIG Makefile e2fsprogs.spec \
1030 util/Makefile util/subst.conf util/gen-tarball \
1031 lib/et/Makefile lib/ss/Makefile lib/e2p/Makefile \
1032 lib/ext2fs/Makefile lib/ext2fs/ext2_types.h \
1033 lib/uuid/Makefile lib/uuid/uuid_types.h \
1034 lib/blkid/Makefile lib/blkid/blkid_types.h \
1035 lib/ss/ss.pc lib/uuid/uuid.pc lib/et/com_err.pc \
1036 lib/e2p/e2p.pc lib/blkid/blkid.pc lib/ext2fs/ext2fs.pc \
1037 misc/Makefile ext2ed/Makefile e2fsck/Makefile \
1038 debugfs/Makefile tests/Makefile tests/progs/Makefile \
1039 resize/Makefile doc/Makefile intl/Makefile \
1040 intl/libgnuintl.h po/Makefile.in ; do
1041 if test -d `dirname ${srcdir}/$i` ; then
1042 outlist="$outlist $i"
1046 if test -f util/gen-tarball; then chmod +x util/gen-tarball; fi