wctype.m4 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. # wctype.m4 serial 2
  2. dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it.
  3. dnl Copyright (C) 2006-2008 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_CHECK_FUNCS_ONCE([iswcntrl])
  12. if test $ac_cv_func_iswcntrl = yes; then
  13. HAVE_ISWCNTRL=1
  14. else
  15. HAVE_ISWCNTRL=0
  16. fi
  17. AC_SUBST([HAVE_ISWCNTRL])
  18. AC_CHECK_HEADERS_ONCE([wctype.h])
  19. AC_REQUIRE([AC_C_INLINE])
  20. AC_REQUIRE([gt_TYPE_WINT_T])
  21. if test $gt_cv_c_wint_t = yes; then
  22. HAVE_WINT_T=1
  23. else
  24. HAVE_WINT_T=0
  25. fi
  26. AC_SUBST([HAVE_WINT_T])
  27. WCTYPE_H=wctype.h
  28. if test $ac_cv_header_wctype_h = yes; then
  29. if test $ac_cv_func_iswcntrl = yes; then
  30. dnl Linux libc5 has an iswprint function that returns 0 for all arguments.
  31. dnl The other functions are likely broken in the same way.
  32. AC_CACHE_CHECK([whether iswcntrl works], [gl_cv_func_iswcntrl_works],
  33. [
  34. AC_TRY_RUN([#include <stddef.h>
  35. #include <stdio.h>
  36. #include <time.h>
  37. #include <wchar.h>
  38. #include <wctype.h>
  39. int main () { return iswprint ('x') == 0; }],
  40. [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no],
  41. [AC_TRY_COMPILE([#include <stdlib.h>
  42. #if __GNU_LIBRARY__ == 1
  43. Linux libc5 i18n is broken.
  44. #endif], [],
  45. [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no])
  46. ])
  47. ])
  48. if test $gl_cv_func_iswcntrl_works = yes; then
  49. WCTYPE_H=
  50. fi
  51. fi
  52. dnl Compute NEXT_WCTYPE_H even if WCTYPE_H is empty,
  53. dnl for the benefit of builds from non-distclean directories.
  54. gl_CHECK_NEXT_HEADERS([wctype.h])
  55. HAVE_WCTYPE_H=1
  56. else
  57. HAVE_WCTYPE_H=0
  58. fi
  59. AC_SUBST([HAVE_WCTYPE_H])
  60. AC_SUBST([WCTYPE_H])
  61. if test "$gl_cv_func_iswcntrl_works" = no; then
  62. REPLACE_ISWCNTRL=1
  63. else
  64. REPLACE_ISWCNTRL=0
  65. fi
  66. AC_SUBST([REPLACE_ISWCNTRL])
  67. ])