Whamcloud - gitweb
po: update sv.po (from translationproject.org)
[tools/e2fsprogs.git] / configure.ac
index f3263c4..4c4b552 100644 (file)
@@ -1,5 +1,5 @@
 AC_INIT(version.h)
 AC_INIT(version.h)
-AC_PREREQ(2.54)
+AC_PREREQ(2.69)
 AC_CONFIG_AUX_DIR(config)
 AC_CONFIG_HEADERS([lib/config.h])
 AH_BOTTOM([#include <dirpaths.h>])
 AC_CONFIG_AUX_DIR(config)
 AC_CONFIG_HEADERS([lib/config.h])
 AH_BOTTOM([#include <dirpaths.h>])
@@ -11,11 +11,11 @@ dnl This is to figure out the version number and the date....
 dnl
 E2FSPROGS_VERSION=`grep E2FSPROGS_VERSION ${srcdir}/version.h  \
        | awk '{print $3}' | tr \" " " | awk '{print $1}'`
 dnl
 E2FSPROGS_VERSION=`grep E2FSPROGS_VERSION ${srcdir}/version.h  \
        | awk '{print $3}' | tr \" " " | awk '{print $1}'`
-DATE=`grep E2FSPROGS_DATE ${srcdir}/version.h | awk '{print $3}' \
-       | tr \" " "`
-E2FSPROGS_DAY=`echo $DATE | awk -F- '{print $1}'`
-MONTH=`echo $DATE | awk -F- '{print $2}'`
-YEAR=`echo $DATE | awk -F- '{print $3}'`
+E2FSPROGS_DATE=`grep E2FSPROGS_DATE ${srcdir}/version.h | awk '{print $3}' \
+       | tr \" " " | awk '{print $1}'`
+E2FSPROGS_DAY=$(echo $E2FSPROGS_DATE | awk -F- '{print $1}' | sed -e '/^[[1-9]]$/s/^/0/')
+MONTH=`echo $E2FSPROGS_DATE | awk -F- '{print $2}'`
+YEAR=`echo $E2FSPROGS_DATE | awk -F- '{print $3}'`
 
 if expr $YEAR ">" 1900 > /dev/null ; then
        E2FSPROGS_YEAR=$YEAR
 
 if expr $YEAR ">" 1900 > /dev/null ; then
        E2FSPROGS_YEAR=$YEAR
@@ -48,7 +48,7 @@ date_spec=${E2FSPROGS_YEAR}.${MONTH_NUM}.${E2FSPROGS_DAY}
 
 case $E2FSPROGS_VERSION in
 *-WIP|pre-*)
 
 case $E2FSPROGS_VERSION in
 *-WIP|pre-*)
-       E2FSPROGS_PKGVER="$base_ver~WIP-$E2FSPROGS_YEAR-$MONTH_NUM-$E2FSPROGS_DAY"
+       E2FSPROGS_PKGVER="$base_ver~WIP.$date_spec"
        ;;
 *)
        E2FSPROGS_PKGVER="$base_ver"
        ;;
 *)
        E2FSPROGS_PKGVER="$base_ver"
@@ -63,12 +63,13 @@ AC_SUBST(E2FSPROGS_MONTH)
 AC_SUBST(E2FSPROGS_DAY)
 AC_SUBST(E2FSPROGS_VERSION)
 AC_SUBST(E2FSPROGS_PKGVER)
 AC_SUBST(E2FSPROGS_DAY)
 AC_SUBST(E2FSPROGS_VERSION)
 AC_SUBST(E2FSPROGS_PKGVER)
+AC_SUBST(E2FSPROGS_DATE)
 dnl
 dnl Use diet libc
 dnl 
 WITH_DIET_LIBC=
 AC_ARG_WITH([diet-libc],
 dnl
 dnl Use diet libc
 dnl 
 WITH_DIET_LIBC=
 AC_ARG_WITH([diet-libc],
-[  --with-diet-libc        use diet libc],
+AS_HELP_STRING([--with-diet-libc],[use diet libc]),
 CC="diet cc -nostdinc"
 WITH_DIET_LIBC=yes
 if test -z "$LIBS"
 CC="diet cc -nostdinc"
 WITH_DIET_LIBC=yes
 if test -z "$LIBS"
@@ -84,21 +85,19 @@ dnl
 dnl Check to see if libdl exists for the sake of dlopen
 dnl
 DLOPEN_LIB=''
 dnl Check to see if libdl exists for the sake of dlopen
 dnl
 DLOPEN_LIB=''
-AC_CHECK_LIB(dl, dlopen,
-[DLOPEN_LIB=-ldl
-AC_DEFINE(HAVE_DLOPEN, 1, [Define to 1 if dlopen/libdl exists])])
+AC_CHECK_LIB(dl, dlopen,DLOPEN_LIB=-ldl)
 AC_SUBST(DLOPEN_LIB)
 dnl
 AC_ARG_WITH([cc],
 AC_SUBST(DLOPEN_LIB)
 dnl
 AC_ARG_WITH([cc],
-AC_HELP_STRING([--with-cc],[no longer supported, use CC= instead]),
+AS_HELP_STRING([--with-cc],[no longer supported, use CC= instead]),
 AC_MSG_ERROR([--with-cc no longer supported; use CC= instead]))
 dnl
 AC_ARG_WITH([ccopts],
 AC_MSG_ERROR([--with-cc no longer supported; use CC= instead]))
 dnl
 AC_ARG_WITH([ccopts],
-AC_HELP_STRING([--with-ccopts],[no longer supported, use CFLAGS= instead]),
+AS_HELP_STRING([--with-ccopts],[no longer supported, use CFLAGS= instead]),
 AC_MSG_ERROR([--with-ccopts no longer supported; use CFLAGS= instead]))
 dnl
 AC_ARG_WITH([ldopts],
 AC_MSG_ERROR([--with-ccopts no longer supported; use CFLAGS= instead]))
 dnl
 AC_ARG_WITH([ldopts],
-AC_HELP_STRING([--with-ldopts],[no longer supported, use LDFLAGS= instead]),
+AS_HELP_STRING([--with-ldopts],[no longer supported, use LDFLAGS= instead]),
 AC_MSG_ERROR([--with-ldopts no longer supported; use LDFLAGS= instead]))
 dnl
 AC_PROG_CC
 AC_MSG_ERROR([--with-ldopts no longer supported; use LDFLAGS= instead]))
 dnl
 AC_PROG_CC
@@ -126,8 +125,8 @@ else
 fi
 AC_USE_SYSTEM_EXTENSIONS
 dnl
 fi
 AC_USE_SYSTEM_EXTENSIONS
 dnl
-dnl Set default values for library extentions.  Will be dealt with after
-dnl parsing configuration opions, which may modify these
+dnl Set default values for library extensions.  Will be dealt with after
+dnl parsing configuration options, which may modify these
 dnl
 LIB_EXT=.a
 STATIC_LIB_EXT=.a
 dnl
 LIB_EXT=.a
 STATIC_LIB_EXT=.a
@@ -136,14 +135,14 @@ dnl
 dnl Allow separate `root_prefix' to be specified
 dnl
 AC_ARG_WITH([root-prefix],
 dnl Allow separate `root_prefix' to be specified
 dnl
 AC_ARG_WITH([root-prefix],
-[  --with-root-prefix=PREFIX override prefix variable for files to be placed in the root],
+AS_HELP_STRING([--with-root-prefix=PREFIX],[override prefix variable for files to be placed in the root]),
 root_prefix=$withval,
 root_prefix=NONE)dnl
 dnl
 dnl handle --enable-maintainer-mode
 dnl
 AC_ARG_ENABLE([maintainer-mode],
 root_prefix=$withval,
 root_prefix=NONE)dnl
 dnl
 dnl handle --enable-maintainer-mode
 dnl
 AC_ARG_ENABLE([maintainer-mode],
-[  --enable-maintainer-mode enable makefile rules useful for maintainers],
+AS_HELP_STRING([--enable-maintainer-mode],[enable makefile rules useful for maintainers]),
 if test "$enableval" = "no"
 then
        MAINTAINER_CMT=#
 if test "$enableval" = "no"
 then
        MAINTAINER_CMT=#
@@ -161,7 +160,7 @@ dnl
 dnl handle --enable-symlink-install
 dnl
 AC_ARG_ENABLE([symlink-install],
 dnl handle --enable-symlink-install
 dnl
 AC_ARG_ENABLE([symlink-install],
-[  --enable-symlink-install use symlinks when installing instead of hard links],
+AS_HELP_STRING([--enable-symlink-install],[use symlinks when installing instead of hard links]),
 if test "$enableval" = "no"
 then
        LINK_INSTALL_FLAGS=-f
 if test "$enableval" = "no"
 then
        LINK_INSTALL_FLAGS=-f
@@ -180,7 +179,7 @@ dnl handle --enable-relative-symlinks
 dnl
 relative_symlink_defined=
 AC_ARG_ENABLE([relative-symlinks],
 dnl
 relative_symlink_defined=
 AC_ARG_ENABLE([relative-symlinks],
-[  --enable-relative-symlinks use relative symlinks when installing],
+AS_HELP_STRING([--enable-relative-symlinks],[use relative symlinks when installing]),
 if test "$enableval" = "no"
 then
        SYMLINK_RELATIVE=
 if test "$enableval" = "no"
 then
        SYMLINK_RELATIVE=
@@ -212,7 +211,7 @@ dnl
 dnl handle --enable-symlink-build
 dnl
 AC_ARG_ENABLE([symlink-build],
 dnl handle --enable-symlink-build
 dnl
 AC_ARG_ENABLE([symlink-build],
-[  --enable-symlink-build  use symlinks while building instead of hard links],
+AS_HELP_STRING([--enable-symlink-build],[use symlinks while building instead of hard links]),
 if test "$enableval" = "no"
 then
        LINK_BUILD_FLAGS=
 if test "$enableval" = "no"
 then
        LINK_BUILD_FLAGS=
@@ -230,7 +229,7 @@ dnl
 dnl handle --enable-verbose-makecmds
 dnl
 AC_ARG_ENABLE([verbose-makecmds],
 dnl handle --enable-verbose-makecmds
 dnl
 AC_ARG_ENABLE([verbose-makecmds],
-[  --enable-verbose-makecmds enable verbose make command output],
+AS_HELP_STRING([--enable-verbose-makecmds],[enable verbose make command output]),
 if test "$enableval" = "no"
 then
        AC_MSG_RESULT([Disabling verbose make commands])
 if test "$enableval" = "no"
 then
        AC_MSG_RESULT([Disabling verbose make commands])
@@ -262,7 +261,7 @@ dnl
 dnl handle --enable-elf-shlibs
 dnl
 AC_ARG_ENABLE([elf-shlibs],
 dnl handle --enable-elf-shlibs
 dnl
 AC_ARG_ENABLE([elf-shlibs],
-[  --enable-elf-shlibs   select ELF shared libraries],
+AS_HELP_STRING([--enable-elf-shlibs],[select ELF shared libraries]),
 if test "$enableval" = "no"
 then
        ELF_CMT=#
 if test "$enableval" = "no"
 then
        ELF_CMT=#
@@ -294,7 +293,7 @@ dnl
 dnl handle --enable-bsd-shlibs
 dnl
 AC_ARG_ENABLE([bsd-shlibs],
 dnl handle --enable-bsd-shlibs
 dnl
 AC_ARG_ENABLE([bsd-shlibs],
-[  --enable-bsd-shlibs   select BSD shared libraries],
+AS_HELP_STRING([--enable-bsd-shlibs],[select BSD shared libraries]),
 if test "$enableval" = "no"
 then
        BSDLIB_CMT=#
 if test "$enableval" = "no"
 then
        BSDLIB_CMT=#
@@ -324,7 +323,7 @@ dnl
 dnl handle --enable-profile
 dnl
 AC_ARG_ENABLE([profile],
 dnl handle --enable-profile
 dnl
 AC_ARG_ENABLE([profile],
-[  --enable-profile      build profiling libraries],
+AS_HELP_STRING([--enable-profile],[build profiling libraries]),
 if test "$enableval" = "no"
 then
        PROFILE_CMT=#
 if test "$enableval" = "no"
 then
        PROFILE_CMT=#
@@ -347,7 +346,7 @@ dnl
 dnl handle --enable-gcov
 dnl
 AC_ARG_ENABLE([gcov],
 dnl handle --enable-gcov
 dnl
 AC_ARG_ENABLE([gcov],
-[  --enable-gcov                 build for coverage testing using gcov],
+AS_HELP_STRING([--enable-gcov],[build for coverage testing using gcov]),
 if test "$enableval" = "yes"
 then
        CFLAGS="-g -fprofile-arcs -ftest-coverage"
 if test "$enableval" = "yes"
 then
        CFLAGS="-g -fprofile-arcs -ftest-coverage"
@@ -355,7 +354,28 @@ then
        AC_MSG_RESULT([Enabling gcov support])
 fi
 )
        AC_MSG_RESULT([Enabling gcov support])
 fi
 )
-
+dnl
+dnl handle --enable-hardening
+dnl
+CFLAGS_SHLIB="${CFLAGS_SHLIB:-$CFLAGS}"
+CFLAGS_STLIB="${CFLAGS_STLIB:-$CFLAGS}"
+LDFLAGS_SHLIB=${LDFLAGS_SHLIB:-$LDFLAGS}
+LDFLAGS_STATIC=${LDFLAGS_STATIC:-$LDFLAGS}
+AC_ARG_ENABLE([hardening],
+AS_HELP_STRING([--enable-hardening],[build for coverage testing using gcov]),
+if test "$enableval" = "yes"
+then
+       HARDEN_CFLAGS="-D_FORTIFY_SOURCE=2 -fstack-protector-strong"
+       HARDEN_LDFLAGS=["-Wl,-z,relro -Wl,-z,now"]
+       CFLAGS="$CFLAGS $HARDEN_CFLAGS -fPIE"
+       CFLAGS_SHLIB="$CFLAGS_SHLIB $HARDEN_CFLAGS"
+       CFLAGS_STLIB="$CFLAGS_STLIB $HARDEN_CFLAGS -fPIE"
+       LDFLAGS="$LDFLAGS $HARDEN_LDFLAGS -fPIE -pie"
+       LDFLAGS_STATIC="$LDFLAGS_STATIC $HARDEN_LDFLAGS"
+       LDFLAGS_SHLIB="$LDFLAGS_SHLIB $HARDEN_LDFLAGS"
+       AC_MSG_RESULT([Enabling hardening support])
+fi
+)
 dnl
 dnl Substitute library extensions
 dnl
 dnl
 dnl Substitute library extensions
 dnl
@@ -368,7 +388,7 @@ dnl
 dnl handle --enable-jbd-debug
 dnl
 AC_ARG_ENABLE([jbd-debug],
 dnl handle --enable-jbd-debug
 dnl
 AC_ARG_ENABLE([jbd-debug],
-[  --enable-jbd-debug            enable journal debugging],
+AS_HELP_STRING([--enable-jbd-debug],[enable journal debugging]),
 if test "$enableval" = "no"
 then
        AC_MSG_RESULT([Disabling journal debugging])
 if test "$enableval" = "no"
 then
        AC_MSG_RESULT([Disabling journal debugging])
@@ -384,7 +404,7 @@ dnl
 dnl handle --enable-blkid-debug
 dnl
 AC_ARG_ENABLE([blkid-debug],
 dnl handle --enable-blkid-debug
 dnl
 AC_ARG_ENABLE([blkid-debug],
-[  --enable-blkid-debug    enable blkid debugging],
+AS_HELP_STRING([--enable-blkid-debug],[enable blkid debugging]),
 if test "$enableval" = "no"
 then
        AC_MSG_RESULT([Disabling blkid debugging])
 if test "$enableval" = "no"
 then
        AC_MSG_RESULT([Disabling blkid debugging])
@@ -400,7 +420,7 @@ dnl
 dnl handle --enable-testio-debug
 dnl
 AC_ARG_ENABLE([testio-debug],
 dnl handle --enable-testio-debug
 dnl
 AC_ARG_ENABLE([testio-debug],
-[  --disable-testio-debug  disable the use of the test I/O manager for debugging],
+AS_HELP_STRING([--disable-testio-debug],[disable the use of the test I/O manager for debugging]),
 AH_TEMPLATE([CONFIG_TESTIO_DEBUG],
        [Define to 1 if the testio I/O manager should be enabled])
 if test "$enableval" = "no"
 AH_TEMPLATE([CONFIG_TESTIO_DEBUG],
        [Define to 1 if the testio I/O manager should be enabled])
 if test "$enableval" = "no"
@@ -419,6 +439,27 @@ TEST_IO_CMT=
 )
 AC_SUBST(TEST_IO_CMT)
 dnl
 )
 AC_SUBST(TEST_IO_CMT)
 dnl
+dnl handle --enable-developer-features
+dnl
+AC_ARG_ENABLE([developer-features],
+AS_HELP_STRING([--enable-developer-features],[enable features for use by ext4 developers]),
+AH_TEMPLATE([CONFIG_DEVELOPER_FEATURES],
+       [Define to 1 for features for use by ext4 developers])
+if test "$enableval" = "yes"
+then
+       DEV_FEATURES_CMT=
+       AC_DEFINE(CONFIG_DEVELOPER_FEATURES, 1)
+       AC_MSG_RESULT([Enabling ext4 developer features])
+else
+       AC_MSG_RESULT([Disabling ext4 developer features])
+       DEV_FEATURES_CMT="#"
+fi
+,
+AC_MSG_RESULT([Disabling ext4 developer features by default])
+DEV_FEATURES_CMT=
+)
+AC_SUBST(DEV_FEATURES_CMT)
+dnl
 dnl handle --disable-libuuid
 dnl
 PKG_PROG_PKG_CONFIG
 dnl handle --disable-libuuid
 dnl
 PKG_PROG_PKG_CONFIG
@@ -430,7 +471,7 @@ PROFILED_LIBUUID=
 DEPPROFILED_LIBUUID=
 UUID_CMT=
 AC_ARG_ENABLE([libuuid],
 DEPPROFILED_LIBUUID=
 UUID_CMT=
 AC_ARG_ENABLE([libuuid],
-[  --enable-libuuid      build and use private uuid library],
+AS_HELP_STRING([--enable-libuuid],[build and use private uuid library]),
 if test "$enableval" = "no"
 then
        if test -z "$PKG_CONFIG"; then
 if test "$enableval" = "no"
 then
        if test -z "$PKG_CONFIG"; then
@@ -493,7 +534,7 @@ DEPPROFILED_LIBBLKID=
 BLKID_CMT=
 AH_TEMPLATE([CONFIG_BUILD_FINDFS], [Define to 1 to compile findfs])
 AC_ARG_ENABLE([libblkid],
 BLKID_CMT=
 AH_TEMPLATE([CONFIG_BUILD_FINDFS], [Define to 1 to compile findfs])
 AC_ARG_ENABLE([libblkid],
-[  --enable-libblkid     build and use private blkid library],
+AS_HELP_STRING([--enable-libblkid],[build and use private blkid library]),
 if test "$enableval" = "no"
 then
        if test -z "$PKG_CONFIG"; then
 if test "$enableval" = "no"
 then
        if test -z "$PKG_CONFIG"; then
@@ -546,53 +587,29 @@ AC_SUBST(PROFILED_LIBBLKID)
 AC_SUBST(DEPPROFILED_LIBBLKID)
 AC_SUBST(BLKID_CMT)
 dnl
 AC_SUBST(DEPPROFILED_LIBBLKID)
 AC_SUBST(BLKID_CMT)
 dnl
-dnl handle --enable-quota
+dnl handle --enable-subset
 dnl
 dnl
-QUOTA_MAN_COMMENT='.\"'
-QUOTA_CMT=
-AC_SUBST(QUOTA_MAN_COMMENT)
-PKG_PROG_PKG_CONFIG
-AH_TEMPLATE([CONFIG_QUOTA], [Define to 1 to enable quota support])
-AC_ARG_ENABLE([quota],
-[  --disable-quota       disable quota support],
+ALL_CMT=
+SUBSET_CMT=
+AC_ARG_ENABLE([subset],
+AS_HELP_STRING([--enable-subset],[enable subset-only build]),
 if test "$enableval" = "no"
 then
 if test "$enableval" = "no"
 then
-       QUOTA_CMT=#
-       AC_MSG_RESULT([Disabling quota support])
+       SUBSET_CMT=#
+       AC_MSG_RESULT([Disabling subset-only build])
 else
 else
-       QUOTA_CMT=
-       AC_DEFINE(CONFIG_QUOTA, 1)
-       AC_MSG_RESULT([Enabling quota support])
-       QUOTA_MAN_COMMENT=""
+       ALL_CMT=#
+       AC_MSG_RESULT([Enabling subset-only-build])
 fi
 fi
-,
-QUOTA_CMT=
-QUOTA_MAN_COMMENT=""
-AC_DEFINE(CONFIG_QUOTA, 1)
-AC_MSG_RESULT([Enabling quota support by default])
-)
-dnl
-dnl Define stuff expected for quota library
-dnl
-LIBQUOTA='$(LIB)/libquota'$LIB_EXT
-DEPLIBQUOTA=$LIBQUOTA
-STATIC_LIBQUOTA='$(LIB)/libquota'$STATIC_LIB_EXT
-DEPSTATIC_LIBQUOTA=$STATIC_LIBQUOTA
-PROFILED_LIBQUOTA='$(LIB)/libquota'$PROFILED_LIB_EXT
-DEPPROFILED_LIBQUOTA=$PROFILED_LIBQUOTA
-AC_SUBST(LIBQUOTA)
-AC_SUBST(DEPLIBQUOTA)
-AC_SUBST(STATIC_LIBQUOTA)
-AC_SUBST(DEPSTATIC_LIBQUOTA)
-AC_SUBST(PROFILED_LIBQUOTA)
-AC_SUBST(DEPPROFILED_LIBQUOTA)
-AC_SUBST(QUOTA_CMT)
+,)
+AC_SUBST(ALL_CMT)
+AC_SUBST(SUBSET_CMT)
 dnl
 dnl handle --disable-backtrace
 dnl
 AH_TEMPLATE([DISABLE_BACKTRACE], [Define to 1 to disable use of backtrace])
 AC_ARG_ENABLE([backtrace],
 dnl
 dnl handle --disable-backtrace
 dnl
 AH_TEMPLATE([DISABLE_BACKTRACE], [Define to 1 to disable use of backtrace])
 AC_ARG_ENABLE([backtrace],
-[  --disable-backtrace   disable use backtrace],
+AS_HELP_STRING([--disable-backtrace],[disable use backtrace]),
 if test "$enableval" = "no"
 then
        AC_MSG_RESULT([Disabling use of backtrace])
 if test "$enableval" = "no"
 then
        AC_MSG_RESULT([Disabling use of backtrace])
@@ -607,7 +624,7 @@ dnl
 dnl handle --enable-debugfs
 dnl
 AC_ARG_ENABLE([debugfs],
 dnl handle --enable-debugfs
 dnl
 AC_ARG_ENABLE([debugfs],
-[  --disable-debugfs             disable support of debugfs program],
+AS_HELP_STRING([--disable-debugfs],[disable support of debugfs program]),
 if test "$enableval" = "no"
 then
        AC_MSG_RESULT([Disabling debugfs support])
 if test "$enableval" = "no"
 then
        AC_MSG_RESULT([Disabling debugfs support])
@@ -625,7 +642,7 @@ dnl
 dnl handle --enable-imager
 dnl
 AC_ARG_ENABLE([imager],
 dnl handle --enable-imager
 dnl
 AC_ARG_ENABLE([imager],
-[  --disable-imager      disable support of e2image program],
+AS_HELP_STRING([--disable-imager],[disable support of e2image program]),
 if test "$enableval" = "no"
 then
        AC_MSG_RESULT([Disabling e2image support])
 if test "$enableval" = "no"
 then
        AC_MSG_RESULT([Disabling e2image support])
@@ -643,7 +660,7 @@ dnl
 dnl handle --enable-resizer
 dnl
 AC_ARG_ENABLE([resizer],
 dnl handle --enable-resizer
 dnl
 AC_ARG_ENABLE([resizer],
-[  --disable-resizer             disable support of e2resize program],
+AS_HELP_STRING([--disable-resizer],[disable support of e2resize program]),
 if test "$enableval" = "no"
 then
        AC_MSG_RESULT([Disabling e2resize support])
 if test "$enableval" = "no"
 then
        AC_MSG_RESULT([Disabling e2resize support])
@@ -661,7 +678,7 @@ dnl
 dnl handle --enable-defrag
 dnl
 AC_ARG_ENABLE([defrag],
 dnl handle --enable-defrag
 dnl
 AC_ARG_ENABLE([defrag],
-[  --disable-defrag      disable support of e4defrag program],
+AS_HELP_STRING([--disable-defrag],[disable support of e4defrag program]),
 if test "$enableval" = "no"
 then
        AC_MSG_RESULT([Disabling e4defrag support])
 if test "$enableval" = "no"
 then
        AC_MSG_RESULT([Disabling e4defrag support])
@@ -685,7 +702,7 @@ dnl
 dnl See whether to install the `fsck' wrapper program (that calls e2fsck)
 dnl
 AC_ARG_ENABLE([fsck],
 dnl See whether to install the `fsck' wrapper program (that calls e2fsck)
 dnl
 AC_ARG_ENABLE([fsck],
-[  --enable-fsck           build fsck wrapper program],
+AS_HELP_STRING([--enable-fsck],[build fsck wrapper program]),
 [if test "$enableval" = "no"
 then
        FSCK_PROG='' FSCK_MAN=''
 [if test "$enableval" = "no"
 then
        FSCK_PROG='' FSCK_MAN=''
@@ -711,7 +728,7 @@ dnl
 dnl See whether to install the `e2initrd-helper' program
 dnl
 AC_ARG_ENABLE([e2initrd-helper],
 dnl See whether to install the `e2initrd-helper' program
 dnl
 AC_ARG_ENABLE([e2initrd-helper],
-[  --enable-e2initrd-helper build e2initrd-helper program],
+AS_HELP_STRING([--enable-e2initrd-helper],[build e2initrd-helper program]),
 [if test "$enableval" = "no"
 then
        E2INITRD_PROG='' E2INITRD_MAN=''
 [if test "$enableval" = "no"
 then
        E2INITRD_PROG='' E2INITRD_MAN=''
@@ -730,7 +747,7 @@ dnl
 dnl
 dnl
 AC_ARG_ENABLE([tls],
 dnl
 dnl
 AC_ARG_ENABLE([tls],
-[  --disable-tls           disable use of thread local support],
+AS_HELP_STRING([--disable-tls],[disable use of thread local support]),
 [if test "$enableval" = "no"
 then
        try_tls=""
 [if test "$enableval" = "no"
 then
        try_tls=""
@@ -756,9 +773,33 @@ fi
 dnl
 dnl
 dnl
 dnl
 dnl
 dnl
+AC_ARG_WITH([pthread],
+AS_HELP_STRING([--without-pthread],[disable use of pthread support]),
+[if test "$withval" = "no"
+then
+       try_pthread=""
+       AC_MSG_RESULT([Disabling pthread support])
+else
+       try_pthread="yes"
+       AC_MSG_RESULT([Testing for pthread support])
+fi]
+,
+try_pthread="yes"
+AC_MSG_RESULT([Try testing for pthread support by default])
+)
+if test "$try_pthread" = "yes"
+then
+AX_PTHREAD
+else
+test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
+AC_SUBST([PTHREAD_CC])
+fi
+dnl
+dnl
+dnl
 AH_TEMPLATE([USE_UUIDD], [Define to 1 to build uuidd])
 AC_ARG_ENABLE([uuidd],
 AH_TEMPLATE([USE_UUIDD], [Define to 1 to build uuidd])
 AC_ARG_ENABLE([uuidd],
-[  --disable-uuidd         disable building the uuid daemon],
+AS_HELP_STRING([--disable-uuidd],[disable building the uuid daemon]),
 [if test "$enableval" = "no"
 then
        AC_MSG_RESULT([Not building uuidd])
 [if test "$enableval" = "no"
 then
        AC_MSG_RESULT([Not building uuidd])
@@ -785,7 +826,7 @@ dnl handle --disable-mmp
 dnl
 AH_TEMPLATE([CONFIG_MMP], [Define to 1 to enable mmp support])
 AC_ARG_ENABLE([mmp],
 dnl
 AH_TEMPLATE([CONFIG_MMP], [Define to 1 to enable mmp support])
 AC_ARG_ENABLE([mmp],
-[  --disable-mmp           disable support mmp, Multi Mount Protection],
+AS_HELP_STRING([--disable-mmp],[disable support mmp, Multi Mount Protection]),
 if test "$enableval" = "no"
 then
        AC_MSG_RESULT([Disabling mmp support])
 if test "$enableval" = "no"
 then
        AC_MSG_RESULT([Disabling mmp support])
@@ -798,11 +839,36 @@ AC_MSG_RESULT([Enabling mmp support by default])
 AC_DEFINE(CONFIG_MMP, 1)
 )
 dnl
 AC_DEFINE(CONFIG_MMP, 1)
 )
 dnl
+dnl handle --disable-tdb
+dnl
+AH_TEMPLATE([CONFIG_TDB], [Define to 1 to enable tdb support])
+AC_ARG_ENABLE([tdb],
+AS_HELP_STRING([--disable-tdb],[disable tdb support]),
+if test "$enableval" = "no"
+then
+       AC_MSG_RESULT([Disabling tdb support])
+       TDB_CMT="#"
+       TDB_MAN_COMMENT='.\"'
+else
+       AC_MSG_RESULT([Enabling tdb support])
+       AC_DEFINE(CONFIG_TDB, 1)
+       TDB_CMT=""
+       TDB_MAN_COMMENT=""
+fi
+,
+AC_MSG_RESULT([Enabling mmp support by default])
+AC_DEFINE(CONFIG_TDB, 1)
+TDB_CMT=""
+TDB_MAN_COMMENT=""
+)
+AC_SUBST(TDB_CMT)
+AC_SUBST(TDB_MAN_COMMENT)
+dnl
 dnl handle --disable-bmap-stats
 dnl
 AH_TEMPLATE([ENABLE_BMAP_STATS], [Define to 1 to enable bitmap stats.])
 AC_ARG_ENABLE([bmap-stats],
 dnl handle --disable-bmap-stats
 dnl
 AH_TEMPLATE([ENABLE_BMAP_STATS], [Define to 1 to enable bitmap stats.])
 AC_ARG_ENABLE([bmap-stats],
-[  --disable-bmap-stats    disable collection of bitmap stats.],
+AS_HELP_STRING([--disable-bmap-stats],[disable collection of bitmap stats]),
 if test "$enableval" = "no"
 then
        AC_MSG_RESULT([Disabling bitmap statistics support])
 if test "$enableval" = "no"
 then
        AC_MSG_RESULT([Disabling bitmap statistics support])
@@ -819,7 +885,7 @@ dnl handle --enable-bmap-stats-ops
 dnl
 AH_TEMPLATE([ENABLE_BMAP_STATS_OPS], [Define to 1 to enable bitmap stats.])
 AC_ARG_ENABLE([bmap-stats-ops],
 dnl
 AH_TEMPLATE([ENABLE_BMAP_STATS_OPS], [Define to 1 to enable bitmap stats.])
 AC_ARG_ENABLE([bmap-stats-ops],
-[  --enable-bmap-stats-ops enable collection of additional bitmap stats],
+AS_HELP_STRING([--enable-bmap-stats-ops],[enable collection of additional bitmap stats]),
 if test "$enableval" = "no"
 then
        AC_MSG_RESULT([Disabling additional bitmap statistics])
 if test "$enableval" = "no"
 then
        AC_MSG_RESULT([Disabling additional bitmap statistics])
@@ -852,7 +918,7 @@ AC_SUBST(GETTEXT_PACKAGE)
 AC_SUBST(PACKAGE)
 AC_SUBST(VERSION)
 
 AC_SUBST(PACKAGE)
 AC_SUBST(VERSION)
 
-AM_GNU_GETTEXT
+AM_GNU_GETTEXT([external])
 dnl
 dnl End of configuration options
 dnl
 dnl
 dnl End of configuration options
 dnl
@@ -860,6 +926,12 @@ AC_SUBST(BINARY_TYPE)
 AC_PROG_MAKE_SET
 CHECK_GNU_MAKE
 AC_PATH_PROG(LN, ln, ln)
 AC_PROG_MAKE_SET
 CHECK_GNU_MAKE
 AC_PATH_PROG(LN, ln, ln)
+AC_PROG_MKDIR_P
+dnl
+dnl @mkdir_p@ is used by po's Makefile.in
+dnl
+mkdir_p=$MKDIR_P
+AC_SUBST(mkdir_p)
 AC_PROG_LN_S
 AC_PATH_PROG(MV, mv, mv)
 AC_PATH_PROG(CP, cp, cp)
 AC_PROG_LN_S
 AC_PATH_PROG(MV, mv, mv)
 AC_PATH_PROG(CP, cp, cp)
@@ -875,7 +947,7 @@ AC_CHECK_TOOL(RANLIB, ranlib, :)
 AC_CHECK_TOOL(STRIP, strip, :)
 AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, )
 if test "_$MAKEINFO" = "_"; then
 AC_CHECK_TOOL(STRIP, strip, :)
 AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, )
 if test "_$MAKEINFO" = "_"; then
-    MAKEINFO="@echo Makeinfo is missing. Info documentation will not be built.;true"
+    MAKEINFO="echo Makeinfo is missing. Info documentation will not be built."
 else
     case "$MAKEINFO" in
       */missing.*)
 else
     case "$MAKEINFO" in
       */missing.*)
@@ -903,6 +975,7 @@ AC_CHECK_HEADERS(m4_flatten([
        malloc.h
        mntent.h
        paths.h
        malloc.h
        mntent.h
        paths.h
+       pthread.h
        semaphore.h
        setjmp.h
        signal.h
        semaphore.h
        setjmp.h
        signal.h
@@ -916,8 +989,10 @@ AC_CHECK_HEADERS(m4_flatten([
        attr/xattr.h
        linux/falloc.h
        linux/fd.h
        attr/xattr.h
        linux/falloc.h
        linux/fd.h
+       linux/fsmap.h
        linux/major.h
        linux/loop.h
        linux/major.h
        linux/loop.h
+       linux/types.h
        net/if_dl.h
        netinet/in.h
        sys/acl.h
        net/if_dl.h
        netinet/in.h
        sys/acl.h
@@ -936,13 +1011,32 @@ AC_CHECK_HEADERS(m4_flatten([
        sys/sockio.h
        sys/stat.h
        sys/syscall.h
        sys/sockio.h
        sys/stat.h
        sys/syscall.h
-       sys/sysctl.h
        sys/sysmacros.h
        sys/time.h
        sys/types.h
        sys/un.h
        sys/wait.h
        sys/sysmacros.h
        sys/time.h
        sys/types.h
        sys/un.h
        sys/wait.h
+       sys/xattr.h
 ]))
 ]))
+dnl Check where to find a dd(1) that supports iflag=fullblock
+dnl and oflag=append
+AC_MSG_CHECKING([for a dd(1) program that supports iflag=fullblock])
+DD=
+for i in dd gdd ; do
+       if "$i" if=/dev/null of=/dev/null count=1 bs=10k 2>/dev/null iflag=fullblock oflag=append ; then
+               DD=$i
+               break
+       fi
+done
+if test -n "$DD" ; then
+       AC_MSG_RESULT([$DD])
+else
+       AC_MSG_RESULT([not found, using dd])
+       DD=dd
+       AC_MSG_WARN([No GNU-compatible dd(1) program found, expect some self-test failures.])
+fi
+AC_SUBST([DD])
+
 AC_CHECK_HEADERS(net/if.h,,,
 [[
 #if HAVE_SYS_TYPES_H
 AC_CHECK_HEADERS(net/if.h,,,
 [[
 #if HAVE_SYS_TYPES_H
@@ -954,7 +1048,7 @@ AC_CHECK_HEADERS(net/if.h,,,
 ]])
 AC_FUNC_VPRINTF
 dnl Check to see if dirent has member d_reclen. On cygwin those d_reclen
 ]])
 AC_FUNC_VPRINTF
 dnl Check to see if dirent has member d_reclen. On cygwin those d_reclen
-dnl is not decleared.
+dnl is not declared.
 AC_CHECK_MEMBER(struct dirent.d_reclen,[AC_DEFINE(HAVE_RECLEN_DIRENT, 1,
                       [Define to 1 if dirent has d_reclen])],,
                [#include <dirent.h>])
 AC_CHECK_MEMBER(struct dirent.d_reclen,[AC_DEFINE(HAVE_RECLEN_DIRENT, 1,
                       [Define to 1 if dirent has d_reclen])],,
                [#include <dirent.h>])
@@ -992,16 +1086,19 @@ AC_CHECK_SIZEOF(int)
 AC_CHECK_SIZEOF(long)
 AC_CHECK_SIZEOF(long long)
 AC_CHECK_SIZEOF(off_t)
 AC_CHECK_SIZEOF(long)
 AC_CHECK_SIZEOF(long long)
 AC_CHECK_SIZEOF(off_t)
+AC_CHECK_SIZEOF(time_t)
 SIZEOF_SHORT=$ac_cv_sizeof_short
 SIZEOF_INT=$ac_cv_sizeof_int
 SIZEOF_LONG=$ac_cv_sizeof_long
 SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
 SIZEOF_OFF_T=$ac_cv_sizeof_off_t
 SIZEOF_SHORT=$ac_cv_sizeof_short
 SIZEOF_INT=$ac_cv_sizeof_int
 SIZEOF_LONG=$ac_cv_sizeof_long
 SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
 SIZEOF_OFF_T=$ac_cv_sizeof_off_t
+SIZEOF_TIME_T=$ac_cv_sizeof_time_t
 AC_SUBST(SIZEOF_SHORT)
 AC_SUBST(SIZEOF_INT)
 AC_SUBST(SIZEOF_LONG)
 AC_SUBST(SIZEOF_LONG_LONG)
 AC_SUBST(SIZEOF_OFF_T)
 AC_SUBST(SIZEOF_SHORT)
 AC_SUBST(SIZEOF_INT)
 AC_SUBST(SIZEOF_LONG)
 AC_SUBST(SIZEOF_LONG_LONG)
 AC_SUBST(SIZEOF_OFF_T)
+AC_SUBST(SIZEOF_TIME_T)
 AC_C_BIGENDIAN
 if test $cross_compiling = no; then
   BUILD_CC="$BUILD_CC" CPP="$CPP" /bin/sh $ac_aux_dir/parse-types.sh
 AC_C_BIGENDIAN
 if test $cross_compiling = no; then
   BUILD_CC="$BUILD_CC" CPP="$CPP" /bin/sh $ac_aux_dir/parse-types.sh
@@ -1067,30 +1164,43 @@ AC_CHECK_MEMBER(struct sockaddr.sa_len,
        [#include <sys/types.h>
         #include <sys/socket.h>])
 dnl
        [#include <sys/types.h>
         #include <sys/socket.h>])
 dnl
-dnl This will add -lblkid to the AC_CHECK_FUNCS search if we are using
-dnl the system-provided blkid library
+dnl If we are using the system-provided blkid library, check for
+dnl the functions added after migrating that library to util-linux
 dnl
 if test -n "$BLKID_CMT"; then
 dnl
 if test -n "$BLKID_CMT"; then
-  AC_SEARCH_LIBS([blkid_probe_all], [blkid])
+  AC_CHECK_LIB(blkid, blkid_probe_get_topology,
+                     AC_DEFINE(HAVE_BLKID_PROBE_GET_TOPOLOGY, 1,
+                               [Define to 1 if blkid has blkid_probe_get_topology]))
+  AC_CHECK_LIB(blkid, blkid_topology_get_dax,
+                     AC_DEFINE(HAVE_BLKID_TOPOLOGY_GET_DAX, 1,
+                               [Define to 1 if blkid has blkid_topology_get_dax]))
+  AC_CHECK_LIB(blkid, blkid_probe_enable_partitions,
+                     AC_DEFINE(HAVE_BLKID_PROBE_ENABLE_PARTITIONS, 1,
+                               [Define to 1 if blkid has blkid_probe_enable_partitions]))
 fi
 dnl
 fi
 dnl
+if test -n "$DLOPEN_LIB" ; then
+   ac_cv_func_dlopen=yes
+fi
 AC_CHECK_FUNCS(m4_flatten([
        __secure_getenv
        add_key
        backtrace
 AC_CHECK_FUNCS(m4_flatten([
        __secure_getenv
        add_key
        backtrace
-       blkid_probe_get_topology
-       blkid_probe_enable_partitions
        chflags
        chflags
+       dlopen
        fadvise64
        fallocate
        fallocate64
        fchown
        fadvise64
        fallocate
        fallocate64
        fchown
+       fcntl
        fdatasync
        fstat64
        fdatasync
        fstat64
+       fsync
        ftruncate64
        futimes
        getcwd
        getdtablesize
        ftruncate64
        futimes
        getcwd
        getdtablesize
+       gethostname
        getmntinfo
        getpwuid_r
        getrlimit
        getmntinfo
        getpwuid_r
        getrlimit
@@ -1148,18 +1258,23 @@ dnl See if libmagic exists
 dnl
 AC_CHECK_LIB(magic, magic_file, [MAGIC_LIB=-lmagic
 AC_CHECK_HEADERS([magic.h])])
 dnl
 AC_CHECK_LIB(magic, magic_file, [MAGIC_LIB=-lmagic
 AC_CHECK_HEADERS([magic.h])])
-if test "$ac_cv_lib_dl_dlopen" = yes ; then
+if test "$ac_cv_func_dlopen" = yes ; then
    MAGIC_LIB=$DLOPEN_LIB
 fi
 AC_SUBST(MAGIC_LIB)
 dnl
    MAGIC_LIB=$DLOPEN_LIB
 fi
 AC_SUBST(MAGIC_LIB)
 dnl
+dnl Check to see if librt is required for clock_gettime() (glibc < 2.17)
+dnl
+AC_CHECK_LIB(rt, clock_gettime, [CLOCK_GETTIME_LIB=-lrt])
+AC_SUBST(CLOCK_GETTIME_LIB)
+dnl
 dnl Check to see if the FUSE library is -lfuse or -losxfuse
 dnl
 FUSE_CMT=
 FUSE_LIB=
 dnl osxfuse.dylib supersedes fuselib.dylib
 AC_ARG_ENABLE([fuse2fs],
 dnl Check to see if the FUSE library is -lfuse or -losxfuse
 dnl
 FUSE_CMT=
 FUSE_LIB=
 dnl osxfuse.dylib supersedes fuselib.dylib
 AC_ARG_ENABLE([fuse2fs],
-[  --disable-fuse2fs     do not build fuse2fs],
+AS_HELP_STRING([--disable-fuse2fs],[do not build fuse2fs]),
 if test "$enableval" = "no"
 then
        FUSE_CMT="#"
 if test "$enableval" = "no"
 then
        FUSE_CMT="#"
@@ -1221,16 +1336,20 @@ dnl Test for sem_init, and which library it might require:
 dnl
 AH_TEMPLATE([HAVE_SEM_INIT], [Define to 1 if sem_init() exists])
 SEM_INIT_LIB=''
 dnl
 AH_TEMPLATE([HAVE_SEM_INIT], [Define to 1 if sem_init() exists])
 SEM_INIT_LIB=''
-AC_CHECK_FUNC(sem_init, ,
-  AC_CHECK_LIB(pthread, sem_init,
+echo GL_THREADS_API: ${gl_threads_api}
+if test "${gl_threads_api}" != none
+then
+  AC_CHECK_FUNC(sem_init, ,
+    AC_CHECK_LIB(pthread, sem_init,
        AC_DEFINE(HAVE_SEM_INIT, 1)
        SEM_INIT_LIB=-lpthread,
        AC_DEFINE(HAVE_SEM_INIT, 1)
        SEM_INIT_LIB=-lpthread,
-  AC_CHECK_LIB(rt, sem_init,
+    AC_CHECK_LIB(rt, sem_init,
        AC_DEFINE(HAVE_SEM_INIT, 1)
        SEM_INIT_LIB=-lrt,
        AC_DEFINE(HAVE_SEM_INIT, 1)
        SEM_INIT_LIB=-lrt,
-  AC_CHECK_LIB(posix4, sem_init,
+    AC_CHECK_LIB(posix4, sem_init,
        AC_DEFINE(HAVE_SEM_INIT, 1)
        SEM_INIT_LIB=-lposix4))))dnl
        AC_DEFINE(HAVE_SEM_INIT, 1)
        SEM_INIT_LIB=-lposix4))))dnl
+fi
 AC_SUBST(SEM_INIT_LIB)
 dnl
 dnl Check for unified diff
 AC_SUBST(SEM_INIT_LIB)
 dnl
 dnl Check for unified diff
@@ -1252,6 +1371,131 @@ linux*)
        ;;
 esac
 dnl
        ;;
 esac
 dnl
+dnl Check the available mount options
+dnl
+AX_CHECK_MOUNT_OPT(nosuid)
+AX_CHECK_MOUNT_OPT(nodev)
+dnl Enable LTO for all packages
+dnl
+AC_ARG_ENABLE([lto],
+AS_HELP_STRING([--enable-lto],[enable link time optimization]),,
+enable_lto=no)
+if test "$enable_lto" = "yes" || test "$enable_lto" = "probe"; then
+       AC_MSG_CHECKING([if C compiler supports LTO])
+       OLD_CFLAGS="$CFLAGS"
+       OLD_LDFLAGS="$LDFLAGS"
+       LTO_FLAGS="-g -flto -ffat-lto-objects"
+       CFLAGS="$CFLAGS $LTO_FLAGS"
+       LDFLAGS="$LDFLAGS $LTO_FLAGS"
+       AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
+               [AC_MSG_RESULT([yes])]
+               [lto_cflags=$LTO_FLAGS]
+               [lto_ldflags=$LTO_FLAGS]
+               [AC_PATH_PROG(gcc_ar, gcc-ar,,)]
+               [AC_PATH_PROG(gcc_ranlib, gcc-ranlib,,)],
+               [AC_MSG_RESULT([no])])
+       if test -x "$gcc_ar" && test -x "$gcc_ranlib"; then
+               have_lto=yes
+               AR="${gcc_ar}"
+               RANLIB="${gcc_ranlib}"
+       fi
+       CFLAGS="${OLD_CFLAGS}"
+       LDFLAGS="${OLD_LDFLAGS}"
+       AC_SUBST(have_lto)
+       AC_SUBST(lto_cflags)
+       AC_SUBST(lto_ldflags)
+fi
+if test "$enable_lto" = "yes" && test "$have_lto" != "yes"; then
+       AC_MSG_ERROR([LTO not supported by compiler.])
+fi
+dnl
+dnl Enable UBSAN for all packages
+dnl
+AC_ARG_ENABLE([ubsan],
+AS_HELP_STRING([--enable-ubsan],[enable undefined behavior sanitizer]),,
+enable_ubsan=no)
+if test "$enable_ubsan" = "yes" || test "$enable_ubsan" = "probe"; then
+       AC_MSG_CHECKING([if C compiler supports UBSAN])
+       OLD_CFLAGS="$CFLAGS"
+       OLD_LDFLAGS="$LDFLAGS"
+       UBSAN_FLAGS="-fsanitize=undefined"
+       CFLAGS="$CFLAGS $UBSAN_FLAGS"
+       LDFLAGS="$LDFLAGS $UBSAN_FLAGS"
+       AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
+               [AC_MSG_RESULT([yes])]
+               [ubsan_cflags=$UBSAN_FLAGS]
+               [ubsan_ldflags=$UBSAN_FLAGS]
+               [have_ubsan=yes],
+               [AC_MSG_RESULT([no])])
+       CFLAGS="${OLD_CFLAGS}"
+       LDFLAGS="${OLD_LDFLAGS}"
+       AC_SUBST(have_ubsan)
+       AC_SUBST(ubsan_cflags)
+       AC_SUBST(ubsan_ldflags)
+fi
+if test "$enable_ubsan" = "yes" && test "$have_ubsan" != "yes"; then
+       AC_MSG_ERROR([UBSAN not supported by compiler.])
+fi
+dnl
+dnl Enable ADDRSAN for all packages
+dnl
+AC_ARG_ENABLE([addrsan],
+AS_HELP_STRING([--enable-addrsan],[enable address sanitizer]),,
+enable_addrsan=no)
+if test "$enable_addrsan" = "yes" || test "$enable_addrsan" = "probe"; then
+       AC_MSG_CHECKING([if C compiler supports ADDRSAN])
+       OLD_CFLAGS="$CFLAGS"
+       OLD_LDFLAGS="$LDFLAGS"
+       ADDRSAN_FLAGS="-fsanitize=address"
+       CFLAGS="$CFLAGS $ADDRSAN_FLAGS"
+       LDFLAGS="$LDFLAGS $ADDRSAN_FLAGS"
+       AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
+               [AC_MSG_RESULT([yes])]
+               [addrsan_cflags=$ADDRSAN_FLAGS]
+               [addrsan_ldflags=$ADDRSAN_FLAGS]
+               [have_addrsan=yes],
+               [AC_MSG_RESULT([no])])
+       CFLAGS="${OLD_CFLAGS}"
+       LDFLAGS="${OLD_LDFLAGS}"
+       AC_SUBST(have_addrsan)
+       AC_SUBST(addrsan_cflags)
+       AC_SUBST(addrsan_ldflags)
+fi
+if test "$enable_addrsan" = "yes" && test "$have_addrsan" != "yes"; then
+       AC_MSG_ERROR([ADDRSAN not supported by compiler.])
+fi
+dnl
+dnl Enable THREADSAN for all packages
+dnl
+AC_ARG_ENABLE([threadsan],
+AS_HELP_STRING([--enable-threadsan],[enable thread sanitizer]),,
+enable_threadsan=no)
+if test "$enable_threadsan" = "yes" || test "$enable_threadsan" = "probe"; then
+       AC_MSG_CHECKING([if C compiler supports THREADSAN])
+       OLD_CFLAGS="$CFLAGS"
+       OLD_LDFLAGS="$LDFLAGS"
+       THREADSAN_FLAGS="-fsanitize=thread"
+       CFLAGS="$CFLAGS $THREADSAN_FLAGS"
+       LDFLAGS="$LDFLAGS $THREADSAN_FLAGS"
+       AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
+               [AC_MSG_RESULT([yes])]
+               [threadsan_cflags=$THREADSAN_FLAGS]
+               [threadsan_ldflags=$THREADSAN_FLAGS]
+               [have_threadsan=yes],
+               [AC_MSG_RESULT([no])])
+       CFLAGS="${OLD_CFLAGS}"
+       LDFLAGS="${OLD_LDFLAGS}"
+       AC_SUBST(have_threadsan)
+       AC_SUBST(threadsan_cflags)
+       AC_SUBST(threadsan_ldflags)
+fi
+if test "$enable_threadsan" = "yes" && test "$have_threadsan" != "yes"; then
+       AC_MSG_ERROR([THREADSAN not supported by compiler.])
+fi
+if test "$have_threadsan" = "yes" && test "$have_addrsan" = "yes"; then
+       AC_MSG_WARN([ADDRSAN and THREADSAN are not known to work together.])
+fi
+dnl
 dnl OS-specific uncomment control
 dnl
 LINUX_CMT="#"
 dnl OS-specific uncomment control
 dnl
 LINUX_CMT="#"
@@ -1270,6 +1514,11 @@ AC_SUBST(LINUX_CMT)
 AC_SUBST(CYGWIN_CMT)
 AC_SUBST(UNIX_CMT)
 dnl
 AC_SUBST(CYGWIN_CMT)
 AC_SUBST(UNIX_CMT)
 dnl
+dnl e2scrub only builds on linux
+dnl
+E2SCRUB_CMT="$LINUX_CMT"
+AC_SUBST(E2SCRUB_CMT)
+dnl
 dnl Linux and Hurd places root files in the / by default
 dnl
 case "$host_os" in
 dnl Linux and Hurd places root files in the / by default
 dnl
 case "$host_os" in
@@ -1336,7 +1585,7 @@ dnl
 dnl Allow specification of the multiarch arch
 dnl
 AC_ARG_WITH([multiarch],
 dnl Allow specification of the multiarch arch
 dnl
 AC_ARG_WITH([multiarch],
-[  --with-multiarch=ARCH specify the multiarch triplet],
+AS_HELP_STRING([--with-multiarch=ARCH],[specify the multiarch triplet]),
 if test "$withval" = "lib64"; then
     libdir=/usr/lib64
     root_libdir=/lib64
 if test "$withval" = "lib64"; then
     libdir=/usr/lib64
     root_libdir=/lib64
@@ -1344,7 +1593,8 @@ else
     libdir=$libdir/$withval
     root_libdir=$root_libdir/$withval
 fi
     libdir=$libdir/$withval
     root_libdir=$root_libdir/$withval
 fi
-)dnl
+)
+dnl
 dnl
 dnl See if -static works.  This could fail if the linker does not
 dnl support -static, or if required external libraries are not available
 dnl
 dnl See if -static works.  This could fail if the linker does not
 dnl support -static, or if required external libraries are not available
@@ -1352,7 +1602,7 @@ dnl in static form.
 dnl
 AC_MSG_CHECKING([whether we can link with -static])
 AC_CACHE_VAL(ac_cv_e2fsprogs_use_static,
 dnl
 AC_MSG_CHECKING([whether we can link with -static])
 AC_CACHE_VAL(ac_cv_e2fsprogs_use_static,
-[SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -static"
+[SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS_STATIC -static"
 AC_TRY_LINK([#include <stdio.h>],[fflush(stdout);],
  ac_cv_e2fsprogs_use_static=yes, ac_cv_e2fsprogs_use_static=no)
 LDFLAGS=$SAVE_LDFLAGS])
 AC_TRY_LINK([#include <stdio.h>],[fflush(stdout);],
  ac_cv_e2fsprogs_use_static=yes, ac_cv_e2fsprogs_use_static=no)
 LDFLAGS=$SAVE_LDFLAGS])
@@ -1369,11 +1619,10 @@ solaris2.*)
 ;;
 esac
 AC_MSG_RESULT($ac_cv_e2fsprogs_use_static)
 ;;
 esac
 AC_MSG_RESULT($ac_cv_e2fsprogs_use_static)
-LDFLAG_STATIC=
 if test $ac_cv_e2fsprogs_use_static = yes; then
 if test $ac_cv_e2fsprogs_use_static = yes; then
-       LDFLAG_STATIC=-static
+       LDFLAGS_STATIC="$LDFLAGS_STATIC -static"
 fi
 fi
-AC_SUBST(LDFLAG_STATIC)
+AC_SUBST(LDFLAGS_STATIC)
 dnl
 dnl Work around mysterious Darwin / GNU libintl problem
 dnl (__asm__ redirection doesn't work for some mysterious reason.  Looks like
 dnl
 dnl Work around mysterious Darwin / GNU libintl problem
 dnl (__asm__ redirection doesn't work for some mysterious reason.  Looks like
@@ -1387,13 +1636,6 @@ darwin*)
        ;;
 esac
 dnl
        ;;
 esac
 dnl
-dnl Make the ss and et directories work correctly.
-dnl
-SS_DIR=`cd ${srcdir}/lib/ss; pwd`
-ET_DIR=`cd ${srcdir}/lib/et; pwd`
-AC_SUBST(SS_DIR)
-AC_SUBST(ET_DIR)
-dnl
 dnl Only try to run the test suite if we're not cross compiling.
 dnl
 if test "$cross_compiling" = yes ; then
 dnl Only try to run the test suite if we're not cross compiling.
 dnl
 if test "$cross_compiling" = yes ; then
@@ -1416,7 +1658,6 @@ if test -n "$WITH_DIET_LIBC" ; then
        INCLUDES="$INCLUDES -D_REENTRANT"
 fi
 AC_SUBST(INCLUDES)
        INCLUDES="$INCLUDES -D_REENTRANT"
 fi
 AC_SUBST(INCLUDES)
-AM_MKINSTALLDIRS
 dnl
 dnl Build CFLAGS
 dnl
 dnl
 dnl Build CFLAGS
 dnl
@@ -1427,6 +1668,125 @@ fi
 AC_SUBST(BUILD_CFLAGS)
 AC_SUBST(BUILD_LDFLAGS)
 dnl
 AC_SUBST(BUILD_CFLAGS)
 AC_SUBST(BUILD_LDFLAGS)
 dnl
+dnl Define CFLAGS and LDFLAGS for shared libraries
+dnl
+CFLAGS_SHLIB=${CFLAGS_SHLIB:-$CFLAGS}
+CFLAGS_STLIB=${CFLAGS_STLIB:-$CFLAGS}
+LDFLAGS_SHLIB=${LDFLAGS_SHLIB:-$LDFLAGS}
+AC_SUBST(CFLAGS_SHLIB)
+AC_SUBST(CFLAGS_STLIB)
+AC_SUBST(LDFLAGS_SHLIB)
+
+dnl
+dnl Where do udev rules go?
+dnl
+AC_ARG_WITH([udev_rules_dir],
+  [AS_HELP_STRING([--with-udev-rules-dir@<:@=DIR@:>@],
+       [Install udev rules into DIR.])],
+  [],
+  [with_udev_rules_dir=yes])
+AS_IF([test "x${with_udev_rules_dir}" != "xno"],
+  [
+       AS_IF([test "x${with_udev_rules_dir}" = "xyes"],
+         [
+               PKG_CHECK_MODULES([udev], [udev],
+                 [
+                       with_udev_rules_dir="$($PKG_CONFIG --variable=udevdir udev)/rules.d"
+                 ], [
+                       with_udev_rules_dir=""
+                 ])
+         ])
+       AC_MSG_CHECKING([for udev rules dir])
+       pkg_udev_rules_dir="${with_udev_rules_dir}"
+       AS_IF([test -n "${pkg_udev_rules_dir}"],
+         [
+               AC_MSG_RESULT(${pkg_udev_rules_dir})
+               have_udev="yes"
+         ],
+         [
+               AC_MSG_RESULT(no)
+               have_udev="no"
+         ])
+  ],
+  [
+       have_udev="disabled"
+  ])
+AC_SUBST(have_udev)
+AC_SUBST(pkg_udev_rules_dir)
+
+dnl
+dnl Where do cron jobs go?
+dnl
+AC_ARG_WITH([crond_dir],
+  [AS_HELP_STRING([--with-crond-dir@<:@=DIR@:>@],
+       [Install system crontabs into DIR.])],
+  [],
+  [with_crond_dir=yes])
+AS_IF([test "x${with_crond_dir}" != "xno"],
+  [
+       AS_IF([test "x${with_crond_dir}" = "xyes"],
+         [
+               AS_IF([test -d "/etc/cron.d"],
+                 [with_crond_dir="/etc/cron.d"],
+                 [have_crond="no"; with_crond_dir=""])
+         ])
+       AC_MSG_CHECKING([for system crontab dir])
+       crond_dir="${with_crond_dir}"
+       AS_IF([test -n "${crond_dir}"],
+         [
+               AC_MSG_RESULT(${crond_dir})
+               have_crond="yes"
+         ],
+         [
+               AC_MSG_RESULT(no)
+               have_crond="no"
+         ])
+  ],
+  [
+       have_crond="disabled"
+  ])
+AC_SUBST(have_crond)
+AC_SUBST(crond_dir)
+
+dnl
+dnl Where do systemd services go?
+dnl
+AC_ARG_WITH([systemd_unit_dir],
+  [AS_HELP_STRING([--with-systemd-unit-dir@<:@=DIR@:>@],
+       [Install systemd system units into DIR.])],
+  [],
+  [with_systemd_unit_dir=yes])
+AS_IF([test "x${with_systemd_unit_dir}" != "xno"],
+  [
+       AS_IF([test "x${with_systemd_unit_dir}" = "xyes"],
+         [
+               PKG_CHECK_MODULES([systemd], [systemd],
+                 [
+                       with_systemd_unit_dir="$($PKG_CONFIG --variable=systemdsystemunitdir systemd)"
+                 ], [
+                       with_systemd_unit_dir=""
+                 ])
+               m4_pattern_allow([^PKG_(MAJOR|MINOR|BUILD|REVISION)$])
+         ])
+       AC_MSG_CHECKING([for systemd system unit dir])
+       systemd_system_unit_dir="${with_systemd_unit_dir}"
+       AS_IF([test -n "${systemd_system_unit_dir}"],
+         [
+               AC_MSG_RESULT(${systemd_system_unit_dir})
+               have_systemd="yes"
+         ],
+         [
+               AC_MSG_RESULT(no)
+               have_systemd="no"
+         ])
+  ],
+  [
+       have_systemd="disabled"
+  ])
+AC_SUBST(have_systemd)
+AC_SUBST(systemd_system_unit_dir)
+
+dnl
 dnl Make our output files, being sure that we create the some miscellaneous 
 dnl directories
 dnl
 dnl Make our output files, being sure that we create the some miscellaneous 
 dnl directories
 dnl
@@ -1442,16 +1802,15 @@ if test -z "$BLKID_CMT" ; then
        blkid_out_list="lib/blkid/Makefile lib/blkid/blkid.pc \
                lib/blkid/blkid_types.h"
 fi
        blkid_out_list="lib/blkid/Makefile lib/blkid/blkid.pc \
                lib/blkid/blkid_types.h"
 fi
-for i in MCONFIG Makefile e2fsprogs.spec \
+for i in MCONFIG Makefile \
        util/Makefile util/subst.conf util/gen-tarball util/install-symlink \
        lib/et/Makefile lib/ss/Makefile lib/e2p/Makefile \
        lib/ext2fs/Makefile lib/ext2fs/ext2_types.h \
        util/Makefile util/subst.conf util/gen-tarball util/install-symlink \
        lib/et/Makefile lib/ss/Makefile lib/e2p/Makefile \
        lib/ext2fs/Makefile lib/ext2fs/ext2_types.h \
-       $uuid_out_list $blkid_out_list lib/quota/Makefile \
+       $uuid_out_list $blkid_out_list lib/support/Makefile \
        lib/ss/ss.pc lib/et/com_err.pc lib/e2p/e2p.pc lib/ext2fs/ext2fs.pc \
        misc/Makefile ext2ed/Makefile e2fsck/Makefile \
        debugfs/Makefile tests/Makefile tests/progs/Makefile \
        lib/ss/ss.pc lib/et/com_err.pc lib/e2p/e2p.pc lib/ext2fs/ext2fs.pc \
        misc/Makefile ext2ed/Makefile e2fsck/Makefile \
        debugfs/Makefile tests/Makefile tests/progs/Makefile \
-       resize/Makefile doc/Makefile intl/Makefile \
-       intl/libgnuintl.h po/Makefile.in ; do
+       resize/Makefile doc/Makefile po/Makefile.in scrub/Makefile; do
        if test -d `dirname ${srcdir}/$i` ; then
                outlist="$outlist $i"
        fi
        if test -d `dirname ${srcdir}/$i` ; then
                outlist="$outlist $i"
        fi