1 # wctype_h.m4 serial 13
3 dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it.
5 dnl Copyright (C) 2006-2011 Free Software Foundation, Inc.
6 dnl This file is free software; the Free Software Foundation
7 dnl gives unlimited permission to copy and/or distribute it,
8 dnl with or without modifications, as long as this notice is preserved.
10 dnl Written by Paul Eggert.
12 AC_DEFUN([gl_WCTYPE_H],
14 AC_REQUIRE([gl_WCTYPE_H_DEFAULTS])
15 AC_REQUIRE([AC_PROG_CC])
16 AC_REQUIRE([AC_CANONICAL_HOST])
17 AC_CHECK_FUNCS_ONCE([iswcntrl])
18 if test $ac_cv_func_iswcntrl = yes; then
23 AC_SUBST([HAVE_ISWCNTRL])
25 AC_REQUIRE([AC_C_INLINE])
27 AC_REQUIRE([gt_TYPE_WINT_T])
28 if test $gt_cv_c_wint_t = yes; then
33 AC_SUBST([HAVE_WINT_T])
35 gl_CHECK_NEXT_HEADERS([wctype.h])
36 if test $ac_cv_header_wctype_h = yes; then
37 if test $ac_cv_func_iswcntrl = yes; then
38 dnl Linux libc5 has an iswprint function that returns 0 for all arguments.
39 dnl The other functions are likely broken in the same way.
40 AC_CACHE_CHECK([whether iswcntrl works], [gl_cv_func_iswcntrl_works],
44 /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be
45 included before <wchar.h>.
46 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h>
47 must be included before <wchar.h>. */
53 int main () { return iswprint ('x') == 0; }
55 [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no],
56 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
57 #if __GNU_LIBRARY__ == 1
58 Linux libc5 i18n is broken.
60 [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no])
68 AC_SUBST([HAVE_WCTYPE_H])
70 if test "$gl_cv_func_iswcntrl_works" = no; then
75 AC_SUBST([REPLACE_ISWCNTRL])
77 if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then
78 dnl Redefine all of iswcntrl, ..., towupper in <wctype.h>.
83 AC_DEFUN([gl_WCTYPE_MODULE_INDICATOR],
85 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
86 AC_REQUIRE([gl_WCTYPE_H_DEFAULTS])
87 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
88 dnl Define it also as a C macro, for the benefit of the unit tests.
89 gl_MODULE_INDICATOR_FOR_TESTS([$1])
92 AC_DEFUN([gl_WCTYPE_H_DEFAULTS],
94 GNULIB_ISWBLANK=0; AC_SUBST([GNULIB_ISWBLANK])
95 dnl Assume proper GNU behavior unless another module says otherwise.
96 HAVE_ISWBLANK=1; AC_SUBST([HAVE_ISWBLANK])
97 REPLACE_ISWBLANK=0; AC_SUBST([REPLACE_ISWBLANK])