1 dnl @synopsis AX_CREATE_STDINT_H [( HEADER-TO-GENERATE [, HEDERS-TO-CHECK])]
3 dnl the "ISO C9X: 7.18 Integer types <stdint.h>" section requires the
4 dnl existence of an include file <stdint.h> that defines a set of
5 dnl typedefs, especially uint8_t,int32_t,uintptr_t. Many older
6 dnl installations will not provide this file, but some will have the
7 dnl very same definitions in <inttypes.h>. In other enviroments we can
8 dnl use the inet-types in <sys/types.h> which would define the typedefs
9 dnl int8_t and u_int8_t respectivly.
11 dnl This macros will create a local "_stdint.h" or the headerfile given
12 dnl as an argument. In many cases that file will just "#include
13 dnl <stdint.h>" or "#include <inttypes.h>", while in other environments
14 dnl it will provide the set of basic 'stdint's definitions/typedefs:
16 dnl int8_t,uint8_t,int16_t,uint16_t,int32_t,uint32_t,intptr_t,uintptr_t
17 dnl int_least32_t.. int_fast32_t.. intmax_t
19 dnl which may or may not rely on the definitions of other files, or
20 dnl using the AC_CHECK_SIZEOF macro to determine the actual sizeof each
23 dnl if your header files require the stdint-types you will want to
24 dnl create an installable file mylib-int.h that all your other
25 dnl installable header may include. So if you have a library package
26 dnl named "mylib", just use
28 dnl AX_CREATE_STDINT_H(mylib-int.h)
30 dnl in configure.ac and go to install that very header file in
31 dnl Makefile.am along with the other headers (mylib.h) - and the
32 dnl mylib-specific headers can simply use "#include <mylib-int.h>" to
33 dnl obtain the stdint-types.
35 dnl Remember, if the system already had a valid <stdint.h>, the
36 dnl generated file will include it directly. No need for fuzzy
37 dnl HAVE_STDINT_H things... (oops, GCC 4.2.x has deliberatly disabled
38 dnl its stdint.h for non-c99 compilation and the c99-mode is not the
39 dnl default. Therefore this macro will not use the compiler's stdint.h
40 dnl - please complain to the GCC developers).
43 dnl @author Guido U. Draheim <guidod@gmx.de>
44 dnl @version 2006-10-13
45 dnl @license GPLWithACException
47 AC_DEFUN([AX_CHECK_DATA_MODEL],[
49 AC_CHECK_SIZEOF(short)
52 AC_CHECK_SIZEOF(void*)
53 ac_cv_char_data_model=""
54 ac_cv_char_data_model="$ac_cv_char_data_model$ac_cv_sizeof_char"
55 ac_cv_char_data_model="$ac_cv_char_data_model$ac_cv_sizeof_short"
56 ac_cv_char_data_model="$ac_cv_char_data_model$ac_cv_sizeof_int"
57 ac_cv_long_data_model=""
58 ac_cv_long_data_model="$ac_cv_long_data_model$ac_cv_sizeof_int"
59 ac_cv_long_data_model="$ac_cv_long_data_model$ac_cv_sizeof_long"
60 ac_cv_long_data_model="$ac_cv_long_data_model$ac_cv_sizeof_voidp"
61 AC_MSG_CHECKING([data model])
62 case "$ac_cv_char_data_model/$ac_cv_long_data_model" in
63 122/242) ac_cv_data_model="IP16" ; n="standard 16bit machine" ;;
64 122/244) ac_cv_data_model="LP32" ; n="standard 32bit machine" ;;
65 122/*) ac_cv_data_model="i16" ; n="unusual int16 model" ;;
66 124/444) ac_cv_data_model="ILP32" ; n="standard 32bit unixish" ;;
67 124/488) ac_cv_data_model="LP64" ; n="standard 64bit unixish" ;;
68 124/448) ac_cv_data_model="LLP64" ; n="unusual 64bit unixish" ;;
69 124/*) ac_cv_data_model="i32" ; n="unusual int32 model" ;;
70 128/888) ac_cv_data_model="ILP64" ; n="unusual 64bit numeric" ;;
71 128/*) ac_cv_data_model="i64" ; n="unusual int64 model" ;;
72 222/*2) ac_cv_data_model="DSP16" ; n="strict 16bit dsptype" ;;
73 333/*3) ac_cv_data_model="DSP24" ; n="strict 24bit dsptype" ;;
74 444/*4) ac_cv_data_model="DSP32" ; n="strict 32bit dsptype" ;;
75 666/*6) ac_cv_data_model="DSP48" ; n="strict 48bit dsptype" ;;
76 888/*8) ac_cv_data_model="DSP64" ; n="strict 64bit dsptype" ;;
77 222/*|333/*|444/*|666/*|888/*) :
78 ac_cv_data_model="iDSP" ; n="unusual dsptype" ;;
79 *) ac_cv_data_model="none" ; n="very unusual model" ;;
81 AC_MSG_RESULT([$ac_cv_data_model ($ac_cv_long_data_model, $n)])
84 dnl AX_CHECK_HEADER_STDINT_X([HEADERLIST][,ACTION-IF])
85 AC_DEFUN([AX_CHECK_HEADER_STDINT_X],[
86 AC_CACHE_CHECK([for stdint uintptr_t], [ac_cv_header_stdint_x],[
87 ac_cv_header_stdint_x="" # the 1997 typedefs (inttypes.h)
89 for i in m4_ifval([$1],[$1],[stdint.h inttypes.h sys/inttypes.h sys/types.h])
91 unset ac_cv_type_uintptr_t
92 unset ac_cv_type_uint64_t
93 AC_CHECK_TYPE(uintptr_t,[ac_cv_header_stdint_x=$i],continue,[#include <$i>])
94 AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>])
95 m4_ifvaln([$1],[$1]) break
97 AC_MSG_CHECKING([for stdint uintptr_t])
101 AC_DEFUN([AX_CHECK_HEADER_STDINT_O],[
102 AC_CACHE_CHECK([for stdint uint32_t], [ac_cv_header_stdint_o],[
103 ac_cv_header_stdint_o="" # the 1995 typedefs (sys/inttypes.h)
104 AC_MSG_RESULT([(..)])
105 for i in m4_ifval([$1],[$1],[inttypes.h sys/inttypes.h sys/types.h stdint.h])
107 unset ac_cv_type_uint32_t
108 unset ac_cv_type_uint64_t
109 AC_CHECK_TYPE(uint32_t,[ac_cv_header_stdint_o=$i],continue,[#include <$i>])
110 AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>])
111 m4_ifvaln([$1],[$1]) break
114 AC_MSG_CHECKING([for stdint uint32_t])
118 AC_DEFUN([AX_CHECK_HEADER_STDINT_U],[
119 AC_CACHE_CHECK([for stdint u_int32_t], [ac_cv_header_stdint_u],[
120 ac_cv_header_stdint_u="" # the BSD typedefs (sys/types.h)
121 AC_MSG_RESULT([(..)])
122 for i in m4_ifval([$1],[$1],[sys/types.h inttypes.h sys/inttypes.h]) ; do
123 unset ac_cv_type_u_int32_t
124 unset ac_cv_type_u_int64_t
125 AC_CHECK_TYPE(u_int32_t,[ac_cv_header_stdint_u=$i],continue,[#include <$i>])
126 AC_CHECK_TYPE(u_int64_t,[and64="/u_int64_t"],[and64=""],[#include<$i>])
127 m4_ifvaln([$1],[$1]) break
130 AC_MSG_CHECKING([for stdint u_int32_t])
134 AC_DEFUN([AX_CREATE_STDINT_H],
135 [# ------ AX CREATE STDINT H -------------------------------------
136 AC_MSG_CHECKING([for stdint types])
137 ac_stdint_h=`echo ifelse($1, , _stdint.h, $1)`
138 # try to shortcircuit - if the default include path of the compiler
139 # can find a "stdint.h" header then we assume that all compilers can.
140 AC_CACHE_VAL([ac_cv_header_stdint_t],[
141 old_CXXFLAGS="$CXXFLAGS" ; CXXFLAGS=""
142 old_CPPFLAGS="$CPPFLAGS" ; CPPFLAGS=""
143 old_CFLAGS="$CFLAGS" ; CFLAGS=""
144 AC_TRY_COMPILE([#include <stdint.h>],[int_least32_t v = 0;],
145 [ac_cv_stdint_result="(assuming C99 compatible system)"
146 ac_cv_header_stdint_t="stdint.h"; ],
147 [ac_cv_header_stdint_t=""])
148 if test "$GCC" = "yes" && test ".$ac_cv_header_stdint_t" = "."; then
150 AC_TRY_COMPILE([#include <stdint.h>],[int_least32_t v = 0;],
151 [AC_MSG_WARN(your GCC compiler has a defunct stdint.h for its default-mode)])
153 CXXFLAGS="$old_CXXFLAGS"
154 CPPFLAGS="$old_CPPFLAGS"
155 CFLAGS="$old_CFLAGS" ])
157 v="... $ac_cv_header_stdint_h"
158 if test "$ac_stdint_h" = "stdint.h" ; then
159 AC_MSG_RESULT([(are you sure you want them in ./stdint.h?)])
160 elif test "$ac_stdint_h" = "inttypes.h" ; then
161 AC_MSG_RESULT([(are you sure you want them in ./inttypes.h?)])
162 elif test "_$ac_cv_header_stdint_t" = "_" ; then
163 AC_MSG_RESULT([(putting them into $ac_stdint_h)$v])
165 ac_cv_header_stdint="$ac_cv_header_stdint_t"
166 AC_MSG_RESULT([$ac_cv_header_stdint (shortcircuit)])
169 if test "_$ac_cv_header_stdint_t" = "_" ; then # can not shortcircuit..
171 dnl .....intro message done, now do a few system checks.....
172 dnl btw, all old CHECK_TYPE macros do automatically "DEFINE" a type,
173 dnl therefore we use the autoconf implementation detail CHECK_TYPE_NEW
174 dnl instead that is triggered with 3 or more arguments (see types.m4)
176 inttype_headers=`echo $2 | sed -e 's/,/ /g'`
178 ac_cv_stdint_result="(no helpful system typedefs seen)"
179 AX_CHECK_HEADER_STDINT_X(dnl
180 stdint.h inttypes.h sys/inttypes.h $inttype_headers,
181 ac_cv_stdint_result="(seen uintptr_t$and64 in $i)")
183 if test "_$ac_cv_header_stdint_x" = "_" ; then
184 AX_CHECK_HEADER_STDINT_O(dnl,
185 inttypes.h sys/inttypes.h stdint.h $inttype_headers,
186 ac_cv_stdint_result="(seen uint32_t$and64 in $i)")
189 if test "_$ac_cv_header_stdint_x" = "_" ; then
190 if test "_$ac_cv_header_stdint_o" = "_" ; then
191 AX_CHECK_HEADER_STDINT_U(dnl,
192 sys/types.h inttypes.h sys/inttypes.h $inttype_headers,
193 ac_cv_stdint_result="(seen u_int32_t$and64 in $i)")
196 dnl if there was no good C99 header file, do some typedef checks...
197 if test "_$ac_cv_header_stdint_x" = "_" ; then
198 AC_MSG_CHECKING([for stdint datatype model])
199 AC_MSG_RESULT([(..)])
203 if test "_$ac_cv_header_stdint_x" != "_" ; then
204 ac_cv_header_stdint="$ac_cv_header_stdint_x"
205 elif test "_$ac_cv_header_stdint_o" != "_" ; then
206 ac_cv_header_stdint="$ac_cv_header_stdint_o"
207 elif test "_$ac_cv_header_stdint_u" != "_" ; then
208 ac_cv_header_stdint="$ac_cv_header_stdint_u"
210 ac_cv_header_stdint="stddef.h"
213 AC_MSG_CHECKING([for extra inttypes in chosen header])
214 AC_MSG_RESULT([($ac_cv_header_stdint)])
215 dnl see if int_least and int_fast types are present in _this_ header.
216 unset ac_cv_type_int_least32_t
217 unset ac_cv_type_int_fast32_t
218 AC_CHECK_TYPE(int_least32_t,,,[#include <$ac_cv_header_stdint>])
219 AC_CHECK_TYPE(int_fast32_t,,,[#include<$ac_cv_header_stdint>])
220 AC_CHECK_TYPE(intmax_t,,,[#include <$ac_cv_header_stdint>])
222 fi # shortcircut to system "stdint.h"
223 # ------------------ PREPARE VARIABLES ------------------------------
224 if test "$GCC" = "yes" ; then
225 ac_cv_stdint_message="using gnu compiler "`$CC --version | head -1`
227 ac_cv_stdint_message="using $CC"
230 AC_MSG_RESULT([make use of $ac_cv_header_stdint in $ac_stdint_h dnl
231 $ac_cv_stdint_result])
233 dnl -----------------------------------------------------------------
234 # ----------------- DONE inttypes.h checks START header -------------
235 AC_CONFIG_COMMANDS([$ac_stdint_h],[
236 AC_MSG_NOTICE(creating $ac_stdint_h : $_ac_stdint_h)
237 ac_stdint=$tmp/_stdint.h
239 echo "#ifndef" $_ac_stdint_h >$ac_stdint
240 echo "#define" $_ac_stdint_h "1" >>$ac_stdint
241 echo "#ifndef" _GENERATED_STDINT_H >>$ac_stdint
242 echo "#define" _GENERATED_STDINT_H '"'$PACKAGE $VERSION'"' >>$ac_stdint
243 echo "/* generated $ac_cv_stdint_message */" >>$ac_stdint
244 if test "_$ac_cv_header_stdint_t" != "_" ; then
245 echo "#define _STDINT_HAVE_STDINT_H" "1" >>$ac_stdint
246 echo "#include <stdint.h>" >>$ac_stdint
247 echo "#endif" >>$ac_stdint
248 echo "#endif" >>$ac_stdint
251 cat >>$ac_stdint <<STDINT_EOF
253 /* ................... shortcircuit part ........................... */
255 #if defined HAVE_STDINT_H || defined _STDINT_HAVE_STDINT_H
260 /* .................... configured part ............................ */
264 echo "/* whether we have a C99 compatible stdint header file */" >>$ac_stdint
265 if test "_$ac_cv_header_stdint_x" != "_" ; then
266 ac_header="$ac_cv_header_stdint_x"
267 echo "#define _STDINT_HEADER_INTPTR" '"'"$ac_header"'"' >>$ac_stdint
269 echo "/* #undef _STDINT_HEADER_INTPTR */" >>$ac_stdint
272 echo "/* whether we have a C96 compatible inttypes header file */" >>$ac_stdint
273 if test "_$ac_cv_header_stdint_o" != "_" ; then
274 ac_header="$ac_cv_header_stdint_o"
275 echo "#define _STDINT_HEADER_UINT32" '"'"$ac_header"'"' >>$ac_stdint
277 echo "/* #undef _STDINT_HEADER_UINT32 */" >>$ac_stdint
280 echo "/* whether we have a BSD compatible inet types header */" >>$ac_stdint
281 if test "_$ac_cv_header_stdint_u" != "_" ; then
282 ac_header="$ac_cv_header_stdint_u"
283 echo "#define _STDINT_HEADER_U_INT32" '"'"$ac_header"'"' >>$ac_stdint
285 echo "/* #undef _STDINT_HEADER_U_INT32 */" >>$ac_stdint
290 if test "_$ac_header" != "_" ; then if test "$ac_header" != "stddef.h" ; then
291 echo "#include <$ac_header>" >>$ac_stdint
295 echo "/* which 64bit typedef has been found */" >>$ac_stdint
296 if test "$ac_cv_type_uint64_t" = "yes" ; then
297 echo "#define _STDINT_HAVE_UINT64_T" "1" >>$ac_stdint
299 echo "/* #undef _STDINT_HAVE_UINT64_T */" >>$ac_stdint
301 if test "$ac_cv_type_u_int64_t" = "yes" ; then
302 echo "#define _STDINT_HAVE_U_INT64_T" "1" >>$ac_stdint
304 echo "/* #undef _STDINT_HAVE_U_INT64_T */" >>$ac_stdint
308 echo "/* which type model has been detected */" >>$ac_stdint
309 if test "_$ac_cv_char_data_model" != "_" ; then
310 echo "#define _STDINT_CHAR_MODEL" "$ac_cv_char_data_model" >>$ac_stdint
311 echo "#define _STDINT_LONG_MODEL" "$ac_cv_long_data_model" >>$ac_stdint
313 echo "/* #undef _STDINT_CHAR_MODEL // skipped */" >>$ac_stdint
314 echo "/* #undef _STDINT_LONG_MODEL // skipped */" >>$ac_stdint
318 echo "/* whether int_least types were detected */" >>$ac_stdint
319 if test "$ac_cv_type_int_least32_t" = "yes"; then
320 echo "#define _STDINT_HAVE_INT_LEAST32_T" "1" >>$ac_stdint
322 echo "/* #undef _STDINT_HAVE_INT_LEAST32_T */" >>$ac_stdint
324 echo "/* whether int_fast types were detected */" >>$ac_stdint
325 if test "$ac_cv_type_int_fast32_t" = "yes"; then
326 echo "#define _STDINT_HAVE_INT_FAST32_T" "1" >>$ac_stdint
328 echo "/* #undef _STDINT_HAVE_INT_FAST32_T */" >>$ac_stdint
330 echo "/* whether intmax_t type was detected */" >>$ac_stdint
331 if test "$ac_cv_type_intmax_t" = "yes"; then
332 echo "#define _STDINT_HAVE_INTMAX_T" "1" >>$ac_stdint
334 echo "/* #undef _STDINT_HAVE_INTMAX_T */" >>$ac_stdint
338 cat >>$ac_stdint <<STDINT_EOF
339 /* .................... detections part ............................ */
341 /* whether we need to define bitspecific types from compiler base types */
342 #ifndef _STDINT_HEADER_INTPTR
343 #ifndef _STDINT_HEADER_UINT32
344 #ifndef _STDINT_HEADER_U_INT32
345 #define _STDINT_NEED_INT_MODEL_T
347 #define _STDINT_HAVE_U_INT_TYPES
352 #ifdef _STDINT_HAVE_U_INT_TYPES
353 #undef _STDINT_NEED_INT_MODEL_T
356 #ifdef _STDINT_CHAR_MODEL
357 #if _STDINT_CHAR_MODEL+0 == 122 || _STDINT_CHAR_MODEL+0 == 124
358 #ifndef _STDINT_BYTE_MODEL
359 #define _STDINT_BYTE_MODEL 12
364 #ifndef _STDINT_HAVE_INT_LEAST32_T
365 #define _STDINT_NEED_INT_LEAST_T
368 #ifndef _STDINT_HAVE_INT_FAST32_T
369 #define _STDINT_NEED_INT_FAST_T
372 #ifndef _STDINT_HEADER_INTPTR
373 #define _STDINT_NEED_INTPTR_T
374 #ifndef _STDINT_HAVE_INTMAX_T
375 #define _STDINT_NEED_INTMAX_T
380 /* .................... definition part ............................ */
382 /* some system headers have good uint64_t */
383 #ifndef _HAVE_UINT64_T
384 #if defined _STDINT_HAVE_UINT64_T || defined HAVE_UINT64_T
385 #define _HAVE_UINT64_T
386 #elif defined _STDINT_HAVE_U_INT64_T || defined HAVE_U_INT64_T
387 #define _HAVE_UINT64_T
388 typedef u_int64_t uint64_t;
392 #ifndef _HAVE_UINT64_T
393 /* .. here are some common heuristics using compiler runtime specifics */
394 #if defined __STDC_VERSION__ && defined __STDC_VERSION__ >= 199901L
395 #define _HAVE_UINT64_T
396 #define _HAVE_LONGLONG_UINT64_T
397 typedef long long int64_t;
398 typedef unsigned long long uint64_t;
400 #elif !defined __STRICT_ANSI__
401 #if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__
402 #define _HAVE_UINT64_T
403 typedef __int64 int64_t;
404 typedef unsigned __int64 uint64_t;
406 #elif defined __GNUC__ || defined __MWERKS__ || defined __ELF__
407 /* note: all ELF-systems seem to have loff-support which needs 64-bit */
408 #if !defined _NO_LONGLONG
409 #define _HAVE_UINT64_T
410 #define _HAVE_LONGLONG_UINT64_T
411 typedef long long int64_t;
412 typedef unsigned long long uint64_t;
415 #elif defined __alpha || (defined __mips && defined _ABIN32)
416 #if !defined _NO_LONGLONG
417 typedef long int64_t;
418 typedef unsigned long uint64_t;
420 /* compiler/cpu type to define int64_t */
425 #if defined _STDINT_HAVE_U_INT_TYPES
426 /* int8_t int16_t int32_t defined by inet code, redeclare the u_intXX types */
427 typedef u_int8_t uint8_t;
428 typedef u_int16_t uint16_t;
429 typedef u_int32_t uint32_t;
431 /* glibc compatibility */
432 #ifndef __int8_t_defined
433 #define __int8_t_defined
437 #ifdef _STDINT_NEED_INT_MODEL_T
438 /* we must guess all the basic types. Apart from byte-adressable system, */
439 /* there a few 32-bit-only dsp-systems that we guard with BYTE_MODEL 8-} */
440 /* (btw, those nibble-addressable systems are way off, or so we assume) */
442 dnl /* have a look at "64bit and data size neutrality" at */
443 dnl /* http://unix.org/version2/whatsnew/login_64bit.html */
444 dnl /* (the shorthand "ILP" types always have a "P" part) */
446 #if defined _STDINT_BYTE_MODEL
447 #if _STDINT_LONG_MODEL+0 == 242
448 /* 2:4:2 = IP16 = a normal 16-bit system */
449 typedef unsigned char uint8_t;
450 typedef unsigned short uint16_t;
451 typedef unsigned long uint32_t;
452 #ifndef __int8_t_defined
453 #define __int8_t_defined
455 typedef short int16_t;
456 typedef long int32_t;
458 #elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL == 444
459 /* 2:4:4 = LP32 = a 32-bit system derived from a 16-bit */
460 /* 4:4:4 = ILP32 = a normal 32-bit system */
461 typedef unsigned char uint8_t;
462 typedef unsigned short uint16_t;
463 typedef unsigned int uint32_t;
464 #ifndef __int8_t_defined
465 #define __int8_t_defined
467 typedef short int16_t;
470 #elif _STDINT_LONG_MODEL+0 == 484 || _STDINT_LONG_MODEL+0 == 488
471 /* 4:8:4 = IP32 = a 32-bit system prepared for 64-bit */
472 /* 4:8:8 = LP64 = a normal 64-bit system */
473 typedef unsigned char uint8_t;
474 typedef unsigned short uint16_t;
475 typedef unsigned int uint32_t;
476 #ifndef __int8_t_defined
477 #define __int8_t_defined
479 typedef short int16_t;
482 /* this system has a "long" of 64bit */
483 #ifndef _HAVE_UINT64_T
484 #define _HAVE_UINT64_T
485 typedef unsigned long uint64_t;
486 typedef long int64_t;
488 #elif _STDINT_LONG_MODEL+0 == 448
489 /* LLP64 a 64-bit system derived from a 32-bit system */
490 typedef unsigned char uint8_t;
491 typedef unsigned short uint16_t;
492 typedef unsigned int uint32_t;
493 #ifndef __int8_t_defined
494 #define __int8_t_defined
496 typedef short int16_t;
499 /* assuming the system has a "long long" */
500 #ifndef _HAVE_UINT64_T
501 #define _HAVE_UINT64_T
502 #define _HAVE_LONGLONG_UINT64_T
503 typedef unsigned long long uint64_t;
504 typedef long long int64_t;
507 #define _STDINT_NO_INT32_T
510 #define _STDINT_NO_INT8_T
511 #define _STDINT_NO_INT32_T
516 * quote from SunOS-5.8 sys/inttypes.h:
517 * Use at your own risk. As of February 1996, the committee is squarely
518 * behind the fixed sized types; the "least" and "fast" types are still being
519 * discussed. The probability that the "fast" types may be removed before
520 * the standard is finalized is high enough that they are not currently
524 #if defined _STDINT_NEED_INT_LEAST_T
525 typedef int8_t int_least8_t;
526 typedef int16_t int_least16_t;
527 typedef int32_t int_least32_t;
528 #ifdef _HAVE_UINT64_T
529 typedef int64_t int_least64_t;
532 typedef uint8_t uint_least8_t;
533 typedef uint16_t uint_least16_t;
534 typedef uint32_t uint_least32_t;
535 #ifdef _HAVE_UINT64_T
536 typedef uint64_t uint_least64_t;
541 #if defined _STDINT_NEED_INT_FAST_T
542 typedef int8_t int_fast8_t;
543 typedef int int_fast16_t;
544 typedef int32_t int_fast32_t;
545 #ifdef _HAVE_UINT64_T
546 typedef int64_t int_fast64_t;
549 typedef uint8_t uint_fast8_t;
550 typedef unsigned uint_fast16_t;
551 typedef uint32_t uint_fast32_t;
552 #ifdef _HAVE_UINT64_T
553 typedef uint64_t uint_fast64_t;
558 #ifdef _STDINT_NEED_INTMAX_T
559 #ifdef _HAVE_UINT64_T
560 typedef int64_t intmax_t;
561 typedef uint64_t uintmax_t;
563 typedef long intmax_t;
564 typedef unsigned long uintmax_t;
568 #ifdef _STDINT_NEED_INTPTR_T
569 #ifndef __intptr_t_defined
570 #define __intptr_t_defined
571 /* we encourage using "long" to store pointer values, never use "int" ! */
572 #if _STDINT_LONG_MODEL+0 == 242 || _STDINT_LONG_MODEL+0 == 484
573 typedef unsigned int uintptr_t;
574 typedef int intptr_t;
575 #elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL+0 == 444
576 typedef unsigned long uintptr_t;
577 typedef long intptr_t;
578 #elif _STDINT_LONG_MODEL+0 == 448 && defined _HAVE_UINT64_T
579 typedef uint64_t uintptr_t;
580 typedef int64_t intptr_t;
581 #else /* matches typical system types ILP32 and LP64 - but not IP16 or LLP64 */
582 typedef unsigned long uintptr_t;
583 typedef long intptr_t;
588 /* The ISO C99 standard specifies that in C++ implementations these
589 should only be defined if explicitly requested. */
590 #if !defined __cplusplus || defined __STDC_CONSTANT_MACROS
595 # define INT16_C(c) c
596 # define INT32_C(c) c
597 # ifdef _HAVE_LONGLONG_UINT64_T
598 # define INT64_C(c) c ## L
600 # define INT64_C(c) c ## LL
604 # define UINT8_C(c) c ## U
605 # define UINT16_C(c) c ## U
606 # define UINT32_C(c) c ## U
607 # ifdef _HAVE_LONGLONG_UINT64_T
608 # define UINT64_C(c) c ## UL
610 # define UINT64_C(c) c ## ULL
614 # ifdef _HAVE_LONGLONG_UINT64_T
615 # define INTMAX_C(c) c ## L
616 # define UINTMAX_C(c) c ## UL
618 # define INTMAX_C(c) c ## LL
619 # define UINTMAX_C(c) c ## ULL
626 /* These limits are merily those of a two complement byte-oriented system */
628 /* Minimum of signed integral types. */
629 # define INT8_MIN (-128)
630 # define INT16_MIN (-32767-1)
631 # define INT32_MIN (-2147483647-1)
632 # define INT64_MIN (-__INT64_C(9223372036854775807)-1)
633 /* Maximum of signed integral types. */
634 # define INT8_MAX (127)
635 # define INT16_MAX (32767)
636 # define INT32_MAX (2147483647)
637 # define INT64_MAX (__INT64_C(9223372036854775807))
639 /* Maximum of unsigned integral types. */
640 # define UINT8_MAX (255)
641 # define UINT16_MAX (65535)
642 # define UINT32_MAX (4294967295U)
643 # define UINT64_MAX (__UINT64_C(18446744073709551615))
645 /* Minimum of signed integral types having a minimum size. */
646 # define INT_LEAST8_MIN INT8_MIN
647 # define INT_LEAST16_MIN INT16_MIN
648 # define INT_LEAST32_MIN INT32_MIN
649 # define INT_LEAST64_MIN INT64_MIN
650 /* Maximum of signed integral types having a minimum size. */
651 # define INT_LEAST8_MAX INT8_MAX
652 # define INT_LEAST16_MAX INT16_MAX
653 # define INT_LEAST32_MAX INT32_MAX
654 # define INT_LEAST64_MAX INT64_MAX
656 /* Maximum of unsigned integral types having a minimum size. */
657 # define UINT_LEAST8_MAX UINT8_MAX
658 # define UINT_LEAST16_MAX UINT16_MAX
659 # define UINT_LEAST32_MAX UINT32_MAX
660 # define UINT_LEAST64_MAX UINT64_MAX
669 if cmp -s $ac_stdint_h $ac_stdint 2>/dev/null; then
670 AC_MSG_NOTICE([$ac_stdint_h is unchanged])
672 ac_dir=`AS_DIRNAME(["$ac_stdint_h"])`
673 AS_MKDIR_P(["$ac_dir"])
675 mv $ac_stdint $ac_stdint_h
677 ],[# variables for create stdint.h replacement
680 ac_stdint_h="$ac_stdint_h"
681 _ac_stdint_h=AS_TR_CPP(_$PACKAGE-$ac_stdint_h)
682 ac_cv_stdint_message="$ac_cv_stdint_message"
683 ac_cv_header_stdint_t="$ac_cv_header_stdint_t"
684 ac_cv_header_stdint_x="$ac_cv_header_stdint_x"
685 ac_cv_header_stdint_o="$ac_cv_header_stdint_o"
686 ac_cv_header_stdint_u="$ac_cv_header_stdint_u"
687 ac_cv_type_uint64_t="$ac_cv_type_uint64_t"
688 ac_cv_type_u_int64_t="$ac_cv_type_u_int64_t"
689 ac_cv_char_data_model="$ac_cv_char_data_model"
690 ac_cv_long_data_model="$ac_cv_long_data_model"
691 ac_cv_type_int_least32_t="$ac_cv_type_int_least32_t"
692 ac_cv_type_int_fast32_t="$ac_cv_type_int_fast32_t"
693 ac_cv_type_intmax_t="$ac_cv_type_intmax_t"