Home | History | Annotate | Line # | Download | only in m4
      1  1.1.1.2  christos # wint_t.m4 serial 11
      2  1.1.1.2  christos dnl Copyright (C) 2003, 2007-2022 Free Software Foundation, Inc.
      3      1.1  christos dnl This file is free software; the Free Software Foundation
      4      1.1  christos dnl gives unlimited permission to copy and/or distribute it,
      5      1.1  christos dnl with or without modifications, as long as this notice is preserved.
      6      1.1  christos 
      7      1.1  christos dnl From Bruno Haible.
      8      1.1  christos dnl Test whether <wchar.h> has the 'wint_t' type and whether gnulib's
      9      1.1  christos dnl <wchar.h> or <wctype.h> would, if present, override 'wint_t'.
     10      1.1  christos dnl Prerequisite: AC_PROG_CC
     11      1.1  christos 
     12      1.1  christos AC_DEFUN([gt_TYPE_WINT_T],
     13      1.1  christos [
     14      1.1  christos   AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t],
     15      1.1  christos     [AC_COMPILE_IFELSE(
     16      1.1  christos        [AC_LANG_PROGRAM(
     17  1.1.1.2  christos           [[#include <wchar.h>
     18      1.1  christos             wint_t foo = (wchar_t)'\0';]],
     19      1.1  christos           [[]])],
     20      1.1  christos        [gt_cv_c_wint_t=yes],
     21      1.1  christos        [gt_cv_c_wint_t=no])])
     22      1.1  christos   if test $gt_cv_c_wint_t = yes; then
     23      1.1  christos     AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.])
     24      1.1  christos 
     25      1.1  christos     dnl Determine whether gnulib's <wchar.h> or <wctype.h> would, if present,
     26      1.1  christos     dnl override 'wint_t'.
     27  1.1.1.2  christos     AC_CACHE_CHECK([whether wint_t is large enough],
     28  1.1.1.2  christos       [gl_cv_type_wint_t_large_enough],
     29      1.1  christos       [AC_COMPILE_IFELSE(
     30  1.1.1.2  christos          [AC_LANG_PROGRAM(
     31  1.1.1.2  christos             [[#include <wchar.h>
     32  1.1.1.2  christos               int verify[sizeof (wint_t) < sizeof (int) ? -1 : 1];
     33      1.1  christos             ]])],
     34  1.1.1.2  christos          [gl_cv_type_wint_t_large_enough=yes],
     35  1.1.1.2  christos          [gl_cv_type_wint_t_large_enough=no])])
     36  1.1.1.2  christos     if test $gl_cv_type_wint_t_large_enough = no; then
     37  1.1.1.2  christos       GNULIBHEADERS_OVERRIDE_WINT_T=1
     38      1.1  christos     else
     39  1.1.1.2  christos       GNULIBHEADERS_OVERRIDE_WINT_T=0
     40      1.1  christos     fi
     41      1.1  christos   else
     42  1.1.1.2  christos     GNULIBHEADERS_OVERRIDE_WINT_T=0
     43      1.1  christos   fi
     44  1.1.1.2  christos   AC_SUBST([GNULIBHEADERS_OVERRIDE_WINT_T])
     45      1.1  christos ])
     46      1.1  christos 
     47      1.1  christos dnl Prerequisites of the 'wint_t' override.
     48      1.1  christos AC_DEFUN([gl_TYPE_WINT_T_PREREQ],
     49      1.1  christos [
     50      1.1  christos   AC_CHECK_HEADERS_ONCE([crtdefs.h])
     51      1.1  christos   if test $ac_cv_header_crtdefs_h = yes; then
     52      1.1  christos     HAVE_CRTDEFS_H=1
     53      1.1  christos   else
     54      1.1  christos     HAVE_CRTDEFS_H=0
     55      1.1  christos   fi
     56      1.1  christos   AC_SUBST([HAVE_CRTDEFS_H])
     57      1.1  christos ])
     58