From 6f49c18b744416207997de4497c1f17b98a45f77 Mon Sep 17 00:00:00 2001 From: Patrik Nyblom Date: Mon, 25 Feb 2013 10:54:31 +0100 Subject: Make configure test for fallocate try to link This hopefully detects fault glibc's where fallocate64 is nonexistent. --- erts/configure.in | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/erts/configure.in b/erts/configure.in index 7257751068..2ee907b6e4 100644 --- a/erts/configure.in +++ b/erts/configure.in @@ -1082,8 +1082,26 @@ fi AC_SUBST(ERTS_BUILD_SMP_EMU) -AC_CHECK_FUNCS([posix_fadvise, fallocate]) +AC_CHECK_FUNCS([posix_fadvise]) AC_CHECK_HEADERS([linux/falloc.h]) +dnl * Old glibcs have broken fallocate64(). Make sure not to use it. +AC_CACHE_CHECK([whether fallocate() works],i_cv_fallocate_works,[ + AC_TRY_LINK([ + #include + #include + #include + #include + #include + #include + ], + [ + int fd = creat("conftest.temp", 0600); + fallocate(fd, FALLOC_FL_KEEP_SIZE,(off_t) 1024,(off_t) 1024); + ], i_cv_fallocate_works=yes, i_cv_fallocate_works=no) +]) +if test $i_cv_fallocate_works = yes; then + AC_DEFINE(HAVE_FALLOCATE, 1, Define if you have a working fallocate()) +fi dnl * Old glibcs have broken posix_fallocate(). Make sure not to use it. dnl * It may also be broken in AIX. -- cgit v1.2.3