summaryrefslogtreecommitdiffstats
path: root/gl/m4/wint_t.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/wint_t.m4')
-rw-r--r--gl/m4/wint_t.m449
1 files changed, 37 insertions, 12 deletions
diff --git a/gl/m4/wint_t.m4 b/gl/m4/wint_t.m4
index d7cd3db9..a49c5081 100644
--- a/gl/m4/wint_t.m4
+++ b/gl/m4/wint_t.m4
@@ -1,11 +1,12 @@
1# wint_t.m4 serial 5 (gettext-0.18.2) 1# wint_t.m4 serial 11
2dnl Copyright (C) 2003, 2007-2013 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
6 6
7dnl From Bruno Haible. 7dnl From Bruno Haible.
8dnl Test whether <wchar.h> has the 'wint_t' type. 8dnl Test whether <wchar.h> has the 'wint_t' type and whether gnulib's
9dnl <wchar.h> or <wctype.h> would, if present, override 'wint_t'.
9dnl Prerequisite: AC_PROG_CC 10dnl Prerequisite: AC_PROG_CC
10 11
11AC_DEFUN([gt_TYPE_WINT_T], 12AC_DEFUN([gt_TYPE_WINT_T],
@@ -13,20 +14,44 @@ AC_DEFUN([gt_TYPE_WINT_T],
13 AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t], 14 AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t],
14 [AC_COMPILE_IFELSE( 15 [AC_COMPILE_IFELSE(
15 [AC_LANG_PROGRAM( 16 [AC_LANG_PROGRAM(
16 [[ 17 [[#include <wchar.h>
17/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
18 <wchar.h>.
19 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included
20 before <wchar.h>. */
21#include <stddef.h>
22#include <stdio.h>
23#include <time.h>
24#include <wchar.h>
25 wint_t foo = (wchar_t)'\0';]], 18 wint_t foo = (wchar_t)'\0';]],
26 [[]])], 19 [[]])],
27 [gt_cv_c_wint_t=yes], 20 [gt_cv_c_wint_t=yes],
28 [gt_cv_c_wint_t=no])]) 21 [gt_cv_c_wint_t=no])])
29 if test $gt_cv_c_wint_t = yes; then 22 if test $gt_cv_c_wint_t = yes; then
30 AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.]) 23 AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.])
24
25 dnl Determine whether gnulib's <wchar.h> or <wctype.h> would, if present,
26 dnl override 'wint_t'.
27 AC_CACHE_CHECK([whether wint_t is large enough],
28 [gl_cv_type_wint_t_large_enough],
29 [AC_COMPILE_IFELSE(
30 [AC_LANG_PROGRAM(
31 [[#include <wchar.h>
32 int verify[sizeof (wint_t) < sizeof (int) ? -1 : 1];
33 ]])],
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
37 GNULIBHEADERS_OVERRIDE_WINT_T=1
38 else
39 GNULIBHEADERS_OVERRIDE_WINT_T=0
40 fi
41 else
42 GNULIBHEADERS_OVERRIDE_WINT_T=0
43 fi
44 AC_SUBST([GNULIBHEADERS_OVERRIDE_WINT_T])
45])
46
47dnl Prerequisites of the 'wint_t' override.
48AC_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
31 fi 55 fi
56 AC_SUBST([HAVE_CRTDEFS_H])
32]) 57])