Blame m4/wint_t.m4

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