Debian Codegraph @

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 dnl This file is offered as-is, without any warranty.
8
9 dnl Check whether limits.h has needed features.
10
11 dnl From Paul Eggert.
12
13 AC_DEFUN_ONCE([gl_LIMITS_H],
14 [
15 gl_CHECK_NEXT_HEADERS([limits.h])
16
17 AC_CACHE_CHECK([whether limits.h has WORD_BIT, BOOL_WIDTH etc.],
18 [gl_cv_header_limits_width],
19 [AC_COMPILE_IFELSE(
20 [AC_LANG_PROGRAM(
21 [[#ifndef __STDC_WANT_IEC_60559_BFP_EXT__
22 #define __STDC_WANT_IEC_60559_BFP_EXT__ 1
23 #endif
24 #include <limits.h>
25 long long llm = LLONG_MAX;
26 int wb = WORD_BIT;
27 int ullw = ULLONG_WIDTH;
28 int bw = BOOL_WIDTH;
29 int bm = BOOL_MAX;
30 int mblm = MB_LEN_MAX;
31 ]])],
32 [gl_cv_header_limits_width=yes],
33 [gl_cv_header_limits_width=no])])
34 GL_GENERATE_LIMITS_H=true
35 AS_IF([test "$gl_cv_header_limits_width" = yes],
36 [AC_CACHE_CHECK([whether limits.h has SSIZE_MAX],
37 [gl_cv_header_limits_ssize_max],
38 [AC_COMPILE_IFELSE(
39 [AC_LANG_SOURCE(
40 [[#include <limits.h>
41 #ifndef SSIZE_MAX
42 #error "SSIZE_MAX is not defined"
43 #endif
44 ]])],
45 [gl_cv_header_limits_ssize_max=yes],
46 [gl_cv_header_limits_ssize_max=no])])
47 if test "$gl_cv_header_limits_ssize_max" = yes; then
48 GL_GENERATE_LIMITS_H=false
49 fi])
50 ])
51
52 dnl Unconditionally enables the replacement of <limits.h>.
53 AC_DEFUN([gl_REPLACE_LIMITS_H],
54 [
55 AC_REQUIRE([gl_LIMITS_H])
56 GL_GENERATE_LIMITS_H=true
57 ])