summaryrefslogtreecommitdiffstats
path: root/gl/m4/btowc.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/btowc.m4')
-rw-r--r--gl/m4/btowc.m445
1 files changed, 42 insertions, 3 deletions
diff --git a/gl/m4/btowc.m4 b/gl/m4/btowc.m4
index b46f74fb..c4ee4e41 100644
--- a/gl/m4/btowc.m4
+++ b/gl/m4/btowc.m4
@@ -1,5 +1,5 @@
1# btowc.m4 serial 4 1# btowc.m4 serial 6
2dnl Copyright (C) 2008-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2008-2010 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -8,15 +8,49 @@ AC_DEFUN([gl_FUNC_BTOWC],
8[ 8[
9 AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) 9 AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
10 10
11 dnl Check whether <wchar.h> is usable at all, first. Otherwise the test
12 dnl program below may lead to an endless loop. See
13 dnl <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>.
14 AC_REQUIRE([gl_WCHAR_H_INLINE_OK])
15
11 AC_CHECK_FUNCS_ONCE([btowc]) 16 AC_CHECK_FUNCS_ONCE([btowc])
12 if test $ac_cv_func_btowc = no; then 17 if test $ac_cv_func_btowc = no; then
13 HAVE_BTOWC=0 18 HAVE_BTOWC=0
14 else 19 else
15 20
16 dnl IRIX 6.5 btowc(EOF) is 0xFF, not WEOF.
17 AC_REQUIRE([AC_PROG_CC]) 21 AC_REQUIRE([AC_PROG_CC])
18 AC_REQUIRE([gt_LOCALE_FR]) 22 AC_REQUIRE([gt_LOCALE_FR])
19 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 23 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
24
25 dnl Cygwin 1.7.2 btowc('\0') is WEOF, not 0.
26 AC_CACHE_CHECK([whether btowc(0) is correct],
27 [gl_cv_func_btowc_nul],
28 [
29 AC_TRY_RUN([
30#include <stdio.h>
31#include <string.h>
32#include <wchar.h>
33int main ()
34{
35 if (btowc ('\0') != 0)
36 return 1;
37 return 0;
38}],
39 [gl_cv_func_btowc_nul=yes],
40 [gl_cv_func_btowc_nul=no],
41 [
42changequote(,)dnl
43 case "$host_os" in
44 # Guess no on Cygwin.
45 cygwin*) gl_cv_func_btowc_nul="guessing no" ;;
46 # Guess yes otherwise.
47 *) gl_cv_func_btowc_nul="guessing yes" ;;
48 esac
49changequote([,])dnl
50 ])
51 ])
52
53 dnl IRIX 6.5 btowc(EOF) is 0xFF, not WEOF.
20 AC_CACHE_CHECK([whether btowc(EOF) is correct], 54 AC_CACHE_CHECK([whether btowc(EOF) is correct],
21 [gl_cv_func_btowc_eof], 55 [gl_cv_func_btowc_eof],
22 [ 56 [
@@ -50,6 +84,11 @@ int main ()
50 [:]) 84 [:])
51 fi 85 fi
52 ]) 86 ])
87
88 case "$gl_cv_func_btowc_nul" in
89 *yes) ;;
90 *) REPLACE_BTOWC=1 ;;
91 esac
53 case "$gl_cv_func_btowc_eof" in 92 case "$gl_cv_func_btowc_eof" in
54 *yes) ;; 93 *yes) ;;
55 *) REPLACE_BTOWC=1 ;; 94 *) REPLACE_BTOWC=1 ;;