Skip to content

Commit

Permalink
Improve detection of fdatasync(2)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
hvr committed Dec 16, 2015
1 parent 59edb0a commit 5d5b747
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* Turn build error into compile warnings for exotic `struct stat`
configurations (GHC #8859).

* Improve detection of `fdatasync(2)` (GHC #11137)

## 2.7.1.0 *Dec 2014*

* Bundled with GHC 7.10.1
Expand Down
23 changes: 6 additions & 17 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,12 @@ AC_CHECK_FUNCS([mkstemps mkdtemp])
# Functions for file synchronization and allocation control
AC_CHECK_FUNCS([fsync])

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


AC_CHECK_FUNCS([posix_fadvise posix_fallocate])

Expand Down

0 comments on commit 5d5b747

Please sign in to comment.