Blame m4/mbstate_t.m4

Packit Service fdd496
# mbstate_t.m4 serial 13
Packit Service fdd496
dnl Copyright (C) 2000-2002, 2008-2017 Free Software Foundation, Inc.
Packit Service fdd496
dnl This file is free software; the Free Software Foundation
Packit Service fdd496
dnl gives unlimited permission to copy and/or distribute it,
Packit Service fdd496
dnl with or without modifications, as long as this notice is preserved.
Packit Service fdd496
Packit Service fdd496
# From Paul Eggert.
Packit Service fdd496
Packit Service fdd496
# BeOS 5 has <wchar.h> but does not define mbstate_t,
Packit Service fdd496
# so you can't declare an object of that type.
Packit Service fdd496
# Check for this incompatibility with Standard C.
Packit Service fdd496
Packit Service fdd496
# AC_TYPE_MBSTATE_T
Packit Service fdd496
# -----------------
Packit Service fdd496
AC_DEFUN([AC_TYPE_MBSTATE_T],
Packit Service fdd496
[
Packit Service fdd496
   AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) dnl for HP-UX 11.11
Packit Service fdd496
Packit Service fdd496
   AC_CACHE_CHECK([for mbstate_t], [ac_cv_type_mbstate_t],
Packit Service fdd496
     [AC_COMPILE_IFELSE(
Packit Service fdd496
        [AC_LANG_PROGRAM(
Packit Service fdd496
           [AC_INCLUDES_DEFAULT[
Packit Service fdd496
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
Packit Service fdd496
   <wchar.h>.
Packit Service fdd496
   BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
Packit Service fdd496
   included before <wchar.h>.  */
Packit Service fdd496
#include <stddef.h>
Packit Service fdd496
#include <stdio.h>
Packit Service fdd496
#include <time.h>
Packit Service fdd496
#include <wchar.h>]],
Packit Service fdd496
           [[mbstate_t x; return sizeof x;]])],
Packit Service fdd496
        [ac_cv_type_mbstate_t=yes],
Packit Service fdd496
        [ac_cv_type_mbstate_t=no])])
Packit Service fdd496
   if test $ac_cv_type_mbstate_t = yes; then
Packit Service fdd496
     AC_DEFINE([HAVE_MBSTATE_T], [1],
Packit Service fdd496
               [Define to 1 if <wchar.h> declares mbstate_t.])
Packit Service fdd496
   else
Packit Service fdd496
     AC_DEFINE([mbstate_t], [int],
Packit Service fdd496
               [Define to a type if <wchar.h> does not define.])
Packit Service fdd496
   fi
Packit Service fdd496
])