diff options
Diffstat (limited to 'gl/m4/btowc.m4')
-rw-r--r-- | gl/m4/btowc.m4 | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/gl/m4/btowc.m4 b/gl/m4/btowc.m4 new file mode 100644 index 00000000..64ff8290 --- /dev/null +++ b/gl/m4/btowc.m4 | |||
@@ -0,0 +1,68 @@ | |||
1 | # btowc.m4 serial 3 | ||
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_BTOWC], | ||
8 | [ | ||
9 | AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) | ||
10 | |||
11 | AC_CHECK_FUNCS_ONCE([btowc]) | ||
12 | if test $ac_cv_func_btowc = no; then | ||
13 | HAVE_BTOWC=0 | ||
14 | else | ||
15 | |||
16 | dnl IRIX 6.5 btowc(EOF) is 0xFF, not WEOF. | ||
17 | AC_REQUIRE([AC_PROG_CC]) | ||
18 | AC_REQUIRE([gt_LOCALE_FR]) | ||
19 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
20 | AC_CACHE_CHECK([whether btowc(EOF) is correct], | ||
21 | [gl_cv_func_btowc_eof], | ||
22 | [ | ||
23 | dnl Initial guess, used when cross-compiling or when no suitable locale | ||
24 | dnl is present. | ||
25 | changequote(,)dnl | ||
26 | case "$host_os" in | ||
27 | # Guess no on IRIX. | ||
28 | irix*) gl_cv_func_btowc_eof="guessing no" ;; | ||
29 | # Guess yes otherwise. | ||
30 | *) gl_cv_func_btowc_eof="guessing yes" ;; | ||
31 | esac | ||
32 | changequote([,])dnl | ||
33 | if test $LOCALE_FR != none; then | ||
34 | AC_TRY_RUN([ | ||
35 | #include <locale.h> | ||
36 | #include <stdio.h> | ||
37 | #include <string.h> | ||
38 | #include <wchar.h> | ||
39 | int main () | ||
40 | { | ||
41 | if (setlocale (LC_ALL, "$LOCALE_FR") != NULL) | ||
42 | { | ||
43 | if (btowc (EOF) != WEOF) | ||
44 | return 1; | ||
45 | } | ||
46 | return 0; | ||
47 | }], | ||
48 | [gl_cv_func_btowc_eof=yes], | ||
49 | [gl_cv_func_btowc_eof=no], | ||
50 | []) | ||
51 | fi | ||
52 | ]) | ||
53 | case "$gl_cv_func_btowc_eof" in | ||
54 | *yes) ;; | ||
55 | *) REPLACE_BTOWC=1 ;; | ||
56 | esac | ||
57 | fi | ||
58 | if test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1; then | ||
59 | gl_REPLACE_WCHAR_H | ||
60 | AC_LIBOBJ([btowc]) | ||
61 | gl_PREREQ_BTOWC | ||
62 | fi | ||
63 | ]) | ||
64 | |||
65 | # Prerequisites of lib/btowc.c. | ||
66 | AC_DEFUN([gl_PREREQ_BTOWC], [ | ||
67 | : | ||
68 | ]) | ||