replace: cope with systems that have fdatasync(), but don't have the prototype
authorAndrew Tridgell <tridge@samba.org>
Sat, 16 Oct 2010 08:53:17 +0000 (19:53 +1100)
committerAndrew Tridgell <tridge@samba.org>
Tue, 19 Oct 2010 00:22:35 +0000 (11:22 +1100)
this is needed for MacOSX 10.4.1

lib/replace/libreplace.m4
lib/replace/replace.h
lib/replace/wscript

index 0d716e0abe03310b98a0e74be1f46089aa44072f..3dd64ef8b8798fe0ac43014d39664c497a6bf34b 100644 (file)
@@ -115,6 +115,7 @@ AC_CHECK_FUNCS(fdatasync,,[
                [libreplace_cv_HAVE_FDATASYNC_IN_LIBRT=yes
                AC_DEFINE(HAVE_FDATASYNC, 1, Define to 1 if there is support for fdatasync)])
 ])
+AC_HAVE_DECL(fdatasync, [#include <unistd.h>])
 AC_CHECK_FUNCS(clock_gettime,libreplace_cv_have_clock_gettime=yes,[
        AC_CHECK_LIB(rt, clock_gettime,
                [libreplace_cv_HAVE_CLOCK_GETTIME_IN_LIBRT=yes
index 8fde16c52d045135e300d6fc785465a236e09b00..10c7ee701c5f3f5476a512ebd094b914c4c80fca 100644 (file)
@@ -756,6 +756,8 @@ char *ufc_crypt(const char *key, const char *salt);
 
 #ifndef HAVE_FDATASYNC
 #define fdatasync(fd) fsync(fd)
+#elif !defined(HAVE_DECL_FDATASYNC)
+int fdatasync(int );
 #endif
 
 /* these are used to mark symbols as local to a shared lib, or
index fef366317cd3dba045c071d270e30ff3fa3957dc..a3cde2bcc847762ef477bb32c0a3499577513317 100644 (file)
@@ -173,7 +173,10 @@ def configure(conf):
     conf.CHECK_C_PROTOTYPE('dlopen', 'void *dlopen(const char* filename, unsigned int flags)',
                            define='DLOPEN_TAKES_UNSIGNED_FLAGS', headers='dlfcn.h dl.h')
 
-    conf.CHECK_FUNCS_IN('fdatasync', 'rt', checklibc=True)
+    if conf.CHECK_FUNCS_IN('fdatasync', 'rt', checklibc=True):
+        # some systems are missing the declaration
+        conf.CHECK_DECLS('fdatasync')
+
     conf.CHECK_FUNCS_IN('clock_gettime', 'rt', checklibc=True)
 
     # these headers need to be tested as a group on freebsd