Debian Codegraph @

tools/gnulib/m4/wint_t.m4

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