2N/A# wcrtomb.m4 serial 6
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/A
2N/AAC_DEFUN([gl_FUNC_WCRTOMB],
2N/A[
2N/A AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
2N/A
2N/A AC_REQUIRE([AC_TYPE_MBSTATE_T])
2N/A gl_MBSTATE_T_BROKEN
2N/A
2N/A AC_CHECK_FUNCS_ONCE([wcrtomb])
2N/A if test $ac_cv_func_wcrtomb = no; then
2N/A HAVE_WCRTOMB=0
2N/A else
2N/A if test $REPLACE_MBSTATE_T = 1; then
2N/A REPLACE_WCRTOMB=1
2N/A else
2N/A dnl On AIX 4.3, OSF/1 5.1 and Solaris 10, wcrtomb (NULL, 0, NULL) sometimes
2N/A dnl returns 0 instead of 1.
2N/A AC_REQUIRE([AC_PROG_CC])
2N/A AC_REQUIRE([gt_LOCALE_FR])
2N/A AC_REQUIRE([gt_LOCALE_FR_UTF8])
2N/A AC_REQUIRE([gt_LOCALE_JA])
2N/A AC_REQUIRE([gt_LOCALE_ZH_CN])
2N/A AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
2N/A AC_CACHE_CHECK([whether wcrtomb return value is correct],
2N/A [gl_cv_func_wcrtomb_retval],
2N/A [
2N/A dnl Initial guess, used when cross-compiling or when no suitable locale
2N/A dnl is present.
2N/Achangequote(,)dnl
2N/A case "$host_os" in
2N/A # Guess no on AIX 4, OSF/1 and Solaris.
2N/A aix4* | osf* | solaris*) gl_cv_func_wcrtomb_retval="guessing no" ;;
2N/A # Guess yes otherwise.
2N/A *) gl_cv_func_wcrtomb_retval="guessing yes" ;;
2N/A esac
2N/Achangequote([,])dnl
2N/A if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then
2N/A AC_RUN_IFELSE(
2N/A [AC_LANG_SOURCE([[
2N/A#include <locale.h>
2N/A#include <stdio.h>
2N/A#include <string.h>
2N/A#include <wchar.h>
2N/Aint main ()
2N/A{
2N/A if (setlocale (LC_ALL, "$LOCALE_FR") != NULL)
2N/A {
2N/A if (wcrtomb (NULL, 0, NULL) != 1)
2N/A return 1;
2N/A }
2N/A if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
2N/A {
2N/A if (wcrtomb (NULL, 0, NULL) != 1)
2N/A return 1;
2N/A }
2N/A if (setlocale (LC_ALL, "$LOCALE_JA") != NULL)
2N/A {
2N/A if (wcrtomb (NULL, 0, NULL) != 1)
2N/A return 1;
2N/A }
2N/A if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
2N/A {
2N/A if (wcrtomb (NULL, 0, NULL) != 1)
2N/A return 1;
2N/A }
2N/A return 0;
2N/A}]])],
2N/A [gl_cv_func_wcrtomb_retval=yes],
2N/A [gl_cv_func_wcrtomb_retval=no],
2N/A [:])
2N/A fi
2N/A ])
2N/A case "$gl_cv_func_wcrtomb_retval" in
2N/A *yes) ;;
2N/A *) REPLACE_WCRTOMB=1 ;;
2N/A esac
2N/A fi
2N/A fi
2N/A if test $HAVE_WCRTOMB = 0 || test $REPLACE_WCRTOMB = 1; then
2N/A gl_REPLACE_WCHAR_H
2N/A AC_LIBOBJ([wcrtomb])
2N/A gl_PREREQ_WCRTOMB
2N/A fi
2N/A])
2N/A
2N/A# Prerequisites of lib/wcrtomb.c.
2N/AAC_DEFUN([gl_PREREQ_WCRTOMB], [
2N/A :
2N/A])