Blame m4/wint_t.m4

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