close: Remove call-in from fchdir.m4.
[gnulib.git] / m4 / close.m4
index fc13138..8f33dfe 100644 (file)
@@ -1,4 +1,4 @@
-# close.m4 serial 5
+# 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],
@@ -22,5 +32,5 @@ AC_DEFUN([gl_REPLACE_CLOSE],
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
   REPLACE_CLOSE=1
   AC_LIBOBJ([close])
-  gl_REPLACE_FCLOSE
+  m4_ifdef([gl_REPLACE_FCLOSE], [gl_REPLACE_FCLOSE])
 ])