Blame m4/wint_t.m4

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