From: Bruno Haible <bruno@clisp.org>
Date: Mon, 25 Jul 2011 21:42:28 +0000 (+0200)
Subject: close: Remove call-in from fchdir.m4.
X-Git-Tag: v0.1~2061
X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=b6a7ab350dba501b3d8f6527865cdb43cc0e2520;p=gnulib.git

close: Remove call-in from fchdir.m4.

* m4/close.m4 (gl_FUNC_CLOSE): Conditionally invoke gl_TEST_FCHDIR.
* m4/fchdir.m4 (gl_FUNC_FCHDIR): Don't invoke gl_REPLACE_CLOSE.
---

diff --git a/ChangeLog b/ChangeLog
index b454363e65..048a284f72 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2011-07-25  Bruno Haible  <bruno@clisp.org>
 
+	close: Remove call-in from fchdir.m4.
+	* m4/close.m4 (gl_FUNC_CLOSE): Conditionally invoke gl_TEST_FCHDIR.
+	* m4/fchdir.m4 (gl_FUNC_FCHDIR): Don't invoke gl_REPLACE_CLOSE.
+
 	open: Move AC_LIBOBJ invocation to module description.
 	* m4/open.m4 (gl_REPLACE_OPEN): Remove macro.
 	(gl_FUNC_OPEN): Instead of gl_REPLACE_OPEN, just set REPLACE_OPEN to 1.
diff --git a/m4/close.m4 b/m4/close.m4
index 0d8f67a48d..8f33dfe9e6 100644
--- a/m4/close.m4
+++ b/m4/close.m4
@@ -1,4 +1,4 @@
-# close.m4 serial 6
+# close.m4 serial 7
 dnl Copyright (C) 2008-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,6 +15,16 @@ AC_DEFUN([gl_FUNC_CLOSE],
       gl_REPLACE_CLOSE
     fi
   ])
+  dnl Replace close() for supporting the gnulib-defined fchdir() function,
+  dnl to keep fchdir's bookkeeping up-to-date.
+  m4_ifdef([gl_FUNC_FCHDIR], [
+    if test $REPLACE_CLOSE = 0; then
+      gl_TEST_FCHDIR
+      if test $HAVE_FCHDIR = 0; then
+        gl_REPLACE_CLOSE
+      fi
+    fi
+  ])
 ])
 
 AC_DEFUN([gl_REPLACE_CLOSE],
diff --git a/m4/fchdir.m4 b/m4/fchdir.m4
index cc05267dda..612c98f5d0 100644
--- a/m4/fchdir.m4
+++ b/m4/fchdir.m4
@@ -27,7 +27,6 @@ AC_DEFUN([gl_FUNC_FCHDIR],
     REPLACE_OPENDIR=1
     REPLACE_CLOSEDIR=1
     REPLACE_DUP=1
-    gl_REPLACE_CLOSE
     gl_REPLACE_DUP2
     dnl dup3 is already unconditionally replaced
     gl_REPLACE_FCNTL