03798476332f1058a7764a1f853cec4acb9ea3f3
[gnulib.git] / m4 / mbrtowc.m4
1 # mbrtowc.m4 serial 4 (fileutils-4.1.3)
2 dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
3 dnl This file is free software, distributed under the terms of the GNU
4 dnl General Public License.  As a special exception to the GNU General
5 dnl Public License, this file may be distributed as part of a program
6 dnl that contains a configuration script generated by Autoconf, under
7 dnl the same distribution terms as the rest of that program.
8
9 dnl From Paul Eggert
10
11 AC_DEFUN([jm_FUNC_MBRTOWC],
12 [
13   AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared],
14     jm_cv_func_mbrtowc,
15     [AC_TRY_LINK(
16        [#include <wchar.h>],
17        [mbstate_t state; return ! (sizeof state && mbrtowc);],
18        jm_cv_func_mbrtowc=yes,
19        jm_cv_func_mbrtowc=no)])
20   if test $jm_cv_func_mbrtowc = yes; then
21     AC_DEFINE(HAVE_MBRTOWC, 1,
22       [Define to 1 if mbrtowc and mbstate_t are properly declared.])
23   fi
24 ])