diff options
Diffstat (limited to 'gl/m4/wcrtomb.m4')
| -rw-r--r-- | gl/m4/wcrtomb.m4 | 49 |
1 files changed, 34 insertions, 15 deletions
diff --git a/gl/m4/wcrtomb.m4 b/gl/m4/wcrtomb.m4 index 6a2d772a..f56b5bae 100644 --- a/gl/m4/wcrtomb.m4 +++ b/gl/m4/wcrtomb.m4 | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | # wcrtomb.m4 serial 5 | 1 | # wcrtomb.m4 serial 11 |
| 2 | dnl Copyright (C) 2008-2010 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2008-2013 Free Software Foundation, Inc. |
| 3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
| @@ -14,6 +14,22 @@ AC_DEFUN([gl_FUNC_WCRTOMB], | |||
| 14 | AC_CHECK_FUNCS_ONCE([wcrtomb]) | 14 | AC_CHECK_FUNCS_ONCE([wcrtomb]) |
| 15 | if test $ac_cv_func_wcrtomb = no; then | 15 | if test $ac_cv_func_wcrtomb = no; then |
| 16 | HAVE_WCRTOMB=0 | 16 | HAVE_WCRTOMB=0 |
| 17 | AC_CHECK_DECLS([wcrtomb],,, [[ | ||
| 18 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | ||
| 19 | <wchar.h>. | ||
| 20 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
| 21 | included before <wchar.h>. */ | ||
| 22 | #include <stddef.h> | ||
| 23 | #include <stdio.h> | ||
| 24 | #include <time.h> | ||
| 25 | #include <wchar.h> | ||
| 26 | ]]) | ||
| 27 | if test $ac_cv_have_decl_wcrtomb = yes; then | ||
| 28 | dnl On Minix 3.1.8, the system's <wchar.h> declares wcrtomb() although | ||
| 29 | dnl it does not have the function. Avoid a collision with gnulib's | ||
| 30 | dnl replacement. | ||
| 31 | REPLACE_WCRTOMB=1 | ||
| 32 | fi | ||
| 17 | else | 33 | else |
| 18 | if test $REPLACE_MBSTATE_T = 1; then | 34 | if test $REPLACE_MBSTATE_T = 1; then |
| 19 | REPLACE_WCRTOMB=1 | 35 | REPLACE_WCRTOMB=1 |
| @@ -40,35 +56,43 @@ changequote(,)dnl | |||
| 40 | esac | 56 | esac |
| 41 | changequote([,])dnl | 57 | changequote([,])dnl |
| 42 | if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then | 58 | if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then |
| 43 | AC_TRY_RUN([ | 59 | AC_RUN_IFELSE( |
| 60 | [AC_LANG_SOURCE([[ | ||
| 44 | #include <locale.h> | 61 | #include <locale.h> |
| 45 | #include <stdio.h> | ||
| 46 | #include <string.h> | 62 | #include <string.h> |
| 63 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | ||
| 64 | <wchar.h>. | ||
| 65 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
| 66 | included before <wchar.h>. */ | ||
| 67 | #include <stddef.h> | ||
| 68 | #include <stdio.h> | ||
| 69 | #include <time.h> | ||
| 47 | #include <wchar.h> | 70 | #include <wchar.h> |
| 48 | int main () | 71 | int main () |
| 49 | { | 72 | { |
| 73 | int result = 0; | ||
| 50 | if (setlocale (LC_ALL, "$LOCALE_FR") != NULL) | 74 | if (setlocale (LC_ALL, "$LOCALE_FR") != NULL) |
| 51 | { | 75 | { |
| 52 | if (wcrtomb (NULL, 0, NULL) != 1) | 76 | if (wcrtomb (NULL, 0, NULL) != 1) |
| 53 | return 1; | 77 | result |= 1; |
| 54 | } | 78 | } |
| 55 | if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) | 79 | if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) |
| 56 | { | 80 | { |
| 57 | if (wcrtomb (NULL, 0, NULL) != 1) | 81 | if (wcrtomb (NULL, 0, NULL) != 1) |
| 58 | return 1; | 82 | result |= 2; |
| 59 | } | 83 | } |
| 60 | if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) | 84 | if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) |
| 61 | { | 85 | { |
| 62 | if (wcrtomb (NULL, 0, NULL) != 1) | 86 | if (wcrtomb (NULL, 0, NULL) != 1) |
| 63 | return 1; | 87 | result |= 4; |
| 64 | } | 88 | } |
| 65 | if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) | 89 | if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) |
| 66 | { | 90 | { |
| 67 | if (wcrtomb (NULL, 0, NULL) != 1) | 91 | if (wcrtomb (NULL, 0, NULL) != 1) |
| 68 | return 1; | 92 | result |= 8; |
| 69 | } | 93 | } |
| 70 | return 0; | 94 | return result; |
| 71 | }], | 95 | }]])], |
| 72 | [gl_cv_func_wcrtomb_retval=yes], | 96 | [gl_cv_func_wcrtomb_retval=yes], |
| 73 | [gl_cv_func_wcrtomb_retval=no], | 97 | [gl_cv_func_wcrtomb_retval=no], |
| 74 | [:]) | 98 | [:]) |
| @@ -80,11 +104,6 @@ int main () | |||
| 80 | esac | 104 | esac |
| 81 | fi | 105 | fi |
| 82 | fi | 106 | fi |
| 83 | if test $HAVE_WCRTOMB = 0 || test $REPLACE_WCRTOMB = 1; then | ||
| 84 | gl_REPLACE_WCHAR_H | ||
| 85 | AC_LIBOBJ([wcrtomb]) | ||
| 86 | gl_PREREQ_WCRTOMB | ||
| 87 | fi | ||
| 88 | ]) | 107 | ]) |
| 89 | 108 | ||
| 90 | # Prerequisites of lib/wcrtomb.c. | 109 | # Prerequisites of lib/wcrtomb.c. |
