Debian Codegraph @

tools/gnulib/m4/limits-h.m4

raw
1 # limits-h.m4
2 # serial 1
3 dnl Copyright 2016-2024 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7
8 dnl Check whether limits.h has needed features.
9
10 dnl From Paul Eggert.
11
12 AC_DEFUN_ONCE([gl_LIMITS_H],
13 [
14 gl_CHECK_NEXT_HEADERS([limits.h])
15
16 AC_CACHE_CHECK([whether limits.h has WORD_BIT, BOOL_WIDTH etc.],
17 [gl_cv_header_limits_width],
18 [AC_COMPILE_IFELSE(
19 [AC_LANG_PROGRAM(
20 [[#ifndef __STDC_WANT_IEC_60559_BFP_EXT__
21 #define __STDC_WANT_IEC_60559_BFP_EXT__ 1
22 #endif
23 #include <limits.h>
24 long long llm = LLONG_MAX;
25 int wb = WORD_BIT;
26 int ullw = ULLONG_WIDTH;
27 int bw = BOOL_WIDTH;
28 int bm = BOOL_MAX;
29 int mblm = MB_LEN_MAX;
30 ]])],
31 [gl_cv_header_limits_width=yes],
32 [gl_cv_header_limits_width=no])])
33 GL_GENERATE_LIMITS_H=true
34 AS_IF([test "$gl_cv_header_limits_width" = yes],
35 [AC_CACHE_CHECK([whether limits.h has SSIZE_MAX],
36 [gl_cv_header_limits_ssize_max],
37 [AC_COMPILE_IFELSE(
38 [AC_LANG_SOURCE(
39 [[#include <limits.h>
40 #ifndef SSIZE_MAX
41 #error "SSIZE_MAX is not defined"
42 #endif
43 ]])],
44 [gl_cv_header_limits_ssize_max=yes],
45 [gl_cv_header_limits_ssize_max=no])])
46 if test "$gl_cv_header_limits_ssize_max" = yes; then
47 GL_GENERATE_LIMITS_H=false
48 fi])
49 ])
50
51 dnl Unconditionally enables the replacement of <limits.h>.
52 AC_DEFUN([gl_REPLACE_LIMITS_H],
53 [
54 AC_REQUIRE([gl_LIMITS_H])
55 GL_GENERATE_LIMITS_H=true
56 ])