Use Gnulib's `locale' module.
[bpt/guile.git] / m4 / wchar.m4
CommitLineData
e65fc94b
LC
1dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
2
f240aacb 3dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
e65fc94b
LC
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8dnl Written by Eric Blake.
9
414e4441 10# wchar.m4 serial 26
e65fc94b
LC
11
12AC_DEFUN([gl_WCHAR_H],
13[
14 AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
15 AC_CACHE_CHECK([whether <wchar.h> is standalone],
16 [gl_cv_header_wchar_h_standalone],
17 [AC_COMPILE_IFELSE([[#include <wchar.h>
18wchar_t w;]],
19 [gl_cv_header_wchar_h_standalone=yes],
20 [gl_cv_header_wchar_h_standalone=no])])
aa7a939c
LC
21
22 AC_REQUIRE([gt_TYPE_WINT_T])
23 if test $gt_cv_c_wint_t = yes; then
24 HAVE_WINT_T=1
25 else
26 HAVE_WINT_T=0
27 fi
28 AC_SUBST([HAVE_WINT_T])
29
8912421c
LC
30 dnl If <stddef.h> is replaced, then <wchar.h> must also be replaced.
31 AC_REQUIRE([gl_STDDEF_H])
32
33 if test $gl_cv_header_wchar_h_standalone != yes || test $gt_cv_c_wint_t != yes || test -n "$STDDEF_H"; then
e65fc94b
LC
34 WCHAR_H=wchar.h
35 fi
36
37 dnl Prepare for creating substitute <wchar.h>.
38 dnl Do it always: WCHAR_H may be empty here but can be set later.
39 dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
40 dnl character support).
41 AC_CHECK_HEADERS_ONCE([wchar.h])
42 if test $ac_cv_header_wchar_h = yes; then
43 HAVE_WCHAR_H=1
44 else
45 HAVE_WCHAR_H=0
46 fi
47 AC_SUBST([HAVE_WCHAR_H])
414e4441
LC
48 dnl Execute this unconditionally, because WCHAR_H may be set by other
49 dnl modules, after this code is executed.
e65fc94b
LC
50 gl_CHECK_NEXT_HEADERS([wchar.h])
51])
52
aa7a939c
LC
53dnl Unconditionally enables the replacement of <wchar.h>.
54AC_DEFUN([gl_REPLACE_WCHAR_H],
55[
56 AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
57 WCHAR_H=wchar.h
58])
59
e65fc94b
LC
60AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
61[
62 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
63 AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
64 GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
65])
66
67AC_DEFUN([gl_WCHAR_H_DEFAULTS],
68[
4a462e35
NJ
69 GNULIB_BTOWC=0; AC_SUBST([GNULIB_BTOWC])
70 GNULIB_WCTOB=0; AC_SUBST([GNULIB_WCTOB])
71 GNULIB_MBSINIT=0; AC_SUBST([GNULIB_MBSINIT])
72 GNULIB_MBRTOWC=0; AC_SUBST([GNULIB_MBRTOWC])
73 GNULIB_MBRLEN=0; AC_SUBST([GNULIB_MBRLEN])
74 GNULIB_MBSRTOWCS=0; AC_SUBST([GNULIB_MBSRTOWCS])
75 GNULIB_MBSNRTOWCS=0; AC_SUBST([GNULIB_MBSNRTOWCS])
76 GNULIB_WCRTOMB=0; AC_SUBST([GNULIB_WCRTOMB])
77 GNULIB_WCSRTOMBS=0; AC_SUBST([GNULIB_WCSRTOMBS])
78 GNULIB_WCSNRTOMBS=0; AC_SUBST([GNULIB_WCSNRTOMBS])
79 GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH])
e65fc94b 80 dnl Assume proper GNU behavior unless another module says otherwise.
f240aacb
LC
81 HAVE_BTOWC=1; AC_SUBST([HAVE_BTOWC])
82 HAVE_MBSINIT=1; AC_SUBST([HAVE_MBSINIT])
83 HAVE_MBRTOWC=1; AC_SUBST([HAVE_MBRTOWC])
84 HAVE_MBRLEN=1; AC_SUBST([HAVE_MBRLEN])
85 HAVE_MBSRTOWCS=1; AC_SUBST([HAVE_MBSRTOWCS])
86 HAVE_MBSNRTOWCS=1; AC_SUBST([HAVE_MBSNRTOWCS])
87 HAVE_WCRTOMB=1; AC_SUBST([HAVE_WCRTOMB])
88 HAVE_WCSRTOMBS=1; AC_SUBST([HAVE_WCSRTOMBS])
89 HAVE_WCSNRTOMBS=1; AC_SUBST([HAVE_WCSNRTOMBS])
90 HAVE_DECL_WCTOB=1; AC_SUBST([HAVE_DECL_WCTOB])
91 HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH])
92 REPLACE_MBSTATE_T=0; AC_SUBST([REPLACE_MBSTATE_T])
93 REPLACE_BTOWC=0; AC_SUBST([REPLACE_BTOWC])
94 REPLACE_WCTOB=0; AC_SUBST([REPLACE_WCTOB])
95 REPLACE_MBSINIT=0; AC_SUBST([REPLACE_MBSINIT])
96 REPLACE_MBRTOWC=0; AC_SUBST([REPLACE_MBRTOWC])
97 REPLACE_MBRLEN=0; AC_SUBST([REPLACE_MBRLEN])
98 REPLACE_MBSRTOWCS=0; AC_SUBST([REPLACE_MBSRTOWCS])
99 REPLACE_MBSNRTOWCS=0; AC_SUBST([REPLACE_MBSNRTOWCS])
100 REPLACE_WCRTOMB=0; AC_SUBST([REPLACE_WCRTOMB])
101 REPLACE_WCSRTOMBS=0; AC_SUBST([REPLACE_WCSRTOMBS])
102 REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS])
103 REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH])
104 WCHAR_H=''; AC_SUBST([WCHAR_H])
e65fc94b 105])