* lib/stdlib.in.h (ptsname_r): Override if REPLACE_PTSNAME_R is 1.
* m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize REPLACE_PTSNAME_R.
* m4/ptsname_r.m4 (gl_FUNC_PTSNAME_R): Set REPLACE_PTSNAME_R if the
function is not declared or incompatibly declared.
* modules/stdlib (Makefile.am): Substitute REPLACE_PTSNAME_R.
* modules/ptsname_r (Depends-on, configure.ac): Update.
* doc/glibc-functions/ptsname_r.texi: Mention the OSF/1 problems.
+2011-11-10 Bruno Haible <bruno@clisp.org>
+
+ ptsname_r: Avoid compilation error on OSF/1 5.1.
+ * lib/stdlib.in.h (ptsname_r): Override if REPLACE_PTSNAME_R is 1.
+ * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize REPLACE_PTSNAME_R.
+ * m4/ptsname_r.m4 (gl_FUNC_PTSNAME_R): Set REPLACE_PTSNAME_R if the
+ function is not declared or incompatibly declared.
+ * modules/stdlib (Makefile.am): Substitute REPLACE_PTSNAME_R.
+ * modules/ptsname_r (Depends-on, configure.ac): Update.
+ * doc/glibc-functions/ptsname_r.texi: Mention the OSF/1 problems.
+
2011-11-10 Bruno Haible <bruno@clisp.org>
fstatat: Make cross-compilation guess succeed everywhere except on AIX.
MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8,
AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 11 2010-11, Cygwin 1.7.9, mingw,
MSVC 9, BeOS.
+@item
+This function is not declared unless @code{_REENTRANT} is defined,
+on some platforms:
+OSF/1 5.1.
+@item
+This function has an incompatible declaration on some platforms:
+OSF/1 5.1.
@end itemize
Portability problems not fixed by Gnulib:
/* Set the pathname of the pseudo-terminal slave associated with
the master FD is open on and return 0, or set errno and return
non-zero on errors. */
-# if !@HAVE_PTSNAME_R@
+# if @REPLACE_PTSNAME_R@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef ptsname_r
+# define ptsname_r rpl_ptsname_r
+# endif
+_GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
+_GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
+# else
+# if !@HAVE_PTSNAME_R@
_GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
-# endif
+# endif
_GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
+# endif
_GL_CXXALIASWARN (ptsname_r);
#elif defined GNULIB_POSIXCHECK
# undef ptsname_r
-# ptsname_r.m4 serial 1
+# ptsname_r.m4 serial 2
dnl Copyright (C) 2010-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_CHECK_FUNCS_ONCE([ptsname_r])
if test $ac_cv_func_ptsname_r = no; then
HAVE_PTSNAME_R=0
+ else
+ dnl On OSF/1 5.1, the type of the third argument is 'int', not 'size_t',
+ dnl and the declaration is missing if _REENTRANT is not defined.
+ AC_CACHE_CHECK([whether ptsname_r has the same signature as in glibc],
+ [gl_cv_func_ptsname_r_signature_ok],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <stddef.h>
+ #include <stdlib.h>
+ /* Test whether ptsname_r is declared at all. */
+ int (*f) (int, char *, size_t) = ptsname_r;
+ /* Test whether it has the same declaration as in glibc. */
+ #undef ptsname_r
+ extern
+ #ifdef __cplusplus
+ "C"
+ #endif
+ int ptsname_r (int, char *, size_t);
+ ]],
+ [[return f (0, NULL, 0);]])
+ ],
+ [gl_cv_func_ptsname_r_signature_ok=yes],
+ [gl_cv_func_ptsname_r_signature_ok=no])
+ ])
+ if test $gl_cv_func_ptsname_r_signature_ok = no; then
+ REPLACE_PTSNAME_R=1
+ fi
fi
])
-# stdlib_h.m4 serial 38
+# stdlib_h.m4 serial 39
dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
REPLACE_MALLOC=0; AC_SUBST([REPLACE_MALLOC])
REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC])
REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP])
+ REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R])
REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV])
REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC])
REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH])
Depends-on:
stdlib
extensions
-ttyname_r [test $HAVE_PTSNAME_R = 0]
+ttyname_r [test $HAVE_PTSNAME_R = 0 || test $REPLACE_PTSNAME_R = 1]
configure.ac:
gl_FUNC_PTSNAME_R
-if test $HAVE_PTSNAME_R = 0; then
+if test $HAVE_PTSNAME_R = 0 || test $REPLACE_PTSNAME_R = 1; then
AC_LIBOBJ([ptsname_r])
gl_PREREQ_PTSNAME_R
fi
-e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \
-e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \
-e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
+ -e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \
-e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
-e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \
-e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \