diff options
author | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2009-01-15 04:22:57 -0500 |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2009-01-15 05:19:08 -0500 |
commit | 71cdb52799220f8d9052643baf1d3e9836a9c755 (patch) | |
tree | 27aee97a35d9ab51f0d8f64a46690bd41a5f8c1b /gl/m4/wcrtomb.m4 | |
parent | f7afa46586645e50498d8b2d0c67884f014dc3a4 (diff) | |
download | monitoring-plugins-71cdb52799220f8d9052643baf1d3e9836a9c755.tar.gz |
Sync with gnulib
Diffstat (limited to 'gl/m4/wcrtomb.m4')
-rw-r--r-- | gl/m4/wcrtomb.m4 | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/gl/m4/wcrtomb.m4 b/gl/m4/wcrtomb.m4 new file mode 100644 index 00000000..22d94336 --- /dev/null +++ b/gl/m4/wcrtomb.m4 | |||
@@ -0,0 +1,88 @@ | |||
1 | # wcrtomb.m4 serial 2 | ||
2 | dnl Copyright (C) 2008 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | ||
4 | dnl gives unlimited permission to copy and/or distribute it, | ||
5 | dnl with or without modifications, as long as this notice is preserved. | ||
6 | |||
7 | AC_DEFUN([gl_FUNC_WCRTOMB], | ||
8 | [ | ||
9 | AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) | ||
10 | |||
11 | AC_REQUIRE([AC_TYPE_MBSTATE_T]) | ||
12 | AC_CHECK_FUNCS_ONCE([wcrtomb]) | ||
13 | if test $ac_cv_func_wcrtomb = no; then | ||
14 | HAVE_WCRTOMB=0 | ||
15 | else | ||
16 | |||
17 | dnl On OSF/1 5.1 and Solaris 10, wcrtomb (NULL, 0, NULL) sometimes | ||
18 | dnl returns 0 instead of 1. | ||
19 | AC_REQUIRE([AC_PROG_CC]) | ||
20 | AC_REQUIRE([gt_LOCALE_FR]) | ||
21 | AC_REQUIRE([gt_LOCALE_FR_UTF8]) | ||
22 | AC_REQUIRE([gt_LOCALE_JA]) | ||
23 | AC_REQUIRE([gt_LOCALE_ZH_CN]) | ||
24 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
25 | AC_CACHE_CHECK([whether wcrtomb return value is correct], | ||
26 | [gl_cv_func_wcrtomb_retval], | ||
27 | [ | ||
28 | dnl Initial guess, used when cross-compiling or when no suitable locale | ||
29 | dnl is present. | ||
30 | changequote(,)dnl | ||
31 | case "$host_os" in | ||
32 | # Guess no on OSF/1 and Solaris. | ||
33 | osf* | solaris*) gl_cv_func_wcrtomb_retval="guessing no" ;; | ||
34 | # Guess yes otherwise. | ||
35 | *) gl_cv_func_wcrtomb_retval="guessing yes" ;; | ||
36 | esac | ||
37 | changequote([,])dnl | ||
38 | if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then | ||
39 | AC_TRY_RUN([ | ||
40 | #include <locale.h> | ||
41 | #include <stdio.h> | ||
42 | #include <string.h> | ||
43 | #include <wchar.h> | ||
44 | int main () | ||
45 | { | ||
46 | if (setlocale (LC_ALL, "$LOCALE_FR") != NULL) | ||
47 | { | ||
48 | if (wcrtomb (NULL, 0, NULL) != 1) | ||
49 | return 1; | ||
50 | } | ||
51 | if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) | ||
52 | { | ||
53 | if (wcrtomb (NULL, 0, NULL) != 1) | ||
54 | return 1; | ||
55 | } | ||
56 | if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) | ||
57 | { | ||
58 | if (wcrtomb (NULL, 0, NULL) != 1) | ||
59 | return 1; | ||
60 | } | ||
61 | if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) | ||
62 | { | ||
63 | if (wcrtomb (NULL, 0, NULL) != 1) | ||
64 | return 1; | ||
65 | } | ||
66 | return 0; | ||
67 | }], | ||
68 | [gl_cv_func_wcrtomb_retval=yes], | ||
69 | [gl_cv_func_wcrtomb_retval=no], | ||
70 | []) | ||
71 | fi | ||
72 | ]) | ||
73 | case "$gl_cv_func_wcrtomb_retval" in | ||
74 | *yes) ;; | ||
75 | *) REPLACE_WCRTOMB=1 ;; | ||
76 | esac | ||
77 | fi | ||
78 | if test $HAVE_WCRTOMB = 0 || test $REPLACE_WCRTOMB = 1; then | ||
79 | gl_REPLACE_WCHAR_H | ||
80 | AC_LIBOBJ([wcrtomb]) | ||
81 | gl_PREREQ_WCRTOMB | ||
82 | fi | ||
83 | ]) | ||
84 | |||
85 | # Prerequisites of lib/wcrtomb.c. | ||
86 | AC_DEFUN([gl_PREREQ_WCRTOMB], [ | ||
87 | : | ||
88 | ]) | ||