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