Debian Codegraph @

gnulib/m4/stdint.m4

raw
1 # stdint.m4
2 # serial 63
3 dnl Copyright (C) 2001-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
8 dnl From Paul Eggert and Bruno Haible.
9 dnl Test whether <stdint.h> is supported or must be substituted.
10
11 AC_PREREQ([2.61])
12
13 AC_DEFUN_ONCE([gl_STDINT_H],
14 [
15 AC_PREREQ([2.59])dnl
16 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
17
18 AC_REQUIRE([gl_LIMITS_H])
19 AC_REQUIRE([gt_TYPE_WINT_T])
20
21 dnl For backward compatibility. Some packages may still be testing these
22 dnl macros.
23 AC_DEFINE([HAVE_LONG_LONG_INT], [1],
24 [Define to 1 if the system has the type 'long long int'.])
25 AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1],
26 [Define to 1 if the system has the type 'unsigned long long int'.])
27
28 dnl Check for <wchar.h>, in the same way as gl_WCHAR_H does.
29 AC_CHECK_HEADERS_ONCE([wchar.h])
30 if test $ac_cv_header_wchar_h = yes; then
31 HAVE_WCHAR_H=1
32 else
33 HAVE_WCHAR_H=0
34 fi
35 AC_SUBST([HAVE_WCHAR_H])
36
37 dnl Check for <inttypes.h>.
38 AC_CHECK_HEADERS_ONCE([inttypes.h])
39 if test $ac_cv_header_inttypes_h = yes; then
40 HAVE_INTTYPES_H=1
41 else
42 HAVE_INTTYPES_H=0
43 fi
44 AC_SUBST([HAVE_INTTYPES_H])
45
46 dnl Check for <sys/types.h>.
47 AC_CHECK_HEADERS_ONCE([sys/types.h])
48 if test $ac_cv_header_sys_types_h = yes; then
49 HAVE_SYS_TYPES_H=1
50 else
51 HAVE_SYS_TYPES_H=0
52 fi
53 AC_SUBST([HAVE_SYS_TYPES_H])
54
55 gl_CHECK_NEXT_HEADERS([stdint.h])
56 if test $ac_cv_header_stdint_h = yes; then
57 HAVE_STDINT_H=1
58 else
59 HAVE_STDINT_H=0
60 fi
61 AC_SUBST([HAVE_STDINT_H])
62
63 dnl Now see whether we need a substitute <stdint.h>.
64 if test $ac_cv_header_stdint_h = yes; then
65 AC_CACHE_CHECK([whether stdint.h conforms to C99],
66 [gl_cv_header_working_stdint_h],
67 [gl_cv_header_working_stdint_h=no
68 AC_COMPILE_IFELSE([
69 AC_LANG_PROGRAM([[
70 #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
71 #define __STDC_CONSTANT_MACROS 1
72 #define __STDC_LIMIT_MACROS 1
73 #include <stdint.h>
74 /* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>. */
75 #if !(defined WCHAR_MIN && defined WCHAR_MAX)
76 #error "WCHAR_MIN, WCHAR_MAX not defined in <stdint.h>"
77 #endif
78 ]
79 gl_STDINT_INCLUDES
80 [
81 #ifdef INT8_MAX
82 int8_t a1 = INT8_MAX;
83 int8_t a1min = INT8_MIN;
84 #endif
85 #ifdef INT16_MAX
86 int16_t a2 = INT16_MAX;
87 int16_t a2min = INT16_MIN;
88 #endif
89 #ifdef INT32_MAX
90 int32_t a3 = INT32_MAX;
91 int32_t a3min = INT32_MIN;
92 #endif
93 #ifdef INT64_MAX
94 int64_t a4 = INT64_MAX;
95 int64_t a4min = INT64_MIN;
96 #endif
97 #ifdef UINT8_MAX
98 uint8_t b1 = UINT8_MAX;
99 #else
100 typedef int b1[(unsigned char) -1 != 255 ? 1 : -1];
101 #endif
102 #ifdef UINT16_MAX
103 uint16_t b2 = UINT16_MAX;
104 #endif
105 #ifdef UINT32_MAX
106 uint32_t b3 = UINT32_MAX;
107 #endif
108 #ifdef UINT64_MAX
109 uint64_t b4 = UINT64_MAX;
110 #endif
111 int_least8_t c1 = INT8_C (0x7f);
112 int_least8_t c1max = INT_LEAST8_MAX;
113 int_least8_t c1min = INT_LEAST8_MIN;
114 int_least16_t c2 = INT16_C (0x7fff);
115 int_least16_t c2max = INT_LEAST16_MAX;
116 int_least16_t c2min = INT_LEAST16_MIN;
117 int_least32_t c3 = INT32_C (0x7fffffff);
118 int_least32_t c3max = INT_LEAST32_MAX;
119 int_least32_t c3min = INT_LEAST32_MIN;
120 int_least64_t c4 = INT64_C (0x7fffffffffffffff);
121 int_least64_t c4max = INT_LEAST64_MAX;
122 int_least64_t c4min = INT_LEAST64_MIN;
123 uint_least8_t d1 = UINT8_C (0xff);
124 uint_least8_t d1max = UINT_LEAST8_MAX;
125 uint_least16_t d2 = UINT16_C (0xffff);
126 uint_least16_t d2max = UINT_LEAST16_MAX;
127 uint_least32_t d3 = UINT32_C (0xffffffff);
128 uint_least32_t d3max = UINT_LEAST32_MAX;
129 uint_least64_t d4 = UINT64_C (0xffffffffffffffff);
130 uint_least64_t d4max = UINT_LEAST64_MAX;
131 int_fast8_t e1 = INT_FAST8_MAX;
132 int_fast8_t e1min = INT_FAST8_MIN;
133 int_fast16_t e2 = INT_FAST16_MAX;
134 int_fast16_t e2min = INT_FAST16_MIN;
135 int_fast32_t e3 = INT_FAST32_MAX;
136 int_fast32_t e3min = INT_FAST32_MIN;
137 int_fast64_t e4 = INT_FAST64_MAX;
138 int_fast64_t e4min = INT_FAST64_MIN;
139 uint_fast8_t f1 = UINT_FAST8_MAX;
140 uint_fast16_t f2 = UINT_FAST16_MAX;
141 uint_fast32_t f3 = UINT_FAST32_MAX;
142 uint_fast64_t f4 = UINT_FAST64_MAX;
143 #ifdef INTPTR_MAX
144 intptr_t g = INTPTR_MAX;
145 intptr_t gmin = INTPTR_MIN;
146 #endif
147 #ifdef UINTPTR_MAX
148 uintptr_t h = UINTPTR_MAX;
149 #endif
150 intmax_t i = INTMAX_MAX;
151 uintmax_t j = UINTMAX_MAX;
152
153 /* Check that SIZE_MAX has the correct type, if possible. */
154 /* ISO C 11 mandates _Generic, but GCC versions < 4.9 lack it. */
155 #if 201112 <= __STDC_VERSION__ \
156 && (!defined __GNUC__ || 4 < __GNUC__ + (9 <= __GNUC_MINOR__) \
157 || defined __clang__)
158 int k = _Generic (SIZE_MAX, size_t: 0);
159 #elif (2 <= __GNUC__ || 4 <= __clang_major__ || defined __IBM__TYPEOF__ \
160 || (0x5110 <= __SUNPRO_C && !__STDC__))
161 extern size_t k;
162 extern __typeof__ (SIZE_MAX) k;
163 #endif
164
165 #include <limits.h> /* for CHAR_BIT */
166 #define TYPE_MINIMUM(t) \
167 ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t)))
168 #define TYPE_MAXIMUM(t) \
169 ((t) ((t) 0 < (t) -1 \
170 ? (t) -1 \
171 : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1)))
172 struct s {
173 int check_PTRDIFF:
174 PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t)
175 && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t)
176 ? 1 : -1;
177 /* Detect bug in FreeBSD 6.0/ia64 and FreeBSD 13.0/arm64. */
178 int check_SIG_ATOMIC:
179 SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t)
180 && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t)
181 ? 1 : -1;
182 int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1;
183 int check_WCHAR:
184 WCHAR_MIN == TYPE_MINIMUM (wchar_t)
185 && WCHAR_MAX == TYPE_MAXIMUM (wchar_t)
186 ? 1 : -1;
187 /* Detect bug in mingw. */
188 int check_WINT:
189 WINT_MIN == TYPE_MINIMUM (wint_t)
190 && WINT_MAX == TYPE_MAXIMUM (wint_t)
191 ? 1 : -1;
192
193 /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */
194 int check_UINT8_C:
195 (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1;
196 int check_UINT16_C:
197 (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1;
198
199 /* Detect bugs in OpenBSD 3.9 stdint.h. */
200 #ifdef UINT8_MAX
201 int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1;
202 #endif
203 #ifdef UINT16_MAX
204 int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1;
205 #endif
206 #ifdef UINT32_MAX
207 int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1;
208 #endif
209 #ifdef UINT64_MAX
210 int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1;
211 #endif
212 int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1;
213 int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1;
214 int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1;
215 int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1;
216 int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1;
217 int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1;
218 int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1;
219 int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1;
220 int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1;
221 int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1;
222 int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1;
223 };
224 ]])],
225 [dnl Determine whether the various *_MIN, *_MAX macros are usable
226 dnl in preprocessor expression. We could do it by compiling a test
227 dnl program for each of these macros. It is faster to run a program
228 dnl that inspects the macro expansion.
229 dnl This detects a bug on HP-UX 11.23/ia64.
230 AC_RUN_IFELSE([
231 AC_LANG_PROGRAM([[
232 #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
233 #define __STDC_CONSTANT_MACROS 1
234 #define __STDC_LIMIT_MACROS 1
235 #include <stdint.h>
236 ]
237 gl_STDINT_INCLUDES
238 [
239 #include <stdio.h>
240 #include <string.h>
241 #define MVAL(macro) MVAL1(macro)
242 #define MVAL1(expression) #expression
243 static const char *macro_values[] =
244 {
245 #ifdef INT8_MAX
246 MVAL (INT8_MAX),
247 #endif
248 #ifdef INT16_MAX
249 MVAL (INT16_MAX),
250 #endif
251 #ifdef INT32_MAX
252 MVAL (INT32_MAX),
253 #endif
254 #ifdef INT64_MAX
255 MVAL (INT64_MAX),
256 #endif
257 #ifdef UINT8_MAX
258 MVAL (UINT8_MAX),
259 #endif
260 #ifdef UINT16_MAX
261 MVAL (UINT16_MAX),
262 #endif
263 #ifdef UINT32_MAX
264 MVAL (UINT32_MAX),
265 #endif
266 #ifdef UINT64_MAX
267 MVAL (UINT64_MAX),
268 #endif
269 NULL
270 };
271 ]], [[
272 const char **mv;
273 for (mv = macro_values; *mv != NULL; mv++)
274 {
275 const char *value = *mv;
276 /* Test whether it looks like a cast expression. */
277 if (strncmp (value, "((unsigned int)"/*)*/, 15) == 0
278 || strncmp (value, "((unsigned short)"/*)*/, 17) == 0
279 || strncmp (value, "((unsigned char)"/*)*/, 16) == 0
280 || strncmp (value, "((int)"/*)*/, 6) == 0
281 || strncmp (value, "((signed short)"/*)*/, 15) == 0
282 || strncmp (value, "((signed char)"/*)*/, 14) == 0)
283 return mv - macro_values + 1;
284 }
285 return 0;
286 ]])],
287 [gl_cv_header_working_stdint_h=yes],
288 [],
289 [case "$host_os" in
290 # Guess yes on native Windows.
291 mingw* | windows*) gl_cv_header_working_stdint_h="guessing yes" ;;
292 # In general, assume it works.
293 *) gl_cv_header_working_stdint_h="guessing yes" ;;
294 esac
295 ])
296 ])
297 ])
298 fi
299
300 HAVE_C99_STDINT_H=0
301 HAVE_SYS_BITYPES_H=0
302 HAVE_SYS_INTTYPES_H=0
303 GL_GENERATE_STDINT_H=true
304 case "$gl_cv_header_working_stdint_h" in
305 *yes)
306 HAVE_C99_STDINT_H=1
307 dnl Now see whether the system <stdint.h> works without
308 dnl __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS defined.
309 dnl If not, there would be problems when stdint.h is included from C++.
310 AC_CACHE_CHECK([whether stdint.h works without ISO C predefines],
311 [gl_cv_header_stdint_without_STDC_macros],
312 [gl_cv_header_stdint_without_STDC_macros=no
313 AC_COMPILE_IFELSE([
314 AC_LANG_PROGRAM([[
315 #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
316 #include <stdint.h>
317 ]
318 gl_STDINT_INCLUDES
319 [
320 intmax_t im = INTMAX_MAX;
321 int32_t i32 = INT32_C (0x7fffffff);
322 ]])],
323 [gl_cv_header_stdint_without_STDC_macros=yes])
324 ])
325
326 if test $gl_cv_header_stdint_without_STDC_macros = no; then
327 AC_DEFINE([__STDC_CONSTANT_MACROS], [1],
328 [Define to 1 if the system <stdint.h> predates C++11.])
329 AC_DEFINE([__STDC_LIMIT_MACROS], [1],
330 [Define to 1 if the system <stdint.h> predates C++11.])
331 fi
332 AC_CACHE_CHECK([whether stdint.h has UINTMAX_WIDTH etc.],
333 [gl_cv_header_stdint_width],
334 [gl_cv_header_stdint_width=no
335 AC_COMPILE_IFELSE(
336 [AC_LANG_PROGRAM([[
337 /* Work if build is not clean. */
338 #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1
339 #ifndef __STDC_WANT_IEC_60559_BFP_EXT__
340 #define __STDC_WANT_IEC_60559_BFP_EXT__ 1
341 #endif
342 #include <stdint.h>
343 ]gl_STDINT_INCLUDES[
344 int iw = UINTMAX_WIDTH;
345 ]])],
346 [gl_cv_header_stdint_width=yes])])
347 if test "$gl_cv_header_stdint_width" = yes; then
348 GL_GENERATE_STDINT_H=false
349 fi
350 ;;
351 *)
352 dnl Check for <sys/inttypes.h>, and for
353 dnl <sys/bitypes.h> (used in Linux libc4 >= 4.6.7 and libc5).
354 AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h])
355 if test $ac_cv_header_sys_inttypes_h = yes; then
356 HAVE_SYS_INTTYPES_H=1
357 fi
358 if test $ac_cv_header_sys_bitypes_h = yes; then
359 HAVE_SYS_BITYPES_H=1
360 fi
361 gl_STDINT_TYPE_PROPERTIES
362 ;;
363 esac
364
365 dnl The substitute stdint.h needs the substitute limit.h's _GL_INTEGER_WIDTH.
366 gl_REPLACE_LIMITS_H
367
368 AC_SUBST([HAVE_C99_STDINT_H])
369 AC_SUBST([HAVE_SYS_BITYPES_H])
370 AC_SUBST([HAVE_SYS_INTTYPES_H])
371 ])
372
373 dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES)
374 dnl Determine the size of each of the given types in bits.
375 AC_DEFUN([gl_STDINT_BITSIZEOF],
376 [
377 dnl Use a shell loop, to avoid bloating configure, and
378 dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
379 dnl config.h.in,
380 dnl - extra AC_SUBST calls, so that the right substitutions are made.
381 m4_foreach_w([gltype], [$1],
382 [AH_TEMPLATE([BITSIZEOF_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
383 [Define to the number of bits in type ']gltype['.])])
384 for gltype in $1 ; do
385 AC_CACHE_CHECK([for bit size of $gltype], [gl_cv_bitsizeof_${gltype}],
386 [AC_COMPUTE_INT([result], [sizeof ($gltype) * CHAR_BIT],
387 [$2
388 #include <limits.h>], [result=unknown])
389 eval gl_cv_bitsizeof_${gltype}=\$result
390 ])
391 eval result=\$gl_cv_bitsizeof_${gltype}
392 if test $result = unknown; then
393 dnl Use a nonempty default, because some compilers, such as IRIX 5 cc,
394 dnl do a syntax check even on unused #if conditions and give an error
395 dnl on valid C code like this:
396 dnl #if 0
397 dnl # if > 32
398 dnl # endif
399 dnl #endif
400 result=0
401 fi
402 GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
403 AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result])
404 eval BITSIZEOF_${GLTYPE}=\$result
405 done
406 m4_foreach_w([gltype], [$1],
407 [AC_SUBST([BITSIZEOF_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
408 ])
409
410 dnl gl_CHECK_TYPES_SIGNED(TYPES, INCLUDES)
411 dnl Determine the signedness of each of the given types.
412 dnl Define HAVE_SIGNED_TYPE if type is signed.
413 AC_DEFUN([gl_CHECK_TYPES_SIGNED],
414 [
415 dnl Use a shell loop, to avoid bloating configure, and
416 dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
417 dnl config.h.in,
418 dnl - extra AC_SUBST calls, so that the right substitutions are made.
419 m4_foreach_w([gltype], [$1],
420 [AH_TEMPLATE([HAVE_SIGNED_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
421 [Define to 1 if ']gltype[' is a signed integer type.])])
422 for gltype in $1 ; do
423 AC_CACHE_CHECK([whether $gltype is signed], [gl_cv_type_${gltype}_signed],
424 [AC_COMPILE_IFELSE(
425 [AC_LANG_PROGRAM([$2[
426 int verify[2 * (($gltype) -1 < ($gltype) 0) - 1];]])],
427 result=yes, result=no)
428 eval gl_cv_type_${gltype}_signed=\$result
429 ])
430 eval result=\$gl_cv_type_${gltype}_signed
431 GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
432 if test "$result" = yes; then
433 AC_DEFINE_UNQUOTED([HAVE_SIGNED_${GLTYPE}], [1])
434 eval HAVE_SIGNED_${GLTYPE}=1
435 else
436 eval HAVE_SIGNED_${GLTYPE}=0
437 fi
438 done
439 m4_foreach_w([gltype], [$1],
440 [AC_SUBST([HAVE_SIGNED_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
441 ])
442
443 dnl gl_INTEGER_TYPE_SUFFIX(TYPES, INCLUDES)
444 dnl Determine the suffix to use for integer constants of the given types.
445 dnl Define t_SUFFIX for each such type.
446 AC_DEFUN([gl_INTEGER_TYPE_SUFFIX],
447 [
448 dnl Use a shell loop, to avoid bloating configure, and
449 dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
450 dnl config.h.in,
451 dnl - extra AC_SUBST calls, so that the right substitutions are made.
452 m4_foreach_w([gltype], [$1],
453 [AH_TEMPLATE(m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX],
454 [Define to l, ll, u, ul, ull, etc., as suitable for
455 constants of type ']gltype['.])])
456 for gltype in $1 ; do
457 AC_CACHE_CHECK([for $gltype integer literal suffix],
458 [gl_cv_type_${gltype}_suffix],
459 [eval gl_cv_type_${gltype}_suffix=no
460 eval result=\$gl_cv_type_${gltype}_signed
461 if test "$result" = yes; then
462 glsufu=
463 else
464 glsufu=u
465 fi
466 for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do
467 case $glsuf in
468 '') gltype1='int';;
469 l) gltype1='long int';;
470 ll) gltype1='long long int';;
471 i64) gltype1='__int64';;
472 u) gltype1='unsigned int';;
473 ul) gltype1='unsigned long int';;
474 ull) gltype1='unsigned long long int';;
475 ui64)gltype1='unsigned __int64';;
476 esac
477 AC_COMPILE_IFELSE(
478 [AC_LANG_PROGRAM([$2[
479 extern $gltype foo;
480 extern $gltype1 foo;]])],
481 [eval gl_cv_type_${gltype}_suffix=\$glsuf])
482 eval result=\$gl_cv_type_${gltype}_suffix
483 test "$result" != no && break
484 done])
485 GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
486 eval result=\$gl_cv_type_${gltype}_suffix
487 test "$result" = no && result=
488 eval ${GLTYPE}_SUFFIX=\$result
489 AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], [$result])
490 done
491 m4_foreach_w([gltype], [$1],
492 [AC_SUBST(m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])])
493 ])
494
495 dnl gl_STDINT_INCLUDES
496 AC_DEFUN([gl_STDINT_INCLUDES],
497 [[
498 #include <stddef.h>
499 #include <signal.h>
500 #if HAVE_WCHAR_H
501 # include <wchar.h>
502 #endif
503 ]])
504
505 dnl gl_STDINT_TYPE_PROPERTIES
506 dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t
507 dnl of interest to stdint.in.h.
508 AC_DEFUN([gl_STDINT_TYPE_PROPERTIES],
509 [
510 AC_REQUIRE([gl_MULTIARCH])
511 if test $APPLE_UNIVERSAL_BUILD = 0; then
512 gl_STDINT_BITSIZEOF([ptrdiff_t size_t],
513 [gl_STDINT_INCLUDES])
514 fi
515 gl_STDINT_BITSIZEOF([sig_atomic_t wchar_t wint_t],
516 [gl_STDINT_INCLUDES])
517 gl_CHECK_TYPES_SIGNED([sig_atomic_t wchar_t wint_t],
518 [gl_STDINT_INCLUDES])
519 gl_cv_type_ptrdiff_t_signed=yes
520 gl_cv_type_size_t_signed=no
521 if test $APPLE_UNIVERSAL_BUILD = 0; then
522 gl_INTEGER_TYPE_SUFFIX([ptrdiff_t size_t],
523 [gl_STDINT_INCLUDES])
524 fi
525 gl_INTEGER_TYPE_SUFFIX([sig_atomic_t wchar_t wint_t],
526 [gl_STDINT_INCLUDES])
527
528 dnl If wint_t is smaller than 'int', it cannot satisfy the ISO C 99
529 dnl requirement that wint_t is "unchanged by default argument promotions".
530 dnl In this case gnulib's <wchar.h> and <wctype.h> override wint_t.
531 dnl Set the variable BITSIZEOF_WINT_T accordingly.
532 if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then
533 BITSIZEOF_WINT_T=32
534 fi
535 ])