mbstate_t.m4 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # serial 5
  2. # From Paul Eggert.
  3. # Some versions of BeOS define mbstate_t to be an incomplete type,
  4. # so you can't declare an object of that type.
  5. # Check for this incompatibility with Standard C.
  6. # Include stdlib.h first, because otherwise this test would fail on Linux
  7. # (at least glibc-2.1.3) because the `_XOPEN_SOURCE 500' definition elicits
  8. # a syntax error in wchar.h due to the use of undefined __int32_t.
  9. AC_DEFUN(AC_MBSTATE_T_OBJECT,
  10. [
  11. AC_CHECK_HEADERS(stdlib.h)
  12. AC_CACHE_CHECK([for mbstate_t], ac_cv_type_mbstate_t,
  13. [AC_TRY_COMPILE([
  14. #if HAVE_STDLIB_H
  15. # include <stdlib.h>
  16. #endif
  17. #include <wchar.h>],
  18. [mbstate_t *x; return sizeof x;],
  19. ac_cv_type_mbstate_t=yes,
  20. ac_cv_type_mbstate_t=no)])
  21. if test $ac_cv_type_mbstate_t != yes; then
  22. AC_DEFINE(mbstate_t, int,
  23. [Define to int if <wchar.h> does not define.])
  24. fi
  25. AC_CACHE_CHECK([for mbstate_t object type], ac_cv_type_mbstate_t_object,
  26. [AC_TRY_COMPILE([
  27. #if HAVE_STDLIB_H
  28. # include <stdlib.h>
  29. #endif
  30. #include <wchar.h>],
  31. [mbstate_t x; return sizeof x;],
  32. ac_cv_type_mbstate_t_object=yes,
  33. ac_cv_type_mbstate_t_object=no)])
  34. if test $ac_cv_type_mbstate_t_object = yes; then
  35. AC_DEFINE(HAVE_MBSTATE_T_OBJECT, 1,
  36. [Define if mbstate_t is an object type.])
  37. fi])