+2008-12-20 Bruno Haible <bruno@clisp.org>
+
+ Ensure wctob is declared on IRIX 6.5.
+ * lib/wchar.in.h (wctob): Declare also when HAVE_DECL_WCTOB is 0.
+ * m4/wctob.m4 (gl_FUNC_WCTOB): Set HAVE_DECL_WCTOB instead of
+ HAVE_WCTOB. Also test whether <wchar.h> declares wctob.
+ * m4/wchar.m4 (gl_WCHAR_H_DEFAULTS): Initialize HAVE_DECL_WCTOB instead
+ of HAVE_WCTOB.
+ * modules/wchar (Makefile.am): Substitute HAVE_DECL_WCTOB instead of
+ HAVE_WCTOB.
+ * doc/posix-functions/wctob.texi: Mention missing declaration on IRIX.
+
2008-12-19 Bruno Haible <bruno@clisp.org>
* modules/mbsrtowcs-tests: New file.
@item
This function is missing on some platforms:
HP-UX 11, IRIX 5.3, Solaris 2.6, mingw, Interix 3.5.
+@item
+This function is missing a declaration on some platforms:
+IRIX 6.5.
@end itemize
Portability problems not fixed by Gnulib:
/* Convert a wide character to a single-byte character. */
#if @GNULIB_WCTOB@
-# if !@HAVE_WCTOB@
+# if !defined wctob && !@HAVE_DECL_WCTOB@
+/* wctob is provided by gnulib, or wctob exists but is not declared. */
extern int wctob (wint_t wc);
# endif
#elif defined GNULIB_POSIXCHECK
dnl Written by Eric Blake.
-# wchar.m4 serial 11
+# wchar.m4 serial 12
AC_DEFUN([gl_WCHAR_H],
[
GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_BTOWC=1; AC_SUBST([HAVE_BTOWC])
- HAVE_WCTOB=1; AC_SUBST([HAVE_WCTOB])
HAVE_MBSINIT=1; AC_SUBST([HAVE_MBSINIT])
HAVE_MBRTOWC=1; AC_SUBST([HAVE_MBRTOWC])
HAVE_MBRLEN=1; AC_SUBST([HAVE_MBRLEN])
HAVE_MBSRTOWCS=1; AC_SUBST([HAVE_MBSRTOWCS])
+ HAVE_DECL_WCTOB=1; AC_SUBST([HAVE_DECL_WCTOB])
HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH])
REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH])
WCHAR_H=''; AC_SUBST([WCHAR_H])
-# wctob.m4 serial 1
+# wctob.m4 serial 2
dnl Copyright (C) 2008 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([wctob])
if test $ac_cv_func_wctob = no; then
- HAVE_WCTOB=0
+ HAVE_DECL_WCTOB=0
gl_REPLACE_WCHAR_H
AC_LIBOBJ([wctob])
gl_PREREQ_WCTOB
+ else
+ dnl IRIX 6.5 has the wctob() function but does not declare it.
+ AC_CHECK_DECLS([wctob], [], [], [
+/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
+ <wchar.h>.
+ BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included
+ before <wchar.h>. */
+#include <stddef.h>
+#include <stdio.h>
+#include <time.h>
+#include <wchar.h>
+])
+ if test $ac_cv_have_decl_wctob != yes; then
+ HAVE_DECL_WCTOB=0
+ gl_REPLACE_WCHAR_H
+ fi
fi
])
-e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \
-e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \
-e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \
- -e 's|@''HAVE_WCTOB''@|$(HAVE_WCTOB)|g' \
-e 's|@''HAVE_MBSINIT''@|$(HAVE_MBSINIT)|g' \
-e 's|@''HAVE_MBRTOWC''@|$(HAVE_MBRTOWC)|g' \
-e 's|@''HAVE_MBRLEN''@|$(HAVE_MBRLEN)|g' \
-e 's|@''HAVE_MBSRTOWCS''@|$(HAVE_MBSRTOWCS)|g' \
+ -e 's|@''HAVE_DECL_WCTOB''@|$(HAVE_DECL_WCTOB)|g' \
-e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
-e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \