Collection of DPF-based plugins for packaging
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.7KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_decl_wchar_max.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_DECL_WCHAR_MAX
  8. #
  9. # DESCRIPTION
  10. #
  11. # Checks whether the system headers define WCHAR_MAX or not. If it is
  12. # already defined, does nothing. Otherwise checks the size and signedness
  13. # of `wchar_t', and defines WCHAR_MAX to the maximum value that can be
  14. # stored in a variable of type `wchar_t'.
  15. #
  16. # LICENSE
  17. #
  18. # Copyright (c) 2008 Ville Laurikari <vl@iki.fi>
  19. #
  20. # Copying and distribution of this file, with or without modification, are
  21. # permitted in any medium without royalty provided the copyright notice
  22. # and this notice are preserved. This file is offered as-is, without any
  23. # warranty.
  24. #serial 7
  25. AU_ALIAS([VL_DECL_WCHAR_MAX], [AX_DECL_WCHAR_MAX])
  26. AC_DEFUN([AX_DECL_WCHAR_MAX], [
  27. AC_CACHE_CHECK([whether WCHAR_MAX is defined], ax_cv_decl_wchar_max, [
  28. AC_TRY_COMPILE([
  29. #ifdef HAVE_WCHAR_H
  30. #include <wchar.h>
  31. #endif
  32. ],[WCHAR_MAX],[ax_cv_decl_wchar_max="yes"],[ax_cv_decl_wchar_max="no"])])
  33. if test $ax_cv_decl_wchar_max = "no"; then
  34. AX_CHECK_SIGN([wchar_t],
  35. [ wc_signed="yes"
  36. AC_DEFINE(WCHAR_T_SIGNED, 1, [Define if wchar_t is signed]) ],
  37. [ wc_signed="no"
  38. AC_DEFINE(WCHAR_T_UNSIGNED, 1, [Define if wchar_t is unsigned])], [
  39. #ifdef HAVE_WCHAR_H
  40. #include <wchar.h>
  41. #endif
  42. ])
  43. if test "$wc_signed" = "yes"; then
  44. AC_DEFINE(WCHAR_MAX, [(1L << (sizeof(wchar_t) * 8 - 1) - 1)], [
  45. Define to the maximum value of wchar_t if not already defined elsewhere])
  46. elif test "$wc_signed" = "no"; then
  47. AC_DEFINE(WCHAR_MAX, [(1L << (sizeof(wchar_t) * 8) - 1)])
  48. fi
  49. fi
  50. ])dnl