From 1e2ae3ac85372153b80e024986877314429d0d25 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 7 Sep 2009 01:33:12 +0200 Subject: [PATCH] Remove dependency from unistd_h.m4, sys_stat_h.m4, fcntl_h.m4 to openat.m4. --- ChangeLog | 28 ++++++++++++++++++++++++++++ lib/sys_stat.in.h | 39 ++++++++++++++++++++++++--------------- lib/unistd.in.h | 17 +++++++++++------ m4/fcntl_h.m4 | 7 ++++--- m4/openat.m4 | 29 +++++++++++++---------------- m4/sys_stat_h.m4 | 20 +++++++++++++------- m4/unistd_h.m4 | 8 ++++++-- modules/fcntl-h | 1 - modules/sys_stat | 5 +++-- modules/unistd | 4 ++-- 10 files changed, 104 insertions(+), 54 deletions(-) diff --git a/ChangeLog b/ChangeLog index 937f8f1de..f587cc43d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,33 @@ 2009-09-06 Bruno Haible + * lib/sys_stat.in.h (fchmodat): Declare if GNULIB_FCHMODAT is set. + (fstatat): Declare if GNULIB_FSTATAT is set. + (mkdirat): Declare if GNULIB_MKDIRAT is set. + * lib/unistd.in.h (fchownat): Declare if GNULIB_FCHOWNAT is set. + (unlinkat): Declare if GNULIB_UNLINKAT is set. + * modules/fcntl-h (Files): Remove m4/openat.m4. + * modules/sys_stat (Files): Remove m4/openat.m4. + (Makefile.am): Substitute GNULIB_FCHMODAT, GNULIB_FSTATAT, + GNULIB_MKDIRAT instead of GNULIB_OPENAT. + * modules/unistd (Files): Remove m4/openat.m4. + (Makefile.am): Substitute GNULIB_FCHOWNAT, GNULIB_UNLINKAT instead of + GNULIB_OPENAT. + * m4/fcntl_h.m4 (gl_FCNTL_H_DEFAULTS): Initialize GNULIB_OPENAT, + HAVE_OPENAT here. Don't require gl_OPENAT_DEFAULTS. + * m4/sys_stat_h.m4 (gl_SYS_STAT_H_DEFAULTS): Initialize + GNULIB_FCHMODAT, GNULIB_FSTATAT, GNULIB_MKDIRAT, HAVE_FCHMODAT, + HAVE_FSTATAT, HAVE_MKDIRAT, REPLACE_FSTATAT here. Don't require + gl_OPENAT_DEFAULTS. + * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize GNULIB_FCHOWNAT, + GNULIB_UNLINKAT, HAVE_FCHOWNAT, HAVE_UNLINKAT, REPLACE_FCHOWNAT here. + Don't require gl_OPENAT_DEFAULTS. + * m4/openat.m4 (gl_FUNC_OPENAT): Require gl_FCNTL_H_DEFAULTS, + gl_SYS_STAT_H_DEFAULTS, gl_UNISTD_H_DEFAULTS. Set GNULIB_FCHMODAT, + GNULIB_FSTATAT, GNULIB_MKDIRAT, GNULIB_FCHOWNAT, GNULIB_UNLINKAT. + (gl_OPENAT_DEFAULTS): Remove macro. + +2009-09-06 Bruno Haible + * modules/openat (configure.ac): Remove unneeded witness. 2009-09-06 Bruno Haible diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h index 33482d28f..0c4522931 100644 --- a/lib/sys_stat.in.h +++ b/lib/sys_stat.in.h @@ -302,40 +302,49 @@ extern int rpl_lstat (const char *name, struct stat *buf); lstat (p, b)) #endif -#if @GNULIB_OPENAT@ -# if @REPLACE_FSTATAT@ -# undef fstatat -# define fstatat rpl_fstatat -# endif -# if !@HAVE_FSTATAT@ || @REPLACE_FSTATAT@ -int fstatat (int fd, char const *name, struct stat *st, int flags); -# endif +#if @GNULIB_FCHMODAT@ # if !@HAVE_FCHMODAT@ -int fchmodat (int fd, char const *file, mode_t mode, int flag); -# endif - -# if !@HAVE_MKDIRAT@ -int mkdirat (int fd, char const *file, mode_t mode); +extern int fchmodat (int fd, char const *file, mode_t mode, int flag); # endif - #elif defined GNULIB_POSIXCHECK # undef fchmodat # define fchmodat(d,n,m,f) \ (GL_LINK_WARNING ("fchmodat is not portable - " \ "use gnulib module openat for portability"), \ fchmodat (d, n, m, f)) +#endif + + +#if @GNULIB_FSTATAT@ +# if @REPLACE_FSTATAT@ +# undef fstatat +# define fstatat rpl_fstatat +# endif +# if !@HAVE_FSTATAT@ || @REPLACE_FSTATAT@ +extern int fstatat (int fd, char const *name, struct stat *st, int flags); +# endif +#elif defined GNULIB_POSIXCHECK # undef fstatat # define fstatat(d,n,s,f) \ (GL_LINK_WARNING ("fstatat is not portable - " \ "use gnulib module openat for portability"), \ fstatat (d, n, s, f)) +#endif + + +#if @GNULIB_MKDIRAT@ +# if !@HAVE_MKDIRAT@ +extern int mkdirat (int fd, char const *file, mode_t mode); +# endif +#elif defined GNULIB_POSIXCHECK # undef mkdirat # define mkdirat(d,n,m) \ (GL_LINK_WARNING ("mkdirat is not portable - " \ "use gnulib module openat for portability"), \ mkdirat (d, n, m)) -#endif /* @GNULIB_OPENAT@ */ +#endif + #if @REPLACE_FCHDIR@ # define fstat rpl_fstat diff --git a/lib/unistd.in.h b/lib/unistd.in.h index d86d06ea7..ed25f69bb 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -147,16 +147,13 @@ extern int chown (const char *file, uid_t uid, gid_t gid); #endif -#if @GNULIB_OPENAT@ +#if @GNULIB_FCHOWNAT@ # if @REPLACE_FCHOWNAT@ # undef fchownat # define fchownat rpl_fchownat # endif # if !@HAVE_FCHOWNAT@ || @REPLACE_FCHOWNAT@ -int fchownat (int fd, char const *file, uid_t owner, gid_t group, int flag); -# endif -# if !@HAVE_UNLINKAT@ -int unlinkat (int fd, char const *file, int flag); +extern int fchownat (int fd, char const *file, uid_t owner, gid_t group, int flag); # endif #elif defined GNULIB_POSIXCHECK # undef fchownat @@ -164,12 +161,20 @@ int unlinkat (int fd, char const *file, int flag); (GL_LINK_WARNING ("fchownat is not portable - " \ "use gnulib module openat for portability"), \ fchownat (d, n, o, g, f)) +#endif + + +#if @GNULIB_UNLINKAT@ +# if !@HAVE_UNLINKAT@ +extern int unlinkat (int fd, char const *file, int flag); +# endif +#elif defined GNULIB_POSIXCHECK # undef unlinkat # define unlinkat(d,n,f) \ (GL_LINK_WARNING ("unlinkat is not portable - " \ "use gnulib module openat for portability"), \ unlinkat (d, n, f)) -#endif /* @GNULIB_OPENAT@ */ +#endif #if @GNULIB_FACCESSAT@ diff --git a/m4/fcntl_h.m4 b/m4/fcntl_h.m4 index fdea01fb3..7100d1980 100644 --- a/m4/fcntl_h.m4 +++ b/m4/fcntl_h.m4 @@ -1,4 +1,4 @@ -# serial 2 +# serial 3 # Configure fcntl.h. dnl Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation @@ -91,8 +91,9 @@ AC_DEFUN([gl_FCNTL_MODULE_INDICATOR], AC_DEFUN([gl_FCNTL_H_DEFAULTS], [ - AC_REQUIRE([gl_OPENAT_DEFAULTS]) dnl for GNULIB_OPENAT - GNULIB_OPEN=0; AC_SUBST([GNULIB_OPEN]) + GNULIB_OPEN=0; AC_SUBST([GNULIB_OPEN]) + GNULIB_OPENAT=0; AC_SUBST([GNULIB_OPENAT]) dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_OPENAT=1; AC_SUBST([HAVE_OPENAT]) REPLACE_OPEN=0; AC_SUBST([REPLACE_OPEN]) ]) diff --git a/m4/openat.m4 b/m4/openat.m4 index 51f38d065..445e952b2 100644 --- a/m4/openat.m4 +++ b/m4/openat.m4 @@ -1,4 +1,4 @@ -# serial 20 +# serial 21 # See if we need to use our replacement for Solaris' openat et al functions. dnl Copyright (C) 2004-2009 Free Software Foundation, Inc. @@ -10,6 +10,18 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_OPENAT], [ + AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) + GNULIB_OPENAT=1 + + AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) + GNULIB_FCHMODAT=1 + GNULIB_FSTATAT=1 + GNULIB_MKDIRAT=1 + + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + GNULIB_FCHOWNAT=1 + GNULIB_UNLINKAT=1 + AC_LIBOBJ([openat-proc]) AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_CHECK_FUNCS_ONCE([lchmod]) @@ -34,7 +46,6 @@ AC_DEFUN([gl_FUNC_OPENAT], HAVE_MKDIRAT=0 fi gl_FUNC_FCHOWNAT - GNULIB_OPENAT=1 ]) # gl_FUNC_FCHOWNAT_DEREF_BUG([ACTION-IF-BUGGY[, ACTION-IF-NOT_BUGGY]]) @@ -92,17 +103,3 @@ AC_DEFUN([gl_PREREQ_OPENAT], AC_REQUIRE([gl_PROMOTED_TYPE_MODE_T]) : ]) - -AC_DEFUN([gl_OPENAT_DEFAULTS], -[ - GNULIB_OPENAT=0; AC_SUBST([GNULIB_OPENAT]) - dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_FCHMODAT=1; AC_SUBST([HAVE_FCHMODAT]) - HAVE_FCHOWNAT=1; AC_SUBST([HAVE_FCHOWNAT]) - HAVE_FSTATAT=1; AC_SUBST([HAVE_FSTATAT]) - HAVE_MKDIRAT=1; AC_SUBST([HAVE_MKDIRAT]) - HAVE_OPENAT=1; AC_SUBST([HAVE_OPENAT]) - HAVE_UNLINKAT=1; AC_SUBST([HAVE_UNLINKAT]) - REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT]) - REPLACE_FSTATAT=0; AC_SUBST([REPLACE_FSTATAT]) -]) diff --git a/m4/sys_stat_h.m4 b/m4/sys_stat_h.m4 index 634a33fc6..d29f695db 100644 --- a/m4/sys_stat_h.m4 +++ b/m4/sys_stat_h.m4 @@ -1,4 +1,4 @@ -# sys_stat_h.m4 serial 12 -*- Autoconf -*- +# sys_stat_h.m4 serial 13 -*- Autoconf -*- dnl Copyright (C) 2006-2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -49,11 +49,17 @@ AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR], AC_DEFUN([gl_SYS_STAT_H_DEFAULTS], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR - AC_REQUIRE([gl_OPENAT_DEFAULTS]) dnl for GNULIB_OPENAT - GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD]) - GNULIB_LSTAT=0; AC_SUBST([GNULIB_LSTAT]) + GNULIB_FCHMODAT=0; AC_SUBST([GNULIB_FCHMODAT]) + GNULIB_FSTATAT=0; AC_SUBST([GNULIB_FSTATAT]) + GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD]) + GNULIB_LSTAT=0; AC_SUBST([GNULIB_LSTAT]) + GNULIB_MKDIRAT=0; AC_SUBST([GNULIB_MKDIRAT]) dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_LCHMOD=1; AC_SUBST([HAVE_LCHMOD]) - REPLACE_LSTAT=0; AC_SUBST([REPLACE_LSTAT]) - REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR]) + HAVE_FCHMODAT=1; AC_SUBST([HAVE_FCHMODAT]) + HAVE_FSTATAT=1; AC_SUBST([HAVE_FSTATAT]) + HAVE_LCHMOD=1; AC_SUBST([HAVE_LCHMOD]) + HAVE_MKDIRAT=1; AC_SUBST([HAVE_MKDIRAT]) + REPLACE_FSTATAT=0; AC_SUBST([REPLACE_FSTATAT]) + REPLACE_LSTAT=0; AC_SUBST([REPLACE_LSTAT]) + REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR]) ]) diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4 index f0de46427..d9781f786 100644 --- a/m4/unistd_h.m4 +++ b/m4/unistd_h.m4 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 22 +# unistd_h.m4 serial 23 dnl Copyright (C) 2006-2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -32,7 +32,6 @@ AC_DEFUN([gl_UNISTD_MODULE_INDICATOR], AC_DEFUN([gl_UNISTD_H_DEFAULTS], [ - AC_REQUIRE([gl_OPENAT_DEFAULTS]) dnl for GNULIB_OPENAT GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN]) GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE]) GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2]) @@ -41,6 +40,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], GNULIB_EUIDACCESS=0; AC_SUBST([GNULIB_EUIDACCESS]) GNULIB_FACCESSAT=0; AC_SUBST([GNULIB_FACCESSAT]) GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR]) + GNULIB_FCHOWNAT=0; AC_SUBST([GNULIB_FCHOWNAT]) GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC]) GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE]) GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD]) @@ -59,12 +59,14 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], GNULIB_SYMLINKAT=0; AC_SUBST([GNULIB_SYMLINKAT]) GNULIB_UNISTD_H_GETOPT=0; AC_SUBST([GNULIB_UNISTD_H_GETOPT]) GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE]) + GNULIB_UNLINKAT=0; AC_SUBST([GNULIB_UNLINKAT]) 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_DUP3=1; AC_SUBST([HAVE_DUP3]) HAVE_EUIDACCESS=1; AC_SUBST([HAVE_EUIDACCESS]) HAVE_FACCESSAT=1; AC_SUBST([HAVE_FACCESSAT]) + HAVE_FCHOWNAT=1; AC_SUBST([HAVE_FCHOWNAT]) HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC]) HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE]) HAVE_GETDOMAINNAME=1; AC_SUBST([HAVE_GETDOMAINNAME]) @@ -82,10 +84,12 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R]) HAVE_OS_H=0; AC_SUBST([HAVE_OS_H]) HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H]) + HAVE_UNLINKAT=1; AC_SUBST([HAVE_UNLINKAT]) REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN]) REPLACE_CLOSE=0; AC_SUBST([REPLACE_CLOSE]) 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_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) diff --git a/modules/fcntl-h b/modules/fcntl-h index d86f57206..5e3696e73 100644 --- a/modules/fcntl-h +++ b/modules/fcntl-h @@ -4,7 +4,6 @@ Like , but with non-working flags defined to 0. Files: lib/fcntl.in.h m4/fcntl_h.m4 -m4/openat.m4 Depends-on: include_next diff --git a/modules/sys_stat b/modules/sys_stat index bad77be84..35bafcc1b 100644 --- a/modules/sys_stat +++ b/modules/sys_stat @@ -4,7 +4,6 @@ A for systems with missing declarations. Files: lib/sys_stat.in.h m4/sys_stat_h.m4 -m4/openat.m4 m4/unistd_h.m4 Depends-on: @@ -27,9 +26,11 @@ sys/stat.h: sys_stat.in.h sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ + -e 's|@''GNULIB_FCHMODAT''@|$(GNULIB_FCHMODAT)|g' \ + -e 's|@''GNULIB_FSTATAT''@|$(GNULIB_FSTATAT)|g' \ -e 's|@''GNULIB_LCHMOD''@|$(GNULIB_LCHMOD)|g' \ -e 's|@''GNULIB_LSTAT''@|$(GNULIB_LSTAT)|g' \ - -e 's|@''GNULIB_OPENAT''@|$(GNULIB_OPENAT)|g' \ + -e 's|@''GNULIB_MKDIRAT''@|$(GNULIB_MKDIRAT)|g' \ -e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \ -e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \ -e 's|@''HAVE_LCHMOD''@|$(HAVE_LCHMOD)|g' \ diff --git a/modules/unistd b/modules/unistd index 95dab91dd..fbcb50e53 100644 --- a/modules/unistd +++ b/modules/unistd @@ -4,7 +4,6 @@ A GNU-like . Files: m4/unistd_h.m4 lib/unistd.in.h -m4/openat.m4 Depends-on: include_next @@ -34,6 +33,7 @@ unistd.h: unistd.in.h -e 's|@''GNULIB_EUIDACCESS''@|$(GNULIB_EUIDACCESS)|g' \ -e 's|@''GNULIB_FACCESSAT''@|$(GNULIB_FACCESSAT)|g' \ -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \ + -e 's|@''GNULIB_FCHOWNAT''@|$(GNULIB_FCHOWNAT)|g' \ -e 's|@''GNULIB_FSYNC''@|$(GNULIB_FSYNC)|g' \ -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \ -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \ @@ -46,13 +46,13 @@ unistd.h: unistd.in.h -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \ -e 's|@''GNULIB_LINK''@|$(GNULIB_LINK)|g' \ -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \ - -e 's|@''GNULIB_OPENAT''@|$(GNULIB_OPENAT)|g' \ -e 's|@''GNULIB_PIPE2''@|$(GNULIB_PIPE2)|g' \ -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \ -e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \ -e 's|@''GNULIB_SYMLINKAT''@|$(GNULIB_SYMLINKAT)|g' \ -e 's|@''GNULIB_UNISTD_H_GETOPT''@|$(GNULIB_UNISTD_H_GETOPT)|g' \ -e 's|@''GNULIB_UNISTD_H_SIGPIPE''@|$(GNULIB_UNISTD_H_SIGPIPE)|g' \ + -e 's|@''GNULIB_UNLINKAT''@|$(GNULIB_UNLINKAT)|g' \ -e 's|@''GNULIB_WRITE''@|$(GNULIB_WRITE)|g' \ -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \ -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \ -- 2.11.0