Blame m4/mbstate_t.m4

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