ttyname_r: Add missing declaration on HP-UX 11.
authorBruno Haible <bruno@clisp.org>
Mon, 20 Dec 2010 12:10:22 +0000 (13:10 +0100)
committerBruno Haible <bruno@clisp.org>
Mon, 20 Dec 2010 12:10:22 +0000 (13:10 +0100)
* lib/unistd.in.h (ttyname_r): Test HAVE_DECL_TTYNAME_R instead of
HAVE_TTYNAME_R.
* m4/ttyname_r.m4 (gl_FUNC_TTYNAME_R): Test whether ttyname_r is
declared. Set HAVE_TTYNAME_R always.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize
HAVE_DECL_TTYNAME_R, not HAVE_TTYNAME_R.
* modules/unistd (Makefile.am): Substitute HAVE_DECL_TTYNAME_R, not
HAVE_TTYNAME_R.
* doc/posix-functions/ttyname_r.texi: Document the HP-UX 11 problem.

ChangeLog
doc/posix-functions/ttyname_r.texi
lib/unistd.in.h
m4/ttyname_r.m4
m4/unistd_h.m4
modules/unistd

index f14e940..916c726 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2010-12-20  Bruno Haible  <bruno@clisp.org>
 
+       ttyname_r: Add missing declaration on HP-UX 11.
+       * lib/unistd.in.h (ttyname_r): Test HAVE_DECL_TTYNAME_R instead of
+       HAVE_TTYNAME_R.
+       * m4/ttyname_r.m4 (gl_FUNC_TTYNAME_R): Test whether ttyname_r is
+       declared. Set HAVE_TTYNAME_R always.
+       * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize
+       HAVE_DECL_TTYNAME_R, not HAVE_TTYNAME_R.
+       * modules/unistd (Makefile.am): Substitute HAVE_DECL_TTYNAME_R, not
+       HAVE_TTYNAME_R.
+       * doc/posix-functions/ttyname_r.texi: Document the HP-UX 11 problem.
+
+2010-12-20  Bruno Haible  <bruno@clisp.org>
+
        getlogin, getlogin_r: Document HP-UX 11.11 bugs.
        * doc/posix-functions/getlogin.texi: Document HP-UX 11.11 bug.
        * doc/posix-functions/getlogin_r.texi: Likewise.
index a2f714d..67ca8d4 100644 (file)
@@ -12,6 +12,10 @@ Portability problems fixed by Gnulib:
 This function is missing on some platforms:
 NetBSD 3.0, mingw, BeOS.
 @item
+This function is not declared unless @code{_REENTRANT} is defined,
+on some platforms:
+HP-UX 11.
+@item
 This function has an incompatible declaration on some platforms:
 MacOS X 10.4, Solaris 11 2010-11 (when @code{_POSIX_PTHREAD_SEMANTICS} is not defined).
 @item
index 23c8f3f..40ac378 100644 (file)
@@ -1249,7 +1249,7 @@ _GL_FUNCDECL_RPL (ttyname_r, int,
 _GL_CXXALIAS_RPL (ttyname_r, int,
                   (int fd, char *buf, size_t buflen));
 # else
-#  if !@HAVE_TTYNAME_R@
+#  if !@HAVE_DECL_TTYNAME_R@
 _GL_FUNCDECL_SYS (ttyname_r, int,
                   (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
 #  endif
index 7e87cc3..ad76070 100644 (file)
@@ -1,4 +1,4 @@
-# ttyname_r.m4 serial 5
+# ttyname_r.m4 serial 6
 dnl Copyright (C) 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,
@@ -12,10 +12,16 @@ AC_DEFUN([gl_FUNC_TTYNAME_R],
   dnl ttyname_r().
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
 
+  AC_CHECK_DECLS_ONCE([ttyname_r])
+  if test $ac_cv_have_decl_ttyname_r = no; then
+    HAVE_DECL_TTYNAME_R=0
+  fi
+
   AC_CHECK_FUNCS([ttyname_r])
   if test $ac_cv_func_ttyname_r = no; then
     HAVE_TTYNAME_R=0
   else
+    HAVE_TTYNAME_R=1
     dnl On MacOS X 10.4 (and Solaris 10 without gl_USE_SYSTEM_EXTENSIONS)
     dnl the return type is 'char *', not 'int'.
     AC_CACHE_CHECK([whether ttyname_r is compatible with its POSIX signature],
index 5a882bb..27d96ff 100644 (file)
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 50
+# unistd_h.m4 serial 51
 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,
@@ -122,7 +122,6 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   HAVE_SLEEP=1;           AC_SUBST([HAVE_SLEEP])
   HAVE_SYMLINK=1;         AC_SUBST([HAVE_SYMLINK])
   HAVE_SYMLINKAT=1;       AC_SUBST([HAVE_SYMLINKAT])
-  HAVE_TTYNAME_R=1;       AC_SUBST([HAVE_TTYNAME_R])
   HAVE_UNLINKAT=1;        AC_SUBST([HAVE_UNLINKAT])
   HAVE_USLEEP=1;          AC_SUBST([HAVE_USLEEP])
   HAVE_DECL_ENVIRON=1;    AC_SUBST([HAVE_DECL_ENVIRON])
@@ -131,6 +130,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R])
   HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE])
   HAVE_DECL_GETUSERSHELL=1; AC_SUBST([HAVE_DECL_GETUSERSHELL])
+  HAVE_DECL_TTYNAME_R=1;  AC_SUBST([HAVE_DECL_TTYNAME_R])
   HAVE_OS_H=0;            AC_SUBST([HAVE_OS_H])
   HAVE_SYS_PARAM_H=0;     AC_SUBST([HAVE_SYS_PARAM_H])
   REPLACE_CHOWN=0;        AC_SUBST([REPLACE_CHOWN])
index e10797a..536e64c 100644 (file)
@@ -96,7 +96,6 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \
              -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \
              -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \
-             -e 's|@''HAVE_TTYNAME_R''@|$(HAVE_TTYNAME_R)|g' \
              -e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \
              -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \
              -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \
@@ -105,6 +104,7 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
              -e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \
              -e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \
+             -e 's|@''HAVE_DECL_TTYNAME_R''@|$(HAVE_DECL_TTYNAME_R)|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' \