On mingw still, I'm seeing these errors: test-fchdir.c:24: error: `fchdir' undeclared here (not in a function) make[4]: *** [test-fchdir.o] Error 1
and in C++ mode: ../gllib/unistd.h:698: error: `fchdir' was not declared in this scope The reason is a regression from 2010-03-08: I was confused by the macro REPLACE_FCHDIR, when the common idiom is to use !...@have_fchdir@ instead. This fixes it: 2010-04-03 Bruno Haible <br...@clisp.org> fchdir: Fix regression introduced on 2010-03-08. * lib/unistd.in.h (fchdir): Fix declaration. * m4/fchdir.m4 (gl_FUNC_FCHDIR): Set HAVE_FCHDIR, not REPLACE_FCHDIR. * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize HAVE_FCHDIR, not REPLACE_FCHDIR. * modules/unistd (Makefile.am): Substitute HAVE_FCHDIR, not REPLACE_FCHDIR. --- lib/unistd.in.h.orig Sat Apr 3 15:53:45 2010 +++ lib/unistd.in.h Sat Apr 3 15:51:28 2010 @@ -415,9 +415,8 @@ Return 0 if successful, otherwise -1 and errno set. See the POSIX:2001 specification <http://www.opengroup.org/susv3xsh/fchdir.html>. */ -# if @REPLACE_FCHDIR@ -_GL_FUNCDECL_RPL (fchdir, int, (int /*fd*/)); -_GL_CXXALIAS_RPL (fchdir, int, (int /*fd*/)); +# if ! @HAVE_FCHDIR@ +_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); /* Gnulib internal hooks needed to maintain the fchdir metadata. */ _GL_EXTERN_C int _gl_register_fd (int fd, const char *filename) @@ -426,9 +425,8 @@ _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd); _GL_EXTERN_C const char *_gl_directory_name (int fd); -# else -_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/)); # endif +_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/)); _GL_CXXALIASWARN (fchdir); #elif defined GNULIB_POSIXCHECK # undef fchdir --- m4/fchdir.m4.orig Sat Apr 3 15:53:45 2010 +++ m4/fchdir.m4 Sat Apr 3 15:49:56 2010 @@ -1,4 +1,4 @@ -# fchdir.m4 serial 13 +# fchdir.m4 serial 14 dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -11,7 +11,7 @@ AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) AC_CHECK_FUNCS_ONCE([fchdir]) if test $ac_cv_func_fchdir = no; then - REPLACE_FCHDIR=1 + HAVE_FCHDIR=0 AC_LIBOBJ([fchdir]) gl_PREREQ_FCHDIR AC_DEFINE([REPLACE_FCHDIR], [1], --- m4/unistd_h.m4.orig Sat Apr 3 15:53:45 2010 +++ m4/unistd_h.m4 Sat Apr 3 15:51:58 2010 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 44 +# unistd_h.m4 serial 45 dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -98,6 +98,7 @@ HAVE_DUP3=1; AC_SUBST([HAVE_DUP3]) HAVE_EUIDACCESS=1; AC_SUBST([HAVE_EUIDACCESS]) HAVE_FACCESSAT=1; AC_SUBST([HAVE_FACCESSAT]) + HAVE_FCHDIR=1; AC_SUBST([HAVE_FCHDIR]) HAVE_FCHOWNAT=1; AC_SUBST([HAVE_FCHOWNAT]) HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC]) HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE]) @@ -130,7 +131,6 @@ REPLACE_CLOSE=0; AC_SUBST([REPLACE_CLOSE]) REPLACE_DUP=0; AC_SUBST([REPLACE_DUP]) REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2]) - REPLACE_FCHDIR=0; AC_SUBST([REPLACE_FCHDIR]) REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT]) REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS]) --- modules/unistd.orig Sat Apr 3 15:53:45 2010 +++ modules/unistd Sat Apr 3 15:52:24 2010 @@ -72,6 +72,7 @@ -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \ -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \ -e 's|@''HAVE_FACCESSAT''@|$(HAVE_FACCESSAT)|g' \ + -e 's|@''HAVE_FCHDIR''@|$(HAVE_FCHDIR)|g' \ -e 's|@''HAVE_FCHOWNAT''@|$(HAVE_FCHOWNAT)|g' \ -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \ -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \ @@ -104,7 +105,6 @@ -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \ -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \ -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \ - -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \ -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \ -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \