summaryrefslogtreecommitdiffstats
path: root/gl/m4/c-bool.m4
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-12-28 12:13:40 +0100
committerLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-12-28 12:13:40 +0100
commitb0afb8fe0ff1d87165af9df61501197a06240dda (patch)
tree274ac6a96c53ef4c19ab4974ce24a06a233128c5 /gl/m4/c-bool.m4
parent68fc05381ee5fa0aee1413118fbb3d81ca888b09 (diff)
downloadmonitoring-plugins-b0afb8fe0ff1d87165af9df61501197a06240dda.tar.gz
Sync with Gnulib stable-202507 code (a8ac9f9ce5)
Diffstat (limited to 'gl/m4/c-bool.m4')
-rw-r--r--gl/m4/c-bool.m420
1 files changed, 16 insertions, 4 deletions
diff --git a/gl/m4/c-bool.m4 b/gl/m4/c-bool.m4
index 0fb0de3b..8fa8bfc8 100644
--- a/gl/m4/c-bool.m4
+++ b/gl/m4/c-bool.m4
@@ -1,9 +1,10 @@
1# c-bool.m4 1# c-bool.m4
2# serial 1 2# serial 3
3dnl Copyright 2022-2024 Free Software Foundation, Inc. 3dnl Copyright 2022-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Check for bool that conforms to C2023. 9# Check for bool that conforms to C2023.
9 10
@@ -29,12 +30,23 @@ AC_DEFUN([gl_C_BOOL],
29 dnl The "zz" puts this toward config.h's end, to avoid potential 30 dnl The "zz" puts this toward config.h's end, to avoid potential
30 dnl collisions with other definitions. 31 dnl collisions with other definitions.
31 dnl If 'bool', 'true' and 'false' do not work, arrange for them to work. 32 dnl If 'bool', 'true' and 'false' do not work, arrange for them to work.
32 dnl In C, this means including <stdbool.h> if it is not already included. 33 dnl Hardcode the known configuration results for GCC and clang, so that
34 dnl a configuration made with the C compiler works also with the C++ compiler
35 dnl and vice versa.
36 dnl The seemingly redundant parentheses are necessary for MSVC 14.
37 dnl "Arrange for them to work", in C, means including <stdbool.h> if it is
38 dnl not already included.
33 dnl However, if the preprocessor mistakenly treats 'true' as 0, 39 dnl However, if the preprocessor mistakenly treats 'true' as 0,
34 dnl define it to a bool expression equal to 1; this is needed in 40 dnl define it to a bool expression equal to 1; this is needed in
35 dnl Sun C++ 5.11 (Oracle Solaris Studio 12.2, 2010) and older. 41 dnl Sun C++ 5.11 (Oracle Solaris Studio 12.2, 2010) and older.
36 AH_VERBATIM([zzbool], 42 AH_VERBATIM([zzbool],
37[#ifndef HAVE_C_BOOL 43[#if !(defined __cplusplus \
44 ? 1 \
45 : (defined __clang__ \
46 ? __STDC_VERSION__ >= 202000L && __clang_major__ >= 15 \
47 : (defined __GNUC__ \
48 ? __STDC_VERSION__ >= 202000L && __GNUC__ >= 13 \
49 : defined HAVE_C_BOOL)))
38# if !defined __cplusplus && !defined __bool_true_false_are_defined 50# if !defined __cplusplus && !defined __bool_true_false_are_defined
39# if HAVE_STDBOOL_H 51# if HAVE_STDBOOL_H
40# include <stdbool.h> 52# include <stdbool.h>