aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrik Nyblom <[email protected]>2013-02-25 10:54:31 +0100
committerPatrik Nyblom <[email protected]>2013-03-18 10:42:56 +0100
commit6f49c18b744416207997de4497c1f17b98a45f77 (patch)
tree3903607accd85cfff7c7c70687d1d7d5b2a8f22e
parentfe18e8fc06ca156e0de76a6cf3f8068856746a36 (diff)
downloadotp-6f49c18b744416207997de4497c1f17b98a45f77.tar.gz
otp-6f49c18b744416207997de4497c1f17b98a45f77.tar.bz2
otp-6f49c18b744416207997de4497c1f17b98a45f77.zip
Make configure test for fallocate try to link
This hopefully detects fault glibc's where fallocate64 is nonexistent.
-rw-r--r--erts/configure.in20
1 files changed, 19 insertions, 1 deletions
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 <stdio.h>
+ #include <stdlib.h>
+ #include <fcntl.h>
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <linux/falloc.h>
+ ],
+ [
+ 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.