[PATCH 2/3] libgst: Fix the cint.c build on XNU/Darwin

Holger Hans Peter Freyther <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.gnu.general
Message-ID <[email protected]>
fdatasync appears to be available when linking but there is
no declaration in XNU. Move from checking the function to
checking the declaration.

Fixes:

cint.c:663:35: error: use of undeclared identifier 'fdatasync'
  _gst_define_cfunc ("fdatasync", fdatasync);
                                  ^

2015-05-21  Holger Hans Peter Freyther  <[email protected]>

	* configure.ac: Move from AC_CHECK_FUNCS_ONCE to AC_CHECK_DECLS
	for fdatasync.

2015-05-21  Holger Hans Peter Freyther  <[email protected]>

	* cint.c: Change to use #if instead of #ifdef and update
	the macro to change for.
---
 ChangeLog        | 5 +++++
 configure.ac     | 3 ++-
 libgst/ChangeLog | 5 +++++
 libgst/cint.c    | 2 +-
 4 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b88cfe7..2875294 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-05-21  Holger Hans Peter Freyther  <[email protected]>
+
+	* configure.ac: Move from AC_CHECK_FUNCS_ONCE to AC_CHECK_DECLS
+	for fdatasync.
+
 2015-01-25  Holger Hans Peter Freyther  <[email protected]>
 
 	* scripts/Remote.st: Document -I and --no-line-numbers.
diff --git a/configure.ac b/configure.ac
index bfd09a4..2102214 100644
--- a/configure.ac
+++ b/configure.ac
@@ -359,7 +359,7 @@ AC_REPLACE_FUNCS(putenv strdup strerror strsignal mkstemp getpagesize \
         lrint trunc strsep strpbrk symlink mkdtemp)
 AC_CHECK_FUNCS_ONCE(gethostname memcpy memmove sighold uname usleep lstat \
 	grantpt popen getrusage gettimeofday fork strchr utimes utime readlink \
-	sigsetmask alarm select mprotect madvise waitpid accept4 fdatasync \
+	sigsetmask alarm select mprotect madvise waitpid accept4 \
 	setsid spawnl pread pwrite _NSGetExecutablePath _NSGetEnviron \
 	chown getgrnam getpwnam endgrent endpwent setgroupent setpassent)
 
@@ -371,6 +371,7 @@ fi
 
 dnl FreeBSD does provide an environ but it is not declared in the headers
 AC_CHECK_DECLS([environ])
+AC_CHECK_DECLS([fdatasync], [], [], [[#include <unistd.h>]])
 
 AC_SEARCH_LIBS([nanosleep], [rt])
 if test "$ac_cv_search_nanosleep" != no; then
diff --git a/libgst/ChangeLog b/libgst/ChangeLog
index 6724338..cc0fdb1 100644
--- a/libgst/ChangeLog
+++ b/libgst/ChangeLog
@@ -1,3 +1,8 @@
+2015-05-21  Holger Hans Peter Freyther  <[email protected]>
+
+	* cint.c: Change to use #if instead of #ifdef and update
+	the macro to change for.
+
 2015-04-17  Holger Hans Peter Freyther  <[email protected]>
 
 	* sysdep/posix/timer.c: Fix handling small sleeping
diff --git a/libgst/cint.c b/libgst/cint.c
index 510cc46..fdb6ce3 100644
--- a/libgst/cint.c
+++ b/libgst/cint.c
@@ -659,7 +659,7 @@ _gst_init_cfuncs (void)
   _gst_define_cfunc ("mkdtemp", my_mkdtemp);
   _gst_define_cfunc ("getCurDirName", _gst_get_cur_dir_name);
   _gst_define_cfunc ("fsync", fsync);
-#ifdef HAVE_FDATASYNC
+#if HAVE_DECL_FDATASYNC
   _gst_define_cfunc ("fdatasync", fdatasync);
 #else
   _gst_define_cfunc ("fdatasync", fsync);
-- 
2.3.5
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.