From 060a5ab2b25c067185f3c3c077287c65723ea985 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 31 Jul 2011 22:39:32 +0200 Subject: [PATCH] wctype-h: Add support for Minix. * m4/wctype_h.m4 (gl_WCTYPE_H): Test whether towlower is declared. Set REPLACE_TOWLOWER. * modules/wctype-h (Makefile.am): Substitute REPLACE_TOWLOWER. * lib/wctype.in.h (towlower, towupper): Test REPLACE_TOWLOWER, not REPLACE_ISWCNTRL. --- ChangeLog | 9 +++++++++ lib/wctype.in.h | 10 +++++++--- m4/wctype_h.m4 | 36 ++++++++++++++++++++++++++++++++++-- modules/wctype-h | 1 + 4 files changed, 51 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index a563a1a11d..b95959c035 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-07-31 Bruno Haible + + wctype-h: Add support for Minix. + * m4/wctype_h.m4 (gl_WCTYPE_H): Test whether towlower is declared. Set + REPLACE_TOWLOWER. + * modules/wctype-h (Makefile.am): Substitute REPLACE_TOWLOWER. + * lib/wctype.in.h (towlower, towupper): Test REPLACE_TOWLOWER, not + REPLACE_ISWCNTRL. + 2011-07-31 Paul Eggert * lib/xalloc.h (DEFAULT_MXFAST): Track 64-bit glibc. diff --git a/lib/wctype.in.h b/lib/wctype.in.h index 5e6798a449..cb50c5b0ef 100644 --- a/lib/wctype.in.h +++ b/lib/wctype.in.h @@ -128,6 +128,10 @@ # define iswspace rpl_iswspace # define iswupper rpl_iswupper # define iswxdigit rpl_iswxdigit +# endif +# endif +# if @REPLACE_TOWLOWER@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define towlower rpl_towlower # define towupper rpl_towupper # endif @@ -271,7 +275,7 @@ iswxdigit } static inline wint_t -# if @REPLACE_ISWCNTRL@ +# if @REPLACE_TOWLOWER@ rpl_towlower # else towlower @@ -282,7 +286,7 @@ towlower } static inline wint_t -# if @REPLACE_ISWCNTRL@ +# if @REPLACE_TOWLOWER@ rpl_towupper # else towupper @@ -429,7 +433,7 @@ _GL_WARN_ON_USE (iswctype, "iswctype is unportable - " # endif #endif -#if @REPLACE_ISWCNTRL@ || defined __MINGW32__ +#if @REPLACE_TOWLOWER@ || defined __MINGW32__ _GL_CXXALIAS_RPL (towlower, wint_t, (wint_t wc)); _GL_CXXALIAS_RPL (towupper, wint_t, (wint_t wc)); #else diff --git a/m4/wctype_h.m4 b/m4/wctype_h.m4 index ef9fb049ce..6df403b3a6 100644 --- a/m4/wctype_h.m4 +++ b/m4/wctype_h.m4 @@ -1,4 +1,4 @@ -# wctype_h.m4 serial 14 +# wctype_h.m4 serial 15 dnl A placeholder for ISO C99 , for platforms that lack it. @@ -75,7 +75,39 @@ AC_DEFUN([gl_WCTYPE_H], AC_SUBST([REPLACE_ISWCNTRL]) if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then - dnl Redefine all of iswcntrl, ..., towupper in . + dnl Redefine all of iswcntrl, ..., iswxdigit in . + : + fi + + if test $REPLACE_ISWCNTRL = 1; then + REPLACE_TOWLOWER=1 + else + AC_CHECK_DECLS([towlower],,, + [[/* Tru64 with Desktop Toolkit C has a bug: must be + included before . + BSD/OS 4.0.1 has a bug: , and + must be included before . */ + #include + #include + #include + #include + #if HAVE_WCTYPE_H + # include + #endif + ]]) + if test $ac_cv_have_decl_towlower = yes; then + dnl On Minix 3.1.8, the system's declares towlower() and + dnl towupper() although it does not have the functions. Avoid a collision + dnl with gnulib's replacement. + REPLACE_TOWLOWER=1 + else + REPLACE_TOWLOWER=0 + fi + fi + AC_SUBST([REPLACE_TOWLOWER]) + + if test $HAVE_ISWCNTRL = 0 || test $REPLACE_TOWLOWER = 1; then + dnl Redefine towlower, towupper in . : fi diff --git a/modules/wctype-h b/modules/wctype-h index 58491192c0..f7b7b5911f 100644 --- a/modules/wctype-h +++ b/modules/wctype-h @@ -40,6 +40,7 @@ wctype.h: wctype.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \ -e 's/@''REPLACE_ISWBLANK''@/$(REPLACE_ISWBLANK)/g' \ -e 's/@''REPLACE_ISWCNTRL''@/$(REPLACE_ISWCNTRL)/g' \ + -e 's/@''REPLACE_TOWLOWER''@/$(REPLACE_TOWLOWER)/g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/wctype.in.h; \ -- 2.30.2