wchar.m4 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
  2. dnl Copyright (C) 2007-2009 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 Written by Eric Blake.
  7. # wchar.m4 serial 23
  8. AC_DEFUN([gl_WCHAR_H],
  9. [
  10. AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
  11. AC_CACHE_CHECK([whether <wchar.h> is standalone],
  12. [gl_cv_header_wchar_h_standalone],
  13. [AC_COMPILE_IFELSE([[#include <wchar.h>
  14. wchar_t w;]],
  15. [gl_cv_header_wchar_h_standalone=yes],
  16. [gl_cv_header_wchar_h_standalone=no])])
  17. AC_REQUIRE([gt_TYPE_WINT_T])
  18. if test $gt_cv_c_wint_t = yes; then
  19. HAVE_WINT_T=1
  20. else
  21. HAVE_WINT_T=0
  22. fi
  23. AC_SUBST([HAVE_WINT_T])
  24. if test $gl_cv_header_wchar_h_standalone != yes || test $gt_cv_c_wint_t != yes; then
  25. WCHAR_H=wchar.h
  26. fi
  27. dnl Prepare for creating substitute <wchar.h>.
  28. dnl Do it always: WCHAR_H may be empty here but can be set later.
  29. dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
  30. dnl character support).
  31. AC_CHECK_HEADERS_ONCE([wchar.h])
  32. if test $ac_cv_header_wchar_h = yes; then
  33. HAVE_WCHAR_H=1
  34. else
  35. HAVE_WCHAR_H=0
  36. fi
  37. AC_SUBST([HAVE_WCHAR_H])
  38. gl_CHECK_NEXT_HEADERS([wchar.h])
  39. ])
  40. dnl Unconditionally enables the replacement of <wchar.h>.
  41. AC_DEFUN([gl_REPLACE_WCHAR_H],
  42. [
  43. AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
  44. WCHAR_H=wchar.h
  45. ])
  46. AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
  47. [
  48. dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
  49. AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
  50. GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
  51. ])
  52. AC_DEFUN([gl_WCHAR_H_DEFAULTS],
  53. [
  54. GNULIB_BTOWC=0; AC_SUBST([GNULIB_BTOWC])
  55. GNULIB_WCTOB=0; AC_SUBST([GNULIB_WCTOB])
  56. GNULIB_MBSINIT=0; AC_SUBST([GNULIB_MBSINIT])
  57. GNULIB_MBRTOWC=0; AC_SUBST([GNULIB_MBRTOWC])
  58. GNULIB_MBRLEN=0; AC_SUBST([GNULIB_MBRLEN])
  59. GNULIB_MBSRTOWCS=0; AC_SUBST([GNULIB_MBSRTOWCS])
  60. GNULIB_MBSNRTOWCS=0; AC_SUBST([GNULIB_MBSNRTOWCS])
  61. GNULIB_WCRTOMB=0; AC_SUBST([GNULIB_WCRTOMB])
  62. GNULIB_WCSRTOMBS=0; AC_SUBST([GNULIB_WCSRTOMBS])
  63. GNULIB_WCSNRTOMBS=0; AC_SUBST([GNULIB_WCSNRTOMBS])
  64. GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH])
  65. dnl Assume proper GNU behavior unless another module says otherwise.
  66. HAVE_BTOWC=1; AC_SUBST([HAVE_BTOWC])
  67. HAVE_MBSINIT=1; AC_SUBST([HAVE_MBSINIT])
  68. HAVE_MBRTOWC=1; AC_SUBST([HAVE_MBRTOWC])
  69. HAVE_MBRLEN=1; AC_SUBST([HAVE_MBRLEN])
  70. HAVE_MBSRTOWCS=1; AC_SUBST([HAVE_MBSRTOWCS])
  71. HAVE_MBSNRTOWCS=1; AC_SUBST([HAVE_MBSNRTOWCS])
  72. HAVE_WCRTOMB=1; AC_SUBST([HAVE_WCRTOMB])
  73. HAVE_WCSRTOMBS=1; AC_SUBST([HAVE_WCSRTOMBS])
  74. HAVE_WCSNRTOMBS=1; AC_SUBST([HAVE_WCSNRTOMBS])
  75. HAVE_DECL_WCTOB=1; AC_SUBST([HAVE_DECL_WCTOB])
  76. HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH])
  77. REPLACE_MBSTATE_T=0; AC_SUBST([REPLACE_MBSTATE_T])
  78. REPLACE_BTOWC=0; AC_SUBST([REPLACE_BTOWC])
  79. REPLACE_WCTOB=0; AC_SUBST([REPLACE_WCTOB])
  80. REPLACE_MBSINIT=0; AC_SUBST([REPLACE_MBSINIT])
  81. REPLACE_MBRTOWC=0; AC_SUBST([REPLACE_MBRTOWC])
  82. REPLACE_MBRLEN=0; AC_SUBST([REPLACE_MBRLEN])
  83. REPLACE_MBSRTOWCS=0; AC_SUBST([REPLACE_MBSRTOWCS])
  84. REPLACE_MBSNRTOWCS=0; AC_SUBST([REPLACE_MBSNRTOWCS])
  85. REPLACE_WCRTOMB=0; AC_SUBST([REPLACE_WCRTOMB])
  86. REPLACE_WCSRTOMBS=0; AC_SUBST([REPLACE_WCSRTOMBS])
  87. REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS])
  88. REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH])
  89. WCHAR_H=''; AC_SUBST([WCHAR_H])
  90. ])