Update from diffutils-2.8.2.
[gnulib.git] / m4 / mbstate_t.m4
1 # mbstate_t.m4 serial 9
2 dnl Copyright (C) 2000, 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 # From Paul Eggert.
10
11 # BeOS 5 has <wchar.h> but does not define mbstate_t,
12 # so you can't declare an object of that type.
13 # Check for this incompatibility with Standard C.
14
15 # AC_TYPE_MBSTATE_T
16 # -----------------
17 AC_DEFUN([AC_TYPE_MBSTATE_T],
18   [AC_CACHE_CHECK([for mbstate_t], ac_cv_type_mbstate_t,
19      [AC_COMPILE_IFELSE(
20         [AC_LANG_PROGRAM(
21            [AC_INCLUDES_DEFAULT
22 #           include <wchar.h>],
23            [mbstate_t x; return sizeof x;])],
24         [ac_cv_type_mbstate_t=yes],
25         [ac_cv_type_mbstate_t=no])])
26    if test $ac_cv_type_mbstate_t = yes; then
27      AC_DEFINE([HAVE_MBSTATE_T], 1,
28                [Define to 1 if <wchar.h> declares mbstate_t.])
29    else
30      AC_DEFINE([mbstate_t], int,
31                [Define to a type if <wchar.h> does not define.])
32    fi])