diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-08-19 23:27:12 +0200 |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-08-19 23:27:12 +0200 |
commit | 26fbe7f1e68bb0c96da32491efcf3696fe6c299b (patch) | |
tree | c4d95289187a64e9c7517bf73d8208026c3d2fb3 /gl/m4/mbrtowc.m4 | |
parent | 5f79e3e9f62ca5487d9881973149136ba1d19d3e (diff) | |
download | monitoring-plugins-26fbe7f1e68bb0c96da32491efcf3696fe6c299b.tar.gz |
Sync with the latest Gnulib code (6f2d632)
Diffstat (limited to 'gl/m4/mbrtowc.m4')
-rw-r--r-- | gl/m4/mbrtowc.m4 | 281 |
1 files changed, 234 insertions, 47 deletions
diff --git a/gl/m4/mbrtowc.m4 b/gl/m4/mbrtowc.m4 index 606de5c9..4c9f3886 100644 --- a/gl/m4/mbrtowc.m4 +++ b/gl/m4/mbrtowc.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # mbrtowc.m4 serial 17 | 1 | # mbrtowc.m4 serial 25 |
2 | dnl Copyright (C) 2001-2002, 2004-2005, 2008-2010 Free Software Foundation, | 2 | dnl Copyright (C) 2001-2002, 2004-2005, 2008-2013 Free Software Foundation, |
3 | dnl Inc. | 3 | dnl Inc. |
4 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
5 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
@@ -15,16 +15,40 @@ AC_DEFUN([gl_FUNC_MBRTOWC], | |||
15 | AC_CHECK_FUNCS_ONCE([mbrtowc]) | 15 | AC_CHECK_FUNCS_ONCE([mbrtowc]) |
16 | if test $ac_cv_func_mbrtowc = no; then | 16 | if test $ac_cv_func_mbrtowc = no; then |
17 | HAVE_MBRTOWC=0 | 17 | HAVE_MBRTOWC=0 |
18 | AC_CHECK_DECLS([mbrtowc],,, [[ | ||
19 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | ||
20 | <wchar.h>. | ||
21 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
22 | included before <wchar.h>. */ | ||
23 | #include <stddef.h> | ||
24 | #include <stdio.h> | ||
25 | #include <time.h> | ||
26 | #include <wchar.h> | ||
27 | ]]) | ||
28 | if test $ac_cv_have_decl_mbrtowc = yes; then | ||
29 | dnl On Minix 3.1.8, the system's <wchar.h> declares mbrtowc() although | ||
30 | dnl it does not have the function. Avoid a collision with gnulib's | ||
31 | dnl replacement. | ||
32 | REPLACE_MBRTOWC=1 | ||
33 | fi | ||
18 | else | 34 | else |
19 | if test $REPLACE_MBSTATE_T = 1; then | 35 | if test $REPLACE_MBSTATE_T = 1; then |
20 | REPLACE_MBRTOWC=1 | 36 | REPLACE_MBRTOWC=1 |
21 | else | 37 | else |
22 | gl_MBRTOWC_NULL_ARG | 38 | gl_MBRTOWC_NULL_ARG1 |
39 | gl_MBRTOWC_NULL_ARG2 | ||
23 | gl_MBRTOWC_RETVAL | 40 | gl_MBRTOWC_RETVAL |
24 | gl_MBRTOWC_NUL_RETVAL | 41 | gl_MBRTOWC_NUL_RETVAL |
25 | case "$gl_cv_func_mbrtowc_null_arg" in | 42 | case "$gl_cv_func_mbrtowc_null_arg1" in |
43 | *yes) ;; | ||
44 | *) AC_DEFINE([MBRTOWC_NULL_ARG1_BUG], [1], | ||
45 | [Define if the mbrtowc function has the NULL pwc argument bug.]) | ||
46 | REPLACE_MBRTOWC=1 | ||
47 | ;; | ||
48 | esac | ||
49 | case "$gl_cv_func_mbrtowc_null_arg2" in | ||
26 | *yes) ;; | 50 | *yes) ;; |
27 | *) AC_DEFINE([MBRTOWC_NULL_ARG_BUG], [1], | 51 | *) AC_DEFINE([MBRTOWC_NULL_ARG2_BUG], [1], |
28 | [Define if the mbrtowc function has the NULL string argument bug.]) | 52 | [Define if the mbrtowc function has the NULL string argument bug.]) |
29 | REPLACE_MBRTOWC=1 | 53 | REPLACE_MBRTOWC=1 |
30 | ;; | 54 | ;; |
@@ -45,11 +69,6 @@ AC_DEFUN([gl_FUNC_MBRTOWC], | |||
45 | esac | 69 | esac |
46 | fi | 70 | fi |
47 | fi | 71 | fi |
48 | if test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1; then | ||
49 | gl_REPLACE_WCHAR_H | ||
50 | AC_LIBOBJ([mbrtowc]) | ||
51 | gl_PREREQ_MBRTOWC | ||
52 | fi | ||
53 | ]) | 72 | ]) |
54 | 73 | ||
55 | dnl Test whether mbsinit() and mbrtowc() need to be overridden in a way that | 74 | dnl Test whether mbsinit() and mbrtowc() need to be overridden in a way that |
@@ -80,9 +99,6 @@ AC_DEFUN([gl_MBSTATE_T_BROKEN], | |||
80 | else | 99 | else |
81 | REPLACE_MBSTATE_T=1 | 100 | REPLACE_MBSTATE_T=1 |
82 | fi | 101 | fi |
83 | if test $REPLACE_MBSTATE_T = 1; then | ||
84 | gl_REPLACE_WCHAR_H | ||
85 | fi | ||
86 | ]) | 102 | ]) |
87 | 103 | ||
88 | dnl Test whether mbrtowc puts the state into non-initial state when parsing an | 104 | dnl Test whether mbrtowc puts the state into non-initial state when parsing an |
@@ -101,16 +117,24 @@ AC_DEFUN([gl_MBRTOWC_INCOMPLETE_STATE], | |||
101 | dnl is present. | 117 | dnl is present. |
102 | changequote(,)dnl | 118 | changequote(,)dnl |
103 | case "$host_os" in | 119 | case "$host_os" in |
104 | # Guess no on AIX and OSF/1. | 120 | # Guess no on AIX and OSF/1. |
105 | osf*) gl_cv_func_mbrtowc_incomplete_state="guessing no" ;; | 121 | aix* | osf*) gl_cv_func_mbrtowc_incomplete_state="guessing no" ;; |
106 | # Guess yes otherwise. | 122 | # Guess yes otherwise. |
107 | *) gl_cv_func_mbrtowc_incomplete_state="guessing yes" ;; | 123 | *) gl_cv_func_mbrtowc_incomplete_state="guessing yes" ;; |
108 | esac | 124 | esac |
109 | changequote([,])dnl | 125 | changequote([,])dnl |
110 | if test $LOCALE_JA != none; then | 126 | if test $LOCALE_JA != none; then |
111 | AC_TRY_RUN([ | 127 | AC_RUN_IFELSE( |
128 | [AC_LANG_SOURCE([[ | ||
112 | #include <locale.h> | 129 | #include <locale.h> |
113 | #include <string.h> | 130 | #include <string.h> |
131 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | ||
132 | <wchar.h>. | ||
133 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
134 | included before <wchar.h>. */ | ||
135 | #include <stddef.h> | ||
136 | #include <stdio.h> | ||
137 | #include <time.h> | ||
114 | #include <wchar.h> | 138 | #include <wchar.h> |
115 | int main () | 139 | int main () |
116 | { | 140 | { |
@@ -126,7 +150,7 @@ int main () | |||
126 | return 1; | 150 | return 1; |
127 | } | 151 | } |
128 | return 0; | 152 | return 0; |
129 | }], | 153 | }]])], |
130 | [gl_cv_func_mbrtowc_incomplete_state=yes], | 154 | [gl_cv_func_mbrtowc_incomplete_state=yes], |
131 | [gl_cv_func_mbrtowc_incomplete_state=no], | 155 | [gl_cv_func_mbrtowc_incomplete_state=no], |
132 | [:]) | 156 | [:]) |
@@ -156,10 +180,18 @@ changequote(,)dnl | |||
156 | esac | 180 | esac |
157 | changequote([,])dnl | 181 | changequote([,])dnl |
158 | if test $LOCALE_ZH_CN != none; then | 182 | if test $LOCALE_ZH_CN != none; then |
159 | AC_TRY_RUN([ | 183 | AC_RUN_IFELSE( |
184 | [AC_LANG_SOURCE([[ | ||
160 | #include <locale.h> | 185 | #include <locale.h> |
161 | #include <stdlib.h> | 186 | #include <stdlib.h> |
162 | #include <string.h> | 187 | #include <string.h> |
188 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | ||
189 | <wchar.h>. | ||
190 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
191 | included before <wchar.h>. */ | ||
192 | #include <stddef.h> | ||
193 | #include <stdio.h> | ||
194 | #include <time.h> | ||
163 | #include <wchar.h> | 195 | #include <wchar.h> |
164 | int main () | 196 | int main () |
165 | { | 197 | { |
@@ -178,7 +210,7 @@ int main () | |||
178 | return 1; | 210 | return 1; |
179 | } | 211 | } |
180 | return 0; | 212 | return 0; |
181 | }], | 213 | }]])], |
182 | [gl_cv_func_mbrtowc_sanitycheck=yes], | 214 | [gl_cv_func_mbrtowc_sanitycheck=yes], |
183 | [gl_cv_func_mbrtowc_sanitycheck=no], | 215 | [gl_cv_func_mbrtowc_sanitycheck=no], |
184 | [:]) | 216 | [:]) |
@@ -186,31 +218,109 @@ int main () | |||
186 | ]) | 218 | ]) |
187 | ]) | 219 | ]) |
188 | 220 | ||
221 | dnl Test whether mbrtowc supports a NULL pwc argument correctly. | ||
222 | dnl Result is gl_cv_func_mbrtowc_null_arg1. | ||
223 | |||
224 | AC_DEFUN([gl_MBRTOWC_NULL_ARG1], | ||
225 | [ | ||
226 | AC_REQUIRE([AC_PROG_CC]) | ||
227 | AC_REQUIRE([gt_LOCALE_FR_UTF8]) | ||
228 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
229 | AC_CACHE_CHECK([whether mbrtowc handles a NULL pwc argument], | ||
230 | [gl_cv_func_mbrtowc_null_arg1], | ||
231 | [ | ||
232 | dnl Initial guess, used when cross-compiling or when no suitable locale | ||
233 | dnl is present. | ||
234 | changequote(,)dnl | ||
235 | case "$host_os" in | ||
236 | # Guess no on Solaris. | ||
237 | solaris*) gl_cv_func_mbrtowc_null_arg1="guessing no" ;; | ||
238 | # Guess yes otherwise. | ||
239 | *) gl_cv_func_mbrtowc_null_arg1="guessing yes" ;; | ||
240 | esac | ||
241 | changequote([,])dnl | ||
242 | if test $LOCALE_FR_UTF8 != none; then | ||
243 | AC_RUN_IFELSE( | ||
244 | [AC_LANG_SOURCE([[ | ||
245 | #include <locale.h> | ||
246 | #include <stdlib.h> | ||
247 | #include <string.h> | ||
248 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | ||
249 | <wchar.h>. | ||
250 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
251 | included before <wchar.h>. */ | ||
252 | #include <stddef.h> | ||
253 | #include <stdio.h> | ||
254 | #include <time.h> | ||
255 | #include <wchar.h> | ||
256 | int main () | ||
257 | { | ||
258 | int result = 0; | ||
259 | |||
260 | if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) | ||
261 | { | ||
262 | char input[] = "\303\237er"; | ||
263 | mbstate_t state; | ||
264 | wchar_t wc; | ||
265 | size_t ret; | ||
266 | |||
267 | memset (&state, '\0', sizeof (mbstate_t)); | ||
268 | wc = (wchar_t) 0xBADFACE; | ||
269 | ret = mbrtowc (&wc, input, 5, &state); | ||
270 | if (ret != 2) | ||
271 | result |= 1; | ||
272 | if (!mbsinit (&state)) | ||
273 | result |= 2; | ||
274 | |||
275 | memset (&state, '\0', sizeof (mbstate_t)); | ||
276 | ret = mbrtowc (NULL, input, 5, &state); | ||
277 | if (ret != 2) /* Solaris 7 fails here: ret is -1. */ | ||
278 | result |= 4; | ||
279 | if (!mbsinit (&state)) | ||
280 | result |= 8; | ||
281 | } | ||
282 | return result; | ||
283 | }]])], | ||
284 | [gl_cv_func_mbrtowc_null_arg1=yes], | ||
285 | [gl_cv_func_mbrtowc_null_arg1=no], | ||
286 | [:]) | ||
287 | fi | ||
288 | ]) | ||
289 | ]) | ||
290 | |||
189 | dnl Test whether mbrtowc supports a NULL string argument correctly. | 291 | dnl Test whether mbrtowc supports a NULL string argument correctly. |
190 | dnl Result is gl_cv_func_mbrtowc_null_arg. | 292 | dnl Result is gl_cv_func_mbrtowc_null_arg2. |
191 | 293 | ||
192 | AC_DEFUN([gl_MBRTOWC_NULL_ARG], | 294 | AC_DEFUN([gl_MBRTOWC_NULL_ARG2], |
193 | [ | 295 | [ |
194 | AC_REQUIRE([AC_PROG_CC]) | 296 | AC_REQUIRE([AC_PROG_CC]) |
195 | AC_REQUIRE([gt_LOCALE_FR_UTF8]) | 297 | AC_REQUIRE([gt_LOCALE_FR_UTF8]) |
196 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | 298 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
197 | AC_CACHE_CHECK([whether mbrtowc handles a NULL string argument], | 299 | AC_CACHE_CHECK([whether mbrtowc handles a NULL string argument], |
198 | [gl_cv_func_mbrtowc_null_arg], | 300 | [gl_cv_func_mbrtowc_null_arg2], |
199 | [ | 301 | [ |
200 | dnl Initial guess, used when cross-compiling or when no suitable locale | 302 | dnl Initial guess, used when cross-compiling or when no suitable locale |
201 | dnl is present. | 303 | dnl is present. |
202 | changequote(,)dnl | 304 | changequote(,)dnl |
203 | case "$host_os" in | 305 | case "$host_os" in |
204 | # Guess no on OSF/1. | 306 | # Guess no on OSF/1. |
205 | osf*) gl_cv_func_mbrtowc_null_arg="guessing no" ;; | 307 | osf*) gl_cv_func_mbrtowc_null_arg2="guessing no" ;; |
206 | # Guess yes otherwise. | 308 | # Guess yes otherwise. |
207 | *) gl_cv_func_mbrtowc_null_arg="guessing yes" ;; | 309 | *) gl_cv_func_mbrtowc_null_arg2="guessing yes" ;; |
208 | esac | 310 | esac |
209 | changequote([,])dnl | 311 | changequote([,])dnl |
210 | if test $LOCALE_FR_UTF8 != none; then | 312 | if test $LOCALE_FR_UTF8 != none; then |
211 | AC_TRY_RUN([ | 313 | AC_RUN_IFELSE( |
314 | [AC_LANG_SOURCE([[ | ||
212 | #include <locale.h> | 315 | #include <locale.h> |
213 | #include <string.h> | 316 | #include <string.h> |
317 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | ||
318 | <wchar.h>. | ||
319 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
320 | included before <wchar.h>. */ | ||
321 | #include <stddef.h> | ||
322 | #include <stdio.h> | ||
323 | #include <time.h> | ||
214 | #include <wchar.h> | 324 | #include <wchar.h> |
215 | int main () | 325 | int main () |
216 | { | 326 | { |
@@ -228,7 +338,10 @@ int main () | |||
228 | return 1; | 338 | return 1; |
229 | } | 339 | } |
230 | return 0; | 340 | return 0; |
231 | }], [gl_cv_func_mbrtowc_null_arg=yes], [gl_cv_func_mbrtowc_null_arg=no], [:]) | 341 | }]])], |
342 | [gl_cv_func_mbrtowc_null_arg2=yes], | ||
343 | [gl_cv_func_mbrtowc_null_arg2=no], | ||
344 | [:]) | ||
232 | fi | 345 | fi |
233 | ]) | 346 | ]) |
234 | ]) | 347 | ]) |
@@ -243,7 +356,7 @@ AC_DEFUN([gl_MBRTOWC_RETVAL], | |||
243 | AC_REQUIRE([AC_PROG_CC]) | 356 | AC_REQUIRE([AC_PROG_CC]) |
244 | AC_REQUIRE([gt_LOCALE_FR_UTF8]) | 357 | AC_REQUIRE([gt_LOCALE_FR_UTF8]) |
245 | AC_REQUIRE([gt_LOCALE_JA]) | 358 | AC_REQUIRE([gt_LOCALE_JA]) |
246 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | 359 | AC_REQUIRE([AC_CANONICAL_HOST]) |
247 | AC_CACHE_CHECK([whether mbrtowc has a correct return value], | 360 | AC_CACHE_CHECK([whether mbrtowc has a correct return value], |
248 | [gl_cv_func_mbrtowc_retval], | 361 | [gl_cv_func_mbrtowc_retval], |
249 | [ | 362 | [ |
@@ -251,19 +364,30 @@ AC_DEFUN([gl_MBRTOWC_RETVAL], | |||
251 | dnl is present. | 364 | dnl is present. |
252 | changequote(,)dnl | 365 | changequote(,)dnl |
253 | case "$host_os" in | 366 | case "$host_os" in |
254 | # Guess no on HP-UX and Solaris. | 367 | # Guess no on HP-UX, Solaris, native Windows. |
255 | hpux* | solaris*) gl_cv_func_mbrtowc_retval="guessing no" ;; | 368 | hpux* | solaris* | mingw*) gl_cv_func_mbrtowc_retval="guessing no" ;; |
256 | # Guess yes otherwise. | 369 | # Guess yes otherwise. |
257 | *) gl_cv_func_mbrtowc_retval="guessing yes" ;; | 370 | *) gl_cv_func_mbrtowc_retval="guessing yes" ;; |
258 | esac | 371 | esac |
259 | changequote([,])dnl | 372 | changequote([,])dnl |
260 | if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none; then | 373 | if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none \ |
261 | AC_TRY_RUN([ | 374 | || { case "$host_os" in mingw*) true;; *) false;; esac; }; then |
375 | AC_RUN_IFELSE( | ||
376 | [AC_LANG_SOURCE([[ | ||
262 | #include <locale.h> | 377 | #include <locale.h> |
263 | #include <string.h> | 378 | #include <string.h> |
379 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | ||
380 | <wchar.h>. | ||
381 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
382 | included before <wchar.h>. */ | ||
383 | #include <stddef.h> | ||
384 | #include <stdio.h> | ||
385 | #include <time.h> | ||
264 | #include <wchar.h> | 386 | #include <wchar.h> |
265 | int main () | 387 | int main () |
266 | { | 388 | { |
389 | int result = 0; | ||
390 | int found_some_locale = 0; | ||
267 | /* This fails on Solaris. */ | 391 | /* This fails on Solaris. */ |
268 | if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) | 392 | if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) |
269 | { | 393 | { |
@@ -276,8 +400,9 @@ int main () | |||
276 | { | 400 | { |
277 | input[1] = '\0'; | 401 | input[1] = '\0'; |
278 | if (mbrtowc (&wc, input + 2, 5, &state) != 1) | 402 | if (mbrtowc (&wc, input + 2, 5, &state) != 1) |
279 | return 1; | 403 | result |= 1; |
280 | } | 404 | } |
405 | found_some_locale = 1; | ||
281 | } | 406 | } |
282 | /* This fails on HP-UX 11.11. */ | 407 | /* This fails on HP-UX 11.11. */ |
283 | if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) | 408 | if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) |
@@ -291,13 +416,63 @@ int main () | |||
291 | { | 416 | { |
292 | input[1] = '\0'; | 417 | input[1] = '\0'; |
293 | if (mbrtowc (&wc, input + 2, 5, &state) != 2) | 418 | if (mbrtowc (&wc, input + 2, 5, &state) != 2) |
294 | return 1; | 419 | result |= 2; |
295 | } | 420 | } |
421 | found_some_locale = 1; | ||
296 | } | 422 | } |
297 | return 0; | 423 | /* This fails on native Windows. */ |
298 | }], | 424 | if (setlocale (LC_ALL, "Japanese_Japan.932") != NULL) |
425 | { | ||
426 | char input[] = "<\223\372\226\173\214\352>"; /* "<日本語>" */ | ||
427 | mbstate_t state; | ||
428 | wchar_t wc; | ||
429 | |||
430 | memset (&state, '\0', sizeof (mbstate_t)); | ||
431 | if (mbrtowc (&wc, input + 3, 1, &state) == (size_t)(-2)) | ||
432 | { | ||
433 | input[3] = '\0'; | ||
434 | if (mbrtowc (&wc, input + 4, 4, &state) != 1) | ||
435 | result |= 4; | ||
436 | } | ||
437 | found_some_locale = 1; | ||
438 | } | ||
439 | if (setlocale (LC_ALL, "Chinese_Taiwan.950") != NULL) | ||
440 | { | ||
441 | char input[] = "<\244\351\245\273\273\171>"; /* "<日本語>" */ | ||
442 | mbstate_t state; | ||
443 | wchar_t wc; | ||
444 | |||
445 | memset (&state, '\0', sizeof (mbstate_t)); | ||
446 | if (mbrtowc (&wc, input + 3, 1, &state) == (size_t)(-2)) | ||
447 | { | ||
448 | input[3] = '\0'; | ||
449 | if (mbrtowc (&wc, input + 4, 4, &state) != 1) | ||
450 | result |= 8; | ||
451 | } | ||
452 | found_some_locale = 1; | ||
453 | } | ||
454 | if (setlocale (LC_ALL, "Chinese_China.936") != NULL) | ||
455 | { | ||
456 | char input[] = "<\310\325\261\276\325\132>"; /* "<日本語>" */ | ||
457 | mbstate_t state; | ||
458 | wchar_t wc; | ||
459 | |||
460 | memset (&state, '\0', sizeof (mbstate_t)); | ||
461 | if (mbrtowc (&wc, input + 3, 1, &state) == (size_t)(-2)) | ||
462 | { | ||
463 | input[3] = '\0'; | ||
464 | if (mbrtowc (&wc, input + 4, 4, &state) != 1) | ||
465 | result |= 16; | ||
466 | } | ||
467 | found_some_locale = 1; | ||
468 | } | ||
469 | return (found_some_locale ? result : 77); | ||
470 | }]])], | ||
299 | [gl_cv_func_mbrtowc_retval=yes], | 471 | [gl_cv_func_mbrtowc_retval=yes], |
300 | [gl_cv_func_mbrtowc_retval=no], | 472 | [if test $? != 77; then |
473 | gl_cv_func_mbrtowc_retval=no | ||
474 | fi | ||
475 | ], | ||
301 | [:]) | 476 | [:]) |
302 | fi | 477 | fi |
303 | ]) | 478 | ]) |
@@ -325,9 +500,17 @@ changequote(,)dnl | |||
325 | esac | 500 | esac |
326 | changequote([,])dnl | 501 | changequote([,])dnl |
327 | if test $LOCALE_ZH_CN != none; then | 502 | if test $LOCALE_ZH_CN != none; then |
328 | AC_TRY_RUN([ | 503 | AC_RUN_IFELSE( |
504 | [AC_LANG_SOURCE([[ | ||
329 | #include <locale.h> | 505 | #include <locale.h> |
330 | #include <string.h> | 506 | #include <string.h> |
507 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | ||
508 | <wchar.h>. | ||
509 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
510 | included before <wchar.h>. */ | ||
511 | #include <stddef.h> | ||
512 | #include <stdio.h> | ||
513 | #include <time.h> | ||
331 | #include <wchar.h> | 514 | #include <wchar.h> |
332 | int main () | 515 | int main () |
333 | { | 516 | { |
@@ -342,7 +525,7 @@ int main () | |||
342 | return 1; | 525 | return 1; |
343 | } | 526 | } |
344 | return 0; | 527 | return 0; |
345 | }], | 528 | }]])], |
346 | [gl_cv_func_mbrtowc_nul_retval=yes], | 529 | [gl_cv_func_mbrtowc_nul_retval=yes], |
347 | [gl_cv_func_mbrtowc_nul_retval=no], | 530 | [gl_cv_func_mbrtowc_nul_retval=no], |
348 | [:]) | 531 | [:]) |
@@ -358,10 +541,8 @@ AC_DEFUN([gl_PREREQ_MBRTOWC], [ | |||
358 | 541 | ||
359 | dnl From Paul Eggert | 542 | dnl From Paul Eggert |
360 | 543 | ||
361 | dnl This override of an autoconf macro can be removed when autoconf 2.60 or | 544 | dnl This is an override of an autoconf macro. |
362 | dnl newer can be assumed everywhere. | ||
363 | 545 | ||
364 | m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.60]),[-1],[ | ||
365 | AC_DEFUN([AC_FUNC_MBRTOWC], | 546 | AC_DEFUN([AC_FUNC_MBRTOWC], |
366 | [ | 547 | [ |
367 | dnl Same as AC_FUNC_MBRTOWC in autoconf-2.60. | 548 | dnl Same as AC_FUNC_MBRTOWC in autoconf-2.60. |
@@ -369,7 +550,14 @@ AC_DEFUN([AC_FUNC_MBRTOWC], | |||
369 | gl_cv_func_mbrtowc, | 550 | gl_cv_func_mbrtowc, |
370 | [AC_LINK_IFELSE( | 551 | [AC_LINK_IFELSE( |
371 | [AC_LANG_PROGRAM( | 552 | [AC_LANG_PROGRAM( |
372 | [[#include <wchar.h>]], | 553 | [[/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be |
554 | included before <wchar.h>. | ||
555 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> | ||
556 | must be included before <wchar.h>. */ | ||
557 | #include <stddef.h> | ||
558 | #include <stdio.h> | ||
559 | #include <time.h> | ||
560 | #include <wchar.h>]], | ||
373 | [[wchar_t wc; | 561 | [[wchar_t wc; |
374 | char const s[] = ""; | 562 | char const s[] = ""; |
375 | size_t n = 1; | 563 | size_t n = 1; |
@@ -382,4 +570,3 @@ AC_DEFUN([AC_FUNC_MBRTOWC], | |||
382 | [Define to 1 if mbrtowc and mbstate_t are properly declared.]) | 570 | [Define to 1 if mbrtowc and mbstate_t are properly declared.]) |
383 | fi | 571 | fi |
384 | ]) | 572 | ]) |
385 | ]) | ||