[libvirt] [PATCH] build: work around lack of MacOS fdatasync

Eric Blake eblake at redhat.com
Fri Sep 16 15:21:19 UTC 2011


Mingw lacks fsync, but gnulib provides that.  Meanwhile, gnulib does
not (yet) provide fdatasync, so this is a quick hack to fake that
function on MacOS X; we can revert this configure change once gnulib
gives us a real module.

* bootstrap.conf (gnulib_modules): Add fsync.
* configure.ac (AC_CHECK_FUNCS_ONCE): Check for fdatasync, and
fake it with fsync when not present.
---

I've tested that this is a no-op on Linux, but would appreciate someone
with a MacOS setup to quickly test that it fixes the build there.

 bootstrap.conf |    1 +
 configure.ac   |    5 ++++-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/bootstrap.conf b/bootstrap.conf
index 94af051..e609ba8 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -42,6 +42,7 @@ fcntl
 fcntl-h
 ffs
 fnmatch
+fsync
 func
 getaddrinfo
 getcwd-lgpl
diff --git a/configure.ac b/configure.ac
index 5e3539f..611a141 100644
--- a/configure.ac
+++ b/configure.ac
@@ -126,9 +126,12 @@ AC_CHECK_SIZEOF([long])

 dnl Availability of various common functions (non-fatal if missing),
 dnl and various less common threadsafe functions
-AC_CHECK_FUNCS_ONCE([cfmakeraw geteuid getgid getgrnam_r getmntent_r \
+AC_CHECK_FUNCS_ONCE([cfmakeraw fdatasync geteuid getgid getgrnam_r getmntent_r \
   getpwuid_r getuid initgroups kill mmap posix_fallocate posix_memalign \
   regexec sched_getaffinity])
+if test $ac_cv_func_fdatasync = no; then
+  AC_DEFINE([fdatasync], [fsync], [Define to fsync if you lack fdatasync])
+fi

 dnl Availability of pthread functions (if missing, win32 threading is
 dnl assumed).  Because of $LIB_PTHREAD, we cannot use AC_CHECK_FUNCS_ONCE.
-- 
1.7.4.4




More information about the libvir-list mailing list