From 182dbdf0f4b6e6484b0d4588aaefacc75862a99c Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Thu, 26 Mar 2020 10:59:46 +0100 Subject: util: Detect posix_fallocate() instead of assuming Don't assume that `posix_fallocate()` is available on Linux and not available on other operating systems. At least FreeBSD has it and we are not using it. Properly check whether `posix_fallocate()` is present and use it if it is. --- configure.ac | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index ef87d759f1..c8984c83c3 100644 --- a/configure.ac +++ b/configure.ac @@ -851,6 +851,22 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [ AC_MSG_RESULT(no)] ) +dnl Check for posix_fallocate +AC_MSG_CHECKING(for posix_fallocate) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + // same as in src/util/system.cpp + #ifdef __linux__ + #ifdef _POSIX_C_SOURCE + #undef _POSIX_C_SOURCE + #endif + #define _POSIX_C_SOURCE 200112L + #endif // __linux__ + #include ]], + [[ int f = posix_fallocate(0, 0, 0); ]])], + [ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_POSIX_FALLOCATE, 1,[Define this symbol if you have posix_fallocate]) ], + [ AC_MSG_RESULT(no)] +) + AC_MSG_CHECKING([for visibility attribute]) AC_LINK_IFELSE([AC_LANG_SOURCE([ int foo_def( void ) __attribute__((visibility("default"))); -- cgit v1.2.3