2
dnl Copyright (C) 2001-2007 Free Software Foundation, Inc.
2
dnl Copyright (C) 2001-2009 Free Software Foundation, Inc.
3
3
dnl This file is free software; the Free Software Foundation
4
4
dnl gives unlimited permission to copy and/or distribute it,
5
5
dnl with or without modifications, as long as this notice is preserved.
59
59
[gl_cv_header_working_stdint_h],
60
60
[gl_cv_header_working_stdint_h=no
61
61
AC_COMPILE_IFELSE([
62
AC_LANG_PROGRAM([gl_STDINT_INCLUDES
64
63
#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
65
64
#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
66
65
#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
67
66
#include <stdint.h>
67
/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>. */
68
#if !(defined WCHAR_MIN && defined WCHAR_MAX)
69
#error "WCHAR_MIN, WCHAR_MAX not defined in <stdint.h>"
69
75
int8_t a1 = INT8_MAX;
70
76
int8_t a1min = INT8_MIN;
195
201
int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1;
198
[gl_cv_header_working_stdint_h=yes])])
204
[dnl Determine whether the various *_MIN, *_MAX macros are usable
205
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
207
dnl that inspects the macro expansion.
208
dnl This detects a bug on HP-UX 11.23/ia64.
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 MVAL(macro) MVAL1(macro)
221
#define MVAL1(expression) #expression
222
static const char *macro_values[] =
252
for (mv = macro_values; *mv != NULL; mv++)
254
const char *value = *mv;
255
/* Test whether it looks like a cast expression. */
256
if (strncmp (value, "((unsigned int)"/*)*/, 15) == 0
257
|| strncmp (value, "((unsigned short)"/*)*/, 17) == 0
258
|| strncmp (value, "((unsigned char)"/*)*/, 16) == 0
259
|| strncmp (value, "((int)"/*)*/, 6) == 0
260
|| strncmp (value, "((signed short)"/*)*/, 15) == 0
261
|| strncmp (value, "((signed char)"/*)*/, 14) == 0)
266
[gl_cv_header_working_stdint_h=yes],
268
[dnl When cross-compiling, assume it works.
269
gl_cv_header_working_stdint_h=yes
200
274
if test "$gl_cv_header_working_stdint_h" = yes; then
234
308
dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
236
310
dnl - extra AC_SUBST calls, so that the right substitutions are made.
237
AC_FOREACH([gltype], [$1],
311
m4_foreach_w([gltype], [$1],
238
312
[AH_TEMPLATE([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
239
313
[Define to the number of bits in type ']gltype['.])])
240
314
for gltype in $1 ; do
259
333
AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result])
260
334
eval BITSIZEOF_${GLTYPE}=\$result
262
AC_FOREACH([gltype], [$1],
336
m4_foreach_w([gltype], [$1],
263
337
[AC_SUBST([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
272
346
dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
274
348
dnl - extra AC_SUBST calls, so that the right substitutions are made.
275
AC_FOREACH([gltype], [$1],
349
m4_foreach_w([gltype], [$1],
276
350
[AH_TEMPLATE([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
277
351
[Define to 1 if ']gltype[' is a signed integer type.])])
278
352
for gltype in $1 ; do
286
360
eval result=\$gl_cv_type_${gltype}_signed
287
361
GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
288
362
if test "$result" = yes; then
289
AC_DEFINE_UNQUOTED([HAVE_SIGNED_${GLTYPE}], 1)
363
AC_DEFINE_UNQUOTED([HAVE_SIGNED_${GLTYPE}], [1])
290
364
eval HAVE_SIGNED_${GLTYPE}=1
292
366
eval HAVE_SIGNED_${GLTYPE}=0
295
AC_FOREACH([gltype], [$1],
369
m4_foreach_w([gltype], [$1],
296
370
[AC_SUBST([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
305
379
dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
307
381
dnl - extra AC_SUBST calls, so that the right substitutions are made.
308
AC_FOREACH([gltype], [$1],
382
m4_foreach_w([gltype], [$1],
309
383
[AH_TEMPLATE(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX],
310
384
[Define to l, ll, u, ul, ull, etc., as suitable for
311
385
constants of type ']gltype['.])])
331
405
ui64)gltype1='unsigned __int64';;
333
407
AC_COMPILE_IFELSE(
408
[AC_LANG_PROGRAM([$2[
335
409
extern $gltype foo;
336
extern $gltype1 foo;])],
410
extern $gltype1 foo;]])],
337
411
[eval gl_cv_type_${gltype}_suffix=\$glsuf])
338
412
eval result=\$gl_cv_type_${gltype}_suffix
339
413
test "$result" != no && break
342
416
eval result=\$gl_cv_type_${gltype}_suffix
343
417
test "$result" = no && result=
344
418
eval ${GLTYPE}_SUFFIX=\$result
345
AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], $result)
419
AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], [$result])
347
AC_FOREACH([gltype], [$1],
421
m4_foreach_w([gltype], [$1],
348
422
[AC_SUBST(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])])
365
439
dnl gl_STDINT_TYPE_PROPERTIES
366
440
dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t
367
dnl of interest to stdint_.h.
441
dnl of interest to stdint.in.h.
368
442
AC_DEFUN([gl_STDINT_TYPE_PROPERTIES],
370
gl_STDINT_BITSIZEOF([ptrdiff_t sig_atomic_t size_t wchar_t wint_t],
444
AC_REQUIRE([gl_MULTIARCH])
445
if test $APPLE_UNIVERSAL_BUILD = 0; then
446
gl_STDINT_BITSIZEOF([ptrdiff_t size_t],
447
[gl_STDINT_INCLUDES])
449
gl_STDINT_BITSIZEOF([sig_atomic_t wchar_t wint_t],
371
450
[gl_STDINT_INCLUDES])
372
451
gl_CHECK_TYPES_SIGNED([sig_atomic_t wchar_t wint_t],
373
452
[gl_STDINT_INCLUDES])
374
453
gl_cv_type_ptrdiff_t_signed=yes
375
454
gl_cv_type_size_t_signed=no
376
gl_INTEGER_TYPE_SUFFIX([ptrdiff_t sig_atomic_t size_t wchar_t wint_t],
455
if test $APPLE_UNIVERSAL_BUILD = 0; then
456
gl_INTEGER_TYPE_SUFFIX([ptrdiff_t size_t],
457
[gl_STDINT_INCLUDES])
459
gl_INTEGER_TYPE_SUFFIX([sig_atomic_t wchar_t wint_t],
377
460
[gl_STDINT_INCLUDES])