Mercurial > hg > octave-kai > gnulib-hg
changeset 11527:4fe203c3f828
Replace wcrtomb, wcsrtombs, wcsnrtombs if mbstate_t has to be replaced.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Fri, 01 May 2009 18:01:52 +0200 |
parents | c016cd78304d |
children | 16e511eaf7d5 |
files | 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 |
diffstat | 10 files changed, 82 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- 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>.
--- a/lib/wchar.in.h +++ b/lib/wchar.in.h @@ -264,7 +264,11 @@ /* 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
--- a/m4/wchar.m4 +++ b/m4/wchar.m4 @@ -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 @@ 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]) ])
--- a/m4/wcrtomb.m4 +++ b/m4/wcrtomb.m4 @@ -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_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])
--- a/m4/wcsnrtombs.m4 +++ b/m4/wcsnrtombs.m4 @@ -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_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])
--- a/m4/wcsrtombs.m4 +++ b/m4/wcsrtombs.m4 @@ -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_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
--- a/modules/wchar +++ b/modules/wchar @@ -58,6 +58,7 @@ -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; \
--- a/modules/wcrtomb +++ b/modules/wcrtomb @@ -4,6 +4,7 @@ Files: lib/wcrtomb.c m4/wcrtomb.m4 +m4/mbrtowc.m4 m4/mbstate_t.m4 m4/locale-fr.m4 m4/locale-ja.m4