wchar.m4 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
  2. dnl Copyright (C) 2007 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 4
  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. if test $gl_cv_header_wchar_h_standalone != yes; then
  18. WCHAR_H=wchar.h
  19. fi
  20. dnl Prepare for creating substitute <wchar.h>.
  21. dnl Do it always: WCHAR_H may be empty here but can be set later.
  22. dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
  23. dnl character support).
  24. AC_CHECK_HEADERS_ONCE([wchar.h])
  25. if test $ac_cv_header_wchar_h = yes; then
  26. HAVE_WCHAR_H=1
  27. else
  28. HAVE_WCHAR_H=0
  29. fi
  30. AC_SUBST([HAVE_WCHAR_H])
  31. gl_CHECK_NEXT_HEADERS([wchar.h])
  32. ])
  33. AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
  34. [
  35. dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
  36. AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
  37. GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
  38. ])
  39. AC_DEFUN([gl_WCHAR_H_DEFAULTS],
  40. [
  41. GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH])
  42. dnl Assume proper GNU behavior unless another module says otherwise.
  43. HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH])
  44. REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH])
  45. WCHAR_H=
  46. AC_SUBST([WCHAR_H])
  47. ])