The header file in which glibc declares euidaccess() is <unistd.h>. Here's a proposed patch for gnulib to do the same.
The patch also contains a simplification: No need to check whether euidaccess is declared. According to doc/glibc-functions/euidaccess.texi, glibc is the only platform so far that has this function, and it declares it, because of AC_USE_SYSTEM_EXTENSIONS which defines _GNU_SOURCE. When other platforms will/may implement this function, they will certainly also provide a declaration - we're not in the 1990ies any more. OK to apply? 2008-10-18 Bruno Haible <[EMAIL PROTECTED]> * lib/euidaccess.h: Remove file. * lib/unistd.in.h (euidaccess): New declaration. * lib/euidaccess.c: Don't include euidaccess.h. * m4/euidaccess.m4 (gl_FUNC_EUIDACCESS): Require gl_UNISTD_H_DEFAULTS. Don't check whether euidaccess is declared. Set HAVE_EUIDACCESS. * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize GNULIB_EUIDACCESS and HAVE_EUIDACCESS. * modules/euidaccess (Files): Remove lib/euidaccess.h. (Depends-on): Add unistd. (configure.ac): Invoke gl_UNISTD_MODULE_INDICATOR. (Include): Specify <unistd.h> instead of euidaccess.h. * modules/unistd (Makefile.am): Substitute GNULIB_EUIDACCESS and HAVE_EUIDACCESS. * NEWS: Mention the change. --- lib/euidaccess.h.orig 2008-10-19 00:59:06.000000000 +0200 +++ lib/euidaccess.h 2003-09-23 19:59:22.000000000 +0200 @@ -1,3 +0,0 @@ -#if ! HAVE_DECL_EUIDACCESS -int euidaccess (char const *file, int mode); -#endif --- lib/unistd.in.h.orig 2008-10-19 00:59:06.000000000 +0200 +++ lib/unistd.in.h 2008-10-19 00:59:04.000000000 +0200 @@ -134,6 +134,21 @@ #endif +#if @GNULIB_EUIDACCESS@ +# if [EMAIL PROTECTED]@ +/* Like access(), except that is uses the effective user id and group id of + the current process. */ +extern int euidaccess (const char *filename, int mode); +# endif +#elif defined GNULIB_POSIXCHECK +# undef euidaccess +# define euidaccess(f,m) \ + (GL_LINK_WARNING ("euidaccess is unportable - " \ + "use gnulib module euidaccess for portability"), \ + euidaccess (f, m)) +#endif + + #if @GNULIB_FCHDIR@ # if @REPLACE_FCHDIR@ --- lib/euidaccess.c.orig 2008-10-19 00:59:06.000000000 +0200 +++ lib/euidaccess.c 2008-10-19 00:51:54.000000000 +0200 @@ -1,6 +1,6 @@ /* euidaccess -- check if effective user id can access file - Copyright (C) 1990, 1991, 1995, 1998, 2000, 2003, 2004, 2005, 2006 + Copyright (C) 1990, 1991, 1995, 1998, 2000, 2003, 2004, 2005, 2006, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -23,7 +23,6 @@ #ifndef _LIBC # include <config.h> -# include "euidaccess.h" #endif #include <sys/types.h> Changing permissions from 100644 to . --- m4/euidaccess.m4.orig 2008-10-19 00:59:06.000000000 +0200 +++ m4/euidaccess.m4 2008-10-19 00:51:54.000000000 +0200 @@ -1,5 +1,5 @@ -# euidaccess.m4 serial 8 -dnl Copyright (C) 2002-2007 Free Software Foundation, Inc. +# euidaccess.m4 serial 9 +dnl Copyright (C) 2002-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -17,12 +17,14 @@ AC_DEFUN([gl_FUNC_EUIDACCESS], [ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + dnl Persuade glibc <unistd.h> to declare euidaccess(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) - AC_CHECK_DECLS_ONCE([euidaccess]) AC_REPLACE_FUNCS(euidaccess) if test $ac_cv_func_euidaccess = no; then + HAVE_EUIDACCESS=0 gl_PREREQ_EUIDACCESS fi ]) --- m4/unistd_h.m4.orig 2008-10-19 00:59:06.000000000 +0200 +++ m4/unistd_h.m4 2008-10-19 00:51:54.000000000 +0200 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 14 +# unistd_h.m4 serial 15 dnl Copyright (C) 2006-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -36,6 +36,7 @@ GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE]) GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2]) GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON]) + GNULIB_EUIDACCESS=0; AC_SUBST([GNULIB_EUIDACCESS]) GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR]) GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC]) GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE]) @@ -51,6 +52,7 @@ GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_DUP2=1; AC_SUBST([HAVE_DUP2]) + HAVE_EUIDACCESS=1; AC_SUBST([HAVE_EUIDACCESS]) HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC]) HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE]) HAVE_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE]) --- modules/euidaccess.orig 2008-10-19 00:59:07.000000000 +0200 +++ modules/euidaccess 2008-10-19 00:51:54.000000000 +0200 @@ -2,22 +2,23 @@ euidaccess() function: check effective user's permissions for a file. Files: -lib/euidaccess.h lib/euidaccess.c m4/euidaccess.m4 Depends-on: +unistd extensions group-member sys_stat configure.ac: gl_FUNC_EUIDACCESS +gl_UNISTD_MODULE_INDICATOR([euidaccess]) Makefile.am: Include: -"euidaccess.h" +<unistd.h> Link: $(LIB_EACCESS) --- modules/unistd.orig 2008-10-19 00:59:07.000000000 +0200 +++ modules/unistd 2008-10-19 00:51:54.000000000 +0200 @@ -28,6 +28,7 @@ -e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \ -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \ -e 's|@''GNULIB_ENVIRON''@|$(GNULIB_ENVIRON)|g' \ + -e 's|@''GNULIB_EUIDACCESS''@|$(GNULIB_EUIDACCESS)|g' \ -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \ -e 's|@''GNULIB_FSYNC''@|$(GNULIB_FSYNC)|g' \ -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \ @@ -42,6 +43,7 @@ -e 's|@''GNULIB_UNISTD_H_SIGPIPE''@|$(GNULIB_UNISTD_H_SIGPIPE)|g' \ -e 's|@''GNULIB_WRITE''@|$(GNULIB_WRITE)|g' \ -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \ + -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \ -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \ -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \ -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \ --- NEWS.orig 2008-10-19 00:59:06.000000000 +0200 +++ NEWS 2008-10-19 00:56:28.000000000 +0200 @@ -6,6 +6,9 @@ Date Modules Changes +2008-10-18 euidaccess The include file is changed from "euidaccess.h" + to <unistd.h>. + 2008-09-28 sockets When using this module, you now need to link with $(LIBSOCKET).