1 |
commit: 6f4c4106d8fa5af3ec3ee772df7783268eb68908 |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Feb 27 12:17:24 2022 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Feb 27 12:17:24 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=6f4c4106 |
7 |
|
8 |
buildsys: add gnulib missing files |
9 |
|
10 |
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> |
11 |
|
12 |
autotools/gnulib/localtime-buffer.c | 60 +++++++++++++++++++ |
13 |
autotools/m4/dirname.m4 | 19 ++++++ |
14 |
autotools/m4/inttypes-pri.m4 | 42 ++++++++++++++ |
15 |
autotools/m4/localtime-buffer.m4 | 21 +++++++ |
16 |
autotools/m4/longlong.m4 | 113 ++++++++++++++++++++++++++++++++++++ |
17 |
5 files changed, 255 insertions(+) |
18 |
|
19 |
diff --git a/autotools/gnulib/localtime-buffer.c b/autotools/gnulib/localtime-buffer.c |
20 |
new file mode 100644 |
21 |
index 0000000..b65ea45 |
22 |
--- /dev/null |
23 |
+++ b/autotools/gnulib/localtime-buffer.c |
24 |
@@ -0,0 +1,60 @@ |
25 |
+/* Provide access to the last buffer returned by localtime() or gmtime(). |
26 |
+ |
27 |
+ Copyright (C) 2001-2003, 2005-2007, 2009-2019 Free Software Foundation, Inc. |
28 |
+ |
29 |
+ This program is free software; you can redistribute it and/or modify |
30 |
+ it under the terms of the GNU General Public License as published by |
31 |
+ the Free Software Foundation; either version 3, or (at your option) |
32 |
+ any later version. |
33 |
+ |
34 |
+ This program is distributed in the hope that it will be useful, |
35 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of |
36 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
37 |
+ GNU General Public License for more details. |
38 |
+ |
39 |
+ You should have received a copy of the GNU General Public License |
40 |
+ along with this program; if not, see <https://www.gnu.org/licenses/>. */ |
41 |
+ |
42 |
+/* written by Jim Meyering */ |
43 |
+ |
44 |
+#include <config.h> |
45 |
+ |
46 |
+/* Specification. */ |
47 |
+#include "localtime-buffer.h" |
48 |
+ |
49 |
+#if GETTIMEOFDAY_CLOBBERS_LOCALTIME || TZSET_CLOBBERS_LOCALTIME |
50 |
+ |
51 |
+static struct tm tm_zero_buffer; |
52 |
+struct tm *localtime_buffer_addr = &tm_zero_buffer; |
53 |
+ |
54 |
+/* This is a wrapper for localtime. |
55 |
+ |
56 |
+ On the first call, record the address of the static buffer that |
57 |
+ localtime uses for its result. */ |
58 |
+ |
59 |
+struct tm * |
60 |
+rpl_localtime (time_t const *timep) |
61 |
+#undef localtime |
62 |
+{ |
63 |
+ struct tm *tm = localtime (timep); |
64 |
+ |
65 |
+ if (localtime_buffer_addr == &tm_zero_buffer) |
66 |
+ localtime_buffer_addr = tm; |
67 |
+ |
68 |
+ return tm; |
69 |
+} |
70 |
+ |
71 |
+/* Same as above, since gmtime and localtime use the same buffer. */ |
72 |
+struct tm * |
73 |
+rpl_gmtime (time_t const *timep) |
74 |
+#undef gmtime |
75 |
+{ |
76 |
+ struct tm *tm = gmtime (timep); |
77 |
+ |
78 |
+ if (localtime_buffer_addr == &tm_zero_buffer) |
79 |
+ localtime_buffer_addr = tm; |
80 |
+ |
81 |
+ return tm; |
82 |
+} |
83 |
+ |
84 |
+#endif |
85 |
|
86 |
diff --git a/autotools/m4/dirname.m4 b/autotools/m4/dirname.m4 |
87 |
new file mode 100644 |
88 |
index 0000000..32141ae |
89 |
--- /dev/null |
90 |
+++ b/autotools/m4/dirname.m4 |
91 |
@@ -0,0 +1,19 @@ |
92 |
+#serial 10 -*- autoconf -*- |
93 |
+dnl Copyright (C) 2002-2006, 2009-2019 Free Software Foundation, Inc. |
94 |
+dnl This file is free software; the Free Software Foundation |
95 |
+dnl gives unlimited permission to copy and/or distribute it, |
96 |
+dnl with or without modifications, as long as this notice is preserved. |
97 |
+ |
98 |
+AC_DEFUN([gl_DIRNAME], |
99 |
+[ |
100 |
+ AC_REQUIRE([gl_DIRNAME_LGPL]) |
101 |
+]) |
102 |
+ |
103 |
+AC_DEFUN([gl_DIRNAME_LGPL], |
104 |
+[ |
105 |
+ dnl Prerequisites of lib/dirname.h. |
106 |
+ AC_REQUIRE([gl_DOUBLE_SLASH_ROOT]) |
107 |
+ |
108 |
+ dnl No prerequisites of lib/basename-lgpl.c, lib/dirname-lgpl.c, |
109 |
+ dnl lib/stripslash.c. |
110 |
+]) |
111 |
|
112 |
diff --git a/autotools/m4/inttypes-pri.m4 b/autotools/m4/inttypes-pri.m4 |
113 |
new file mode 100644 |
114 |
index 0000000..38fe118 |
115 |
--- /dev/null |
116 |
+++ b/autotools/m4/inttypes-pri.m4 |
117 |
@@ -0,0 +1,42 @@ |
118 |
+# inttypes-pri.m4 serial 7 (gettext-0.18.2) |
119 |
+dnl Copyright (C) 1997-2002, 2006, 2008-2019 Free Software Foundation, Inc. |
120 |
+dnl This file is free software; the Free Software Foundation |
121 |
+dnl gives unlimited permission to copy and/or distribute it, |
122 |
+dnl with or without modifications, as long as this notice is preserved. |
123 |
+ |
124 |
+dnl From Bruno Haible. |
125 |
+ |
126 |
+AC_PREREQ([2.53]) |
127 |
+ |
128 |
+# Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI* |
129 |
+# macros to non-string values. This is the case on AIX 4.3.3. |
130 |
+ |
131 |
+AC_DEFUN([gt_INTTYPES_PRI], |
132 |
+[ |
133 |
+ AC_CHECK_HEADERS([inttypes.h]) |
134 |
+ if test $ac_cv_header_inttypes_h = yes; then |
135 |
+ AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken], |
136 |
+ [gt_cv_inttypes_pri_broken], |
137 |
+ [ |
138 |
+ AC_COMPILE_IFELSE( |
139 |
+ [AC_LANG_PROGRAM( |
140 |
+ [[ |
141 |
+#include <inttypes.h> |
142 |
+#ifdef PRId32 |
143 |
+char *p = PRId32; |
144 |
+#endif |
145 |
+ ]], |
146 |
+ [[]])], |
147 |
+ [gt_cv_inttypes_pri_broken=no], |
148 |
+ [gt_cv_inttypes_pri_broken=yes]) |
149 |
+ ]) |
150 |
+ fi |
151 |
+ if test "$gt_cv_inttypes_pri_broken" = yes; then |
152 |
+ AC_DEFINE_UNQUOTED([PRI_MACROS_BROKEN], [1], |
153 |
+ [Define if <inttypes.h> exists and defines unusable PRI* macros.]) |
154 |
+ PRI_MACROS_BROKEN=1 |
155 |
+ else |
156 |
+ PRI_MACROS_BROKEN=0 |
157 |
+ fi |
158 |
+ AC_SUBST([PRI_MACROS_BROKEN]) |
159 |
+]) |
160 |
|
161 |
diff --git a/autotools/m4/localtime-buffer.m4 b/autotools/m4/localtime-buffer.m4 |
162 |
new file mode 100644 |
163 |
index 0000000..6d99828 |
164 |
--- /dev/null |
165 |
+++ b/autotools/m4/localtime-buffer.m4 |
166 |
@@ -0,0 +1,21 @@ |
167 |
+# localtime-buffer.m4 serial 1 |
168 |
+dnl Copyright (C) 2017-2019 Free Software Foundation, Inc. |
169 |
+dnl This file is free software; the Free Software Foundation |
170 |
+dnl gives unlimited permission to copy and/or distribute it, |
171 |
+dnl with or without modifications, as long as this notice is preserved. |
172 |
+ |
173 |
+AC_DEFUN([gl_LOCALTIME_BUFFER_DEFAULTS], |
174 |
+[ |
175 |
+ NEED_LOCALTIME_BUFFER=0 |
176 |
+]) |
177 |
+ |
178 |
+dnl Macro invoked from other modules, to signal that the compilation of |
179 |
+dnl module 'localtime-buffer' is needed. |
180 |
+AC_DEFUN([gl_LOCALTIME_BUFFER_NEEDED], |
181 |
+[ |
182 |
+ AC_REQUIRE([gl_LOCALTIME_BUFFER_DEFAULTS]) |
183 |
+ AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) |
184 |
+ NEED_LOCALTIME_BUFFER=1 |
185 |
+ REPLACE_GMTIME=1 |
186 |
+ REPLACE_LOCALTIME=1 |
187 |
+]) |
188 |
|
189 |
diff --git a/autotools/m4/longlong.m4 b/autotools/m4/longlong.m4 |
190 |
new file mode 100644 |
191 |
index 0000000..08d0e36 |
192 |
--- /dev/null |
193 |
+++ b/autotools/m4/longlong.m4 |
194 |
@@ -0,0 +1,113 @@ |
195 |
+# longlong.m4 serial 18 |
196 |
+dnl Copyright (C) 1999-2007, 2009-2019 Free Software Foundation, Inc. |
197 |
+dnl This file is free software; the Free Software Foundation |
198 |
+dnl gives unlimited permission to copy and/or distribute it, |
199 |
+dnl with or without modifications, as long as this notice is preserved. |
200 |
+ |
201 |
+dnl From Paul Eggert. |
202 |
+ |
203 |
+AC_PREREQ([2.62]) |
204 |
+ |
205 |
+# Define HAVE_LONG_LONG_INT if 'long long int' works. |
206 |
+# This can be faster than what's in Autoconf 2.62 through 2.68. |
207 |
+ |
208 |
+# Note: If the type 'long long int' exists but is only 32 bits large |
209 |
+# (as on some very old compilers), HAVE_LONG_LONG_INT will not be |
210 |
+# defined. In this case you can treat 'long long int' like 'long int'. |
211 |
+ |
212 |
+AC_DEFUN([AC_TYPE_LONG_LONG_INT], |
213 |
+[ |
214 |
+ AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) |
215 |
+ AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int], |
216 |
+ [ac_cv_type_long_long_int=yes |
217 |
+ if test "x${ac_cv_prog_cc_c99-no}" = xno; then |
218 |
+ ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int |
219 |
+ if test $ac_cv_type_long_long_int = yes; then |
220 |
+ dnl Catch a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004. |
221 |
+ dnl If cross compiling, assume the bug is not important, since |
222 |
+ dnl nobody cross compiles for this platform as far as we know. |
223 |
+ AC_RUN_IFELSE( |
224 |
+ [AC_LANG_PROGRAM( |
225 |
+ [[@%:@include <limits.h> |
226 |
+ @%:@ifndef LLONG_MAX |
227 |
+ @%:@ define HALF \ |
228 |
+ (1LL << (sizeof (long long int) * CHAR_BIT - 2)) |
229 |
+ @%:@ define LLONG_MAX (HALF - 1 + HALF) |
230 |
+ @%:@endif]], |
231 |
+ [[long long int n = 1; |
232 |
+ int i; |
233 |
+ for (i = 0; ; i++) |
234 |
+ { |
235 |
+ long long int m = n << i; |
236 |
+ if (m >> i != n) |
237 |
+ return 1; |
238 |
+ if (LLONG_MAX / 2 < m) |
239 |
+ break; |
240 |
+ } |
241 |
+ return 0;]])], |
242 |
+ [], |
243 |
+ [ac_cv_type_long_long_int=no], |
244 |
+ [:]) |
245 |
+ fi |
246 |
+ fi]) |
247 |
+ if test $ac_cv_type_long_long_int = yes; then |
248 |
+ AC_DEFINE([HAVE_LONG_LONG_INT], [1], |
249 |
+ [Define to 1 if the system has the type 'long long int'.]) |
250 |
+ fi |
251 |
+]) |
252 |
+ |
253 |
+# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works. |
254 |
+# This can be faster than what's in Autoconf 2.62 through 2.68. |
255 |
+ |
256 |
+# Note: If the type 'unsigned long long int' exists but is only 32 bits |
257 |
+# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT |
258 |
+# will not be defined. In this case you can treat 'unsigned long long int' |
259 |
+# like 'unsigned long int'. |
260 |
+ |
261 |
+AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT], |
262 |
+[ |
263 |
+ AC_CACHE_CHECK([for unsigned long long int], |
264 |
+ [ac_cv_type_unsigned_long_long_int], |
265 |
+ [ac_cv_type_unsigned_long_long_int=yes |
266 |
+ if test "x${ac_cv_prog_cc_c99-no}" = xno; then |
267 |
+ AC_LINK_IFELSE( |
268 |
+ [_AC_TYPE_LONG_LONG_SNIPPET], |
269 |
+ [], |
270 |
+ [ac_cv_type_unsigned_long_long_int=no]) |
271 |
+ fi]) |
272 |
+ if test $ac_cv_type_unsigned_long_long_int = yes; then |
273 |
+ AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1], |
274 |
+ [Define to 1 if the system has the type 'unsigned long long int'.]) |
275 |
+ fi |
276 |
+]) |
277 |
+ |
278 |
+# Expands to a C program that can be used to test for simultaneous support |
279 |
+# of 'long long' and 'unsigned long long'. We don't want to say that |
280 |
+# 'long long' is available if 'unsigned long long' is not, or vice versa, |
281 |
+# because too many programs rely on the symmetry between signed and unsigned |
282 |
+# integer types (excluding 'bool'). |
283 |
+AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET], |
284 |
+[ |
285 |
+ AC_LANG_PROGRAM( |
286 |
+ [[/* For now, do not test the preprocessor; as of 2007 there are too many |
287 |
+ implementations with broken preprocessors. Perhaps this can |
288 |
+ be revisited in 2012. In the meantime, code should not expect |
289 |
+ #if to work with literals wider than 32 bits. */ |
290 |
+ /* Test literals. */ |
291 |
+ long long int ll = 9223372036854775807ll; |
292 |
+ long long int nll = -9223372036854775807LL; |
293 |
+ unsigned long long int ull = 18446744073709551615ULL; |
294 |
+ /* Test constant expressions. */ |
295 |
+ typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) |
296 |
+ ? 1 : -1)]; |
297 |
+ typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 |
298 |
+ ? 1 : -1)]; |
299 |
+ int i = 63;]], |
300 |
+ [[/* Test availability of runtime routines for shift and division. */ |
301 |
+ long long int llmax = 9223372036854775807ll; |
302 |
+ unsigned long long int ullmax = 18446744073709551615ull; |
303 |
+ return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) |
304 |
+ | (llmax / ll) | (llmax % ll) |
305 |
+ | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) |
306 |
+ | (ullmax / ull) | (ullmax % ull));]]) |
307 |
+]) |