wctype_h.m4 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # wctype_h.m4 serial 6
  2. dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it.
  3. dnl Copyright (C) 2006-2010 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 Written by Paul Eggert.
  8. AC_DEFUN([gl_WCTYPE_H],
  9. [
  10. AC_REQUIRE([AC_PROG_CC])
  11. AC_REQUIRE([AC_CANONICAL_HOST])
  12. AC_CHECK_FUNCS_ONCE([iswcntrl])
  13. if test $ac_cv_func_iswcntrl = yes; then
  14. HAVE_ISWCNTRL=1
  15. else
  16. HAVE_ISWCNTRL=0
  17. fi
  18. AC_SUBST([HAVE_ISWCNTRL])
  19. AC_CHECK_FUNCS_ONCE([iswblank])
  20. if test $ac_cv_func_iswblank = yes; then
  21. HAVE_ISWBLANK=1
  22. else
  23. HAVE_ISWBLANK=0
  24. fi
  25. AC_SUBST([HAVE_ISWBLANK])
  26. AC_CHECK_HEADERS_ONCE([wctype.h])
  27. AC_REQUIRE([AC_C_INLINE])
  28. AC_REQUIRE([gt_TYPE_WINT_T])
  29. if test $gt_cv_c_wint_t = yes; then
  30. HAVE_WINT_T=1
  31. else
  32. HAVE_WINT_T=0
  33. fi
  34. AC_SUBST([HAVE_WINT_T])
  35. if test $ac_cv_header_wctype_h = yes; then
  36. if test $ac_cv_func_iswcntrl = yes; then
  37. dnl Linux libc5 has an iswprint function that returns 0 for all arguments.
  38. dnl The other functions are likely broken in the same way.
  39. AC_CACHE_CHECK([whether iswcntrl works], [gl_cv_func_iswcntrl_works],
  40. [
  41. AC_RUN_IFELSE([AC_LANG_SOURCE([[
  42. #include <stddef.h>
  43. #include <stdio.h>
  44. #include <time.h>
  45. #include <wchar.h>
  46. #include <wctype.h>
  47. int main () { return iswprint ('x') == 0; }]])],
  48. [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no],
  49. [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
  50. #if __GNU_LIBRARY__ == 1
  51. Linux libc5 i18n is broken.
  52. #endif]], [])],
  53. [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no])
  54. ])
  55. ])
  56. fi
  57. gl_CHECK_NEXT_HEADERS([wctype.h])
  58. HAVE_WCTYPE_H=1
  59. else
  60. HAVE_WCTYPE_H=0
  61. fi
  62. AC_SUBST([HAVE_WCTYPE_H])
  63. if test "$gl_cv_func_iswcntrl_works" = no; then
  64. REPLACE_ISWCNTRL=1
  65. else
  66. REPLACE_ISWCNTRL=0
  67. fi
  68. AC_SUBST([REPLACE_ISWCNTRL])
  69. ])