limits-h.m4 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. dnl Check whether limits.h has needed features.
  2. dnl Copyright 2016-2021 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 From Paul Eggert.
  7. AC_DEFUN_ONCE([gl_LIMITS_H],
  8. [
  9. gl_CHECK_NEXT_HEADERS([limits.h])
  10. AC_CACHE_CHECK([whether limits.h has LLONG_MAX, WORD_BIT, ULLONG_WIDTH etc.],
  11. [gl_cv_header_limits_width],
  12. [AC_COMPILE_IFELSE(
  13. [AC_LANG_PROGRAM(
  14. [[#ifndef __STDC_WANT_IEC_60559_BFP_EXT__
  15. #define __STDC_WANT_IEC_60559_BFP_EXT__ 1
  16. #endif
  17. #include <limits.h>
  18. long long llm = LLONG_MAX;
  19. int wb = WORD_BIT;
  20. int ullw = ULLONG_WIDTH;
  21. ]])],
  22. [gl_cv_header_limits_width=yes],
  23. [gl_cv_header_limits_width=no])])
  24. if test "$gl_cv_header_limits_width" = yes; then
  25. LIMITS_H=
  26. else
  27. LIMITS_H=limits.h
  28. fi
  29. AC_SUBST([LIMITS_H])
  30. AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"])
  31. ])
  32. dnl Unconditionally enables the replacement of <limits.h>.
  33. AC_DEFUN([gl_REPLACE_LIMITS_H],
  34. [
  35. AC_REQUIRE([gl_LIMITS_H])
  36. LIMITS_H='limits.h'
  37. AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"])
  38. ])