diff options
author | Lorenz <12514511+RincewindsHat@users.noreply.github.com> | 2023-02-10 10:43:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-10 10:43:20 (GMT) |
commit | c07206f2ccc2356aa74bc6813a94c2190017d44e (patch) | |
tree | 1677e5fdca5c3ce544e92c5484e16a0b68df1cc9 /gl/m4/extensions.m4 | |
parent | e92046f810658016b7c373677efefda3b21400e4 (diff) | |
parent | d2fcf49ad4afc15f37d082d7bc96a808369ec2d4 (diff) | |
download | monitoring-plugins-c07206f2ccc2356aa74bc6813a94c2190017d44e.tar.gz |
Merge pull request #1832 from RincewindsHat/gnulib_update_2023
Gnulib update 2023 and attendant fixes
Diffstat (limited to 'gl/m4/extensions.m4')
-rw-r--r-- | gl/m4/extensions.m4 | 214 |
1 files changed, 154 insertions, 60 deletions
diff --git a/gl/m4/extensions.m4 b/gl/m4/extensions.m4 index e30f122..5336b8d 100644 --- a/gl/m4/extensions.m4 +++ b/gl/m4/extensions.m4 | |||
@@ -1,14 +1,19 @@ | |||
1 | # serial 13 -*- Autoconf -*- | 1 | # serial 23 -*- Autoconf -*- |
2 | # Enable extensions on systems that normally disable them. | 2 | # Enable extensions on systems that normally disable them. |
3 | 3 | ||
4 | # Copyright (C) 2003, 2006-2013 Free Software Foundation, Inc. | 4 | # Copyright (C) 2003, 2006-2023 Free Software Foundation, Inc. |
5 | # This file is free software; the Free Software Foundation | 5 | # This file is free software; the Free Software Foundation |
6 | # gives unlimited permission to copy and/or distribute it, | 6 | # gives unlimited permission to copy and/or distribute it, |
7 | # with or without modifications, as long as this notice is preserved. | 7 | # with or without modifications, as long as this notice is preserved. |
8 | 8 | ||
9 | dnl Define to empty for the benefit of Autoconf 2.69 and earlier, so that | ||
10 | dnl AC_USE_SYSTEM_EXTENSIONS (below) can be used unchanged from Autoconf 2.70+. | ||
11 | m4_ifndef([AC_CHECK_INCLUDES_DEFAULT], | ||
12 | [AC_DEFUN([AC_CHECK_INCLUDES_DEFAULT], [])]) | ||
13 | |||
9 | # This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from git | 14 | # This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from git |
10 | # Autoconf. Perhaps we can remove this once we can assume Autoconf | 15 | # Autoconf. Perhaps we can remove this once we can assume Autoconf |
11 | # 2.70 or later everywhere, but since Autoconf mutates rapidly | 16 | # is recent-enough everywhere, but since Autoconf mutates rapidly |
12 | # enough in this area it's likely we'll need to redefine | 17 | # enough in this area it's likely we'll need to redefine |
13 | # AC_USE_SYSTEM_EXTENSIONS for quite some time. | 18 | # AC_USE_SYSTEM_EXTENSIONS for quite some time. |
14 | 19 | ||
@@ -26,67 +31,125 @@ | |||
26 | # its dependencies. This will ensure that the gl_USE_SYSTEM_EXTENSIONS | 31 | # its dependencies. This will ensure that the gl_USE_SYSTEM_EXTENSIONS |
27 | # invocation occurs in gl_EARLY, not in gl_INIT. | 32 | # invocation occurs in gl_EARLY, not in gl_INIT. |
28 | 33 | ||
34 | m4_version_prereq([2.72], [], [ | ||
35 | |||
29 | # AC_USE_SYSTEM_EXTENSIONS | 36 | # AC_USE_SYSTEM_EXTENSIONS |
30 | # ------------------------ | 37 | # ------------------------ |
31 | # Enable extensions on systems that normally disable them, | 38 | # Enable extensions on systems that normally disable them, |
32 | # typically due to standards-conformance issues. | 39 | # typically due to standards-conformance issues. |
33 | # | 40 | # We unconditionally define as many of the known feature-enabling |
34 | # Remember that #undef in AH_VERBATIM gets replaced with #define by | 41 | # as possible, reserving conditional behavior for macros that are |
35 | # AC_DEFINE. The goal here is to define all known feature-enabling | 42 | # known to cause problems on some platforms (such as __EXTENSIONS__). |
36 | # macros, then, if reports of conflicts are made, disable macros that | ||
37 | # cause problems on some platforms (such as __EXTENSIONS__). | ||
38 | AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS], | 43 | AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS], |
39 | [AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl | 44 | [AC_BEFORE([$0], [AC_PREPROC_IFELSE])dnl |
45 | AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl | ||
46 | AC_BEFORE([$0], [AC_LINK_IFELSE])dnl | ||
40 | AC_BEFORE([$0], [AC_RUN_IFELSE])dnl | 47 | AC_BEFORE([$0], [AC_RUN_IFELSE])dnl |
41 | 48 | AC_BEFORE([$0], [AC_CHECK_INCLUDES_DEFAULT])dnl | |
42 | AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=]) | 49 | dnl #undef in AH_VERBATIM gets replaced with #define by AC_DEFINE. |
43 | if test "$MINIX" = yes; then | ||
44 | AC_DEFINE([_POSIX_SOURCE], [1], | ||
45 | [Define to 1 if you need to in order for 'stat' and other | ||
46 | things to work.]) | ||
47 | AC_DEFINE([_POSIX_1_SOURCE], [2], | ||
48 | [Define to 2 if the system does not provide POSIX.1 features | ||
49 | except with this defined.]) | ||
50 | AC_DEFINE([_MINIX], [1], | ||
51 | [Define to 1 if on MINIX.]) | ||
52 | AC_DEFINE([_NETBSD_SOURCE], [1], | ||
53 | [Define to 1 to make NetBSD features available. MINIX 3 needs this.]) | ||
54 | fi | ||
55 | |||
56 | dnl Use a different key than __EXTENSIONS__, as that name broke existing | 50 | dnl Use a different key than __EXTENSIONS__, as that name broke existing |
57 | dnl configure.ac when using autoheader 2.62. | 51 | dnl configure.ac when using autoheader 2.62. |
58 | AH_VERBATIM([USE_SYSTEM_EXTENSIONS], | 52 | dnl The macros below are in alphabetical order ignoring leading _ or __ |
53 | dnl prefixes. | ||
54 | AH_VERBATIM([USE_SYSTEM_EXTENSIONS], | ||
59 | [/* Enable extensions on AIX 3, Interix. */ | 55 | [/* Enable extensions on AIX 3, Interix. */ |
60 | #ifndef _ALL_SOURCE | 56 | #ifndef _ALL_SOURCE |
61 | # undef _ALL_SOURCE | 57 | # undef _ALL_SOURCE |
62 | #endif | 58 | #endif |
63 | /* Enable general extensions on OS X. */ | 59 | /* Enable general extensions on macOS. */ |
64 | #ifndef _DARWIN_C_SOURCE | 60 | #ifndef _DARWIN_C_SOURCE |
65 | # undef _DARWIN_C_SOURCE | 61 | # undef _DARWIN_C_SOURCE |
66 | #endif | 62 | #endif |
63 | /* Enable general extensions on Solaris. */ | ||
64 | #ifndef __EXTENSIONS__ | ||
65 | # undef __EXTENSIONS__ | ||
66 | #endif | ||
67 | /* Enable GNU extensions on systems that have them. */ | 67 | /* Enable GNU extensions on systems that have them. */ |
68 | #ifndef _GNU_SOURCE | 68 | #ifndef _GNU_SOURCE |
69 | # undef _GNU_SOURCE | 69 | # undef _GNU_SOURCE |
70 | #endif | 70 | #endif |
71 | /* Enable threading extensions on Solaris. */ | 71 | /* Enable X/Open compliant socket functions that do not require linking |
72 | with -lxnet on HP-UX 11.11. */ | ||
73 | #ifndef _HPUX_ALT_XOPEN_SOCKET_API | ||
74 | # undef _HPUX_ALT_XOPEN_SOCKET_API | ||
75 | #endif | ||
76 | /* Identify the host operating system as Minix. | ||
77 | This macro does not affect the system headers' behavior. | ||
78 | A future release of Autoconf may stop defining this macro. */ | ||
79 | #ifndef _MINIX | ||
80 | # undef _MINIX | ||
81 | #endif | ||
82 | /* Enable general extensions on NetBSD. | ||
83 | Enable NetBSD compatibility extensions on Minix. */ | ||
84 | #ifndef _NETBSD_SOURCE | ||
85 | # undef _NETBSD_SOURCE | ||
86 | #endif | ||
87 | /* Enable OpenBSD compatibility extensions on NetBSD. | ||
88 | Oddly enough, this does nothing on OpenBSD. */ | ||
89 | #ifndef _OPENBSD_SOURCE | ||
90 | # undef _OPENBSD_SOURCE | ||
91 | #endif | ||
92 | /* Define to 1 if needed for POSIX-compatible behavior. */ | ||
93 | #ifndef _POSIX_SOURCE | ||
94 | # undef _POSIX_SOURCE | ||
95 | #endif | ||
96 | /* Define to 2 if needed for POSIX-compatible behavior. */ | ||
97 | #ifndef _POSIX_1_SOURCE | ||
98 | # undef _POSIX_1_SOURCE | ||
99 | #endif | ||
100 | /* Enable POSIX-compatible threading on Solaris. */ | ||
72 | #ifndef _POSIX_PTHREAD_SEMANTICS | 101 | #ifndef _POSIX_PTHREAD_SEMANTICS |
73 | # undef _POSIX_PTHREAD_SEMANTICS | 102 | # undef _POSIX_PTHREAD_SEMANTICS |
74 | #endif | 103 | #endif |
104 | /* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ | ||
105 | #ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ | ||
106 | # undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ | ||
107 | #endif | ||
108 | /* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ | ||
109 | #ifndef __STDC_WANT_IEC_60559_BFP_EXT__ | ||
110 | # undef __STDC_WANT_IEC_60559_BFP_EXT__ | ||
111 | #endif | ||
112 | /* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ | ||
113 | #ifndef __STDC_WANT_IEC_60559_DFP_EXT__ | ||
114 | # undef __STDC_WANT_IEC_60559_DFP_EXT__ | ||
115 | #endif | ||
116 | /* Enable extensions specified by C23 Annex F. */ | ||
117 | #ifndef __STDC_WANT_IEC_60559_EXT__ | ||
118 | # undef __STDC_WANT_IEC_60559_EXT__ | ||
119 | #endif | ||
120 | /* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ | ||
121 | #ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ | ||
122 | # undef __STDC_WANT_IEC_60559_FUNCS_EXT__ | ||
123 | #endif | ||
124 | /* Enable extensions specified by C23 Annex H and ISO/IEC TS 18661-3:2015. */ | ||
125 | #ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ | ||
126 | # undef __STDC_WANT_IEC_60559_TYPES_EXT__ | ||
127 | #endif | ||
128 | /* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ | ||
129 | #ifndef __STDC_WANT_LIB_EXT2__ | ||
130 | # undef __STDC_WANT_LIB_EXT2__ | ||
131 | #endif | ||
132 | /* Enable extensions specified by ISO/IEC 24747:2009. */ | ||
133 | #ifndef __STDC_WANT_MATH_SPEC_FUNCS__ | ||
134 | # undef __STDC_WANT_MATH_SPEC_FUNCS__ | ||
135 | #endif | ||
75 | /* Enable extensions on HP NonStop. */ | 136 | /* Enable extensions on HP NonStop. */ |
76 | #ifndef _TANDEM_SOURCE | 137 | #ifndef _TANDEM_SOURCE |
77 | # undef _TANDEM_SOURCE | 138 | # undef _TANDEM_SOURCE |
78 | #endif | 139 | #endif |
79 | /* Enable X/Open extensions if necessary. HP-UX 11.11 defines | 140 | /* Enable X/Open extensions. Define to 500 only if necessary |
80 | mbstate_t only if _XOPEN_SOURCE is defined to 500, regardless of | 141 | to make mbstate_t available. */ |
81 | whether compiling with -Ae or -D_HPUX_SOURCE=1. */ | ||
82 | #ifndef _XOPEN_SOURCE | 142 | #ifndef _XOPEN_SOURCE |
83 | # undef _XOPEN_SOURCE | 143 | # undef _XOPEN_SOURCE |
84 | #endif | 144 | #endif |
85 | /* Enable general extensions on Solaris. */ | 145 | ])dnl |
86 | #ifndef __EXTENSIONS__ | 146 | |
87 | # undef __EXTENSIONS__ | 147 | AC_REQUIRE([AC_CHECK_INCLUDES_DEFAULT])dnl |
88 | #endif | 148 | _AC_CHECK_HEADER_ONCE([wchar.h]) |
89 | ]) | 149 | _AC_CHECK_HEADER_ONCE([minix/config.h]) |
150 | |||
151 | dnl Defining __EXTENSIONS__ may break the system headers on some systems. | ||
152 | dnl (FIXME: Which ones?) | ||
90 | AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], | 153 | AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], |
91 | [ac_cv_safe_to_define___extensions__], | 154 | [ac_cv_safe_to_define___extensions__], |
92 | [AC_COMPILE_IFELSE( | 155 | [AC_COMPILE_IFELSE( |
@@ -95,30 +158,57 @@ dnl configure.ac when using autoheader 2.62. | |||
95 | ]AC_INCLUDES_DEFAULT])], | 158 | ]AC_INCLUDES_DEFAULT])], |
96 | [ac_cv_safe_to_define___extensions__=yes], | 159 | [ac_cv_safe_to_define___extensions__=yes], |
97 | [ac_cv_safe_to_define___extensions__=no])]) | 160 | [ac_cv_safe_to_define___extensions__=no])]) |
98 | test $ac_cv_safe_to_define___extensions__ = yes && | 161 | |
99 | AC_DEFINE([__EXTENSIONS__]) | 162 | dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to |
100 | AC_DEFINE([_ALL_SOURCE]) | 163 | dnl 500, regardless of whether compiling with -Ae or -D_HPUX_SOURCE=1. |
101 | AC_DEFINE([_DARWIN_C_SOURCE]) | 164 | dnl But defining _XOPEN_SOURCE may turn *off* extensions on platforms |
102 | AC_DEFINE([_GNU_SOURCE]) | 165 | dnl not covered by turn-on-extensions macros (notably Dragonfly, Free, |
103 | AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) | 166 | dnl and OpenBSD, which don't have any equivalent of _NETBSD_SOURCE) so |
104 | AC_DEFINE([_TANDEM_SOURCE]) | 167 | dnl it should only be defined when necessary. |
105 | AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined], | 168 | AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined], |
106 | [ac_cv_should_define__xopen_source], | 169 | [ac_cv_should_define__xopen_source], |
107 | [ac_cv_should_define__xopen_source=no | 170 | [ac_cv_should_define__xopen_source=no |
108 | AC_COMPILE_IFELSE( | 171 | AS_IF([test $ac_cv_header_wchar_h = yes], |
109 | [AC_LANG_PROGRAM([[ | 172 | [AC_COMPILE_IFELSE( |
173 | [AC_LANG_PROGRAM([[ | ||
110 | #include <wchar.h> | 174 | #include <wchar.h> |
111 | mbstate_t x;]])], | 175 | mbstate_t x;]])], |
112 | [], | 176 | [], |
113 | [AC_COMPILE_IFELSE( | 177 | [AC_COMPILE_IFELSE( |
114 | [AC_LANG_PROGRAM([[ | 178 | [AC_LANG_PROGRAM([[ |
115 | #define _XOPEN_SOURCE 500 | 179 | #define _XOPEN_SOURCE 500 |
116 | #include <wchar.h> | 180 | #include <wchar.h> |
117 | mbstate_t x;]])], | 181 | mbstate_t x;]])], |
118 | [ac_cv_should_define__xopen_source=yes])])]) | 182 | [ac_cv_should_define__xopen_source=yes])])])]) |
119 | test $ac_cv_should_define__xopen_source = yes && | 183 | |
120 | AC_DEFINE([_XOPEN_SOURCE], [500]) | 184 | AC_DEFINE([_ALL_SOURCE]) |
185 | AC_DEFINE([_DARWIN_C_SOURCE]) | ||
186 | AC_DEFINE([_GNU_SOURCE]) | ||
187 | AC_DEFINE([_HPUX_ALT_XOPEN_SOCKET_API]) | ||
188 | AC_DEFINE([_NETBSD_SOURCE]) | ||
189 | AC_DEFINE([_OPENBSD_SOURCE]) | ||
190 | AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) | ||
191 | AC_DEFINE([__STDC_WANT_IEC_60559_ATTRIBS_EXT__]) | ||
192 | AC_DEFINE([__STDC_WANT_IEC_60559_BFP_EXT__]) | ||
193 | AC_DEFINE([__STDC_WANT_IEC_60559_DFP_EXT__]) | ||
194 | AC_DEFINE([__STDC_WANT_IEC_60559_EXT__]) | ||
195 | AC_DEFINE([__STDC_WANT_IEC_60559_FUNCS_EXT__]) | ||
196 | AC_DEFINE([__STDC_WANT_IEC_60559_TYPES_EXT__]) | ||
197 | AC_DEFINE([__STDC_WANT_LIB_EXT2__]) | ||
198 | AC_DEFINE([__STDC_WANT_MATH_SPEC_FUNCS__]) | ||
199 | AC_DEFINE([_TANDEM_SOURCE]) | ||
200 | AS_IF([test $ac_cv_header_minix_config_h = yes], | ||
201 | [MINIX=yes | ||
202 | AC_DEFINE([_MINIX]) | ||
203 | AC_DEFINE([_POSIX_SOURCE]) | ||
204 | AC_DEFINE([_POSIX_1_SOURCE], [2])], | ||
205 | [MINIX=]) | ||
206 | AS_IF([test $ac_cv_safe_to_define___extensions__ = yes], | ||
207 | [AC_DEFINE([__EXTENSIONS__])]) | ||
208 | AS_IF([test $ac_cv_should_define__xopen_source = yes], | ||
209 | [AC_DEFINE([_XOPEN_SOURCE], [500])]) | ||
121 | ])# AC_USE_SYSTEM_EXTENSIONS | 210 | ])# AC_USE_SYSTEM_EXTENSIONS |
211 | ]) | ||
122 | 212 | ||
123 | # gl_USE_SYSTEM_EXTENSIONS | 213 | # gl_USE_SYSTEM_EXTENSIONS |
124 | # ------------------------ | 214 | # ------------------------ |
@@ -126,13 +216,17 @@ dnl configure.ac when using autoheader 2.62. | |||
126 | # typically due to standards-conformance issues. | 216 | # typically due to standards-conformance issues. |
127 | AC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS], | 217 | AC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS], |
128 | [ | 218 | [ |
129 | dnl Require this macro before AC_USE_SYSTEM_EXTENSIONS. | ||
130 | dnl gnulib does not need it. But if it gets required by third-party macros | ||
131 | dnl after AC_USE_SYSTEM_EXTENSIONS is required, autoconf 2.62..2.63 emit a | ||
132 | dnl warning: "AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS". | ||
133 | dnl Note: We can do this only for one of the macros AC_AIX, AC_GNU_SOURCE, | ||
134 | dnl AC_MINIX. If people still use AC_AIX or AC_MINIX, they are out of luck. | ||
135 | AC_REQUIRE([AC_GNU_SOURCE]) | ||
136 | |||
137 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) | 219 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) |
220 | |||
221 | dnl On OpenBSD 6.8 with GCC, the include files contain a couple of | ||
222 | dnl definitions that are only activated with an explicit -D_ISOC11_SOURCE. | ||
223 | dnl That's because this version of GCC (4.2.1) supports the option | ||
224 | dnl '-std=gnu99' but not the option '-std=gnu11'. | ||
225 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
226 | case "$host_os" in | ||
227 | openbsd*) | ||
228 | AC_DEFINE([_ISOC11_SOURCE], [1], | ||
229 | [Define to enable the declarations of ISO C 11 types and functions.]) | ||
230 | ;; | ||
231 | esac | ||
138 | ]) | 232 | ]) |