-AC_INIT(version.h)
-AC_PREREQ(2.69)
+AC_INIT
+AC_CONFIG_SRCDIR([version.h])
+AC_PREREQ(2.59)
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_HEADERS([lib/config.h])
AH_BOTTOM([#include <dirpaths.h>])
+AC_USE_SYSTEM_EXTENSIONS
MCONFIG=./MCONFIG
AC_SUBST_FILE(MCONFIG)
BINARY_TYPE=bin
dnl
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}'`
-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/')
+E2FSPROGS_VERSION=`awk -F\" '/E2FSPROGS_VER/ { print $2 }' ${srcdir}/version.h`
+E2FSPROGS_DATE=`awk -F\" '/E2FSPROGS_DATE/ { print $2 }' ${srcdir}/version.h`
+E2FSPROGS_DAY=$(echo $E2FSPROGS_DATE | awk -F- '{ printf "%02d", $1 }')
MONTH=`echo $E2FSPROGS_DATE | awk -F- '{print $2}'`
YEAR=`echo $E2FSPROGS_DATE | awk -F- '{print $3}'`
*) AC_MSG_WARN([Unknown month $MONTH??]) ;;
esac
-base_ver=`echo $E2FSPROGS_VERSION | \
- sed -e 's/-WIP//' -e 's/pre-//' -e 's/-PLUS//'`
+base_ver=`echo $E2FSPROGS_VERSION | sed -e 's/pre-//' -e 's/-.*//'`
+base_rel=`echo $E2FSPROGS_VERSION | awk -F- '{ print $2 }'`
date_spec=${E2FSPROGS_YEAR}.${MONTH_NUM}.${E2FSPROGS_DAY}
case $E2FSPROGS_VERSION in
*-WIP|pre-*)
- E2FSPROGS_PKGVER="$base_ver~WIP.$date_spec"
+ E2FSPROGS_PKGVER="$base_ver"
+ E2FSPROGS_PKGREL="WIP.$date_spec"
;;
*)
E2FSPROGS_PKGVER="$base_ver"
+ E2FSPROGS_PKGREL="$base_rel"
;;
esac
unset DATE MONTH YEAR base_ver pre_vers date_spec
AC_MSG_RESULT([Generating configuration file for e2fsprogs version $E2FSPROGS_VERSION])
+AC_MSG_RESULT([Package version ${E2FSPROGS_PKGVER} release ${E2FSPROGS_PKGREL}])
AC_MSG_RESULT([Release date is ${E2FSPROGS_MONTH}, ${E2FSPROGS_YEAR}])
AC_SUBST(E2FSPROGS_YEAR)
AC_SUBST(E2FSPROGS_MONTH)
AC_SUBST(E2FSPROGS_DAY)
AC_SUBST(E2FSPROGS_VERSION)
AC_SUBST(E2FSPROGS_PKGVER)
+AC_SUBST(E2FSPROGS_PKGREL)
AC_SUBST(E2FSPROGS_DATE)
dnl
dnl Use diet libc
else
AC_MSG_RESULT([[(none)]])
fi
-AC_USE_SYSTEM_EXTENSIONS
dnl
dnl Set default values for library extensions. Will be dealt with after
dnl parsing configuration options, which may modify these
AC_CHECK_PROGS(BUILD_CC, gcc cc)
fi
AC_CHECK_HEADERS(m4_flatten([
+ attr/xattr.h
dirent.h
errno.h
execinfo.h
sys/mman.h
sys/mount.h
sys/prctl.h
+ sys/random.h
sys/resource.h
sys/select.h
sys/socket.h
dnl
AC_MSG_CHECKING(whether struct stat has a st_flags field)
AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags,
- AC_TRY_COMPILE([#include <sys/stat.h>],
- [struct stat stat; stat.st_flags = 0;],
- [e2fsprogs_cv_struct_st_flags=yes],
- [e2fsprogs_cv_struct_st_flags=no]))
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[struct stat stat; stat.st_flags = 0;]])],[e2fsprogs_cv_struct_st_flags=yes],[e2fsprogs_cv_struct_st_flags=no]))
AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags)
if test "$e2fsprogs_cv_struct_st_flags" = yes; then
AC_MSG_CHECKING(whether st_flags field is useful)
AC_CACHE_VAL(e2fsprogs_cv_struct_st_flags_immut,
- AC_TRY_COMPILE([#include <sys/stat.h>],
- [struct stat stat; stat.st_flags |= UF_IMMUTABLE;],
- [e2fsprogs_cv_struct_st_flags_immut=yes],
- [e2fsprogs_cv_struct_st_flags_immut=no]))
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[struct stat stat; stat.st_flags |= UF_IMMUTABLE;]])],[e2fsprogs_cv_struct_st_flags_immut=yes],[e2fsprogs_cv_struct_st_flags_immut=no]))
AC_MSG_RESULT($e2fsprogs_cv_struct_st_flags_immut)
if test "$e2fsprogs_cv_struct_st_flags_immut" = yes; then
AC_DEFINE(HAVE_STAT_FLAGS, 1,
futimes
getcwd
getdtablesize
+ getentropy
gethostname
getmntinfo
getpwuid_r
+ getrandom
getrlimit
getrusage
jrand48
llseek
lseek64
mallinfo
+ mallinfo2
mbstowcs
memalign
mempcpy
AC_MSG_WARN([ADDRSAN and THREADSAN are not known to work together.])
fi
dnl
+dnl Enable the fuzzer sanitizer for all packages
+dnl
+FUZZING_CMT="#"
+AC_ARG_ENABLE([fuzzing],
+AS_HELP_STRING([--enable-fuzzing],[enable fuzzing sanitizer]),,
+enable_fuzzing=no)
+if test "$enable_fuzzing" = "yes" || test "$enable_fuzzing" = "probe"; then
+ AC_PROG_CXX
+ AC_MSG_CHECKING([if C compiler supports fuzzing sanitizer])
+ AC_LANG_PUSH([C++])
+ OLD_CXXFLAGS="$CXXFLAGS"
+ OLD_LDFLAGS="$LDFLAGS"
+ FUZZER_FLAGS="-fsanitize=fuzzer"
+ CXXFLAGS="$CXXFLAGS $FUZZER_FLAGS"
+ LDFLAGS="$LDFLAGS $FUZZER_FLAGS"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include <stddef.h>
+ #include <stdint.h>
+ ]],
+ [ return 0; ])],
+ [AC_MSG_RESULT([yes])]
+ [fuzzer_cflags=$FUZZER_FLAGS]
+ [fuzzer_ldflags=$FUZZER_FLAGS]
+ [FUZZING_CMT=]
+ [have_fuzzer=yes],
+ [AC_MSG_RESULT([no])]
+ [AC_MSG_ERROR([fuzzing requested but not available])])
+ CXXFLAGS="${OLD_CXXFLAGS}"
+ LDFLAGS="${OLD_LDFLAGS}"
+ AC_LANG_POP([C++])
+ AC_SUBST(have_fuzzer)
+ AC_SUBST(fuzzer_cflags)
+ AC_SUBST(fuzzer_ldflags)
+fi
+if test "$enable_fuzzer" = "yes" && test "$have_fuzzer" != "yes"; then
+ AC_MSG_ERROR([Fuzzing not supported by compiler.])
+fi
+AC_SUBST(FUZZING_CMT)
+dnl
dnl OS-specific uncomment control
dnl
LINUX_CMT="#"
AC_MSG_CHECKING([whether we can link with -static])
AC_CACHE_VAL(ac_cv_e2fsprogs_use_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)
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[fflush(stdout);]])],[ac_cv_e2fsprogs_use_static=yes],[ac_cv_e2fsprogs_use_static=no])
LDFLAGS=$SAVE_LDFLAGS])
dnl
dnl Regardless of how the test turns out, Solaris doesn't handle -static
])
AC_SUBST(have_systemd)
AC_SUBST(systemd_system_unit_dir)
-
+dnl Adjust the compiled files if we are on windows vs everywhere else
+dnl
+OS_IO_FILE=""
+[case "$host_os" in
+ cigwin*|mingw*|msys*)
+ OS_IO_FILE=windows_io
+ ;;
+ *)
+ OS_IO_FILE=unix_io
+ ;;
+esac]
+AC_SUBST(OS_IO_FILE)
dnl
dnl Make our output files, being sure that we create the some miscellaneous
dnl directories
lib/blkid/blkid_types.h"
fi
for i in MCONFIG Makefile \
+ e2fsprogs-RHEL-6.spec \
+ e2fsprogs-SUSE_LINUX-11+.spec \
+ e2fsprogs-RHEL-7+.spec \
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 \
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 po/Makefile.in scrub/Makefile; do
+ tests/fuzz/Makefile resize/Makefile doc/Makefile \
+ po/Makefile.in scrub/Makefile; do
if test -d `dirname ${srcdir}/$i` ; then
outlist="$outlist $i"
fi
done
-AC_OUTPUT($outlist)
+AC_CONFIG_FILES([$outlist])
+AC_OUTPUT
if test -f util/gen-tarball; then chmod +x util/gen-tarball; fi