fchdir: Start to remove gl_REPLACE_* idiom.
authorBruno Haible <bruno@clisp.org>
Mon, 25 Jul 2011 21:23:14 +0000 (23:23 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 25 Jul 2011 21:23:14 +0000 (23:23 +0200)
* m4/fchdir.m4 (gl_TEST_FCHDIR): New macro.
(gl_FUNC_FCHDIR): Invoke it.

ChangeLog
m4/fchdir.m4

index f999c04..5e27329 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-07-25  Bruno Haible  <bruno@clisp.org>
+
+       fchdir: Start to remove gl_REPLACE_* idiom.
+       * m4/fchdir.m4 (gl_TEST_FCHDIR): New macro.
+       (gl_FUNC_FCHDIR): Invoke it.
+
 2011-07-25  Paul Eggert  <eggert@cs.ucla.edu>
 
        * lib/ftell.c (ftell): Comment out cast.
index 829373a..92d0f53 100644 (file)
@@ -1,4 +1,4 @@
-# fchdir.m4 serial 16
+# fchdir.m4 serial 17
 dnl Copyright (C) 2006-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -15,9 +15,8 @@ AC_DEFUN([gl_FUNC_FCHDIR],
     HAVE_DECL_FCHDIR=0
   fi
 
-  AC_CHECK_FUNCS_ONCE([fchdir])
-  if test $ac_cv_func_fchdir = no; then
-    HAVE_FCHDIR=0
+  AC_REQUIRE([gl_TEST_FCHDIR])
+  if test $HAVE_FCHDIR = 0; then
     AC_LIBOBJ([fchdir])
     gl_PREREQ_FCHDIR
     AC_DEFINE([REPLACE_FCHDIR], [1],
@@ -48,5 +47,15 @@ work around the inability to open a directory.])
   fi
 ])
 
+# Determine whether to use the overrides in lib/fchdir.c.
+AC_DEFUN([gl_TEST_FCHDIR],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([fchdir])
+  if test $ac_cv_func_fchdir = no; then
+    HAVE_FCHDIR=0
+  fi
+])
+
 # Prerequisites of lib/fchdir.c.
 AC_DEFUN([gl_PREREQ_FCHDIR], [:])