Debian Codegraph @

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 dnl This file is offered as-is, without any warranty.
8
9 dnl From Bruno Haible.
10 dnl Test whether <wchar.h> has the 'wint_t' type and whether gnulib's
11 dnl <wchar.h> or <wctype.h> would, if present, override 'wint_t'.
12 dnl Prerequisite: AC_PROG_CC
13
14 AC_DEFUN([gt_TYPE_WINT_T],
15 [
16 AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t],
17 [AC_COMPILE_IFELSE(
18 [AC_LANG_PROGRAM(
19 [[#include <wchar.h>
20 wint_t foo = (wchar_t)'\0';]],
21 [[]])],
22 [gt_cv_c_wint_t=yes],
23 [gt_cv_c_wint_t=no])])
24 if test $gt_cv_c_wint_t = yes; then
25 AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.])
26
27 dnl Determine whether gnulib's <wchar.h> or <wctype.h> would, if present,
28 dnl override 'wint_t'.
29 AC_CACHE_CHECK([whether wint_t is large enough],
30 [gl_cv_type_wint_t_large_enough],
31 [AC_COMPILE_IFELSE(
32 [AC_LANG_PROGRAM(
33 [[#include <wchar.h>
34 int verify[sizeof (wint_t) < sizeof (int) ? -1 : 1];
35 ]])],
36 [gl_cv_type_wint_t_large_enough=yes],
37 [gl_cv_type_wint_t_large_enough=no])])
38 if test $gl_cv_type_wint_t_large_enough = no; then
39 GNULIBHEADERS_OVERRIDE_WINT_T=1
40 else
41 GNULIBHEADERS_OVERRIDE_WINT_T=0
42 fi
43 else
44 GNULIBHEADERS_OVERRIDE_WINT_T=0
45 fi
46 AC_SUBST([GNULIBHEADERS_OVERRIDE_WINT_T])
47 ])
48
49 dnl Prerequisites of the 'wint_t' override.
50 AC_DEFUN([gl_TYPE_WINT_T_PREREQ],
51 [
52 AC_CHECK_HEADERS_ONCE([crtdefs.h])
53 if test $ac_cv_header_crtdefs_h = yes; then
54 HAVE_CRTDEFS_H=1
55 else
56 HAVE_CRTDEFS_H=0
57 fi
58 AC_SUBST([HAVE_CRTDEFS_H])
59 ])