~youscribe/parted/3.1

« back to all changes in this revision

Viewing changes to m4/stdint.m4

  • Committer: Guilhem Lettron
  • Date: 2012-10-22 14:37:59 UTC
  • Revision ID: guilhem+ubuntu@lettron.fr-20121022143759-m403kecgz13sknvp
3.1 from tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# stdint.m4 serial 43
 
2
dnl Copyright (C) 2001-2012 Free Software Foundation, Inc.
 
3
dnl This file is free software; the Free Software Foundation
 
4
dnl gives unlimited permission to copy and/or distribute it,
 
5
dnl with or without modifications, as long as this notice is preserved.
 
6
 
 
7
dnl From Paul Eggert and Bruno Haible.
 
8
dnl Test whether <stdint.h> is supported or must be substituted.
 
9
 
 
10
AC_DEFUN_ONCE([gl_STDINT_H],
 
11
[
 
12
  AC_PREREQ([2.59])dnl
 
13
 
 
14
  dnl Check for long long int and unsigned long long int.
 
15
  AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
 
16
  if test $ac_cv_type_long_long_int = yes; then
 
17
    HAVE_LONG_LONG_INT=1
 
18
  else
 
19
    HAVE_LONG_LONG_INT=0
 
20
  fi
 
21
  AC_SUBST([HAVE_LONG_LONG_INT])
 
22
  AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
 
23
  if test $ac_cv_type_unsigned_long_long_int = yes; then
 
24
    HAVE_UNSIGNED_LONG_LONG_INT=1
 
25
  else
 
26
    HAVE_UNSIGNED_LONG_LONG_INT=0
 
27
  fi
 
28
  AC_SUBST([HAVE_UNSIGNED_LONG_LONG_INT])
 
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
 
 
39
  dnl Check for <inttypes.h>.
 
40
  dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h.
 
41
  if test $ac_cv_header_inttypes_h = yes; then
 
42
    HAVE_INTTYPES_H=1
 
43
  else
 
44
    HAVE_INTTYPES_H=0
 
45
  fi
 
46
  AC_SUBST([HAVE_INTTYPES_H])
 
47
 
 
48
  dnl Check for <sys/types.h>.
 
49
  dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_sys_types_h.
 
50
  if test $ac_cv_header_sys_types_h = yes; then
 
51
    HAVE_SYS_TYPES_H=1
 
52
  else
 
53
    HAVE_SYS_TYPES_H=0
 
54
  fi
 
55
  AC_SUBST([HAVE_SYS_TYPES_H])
 
56
 
 
57
  gl_CHECK_NEXT_HEADERS([stdint.h])
 
58
  if test $ac_cv_header_stdint_h = yes; then
 
59
    HAVE_STDINT_H=1
 
60
  else
 
61
    HAVE_STDINT_H=0
 
62
  fi
 
63
  AC_SUBST([HAVE_STDINT_H])
 
64
 
 
65
  dnl Now see whether we need a substitute <stdint.h>.
 
66
  if test $ac_cv_header_stdint_h = yes; then
 
67
    AC_CACHE_CHECK([whether stdint.h conforms to C99],
 
68
      [gl_cv_header_working_stdint_h],
 
69
      [gl_cv_header_working_stdint_h=no
 
70
       AC_COMPILE_IFELSE([
 
71
         AC_LANG_PROGRAM([[
 
72
#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
 
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
#include <limits.h> /* for CHAR_BIT */
 
154
#define TYPE_MINIMUM(t) \
 
155
  ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t)))
 
156
#define TYPE_MAXIMUM(t) \
 
157
  ((t) ((t) 0 < (t) -1 \
 
158
        ? (t) -1 \
 
159
        : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1)))
 
160
struct s {
 
161
  int check_PTRDIFF:
 
162
      PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t)
 
163
      && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t)
 
164
      ? 1 : -1;
 
165
  /* Detect bug in FreeBSD 6.0 / ia64.  */
 
166
  int check_SIG_ATOMIC:
 
167
      SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t)
 
168
      && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t)
 
169
      ? 1 : -1;
 
170
  int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1;
 
171
  int check_WCHAR:
 
172
      WCHAR_MIN == TYPE_MINIMUM (wchar_t)
 
173
      && WCHAR_MAX == TYPE_MAXIMUM (wchar_t)
 
174
      ? 1 : -1;
 
175
  /* Detect bug in mingw.  */
 
176
  int check_WINT:
 
177
      WINT_MIN == TYPE_MINIMUM (wint_t)
 
178
      && WINT_MAX == TYPE_MAXIMUM (wint_t)
 
179
      ? 1 : -1;
 
180
 
 
181
  /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others.  */
 
182
  int check_UINT8_C:
 
183
        (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1;
 
184
  int check_UINT16_C:
 
185
        (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1;
 
186
 
 
187
  /* Detect bugs in OpenBSD 3.9 stdint.h.  */
 
188
#ifdef UINT8_MAX
 
189
  int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1;
 
190
#endif
 
191
#ifdef UINT16_MAX
 
192
  int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1;
 
193
#endif
 
194
#ifdef UINT32_MAX
 
195
  int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1;
 
196
#endif
 
197
#ifdef UINT64_MAX
 
198
  int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1;
 
199
#endif
 
200
  int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1;
 
201
  int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1;
 
202
  int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1;
 
203
  int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1;
 
204
  int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1;
 
205
  int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1;
 
206
  int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1;
 
207
  int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1;
 
208
  int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1;
 
209
  int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1;
 
210
  int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1;
 
211
};
 
212
         ]])],
 
213
         [dnl Determine whether the various *_MIN, *_MAX macros are usable
 
214
          dnl in preprocessor expression. We could do it by compiling a test
 
215
          dnl program for each of these macros. It is faster to run a program
 
216
          dnl that inspects the macro expansion.
 
217
          dnl This detects a bug on HP-UX 11.23/ia64.
 
218
          AC_RUN_IFELSE([
 
219
            AC_LANG_PROGRAM([[
 
220
#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
 
221
#include <stdint.h>
 
222
]
 
223
gl_STDINT_INCLUDES
 
224
[
 
225
#include <stdio.h>
 
226
#include <string.h>
 
227
#define MVAL(macro) MVAL1(macro)
 
228
#define MVAL1(expression) #expression
 
229
static const char *macro_values[] =
 
230
  {
 
231
#ifdef INT8_MAX
 
232
    MVAL (INT8_MAX),
 
233
#endif
 
234
#ifdef INT16_MAX
 
235
    MVAL (INT16_MAX),
 
236
#endif
 
237
#ifdef INT32_MAX
 
238
    MVAL (INT32_MAX),
 
239
#endif
 
240
#ifdef INT64_MAX
 
241
    MVAL (INT64_MAX),
 
242
#endif
 
243
#ifdef UINT8_MAX
 
244
    MVAL (UINT8_MAX),
 
245
#endif
 
246
#ifdef UINT16_MAX
 
247
    MVAL (UINT16_MAX),
 
248
#endif
 
249
#ifdef UINT32_MAX
 
250
    MVAL (UINT32_MAX),
 
251
#endif
 
252
#ifdef UINT64_MAX
 
253
    MVAL (UINT64_MAX),
 
254
#endif
 
255
    NULL
 
256
  };
 
257
]], [[
 
258
  const char **mv;
 
259
  for (mv = macro_values; *mv != NULL; mv++)
 
260
    {
 
261
      const char *value = *mv;
 
262
      /* Test whether it looks like a cast expression.  */
 
263
      if (strncmp (value, "((unsigned int)"/*)*/, 15) == 0
 
264
          || strncmp (value, "((unsigned short)"/*)*/, 17) == 0
 
265
          || strncmp (value, "((unsigned char)"/*)*/, 16) == 0
 
266
          || strncmp (value, "((int)"/*)*/, 6) == 0
 
267
          || strncmp (value, "((signed short)"/*)*/, 15) == 0
 
268
          || strncmp (value, "((signed char)"/*)*/, 14) == 0)
 
269
        return mv - macro_values + 1;
 
270
    }
 
271
  return 0;
 
272
]])],
 
273
              [gl_cv_header_working_stdint_h=yes],
 
274
              [],
 
275
              [dnl When cross-compiling, assume it works.
 
276
               gl_cv_header_working_stdint_h=yes
 
277
              ])
 
278
         ])
 
279
      ])
 
280
  fi
 
281
  if test "$gl_cv_header_working_stdint_h" = yes; then
 
282
    STDINT_H=
 
283
  else
 
284
    dnl Check for <sys/inttypes.h>, and for
 
285
    dnl <sys/bitypes.h> (used in Linux libc4 >= 4.6.7 and libc5).
 
286
    AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h])
 
287
    if test $ac_cv_header_sys_inttypes_h = yes; then
 
288
      HAVE_SYS_INTTYPES_H=1
 
289
    else
 
290
      HAVE_SYS_INTTYPES_H=0
 
291
    fi
 
292
    AC_SUBST([HAVE_SYS_INTTYPES_H])
 
293
    if test $ac_cv_header_sys_bitypes_h = yes; then
 
294
      HAVE_SYS_BITYPES_H=1
 
295
    else
 
296
      HAVE_SYS_BITYPES_H=0
 
297
    fi
 
298
    AC_SUBST([HAVE_SYS_BITYPES_H])
 
299
 
 
300
    gl_STDINT_TYPE_PROPERTIES
 
301
    STDINT_H=stdint.h
 
302
  fi
 
303
  AC_SUBST([STDINT_H])
 
304
  AM_CONDITIONAL([GL_GENERATE_STDINT_H], [test -n "$STDINT_H"])
 
305
])
 
306
 
 
307
dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES)
 
308
dnl Determine the size of each of the given types in bits.
 
309
AC_DEFUN([gl_STDINT_BITSIZEOF],
 
310
[
 
311
  dnl Use a shell loop, to avoid bloating configure, and
 
312
  dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
 
313
  dnl   config.h.in,
 
314
  dnl - extra AC_SUBST calls, so that the right substitutions are made.
 
315
  m4_foreach_w([gltype], [$1],
 
316
    [AH_TEMPLATE([BITSIZEOF_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
 
317
       [Define to the number of bits in type ']gltype['.])])
 
318
  for gltype in $1 ; do
 
319
    AC_CACHE_CHECK([for bit size of $gltype], [gl_cv_bitsizeof_${gltype}],
 
320
      [AC_COMPUTE_INT([result], [sizeof ($gltype) * CHAR_BIT],
 
321
         [$2
 
322
#include <limits.h>], [result=unknown])
 
323
       eval gl_cv_bitsizeof_${gltype}=\$result
 
324
      ])
 
325
    eval result=\$gl_cv_bitsizeof_${gltype}
 
326
    if test $result = unknown; then
 
327
      dnl Use a nonempty default, because some compilers, such as IRIX 5 cc,
 
328
      dnl do a syntax check even on unused #if conditions and give an error
 
329
      dnl on valid C code like this:
 
330
      dnl   #if 0
 
331
      dnl   # if  > 32
 
332
      dnl   # endif
 
333
      dnl   #endif
 
334
      result=0
 
335
    fi
 
336
    GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
 
337
    AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result])
 
338
    eval BITSIZEOF_${GLTYPE}=\$result
 
339
  done
 
340
  m4_foreach_w([gltype], [$1],
 
341
    [AC_SUBST([BITSIZEOF_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
 
342
])
 
343
 
 
344
dnl gl_CHECK_TYPES_SIGNED(TYPES, INCLUDES)
 
345
dnl Determine the signedness of each of the given types.
 
346
dnl Define HAVE_SIGNED_TYPE if type is signed.
 
347
AC_DEFUN([gl_CHECK_TYPES_SIGNED],
 
348
[
 
349
  dnl Use a shell loop, to avoid bloating configure, and
 
350
  dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
 
351
  dnl   config.h.in,
 
352
  dnl - extra AC_SUBST calls, so that the right substitutions are made.
 
353
  m4_foreach_w([gltype], [$1],
 
354
    [AH_TEMPLATE([HAVE_SIGNED_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
 
355
       [Define to 1 if ']gltype[' is a signed integer type.])])
 
356
  for gltype in $1 ; do
 
357
    AC_CACHE_CHECK([whether $gltype is signed], [gl_cv_type_${gltype}_signed],
 
358
      [AC_COMPILE_IFELSE(
 
359
         [AC_LANG_PROGRAM([$2[
 
360
            int verify[2 * (($gltype) -1 < ($gltype) 0) - 1];]])],
 
361
         result=yes, result=no)
 
362
       eval gl_cv_type_${gltype}_signed=\$result
 
363
      ])
 
364
    eval result=\$gl_cv_type_${gltype}_signed
 
365
    GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
 
366
    if test "$result" = yes; then
 
367
      AC_DEFINE_UNQUOTED([HAVE_SIGNED_${GLTYPE}], [1])
 
368
      eval HAVE_SIGNED_${GLTYPE}=1
 
369
    else
 
370
      eval HAVE_SIGNED_${GLTYPE}=0
 
371
    fi
 
372
  done
 
373
  m4_foreach_w([gltype], [$1],
 
374
    [AC_SUBST([HAVE_SIGNED_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
 
375
])
 
376
 
 
377
dnl gl_INTEGER_TYPE_SUFFIX(TYPES, INCLUDES)
 
378
dnl Determine the suffix to use for integer constants of the given types.
 
379
dnl Define t_SUFFIX for each such type.
 
380
AC_DEFUN([gl_INTEGER_TYPE_SUFFIX],
 
381
[
 
382
  dnl Use a shell loop, to avoid bloating configure, and
 
383
  dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
 
384
  dnl   config.h.in,
 
385
  dnl - extra AC_SUBST calls, so that the right substitutions are made.
 
386
  m4_foreach_w([gltype], [$1],
 
387
    [AH_TEMPLATE(m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX],
 
388
       [Define to l, ll, u, ul, ull, etc., as suitable for
 
389
        constants of type ']gltype['.])])
 
390
  for gltype in $1 ; do
 
391
    AC_CACHE_CHECK([for $gltype integer literal suffix],
 
392
      [gl_cv_type_${gltype}_suffix],
 
393
      [eval gl_cv_type_${gltype}_suffix=no
 
394
       eval result=\$gl_cv_type_${gltype}_signed
 
395
       if test "$result" = yes; then
 
396
         glsufu=
 
397
       else
 
398
         glsufu=u
 
399
       fi
 
400
       for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do
 
401
         case $glsuf in
 
402
           '')  gltype1='int';;
 
403
           l)   gltype1='long int';;
 
404
           ll)  gltype1='long long int';;
 
405
           i64) gltype1='__int64';;
 
406
           u)   gltype1='unsigned int';;
 
407
           ul)  gltype1='unsigned long int';;
 
408
           ull) gltype1='unsigned long long int';;
 
409
           ui64)gltype1='unsigned __int64';;
 
410
         esac
 
411
         AC_COMPILE_IFELSE(
 
412
           [AC_LANG_PROGRAM([$2[
 
413
              extern $gltype foo;
 
414
              extern $gltype1 foo;]])],
 
415
           [eval gl_cv_type_${gltype}_suffix=\$glsuf])
 
416
         eval result=\$gl_cv_type_${gltype}_suffix
 
417
         test "$result" != no && break
 
418
       done])
 
419
    GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
 
420
    eval result=\$gl_cv_type_${gltype}_suffix
 
421
    test "$result" = no && result=
 
422
    eval ${GLTYPE}_SUFFIX=\$result
 
423
    AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], [$result])
 
424
  done
 
425
  m4_foreach_w([gltype], [$1],
 
426
    [AC_SUBST(m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])])
 
427
])
 
428
 
 
429
dnl gl_STDINT_INCLUDES
 
430
AC_DEFUN([gl_STDINT_INCLUDES],
 
431
[[
 
432
  /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
 
433
     included before <wchar.h>.  */
 
434
  #include <stddef.h>
 
435
  #include <signal.h>
 
436
  #if HAVE_WCHAR_H
 
437
  # include <stdio.h>
 
438
  # include <time.h>
 
439
  # include <wchar.h>
 
440
  #endif
 
441
]])
 
442
 
 
443
dnl gl_STDINT_TYPE_PROPERTIES
 
444
dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t
 
445
dnl of interest to stdint.in.h.
 
446
AC_DEFUN([gl_STDINT_TYPE_PROPERTIES],
 
447
[
 
448
  AC_REQUIRE([gl_MULTIARCH])
 
449
  if test $APPLE_UNIVERSAL_BUILD = 0; then
 
450
    gl_STDINT_BITSIZEOF([ptrdiff_t size_t],
 
451
      [gl_STDINT_INCLUDES])
 
452
  fi
 
453
  gl_STDINT_BITSIZEOF([sig_atomic_t wchar_t wint_t],
 
454
    [gl_STDINT_INCLUDES])
 
455
  gl_CHECK_TYPES_SIGNED([sig_atomic_t wchar_t wint_t],
 
456
    [gl_STDINT_INCLUDES])
 
457
  gl_cv_type_ptrdiff_t_signed=yes
 
458
  gl_cv_type_size_t_signed=no
 
459
  if test $APPLE_UNIVERSAL_BUILD = 0; then
 
460
    gl_INTEGER_TYPE_SUFFIX([ptrdiff_t size_t],
 
461
      [gl_STDINT_INCLUDES])
 
462
  fi
 
463
  gl_INTEGER_TYPE_SUFFIX([sig_atomic_t wchar_t wint_t],
 
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
 
473
])
 
474
 
 
475
dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
 
476
dnl Remove this when we can assume autoconf >= 2.61.
 
477
m4_ifdef([AC_COMPUTE_INT], [], [
 
478
  AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])
 
479
])
 
480
 
 
481
# Hey Emacs!
 
482
# Local Variables:
 
483
# indent-tabs-mode: nil
 
484
# End: