diff options
Diffstat (limited to 'gl/m4/wctype_h.m4')
-rw-r--r-- | gl/m4/wctype_h.m4 | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/gl/m4/wctype_h.m4 b/gl/m4/wctype_h.m4 new file mode 100644 index 0000000..3292451 --- /dev/null +++ b/gl/m4/wctype_h.m4 | |||
@@ -0,0 +1,76 @@ | |||
1 | # wctype_h.m4 serial 6 | ||
2 | |||
3 | dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it. | ||
4 | |||
5 | dnl Copyright (C) 2006-2010 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. | ||
9 | |||
10 | dnl Written by Paul Eggert. | ||
11 | |||
12 | AC_DEFUN([gl_WCTYPE_H], | ||
13 | [ | ||
14 | AC_REQUIRE([AC_PROG_CC]) | ||
15 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
16 | AC_CHECK_FUNCS_ONCE([iswcntrl]) | ||
17 | if test $ac_cv_func_iswcntrl = yes; then | ||
18 | HAVE_ISWCNTRL=1 | ||
19 | else | ||
20 | HAVE_ISWCNTRL=0 | ||
21 | fi | ||
22 | AC_SUBST([HAVE_ISWCNTRL]) | ||
23 | AC_CHECK_FUNCS_ONCE([iswblank]) | ||
24 | if test $ac_cv_func_iswblank = yes; then | ||
25 | HAVE_ISWBLANK=1 | ||
26 | else | ||
27 | HAVE_ISWBLANK=0 | ||
28 | fi | ||
29 | AC_SUBST([HAVE_ISWBLANK]) | ||
30 | AC_CHECK_HEADERS_ONCE([wctype.h]) | ||
31 | AC_REQUIRE([AC_C_INLINE]) | ||
32 | |||
33 | AC_REQUIRE([gt_TYPE_WINT_T]) | ||
34 | if test $gt_cv_c_wint_t = yes; then | ||
35 | HAVE_WINT_T=1 | ||
36 | else | ||
37 | HAVE_WINT_T=0 | ||
38 | fi | ||
39 | AC_SUBST([HAVE_WINT_T]) | ||
40 | |||
41 | if test $ac_cv_header_wctype_h = yes; then | ||
42 | if test $ac_cv_func_iswcntrl = yes; then | ||
43 | dnl Linux libc5 has an iswprint function that returns 0 for all arguments. | ||
44 | dnl The other functions are likely broken in the same way. | ||
45 | AC_CACHE_CHECK([whether iswcntrl works], [gl_cv_func_iswcntrl_works], | ||
46 | [ | ||
47 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ | ||
48 | #include <stddef.h> | ||
49 | #include <stdio.h> | ||
50 | #include <time.h> | ||
51 | #include <wchar.h> | ||
52 | #include <wctype.h> | ||
53 | int main () { return iswprint ('x') == 0; }]])], | ||
54 | [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no], | ||
55 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h> | ||
56 | #if __GNU_LIBRARY__ == 1 | ||
57 | Linux libc5 i18n is broken. | ||
58 | #endif]], [])], | ||
59 | [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no]) | ||
60 | ]) | ||
61 | ]) | ||
62 | fi | ||
63 | gl_CHECK_NEXT_HEADERS([wctype.h]) | ||
64 | HAVE_WCTYPE_H=1 | ||
65 | else | ||
66 | HAVE_WCTYPE_H=0 | ||
67 | fi | ||
68 | AC_SUBST([HAVE_WCTYPE_H]) | ||
69 | |||
70 | if test "$gl_cv_func_iswcntrl_works" = no; then | ||
71 | REPLACE_ISWCNTRL=1 | ||
72 | else | ||
73 | REPLACE_ISWCNTRL=0 | ||
74 | fi | ||
75 | AC_SUBST([REPLACE_ISWCNTRL]) | ||
76 | ]) | ||