From cf5e3a18e2726346c1c3c26cfec8f75d40176090 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 19 Mar 2010 23:22:28 +0100 Subject: [PATCH] getusershell: Provide declaration, missing on Solaris 9. --- ChangeLog | 13 +++++++++++++ doc/glibc-functions/getusershell.texi | 3 +++ lib/unistd.in.h | 6 +++--- m4/getusershell.m4 | 17 +++++++++++++---- m4/unistd_h.m4 | 4 ++-- modules/unistd | 2 +- 6 files changed, 35 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0e54678f0..61add04f0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,18 @@ 2010-03-19 Bruno Haible + getusershell: Provide declaration, missing on Solaris 9. + * lib/unistd.in.h (getusershell, setusershell, endusershell): Declare + also if HAVE_GETUSERSHELL && !HAVE_DECL_GETUSERSHELL. + * m4/getusershell.m4 (gl_FUNC_GETUSERSHELL): When the function exists, + check whether it is declared. Set HAVE_DECL_GETUSERSHELL. + * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize + HAVE_DECL_GETUSERSHELL, not HAVE_GETUSERSHELL. + * modules/unistd (Makefile.am): Substitute HAVE_DECL_GETUSERSHELL, not + HAVE_GETUSERSHELL. + * doc/glibc-functions/getusershell.texi: Mention the Solaris problem. + +2010-03-19 Bruno Haible + wctype: Provide iswblank function. * lib/wctype.in.h (iswblank): Provide a replacement also when iswcntrl exists and is fine. diff --git a/doc/glibc-functions/getusershell.texi b/doc/glibc-functions/getusershell.texi index 45c652c12..1c3e853d2 100644 --- a/doc/glibc-functions/getusershell.texi +++ b/doc/glibc-functions/getusershell.texi @@ -9,6 +9,9 @@ Portability problems fixed by Gnulib: @item This function is missing on some platforms: AIX 4.3.2, IRIX 6.5, mingw, Interix 3.5, BeOS. +@item +This function is missing a declaration on some platforms: +Solaris 9. @end itemize Portability problems not fixed by Gnulib: diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 68e1a870e..b74484a88 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -726,7 +726,7 @@ _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - " #if @GNULIB_GETUSERSHELL@ /* Return the next valid login shell on the system, or NULL when the end of the list has been reached. */ -# if !@HAVE_GETUSERSHELL@ +# if !@HAVE_DECL_GETUSERSHELL@ _GL_FUNCDECL_SYS (getusershell, char *, (void)); # endif _GL_CXXALIAS_SYS (getusershell, char *, (void)); @@ -741,7 +741,7 @@ _GL_WARN_ON_USE (getusershell, "getusershell is unportable - " #if @GNULIB_GETUSERSHELL@ /* Rewind to pointer that is advanced at each getusershell() call. */ -# if !@HAVE_GETUSERSHELL@ +# if !@HAVE_DECL_GETUSERSHELL@ _GL_FUNCDECL_SYS (setusershell, void, (void)); # endif _GL_CXXALIAS_SYS (setusershell, void, (void)); @@ -757,7 +757,7 @@ _GL_WARN_ON_USE (setusershell, "setusershell is unportable - " #if @GNULIB_GETUSERSHELL@ /* Free the pointer that is advanced at each getusershell() call and associated resources. */ -# if !@HAVE_GETUSERSHELL@ +# if !@HAVE_DECL_GETUSERSHELL@ _GL_FUNCDECL_SYS (endusershell, void, (void)); # endif _GL_CXXALIAS_SYS (endusershell, void, (void)); diff --git a/m4/getusershell.m4 b/m4/getusershell.m4 index fa13e8682..b3664867c 100644 --- a/m4/getusershell.m4 +++ b/m4/getusershell.m4 @@ -1,4 +1,4 @@ -# getusershell.m4 serial 5 +# getusershell.m4 serial 6 dnl Copyright (C) 2002-2003, 2006, 2008-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,8 +11,17 @@ AC_DEFUN([gl_FUNC_GETUSERSHELL], dnl Persuade glibc to declare {get,set,end}usershell(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) - AC_REPLACE_FUNCS([getusershell]) - if test $ac_cv_func_getusershell = no; then - HAVE_GETUSERSHELL=0 + dnl Check whether the getusershell function exists. + AC_CHECK_FUNCS_ONCE([getusershell]) + if test $ac_cv_func_getusershell = yes; then + dnl Check whether getusershell is declared. + AC_CHECK_DECLS([getusershell]) + if test $ac_cv_have_decl_getusershell = no; then + HAVE_DECL_GETUSERSHELL=0 + fi + else + AC_LIBOBJ([getusershell]) + dnl Assume that on platforms which declare it, the function exists. + HAVE_DECL_GETUSERSHELL=0 fi ]) diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4 index f6c35d2a7..d7c552896 100644 --- a/m4/unistd_h.m4 +++ b/m4/unistd_h.m4 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 40 +# unistd_h.m4 serial 41 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, @@ -106,7 +106,6 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME]) HAVE_GETLOGIN=1; AC_SUBST([HAVE_GETLOGIN]) HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE]) - HAVE_GETUSERSHELL=1; AC_SUBST([HAVE_GETUSERSHELL]) HAVE_LCHOWN=1; AC_SUBST([HAVE_LCHOWN]) HAVE_LINK=1; AC_SUBST([HAVE_LINK]) HAVE_LINKAT=1; AC_SUBST([HAVE_LINKAT]) @@ -119,6 +118,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], HAVE_SYMLINKAT=1; AC_SUBST([HAVE_SYMLINKAT]) HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON]) HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R]) + HAVE_DECL_GETUSERSHELL=1; AC_SUBST([HAVE_DECL_GETUSERSHELL]) 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]) diff --git a/modules/unistd b/modules/unistd index 1ed98ccf2..8e2b33d97 100644 --- a/modules/unistd +++ b/modules/unistd @@ -80,7 +80,6 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \ -e 's|@''HAVE_GETLOGIN''@|$(HAVE_GETLOGIN)|g' \ -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ - -e 's|@''HAVE_GETUSERSHELL''@|$(HAVE_GETUSERSHELL)|g' \ -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \ -e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \ -e 's|@''HAVE_LINKAT''@|$(HAVE_LINKAT)|g' \ @@ -95,6 +94,7 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \ -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \ -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \ + -e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \ -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \ -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \ -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ -- 2.11.0