summaryrefslogtreecommitdiff
path: root/lib/replace
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-10-16 19:53:17 +1100
committerAndrew Tridgell <tridge@samba.org>2010-10-19 11:22:35 +1100
commitec90b249ecbd415c931630070b0831c6cf86d2d4 (patch)
treef33e0bdaed4d684db54bcc5151ddbbd84cae721e /lib/replace
parent1ac19c1ca3164dc6a1b29ce81047bab81a9af918 (diff)
downloadsamba-ec90b249ecbd415c931630070b0831c6cf86d2d4.tar.gz
samba-ec90b249ecbd415c931630070b0831c6cf86d2d4.tar.bz2
samba-ec90b249ecbd415c931630070b0831c6cf86d2d4.zip
replace: cope with systems that have fdatasync(), but don't have the prototype
this is needed for MacOSX 10.4.1
Diffstat (limited to 'lib/replace')
-rw-r--r--lib/replace/libreplace.m41
-rw-r--r--lib/replace/replace.h2
-rw-r--r--lib/replace/wscript5
3 files changed, 7 insertions, 1 deletions
diff --git a/lib/replace/libreplace.m4 b/lib/replace/libreplace.m4
index 0d716e0abe..3dd64ef8b8 100644
--- a/lib/replace/libreplace.m4
+++ b/lib/replace/libreplace.m4
@@ -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
diff --git a/lib/replace/replace.h b/lib/replace/replace.h
index 8fde16c52d..10c7ee701c 100644
--- a/lib/replace/replace.h
+++ b/lib/replace/replace.h
@@ -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
diff --git a/lib/replace/wscript b/lib/replace/wscript
index fef366317c..a3cde2bcc8 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -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