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 065bdf13955ee6f3ba27f164b1fde93819731953..1719958dfa2637e9e502ed4cbfd17ee6c0aacd2c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+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>.
index 3c6cd7b891e38b75c21c6584951748164b8aa105..ddf8b7535281f19d756394956e935c2c843f18dc 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 ba8ee6ab7bdf0125546b546fd3eaf0babaefcd1c..2e52a82acfb9a94e00ca1ef12729f3294995f64b 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 11a197fd4123643139cc59054eb488ae2fe6a542..cb7d9263ed8fbe9a3531655aa665ee4c7c64ffb4 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 9aef477e99197c77600b438de2c3d70d8a796423..e16278c5949d12fb0bdc8bab72885b55fb5fbd0d 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 53d374dfaed9be7e840e26f67afeae1c6f6e21d0..6a64928cdf8c3e484ec54fe0850d227ca547a44e 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 f7333cca6743a5fea3835bd6b9c0e2e29bd01988..f46150c5f887ec5cd9e0a0fe4b9ca9d567090cac 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 01ac0d181e0dc9752762af7993edcb109572fcd9..f5595ddfddb9e3ca1584aed408fae82d6a0b68bd 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 af1a9c2f017c6e03e5cdbbd4bc56980a1af46a3c..8e780131655a85162364907ba05aa2311ab990c9 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 295aa50eed8b4daa5d9be8bc2dc5530513c868ac..97aa1aace17034af8e783c1e82dbd0a5b0326d8f 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: