Whamcloud - gitweb
libext2fs: in ext2fs_open[2](), return an error if s_desc_size is too large
[tools/e2fsprogs.git] / configure.ac
index 4c4b552..cb528da 100644 (file)
@@ -1,8 +1,10 @@
-AC_INIT(version.h)
-AC_PREREQ(2.69)
+AC_INIT
+AC_CONFIG_SRCDIR([version.h])
+AC_PREREQ([2.71])
 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
@@ -123,7 +125,6 @@ then
 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
@@ -1005,6 +1006,7 @@ AC_CHECK_HEADERS(m4_flatten([
        sys/mman.h
        sys/mount.h
        sys/prctl.h
+       sys/random.h
        sys/resource.h
        sys/select.h
        sys/socket.h
@@ -1137,18 +1139,12 @@ dnl flags somewhat portably.  Also check for the analogous setter, chflags().
 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,
@@ -1200,9 +1196,11 @@ AC_CHECK_FUNCS(m4_flatten([
        futimes
        getcwd
        getdtablesize
+       getentropy
        gethostname
        getmntinfo
        getpwuid_r
+       getrandom
        getrlimit
        getrusage
        jrand48
@@ -1211,6 +1209,7 @@ AC_CHECK_FUNCS(m4_flatten([
        llseek
        lseek64
        mallinfo
+       mallinfo2
        mbstowcs
        memalign
        mempcpy
@@ -1603,8 +1602,7 @@ dnl
 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
@@ -1785,7 +1783,18 @@ AS_IF([test "x${with_systemd_unit_dir}" != "xno"],
   ])
 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
@@ -1815,5 +1824,6 @@ for i in MCONFIG Makefile \
                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