limits-h.m4 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 WORD_BIT, BOOL_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. int bw = BOOL_WIDTH;
  22. ]])],
  23. [gl_cv_header_limits_width=yes],
  24. [gl_cv_header_limits_width=no])])
  25. if test "$gl_cv_header_limits_width" = yes; then
  26. LIMITS_H=
  27. else
  28. LIMITS_H=limits.h
  29. fi
  30. AC_SUBST([LIMITS_H])
  31. AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"])
  32. ])
  33. dnl Unconditionally enables the replacement of <limits.h>.
  34. AC_DEFUN([gl_REPLACE_LIMITS_H],
  35. [
  36. AC_REQUIRE([gl_LIMITS_H])
  37. LIMITS_H='limits.h'
  38. AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"])
  39. ])