]> sjero.net Git - wget/blob - m4/wchar.m4
mass change: update copyright years.
[wget] / m4 / wchar.m4
1 dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
2
3 dnl Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
4 dnl Inc.
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.
8
9 dnl Written by Eric Blake.
10
11 # wchar.m4 serial 25
12
13 AC_DEFUN([gl_WCHAR_H],
14 [
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>
19 wchar_t w;]],
20       [gl_cv_header_wchar_h_standalone=yes],
21       [gl_cv_header_wchar_h_standalone=no])])
22
23   AC_REQUIRE([gt_TYPE_WINT_T])
24   if test $gt_cv_c_wint_t = yes; then
25     HAVE_WINT_T=1
26   else
27     HAVE_WINT_T=0
28   fi
29   AC_SUBST([HAVE_WINT_T])
30
31   dnl If <stddef.h> is replaced, then <wchar.h> must also be replaced.
32   AC_REQUIRE([gl_STDDEF_H])
33
34   if test $gl_cv_header_wchar_h_standalone != yes || test $gt_cv_c_wint_t != yes || test -n "$STDDEF_H"; then
35     WCHAR_H=wchar.h
36   fi
37
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
44     HAVE_WCHAR_H=1
45   else
46     HAVE_WCHAR_H=0
47   fi
48   AC_SUBST([HAVE_WCHAR_H])
49   gl_CHECK_NEXT_HEADERS([wchar.h])
50 ])
51
52 dnl Unconditionally enables the replacement of <wchar.h>.
53 AC_DEFUN([gl_REPLACE_WCHAR_H],
54 [
55   AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
56   WCHAR_H=wchar.h
57 ])
58
59 AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
60 [
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
64 ])
65
66 AC_DEFUN([gl_WCHAR_H_DEFAULTS],
67 [
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])
104 ])