Ensure wctob is declared on IRIX 6.5.
authorBruno Haible <bruno@clisp.org>
Sat, 20 Dec 2008 11:48:18 +0000 (12:48 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 20 Dec 2008 11:48:18 +0000 (12:48 +0100)
ChangeLog
doc/posix-functions/wctob.texi
lib/wchar.in.h
m4/wchar.m4
m4/wctob.m4
modules/wchar

index fe5a347..ecc957b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+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.
index c497076..d610660 100644 (file)
@@ -11,6 +11,9 @@ Portability problems fixed by Gnulib:
 @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:
index af0d978..2a8f839 100644 (file)
@@ -97,7 +97,8 @@ extern wint_t btowc (int c);
 
 /* 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
index acedc66..d7455f7 100644 (file)
@@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
 
 dnl Written by Eric Blake.
 
-# wchar.m4 serial 11
+# wchar.m4 serial 12
 
 AC_DEFUN([gl_WCHAR_H],
 [
@@ -70,11 +70,11 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS],
   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])
index f511b51..b9b8387 100644 (file)
@@ -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_DEFUN([gl_FUNC_WCTOB],
 
   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
 ])
 
index 8953fc1..e38a6da 100644 (file)
@@ -34,11 +34,11 @@ wchar.h: wchar.in.h
              -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)' \