# HG changeset patch # User Bruno Haible # Date 1297030710 -3600 # Node ID 18ad0b0246fcfae6fbd3ad5c6d69cb928bf74b77 # Parent 0c0a50ad23ad03797f3c9b8484d4d20383a14d76 wctype-h: Ensure wctype_t and wctrans_t are defined. * lib/wctype.in.h (wctype_t, wctrans_t): New type declarations. * m4/wctype_h.m4 (gl_WCTYPE_H): Determine HAVE_WCTYPE_T, HAVE_WCTRANS_T. (gl_WCTYPE_H_DEFAULTS): Initialize HAVE_WCTYPE_T, HAVE_WCTRANS_T. * modules/wctype-h (Makefile.am): Substitute HAVE_WCTYPE_T, HAVE_WCTRANS_T. * tests/test-wctype-h.c: Check that wctype_t and wctrans_t are defined. diff -r 0c0a50ad23ad -r 18ad0b0246fc ChangeLog --- a/ChangeLog Wed Feb 09 09:45:17 2011 -0800 +++ b/ChangeLog Sun Feb 06 23:18:30 2011 +0100 @@ -1,3 +1,13 @@ +2011-02-06 Bruno Haible + + wctype-h: Ensure wctype_t and wctrans_t are defined. + * lib/wctype.in.h (wctype_t, wctrans_t): New type declarations. + * m4/wctype_h.m4 (gl_WCTYPE_H): Determine HAVE_WCTYPE_T, HAVE_WCTRANS_T. + (gl_WCTYPE_H_DEFAULTS): Initialize HAVE_WCTYPE_T, HAVE_WCTRANS_T. + * modules/wctype-h (Makefile.am): Substitute HAVE_WCTYPE_T, + HAVE_WCTRANS_T. + * tests/test-wctype-h.c: Check that wctype_t and wctrans_t are defined. + 2011-02-09 Paul Eggert flock: fix license typo diff -r 0c0a50ad23ad -r 18ad0b0246fc lib/wctype.in.h --- a/lib/wctype.in.h Wed Feb 09 09:45:17 2011 -0800 +++ b/lib/wctype.in.h Sun Feb 06 23:18:30 2011 +0100 @@ -377,6 +377,13 @@ _GL_CXXALIASWARN (iswblank); #endif +#if !@HAVE_WCTYPE_T@ +# if !GNULIB_defined_wctype_t +typedef void * wctype_t; +# define GNULIB_defined_wctype_t 1 +# endif +#endif + #if @REPLACE_ISWCNTRL@ || defined __MINGW32__ _GL_CXXALIAS_RPL (towlower, wint_t, (wint_t wc)); _GL_CXXALIAS_RPL (towupper, wint_t, (wint_t wc)); @@ -387,6 +394,13 @@ _GL_CXXALIASWARN (towlower); _GL_CXXALIASWARN (towupper); +#if !@HAVE_WCTRANS_T@ +# if !GNULIB_defined_wctrans_t +typedef void * wctrans_t; +# define GNULIB_defined_wctrans_t 1 +# endif +#endif + #endif /* _GL_WCTYPE_H */ #endif /* _GL_WCTYPE_H */ diff -r 0c0a50ad23ad -r 18ad0b0246fc m4/wctype_h.m4 --- a/m4/wctype_h.m4 Wed Feb 09 09:45:17 2011 -0800 +++ b/m4/wctype_h.m4 Sun Feb 06 23:18:30 2011 +0100 @@ -1,4 +1,4 @@ -# wctype_h.m4 serial 13 +# wctype_h.m4 serial 14 dnl A placeholder for ISO C99 , for platforms that lack it. @@ -78,6 +78,58 @@ dnl Redefine all of iswcntrl, ..., towupper in . : fi + + dnl We assume that the wctype() and iswctype() functions exist if and only + dnl if the type wctype_t is defined in or in if that + dnl exists. + dnl HP-UX 11.00 declares all these in and lacks . + AC_CACHE_CHECK([for wctype_t], [gl_cv_type_wctype_t], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[/* 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 + wctype_t a; + ]], + [[]])], + [gl_cv_type_wctype_t=yes], + [gl_cv_type_wctype_t=no]) + ]) + if test $gl_cv_type_wctype_t = no; then + HAVE_WCTYPE_T=0 + fi + + dnl We assume that the wctrans() and towctrans() functions exist if and only + dnl if the type wctrans_t is defined in . + AC_CACHE_CHECK([for wctrans_t], [gl_cv_type_wctrans_t], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[/* 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 + #include + wctrans_t a; + ]], + [[]])], + [gl_cv_type_wctrans_t=yes], + [gl_cv_type_wctrans_t=no]) + ]) + if test $gl_cv_type_wctrans_t = no; then + HAVE_WCTRANS_T=0 + fi ]) AC_DEFUN([gl_WCTYPE_MODULE_INDICATOR], @@ -94,5 +146,7 @@ GNULIB_ISWBLANK=0; AC_SUBST([GNULIB_ISWBLANK]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_ISWBLANK=1; AC_SUBST([HAVE_ISWBLANK]) + HAVE_WCTYPE_T=1; AC_SUBST([HAVE_WCTYPE_T]) + HAVE_WCTRANS_T=1; AC_SUBST([HAVE_WCTRANS_T]) REPLACE_ISWBLANK=0; AC_SUBST([REPLACE_ISWBLANK]) ]) diff -r 0c0a50ad23ad -r 18ad0b0246fc modules/wctype-h --- a/modules/wctype-h Wed Feb 09 09:45:17 2011 -0800 +++ b/modules/wctype-h Sun Feb 06 23:18:30 2011 +0100 @@ -30,6 +30,8 @@ -e 's/@''GNULIB_ISWBLANK''@/$(GNULIB_ISWBLANK)/g' \ -e 's/@''HAVE_ISWBLANK''@/$(HAVE_ISWBLANK)/g' \ -e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \ + -e 's/@''HAVE_WCTYPE_T''@/$(HAVE_WCTYPE_T)/g' \ + -e 's/@''HAVE_WCTRANS_T''@/$(HAVE_WCTRANS_T)/g' \ -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \ -e 's/@''REPLACE_ISWBLANK''@/$(REPLACE_ISWBLANK)/g' \ -e 's/@''REPLACE_ISWCNTRL''@/$(REPLACE_ISWCNTRL)/g' \ diff -r 0c0a50ad23ad -r 18ad0b0246fc tests/test-wctype-h.c --- a/tests/test-wctype-h.c Wed Feb 09 09:45:17 2011 -0800 +++ b/tests/test-wctype-h.c Sun Feb 06 23:18:30 2011 +0100 @@ -27,6 +27,12 @@ /* Check that WEOF is defined. */ wint_t e = WEOF; +/* Check that the type wctype_t is defined. */ +wctype_t p; + +/* Check that the type wctrans_t is defined. */ +wctrans_t q; + int main (void) {