wint_t.m4 1.8 KB

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