> New module 'wctob'. > * lib/wchar.in.h (wctob): New declaration.
IRIX 6.5 has the wctob function but lacks its declaration. This patch provides the missing declaration. 2008-12-20 Bruno Haible <br...@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. --- lib/wchar.in.h.orig 2008-12-20 12:41:43.000000000 +0100 +++ lib/wchar.in.h 2008-12-20 12:21:41.000000000 +0100 @@ -97,7 +97,8 @@ /* 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 --- m4/wctob.m4.orig 2008-12-20 12:41:43.000000000 +0100 +++ m4/wctob.m4 2008-12-20 12:32:10.000000000 +0100 @@ -1,4 +1,4 @@ -# 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, @@ -10,10 +10,26 @@ 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 ]) --- m4/wchar.m4.orig 2008-12-20 12:41:43.000000000 +0100 +++ m4/wchar.m4 2008-12-20 12:22:29.000000000 +0100 @@ -7,7 +7,7 @@ dnl Written by Eric Blake. -# wchar.m4 serial 11 +# wchar.m4 serial 12 AC_DEFUN([gl_WCHAR_H], [ @@ -70,11 +70,11 @@ 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]) --- modules/wchar.orig 2008-12-20 12:41:44.000000000 +0100 +++ modules/wchar 2008-12-20 12:22:21.000000000 +0100 @@ -34,11 +34,11 @@ -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)' \ --- doc/posix-functions/wctob.texi.orig 2008-12-20 12:41:43.000000000 +0100 +++ doc/posix-functions/wctob.texi 2008-12-20 12:25:30.000000000 +0100 @@ -11,6 +11,9 @@ @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: