Replace wcrtomb, wcsrtombs, wcsnrtombs if mbstate_t has to be replaced.
authorBruno Haible <bruno@clisp.org>
Fri, 1 May 2009 16:01:52 +0000 (18:01 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 1 May 2009 16:01:52 +0000 (18:01 +0200)
ChangeLog
lib/wchar.in.h
m4/wchar.m4
m4/wcrtomb.m4
m4/wcsnrtombs.m4
m4/wcsrtombs.m4
modules/wchar
modules/wcrtomb
modules/wcsnrtombs
modules/wcsrtombs

index 065bdf1..1719958 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,25 @@
 2009-05-01  Bruno Haible  <bruno@clisp.org>
 
+       * lib/wchar.in.h (wcsnrtombs): Define if REPLACE_WCSNRTOMBS is 1.
+       * m4/wcsnrtombs.m4 (gl_FUNC_WCSRTOMBS): Invoke gl_MBSTATE_T_BROKEN, and
+       set REPLACE_WCSNRTOMBS if mbstate_t must be replaced.
+       * m4/wchar.m4 (gl_WCHAR_H_DEFAULTS): Initialize REPLACE_WCSNRTOMBS.
+       * modules/wchar (Makefile.am): Substitute REPLACE_WCSNRTOMBS.
+       * modules/wcsnrtombs (Files): Add m4/mbrtowc.m4, m4/locale-ja.m4,
+       m4/locale-zh.m4, m4/codeset.m4.
+
+       * m4/wcsrtombs.m4 (gl_FUNC_WCSNRTOMBS): Invoke gl_MBSTATE_T_BROKEN, and
+       set REPLACE_WCSRTOMBS if mbstate_t must be replaced.
+       * modules/wcsrtombs (Files): Add m4/mbrtowc.m4, m4/locale-ja.m4,
+       m4/locale-zh.m4.
+
+       * m4/wcrtomb.m4 (gl_FUNC_WCRTOMB): Invoke gl_MBSTATE_T_BROKEN, and set
+       REPLACE_WCRTOMB if mbstate_t must be replaced.
+       * modules/wcrtomb (Files): Add m4/mbrtowc.m4.
+       Reported by Jens Rehsack <rehsack@googlemail.com> via Eric Blake.
+
+2009-05-01  Bruno Haible  <bruno@clisp.org>
+
        Avoid compiler warnings when redefining macros defined by <libintl.h>.
        * lib/gettext.h [!ENABLE_NLS] (gettext, dgettext, dcgettext, ngettext,
        dngettext, dcngettext, textdomain, bindtextdomain,
index 3c6cd7b..ddf8b75 100644 (file)
@@ -264,7 +264,11 @@ extern size_t wcsrtombs (char *dest, const wchar_t **srcp, size_t len, mbstate_t
 
 /* Convert a wide string to a string.  */
 #if @GNULIB_WCSNRTOMBS@
-# if !@HAVE_WCSNRTOMBS@
+# if @REPLACE_WCSNRTOMBS@
+#  undef wcsnrtombs
+#  define wcsnrtombs rpl_wcsnrtombs
+# endif
+# if !@HAVE_WCSNRTOMBS@ || @REPLACE_WCSNRTOMBS@
 extern size_t wcsnrtombs (char *dest, const wchar_t **srcp, size_t srclen, size_t len, mbstate_t *ps);
 # endif
 #elif defined GNULIB_POSIXCHECK
index ba8ee6a..2e52a82 100644 (file)
@@ -1,13 +1,13 @@
 dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
 
-dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
 dnl Written by Eric Blake.
 
-# wchar.m4 serial 22
+# wchar.m4 serial 23
 
 AC_DEFUN([gl_WCHAR_H],
 [
@@ -73,27 +73,28 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS],
   GNULIB_WCSNRTOMBS=0; AC_SUBST([GNULIB_WCSNRTOMBS])
   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_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_MBSNRTOWCS=1;   AC_SUBST([HAVE_MBSNRTOWCS])
-  HAVE_WCRTOMB=1;      AC_SUBST([HAVE_WCRTOMB])
-  HAVE_WCSRTOMBS=1;    AC_SUBST([HAVE_WCSRTOMBS])
-  HAVE_WCSNRTOMBS=1;   AC_SUBST([HAVE_WCSNRTOMBS])
-  HAVE_DECL_WCTOB=1;   AC_SUBST([HAVE_DECL_WCTOB])
-  HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH])
-  REPLACE_MBSTATE_T=0; AC_SUBST([REPLACE_MBSTATE_T])
-  REPLACE_BTOWC=0;     AC_SUBST([REPLACE_BTOWC])
-  REPLACE_WCTOB=0;     AC_SUBST([REPLACE_WCTOB])
-  REPLACE_MBSINIT=0;   AC_SUBST([REPLACE_MBSINIT])
-  REPLACE_MBRTOWC=0;   AC_SUBST([REPLACE_MBRTOWC])
-  REPLACE_MBRLEN=0;    AC_SUBST([REPLACE_MBRLEN])
-  REPLACE_MBSRTOWCS=0; AC_SUBST([REPLACE_MBSRTOWCS])
-  REPLACE_MBSNRTOWCS=0;AC_SUBST([REPLACE_MBSNRTOWCS])
-  REPLACE_WCRTOMB=0;   AC_SUBST([REPLACE_WCRTOMB])
-  REPLACE_WCSRTOMBS=0; AC_SUBST([REPLACE_WCSRTOMBS])
-  REPLACE_WCWIDTH=0;   AC_SUBST([REPLACE_WCWIDTH])
-  WCHAR_H='';          AC_SUBST([WCHAR_H])
+  HAVE_BTOWC=1;         AC_SUBST([HAVE_BTOWC])
+  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_MBSNRTOWCS=1;    AC_SUBST([HAVE_MBSNRTOWCS])
+  HAVE_WCRTOMB=1;       AC_SUBST([HAVE_WCRTOMB])
+  HAVE_WCSRTOMBS=1;     AC_SUBST([HAVE_WCSRTOMBS])
+  HAVE_WCSNRTOMBS=1;    AC_SUBST([HAVE_WCSNRTOMBS])
+  HAVE_DECL_WCTOB=1;    AC_SUBST([HAVE_DECL_WCTOB])
+  HAVE_DECL_WCWIDTH=1;  AC_SUBST([HAVE_DECL_WCWIDTH])
+  REPLACE_MBSTATE_T=0;  AC_SUBST([REPLACE_MBSTATE_T])
+  REPLACE_BTOWC=0;      AC_SUBST([REPLACE_BTOWC])
+  REPLACE_WCTOB=0;      AC_SUBST([REPLACE_WCTOB])
+  REPLACE_MBSINIT=0;    AC_SUBST([REPLACE_MBSINIT])
+  REPLACE_MBRTOWC=0;    AC_SUBST([REPLACE_MBRTOWC])
+  REPLACE_MBRLEN=0;     AC_SUBST([REPLACE_MBRLEN])
+  REPLACE_MBSRTOWCS=0;  AC_SUBST([REPLACE_MBSRTOWCS])
+  REPLACE_MBSNRTOWCS=0; AC_SUBST([REPLACE_MBSNRTOWCS])
+  REPLACE_WCRTOMB=0;    AC_SUBST([REPLACE_WCRTOMB])
+  REPLACE_WCSRTOMBS=0;  AC_SUBST([REPLACE_WCSRTOMBS])
+  REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS])
+  REPLACE_WCWIDTH=0;    AC_SUBST([REPLACE_WCWIDTH])
+  WCHAR_H='';           AC_SUBST([WCHAR_H])
 ])
index 11a197f..cb7d926 100644 (file)
@@ -1,4 +1,4 @@
-# wcrtomb.m4 serial 3
+# wcrtomb.m4 serial 4
 dnl Copyright (C) 2008-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -9,11 +9,15 @@ AC_DEFUN([gl_FUNC_WCRTOMB],
   AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
 
   AC_REQUIRE([AC_TYPE_MBSTATE_T])
+  gl_MBSTATE_T_BROKEN
+  if test $REPLACE_MBSTATE_T = 1; then
+    REPLACE_WCRTOMB=1
+  fi
   AC_CHECK_FUNCS_ONCE([wcrtomb])
   if test $ac_cv_func_wcrtomb = no; then
     HAVE_WCRTOMB=0
-  else
-
+  fi
+  if test $HAVE_WCRTOMB != 0 && test $REPLACE_WCRTOMB != 1; then
     dnl On AIX 4.3, OSF/1 5.1 and Solaris 10, wcrtomb (NULL, 0, NULL) sometimes
     dnl returns 0 instead of 1.
     AC_REQUIRE([AC_PROG_CC])
index 9aef477..e16278c 100644 (file)
@@ -1,5 +1,5 @@
-# wcsnrtombs.m4 serial 1
-dnl Copyright (C) 2008 Free Software Foundation, Inc.
+# wcsnrtombs.m4 serial 2
+dnl Copyright (C) 2008-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -9,9 +9,15 @@ AC_DEFUN([gl_FUNC_WCSNRTOMBS],
   AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
 
   AC_REQUIRE([AC_TYPE_MBSTATE_T])
+  gl_MBSTATE_T_BROKEN
+  if test $REPLACE_MBSTATE_T = 1; then
+    REPLACE_WCSNRTOMBS=1
+  fi
   AC_CHECK_FUNCS_ONCE([wcsnrtombs])
   if test $ac_cv_func_wcsnrtombs = no; then
     HAVE_WCSNRTOMBS=0
+  fi
+  if test $HAVE_WCSNRTOMBS = 0 || test $REPLACE_WCSNRTOMBS = 1; then
     gl_REPLACE_WCHAR_H
     AC_LIBOBJ([wcsnrtombs])
     AC_LIBOBJ([wcsrtombs-state])
index 53d374d..6a64928 100644 (file)
@@ -1,4 +1,4 @@
-# wcsrtombs.m4 serial 3
+# wcsrtombs.m4 serial 4
 dnl Copyright (C) 2008-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -9,10 +9,15 @@ AC_DEFUN([gl_FUNC_WCSRTOMBS],
   AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
 
   AC_REQUIRE([AC_TYPE_MBSTATE_T])
+  gl_MBSTATE_T_BROKEN
+  if test $REPLACE_MBSTATE_T = 1; then
+    REPLACE_WCSRTOMBS=1
+  fi
   AC_CHECK_FUNCS_ONCE([wcsrtombs])
   if test $ac_cv_func_wcsrtombs = no; then
     HAVE_WCSRTOMBS=0
-  else
+  fi
+  if test $HAVE_WCSRTOMBS != 0 && test $REPLACE_WCSRTOMBS != 1; then
     gl_WCSRTOMBS_TERMINATION
     gl_WCSRTOMBS_NULL
     case "$gl_cv_func_wcsrtombs_termination" in
index f7333cc..f46150c 100644 (file)
@@ -58,6 +58,7 @@ wchar.h: wchar.in.h
              -e 's|@''REPLACE_MBSNRTOWCS''@|$(REPLACE_MBSNRTOWCS)|g' \
              -e 's|@''REPLACE_WCRTOMB''@|$(REPLACE_WCRTOMB)|g' \
              -e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \
+             -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \
              -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
            < $(srcdir)/wchar.in.h; \
index 01ac0d1..f5595dd 100644 (file)
@@ -4,6 +4,7 @@ wcrtomb() function: convert wide character to multibyte character.
 Files:
 lib/wcrtomb.c
 m4/wcrtomb.m4
+m4/mbrtowc.m4
 m4/mbstate_t.m4
 m4/locale-fr.m4
 m4/locale-ja.m4
index af1a9c2..8e78013 100644 (file)
@@ -5,7 +5,11 @@ Files:
 lib/wcsnrtombs.c
 lib/wcsrtombs-state.c
 m4/wcsnrtombs.m4
+m4/mbrtowc.m4
 m4/mbstate_t.m4
+m4/locale-ja.m4
+m4/locale-zh.m4
+m4/codeset.m4
 
 Depends-on:
 wchar
index 295aa50..97aa1aa 100644 (file)
@@ -5,8 +5,11 @@ Files:
 lib/wcsrtombs.c
 lib/wcsrtombs-state.c
 m4/wcsrtombs.m4
+m4/mbrtowc.m4
 m4/mbstate_t.m4
 m4/locale-fr.m4
+m4/locale-ja.m4
+m4/locale-zh.m4
 m4/codeset.m4
 
 Depends-on: