Rename gl_FUNC_MBRTOWC to AC_FUNC_MBRTOWC.
[gnulib.git] / m4 / mbrtowc.m4
1 # mbrtowc.m4 serial 9
2 dnl Copyright (C) 2001-2002, 2004-2005, 2008 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.
6
7 dnl From Paul Eggert
8
9 dnl This override of an autoconf macro can be removed when autoconf 2.60 or
10 dnl newer can be assumed everywhere.
11
12 AC_DEFUN([AC_FUNC_MBRTOWC],
13 [
14   dnl Same as AC_FUNC_MBRTOWC in autoconf-2.60.
15   AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared],
16     gl_cv_func_mbrtowc,
17     [AC_LINK_IFELSE(
18        [AC_LANG_PROGRAM(
19             [[#include <wchar.h>]],
20             [[wchar_t wc;
21               char const s[] = "";
22               size_t n = 1;
23               mbstate_t state;
24               return ! (sizeof state && (mbrtowc) (&wc, s, n, &state));]])],
25        gl_cv_func_mbrtowc=yes,
26        gl_cv_func_mbrtowc=no)])
27   if test $gl_cv_func_mbrtowc = yes; then
28     AC_DEFINE([HAVE_MBRTOWC], 1,
29       [Define to 1 if mbrtowc and mbstate_t are properly declared.])
30   fi
31 ])