Blame m4/wint_t.m4

Packit Service a2489d
# wint_t.m4 serial 7
Packit Service a2489d
dnl Copyright (C) 2003, 2007-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
dnl From Bruno Haible.
Packit Service a2489d
dnl Test whether <wchar.h> has the 'wint_t' type and whether gnulib's
Packit Service a2489d
dnl <wchar.h> or <wctype.h> would, if present, override 'wint_t'.
Packit Service a2489d
dnl Prerequisite: AC_PROG_CC
Packit Service a2489d
Packit Service a2489d
AC_DEFUN([gt_TYPE_WINT_T],
Packit Service a2489d
[
Packit Service a2489d
  AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t],
Packit Service a2489d
    [AC_COMPILE_IFELSE(
Packit Service a2489d
       [AC_LANG_PROGRAM(
Packit Service a2489d
          [[
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 included
Packit Service a2489d
   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
            wint_t foo = (wchar_t)'\0';]],
Packit Service a2489d
          [[]])],
Packit Service a2489d
       [gt_cv_c_wint_t=yes],
Packit Service a2489d
       [gt_cv_c_wint_t=no])])
Packit Service a2489d
  if test $gt_cv_c_wint_t = yes; then
Packit Service a2489d
    AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.])
Packit Service a2489d
Packit Service a2489d
    dnl Determine whether gnulib's <wchar.h> or <wctype.h> would, if present,
Packit Service a2489d
    dnl override 'wint_t'.
Packit Service a2489d
    AC_CACHE_CHECK([whether wint_t is too small],
Packit Service a2489d
      [gl_cv_type_wint_t_too_small],
Packit Service a2489d
      [AC_COMPILE_IFELSE(
Packit Service a2489d
           [AC_LANG_PROGRAM([[
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
#if !(defined __GLIBC__ && !defined __UCLIBC__)
Packit Service a2489d
# include <stddef.h>
Packit Service a2489d
# include <stdio.h>
Packit Service a2489d
# include <time.h>
Packit Service a2489d
#endif
Packit Service a2489d
#include <wchar.h>
Packit Service a2489d
              int verify[sizeof (wint_t) < sizeof (int) ? -1 : 1];
Packit Service a2489d
              ]])],
Packit Service a2489d
           [gl_cv_type_wint_t_too_small=no],
Packit Service a2489d
           [gl_cv_type_wint_t_too_small=yes])])
Packit Service a2489d
    if test $gl_cv_type_wint_t_too_small = yes; then
Packit Service a2489d
      GNULIB_OVERRIDES_WINT_T=1
Packit Service a2489d
    else
Packit Service a2489d
      GNULIB_OVERRIDES_WINT_T=0
Packit Service a2489d
    fi
Packit Service a2489d
  else
Packit Service a2489d
    GNULIB_OVERRIDES_WINT_T=0
Packit Service a2489d
  fi
Packit Service a2489d
  AC_SUBST([GNULIB_OVERRIDES_WINT_T])
Packit Service a2489d
])
Packit Service a2489d
Packit Service a2489d
dnl Prerequisites of the 'wint_t' override.
Packit Service a2489d
AC_DEFUN([gl_TYPE_WINT_T_PREREQ],
Packit Service a2489d
[
Packit Service a2489d
  AC_CHECK_HEADERS_ONCE([crtdefs.h])
Packit Service a2489d
  if test $ac_cv_header_crtdefs_h = yes; then
Packit Service a2489d
    HAVE_CRTDEFS_H=1
Packit Service a2489d
  else
Packit Service a2489d
    HAVE_CRTDEFS_H=0
Packit Service a2489d
  fi
Packit Service a2489d
  AC_SUBST([HAVE_CRTDEFS_H])
Packit Service a2489d
])