diff options
Diffstat (limited to 'gl/m4/wctype_h.m4')
-rw-r--r-- | gl/m4/wctype_h.m4 | 99 |
1 files changed, 45 insertions, 54 deletions
diff --git a/gl/m4/wctype_h.m4 b/gl/m4/wctype_h.m4 index 82ada0e..6856a73 100644 --- a/gl/m4/wctype_h.m4 +++ b/gl/m4/wctype_h.m4 | |||
@@ -1,15 +1,15 @@ | |||
1 | # wctype_h.m4 serial 18 | 1 | # wctype_h.m4 serial 30 |
2 | 2 | ||
3 | dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it. | 3 | dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it. |
4 | 4 | ||
5 | dnl Copyright (C) 2006-2013 Free Software Foundation, Inc. | 5 | dnl Copyright (C) 2006-2023 Free Software Foundation, Inc. |
6 | dnl This file is free software; the Free Software Foundation | 6 | dnl This file is free software; the Free Software Foundation |
7 | dnl gives unlimited permission to copy and/or distribute it, | 7 | dnl gives unlimited permission to copy and/or distribute it, |
8 | dnl with or without modifications, as long as this notice is preserved. | 8 | dnl with or without modifications, as long as this notice is preserved. |
9 | 9 | ||
10 | dnl Written by Paul Eggert. | 10 | dnl Written by Paul Eggert. |
11 | 11 | ||
12 | AC_DEFUN([gl_WCTYPE_H], | 12 | AC_DEFUN_ONCE([gl_WCTYPE_H], |
13 | [ | 13 | [ |
14 | AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) | 14 | AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) |
15 | AC_REQUIRE([AC_PROG_CC]) | 15 | AC_REQUIRE([AC_PROG_CC]) |
@@ -30,6 +30,8 @@ AC_DEFUN([gl_WCTYPE_H], | |||
30 | fi | 30 | fi |
31 | AC_SUBST([HAVE_WINT_T]) | 31 | AC_SUBST([HAVE_WINT_T]) |
32 | 32 | ||
33 | AC_REQUIRE([gl_TYPE_WINT_T_PREREQ]) | ||
34 | |||
33 | gl_CHECK_NEXT_HEADERS([wctype.h]) | 35 | gl_CHECK_NEXT_HEADERS([wctype.h]) |
34 | if test $ac_cv_header_wctype_h = yes; then | 36 | if test $ac_cv_header_wctype_h = yes; then |
35 | if test $ac_cv_func_iswcntrl = yes; then | 37 | if test $ac_cv_func_iswcntrl = yes; then |
@@ -39,22 +41,16 @@ AC_DEFUN([gl_WCTYPE_H], | |||
39 | [ | 41 | [ |
40 | AC_RUN_IFELSE( | 42 | AC_RUN_IFELSE( |
41 | [AC_LANG_SOURCE([[ | 43 | [AC_LANG_SOURCE([[ |
42 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be | ||
43 | included before <wchar.h>. | ||
44 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> | ||
45 | must be included before <wchar.h>. */ | ||
46 | #include <stddef.h> | ||
47 | #include <stdio.h> | ||
48 | #include <time.h> | ||
49 | #include <wchar.h> | 44 | #include <wchar.h> |
50 | #include <wctype.h> | 45 | #include <wctype.h> |
51 | int main () { return iswprint ('x') == 0; } | 46 | int main () { return iswprint ('x') == 0; } |
52 | ]])], | 47 | ]])], |
53 | [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no], | 48 | [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no], |
54 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h> | 49 | [dnl Guess no on Linux libc5, yes otherwise. |
50 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h> | ||
55 | #if __GNU_LIBRARY__ == 1 | 51 | #if __GNU_LIBRARY__ == 1 |
56 | Linux libc5 i18n is broken. | 52 | Linux libc5 i18n is broken. |
57 | #endif]], [])], | 53 | #endif]], [[]])], |
58 | [gl_cv_func_iswcntrl_works="guessing yes"], | 54 | [gl_cv_func_iswcntrl_works="guessing yes"], |
59 | [gl_cv_func_iswcntrl_works="guessing no"]) | 55 | [gl_cv_func_iswcntrl_works="guessing no"]) |
60 | ]) | 56 | ]) |
@@ -66,10 +62,14 @@ AC_DEFUN([gl_WCTYPE_H], | |||
66 | fi | 62 | fi |
67 | AC_SUBST([HAVE_WCTYPE_H]) | 63 | AC_SUBST([HAVE_WCTYPE_H]) |
68 | 64 | ||
69 | case "$gl_cv_func_iswcntrl_works" in | 65 | if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then |
70 | *yes) REPLACE_ISWCNTRL=0 ;; | 66 | REPLACE_ISWCNTRL=1 |
71 | *) REPLACE_ISWCNTRL=1 ;; | 67 | else |
72 | esac | 68 | case "$gl_cv_func_iswcntrl_works" in |
69 | *yes) REPLACE_ISWCNTRL=0 ;; | ||
70 | *) REPLACE_ISWCNTRL=1 ;; | ||
71 | esac | ||
72 | fi | ||
73 | AC_SUBST([REPLACE_ISWCNTRL]) | 73 | AC_SUBST([REPLACE_ISWCNTRL]) |
74 | 74 | ||
75 | if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then | 75 | if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then |
@@ -85,14 +85,7 @@ AC_DEFUN([gl_WCTYPE_H], | |||
85 | REPLACE_TOWLOWER=0 | 85 | REPLACE_TOWLOWER=0 |
86 | else | 86 | else |
87 | AC_CHECK_DECLS([towlower],,, | 87 | AC_CHECK_DECLS([towlower],,, |
88 | [[/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be | 88 | [[#include <wchar.h> |
89 | included before <wchar.h>. | ||
90 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> | ||
91 | must be included before <wchar.h>. */ | ||
92 | #include <stddef.h> | ||
93 | #include <stdio.h> | ||
94 | #include <time.h> | ||
95 | #include <wchar.h> | ||
96 | #if HAVE_WCTYPE_H | 89 | #if HAVE_WCTYPE_H |
97 | # include <wctype.h> | 90 | # include <wctype.h> |
98 | #endif | 91 | #endif |
@@ -121,14 +114,7 @@ AC_DEFUN([gl_WCTYPE_H], | |||
121 | AC_CACHE_CHECK([for wctype_t], [gl_cv_type_wctype_t], | 114 | AC_CACHE_CHECK([for wctype_t], [gl_cv_type_wctype_t], |
122 | [AC_COMPILE_IFELSE( | 115 | [AC_COMPILE_IFELSE( |
123 | [AC_LANG_PROGRAM( | 116 | [AC_LANG_PROGRAM( |
124 | [[/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be | 117 | [[#include <wchar.h> |
125 | included before <wchar.h>. | ||
126 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> | ||
127 | must be included before <wchar.h>. */ | ||
128 | #include <stddef.h> | ||
129 | #include <stdio.h> | ||
130 | #include <time.h> | ||
131 | #include <wchar.h> | ||
132 | #if HAVE_WCTYPE_H | 118 | #if HAVE_WCTYPE_H |
133 | # include <wctype.h> | 119 | # include <wctype.h> |
134 | #endif | 120 | #endif |
@@ -147,14 +133,7 @@ AC_DEFUN([gl_WCTYPE_H], | |||
147 | AC_CACHE_CHECK([for wctrans_t], [gl_cv_type_wctrans_t], | 133 | AC_CACHE_CHECK([for wctrans_t], [gl_cv_type_wctrans_t], |
148 | [AC_COMPILE_IFELSE( | 134 | [AC_COMPILE_IFELSE( |
149 | [AC_LANG_PROGRAM( | 135 | [AC_LANG_PROGRAM( |
150 | [[/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be | 136 | [[#include <wchar.h> |
151 | included before <wchar.h>. | ||
152 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> | ||
153 | must be included before <wchar.h>. */ | ||
154 | #include <stddef.h> | ||
155 | #include <stdio.h> | ||
156 | #include <time.h> | ||
157 | #include <wchar.h> | ||
158 | #include <wctype.h> | 137 | #include <wctype.h> |
159 | wctrans_t a; | 138 | wctrans_t a; |
160 | ]], | 139 | ]], |
@@ -169,14 +148,7 @@ AC_DEFUN([gl_WCTYPE_H], | |||
169 | dnl Check for declarations of anything we want to poison if the | 148 | dnl Check for declarations of anything we want to poison if the |
170 | dnl corresponding gnulib module is not in use. | 149 | dnl corresponding gnulib module is not in use. |
171 | gl_WARN_ON_USE_PREPARE([[ | 150 | gl_WARN_ON_USE_PREPARE([[ |
172 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | ||
173 | <wchar.h>. | ||
174 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
175 | included before <wchar.h>. */ | ||
176 | #if !(defined __GLIBC__ && !defined __UCLIBC__) | 151 | #if !(defined __GLIBC__ && !defined __UCLIBC__) |
177 | # include <stddef.h> | ||
178 | # include <stdio.h> | ||
179 | # include <time.h> | ||
180 | # include <wchar.h> | 152 | # include <wchar.h> |
181 | #endif | 153 | #endif |
182 | #include <wctype.h> | 154 | #include <wctype.h> |
@@ -185,25 +157,44 @@ AC_DEFUN([gl_WCTYPE_H], | |||
185 | ]) | 157 | ]) |
186 | ]) | 158 | ]) |
187 | 159 | ||
160 | # gl_WCTYPE_MODULE_INDICATOR([modulename]) | ||
161 | # sets the shell variable that indicates the presence of the given module | ||
162 | # to a C preprocessor expression that will evaluate to 1. | ||
163 | # This macro invocation must not occur in macros that are AC_REQUIREd. | ||
188 | AC_DEFUN([gl_WCTYPE_MODULE_INDICATOR], | 164 | AC_DEFUN([gl_WCTYPE_MODULE_INDICATOR], |
189 | [ | 165 | [ |
190 | dnl Use AC_REQUIRE here, so that the default settings are expanded once only. | 166 | dnl Ensure to expand the default settings once only. |
191 | AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) | 167 | gl_WCTYPE_H_REQUIRE_DEFAULTS |
192 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) | 168 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) |
193 | dnl Define it also as a C macro, for the benefit of the unit tests. | 169 | dnl Define it also as a C macro, for the benefit of the unit tests. |
194 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) | 170 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) |
195 | ]) | 171 | ]) |
196 | 172 | ||
173 | # Initializes the default values for AC_SUBSTed shell variables. | ||
174 | # This macro must not be AC_REQUIREd. It must only be invoked, and only | ||
175 | # outside of macros or in macros that are not AC_REQUIREd. | ||
176 | AC_DEFUN([gl_WCTYPE_H_REQUIRE_DEFAULTS], | ||
177 | [ | ||
178 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_WCTYPE_H_MODULE_INDICATOR_DEFAULTS], [ | ||
179 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWBLANK]) | ||
180 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWDIGIT]) | ||
181 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWXDIGIT]) | ||
182 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTYPE]) | ||
183 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWCTYPE]) | ||
184 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTRANS]) | ||
185 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TOWCTRANS]) | ||
186 | ]) | ||
187 | m4_require(GL_MODULE_INDICATOR_PREFIX[_WCTYPE_H_MODULE_INDICATOR_DEFAULTS]) | ||
188 | AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) | ||
189 | ]) | ||
190 | |||
197 | AC_DEFUN([gl_WCTYPE_H_DEFAULTS], | 191 | AC_DEFUN([gl_WCTYPE_H_DEFAULTS], |
198 | [ | 192 | [ |
199 | GNULIB_ISWBLANK=0; AC_SUBST([GNULIB_ISWBLANK]) | ||
200 | GNULIB_WCTYPE=0; AC_SUBST([GNULIB_WCTYPE]) | ||
201 | GNULIB_ISWCTYPE=0; AC_SUBST([GNULIB_ISWCTYPE]) | ||
202 | GNULIB_WCTRANS=0; AC_SUBST([GNULIB_WCTRANS]) | ||
203 | GNULIB_TOWCTRANS=0; AC_SUBST([GNULIB_TOWCTRANS]) | ||
204 | dnl Assume proper GNU behavior unless another module says otherwise. | 193 | dnl Assume proper GNU behavior unless another module says otherwise. |
205 | HAVE_ISWBLANK=1; AC_SUBST([HAVE_ISWBLANK]) | 194 | HAVE_ISWBLANK=1; AC_SUBST([HAVE_ISWBLANK]) |
206 | HAVE_WCTYPE_T=1; AC_SUBST([HAVE_WCTYPE_T]) | 195 | HAVE_WCTYPE_T=1; AC_SUBST([HAVE_WCTYPE_T]) |
207 | HAVE_WCTRANS_T=1; AC_SUBST([HAVE_WCTRANS_T]) | 196 | HAVE_WCTRANS_T=1; AC_SUBST([HAVE_WCTRANS_T]) |
208 | REPLACE_ISWBLANK=0; AC_SUBST([REPLACE_ISWBLANK]) | 197 | REPLACE_ISWBLANK=0; AC_SUBST([REPLACE_ISWBLANK]) |
198 | REPLACE_ISWDIGIT=0; AC_SUBST([REPLACE_ISWDIGIT]) | ||
199 | REPLACE_ISWXDIGIT=0; AC_SUBST([REPLACE_ISWXDIGIT]) | ||
209 | ]) | 200 | ]) |