OLD | NEW |
1 # stdint.m4 serial 34 | 1 # stdint.m4 serial 43 |
2 dnl Copyright (C) 2001-2011 Free Software Foundation, Inc. | 2 dnl Copyright (C) 2001-2012 Free Software Foundation, Inc. |
3 dnl This file is free software; the Free Software Foundation | 3 dnl This file is free software; the Free Software Foundation |
4 dnl gives unlimited permission to copy and/or distribute it, | 4 dnl gives unlimited permission to copy and/or distribute it, |
5 dnl with or without modifications, as long as this notice is preserved. | 5 dnl with or without modifications, as long as this notice is preserved. |
6 | 6 |
7 dnl From Paul Eggert and Bruno Haible. | 7 dnl From Paul Eggert and Bruno Haible. |
8 dnl Test whether <stdint.h> is supported or must be substituted. | 8 dnl Test whether <stdint.h> is supported or must be substituted. |
9 | 9 |
10 AC_DEFUN([gl_STDINT_H], | 10 AC_DEFUN_ONCE([gl_STDINT_H], |
11 [ | 11 [ |
12 AC_PREREQ([2.59])dnl | 12 AC_PREREQ([2.59])dnl |
13 | 13 |
14 dnl Check for long long int and unsigned long long int. | 14 dnl Check for long long int and unsigned long long int. |
15 AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) | 15 AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) |
16 if test $ac_cv_type_long_long_int = yes; then | 16 if test $ac_cv_type_long_long_int = yes; then |
17 HAVE_LONG_LONG_INT=1 | 17 HAVE_LONG_LONG_INT=1 |
18 else | 18 else |
19 HAVE_LONG_LONG_INT=0 | 19 HAVE_LONG_LONG_INT=0 |
20 fi | 20 fi |
21 AC_SUBST([HAVE_LONG_LONG_INT]) | 21 AC_SUBST([HAVE_LONG_LONG_INT]) |
22 AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) | 22 AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) |
23 if test $ac_cv_type_unsigned_long_long_int = yes; then | 23 if test $ac_cv_type_unsigned_long_long_int = yes; then |
24 HAVE_UNSIGNED_LONG_LONG_INT=1 | 24 HAVE_UNSIGNED_LONG_LONG_INT=1 |
25 else | 25 else |
26 HAVE_UNSIGNED_LONG_LONG_INT=0 | 26 HAVE_UNSIGNED_LONG_LONG_INT=0 |
27 fi | 27 fi |
28 AC_SUBST([HAVE_UNSIGNED_LONG_LONG_INT]) | 28 AC_SUBST([HAVE_UNSIGNED_LONG_LONG_INT]) |
29 | 29 |
| 30 dnl Check for <wchar.h>, in the same way as gl_WCHAR_H does. |
| 31 AC_CHECK_HEADERS_ONCE([wchar.h]) |
| 32 if test $ac_cv_header_wchar_h = yes; then |
| 33 HAVE_WCHAR_H=1 |
| 34 else |
| 35 HAVE_WCHAR_H=0 |
| 36 fi |
| 37 AC_SUBST([HAVE_WCHAR_H]) |
| 38 |
30 dnl Check for <inttypes.h>. | 39 dnl Check for <inttypes.h>. |
31 dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h. | 40 dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h. |
32 if test $ac_cv_header_inttypes_h = yes; then | 41 if test $ac_cv_header_inttypes_h = yes; then |
33 HAVE_INTTYPES_H=1 | 42 HAVE_INTTYPES_H=1 |
34 else | 43 else |
35 HAVE_INTTYPES_H=0 | 44 HAVE_INTTYPES_H=0 |
36 fi | 45 fi |
37 AC_SUBST([HAVE_INTTYPES_H]) | 46 AC_SUBST([HAVE_INTTYPES_H]) |
38 | 47 |
39 dnl Check for <sys/types.h>. | 48 dnl Check for <sys/types.h>. |
(...skipping 13 matching lines...) Expand all Loading... |
53 fi | 62 fi |
54 AC_SUBST([HAVE_STDINT_H]) | 63 AC_SUBST([HAVE_STDINT_H]) |
55 | 64 |
56 dnl Now see whether we need a substitute <stdint.h>. | 65 dnl Now see whether we need a substitute <stdint.h>. |
57 if test $ac_cv_header_stdint_h = yes; then | 66 if test $ac_cv_header_stdint_h = yes; then |
58 AC_CACHE_CHECK([whether stdint.h conforms to C99], | 67 AC_CACHE_CHECK([whether stdint.h conforms to C99], |
59 [gl_cv_header_working_stdint_h], | 68 [gl_cv_header_working_stdint_h], |
60 [gl_cv_header_working_stdint_h=no | 69 [gl_cv_header_working_stdint_h=no |
61 AC_COMPILE_IFELSE([ | 70 AC_COMPILE_IFELSE([ |
62 AC_LANG_PROGRAM([[ | 71 AC_LANG_PROGRAM([[ |
63 #define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ | |
64 #define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ | |
65 #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ | 72 #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ |
66 #include <stdint.h> | 73 #include <stdint.h> |
67 /* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>. */ | 74 /* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>. */ |
68 #if !(defined WCHAR_MIN && defined WCHAR_MAX) | 75 #if !(defined WCHAR_MIN && defined WCHAR_MAX) |
69 #error "WCHAR_MIN, WCHAR_MAX not defined in <stdint.h>" | 76 #error "WCHAR_MIN, WCHAR_MAX not defined in <stdint.h>" |
70 #endif | 77 #endif |
71 ] | 78 ] |
72 gl_STDINT_INCLUDES | 79 gl_STDINT_INCLUDES |
73 [ | 80 [ |
74 #ifdef INT8_MAX | 81 #ifdef INT8_MAX |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 intptr_t gmin = INTPTR_MIN; | 145 intptr_t gmin = INTPTR_MIN; |
139 #endif | 146 #endif |
140 #ifdef UINTPTR_MAX | 147 #ifdef UINTPTR_MAX |
141 uintptr_t h = UINTPTR_MAX; | 148 uintptr_t h = UINTPTR_MAX; |
142 #endif | 149 #endif |
143 intmax_t i = INTMAX_MAX; | 150 intmax_t i = INTMAX_MAX; |
144 uintmax_t j = UINTMAX_MAX; | 151 uintmax_t j = UINTMAX_MAX; |
145 | 152 |
146 #include <limits.h> /* for CHAR_BIT */ | 153 #include <limits.h> /* for CHAR_BIT */ |
147 #define TYPE_MINIMUM(t) \ | 154 #define TYPE_MINIMUM(t) \ |
148 ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))) | 155 ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t))) |
149 #define TYPE_MAXIMUM(t) \ | 156 #define TYPE_MAXIMUM(t) \ |
150 ((t) ((t) 0 < (t) -1 ? (t) -1 : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))) | 157 ((t) ((t) 0 < (t) -1 \ |
| 158 ? (t) -1 \ |
| 159 : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1))) |
151 struct s { | 160 struct s { |
152 int check_PTRDIFF: | 161 int check_PTRDIFF: |
153 PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) | 162 PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) |
154 && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t) | 163 && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t) |
155 ? 1 : -1; | 164 ? 1 : -1; |
156 /* Detect bug in FreeBSD 6.0 / ia64. */ | 165 /* Detect bug in FreeBSD 6.0 / ia64. */ |
157 int check_SIG_ATOMIC: | 166 int check_SIG_ATOMIC: |
158 SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t) | 167 SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t) |
159 && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t) | 168 && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t) |
160 ? 1 : -1; | 169 ? 1 : -1; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1; | 210 int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1; |
202 }; | 211 }; |
203 ]])], | 212 ]])], |
204 [dnl Determine whether the various *_MIN, *_MAX macros are usable | 213 [dnl Determine whether the various *_MIN, *_MAX macros are usable |
205 dnl in preprocessor expression. We could do it by compiling a test | 214 dnl in preprocessor expression. We could do it by compiling a test |
206 dnl program for each of these macros. It is faster to run a program | 215 dnl program for each of these macros. It is faster to run a program |
207 dnl that inspects the macro expansion. | 216 dnl that inspects the macro expansion. |
208 dnl This detects a bug on HP-UX 11.23/ia64. | 217 dnl This detects a bug on HP-UX 11.23/ia64. |
209 AC_RUN_IFELSE([ | 218 AC_RUN_IFELSE([ |
210 AC_LANG_PROGRAM([[ | 219 AC_LANG_PROGRAM([[ |
211 #define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ | |
212 #define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ | |
213 #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ | 220 #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ |
214 #include <stdint.h> | 221 #include <stdint.h> |
215 ] | 222 ] |
216 gl_STDINT_INCLUDES | 223 gl_STDINT_INCLUDES |
217 [ | 224 [ |
218 #include <stdio.h> | 225 #include <stdio.h> |
219 #include <string.h> | 226 #include <string.h> |
220 #define MVAL(macro) MVAL1(macro) | 227 #define MVAL(macro) MVAL1(macro) |
221 #define MVAL1(expression) #expression | 228 #define MVAL1(expression) #expression |
222 static const char *macro_values[] = | 229 static const char *macro_values[] = |
(...skipping 29 matching lines...) Expand all Loading... |
252 for (mv = macro_values; *mv != NULL; mv++) | 259 for (mv = macro_values; *mv != NULL; mv++) |
253 { | 260 { |
254 const char *value = *mv; | 261 const char *value = *mv; |
255 /* Test whether it looks like a cast expression. */ | 262 /* Test whether it looks like a cast expression. */ |
256 if (strncmp (value, "((unsigned int)"/*)*/, 15) == 0 | 263 if (strncmp (value, "((unsigned int)"/*)*/, 15) == 0 |
257 || strncmp (value, "((unsigned short)"/*)*/, 17) == 0 | 264 || strncmp (value, "((unsigned short)"/*)*/, 17) == 0 |
258 || strncmp (value, "((unsigned char)"/*)*/, 16) == 0 | 265 || strncmp (value, "((unsigned char)"/*)*/, 16) == 0 |
259 || strncmp (value, "((int)"/*)*/, 6) == 0 | 266 || strncmp (value, "((int)"/*)*/, 6) == 0 |
260 || strncmp (value, "((signed short)"/*)*/, 15) == 0 | 267 || strncmp (value, "((signed short)"/*)*/, 15) == 0 |
261 || strncmp (value, "((signed char)"/*)*/, 14) == 0) | 268 || strncmp (value, "((signed char)"/*)*/, 14) == 0) |
262 return 1; | 269 return mv - macro_values + 1; |
263 } | 270 } |
264 return 0; | 271 return 0; |
265 ]])], | 272 ]])], |
266 [gl_cv_header_working_stdint_h=yes], | 273 [gl_cv_header_working_stdint_h=yes], |
267 [], | 274 [], |
268 [dnl When cross-compiling, assume it works. | 275 [dnl When cross-compiling, assume it works. |
269 gl_cv_header_working_stdint_h=yes | 276 gl_cv_header_working_stdint_h=yes |
270 ]) | 277 ]) |
271 ]) | 278 ]) |
272 ]) | 279 ]) |
(...skipping 10 matching lines...) Expand all Loading... |
283 HAVE_SYS_INTTYPES_H=0 | 290 HAVE_SYS_INTTYPES_H=0 |
284 fi | 291 fi |
285 AC_SUBST([HAVE_SYS_INTTYPES_H]) | 292 AC_SUBST([HAVE_SYS_INTTYPES_H]) |
286 if test $ac_cv_header_sys_bitypes_h = yes; then | 293 if test $ac_cv_header_sys_bitypes_h = yes; then |
287 HAVE_SYS_BITYPES_H=1 | 294 HAVE_SYS_BITYPES_H=1 |
288 else | 295 else |
289 HAVE_SYS_BITYPES_H=0 | 296 HAVE_SYS_BITYPES_H=0 |
290 fi | 297 fi |
291 AC_SUBST([HAVE_SYS_BITYPES_H]) | 298 AC_SUBST([HAVE_SYS_BITYPES_H]) |
292 | 299 |
293 dnl Check for <wchar.h> (missing in Linux uClibc when built without wide | |
294 dnl character support). | |
295 AC_CHECK_HEADERS_ONCE([wchar.h]) | |
296 | |
297 gl_STDINT_TYPE_PROPERTIES | 300 gl_STDINT_TYPE_PROPERTIES |
298 STDINT_H=stdint.h | 301 STDINT_H=stdint.h |
299 fi | 302 fi |
300 AC_SUBST([STDINT_H]) | 303 AC_SUBST([STDINT_H]) |
| 304 AM_CONDITIONAL([GL_GENERATE_STDINT_H], [test -n "$STDINT_H"]) |
301 ]) | 305 ]) |
302 | 306 |
303 dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES) | 307 dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES) |
304 dnl Determine the size of each of the given types in bits. | 308 dnl Determine the size of each of the given types in bits. |
305 AC_DEFUN([gl_STDINT_BITSIZEOF], | 309 AC_DEFUN([gl_STDINT_BITSIZEOF], |
306 [ | 310 [ |
307 dnl Use a shell loop, to avoid bloating configure, and | 311 dnl Use a shell loop, to avoid bloating configure, and |
308 dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into | 312 dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into |
309 dnl config.h.in, | 313 dnl config.h.in, |
310 dnl - extra AC_SUBST calls, so that the right substitutions are made. | 314 dnl - extra AC_SUBST calls, so that the right substitutions are made. |
311 m4_foreach_w([gltype], [$1], | 315 m4_foreach_w([gltype], [$1], |
312 [AH_TEMPLATE([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCD
EFGHIJKLMNOPQRSTUVWXYZ_]), | 316 [AH_TEMPLATE([BITSIZEOF_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[A
BCDEFGHIJKLMNOPQRSTUVWXYZ_]), |
313 [Define to the number of bits in type ']gltype['.])]) | 317 [Define to the number of bits in type ']gltype['.])]) |
314 for gltype in $1 ; do | 318 for gltype in $1 ; do |
315 AC_CACHE_CHECK([for bit size of $gltype], [gl_cv_bitsizeof_${gltype}], | 319 AC_CACHE_CHECK([for bit size of $gltype], [gl_cv_bitsizeof_${gltype}], |
316 [AC_COMPUTE_INT([result], [sizeof ($gltype) * CHAR_BIT], | 320 [AC_COMPUTE_INT([result], [sizeof ($gltype) * CHAR_BIT], |
317 [$2 | 321 [$2 |
318 #include <limits.h>], [result=unknown]) | 322 #include <limits.h>], [result=unknown]) |
319 eval gl_cv_bitsizeof_${gltype}=\$result | 323 eval gl_cv_bitsizeof_${gltype}=\$result |
320 ]) | 324 ]) |
321 eval result=\$gl_cv_bitsizeof_${gltype} | 325 eval result=\$gl_cv_bitsizeof_${gltype} |
322 if test $result = unknown; then | 326 if test $result = unknown; then |
323 dnl Use a nonempty default, because some compilers, such as IRIX 5 cc, | 327 dnl Use a nonempty default, because some compilers, such as IRIX 5 cc, |
324 dnl do a syntax check even on unused #if conditions and give an error | 328 dnl do a syntax check even on unused #if conditions and give an error |
325 dnl on valid C code like this: | 329 dnl on valid C code like this: |
326 dnl #if 0 | 330 dnl #if 0 |
327 dnl # if > 32 | 331 dnl # if > 32 |
328 dnl # endif | 332 dnl # endif |
329 dnl #endif | 333 dnl #endif |
330 result=0 | 334 result=0 |
331 fi | 335 fi |
332 GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQ
RSTUVWXYZ_'` | 336 GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQ
RSTUVWXYZ_'` |
333 AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result]) | 337 AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result]) |
334 eval BITSIZEOF_${GLTYPE}=\$result | 338 eval BITSIZEOF_${GLTYPE}=\$result |
335 done | 339 done |
336 m4_foreach_w([gltype], [$1], | 340 m4_foreach_w([gltype], [$1], |
337 [AC_SUBST([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFG
HIJKLMNOPQRSTUVWXYZ_]))]) | 341 [AC_SUBST([BITSIZEOF_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCD
EFGHIJKLMNOPQRSTUVWXYZ_]))]) |
338 ]) | 342 ]) |
339 | 343 |
340 dnl gl_CHECK_TYPES_SIGNED(TYPES, INCLUDES) | 344 dnl gl_CHECK_TYPES_SIGNED(TYPES, INCLUDES) |
341 dnl Determine the signedness of each of the given types. | 345 dnl Determine the signedness of each of the given types. |
342 dnl Define HAVE_SIGNED_TYPE if type is signed. | 346 dnl Define HAVE_SIGNED_TYPE if type is signed. |
343 AC_DEFUN([gl_CHECK_TYPES_SIGNED], | 347 AC_DEFUN([gl_CHECK_TYPES_SIGNED], |
344 [ | 348 [ |
345 dnl Use a shell loop, to avoid bloating configure, and | 349 dnl Use a shell loop, to avoid bloating configure, and |
346 dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into | 350 dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into |
347 dnl config.h.in, | 351 dnl config.h.in, |
348 dnl - extra AC_SUBST calls, so that the right substitutions are made. | 352 dnl - extra AC_SUBST calls, so that the right substitutions are made. |
349 m4_foreach_w([gltype], [$1], | 353 m4_foreach_w([gltype], [$1], |
350 [AH_TEMPLATE([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[AB
CDEFGHIJKLMNOPQRSTUVWXYZ_]), | 354 [AH_TEMPLATE([HAVE_SIGNED_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],
[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]), |
351 [Define to 1 if ']gltype[' is a signed integer type.])]) | 355 [Define to 1 if ']gltype[' is a signed integer type.])]) |
352 for gltype in $1 ; do | 356 for gltype in $1 ; do |
353 AC_CACHE_CHECK([whether $gltype is signed], [gl_cv_type_${gltype}_signed], | 357 AC_CACHE_CHECK([whether $gltype is signed], [gl_cv_type_${gltype}_signed], |
354 [AC_COMPILE_IFELSE( | 358 [AC_COMPILE_IFELSE( |
355 [AC_LANG_PROGRAM([$2[ | 359 [AC_LANG_PROGRAM([$2[ |
356 int verify[2 * (($gltype) -1 < ($gltype) 0) - 1];]])], | 360 int verify[2 * (($gltype) -1 < ($gltype) 0) - 1];]])], |
357 result=yes, result=no) | 361 result=yes, result=no) |
358 eval gl_cv_type_${gltype}_signed=\$result | 362 eval gl_cv_type_${gltype}_signed=\$result |
359 ]) | 363 ]) |
360 eval result=\$gl_cv_type_${gltype}_signed | 364 eval result=\$gl_cv_type_${gltype}_signed |
361 GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRS
TUVWXYZ_'` | 365 GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRS
TUVWXYZ_'` |
362 if test "$result" = yes; then | 366 if test "$result" = yes; then |
363 AC_DEFINE_UNQUOTED([HAVE_SIGNED_${GLTYPE}], [1]) | 367 AC_DEFINE_UNQUOTED([HAVE_SIGNED_${GLTYPE}], [1]) |
364 eval HAVE_SIGNED_${GLTYPE}=1 | 368 eval HAVE_SIGNED_${GLTYPE}=1 |
365 else | 369 else |
366 eval HAVE_SIGNED_${GLTYPE}=0 | 370 eval HAVE_SIGNED_${GLTYPE}=0 |
367 fi | 371 fi |
368 done | 372 done |
369 m4_foreach_w([gltype], [$1], | 373 m4_foreach_w([gltype], [$1], |
370 [AC_SUBST([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDE
FGHIJKLMNOPQRSTUVWXYZ_]))]) | 374 [AC_SUBST([HAVE_SIGNED_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[AB
CDEFGHIJKLMNOPQRSTUVWXYZ_]))]) |
371 ]) | 375 ]) |
372 | 376 |
373 dnl gl_INTEGER_TYPE_SUFFIX(TYPES, INCLUDES) | 377 dnl gl_INTEGER_TYPE_SUFFIX(TYPES, INCLUDES) |
374 dnl Determine the suffix to use for integer constants of the given types. | 378 dnl Determine the suffix to use for integer constants of the given types. |
375 dnl Define t_SUFFIX for each such type. | 379 dnl Define t_SUFFIX for each such type. |
376 AC_DEFUN([gl_INTEGER_TYPE_SUFFIX], | 380 AC_DEFUN([gl_INTEGER_TYPE_SUFFIX], |
377 [ | 381 [ |
378 dnl Use a shell loop, to avoid bloating configure, and | 382 dnl Use a shell loop, to avoid bloating configure, and |
379 dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into | 383 dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into |
380 dnl config.h.in, | 384 dnl config.h.in, |
381 dnl - extra AC_SUBST calls, so that the right substitutions are made. | 385 dnl - extra AC_SUBST calls, so that the right substitutions are made. |
382 m4_foreach_w([gltype], [$1], | 386 m4_foreach_w([gltype], [$1], |
383 [AH_TEMPLATE(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOP
QRSTUVWXYZ_])[_SUFFIX], | 387 [AH_TEMPLATE(m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLM
NOPQRSTUVWXYZ_])[_SUFFIX], |
384 [Define to l, ll, u, ul, ull, etc., as suitable for | 388 [Define to l, ll, u, ul, ull, etc., as suitable for |
385 constants of type ']gltype['.])]) | 389 constants of type ']gltype['.])]) |
386 for gltype in $1 ; do | 390 for gltype in $1 ; do |
387 AC_CACHE_CHECK([for $gltype integer literal suffix], | 391 AC_CACHE_CHECK([for $gltype integer literal suffix], |
388 [gl_cv_type_${gltype}_suffix], | 392 [gl_cv_type_${gltype}_suffix], |
389 [eval gl_cv_type_${gltype}_suffix=no | 393 [eval gl_cv_type_${gltype}_suffix=no |
390 eval result=\$gl_cv_type_${gltype}_signed | 394 eval result=\$gl_cv_type_${gltype}_signed |
391 if test "$result" = yes; then | 395 if test "$result" = yes; then |
392 glsufu= | 396 glsufu= |
393 else | 397 else |
(...skipping 18 matching lines...) Expand all Loading... |
412 eval result=\$gl_cv_type_${gltype}_suffix | 416 eval result=\$gl_cv_type_${gltype}_suffix |
413 test "$result" != no && break | 417 test "$result" != no && break |
414 done]) | 418 done]) |
415 GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRS
TUVWXYZ_'` | 419 GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRS
TUVWXYZ_'` |
416 eval result=\$gl_cv_type_${gltype}_suffix | 420 eval result=\$gl_cv_type_${gltype}_suffix |
417 test "$result" = no && result= | 421 test "$result" = no && result= |
418 eval ${GLTYPE}_SUFFIX=\$result | 422 eval ${GLTYPE}_SUFFIX=\$result |
419 AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], [$result]) | 423 AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], [$result]) |
420 done | 424 done |
421 m4_foreach_w([gltype], [$1], | 425 m4_foreach_w([gltype], [$1], |
422 [AC_SUBST(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRS
TUVWXYZ_])[_SUFFIX])]) | 426 [AC_SUBST(m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOP
QRSTUVWXYZ_])[_SUFFIX])]) |
423 ]) | 427 ]) |
424 | 428 |
425 dnl gl_STDINT_INCLUDES | 429 dnl gl_STDINT_INCLUDES |
426 AC_DEFUN([gl_STDINT_INCLUDES], | 430 AC_DEFUN([gl_STDINT_INCLUDES], |
427 [[ | 431 [[ |
428 /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | 432 /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be |
429 included before <wchar.h>. */ | 433 included before <wchar.h>. */ |
430 #include <stddef.h> | 434 #include <stddef.h> |
431 #include <signal.h> | 435 #include <signal.h> |
432 #if HAVE_WCHAR_H | 436 #if HAVE_WCHAR_H |
(...skipping 18 matching lines...) Expand all Loading... |
451 gl_CHECK_TYPES_SIGNED([sig_atomic_t wchar_t wint_t], | 455 gl_CHECK_TYPES_SIGNED([sig_atomic_t wchar_t wint_t], |
452 [gl_STDINT_INCLUDES]) | 456 [gl_STDINT_INCLUDES]) |
453 gl_cv_type_ptrdiff_t_signed=yes | 457 gl_cv_type_ptrdiff_t_signed=yes |
454 gl_cv_type_size_t_signed=no | 458 gl_cv_type_size_t_signed=no |
455 if test $APPLE_UNIVERSAL_BUILD = 0; then | 459 if test $APPLE_UNIVERSAL_BUILD = 0; then |
456 gl_INTEGER_TYPE_SUFFIX([ptrdiff_t size_t], | 460 gl_INTEGER_TYPE_SUFFIX([ptrdiff_t size_t], |
457 [gl_STDINT_INCLUDES]) | 461 [gl_STDINT_INCLUDES]) |
458 fi | 462 fi |
459 gl_INTEGER_TYPE_SUFFIX([sig_atomic_t wchar_t wint_t], | 463 gl_INTEGER_TYPE_SUFFIX([sig_atomic_t wchar_t wint_t], |
460 [gl_STDINT_INCLUDES]) | 464 [gl_STDINT_INCLUDES]) |
| 465 |
| 466 dnl If wint_t is smaller than 'int', it cannot satisfy the ISO C 99 |
| 467 dnl requirement that wint_t is "unchanged by default argument promotions". |
| 468 dnl In this case gnulib's <wchar.h> and <wctype.h> override wint_t. |
| 469 dnl Set the variable BITSIZEOF_WINT_T accordingly. |
| 470 if test $BITSIZEOF_WINT_T -lt 32; then |
| 471 BITSIZEOF_WINT_T=32 |
| 472 fi |
461 ]) | 473 ]) |
462 | 474 |
463 dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. | 475 dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. |
464 dnl Remove this when we can assume autoconf >= 2.61. | 476 dnl Remove this when we can assume autoconf >= 2.61. |
465 m4_ifdef([AC_COMPUTE_INT], [], [ | 477 m4_ifdef([AC_COMPUTE_INT], [], [ |
466 AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) | 478 AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) |
467 ]) | 479 ]) |
468 | 480 |
469 # Hey Emacs! | 481 # Hey Emacs! |
470 # Local Variables: | 482 # Local Variables: |
471 # indent-tabs-mode: nil | 483 # indent-tabs-mode: nil |
472 # End: | 484 # End: |
OLD | NEW |