diff options
author | Bruno Haible <bruno@clisp.org> | 2011-11-10 13:48:16 +0100 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2011-11-10 13:48:16 +0100 |
commit | f5562fca6f341accafc32a5285a0262625df0fde (patch) | |
tree | 0c2815d8c5963d6ca2f667ae37af0bd427f0528c /m4 | |
parent | 24a579b40979e51868e07b56ea307c1b2c12bcff (diff) | |
download | gnulib-f5562fca6f341accafc32a5285a0262625df0fde.tar.gz |
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.
Diffstat (limited to 'm4')
-rw-r--r-- | m4/ptsname_r.m4 | 29 | ||||
-rw-r--r-- | m4/stdlib_h.m4 | 3 |
2 files changed, 30 insertions, 2 deletions
diff --git a/m4/ptsname_r.m4 b/m4/ptsname_r.m4 index fb070998ed..695fe791b1 100644 --- a/m4/ptsname_r.m4 +++ b/m4/ptsname_r.m4 @@ -1,4 +1,4 @@ -# 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, @@ -14,6 +14,33 @@ AC_DEFUN([gl_FUNC_PTSNAME_R], 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 ]) diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4 index ebf7fb52a9..0a8a9e5631 100644 --- a/m4/stdlib_h.m4 +++ b/m4/stdlib_h.m4 @@ -1,4 +1,4 @@ -# 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, @@ -99,6 +99,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], 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]) |