Check for declarations of fchdir and fsync. Fixes #800710. Backported to 2.3.
diff --git a/configure.in b/configure.in
index bf11b92..b2deb65 100644
--- a/configure.in
+++ b/configure.in
@@ -2065,7 +2065,7 @@
 
 # checks for library functions
 AC_CHECK_FUNCS(alarm chown clock confstr ctermid execv \
- fchdir fork fsync fdatasync fpathconf ftime ftruncate \
+ fork fpathconf ftime ftruncate \
  gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
  getpriority getpwent getwd \
  kill killpg lchown lstat mkfifo mknod mktime \
@@ -2097,6 +2097,24 @@
   AC_MSG_RESULT(yes),
   AC_MSG_RESULT(no)
 )
+AC_MSG_CHECKING(for fchdir)
+AC_TRY_COMPILE([#include <unistd.h>], void *x=fchdir,
+  AC_DEFINE(HAVE_FCHDIR, 1, Define if you have the 'fchdir' function.)
+  AC_MSG_RESULT(yes),
+  AC_MSG_RESULT(no)
+)
+AC_MSG_CHECKING(for fsync)
+AC_TRY_COMPILE([#include <unistd.h>], void *x=fsync,
+  AC_DEFINE(HAVE_SYNC, 1, Define if you have the 'fsync' function.)
+  AC_MSG_RESULT(yes),
+  AC_MSG_RESULT(no)
+)
+AC_MSG_CHECKING(for fdatasync)
+AC_TRY_COMPILE([#include <unistd.h>], void *x=fdatasync,
+  AC_DEFINE(HAVE_FDATASYNC, 1, Define if you have the 'fdatasync' function.)
+  AC_MSG_RESULT(yes),
+  AC_MSG_RESULT(no)
+)
 
 # On some systems (eg. FreeBSD 5), we would find a definition of the
 # functions ctermid_r, setgroups in the library, but no prototype