mbsinit.m4 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # mbsinit.m4 serial 8
  2. dnl Copyright (C) 2008, 2010-2013 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. AC_DEFUN([gl_FUNC_MBSINIT],
  7. [
  8. AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
  9. AC_REQUIRE([AC_CANONICAL_HOST])
  10. AC_REQUIRE([AC_TYPE_MBSTATE_T])
  11. gl_MBSTATE_T_BROKEN
  12. AC_CHECK_FUNCS_ONCE([mbsinit])
  13. if test $ac_cv_func_mbsinit = no; then
  14. HAVE_MBSINIT=0
  15. AC_CHECK_DECLS([mbsinit],,, [[
  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
  19. included before <wchar.h>. */
  20. #include <stddef.h>
  21. #include <stdio.h>
  22. #include <time.h>
  23. #include <wchar.h>
  24. ]])
  25. if test $ac_cv_have_decl_mbsinit = yes; then
  26. dnl On Minix 3.1.8, the system's <wchar.h> declares mbsinit() although
  27. dnl it does not have the function. Avoid a collision with gnulib's
  28. dnl replacement.
  29. REPLACE_MBSINIT=1
  30. fi
  31. else
  32. if test $REPLACE_MBSTATE_T = 1; then
  33. REPLACE_MBSINIT=1
  34. else
  35. dnl On mingw, mbsinit() always returns 1, which is inappropriate for
  36. dnl states produced by mbrtowc() for an incomplete multibyte character
  37. dnl in multibyte locales.
  38. case "$host_os" in
  39. mingw*) REPLACE_MBSINIT=1 ;;
  40. esac
  41. fi
  42. fi
  43. ])
  44. # Prerequisites of lib/mbsinit.c.
  45. AC_DEFUN([gl_PREREQ_MBSINIT], [
  46. :
  47. ])