Skip to content

Commit 94d8824

Browse files
committed
Merge pull request #42 from argiopetech/master
Adds a more comprehensive check for fdatasync
2 parents fa24ceb + b06446e commit 94d8824

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

configure.ac

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,26 @@ AC_CHECK_FUNCS([lutimes futimes])
6868
AC_CHECK_FUNCS([mkstemps mkdtemp])
6969

7070
# Functions for file synchronization and allocation control
71-
AC_CHECK_FUNCS([fsync fdatasync])
71+
AC_CHECK_FUNCS([fsync])
72+
73+
# A more comprehensive check that fdatasync exits
74+
# Necessary for platforms that have fdatasync in headers but have no
75+
# implementation
76+
dnl Originally provided by user copiousfreetime for the beanstalkd project
77+
dnl {{{ make sure that fdatasync exits
78+
AC_CACHE_CHECK([for fdatasync],[ac_cv_func_fdatasync],[
79+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
80+
#include <unistd.h>
81+
]],[[
82+
fdatasync(4);
83+
]])],
84+
[ac_cv_func_fdatasync=yes],
85+
[ac_cv_func_fdatasync=no])
86+
])
87+
AS_IF([test "x${ac_cv_func_fdatasync}" = "xyes"],
88+
[AC_DEFINE([HAVE_FDATASYNC],[1],[If the system defines fdatasync])])
89+
dnl }}}
90+
7291
AC_CHECK_FUNCS([posix_fadvise posix_fallocate])
7392

7493
# Avoid adding rt if absent or unneeded

0 commit comments

Comments
 (0)