Blame m4/limits-h.m4

Packit aea12f
dnl Check whether limits.h has needed features.
Packit aea12f
Packit Service 991b93
dnl Copyright 2016-2020 Free Software Foundation, Inc.
Packit aea12f
dnl This file is free software; the Free Software Foundation
Packit aea12f
dnl gives unlimited permission to copy and/or distribute it,
Packit aea12f
dnl with or without modifications, as long as this notice is preserved.
Packit aea12f
Packit aea12f
dnl From Paul Eggert.
Packit aea12f
Packit aea12f
AC_DEFUN_ONCE([gl_LIMITS_H],
Packit aea12f
[
Packit aea12f
  gl_CHECK_NEXT_HEADERS([limits.h])
Packit aea12f
Packit aea12f
  AC_CACHE_CHECK([whether limits.h has LLONG_MAX, WORD_BIT, ULLONG_WIDTH etc.],
Packit aea12f
    [gl_cv_header_limits_width],
Packit aea12f
    [AC_COMPILE_IFELSE(
Packit aea12f
       [AC_LANG_PROGRAM(
Packit aea12f
          [[#ifndef __STDC_WANT_IEC_60559_BFP_EXT__
Packit aea12f
             #define __STDC_WANT_IEC_60559_BFP_EXT__ 1
Packit aea12f
            #endif
Packit aea12f
            #include <limits.h>
Packit aea12f
            long long llm = LLONG_MAX;
Packit aea12f
            int wb = WORD_BIT;
Packit aea12f
            int ullw = ULLONG_WIDTH;
Packit aea12f
          ]])],
Packit aea12f
       [gl_cv_header_limits_width=yes],
Packit aea12f
       [gl_cv_header_limits_width=no])])
Packit aea12f
  if test "$gl_cv_header_limits_width" = yes; then
Packit aea12f
    LIMITS_H=
Packit aea12f
  else
Packit aea12f
    LIMITS_H=limits.h
Packit aea12f
  fi
Packit aea12f
  AC_SUBST([LIMITS_H])
Packit aea12f
  AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"])
Packit aea12f
])
Packit aea12f
Packit aea12f
dnl Unconditionally enables the replacement of <limits.h>.
Packit aea12f
AC_DEFUN([gl_REPLACE_LIMITS_H],
Packit aea12f
[
Packit aea12f
  AC_REQUIRE([gl_LIMITS_H])
Packit aea12f
  LIMITS_H='limits.h'
Packit aea12f
  AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"])
Packit aea12f
])