changeset 13010:23b6d428ea53

getusershell: Provide declaration, missing on Solaris 9.
author Bruno Haible <bruno@clisp.org>
date Fri, 19 Mar 2010 23:22:28 +0100
parents 15a1a8b07c32
children 37630f6e084b
files ChangeLog doc/glibc-functions/getusershell.texi lib/unistd.in.h m4/getusershell.m4 m4/unistd_h.m4 modules/unistd
diffstat 6 files changed, 35 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2010-03-19  Bruno Haible  <bruno@clisp.org>
+
+	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  <bruno@clisp.org>
 
 	wctype: Provide iswblank function.
--- a/doc/glibc-functions/getusershell.texi
+++ b/doc/glibc-functions/getusershell.texi
@@ -9,6 +9,9 @@
 @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:
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -726,7 +726,7 @@
 #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 @@
 
 #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 @@
 #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));
--- 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 @@
   dnl Persuade glibc <unistd.h> 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
 ])
--- 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 @@
   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 @@
   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])
--- a/modules/unistd
+++ b/modules/unistd
@@ -80,7 +80,6 @@
 	      -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 @@
 	      -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' \