Mercurial > hg > octave-kai > gnulib-hg
comparison m4/wctype_h.m4 @ 12914:7031f1066ded
More consistent naming of *.m4 files.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sat, 06 Mar 2010 19:08:20 +0100 |
parents | |
children | dbe2adea8676 |
comparison
equal
deleted
inserted
replaced
12913:6a1b2eb4c331 | 12914:7031f1066ded |
---|---|
1 # wctype_h.m4 serial 4 | |
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_HEADERS_ONCE([wctype.h]) | |
24 AC_REQUIRE([AC_C_INLINE]) | |
25 | |
26 AC_REQUIRE([gt_TYPE_WINT_T]) | |
27 if test $gt_cv_c_wint_t = yes; then | |
28 HAVE_WINT_T=1 | |
29 else | |
30 HAVE_WINT_T=0 | |
31 fi | |
32 AC_SUBST([HAVE_WINT_T]) | |
33 | |
34 WCTYPE_H=wctype.h | |
35 if test $ac_cv_header_wctype_h = yes; then | |
36 if test $ac_cv_func_iswcntrl = yes; then | |
37 dnl Linux libc5 has an iswprint function that returns 0 for all arguments. | |
38 dnl The other functions are likely broken in the same way. | |
39 AC_CACHE_CHECK([whether iswcntrl works], [gl_cv_func_iswcntrl_works], | |
40 [ | |
41 AC_RUN_IFELSE([AC_LANG_SOURCE([[ | |
42 #include <stddef.h> | |
43 #include <stdio.h> | |
44 #include <time.h> | |
45 #include <wchar.h> | |
46 #include <wctype.h> | |
47 int main () { return iswprint ('x') == 0; }]])], | |
48 [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no], | |
49 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h> | |
50 #if __GNU_LIBRARY__ == 1 | |
51 Linux libc5 i18n is broken. | |
52 #endif]], [])], | |
53 [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no]) | |
54 ]) | |
55 ]) | |
56 if test $gl_cv_func_iswcntrl_works = yes; then | |
57 case "$host_os" in | |
58 mingw*) | |
59 dnl On mingw, towlower and towupper return random high 16 bits. | |
60 ;; | |
61 *) | |
62 dnl iswcntrl works. towlower and towupper work as well. | |
63 WCTYPE_H= | |
64 ;; | |
65 esac | |
66 fi | |
67 fi | |
68 dnl Compute NEXT_WCTYPE_H even if WCTYPE_H is empty, | |
69 dnl for the benefit of builds from non-distclean directories. | |
70 gl_CHECK_NEXT_HEADERS([wctype.h]) | |
71 HAVE_WCTYPE_H=1 | |
72 else | |
73 HAVE_WCTYPE_H=0 | |
74 fi | |
75 AC_SUBST([HAVE_WCTYPE_H]) | |
76 AC_SUBST([WCTYPE_H]) | |
77 | |
78 if test "$gl_cv_func_iswcntrl_works" = no; then | |
79 REPLACE_ISWCNTRL=1 | |
80 else | |
81 REPLACE_ISWCNTRL=0 | |
82 fi | |
83 AC_SUBST([REPLACE_ISWCNTRL]) | |
84 ]) |