bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

getusershell: provide missing declaration


From: Bruno Haible
Subject: getusershell: provide missing declaration
Date: Fri, 19 Mar 2010 23:26:00 +0100
User-agent: KMail/1.9.9

On Solaris 8, I see this error:

source='test-unistd-c++.cc' object='test-unistd-c++.o' libtool=no \
DEPDIR=.deps depmode=none /bin/bash ./../build-aux/depcomp \
CC -O -DHAVE_CONFIG_H -I.   -I. -I.  -I.. -I./..  -I../gllib -I./../gllib 
-I/home/haible/prefix-x86/include -D_REENTRANT   -c -o test-unistd-c++.o 
test-unistd-c++.cc
"../gllib/unistd.h", line 989: Error: getusershell is not defined.
"../gllib/unistd.h", line 1004: Error: setusershell is not defined.
"../gllib/unistd.h", line 1020: Error: endusershell is not defined.
3 Error(s) and 117 Warning(s) detected.
*** Error code 3

The reason is that the getusershell function exists but is not declared.
This fixes it.


2010-03-19  Bruno Haible  <address@hidden>

        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.

--- doc/glibc-functions/getusershell.texi.orig  Fri Mar 19 23:15:24 2010
+++ doc/glibc-functions/getusershell.texi       Fri Mar 19 22:58:10 2010
@@ -9,6 +9,9 @@
 @item
 This function is missing on some platforms:
 AIX 4.3.2, IRIX 6.5, mingw, Interix 3.5, BeOS.
address@hidden
+This function is missing a declaration on some platforms:
+Solaris 9.
 @end itemize
 
 Portability problems not fixed by Gnulib:
--- lib/unistd.in.h.orig        Fri Mar 19 23:15:24 2010
+++ lib/unistd.in.h     Fri Mar 19 22:59:32 2010
@@ -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 address@hidden@
+# if address@hidden@
 _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 address@hidden@
+# if address@hidden@
 _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 address@hidden@
+# if address@hidden@
 _GL_FUNCDECL_SYS (endusershell, void, (void));
 # endif
 _GL_CXXALIAS_SYS (endusershell, void, (void));
--- m4/getusershell.m4.orig     Fri Mar 19 23:15:24 2010
+++ m4/getusershell.m4  Fri Mar 19 23:08:53 2010
@@ -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
 ])
--- m4/unistd_h.m4.orig Fri Mar 19 23:15:24 2010
+++ m4/unistd_h.m4      Fri Mar 19 23:00:19 2010
@@ -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])
--- modules/unistd.orig Fri Mar 19 23:15:24 2010
+++ modules/unistd      Fri Mar 19 23:00:44 2010
@@ -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' \




reply via email to

[Prev in Thread] Current Thread [Next in Thread]