2N/Adnl Copyright (C) 2008-2010 Free Software Foundation, Inc.
2N/Adnl This file is free software; the Free Software Foundation
2N/Adnl gives unlimited permission to copy
and/or distribute it,
2N/Adnl with or without modifications, as long as this notice is preserved.
2N/AAC_DEFUN([gl_FUNC_BTOWC],
2N/A AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
2N/A dnl Check whether <
wchar.h> is usable at all, first. Otherwise the test
2N/A dnl program below may lead to an endless loop. See
2N/A AC_REQUIRE([gl_WCHAR_H_INLINE_OK])
2N/A AC_CHECK_FUNCS_ONCE([btowc])
2N/A if test $ac_cv_func_btowc = no; then
2N/A AC_REQUIRE([AC_PROG_CC])
2N/A AC_REQUIRE([gt_LOCALE_FR])
2N/A AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
2N/A dnl Cygwin 1.7.2 btowc('\0') is WEOF, not 0.
2N/A AC_CACHE_CHECK([whether btowc(0) is correct],
2N/A [gl_cv_func_btowc_nul],
2N/A if (btowc ('\0') != 0)
2N/A [gl_cv_func_btowc_nul=yes],
2N/A [gl_cv_func_btowc_nul=no],
2N/A # Guess no on Cygwin.
2N/A cygwin*) gl_cv_func_btowc_nul="guessing no" ;;
2N/A # Guess yes otherwise.
2N/A *) gl_cv_func_btowc_nul="guessing yes" ;;
2N/A dnl IRIX 6.5 btowc(EOF) is 0xFF, not WEOF.
2N/A AC_CACHE_CHECK([whether btowc(EOF) is correct],
2N/A [gl_cv_func_btowc_eof],
2N/A dnl Initial guess, used when cross-compiling or when no suitable locale
2N/A irix*) gl_cv_func_btowc_eof="guessing no" ;;
2N/A # Guess yes otherwise.
2N/A *) gl_cv_func_btowc_eof="guessing yes" ;;
2N/A if test $LOCALE_FR != none; then
2N/A if (setlocale (LC_ALL, "$LOCALE_FR") != NULL)
2N/A if (btowc (EOF) != WEOF)
2N/A [gl_cv_func_btowc_eof=yes],
2N/A [gl_cv_func_btowc_eof=no],
2N/A case "$gl_cv_func_btowc_nul" in
2N/A *) REPLACE_BTOWC=1 ;;
2N/A case "$gl_cv_func_btowc_eof" in
2N/A *) REPLACE_BTOWC=1 ;;
2N/A if test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1; then
2N/AAC_DEFUN([gl_PREREQ_BTOWC], [