@ai-ecoverse/wasix-autoconf 0.0.0-stage → 2.72.0-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/LICENSE +338 -0
  2. package/README.md +2 -2
  3. package/bin/autoconf +215 -0
  4. package/bin/autoheader +335 -0
  5. package/bin/autom4te +1174 -0
  6. package/bin/autoreconf +937 -0
  7. package/bin/autoscan +686 -0
  8. package/bin/autoupdate +1074 -0
  9. package/bin/ifnames +158 -0
  10. package/package.json +75 -4
  11. package/share/autoconf/Autom4te/C4che.pm +263 -0
  12. package/share/autoconf/Autom4te/ChannelDefs.pm +549 -0
  13. package/share/autoconf/Autom4te/Channels.pm +856 -0
  14. package/share/autoconf/Autom4te/Config.pm +43 -0
  15. package/share/autoconf/Autom4te/Configure_ac.pm +112 -0
  16. package/share/autoconf/Autom4te/FileUtils.pm +429 -0
  17. package/share/autoconf/Autom4te/General.pm +413 -0
  18. package/share/autoconf/Autom4te/Getopt.pm +99 -0
  19. package/share/autoconf/Autom4te/Request.pm +121 -0
  20. package/share/autoconf/Autom4te/XFile.pm +304 -0
  21. package/share/autoconf/INSTALL +368 -0
  22. package/share/autoconf/autoconf/autoconf.m4 +105 -0
  23. package/share/autoconf/autoconf/autoconf.m4f +15460 -0
  24. package/share/autoconf/autoconf/autoheader.m4 +78 -0
  25. package/share/autoconf/autoconf/autoscan.m4 +51 -0
  26. package/share/autoconf/autoconf/autotest.m4 +81 -0
  27. package/share/autoconf/autoconf/autoupdate.m4 +123 -0
  28. package/share/autoconf/autoconf/c.m4 +2794 -0
  29. package/share/autoconf/autoconf/erlang.m4 +270 -0
  30. package/share/autoconf/autoconf/fortran.m4 +1933 -0
  31. package/share/autoconf/autoconf/functions.m4 +2127 -0
  32. package/share/autoconf/autoconf/general.m4 +3374 -0
  33. package/share/autoconf/autoconf/go.m4 +177 -0
  34. package/share/autoconf/autoconf/headers.m4 +839 -0
  35. package/share/autoconf/autoconf/lang.m4 +730 -0
  36. package/share/autoconf/autoconf/libs.m4 +493 -0
  37. package/share/autoconf/autoconf/oldnames.m4 +92 -0
  38. package/share/autoconf/autoconf/programs.m4 +1015 -0
  39. package/share/autoconf/autoconf/specific.m4 +763 -0
  40. package/share/autoconf/autoconf/status.m4 +1787 -0
  41. package/share/autoconf/autoconf/trailer.m4 +4 -0
  42. package/share/autoconf/autoconf/types.m4 +1133 -0
  43. package/share/autoconf/autom4te.cfg +169 -0
  44. package/share/autoconf/autoscan/autoscan.list +264 -0
  45. package/share/autoconf/autotest/autotest.m4 +27 -0
  46. package/share/autoconf/autotest/autotest.m4f +3915 -0
  47. package/share/autoconf/autotest/general.m4 +2292 -0
  48. package/share/autoconf/autotest/specific.m4 +74 -0
  49. package/share/autoconf/build-aux/config.guess +1807 -0
  50. package/share/autoconf/build-aux/config.sub +1960 -0
  51. package/share/autoconf/build-aux/install-sh +541 -0
  52. package/share/autoconf/m4sugar/foreach.m4 +362 -0
  53. package/share/autoconf/m4sugar/m4sh.m4 +2217 -0
  54. package/share/autoconf/m4sugar/m4sh.m4f +2046 -0
  55. package/share/autoconf/m4sugar/m4sugar.m4 +3307 -0
  56. package/share/autoconf/m4sugar/m4sugar.m4f +868 -0
  57. package/share/autoconf/version.m4 +12 -0
@@ -0,0 +1,1133 @@
1
+ # This file is part of Autoconf. -*- Autoconf -*-
2
+ # Type related macros: existence, sizeof, and structure members.
3
+ #
4
+ # Copyright (C) 2000-2002, 2004-2017, 2020-2023 Free Software
5
+ # Foundation, Inc.
6
+
7
+ # This file is part of Autoconf. This program is free
8
+ # software; you can redistribute it and/or modify it under the
9
+ # terms of the GNU General Public License as published by the
10
+ # Free Software Foundation, either version 3 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # This program is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU General Public License for more details.
17
+ #
18
+ # Under Section 7 of GPL version 3, you are granted additional
19
+ # permissions described in the Autoconf Configure Script Exception,
20
+ # version 3.0, as published by the Free Software Foundation.
21
+ #
22
+ # You should have received a copy of the GNU General Public License
23
+ # and a copy of the Autoconf Configure Script Exception along with
24
+ # this program; see the files COPYINGv3 and COPYING.EXCEPTION
25
+ # respectively. If not, see <https://www.gnu.org/licenses/>.
26
+
27
+ # Written by David MacKenzie, with help from
28
+ # François Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
29
+ # Roland McGrath, Noah Friedman, david d zuhn, and many others.
30
+
31
+
32
+ ## ---------------- ##
33
+ ## Type existence. ##
34
+ ## ---------------- ##
35
+
36
+ # ---------------- #
37
+ # General checks. #
38
+ # ---------------- #
39
+
40
+ # Up to 2.13 included, Autoconf used to provide the macro
41
+ #
42
+ # AC_CHECK_TYPE(TYPE, DEFAULT)
43
+ #
44
+ # Since, it provides another version which fits better with the other
45
+ # AC_CHECK_ families:
46
+ #
47
+ # AC_CHECK_TYPE(TYPE,
48
+ # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
49
+ # [INCLUDES = DEFAULT-INCLUDES])
50
+ #
51
+ # In order to provide backward compatibility, the new scheme is
52
+ # implemented as _AC_CHECK_TYPE_NEW, the old scheme as _AC_CHECK_TYPE_OLD,
53
+ # and AC_CHECK_TYPE branches to one or the other, depending upon its
54
+ # arguments.
55
+
56
+
57
+ # _AC_CHECK_TYPE_NEW_BODY
58
+ # -----------------------
59
+ # Shell function body for _AC_CHECK_TYPE_NEW. This macro implements the
60
+ # former task of AC_CHECK_TYPE, with one big difference though: AC_CHECK_TYPE
61
+ # used to grep in the headers, which, BTW, led to many problems until the
62
+ # extended regular expression was correct and did not give false positives.
63
+ # It turned out there are even portability issues with egrep...
64
+ #
65
+ # The most obvious way to check for a TYPE is just to compile a variable
66
+ # definition:
67
+ #
68
+ # TYPE my_var;
69
+ #
70
+ # (TYPE being the second parameter to the shell function, hence $[]2 in m4).
71
+ # Unfortunately this does not work for const qualified types in C++, where
72
+ # you need an initializer. So you think of
73
+ #
74
+ # TYPE my_var = (TYPE) 0;
75
+ #
76
+ # Unfortunately, again, this is not valid for some C++ classes.
77
+ #
78
+ # Then you look for another scheme. For instance you think of declaring
79
+ # a function which uses a parameter of type TYPE:
80
+ #
81
+ # int foo (TYPE param);
82
+ #
83
+ # but of course you soon realize this does not make it with K&R
84
+ # compilers. And by no means do you want to use this:
85
+ #
86
+ # int foo (param)
87
+ # TYPE param
88
+ # { ; }
89
+ #
90
+ # since C++ would complain loudly.
91
+ #
92
+ # Don't even think of using a function return type, since K&R cries
93
+ # there too. So you start thinking of declaring a *pointer* to this TYPE:
94
+ #
95
+ # TYPE *p;
96
+ #
97
+ # but you know fairly well that this is legal in C for aggregates which
98
+ # are unknown (TYPE = struct does-not-exist).
99
+ #
100
+ # Then you think of using sizeof to make sure the TYPE is really
101
+ # defined:
102
+ #
103
+ # sizeof (TYPE);
104
+ #
105
+ # That is great, but has one drawback: it succeeds when TYPE happens
106
+ # to be a variable: you'd get the size of the variable's type.
107
+ # Obviously, we must not accept a variable in place of a type name.
108
+ #
109
+ # So, to filter out the last possibility, we will require that this fail:
110
+ #
111
+ # sizeof ((TYPE));
112
+ #
113
+ # This evokes a syntax error when TYPE is a type, but succeeds if TYPE
114
+ # is actually a variable.
115
+ #
116
+ # Also note that we use
117
+ #
118
+ # if (sizeof (TYPE))
119
+ #
120
+ # to 'read' sizeof (to avoid warnings), while not depending on its type
121
+ # (not necessarily size_t etc.).
122
+ #
123
+ # C++ disallows defining types inside 'sizeof ()', but that's OK,
124
+ # since we don't want to consider unnamed structs to be types for C++,
125
+ # precisely because they don't work in cases like that.
126
+ m4_define([_AC_CHECK_TYPE_NEW_BODY],
127
+ [ AS_LINENO_PUSH([$[]1])
128
+ AC_CACHE_CHECK([for $[]2], [$[]3],
129
+ [AS_VAR_SET([$[]3], [no])
130
+ AC_COMPILE_IFELSE(
131
+ [AC_LANG_PROGRAM([$[]4],
132
+ [if (sizeof ($[]2))
133
+ return 0;])],
134
+ [AC_COMPILE_IFELSE(
135
+ [AC_LANG_PROGRAM([$[]4],
136
+ [if (sizeof (($[]2)))
137
+ return 0;])],
138
+ [],
139
+ [AS_VAR_SET([$[]3], [yes])])])])
140
+ AS_LINENO_POP
141
+ ])dnl
142
+
143
+ # _AC_CHECK_TYPE_NEW(TYPE,
144
+ # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
145
+ # [INCLUDES = DEFAULT-INCLUDES])
146
+ # ------------------------------------------------------------
147
+ # Check whether the type TYPE is supported by the system, maybe via the
148
+ # the provided includes.
149
+ AC_DEFUN([_AC_CHECK_TYPE_NEW],
150
+ [AC_REQUIRE_SHELL_FN([ac_fn_]_AC_LANG_ABBREV[_check_type],
151
+ [AS_FUNCTION_DESCRIBE([ac_fn_]_AC_LANG_ABBREV[_check_type],
152
+ [LINENO TYPE VAR INCLUDES],
153
+ [Tests whether TYPE exists after having included INCLUDES, setting
154
+ cache variable VAR accordingly.])],
155
+ [$0_BODY])]dnl
156
+ [AS_VAR_PUSHDEF([ac_Type], [ac_cv_type_$1])]dnl
157
+ [ac_fn_[]_AC_LANG_ABBREV[]_check_type "$LINENO" "$1" "ac_Type" ]dnl
158
+ ["AS_ESCAPE([AC_INCLUDES_DEFAULT([$4])], [""])"
159
+ AS_VAR_IF([ac_Type], [yes], [$2], [$3])
160
+ AS_VAR_POPDEF([ac_Type])dnl
161
+ ])# _AC_CHECK_TYPE_NEW
162
+
163
+
164
+ # _AC_CHECK_TYPES(TYPE)
165
+ # ---------------------
166
+ # Helper to AC_CHECK_TYPES, which generates two of the four arguments
167
+ # to _AC_CHECK_TYPE_NEW that are based on TYPE.
168
+ m4_define([_AC_CHECK_TYPES],
169
+ [[$1], [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$1]), [1],
170
+ [Define to 1 if the system has the type '$1'.])]])
171
+
172
+
173
+ # AC_CHECK_TYPES(TYPES,
174
+ # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
175
+ # [INCLUDES = DEFAULT-INCLUDES])
176
+ # --------------------------------------------------------
177
+ # TYPES is an m4 list. There are no ambiguities here, we mean the newer
178
+ # AC_CHECK_TYPE.
179
+ AC_DEFUN([AC_CHECK_TYPES],
180
+ [m4_map_args_sep([_AC_CHECK_TYPE_NEW(_$0(], [)[
181
+ $2], [$3], [$4])], [], $1)])
182
+
183
+
184
+ # _AC_CHECK_TYPE_OLD(TYPE, DEFAULT)
185
+ # ---------------------------------
186
+ # FIXME: This is an extremely badly chosen name, since this
187
+ # macro actually performs an AC_REPLACE_TYPE. Some day we
188
+ # have to clean this up.
189
+ m4_define([_AC_CHECK_TYPE_OLD],
190
+ [_AC_CHECK_TYPE_NEW([$1],,
191
+ [AC_DEFINE_UNQUOTED([$1], [$2],
192
+ [Define to '$2' if <sys/types.h> does not define.])])dnl
193
+ ])# _AC_CHECK_TYPE_OLD
194
+
195
+
196
+ # _AC_CHECK_TYPE_REPLACEMENT_TYPE_P(STRING)
197
+ # -----------------------------------------
198
+ # Return '1' if STRING seems to be a builtin C/C++ type, i.e., if it
199
+ # starts with '_Bool', 'bool', 'char', 'double', 'float', 'int',
200
+ # 'long', 'short', 'signed', or 'unsigned' followed by characters
201
+ # that are defining types.
202
+ # Because many people have used 'off_t' and 'size_t' too, they are added
203
+ # for better common-use backward compatibility.
204
+ m4_define([_AC_CHECK_TYPE_REPLACEMENT_TYPE_P],
205
+ [m4_bmatch([$1],
206
+ [^\(_Bool\|bool\|char\|double\|float\|int\|long\|short\|\(un\)?signed\|[_a-zA-Z][_a-zA-Z0-9]*_t\)[][_a-zA-Z0-9() *]*$],
207
+ 1, 0)dnl
208
+ ])# _AC_CHECK_TYPE_REPLACEMENT_TYPE_P
209
+
210
+
211
+ # _AC_CHECK_TYPE_MAYBE_TYPE_P(STRING)
212
+ # -----------------------------------
213
+ # Return '1' if STRING looks like a C/C++ type.
214
+ m4_define([_AC_CHECK_TYPE_MAYBE_TYPE_P],
215
+ [m4_bmatch([$1], [^[_a-zA-Z0-9 ]+\([_a-zA-Z0-9() *]\|\[\|\]\)*$],
216
+ 1, 0)dnl
217
+ ])# _AC_CHECK_TYPE_MAYBE_TYPE_P
218
+
219
+
220
+ # AC_CHECK_TYPE(TYPE, DEFAULT)
221
+ # or
222
+ # AC_CHECK_TYPE(TYPE,
223
+ # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
224
+ # [INCLUDES = DEFAULT-INCLUDES])
225
+ # -------------------------------------------------------
226
+ #
227
+ # Dispatch respectively to _AC_CHECK_TYPE_OLD or _AC_CHECK_TYPE_NEW.
228
+ # 1. More than two arguments => NEW
229
+ # 2. $2 seems to be replacement type => OLD
230
+ # See _AC_CHECK_TYPE_REPLACEMENT_TYPE_P for 'replacement type'.
231
+ # 3. $2 seems to be a type => NEW plus a warning
232
+ # 4. default => NEW
233
+ AC_DEFUN([AC_CHECK_TYPE],
234
+ [m4_cond([$#], [3],
235
+ [_AC_CHECK_TYPE_NEW],
236
+ [$#], [4],
237
+ [_AC_CHECK_TYPE_NEW],
238
+ [_AC_CHECK_TYPE_REPLACEMENT_TYPE_P([$2])], [1],
239
+ [_AC_CHECK_TYPE_OLD],
240
+ [_AC_CHECK_TYPE_MAYBE_TYPE_P([$2])], [1],
241
+ [m4_warn([syntax],
242
+ [$0: assuming '$2' is not a type])_AC_CHECK_TYPE_NEW],
243
+ [_AC_CHECK_TYPE_NEW])($@)])# AC_CHECK_TYPE
244
+
245
+
246
+
247
+ # ---------------------------- #
248
+ # Types that must be checked. #
249
+ # ---------------------------- #
250
+
251
+ AN_IDENTIFIER([ptrdiff_t], [AC_CHECK_TYPES])
252
+
253
+
254
+ # ----------------- #
255
+ # Specific checks. #
256
+ # ----------------- #
257
+
258
+ # AC_TYPE_GETGROUPS
259
+ # -----------------
260
+ AC_DEFUN([AC_TYPE_GETGROUPS],
261
+ dnl We now unconditionally assume that if <unistd.h> has a prototype for
262
+ dnl getgroups, it is accurate; and that if <unistd.h> does _not_ declare
263
+ dnl getgroups with a prototype, the second argument is an array of int.
264
+ dnl (Older versions of Autoconf made these assumptions only when cross
265
+ dnl compiling.) See AC_FUNC_GETGROUPS, over in functions.m4, for why
266
+ dnl this uses AC_COMPILE_IFELSE rather than AC_LINK_IFELSE.
267
+ [AC_REQUIRE([AC_TYPE_UID_T])dnl
268
+ AC_CACHE_CHECK([type of array argument to getgroups], ac_cv_type_getgroups,
269
+ [# If AC_TYPE_UID_T says there isn't any gid_t typedef, then we can skip
270
+ # everything below.
271
+ AS_IF([test $ac_cv_type_gid_t = no],
272
+ [ac_cv_type_getgroups=int],
273
+ [# Test programs below rely on strict type checking of extern declarations:
274
+ # 'extern int getgroups(int, int *); extern int getgroups(int, pid_t *);'
275
+ # is valid in C89 if and only if pid_t is a typedef for int. Unlike
276
+ # anything involving either an assignment or a function call, compilers
277
+ # tend to make this kind of type mismatch a hard error, not just an
278
+ # "incompatible pointer types" warning.
279
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
280
+ [AC_INCLUDES_DEFAULT
281
+ [extern int getgroups(int, gid_t *);]],
282
+ [[return !(getgroups(0, 0) >= 0);]])],
283
+ [ac_getgroups_gidarray=yes],
284
+ [ac_getgroups_gidarray=no])
285
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
286
+ [AC_INCLUDES_DEFAULT
287
+ [extern int getgroups(int, int *);]],
288
+ [[return !(getgroups(0, 0) >= 0);]])],
289
+ [ac_getgroups_intarray=yes],
290
+ [ac_getgroups_intarray=no])
291
+
292
+ AS_CASE([int:$ac_getgroups_intarray,gid:$ac_getgroups_gidarray],
293
+ [int:yes,gid:no], [ac_cv_type_getgroups=int],
294
+ [int:no,gid:yes], [ac_cv_type_getgroups=gid_t],
295
+ [int:yes,gid:yes], [
296
+ # Both programs compiled - this means *either* that getgroups
297
+ # was declared with no prototype, in which case we should use int,
298
+ # or that it was declared prototyped but gid_t is a typedef for int,
299
+ # in which case we should use gid_t. Distinguish the two cases
300
+ # by testing if the compiler catches a blatantly incorrect function
301
+ # signature for getgroups.
302
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
303
+ [AC_INCLUDES_DEFAULT
304
+ [extern int getgroups(int, float);]],
305
+ [[return !(getgroups(0, 0) >= 0);]])], [
306
+ # Compiler did not catch incorrect argument list;
307
+ # getgroups is unprototyped.
308
+ ac_cv_type_getgroups=int
309
+ ], [
310
+ # Compiler caught incorrect argument list;
311
+ # gid_t is a typedef for int.
312
+ ac_cv_type_getgroups=gid_t
313
+ ])
314
+ ], [
315
+ # Both programs failed to compile - this probably means getgroups
316
+ # wasn't declared at all. Use 'int', as this is probably a very
317
+ # old system where the type _would have been_ int.
318
+ ac_cv_type_getgroups=int
319
+ ])
320
+ ])
321
+ ])dnl AC_CACHE_CHECK
322
+ AC_DEFINE_UNQUOTED(GETGROUPS_T, $ac_cv_type_getgroups,
323
+ [Define to the type of elements in the array argument to
324
+ 'getgroups'. Usually this is either 'int' or 'gid_t'.])
325
+ ])# AC_TYPE_GETGROUPS
326
+
327
+
328
+ # AU::AM_TYPE_PTRDIFF_T
329
+ # ---------------------
330
+ AU_DEFUN([AM_TYPE_PTRDIFF_T],
331
+ [AC_CHECK_TYPES(ptrdiff_t)])
332
+
333
+
334
+ # AC_TYPE_INTMAX_T
335
+ # ----------------
336
+ AC_DEFUN([AC_TYPE_INTMAX_T],
337
+ [
338
+ AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
339
+ AC_CHECK_TYPE([intmax_t],
340
+ [AC_DEFINE([HAVE_INTMAX_T], 1,
341
+ [Define to 1 if the system has the type 'intmax_t'.])],
342
+ [test $ac_cv_type_long_long_int = yes \
343
+ && ac_type='long long int' \
344
+ || ac_type='long int'
345
+ AC_DEFINE_UNQUOTED([intmax_t], [$ac_type],
346
+ [Define to the widest signed integer type
347
+ if <stdint.h> and <inttypes.h> do not define.])])
348
+ ])
349
+
350
+
351
+ # AC_TYPE_UINTMAX_T
352
+ # -----------------
353
+ AC_DEFUN([AC_TYPE_UINTMAX_T],
354
+ [
355
+ AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
356
+ AC_CHECK_TYPE([uintmax_t],
357
+ [AC_DEFINE([HAVE_UINTMAX_T], 1,
358
+ [Define to 1 if the system has the type 'uintmax_t'.])],
359
+ [test $ac_cv_type_unsigned_long_long_int = yes \
360
+ && ac_type='unsigned long long int' \
361
+ || ac_type='unsigned long int'
362
+ AC_DEFINE_UNQUOTED([uintmax_t], [$ac_type],
363
+ [Define to the widest unsigned integer type
364
+ if <stdint.h> and <inttypes.h> do not define.])])
365
+ ])
366
+
367
+
368
+ # AC_TYPE_INTPTR_T
369
+ # ----------------
370
+ AC_DEFUN([AC_TYPE_INTPTR_T],
371
+ [
372
+ AC_CHECK_TYPE([intptr_t],
373
+ [AC_DEFINE([HAVE_INTPTR_T], 1,
374
+ [Define to 1 if the system has the type 'intptr_t'.])],
375
+ [for ac_type in 'int' 'long int' 'long long int'; do
376
+ AC_COMPILE_IFELSE(
377
+ [AC_LANG_BOOL_COMPILE_TRY(
378
+ [AC_INCLUDES_DEFAULT],
379
+ [[sizeof (void *) <= sizeof ($ac_type)]])],
380
+ [AC_DEFINE_UNQUOTED([intptr_t], [$ac_type],
381
+ [Define to the type of a signed integer type wide enough to
382
+ hold a pointer, if such a type exists, and if the system
383
+ does not define it.])
384
+ ac_type=])
385
+ test -z "$ac_type" && break
386
+ done])
387
+ ])
388
+
389
+
390
+ # AC_TYPE_UINTPTR_T
391
+ # -----------------
392
+ AC_DEFUN([AC_TYPE_UINTPTR_T],
393
+ [
394
+ AC_CHECK_TYPE([uintptr_t],
395
+ [AC_DEFINE([HAVE_UINTPTR_T], 1,
396
+ [Define to 1 if the system has the type 'uintptr_t'.])],
397
+ [for ac_type in 'unsigned int' 'unsigned long int' \
398
+ 'unsigned long long int'; do
399
+ AC_COMPILE_IFELSE(
400
+ [AC_LANG_BOOL_COMPILE_TRY(
401
+ [AC_INCLUDES_DEFAULT],
402
+ [[sizeof (void *) <= sizeof ($ac_type)]])],
403
+ [AC_DEFINE_UNQUOTED([uintptr_t], [$ac_type],
404
+ [Define to the type of an unsigned integer type wide enough to
405
+ hold a pointer, if such a type exists, and if the system
406
+ does not define it.])
407
+ ac_type=])
408
+ test -z "$ac_type" && break
409
+ done])
410
+ ])
411
+
412
+
413
+ # AC_TYPE_LONG_DOUBLE
414
+ # -------------------
415
+ AC_DEFUN([AC_TYPE_LONG_DOUBLE],
416
+ [
417
+ AC_CACHE_CHECK([for long double], [ac_cv_type_long_double],
418
+ [if test "$GCC" = yes; then
419
+ ac_cv_type_long_double=yes
420
+ else
421
+ AC_COMPILE_IFELSE(
422
+ [AC_LANG_BOOL_COMPILE_TRY(
423
+ [[/* The Stardent Vistra knows sizeof (long double), but does
424
+ not support it. */
425
+ long double foo = 0.0L;]],
426
+ [[/* On Ultrix 4.3 cc, long double is 4 and double is 8. */
427
+ sizeof (double) <= sizeof (long double)]])],
428
+ [ac_cv_type_long_double=yes],
429
+ [ac_cv_type_long_double=no])
430
+ fi])
431
+ if test $ac_cv_type_long_double = yes; then
432
+ AC_DEFINE([HAVE_LONG_DOUBLE], 1,
433
+ [Define to 1 if the system has the type 'long double'.])
434
+ fi
435
+ ])
436
+
437
+
438
+ # AC_TYPE_LONG_DOUBLE_WIDER
439
+ # -------------------------
440
+ AC_DEFUN([AC_TYPE_LONG_DOUBLE_WIDER],
441
+ [
442
+ AC_CACHE_CHECK(
443
+ [for long double with more range or precision than double],
444
+ [ac_cv_type_long_double_wider],
445
+ [AC_COMPILE_IFELSE(
446
+ [AC_LANG_BOOL_COMPILE_TRY(
447
+ [[#include <float.h>
448
+ long double const a[] =
449
+ {
450
+ 0.0L, DBL_MIN, DBL_MAX, DBL_EPSILON,
451
+ LDBL_MIN, LDBL_MAX, LDBL_EPSILON
452
+ };
453
+ long double
454
+ f (long double x)
455
+ {
456
+ return ((x + (unsigned long int) 10) * (-1 / x) + a[0]
457
+ + (x ? f (x) : 'c'));
458
+ }
459
+ ]],
460
+ [[(0 < ((DBL_MAX_EXP < LDBL_MAX_EXP)
461
+ + (DBL_MANT_DIG < LDBL_MANT_DIG)
462
+ - (LDBL_MAX_EXP < DBL_MAX_EXP)
463
+ - (LDBL_MANT_DIG < DBL_MANT_DIG)))
464
+ && (int) LDBL_EPSILON == 0
465
+ ]])],
466
+ ac_cv_type_long_double_wider=yes,
467
+ ac_cv_type_long_double_wider=no)])
468
+ if test $ac_cv_type_long_double_wider = yes; then
469
+ AC_DEFINE([HAVE_LONG_DOUBLE_WIDER], 1,
470
+ [Define to 1 if the type 'long double' works and has more range or
471
+ precision than 'double'.])
472
+ fi
473
+ ])# AC_TYPE_LONG_DOUBLE_WIDER
474
+
475
+
476
+ # AC_C_LONG_DOUBLE
477
+ # ----------------
478
+ AU_DEFUN([AC_C_LONG_DOUBLE],
479
+ [
480
+ AC_TYPE_LONG_DOUBLE_WIDER
481
+ ac_cv_c_long_double=$ac_cv_type_long_double_wider
482
+ if test $ac_cv_c_long_double = yes; then
483
+ AC_DEFINE([HAVE_LONG_DOUBLE], 1,
484
+ [Define to 1 if the type 'long double' works and has more range or
485
+ precision than 'double'.])
486
+ fi
487
+ ],
488
+ [The macro 'AC_C_LONG_DOUBLE' is obsolete.
489
+ You should use 'AC_TYPE_LONG_DOUBLE' or 'AC_TYPE_LONG_DOUBLE_WIDER' instead.]
490
+ )
491
+
492
+
493
+ # _AC_TYPE_LONG_LONG_SNIPPET
494
+ # --------------------------
495
+ # Expands to a C program that can be used to test for simultaneous support
496
+ # of 'long long' and 'unsigned long long'. We don't want to say that
497
+ # 'long long' is available if 'unsigned long long' is not, or vice versa,
498
+ # because too many programs rely on the symmetry between signed and unsigned
499
+ # integer types (excluding 'bool').
500
+ AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET],
501
+ [
502
+ AC_LANG_PROGRAM(
503
+ [[/* For now, do not test the preprocessor; as of 2007 there are too many
504
+ implementations with broken preprocessors. Perhaps this can
505
+ be revisited in 2012. In the meantime, code should not expect
506
+ #if to work with literals wider than 32 bits. */
507
+ /* Test literals. */
508
+ long long int ll = 9223372036854775807ll;
509
+ long long int nll = -9223372036854775807LL;
510
+ unsigned long long int ull = 18446744073709551615ULL;
511
+ /* Test constant expressions. */
512
+ typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
513
+ ? 1 : -1)];
514
+ typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
515
+ ? 1 : -1)];
516
+ int i = 63;]],
517
+ [[/* Test availability of runtime routines for shift and division. */
518
+ long long int llmax = 9223372036854775807ll;
519
+ unsigned long long int ullmax = 18446744073709551615ull;
520
+ return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
521
+ | (llmax / ll) | (llmax % ll)
522
+ | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
523
+ | (ullmax / ull) | (ullmax % ull));]])
524
+ ])
525
+
526
+
527
+ # AC_TYPE_LONG_LONG_INT
528
+ # ---------------------
529
+ AC_DEFUN([AC_TYPE_LONG_LONG_INT],
530
+ [
531
+ AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
532
+ AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
533
+ [ac_cv_type_long_long_int=yes
534
+ case $ac_prog_cc_stdc in
535
+ no | c89) ;;
536
+ *)
537
+ ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int
538
+ if test $ac_cv_type_long_long_int = yes; then
539
+ dnl Catch a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
540
+ dnl If cross compiling, assume the bug is not important, since
541
+ dnl nobody cross compiles for this platform as far as we know.
542
+ AC_RUN_IFELSE(
543
+ [AC_LANG_PROGRAM(
544
+ [[@%:@include <limits.h>
545
+ @%:@ifndef LLONG_MAX
546
+ @%:@ define HALF \\
547
+ (1LL << (sizeof (long long int) * CHAR_BIT - 2))
548
+ @%:@ define LLONG_MAX (HALF - 1 + HALF)
549
+ @%:@endif]],
550
+ [[long long int n = 1;
551
+ int i;
552
+ for (i = 0; ; i++)
553
+ {
554
+ long long int m = n << i;
555
+ if (m >> i != n)
556
+ return 1;
557
+ if (LLONG_MAX / 2 < m)
558
+ break;
559
+ }
560
+ return 0;]])],
561
+ [],
562
+ [ac_cv_type_long_long_int=no],
563
+ [:])
564
+ fi;;
565
+ esac])
566
+ if test $ac_cv_type_long_long_int = yes; then
567
+ AC_DEFINE([HAVE_LONG_LONG_INT], [1],
568
+ [Define to 1 if the system has the type 'long long int'.])
569
+ fi
570
+ ])
571
+
572
+
573
+ # AC_TYPE_UNSIGNED_LONG_LONG_INT
574
+ # ------------------------------
575
+ AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
576
+ [
577
+ AC_CACHE_CHECK([for unsigned long long int],
578
+ [ac_cv_type_unsigned_long_long_int],
579
+ [ac_cv_type_unsigned_long_long_int=yes
580
+ case $ac_prog_cc_stdc in
581
+ no | c89) ;;
582
+ *)
583
+ AC_LINK_IFELSE(
584
+ [_AC_TYPE_LONG_LONG_SNIPPET],
585
+ [],
586
+ [ac_cv_type_unsigned_long_long_int=no]);;
587
+ esac])
588
+ if test $ac_cv_type_unsigned_long_long_int = yes; then
589
+ AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1],
590
+ [Define to 1 if the system has the type 'unsigned long long int'.])
591
+ fi
592
+ ])
593
+
594
+
595
+ # AC_TYPE_MBSTATE_T
596
+ # -----------------
597
+ AC_DEFUN([AC_TYPE_MBSTATE_T],
598
+ [AC_CACHE_CHECK([for mbstate_t], ac_cv_type_mbstate_t,
599
+ [AC_COMPILE_IFELSE(
600
+ [AC_LANG_PROGRAM(
601
+ [AC_INCLUDES_DEFAULT
602
+ # include <wchar.h>],
603
+ [mbstate_t x; return sizeof x;])],
604
+ [ac_cv_type_mbstate_t=yes],
605
+ [ac_cv_type_mbstate_t=no])])
606
+ if test $ac_cv_type_mbstate_t = yes; then
607
+ AC_DEFINE([HAVE_MBSTATE_T], 1,
608
+ [Define to 1 if <wchar.h> declares mbstate_t.])
609
+ else
610
+ AC_DEFINE([mbstate_t], int,
611
+ [Define to a type if <wchar.h> does not define.])
612
+ fi])
613
+
614
+
615
+ # AC_TYPE_UID_T
616
+ # -------------
617
+ AN_IDENTIFIER([gid_t], [AC_TYPE_UID_T])
618
+ AN_IDENTIFIER([uid_t], [AC_TYPE_UID_T])
619
+ AC_DEFUN([AC_TYPE_UID_T],
620
+ [AC_CHECK_TYPE([uid_t], [],
621
+ [AC_DEFINE([uid_t], [int],
622
+ [Define as 'int' if <sys/types.h> doesn't define.])])
623
+ AC_CHECK_TYPE([gid_t], [],
624
+ [AC_DEFINE([gid_t], [int],
625
+ [Define as 'int' if <sys/types.h> doesn't define.])])])
626
+
627
+ # This should be obsoleted, size_t is in C90.
628
+ AN_IDENTIFIER([size_t], [AC_TYPE_SIZE_T])
629
+ AC_DEFUN([AC_TYPE_SIZE_T],
630
+ [AC_CHECK_TYPE([size_t], [],
631
+ [AC_DEFINE([size_t], [unsigned int],
632
+ [Define as 'unsigned int' if <stddef.h> doesn't define.])])])
633
+
634
+ AN_IDENTIFIER([ssize_t], [AC_TYPE_SSIZE_T])
635
+ AC_DEFUN([AC_TYPE_SSIZE_T],
636
+ [AC_CHECK_TYPE([ssize_t], [],
637
+ [AC_DEFINE([ssize_t], [int],
638
+ [Define as 'int' if <sys/types.h> doesn't define.])])])
639
+
640
+
641
+ AN_IDENTIFIER([pid_t], [AC_TYPE_PID_T])
642
+ AC_DEFUN([AC_TYPE_PID_T],
643
+ [
644
+ AC_CHECK_TYPE([pid_t],
645
+ [],
646
+ [dnl On 64-bit native Microsoft Windows, define it to the equivalent of
647
+ dnl 'intptr_t' (= 'long long' = '__int64'), because that is the return type
648
+ dnl of the _spawnv* functions
649
+ dnl <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/spawnvp-wspawnvp>
650
+ dnl and the argument type of the _cwait function
651
+ dnl <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/cwait>.
652
+ dnl Otherwise (on 32-bit Microsoft Windows and on old Unix platforms),
653
+ dnl define it to 'int'.
654
+ AC_COMPILE_IFELSE(
655
+ [AC_LANG_PROGRAM([[
656
+ #if defined _WIN64 && !defined __CYGWIN__
657
+ LLP64
658
+ #endif
659
+ ]])
660
+ ],
661
+ [ac_pid_type='int'],
662
+ [ac_pid_type='__int64'])
663
+ AC_DEFINE_UNQUOTED([pid_t], [$ac_pid_type],
664
+ [Define as a signed integer type capable of holding a process identifier.])
665
+ ],
666
+ [AC_INCLUDES_DEFAULT])
667
+ ])
668
+
669
+ AN_IDENTIFIER([off_t], [AC_TYPE_OFF_T])
670
+ AC_DEFUN([AC_TYPE_OFF_T], [AC_CHECK_TYPE(off_t, long int)])
671
+
672
+ AN_IDENTIFIER([mode_t], [AC_TYPE_MODE_T])
673
+ AC_DEFUN([AC_TYPE_MODE_T], [AC_CHECK_TYPE(mode_t, int)])
674
+
675
+ AN_IDENTIFIER([int8_t], [AC_TYPE_INT8_T])
676
+ AN_IDENTIFIER([int16_t], [AC_TYPE_INT16_T])
677
+ AN_IDENTIFIER([int32_t], [AC_TYPE_INT32_T])
678
+ AN_IDENTIFIER([int64_t], [AC_TYPE_INT64_T])
679
+ AN_IDENTIFIER([uint8_t], [AC_TYPE_UINT8_T])
680
+ AN_IDENTIFIER([uint16_t], [AC_TYPE_UINT16_T])
681
+ AN_IDENTIFIER([uint32_t], [AC_TYPE_UINT32_T])
682
+ AN_IDENTIFIER([uint64_t], [AC_TYPE_UINT64_T])
683
+ AC_DEFUN([AC_TYPE_INT8_T], [_AC_TYPE_INT(8)])
684
+ AC_DEFUN([AC_TYPE_INT16_T], [_AC_TYPE_INT(16)])
685
+ AC_DEFUN([AC_TYPE_INT32_T], [_AC_TYPE_INT(32)])
686
+ AC_DEFUN([AC_TYPE_INT64_T], [_AC_TYPE_INT(64)])
687
+ AC_DEFUN([AC_TYPE_UINT8_T], [_AC_TYPE_UNSIGNED_INT(8)])
688
+ AC_DEFUN([AC_TYPE_UINT16_T], [_AC_TYPE_UNSIGNED_INT(16)])
689
+ AC_DEFUN([AC_TYPE_UINT32_T], [_AC_TYPE_UNSIGNED_INT(32)])
690
+ AC_DEFUN([AC_TYPE_UINT64_T], [_AC_TYPE_UNSIGNED_INT(64)])
691
+
692
+ # _AC_TYPE_INT_BODY
693
+ # -----------------
694
+ # Shell function body for _AC_TYPE_INT.
695
+ m4_define([_AC_TYPE_INT_BODY],
696
+ [ AS_LINENO_PUSH([$[]1])
697
+ AC_CACHE_CHECK([for int$[]2_t], [$[]3],
698
+ [AS_VAR_SET([$[]3], [no])
699
+ # Order is important - never check a type that is potentially smaller
700
+ # than half of the expected target width.
701
+ for ac_type in int$[]2_t 'int' 'long int' \
702
+ 'long long int' 'short int' 'signed char'; do
703
+ AC_COMPILE_IFELSE(
704
+ [AC_LANG_BOOL_COMPILE_TRY(
705
+ [AC_INCLUDES_DEFAULT
706
+ enum { N = $[]2 / 2 - 1 };],
707
+ [0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1)])],
708
+ [AC_COMPILE_IFELSE(
709
+ [AC_LANG_BOOL_COMPILE_TRY(
710
+ [AC_INCLUDES_DEFAULT
711
+ enum { N = $[]2 / 2 - 1 };],
712
+ [($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1)
713
+ < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2)])],
714
+ [],
715
+ [AS_CASE([$ac_type], [int$[]2_t],
716
+ [AS_VAR_SET([$[]3], [yes])],
717
+ [AS_VAR_SET([$[]3], [$ac_type])])])])
718
+ AS_VAR_IF([$[]3], [no], [], [break])
719
+ done])
720
+ AS_LINENO_POP
721
+ ])# _AC_TYPE_INT_BODY
722
+
723
+ # _AC_TYPE_INT(NBITS)
724
+ # -------------------
725
+ # Set a variable ac_cv_c_intNBITS_t to 'yes' if intNBITS_t is available,
726
+ # 'no' if it is not and no replacement types could be found, and a C type
727
+ # if it is not available but a replacement signed integer type of width
728
+ # exactly NBITS bits was found. In the third case, intNBITS_t is AC_DEFINEd
729
+ # to type, as well.
730
+ AC_DEFUN([_AC_TYPE_INT],
731
+ [AC_REQUIRE_SHELL_FN([ac_fn_c_find_intX_t],
732
+ [AS_FUNCTION_DESCRIBE([ac_fn_c_find_intX_t], [LINENO BITS VAR],
733
+ [Finds a signed integer type with width BITS, setting cache variable VAR
734
+ accordingly.])],
735
+ [$0_BODY])]dnl
736
+ [ac_fn_c_find_intX_t "$LINENO" "$1" "ac_cv_c_int$1_t"
737
+ case $ac_cv_c_int$1_t in #(
738
+ no|yes) ;; #(
739
+ *)
740
+ AC_DEFINE_UNQUOTED([int$1_t], [$ac_cv_c_int$1_t],
741
+ [Define to the type of a signed integer type of width exactly $1 bits
742
+ if such a type exists and the standard includes do not define it.]);;
743
+ esac
744
+ ])# _AC_TYPE_INT
745
+
746
+ # _AC_TYPE_UNSIGNED_INT_BODY
747
+ # --------------------------
748
+ # Shell function body for _AC_TYPE_UNSIGNED_INT.
749
+ m4_define([_AC_TYPE_UNSIGNED_INT_BODY],
750
+ [ AS_LINENO_PUSH([$[]1])
751
+ AC_CACHE_CHECK([for uint$[]2_t], $[]3,
752
+ [AS_VAR_SET([$[]3], [no])
753
+ # Order is important - never check a type that is potentially smaller
754
+ # than half of the expected target width.
755
+ for ac_type in uint$[]2_t 'unsigned int' 'unsigned long int' \
756
+ 'unsigned long long int' 'unsigned short int' 'unsigned char'; do
757
+ AC_COMPILE_IFELSE(
758
+ [AC_LANG_BOOL_COMPILE_TRY(
759
+ [AC_INCLUDES_DEFAULT],
760
+ [(($ac_type) -1 >> ($[]2 / 2 - 1)) >> ($[]2 / 2 - 1) == 3])],
761
+ [AS_CASE([$ac_type], [uint$[]2_t],
762
+ [AS_VAR_SET([$[]3], [yes])],
763
+ [AS_VAR_SET([$[]3], [$ac_type])])])
764
+ AS_VAR_IF([$[]3], [no], [], [break])
765
+ done])
766
+ AS_LINENO_POP
767
+ ])# _AC_TYPE_UNSIGNED_INT_BODY
768
+
769
+
770
+ # _AC_TYPE_UNSIGNED_INT(NBITS)
771
+ # ----------------------------
772
+ # Set a variable ac_cv_c_uintNBITS_t to 'yes' if uintNBITS_t is available,
773
+ # 'no' if it is not and no replacement types could be found, and a C type
774
+ # if it is not available but a replacement unsigned integer type of width
775
+ # exactly NBITS bits was found. In the third case, uintNBITS_t is AC_DEFINEd
776
+ # to type, as well.
777
+ AC_DEFUN([_AC_TYPE_UNSIGNED_INT],
778
+ [AC_REQUIRE_SHELL_FN([ac_fn_c_find_uintX_t],
779
+ [AS_FUNCTION_DESCRIBE([ac_fn_c_find_uintX_t], [LINENO BITS VAR],
780
+ [Finds an unsigned integer type with width BITS, setting cache variable VAR
781
+ accordingly.])],
782
+ [$0_BODY])]dnl
783
+ [ac_fn_c_find_uintX_t "$LINENO" "$1" "ac_cv_c_uint$1_t"
784
+ case $ac_cv_c_uint$1_t in #(
785
+ no|yes) ;; #(
786
+ *)
787
+ m4_bmatch([$1], [^\(8\|32\|64\)$],
788
+ [AC_DEFINE([_UINT$1_T], 1,
789
+ [Define for Solaris 2.5.1 so the uint$1_t typedef from
790
+ <sys/synch.h>, <pthread.h>, or <semaphore.h> is not used.
791
+ If the typedef were allowed, the #define below would cause a
792
+ syntax error.])])
793
+ AC_DEFINE_UNQUOTED([uint$1_t], [$ac_cv_c_uint$1_t],
794
+ [Define to the type of an unsigned integer type of width exactly $1 bits
795
+ if such a type exists and the standard includes do not define it.]);;
796
+ esac
797
+ ])# _AC_TYPE_UNSIGNED_INT
798
+
799
+ # AC_TYPE_SIGNAL
800
+ # --------------
801
+ # Note that identifiers starting with SIG are reserved by ANSI C.
802
+ # C89 requires signal handlers to return void; only K&R returned int;
803
+ # modern code does not need to worry about using this macro (not to
804
+ # mention that sigaction is better than signal).
805
+ AU_DEFUN([AC_TYPE_SIGNAL],
806
+ [AC_CACHE_CHECK([return type of signal handlers], ac_cv_type_signal,
807
+ [AC_COMPILE_IFELSE(
808
+ [AC_LANG_PROGRAM([#include <sys/types.h>
809
+ #include <signal.h>
810
+ ],
811
+ [return *(signal (0, 0)) (0) == 1;])],
812
+ [ac_cv_type_signal=int],
813
+ [ac_cv_type_signal=void])])
814
+ AC_DEFINE_UNQUOTED(RETSIGTYPE, $ac_cv_type_signal,
815
+ [Define as the return type of signal handlers
816
+ ('int' or 'void').])
817
+ ], [your code may safely assume C89 semantics that RETSIGTYPE is void.
818
+ Remove this warning and the 'AC_CACHE_CHECK' when you adjust the code.])
819
+
820
+
821
+ ## ------------------------ ##
822
+ ## Checking size of types. ##
823
+ ## ------------------------ ##
824
+
825
+ # ---------------- #
826
+ # Generic checks. #
827
+ # ---------------- #
828
+
829
+
830
+ # AC_CHECK_SIZEOF(TYPE, [IGNORED], [INCLUDES = DEFAULT-INCLUDES])
831
+ # ---------------------------------------------------------------
832
+ AC_DEFUN([AC_CHECK_SIZEOF],
833
+ [AS_LITERAL_IF(m4_translit([[$1]], [*], [p]), [],
834
+ [m4_fatal([$0: requires literal arguments])])]dnl
835
+ [# The cast to long int works around a bug in the HP C Compiler
836
+ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
837
+ # declarations like 'int a3[[(sizeof (unsigned char)) >= 0]];'.
838
+ # This bug is HP SR number 8606223364.
839
+ _AC_CACHE_CHECK_INT([size of $1], [AS_TR_SH([ac_cv_sizeof_$1])],
840
+ [(long int) (sizeof ($1))],
841
+ [AC_INCLUDES_DEFAULT([$3])],
842
+ [if test "$AS_TR_SH([ac_cv_type_$1])" = yes; then
843
+ AC_MSG_FAILURE([cannot compute sizeof ($1)], 77)
844
+ else
845
+ AS_TR_SH([ac_cv_sizeof_$1])=0
846
+ fi])
847
+
848
+ AC_DEFINE_UNQUOTED(AS_TR_CPP(sizeof_$1), $AS_TR_SH([ac_cv_sizeof_$1]),
849
+ [The size of '$1', as computed by sizeof.])
850
+ ])# AC_CHECK_SIZEOF
851
+
852
+
853
+ # AC_CHECK_ALIGNOF(TYPE, [INCLUDES = DEFAULT-INCLUDES])
854
+ # -----------------------------------------------------
855
+ # TYPE can include braces and semicolon, which AS_TR_CPP and AS_TR_SH
856
+ # (correctly) recognize as potential shell metacharacters. So we
857
+ # have to flatten problematic characters ourselves to guarantee that
858
+ # AC_DEFINE_UNQUOTED will see a literal.
859
+ AC_DEFUN([AC_CHECK_ALIGNOF],
860
+ [m4_if(m4_index(m4_translit([[$1]], [`\"], [$]), [$]), [-1], [],
861
+ [m4_fatal([$0: requires literal arguments])])]dnl
862
+ [_$0([$1], [$2], m4_translit([[$1]], [{;}], [___]))])
863
+
864
+ m4_define([_AC_CHECK_ALIGNOF],
865
+ [# The cast to long int works around a bug in the HP C Compiler,
866
+ # see AC_CHECK_SIZEOF for more information.
867
+ _AC_CACHE_CHECK_INT([alignment of $1], [AS_TR_SH([ac_cv_alignof_$3])],
868
+ [(long int) offsetof (ac__type_alignof_, y)],
869
+ [AC_INCLUDES_DEFAULT([$2])
870
+ typedef struct { char x; $1 y; } ac__type_alignof_;],
871
+ [if test "$AS_TR_SH([ac_cv_type_$3])" = yes; then
872
+ AC_MSG_FAILURE([cannot compute alignment of $1], 77)
873
+ else
874
+ AS_TR_SH([ac_cv_alignof_$3])=0
875
+ fi])
876
+
877
+ AC_DEFINE_UNQUOTED(AS_TR_CPP(alignof_$3), $AS_TR_SH([ac_cv_alignof_$3]),
878
+ [The normal alignment of '$1', in bytes.])
879
+ ])# AC_CHECK_ALIGNOF
880
+
881
+
882
+ # AU::AC_INT_16_BITS
883
+ # ------------------
884
+ # What a great name :)
885
+ AU_DEFUN([AC_INT_16_BITS],
886
+ [AC_CHECK_SIZEOF([int])
887
+ test $ac_cv_sizeof_int = 2 &&
888
+ AC_DEFINE(INT_16_BITS, 1,
889
+ [Define to 1 if 'sizeof (int)' = 2. Obsolete, use 'SIZEOF_INT'.])
890
+ ], [your code should no longer depend upon 'INT_16_BITS', but upon
891
+ 'SIZEOF_INT == 2'. Remove this warning and the 'AC_DEFINE' when you
892
+ adjust the code.])
893
+
894
+
895
+ # AU::AC_LONG_64_BITS
896
+ # -------------------
897
+ AU_DEFUN([AC_LONG_64_BITS],
898
+ [AC_CHECK_SIZEOF([long int])
899
+ test $ac_cv_sizeof_long_int = 8 &&
900
+ AC_DEFINE(LONG_64_BITS, 1,
901
+ [Define to 1 if 'sizeof (long int)' = 8. Obsolete, use
902
+ 'SIZEOF_LONG_INT'.])
903
+ ], [your code should no longer depend upon 'LONG_64_BITS', but upon
904
+ 'SIZEOF_LONG_INT == 8'. Remove this warning and the 'AC_DEFINE' when
905
+ you adjust the code.])
906
+
907
+
908
+
909
+ ## -------------------------- ##
910
+ ## Generic structure checks. ##
911
+ ## -------------------------- ##
912
+
913
+
914
+ # ---------------- #
915
+ # Generic checks. #
916
+ # ---------------- #
917
+
918
+ # _AC_CHECK_MEMBER_BODY
919
+ # ---------------------
920
+ # Shell function body for AC_CHECK_MEMBER.
921
+ m4_define([_AC_CHECK_MEMBER_BODY],
922
+ [ AS_LINENO_PUSH([$[]1])
923
+ AC_CACHE_CHECK([for $[]2.$[]3], [$[]4],
924
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$[]5],
925
+ [static $[]2 ac_aggr;
926
+ if (ac_aggr.$[]3)
927
+ return 0;])],
928
+ [AS_VAR_SET([$[]4], [yes])],
929
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$[]5],
930
+ [static $[]2 ac_aggr;
931
+ if (sizeof ac_aggr.$[]3)
932
+ return 0;])],
933
+ [AS_VAR_SET([$[]4], [yes])],
934
+ [AS_VAR_SET([$[]4], [no])])])])
935
+ AS_LINENO_POP
936
+ ])dnl
937
+
938
+ # AC_CHECK_MEMBER(AGGREGATE.MEMBER,
939
+ # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
940
+ # [INCLUDES = DEFAULT-INCLUDES])
941
+ # ---------------------------------------------------------
942
+ # AGGREGATE.MEMBER is for instance 'struct passwd.pw_gecos', shell
943
+ # variables are not a valid argument.
944
+ AC_DEFUN([AC_CHECK_MEMBER],
945
+ [AC_REQUIRE_SHELL_FN([ac_fn_]_AC_LANG_ABBREV[_check_member],
946
+ [AS_FUNCTION_DESCRIBE([ac_fn_]_AC_LANG_ABBREV[_check_member],
947
+ [LINENO AGGR MEMBER VAR INCLUDES],
948
+ [Tries to find if the field MEMBER exists in type AGGR, after including
949
+ INCLUDES, setting cache variable VAR accordingly.])],
950
+ [_$0_BODY])]dnl
951
+ [AS_LITERAL_IF([$1], [], [m4_fatal([$0: requires literal arguments])])]dnl
952
+ [m4_if(m4_index([$1], [.]), [-1],
953
+ [m4_fatal([$0: Did not see any dot in '$1'])])]dnl
954
+ [AS_VAR_PUSHDEF([ac_Member], [ac_cv_member_$1])]dnl
955
+ [ac_fn_[]_AC_LANG_ABBREV[]_check_member "$LINENO" ]dnl
956
+ [m4_bpatsubst([$1], [^\([^.]*\)\.\(.*\)], ["\1" "\2"]) "ac_Member" ]dnl
957
+ ["AS_ESCAPE([AC_INCLUDES_DEFAULT([$4])], [""])"
958
+ AS_VAR_IF([ac_Member], [yes], [$2], [$3])
959
+ AS_VAR_POPDEF([ac_Member])dnl
960
+ ])# AC_CHECK_MEMBER
961
+
962
+
963
+ # _AC_CHECK_MEMBERS(AGGREGATE.MEMBER)
964
+ # -----------------------------------
965
+ # Helper to AC_CHECK_MEMBERS, which generates two of the four
966
+ # arguments to AC_CHECK_MEMBER that are based on AGGREGATE and MEMBER.
967
+ m4_define([_AC_CHECK_MEMBERS],
968
+ [[$1], [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$1]), [1],
969
+ [Define to 1 if ']m4_bpatsubst([$1],
970
+ [^\([^.]*\)\.\(.*\)], [[\2' is a member of '\1]])['.])]])
971
+
972
+ # AC_CHECK_MEMBERS([AGGREGATE.MEMBER, ...],
973
+ # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
974
+ # [INCLUDES = DEFAULT-INCLUDES])
975
+ # ----------------------------------------------------------
976
+ # The first argument is an m4 list.
977
+ AC_DEFUN([AC_CHECK_MEMBERS],
978
+ [m4_map_args_sep([AC_CHECK_MEMBER(_$0(], [)[
979
+ $2], [$3], [$4])], [], $1)])
980
+
981
+
982
+
983
+ # ------------------------------------------------------- #
984
+ # Members that ought to be tested with AC_CHECK_MEMBERS. #
985
+ # ------------------------------------------------------- #
986
+
987
+ AN_IDENTIFIER([st_blksize], [AC_CHECK_MEMBERS([struct stat.st_blksize])])
988
+ AN_IDENTIFIER([st_rdev], [AC_CHECK_MEMBERS([struct stat.st_rdev])])
989
+
990
+
991
+ # Alphabetic order, please.
992
+
993
+ # _AC_STRUCT_DIRENT(MEMBER)
994
+ # -------------------------
995
+ AC_DEFUN([_AC_STRUCT_DIRENT],
996
+ [
997
+ AC_REQUIRE([AC_HEADER_DIRENT])
998
+ AC_CHECK_MEMBERS([struct dirent.$1], [], [],
999
+ [[
1000
+ #include <sys/types.h>
1001
+ #ifdef HAVE_DIRENT_H
1002
+ # include <dirent.h>
1003
+ #else
1004
+ # define dirent direct
1005
+ # ifdef HAVE_SYS_NDIR_H
1006
+ # include <sys/ndir.h>
1007
+ # endif
1008
+ # ifdef HAVE_SYS_DIR_H
1009
+ # include <sys/dir.h>
1010
+ # endif
1011
+ # ifdef HAVE_NDIR_H
1012
+ # include <ndir.h>
1013
+ # endif
1014
+ #endif
1015
+ ]])
1016
+ ])
1017
+
1018
+ # AC_STRUCT_DIRENT_D_INO
1019
+ # ----------------------
1020
+ AC_DEFUN([AC_STRUCT_DIRENT_D_INO], [_AC_STRUCT_DIRENT([d_ino])])
1021
+
1022
+ # AC_STRUCT_DIRENT_D_TYPE
1023
+ # -----------------------
1024
+ AC_DEFUN([AC_STRUCT_DIRENT_D_TYPE], [_AC_STRUCT_DIRENT([d_type])])
1025
+
1026
+
1027
+ # AC_STRUCT_ST_BLKSIZE
1028
+ # --------------------
1029
+ AU_DEFUN([AC_STRUCT_ST_BLKSIZE],
1030
+ [AC_CHECK_MEMBERS([struct stat.st_blksize],
1031
+ [AC_DEFINE(HAVE_ST_BLKSIZE, 1,
1032
+ [Define to 1 if your 'struct stat' has
1033
+ 'st_blksize'. Deprecated, use
1034
+ 'HAVE_STRUCT_STAT_ST_BLKSIZE' instead.])])
1035
+ ], [your code should no longer depend upon 'HAVE_ST_BLKSIZE', but
1036
+ 'HAVE_STRUCT_STAT_ST_BLKSIZE'. Remove this warning and
1037
+ the 'AC_DEFINE' when you adjust the code.])# AC_STRUCT_ST_BLKSIZE
1038
+
1039
+
1040
+ # AC_STRUCT_ST_BLOCKS
1041
+ # -------------------
1042
+ # If 'struct stat' contains an 'st_blocks' member, define
1043
+ # HAVE_STRUCT_STAT_ST_BLOCKS. Otherwise, add 'fileblocks.o' to the
1044
+ # output variable LIBOBJS. We still define HAVE_ST_BLOCKS for backward
1045
+ # compatibility. In the future, we will activate specializations for
1046
+ # this macro, so don't obsolete it right now.
1047
+ #
1048
+ # AC_OBSOLETE([$0], [; replace it with
1049
+ # AC_CHECK_MEMBERS([struct stat.st_blocks],
1050
+ # [AC_LIBOBJ([fileblocks])])
1051
+ # Please note that it will define 'HAVE_STRUCT_STAT_ST_BLOCKS',
1052
+ # and not 'HAVE_ST_BLOCKS'.])dnl
1053
+ #
1054
+ AN_IDENTIFIER([st_blocks], [AC_STRUCT_ST_BLOCKS])
1055
+ AC_DEFUN([AC_STRUCT_ST_BLOCKS],
1056
+ [AC_CHECK_MEMBERS([struct stat.st_blocks],
1057
+ [AC_DEFINE(HAVE_ST_BLOCKS, 1,
1058
+ [Define to 1 if your 'struct stat' has
1059
+ 'st_blocks'. Deprecated, use
1060
+ 'HAVE_STRUCT_STAT_ST_BLOCKS' instead.])],
1061
+ [AC_LIBOBJ([fileblocks])])
1062
+ ])# AC_STRUCT_ST_BLOCKS
1063
+
1064
+
1065
+ # AC_STRUCT_ST_RDEV
1066
+ # -----------------
1067
+ AU_DEFUN([AC_STRUCT_ST_RDEV],
1068
+ [AC_CHECK_MEMBERS([struct stat.st_rdev],
1069
+ [AC_DEFINE(HAVE_ST_RDEV, 1,
1070
+ [Define to 1 if your 'struct stat' has 'st_rdev'.
1071
+ Deprecated, use 'HAVE_STRUCT_STAT_ST_RDEV'
1072
+ instead.])])
1073
+ ], [your code should no longer depend upon 'HAVE_ST_RDEV', but
1074
+ 'HAVE_STRUCT_STAT_ST_RDEV'. Remove this warning and
1075
+ the 'AC_DEFINE' when you adjust the code.])# AC_STRUCT_ST_RDEV
1076
+
1077
+
1078
+ # AC_STRUCT_TM
1079
+ # ------------
1080
+ # FIXME: This macro is badly named, it should be AC_CHECK_TYPE_STRUCT_TM.
1081
+ # Or something else, but what? AC_CHECK_TYPE_STRUCT_TM_IN_SYS_TIME?
1082
+ AC_DEFUN([AC_STRUCT_TM],
1083
+ [AC_CACHE_CHECK([whether struct tm is in sys/time.h or time.h],
1084
+ ac_cv_struct_tm,
1085
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
1086
+ #include <time.h>
1087
+ ],
1088
+ [struct tm tm;
1089
+ int *p = &tm.tm_sec;
1090
+ return !p;])],
1091
+ [ac_cv_struct_tm=time.h],
1092
+ [ac_cv_struct_tm=sys/time.h])])
1093
+ if test $ac_cv_struct_tm = sys/time.h; then
1094
+ AC_DEFINE(TM_IN_SYS_TIME, 1,
1095
+ [Define to 1 if your <sys/time.h> declares 'struct tm'.])
1096
+ fi
1097
+ ])# AC_STRUCT_TM
1098
+
1099
+
1100
+ # AC_STRUCT_TIMEZONE
1101
+ # ------------------
1102
+ # Figure out how to get the current timezone. If 'struct tm' has a
1103
+ # 'tm_zone' member, define 'HAVE_TM_ZONE'. Otherwise, if the
1104
+ # external array 'tzname' is found, define 'HAVE_TZNAME'.
1105
+ AN_IDENTIFIER([tm_zone], [AC_STRUCT_TIMEZONE])
1106
+ AC_DEFUN([AC_STRUCT_TIMEZONE],
1107
+ [AC_REQUIRE([AC_STRUCT_TM])dnl
1108
+ AC_CHECK_MEMBERS([struct tm.tm_zone],,,[#include <sys/types.h>
1109
+ #include <$ac_cv_struct_tm>
1110
+ ])
1111
+ if test "$ac_cv_member_struct_tm_tm_zone" = yes; then
1112
+ AC_DEFINE(HAVE_TM_ZONE, 1,
1113
+ [Define to 1 if your 'struct tm' has 'tm_zone'. Deprecated, use
1114
+ 'HAVE_STRUCT_TM_TM_ZONE' instead.])
1115
+ else
1116
+ AC_CHECK_DECLS([tzname], , , [#include <time.h>])
1117
+ AC_CACHE_CHECK(for tzname, ac_cv_var_tzname,
1118
+ [AC_LINK_IFELSE([AC_LANG_PROGRAM(
1119
+ [[#include <time.h>
1120
+ #if !HAVE_DECL_TZNAME
1121
+ extern char *tzname[];
1122
+ #endif
1123
+ ]],
1124
+ [[return tzname[0][0];]])],
1125
+ [ac_cv_var_tzname=yes],
1126
+ [ac_cv_var_tzname=no])])
1127
+ if test $ac_cv_var_tzname = yes; then
1128
+ AC_DEFINE(HAVE_TZNAME, 1,
1129
+ [Define to 1 if you don't have 'tm_zone' but do have the external
1130
+ array 'tzname'.])
1131
+ fi
1132
+ fi
1133
+ ])# AC_STRUCT_TIMEZONE