+2008-04-21 Bruno Haible <bruno@clisp.org>
+
+ * lib/wctype.in.h (iswalnum, iswalpha, iswblank, iswcntrl, iswdigit,
+ iswgraph, iswlower, iswprint, iswpunct, iswspace, iswupper, iswxdigit):
+ Define to replacements if REPLACE_ISWCNTRL is 1.
+ * m4/wctype.m4 (gl_WCTYPE_H): Test whether the isw* functions work.
+ If not, set WCTYPE_H to nonempty and REPLACE_ISWCNTRL to 1.
+ * modules/wctype (Makefile.am): Substitute REPLACE_ISWCNTRL.
+ * doc/posix-functions/iswalnum.texi: Mention the 'wctype' module and
+ what it fixes.
+ * doc/posix-functions/iswalpha.texi: Likewise.
+ * doc/posix-functions/iswblank.texi: Likewise.
+ * doc/posix-functions/iswcntrl.texi: Likewise.
+ * doc/posix-functions/iswdigit.texi: Likewise.
+ * doc/posix-functions/iswgraph.texi: Likewise.
+ * doc/posix-functions/iswlower.texi: Likewise.
+ * doc/posix-functions/iswprint.texi: Likewise.
+ * doc/posix-functions/iswpunct.texi: Likewise.
+ * doc/posix-functions/iswspace.texi: Likewise.
+ * doc/posix-functions/iswupper.texi: Likewise.
+ * doc/posix-functions/iswxdigit.texi: Likewise.
+
2008-04-21 Bruno Haible <bruno@clisp.org>
* m4/vsnprintf.m4 (gl_FUNC_VSNPRINTF): Fix typo in last commit.
POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswalnum.html}
-Gnulib module: ---
+Gnulib module: wctype
Portability problems fixed by Gnulib:
@itemize
+@item
+This function is missing on some platforms:
+Solaris 2.5.1.
+@item
+This function returns 0 for all possible arguments on some platforms:
+Linux libc5.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@item
-This function is missing on some platforms:
-Solaris 2.5.1.
-@item
On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
accommodate all Unicode characters.
@end itemize
POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswalpha.html}
-Gnulib module: ---
+Gnulib module: wctype
Portability problems fixed by Gnulib:
@itemize
+@item
+This function is missing on some platforms:
+Solaris 2.5.1.
+@item
+This function returns 0 for all possible arguments on some platforms:
+Linux libc5.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@item
-This function is missing on some platforms:
-Solaris 2.5.1.
-@item
On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
accommodate all Unicode characters.
@end itemize
POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswblank.html}
-Gnulib module: ---
+Gnulib module: wctype
Portability problems fixed by Gnulib:
@itemize
+@item
+This function returns 0 for all possible arguments on some platforms:
+Linux libc5.
@end itemize
Portability problems not fixed by Gnulib:
POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswcntrl.html}
-Gnulib module: ---
+Gnulib module: wctype
Portability problems fixed by Gnulib:
@itemize
+@item
+This function is missing on some platforms:
+Solaris 2.5.1.
+@item
+This function returns 0 for all possible arguments on some platforms:
+Linux libc5.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@item
-This function is missing on some platforms:
-Solaris 2.5.1.
-@item
On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
accommodate all Unicode characters.
@end itemize
POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswdigit.html}
-Gnulib module: ---
+Gnulib module: wctype
Portability problems fixed by Gnulib:
@itemize
+@item
+This function is missing on some platforms:
+Solaris 2.5.1.
+@item
+This function returns 0 for all possible arguments on some platforms:
+Linux libc5.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@item
-This function is missing on some platforms:
-Solaris 2.5.1.
-@item
On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
accommodate all Unicode characters.
@end itemize
POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswgraph.html}
-Gnulib module: ---
+Gnulib module: wctype
Portability problems fixed by Gnulib:
@itemize
+@item
+This function is missing on some platforms:
+Solaris 2.5.1.
+@item
+This function returns 0 for all possible arguments on some platforms:
+Linux libc5.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@item
-This function is missing on some platforms:
-Solaris 2.5.1.
-@item
On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
accommodate all Unicode characters.
@end itemize
POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswlower.html}
-Gnulib module: ---
+Gnulib module: wctype
Portability problems fixed by Gnulib:
@itemize
+@item
+This function is missing on some platforms:
+Solaris 2.5.1.
+@item
+This function returns 0 for all possible arguments on some platforms:
+Linux libc5.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@item
-This function is missing on some platforms:
-Solaris 2.5.1.
-@item
On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
accommodate all Unicode characters.
@end itemize
POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswprint.html}
-Gnulib module: ---
+Gnulib module: wctype
Portability problems fixed by Gnulib:
@itemize
+@item
+This function is missing on some platforms:
+Solaris 2.5.1.
+@item
+This function returns 0 for all possible arguments on some platforms:
+Linux libc5.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@item
-This function is missing on some platforms:
-Solaris 2.5.1.
-@item
On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
accommodate all Unicode characters.
@end itemize
POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswpunct.html}
-Gnulib module: ---
+Gnulib module: wctype
Portability problems fixed by Gnulib:
@itemize
+@item
+This function is missing on some platforms:
+Solaris 2.5.1.
+@item
+This function returns 0 for all possible arguments on some platforms:
+Linux libc5.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@item
-This function is missing on some platforms:
-Solaris 2.5.1.
-@item
On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
accommodate all Unicode characters.
@end itemize
POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswspace.html}
-Gnulib module: ---
+Gnulib module: wctype
Portability problems fixed by Gnulib:
@itemize
+@item
+This function is missing on some platforms:
+Solaris 2.5.1.
+@item
+This function returns 0 for all possible arguments on some platforms:
+Linux libc5.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@item
-This function is missing on some platforms:
-Solaris 2.5.1.
-@item
On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
accommodate all Unicode characters.
@end itemize
POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswupper.html}
-Gnulib module: ---
+Gnulib module: wctype
Portability problems fixed by Gnulib:
@itemize
+@item
+This function is missing on some platforms:
+Solaris 2.5.1.
+@item
+This function returns 0 for all possible arguments on some platforms:
+Linux libc5.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@item
-This function is missing on some platforms:
-Solaris 2.5.1.
-@item
On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
accommodate all Unicode characters.
@end itemize
POSIX specification: @url{http://www.opengroup.org/susv3xsh/iswxdigit.html}
-Gnulib module: ---
+Gnulib module: wctype
Portability problems fixed by Gnulib:
@itemize
+@item
+This function is missing on some platforms:
+Solaris 2.5.1.
+@item
+This function returns 0 for all possible arguments on some platforms:
+Linux libc5.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@item
-This function is missing on some platforms:
-Solaris 2.5.1.
-@item
On Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
accommodate all Unicode characters.
@end itemize
/* A substitute for ISO C99 <wctype.h>, for platforms that lack it.
- Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2006-2008 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#endif
/* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions.
+ Linux libc5 has <wctype.h> and the functions but they are broken.
Assume all 12 functions are implemented the same way, or not at all. */
-#if ! @HAVE_ISWCNTRL@
+#if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@
/* IRIX 5.3 has macros but no functions, its isw* macros refer to an
undefined variable _ctmp_ and to <ctype.h> macros like _P, and they
# undef iswupper
# undef iswxdigit
+/* Linux libc5 has <wctype.h> and the functions but they are broken. */
+# if @REPLACE_ISWCNTRL@
+# define iswalnum rpl_iswalnum
+# define iswalpha rpl_iswalpha
+# define iswblank rpl_iswblank
+# define iswcntrl rpl_iswcntrl
+# define iswdigit rpl_iswdigit
+# define iswgraph rpl_iswgraph
+# define iswlower rpl_iswlower
+# define iswprint rpl_iswprint
+# define iswpunct rpl_iswpunct
+# define iswspace rpl_iswspace
+# define iswupper rpl_iswupper
+# define iswxdigit rpl_iswxdigit
+# endif
+
static inline int
iswalnum (__wctype_wint_t wc)
{
dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it.
-dnl Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2008 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.
AC_DEFUN([gl_WCTYPE_H],
[
+ AC_REQUIRE([AC_PROG_CC])
AC_CHECK_FUNCS_ONCE([iswcntrl])
if test $ac_cv_func_iswcntrl = yes; then
HAVE_ISWCNTRL=1
WCTYPE_H=wctype.h
if test $ac_cv_header_wctype_h = yes; then
if test $ac_cv_func_iswcntrl = yes; then
- WCTYPE_H=
+ dnl Linux libc5 has an iswprint function that returns 0 for all arguments.
+ dnl The other functions are likely broken in the same way.
+ AC_CACHE_CHECK([whether iswcntrl works], [gl_cv_func_iswcntrl_works],
+ [
+ AC_TRY_RUN([#include <stddef.h>
+ #include <stdio.h>
+ #include <time.h>
+ #include <wchar.h>
+ #include <wctype.h>
+ int main () { return iswprint ('x') == 0; }],
+ [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no])
+ ],
+ [
+ AC_TRY_COMPILE([#include <stdlib.h>
+ #if __GNU_LIBRARY__ == 1
+ Linux libc5 i18n is broken.
+ #endif],
+ [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no])
+ ])
+ if test $gl_cv_func_iswcntrl_works = yes; then
+ WCTYPE_H=
+ fi
fi
dnl Compute NEXT_WCTYPE_H even if WCTYPE_H is empty,
dnl for the benefit of builds from non-distclean directories.
fi
AC_SUBST([HAVE_WCTYPE_H])
AC_SUBST([WCTYPE_H])
+
+ if test "$gl_cv_func_iswcntrl_works" = no; then
+ REPLACE_ISWCNTRL=1
+ else
+ REPLACE_ISWCNTRL=0
+ fi
+ AC_SUBST([REPLACE_ISWCNTRL])
])
-e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \
-e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \
-e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \
+ -e 's/@''REPLACE_ISWCNTRL''@/$(REPLACE_ISWCNTRL)/g' \
< $(srcdir)/wctype.in.h; \
} > $@-t
mv $@-t $@