2 dnl Copyright (C) 2008-2010 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.
7 AC_DEFUN([gl_FUNC_WCTOB],
9 AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
11 AC_CHECK_FUNCS_ONCE([wctob])
12 if test $ac_cv_func_wctob = no; then
19 dnl Solaris 9 has the wctob() function but it does not work.
20 AC_REQUIRE([AC_PROG_CC])
21 AC_REQUIRE([gt_LOCALE_FR])
22 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
23 AC_CACHE_CHECK([whether wctob works],
24 [gl_cv_func_wctob_works],
26 dnl Initial guess, used when cross-compiling or when no suitable locale
30 # Guess no on Solaris <= 9.
31 solaris2.[1-9] | solaris2.[1-9].*)
32 gl_cv_func_wctob_works="guessing no" ;;
33 # Guess yes otherwise.
34 *) gl_cv_func_wctob_works="guessing yes" ;;
37 if test $LOCALE_FR != none; then
44 if (setlocale (LC_ALL, "$LOCALE_FR") != NULL)
48 if (mbtowc (&wc, "\374", 1) == 1)
49 if (wctob (wc) != (unsigned char) '\374')
54 [gl_cv_func_wctob_works=yes],
55 [gl_cv_func_wctob_works=no],
59 case "$gl_cv_func_wctob_works" in
63 if test $REPLACE_WCTOB = 1; then
69 dnl IRIX 6.5 has the wctob() function but does not declare it.
70 AC_CHECK_DECLS([wctob], [], [], [
71 /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
73 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included
80 if test $ac_cv_have_decl_wctob != yes; then
88 # Prerequisites of lib/wctob.c.
89 AC_DEFUN([gl_PREREQ_WCTOB], [