Blame m4/wint_t.m4

Packit Service 4684c1
# wint_t.m4 serial 8
Packit Service 4684c1
dnl Copyright (C) 2003, 2007-2020 Free Software Foundation, Inc.
Packit Service 4684c1
dnl This file is free software; the Free Software Foundation
Packit Service 4684c1
dnl gives unlimited permission to copy and/or distribute it,
Packit Service 4684c1
dnl with or without modifications, as long as this notice is preserved.
Packit Service 4684c1
Packit Service 4684c1
dnl From Bruno Haible.
Packit Service 4684c1
dnl Test whether <wchar.h> has the 'wint_t' type and whether gnulib's
Packit Service 4684c1
dnl <wchar.h> or <wctype.h> would, if present, override 'wint_t'.
Packit Service 4684c1
dnl Prerequisite: AC_PROG_CC
Packit Service 4684c1
Packit Service 4684c1
AC_DEFUN([gt_TYPE_WINT_T],
Packit Service 4684c1
[
Packit Service 4684c1
  AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t],
Packit Service 4684c1
    [AC_COMPILE_IFELSE(
Packit Service 4684c1
       [AC_LANG_PROGRAM(
Packit Service 4684c1
          [[
Packit Service 4684c1
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
Packit Service 4684c1
   <wchar.h>.
Packit Service 4684c1
   BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included
Packit Service 4684c1
   before <wchar.h>.  */
Packit Service 4684c1
#include <stddef.h>
Packit Service 4684c1
#include <stdio.h>
Packit Service 4684c1
#include <time.h>
Packit Service 4684c1
#include <wchar.h>
Packit Service 4684c1
            wint_t foo = (wchar_t)'\0';]],
Packit Service 4684c1
          [[]])],
Packit Service 4684c1
       [gt_cv_c_wint_t=yes],
Packit Service 4684c1
       [gt_cv_c_wint_t=no])])
Packit Service 4684c1
  if test $gt_cv_c_wint_t = yes; then
Packit Service 4684c1
    AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.])
Packit Service 4684c1
Packit Service 4684c1
    dnl Determine whether gnulib's <wchar.h> or <wctype.h> would, if present,
Packit Service 4684c1
    dnl override 'wint_t'.
Packit Service 4684c1
    AC_CACHE_CHECK([whether wint_t is too small],
Packit Service 4684c1
      [gl_cv_type_wint_t_too_small],
Packit Service 4684c1
      [AC_COMPILE_IFELSE(
Packit Service 4684c1
         [AC_LANG_PROGRAM([[
Packit Service 4684c1
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
Packit Service 4684c1
   <wchar.h>.
Packit Service 4684c1
   BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
Packit Service 4684c1
   included before <wchar.h>.  */
Packit Service 4684c1
#if !(defined __GLIBC__ && !defined __UCLIBC__)
Packit Service 4684c1
# include <stddef.h>
Packit Service 4684c1
# include <stdio.h>
Packit Service 4684c1
# include <time.h>
Packit Service 4684c1
#endif
Packit Service 4684c1
#include <wchar.h>
Packit Service 4684c1
            int verify[sizeof (wint_t) < sizeof (int) ? -1 : 1];
Packit Service 4684c1
            ]])],
Packit Service 4684c1
         [gl_cv_type_wint_t_too_small=no],
Packit Service 4684c1
         [gl_cv_type_wint_t_too_small=yes])])
Packit Service 4684c1
    if test $gl_cv_type_wint_t_too_small = yes; then
Packit Service 4684c1
      GNULIB_OVERRIDES_WINT_T=1
Packit Service 4684c1
    else
Packit Service 4684c1
      GNULIB_OVERRIDES_WINT_T=0
Packit Service 4684c1
    fi
Packit Service 4684c1
  else
Packit Service 4684c1
    GNULIB_OVERRIDES_WINT_T=0
Packit Service 4684c1
  fi
Packit Service 4684c1
  AC_SUBST([GNULIB_OVERRIDES_WINT_T])
Packit Service 4684c1
])
Packit Service 4684c1
Packit Service 4684c1
dnl Prerequisites of the 'wint_t' override.
Packit Service 4684c1
AC_DEFUN([gl_TYPE_WINT_T_PREREQ],
Packit Service 4684c1
[
Packit Service 4684c1
  AC_CHECK_HEADERS_ONCE([crtdefs.h])
Packit Service 4684c1
  if test $ac_cv_header_crtdefs_h = yes; then
Packit Service 4684c1
    HAVE_CRTDEFS_H=1
Packit Service 4684c1
  else
Packit Service 4684c1
    HAVE_CRTDEFS_H=0
Packit Service 4684c1
  fi
Packit Service 4684c1
  AC_SUBST([HAVE_CRTDEFS_H])
Packit Service 4684c1
])