wint_t.m4 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # wint_t.m4 serial 6
  2. dnl Copyright (C) 2003, 2007-2017 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. [[
  16. /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
  17. <wchar.h>.
  18. BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included
  19. before <wchar.h>. */
  20. #include <stddef.h>
  21. #include <stdio.h>
  22. #include <time.h>
  23. #include <wchar.h>
  24. wint_t foo = (wchar_t)'\0';]],
  25. [[]])],
  26. [gt_cv_c_wint_t=yes],
  27. [gt_cv_c_wint_t=no])])
  28. if test $gt_cv_c_wint_t = yes; then
  29. AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.])
  30. dnl Determine whether gnulib's <wchar.h> or <wctype.h> would, if present,
  31. dnl override 'wint_t'.
  32. AC_CACHE_CHECK([whether wint_t is too small],
  33. [gl_cv_type_wint_t_too_small],
  34. [AC_COMPILE_IFELSE(
  35. [AC_LANG_PROGRAM([[
  36. /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
  37. <wchar.h>.
  38. BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
  39. included before <wchar.h>. */
  40. #if !(defined __GLIBC__ && !defined __UCLIBC__)
  41. # include <stddef.h>
  42. # include <stdio.h>
  43. # include <time.h>
  44. #endif
  45. #include <wchar.h>
  46. int verify[sizeof (wint_t) < sizeof (int) ? -1 : 1];
  47. ]])],
  48. [gl_cv_type_wint_t_too_small=no],
  49. [gl_cv_type_wint_t_too_small=yes])])
  50. if test $gl_cv_type_wint_t_too_small = yes; then
  51. GNULIB_OVERRIDES_WINT_T=1
  52. else
  53. GNULIB_OVERRIDES_WINT_T=0
  54. fi
  55. else
  56. GNULIB_OVERRIDES_WINT_T=0
  57. fi
  58. AC_SUBST([GNULIB_OVERRIDES_WINT_T])
  59. ])