Skip to content

Commit 5d5b747

Browse files
committed
Improve detection of fdatasync(2)
This attempts a simpler and hopefully more robust test for `fdatasync(2)` See 94d8824 / #42 for the previous attempt. This hopefully addresses #52 in a better way than #53
1 parent 59edb0a commit 5d5b747

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
* Turn build error into compile warnings for exotic `struct stat`
1010
configurations (GHC #8859).
1111

12+
* Improve detection of `fdatasync(2)` (GHC #11137)
13+
1214
## 2.7.1.0 *Dec 2014*
1315

1416
* Bundled with GHC 7.10.1

configure.ac

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -71,23 +71,12 @@ AC_CHECK_FUNCS([mkstemps mkdtemp])
7171
# Functions for file synchronization and allocation control
7272
AC_CHECK_FUNCS([fsync])
7373

74-
# A more comprehensive check that fdatasync exits
75-
# Necessary for platforms that have fdatasync in headers but have no
76-
# implementation
77-
dnl Originally provided by user copiousfreetime for the beanstalkd project
78-
dnl {{{ make sure that fdatasync exits
79-
AC_CACHE_CHECK([for fdatasync],[ac_cv_func_fdatasync],[
80-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
81-
#include <unistd.h>
82-
]],[[
83-
fdatasync(4);
84-
]])],
85-
[ac_cv_func_fdatasync=yes],
86-
[ac_cv_func_fdatasync=no])
87-
])
88-
AS_IF([test "x${ac_cv_func_fdatasync}" = "xyes"],
89-
[AC_DEFINE([HAVE_FDATASYNC],[1],[If the system defines fdatasync])])
90-
dnl }}}
74+
# On OSX linking against 'fdatasync' succeeds, but that doesn't pick
75+
# the expected the POSIX 'fdatasync' function. So make sure that we
76+
# also have a function declaration in scope, in addition to being able
77+
# to link against 'fdatasync'.
78+
AC_CHECK_DECLS([fdatasync],[AC_CHECK_FUNCS([fdatasync])])
79+
9180

9281
AC_CHECK_FUNCS([posix_fadvise posix_fallocate])
9382

0 commit comments

Comments
 (0)