Debian Codegraph @

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