1 dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
3 dnl Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
5 dnl This file is free software; the Free Software Foundation
6 dnl gives unlimited permission to copy and/or distribute it,
7 dnl with or without modifications, as long as this notice is preserved.
9 dnl Written by Eric Blake.
13 AC_DEFUN([gl_WCHAR_H],
15 AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
16 AC_CACHE_CHECK([whether <wchar.h> is standalone],
17 [gl_cv_header_wchar_h_standalone],
18 [AC_COMPILE_IFELSE([[#include <wchar.h>
20 [gl_cv_header_wchar_h_standalone=yes],
21 [gl_cv_header_wchar_h_standalone=no])])
23 AC_REQUIRE([gt_TYPE_WINT_T])
24 if test $gt_cv_c_wint_t = yes; then
29 AC_SUBST([HAVE_WINT_T])
31 dnl If <stddef.h> is replaced, then <wchar.h> must also be replaced.
32 AC_REQUIRE([gl_STDDEF_H])
34 if test $gl_cv_header_wchar_h_standalone != yes || test $gt_cv_c_wint_t != yes || test -n "$STDDEF_H"; then
38 dnl Prepare for creating substitute <wchar.h>.
39 dnl Do it always: WCHAR_H may be empty here but can be set later.
40 dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
41 dnl character support).
42 AC_CHECK_HEADERS_ONCE([wchar.h])
43 if test $ac_cv_header_wchar_h = yes; then
48 AC_SUBST([HAVE_WCHAR_H])
49 gl_CHECK_NEXT_HEADERS([wchar.h])
52 dnl Unconditionally enables the replacement of <wchar.h>.
53 AC_DEFUN([gl_REPLACE_WCHAR_H],
55 AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
59 AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
61 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
62 AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
63 GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
66 AC_DEFUN([gl_WCHAR_H_DEFAULTS],
68 GNULIB_BTOWC=0; AC_SUBST([GNULIB_BTOWC])
69 GNULIB_WCTOB=0; AC_SUBST([GNULIB_WCTOB])
70 GNULIB_MBSINIT=0; AC_SUBST([GNULIB_MBSINIT])
71 GNULIB_MBRTOWC=0; AC_SUBST([GNULIB_MBRTOWC])
72 GNULIB_MBRLEN=0; AC_SUBST([GNULIB_MBRLEN])
73 GNULIB_MBSRTOWCS=0; AC_SUBST([GNULIB_MBSRTOWCS])
74 GNULIB_MBSNRTOWCS=0; AC_SUBST([GNULIB_MBSNRTOWCS])
75 GNULIB_WCRTOMB=0; AC_SUBST([GNULIB_WCRTOMB])
76 GNULIB_WCSRTOMBS=0; AC_SUBST([GNULIB_WCSRTOMBS])
77 GNULIB_WCSNRTOMBS=0; AC_SUBST([GNULIB_WCSNRTOMBS])
78 GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH])
79 dnl Assume proper GNU behavior unless another module says otherwise.
80 HAVE_BTOWC=1; AC_SUBST([HAVE_BTOWC])
81 HAVE_MBSINIT=1; AC_SUBST([HAVE_MBSINIT])
82 HAVE_MBRTOWC=1; AC_SUBST([HAVE_MBRTOWC])
83 HAVE_MBRLEN=1; AC_SUBST([HAVE_MBRLEN])
84 HAVE_MBSRTOWCS=1; AC_SUBST([HAVE_MBSRTOWCS])
85 HAVE_MBSNRTOWCS=1; AC_SUBST([HAVE_MBSNRTOWCS])
86 HAVE_WCRTOMB=1; AC_SUBST([HAVE_WCRTOMB])
87 HAVE_WCSRTOMBS=1; AC_SUBST([HAVE_WCSRTOMBS])
88 HAVE_WCSNRTOMBS=1; AC_SUBST([HAVE_WCSNRTOMBS])
89 HAVE_DECL_WCTOB=1; AC_SUBST([HAVE_DECL_WCTOB])
90 HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH])
91 REPLACE_MBSTATE_T=0; AC_SUBST([REPLACE_MBSTATE_T])
92 REPLACE_BTOWC=0; AC_SUBST([REPLACE_BTOWC])
93 REPLACE_WCTOB=0; AC_SUBST([REPLACE_WCTOB])
94 REPLACE_MBSINIT=0; AC_SUBST([REPLACE_MBSINIT])
95 REPLACE_MBRTOWC=0; AC_SUBST([REPLACE_MBRTOWC])
96 REPLACE_MBRLEN=0; AC_SUBST([REPLACE_MBRLEN])
97 REPLACE_MBSRTOWCS=0; AC_SUBST([REPLACE_MBSRTOWCS])
98 REPLACE_MBSNRTOWCS=0; AC_SUBST([REPLACE_MBSNRTOWCS])
99 REPLACE_WCRTOMB=0; AC_SUBST([REPLACE_WCRTOMB])
100 REPLACE_WCSRTOMBS=0; AC_SUBST([REPLACE_WCSRTOMBS])
101 REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS])
102 REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH])
103 WCHAR_H=''; AC_SUBST([WCHAR_H])