1 # ===========================================================================
2 # http://autoconf-archive.cryp.to/ax_create_stdint_h.html
3 # ===========================================================================
7 # AX_CREATE_STDINT_H [( HEADER-TO-GENERATE [, HEDERS-TO-CHECK])]
11 # the "ISO C9X: 7.18 Integer types <stdint.h>" section requires the
12 # existence of an include file <stdint.h> that defines a set of typedefs,
13 # especially uint8_t,int32_t,uintptr_t. Many older installations will not
14 # provide this file, but some will have the very same definitions in
15 # <inttypes.h>. In other enviroments we can use the inet-types in
16 # <sys/types.h> which would define the typedefs int8_t and u_int8_t
19 # This macros will create a local "_stdint.h" or the headerfile given as
20 # an argument. In many cases that file will just "#include <stdint.h>" or
21 # "#include <inttypes.h>", while in other environments it will provide the
22 # set of basic 'stdint's definitions/typedefs:
24 # int8_t,uint8_t,int16_t,uint16_t,int32_t,uint32_t,intptr_t,uintptr_t
25 # int_least32_t.. int_fast32_t.. intmax_t
27 # which may or may not rely on the definitions of other files, or using
28 # the AC_CHECK_SIZEOF macro to determine the actual sizeof each type.
30 # if your header files require the stdint-types you will want to create an
31 # installable file mylib-int.h that all your other installable header may
32 # include. So if you have a library package named "mylib", just use
34 # AX_CREATE_STDINT_H(mylib-int.h)
36 # in configure.ac and go to install that very header file in Makefile.am
37 # along with the other headers (mylib.h) - and the mylib-specific headers
38 # can simply use "#include <mylib-int.h>" to obtain the stdint-types.
40 # Remember, if the system already had a valid <stdint.h>, the generated
41 # file will include it directly. No need for fuzzy HAVE_STDINT_H things...
42 # (oops, GCC 4.2.x has deliberatly disabled its stdint.h for non-c99
43 # compilation and the c99-mode is not the default. Therefore this macro
44 # will not use the compiler's stdint.h - please complain to the GCC
53 # Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
55 # This program is free software; you can redistribute it and/or modify it
56 # under the terms of the GNU General Public License as published by the
57 # Free Software Foundation; either version 2 of the License, or (at your
58 # option) any later version.
60 # This program is distributed in the hope that it will be useful, but
61 # WITHOUT ANY WARRANTY; without even the implied warranty of
62 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
63 # Public License for more details.
65 # You should have received a copy of the GNU General Public License along
66 # with this program. If not, see <http://www.gnu.org/licenses/>.
68 # As a special exception, the respective Autoconf Macro's copyright owner
69 # gives unlimited permission to copy, distribute and modify the configure
70 # scripts that are the output of Autoconf when processing the Macro. You
71 # need not follow the terms of the GNU General Public License when using
72 # or distributing such scripts, even though portions of the text of the
73 # Macro appear in them. The GNU General Public License (GPL) does govern
74 # all other use of the material that constitutes the Autoconf Macro.
76 # This special exception to the GPL applies to versions of the Autoconf
77 # Macro released by the Autoconf Macro Archive. When you make and
78 # distribute a modified version of the Autoconf Macro, you may extend this
79 # special exception to the GPL to apply to your modified version as well.
81 AC_DEFUN([AX_CHECK_DATA_MODEL],[
83 AC_CHECK_SIZEOF(short)
86 AC_CHECK_SIZEOF(void*)
87 ac_cv_char_data_model=""
88 ac_cv_char_data_model="$ac_cv_char_data_model$ac_cv_sizeof_char"
89 ac_cv_char_data_model="$ac_cv_char_data_model$ac_cv_sizeof_short"
90 ac_cv_char_data_model="$ac_cv_char_data_model$ac_cv_sizeof_int"
91 ac_cv_long_data_model=""
92 ac_cv_long_data_model="$ac_cv_long_data_model$ac_cv_sizeof_int"
93 ac_cv_long_data_model="$ac_cv_long_data_model$ac_cv_sizeof_long"
94 ac_cv_long_data_model="$ac_cv_long_data_model$ac_cv_sizeof_voidp"
95 AC_MSG_CHECKING([data model])
96 case "$ac_cv_char_data_model/$ac_cv_long_data_model" in
97 122/242) ac_cv_data_model="IP16" ; n="standard 16bit machine" ;;
98 122/244) ac_cv_data_model="LP32" ; n="standard 32bit machine" ;;
99 122/*) ac_cv_data_model="i16" ; n="unusual int16 model" ;;
100 124/444) ac_cv_data_model="ILP32" ; n="standard 32bit unixish" ;;
101 124/488) ac_cv_data_model="LP64" ; n="standard 64bit unixish" ;;
102 124/448) ac_cv_data_model="LLP64" ; n="unusual 64bit unixish" ;;
103 124/*) ac_cv_data_model="i32" ; n="unusual int32 model" ;;
104 128/888) ac_cv_data_model="ILP64" ; n="unusual 64bit numeric" ;;
105 128/*) ac_cv_data_model="i64" ; n="unusual int64 model" ;;
106 222/*2) ac_cv_data_model="DSP16" ; n="strict 16bit dsptype" ;;
107 333/*3) ac_cv_data_model="DSP24" ; n="strict 24bit dsptype" ;;
108 444/*4) ac_cv_data_model="DSP32" ; n="strict 32bit dsptype" ;;
109 666/*6) ac_cv_data_model="DSP48" ; n="strict 48bit dsptype" ;;
110 888/*8) ac_cv_data_model="DSP64" ; n="strict 64bit dsptype" ;;
111 222/*|333/*|444/*|666/*|888/*) :
112 ac_cv_data_model="iDSP" ; n="unusual dsptype" ;;
113 *) ac_cv_data_model="none" ; n="very unusual model" ;;
115 AC_MSG_RESULT([$ac_cv_data_model ($ac_cv_long_data_model, $n)])
118 dnl AX_CHECK_HEADER_STDINT_X([HEADERLIST][,ACTION-IF])
119 AC_DEFUN([AX_CHECK_HEADER_STDINT_X],[
120 AC_CACHE_CHECK([for stdint uintptr_t], [ac_cv_header_stdint_x],[
121 ac_cv_header_stdint_x="" # the 1997 typedefs (inttypes.h)
122 AC_MSG_RESULT([(..)])
123 for i in m4_ifval([$1],[$1],[stdint.h inttypes.h sys/inttypes.h sys/types.h])
125 unset ac_cv_type_uintptr_t
126 unset ac_cv_type_uint64_t
127 AC_CHECK_TYPE(uintptr_t,[ac_cv_header_stdint_x=$i],continue,[#include <$i>])
128 AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>])
129 m4_ifvaln([$2],[$2]) break
131 AC_MSG_CHECKING([for stdint uintptr_t])
135 AC_DEFUN([AX_CHECK_HEADER_STDINT_O],[
136 AC_CACHE_CHECK([for stdint uint32_t], [ac_cv_header_stdint_o],[
137 ac_cv_header_stdint_o="" # the 1995 typedefs (sys/inttypes.h)
138 AC_MSG_RESULT([(..)])
139 for i in m4_ifval([$1],[$1],[inttypes.h sys/inttypes.h sys/types.h stdint.h])
141 unset ac_cv_type_uint32_t
142 unset ac_cv_type_uint64_t
143 AC_CHECK_TYPE(uint32_t,[ac_cv_header_stdint_o=$i],continue,[#include <$i>])
144 AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>])
145 m4_ifvaln([$2],[$2]) break
148 AC_MSG_CHECKING([for stdint uint32_t])
152 AC_DEFUN([AX_CHECK_HEADER_STDINT_U],[
153 AC_CACHE_CHECK([for stdint u_int32_t], [ac_cv_header_stdint_u],[
154 ac_cv_header_stdint_u="" # the BSD typedefs (sys/types.h)
155 AC_MSG_RESULT([(..)])
156 for i in m4_ifval([$1],[$1],[sys/types.h inttypes.h sys/inttypes.h]) ; do
157 unset ac_cv_type_u_int32_t
158 unset ac_cv_type_u_int64_t
159 AC_CHECK_TYPE(u_int32_t,[ac_cv_header_stdint_u=$i],continue,[#include <$i>])
160 AC_CHECK_TYPE(u_int64_t,[and64="/u_int64_t"],[and64=""],[#include<$i>])
161 m4_ifvaln([$2],[$2]) break
164 AC_MSG_CHECKING([for stdint u_int32_t])
168 AC_DEFUN([AX_CREATE_STDINT_H],
169 [# ------ AX CREATE STDINT H -------------------------------------
170 AC_MSG_CHECKING([for stdint types])
171 ac_stdint_h=`echo ifelse($1, , _stdint.h, $1)`
172 # try to shortcircuit - if the default include path of the compiler
173 # can find a "stdint.h" header then we assume that all compilers can.
174 AC_CACHE_VAL([ac_cv_header_stdint_t],[
175 old_CXXFLAGS="$CXXFLAGS" ; CXXFLAGS=""
176 old_CPPFLAGS="$CPPFLAGS" ; CPPFLAGS=""
177 old_CFLAGS="$CFLAGS" ; CFLAGS=""
178 AC_TRY_COMPILE([#include <stdint.h>],[int_least32_t v = 0;],
179 [ac_cv_stdint_result="(assuming C99 compatible system)"
180 ac_cv_header_stdint_t="stdint.h"; ],
181 [ac_cv_header_stdint_t=""])
182 if test "$GCC" = "yes" && test ".$ac_cv_header_stdint_t" = "."; then
184 AC_TRY_COMPILE([#include <stdint.h>],[int_least32_t v = 0;],
185 [AC_MSG_WARN(your GCC compiler has a defunct stdint.h for its default-mode)])
187 CXXFLAGS="$old_CXXFLAGS"
188 CPPFLAGS="$old_CPPFLAGS"
189 CFLAGS="$old_CFLAGS" ])
191 v="... $ac_cv_header_stdint_h"
192 if test "$ac_stdint_h" = "stdint.h" ; then
193 AC_MSG_RESULT([(are you sure you want them in ./stdint.h?)])
194 elif test "$ac_stdint_h" = "inttypes.h" ; then
195 AC_MSG_RESULT([(are you sure you want them in ./inttypes.h?)])
196 elif test "_$ac_cv_header_stdint_t" = "_" ; then
197 AC_MSG_RESULT([(putting them into $ac_stdint_h)$v])
199 ac_cv_header_stdint="$ac_cv_header_stdint_t"
200 AC_MSG_RESULT([$ac_cv_header_stdint (shortcircuit)])
203 if test "_$ac_cv_header_stdint_t" = "_" ; then # can not shortcircuit..
205 dnl .....intro message done, now do a few system checks.....
206 dnl btw, all old CHECK_TYPE macros do automatically "DEFINE" a type,
207 dnl therefore we use the autoconf implementation detail CHECK_TYPE_NEW
208 dnl instead that is triggered with 3 or more arguments (see types.m4)
210 inttype_headers=`echo $2 | sed -e 's/,/ /g'`
212 ac_cv_stdint_result="(no helpful system typedefs seen)"
213 AX_CHECK_HEADER_STDINT_X(dnl
214 stdint.h inttypes.h sys/inttypes.h $inttype_headers,
215 ac_cv_stdint_result="(seen uintptr_t$and64 in $i)")
217 if test "_$ac_cv_header_stdint_x" = "_" ; then
218 AX_CHECK_HEADER_STDINT_O(dnl,
219 inttypes.h sys/inttypes.h stdint.h $inttype_headers,
220 ac_cv_stdint_result="(seen uint32_t$and64 in $i)")
223 if test "_$ac_cv_header_stdint_x" = "_" ; then
224 if test "_$ac_cv_header_stdint_o" = "_" ; then
225 AX_CHECK_HEADER_STDINT_U(dnl,
226 sys/types.h inttypes.h sys/inttypes.h $inttype_headers,
227 ac_cv_stdint_result="(seen u_int32_t$and64 in $i)")
230 dnl if there was no good C99 header file, do some typedef checks...
231 if test "_$ac_cv_header_stdint_x" = "_" ; then
232 AC_MSG_CHECKING([for stdint datatype model])
233 AC_MSG_RESULT([(..)])
237 if test "_$ac_cv_header_stdint_x" != "_" ; then
238 ac_cv_header_stdint="$ac_cv_header_stdint_x"
239 elif test "_$ac_cv_header_stdint_o" != "_" ; then
240 ac_cv_header_stdint="$ac_cv_header_stdint_o"
241 elif test "_$ac_cv_header_stdint_u" != "_" ; then
242 ac_cv_header_stdint="$ac_cv_header_stdint_u"
244 ac_cv_header_stdint="stddef.h"
247 AC_MSG_CHECKING([for extra inttypes in chosen header])
248 AC_MSG_RESULT([($ac_cv_header_stdint)])
249 dnl see if int_least and int_fast types are present in _this_ header.
250 unset ac_cv_type_int_least32_t
251 unset ac_cv_type_int_fast32_t
252 AC_CHECK_TYPE(int_least32_t,,,[#include <$ac_cv_header_stdint>])
253 AC_CHECK_TYPE(int_fast32_t,,,[#include<$ac_cv_header_stdint>])
254 AC_CHECK_TYPE(intmax_t,,,[#include <$ac_cv_header_stdint>])
256 fi # shortcircut to system "stdint.h"
257 # ------------------ PREPARE VARIABLES ------------------------------
258 if test "$GCC" = "yes" ; then
259 ac_cv_stdint_message="using gnu compiler "`$CC --version | head -1`
261 ac_cv_stdint_message="using $CC"
264 AC_MSG_RESULT([make use of $ac_cv_header_stdint in $ac_stdint_h dnl
265 $ac_cv_stdint_result])
267 dnl -----------------------------------------------------------------
268 # ----------------- DONE inttypes.h checks START header -------------
269 AC_CONFIG_COMMANDS([$ac_stdint_h],[
270 AC_MSG_NOTICE(creating $ac_stdint_h : $_ac_stdint_h)
271 ac_stdint=$tmp/_stdint.h
273 echo "#ifndef" $_ac_stdint_h >$ac_stdint
274 echo "#define" $_ac_stdint_h "1" >>$ac_stdint
275 echo "#ifndef" _GENERATED_STDINT_H >>$ac_stdint
276 echo "#define" _GENERATED_STDINT_H '"'$PACKAGE $VERSION'"' >>$ac_stdint
277 echo "/* generated $ac_cv_stdint_message */" >>$ac_stdint
278 if test "_$ac_cv_header_stdint_t" != "_" ; then
279 echo "#define _STDINT_HAVE_STDINT_H" "1" >>$ac_stdint
280 echo "#include <stdint.h>" >>$ac_stdint
281 echo "#endif" >>$ac_stdint
282 echo "#endif" >>$ac_stdint
285 cat >>$ac_stdint <<STDINT_EOF
287 /* ................... shortcircuit part ........................... */
289 #if defined HAVE_STDINT_H || defined _STDINT_HAVE_STDINT_H
294 /* .................... configured part ............................ */
298 echo "/* whether we have a C99 compatible stdint header file */" >>$ac_stdint
299 if test "_$ac_cv_header_stdint_x" != "_" ; then
300 ac_header="$ac_cv_header_stdint_x"
301 echo "#define _STDINT_HEADER_INTPTR" '"'"$ac_header"'"' >>$ac_stdint
303 echo "/* #undef _STDINT_HEADER_INTPTR */" >>$ac_stdint
306 echo "/* whether we have a C96 compatible inttypes header file */" >>$ac_stdint
307 if test "_$ac_cv_header_stdint_o" != "_" ; then
308 ac_header="$ac_cv_header_stdint_o"
309 echo "#define _STDINT_HEADER_UINT32" '"'"$ac_header"'"' >>$ac_stdint
311 echo "/* #undef _STDINT_HEADER_UINT32 */" >>$ac_stdint
314 echo "/* whether we have a BSD compatible inet types header */" >>$ac_stdint
315 if test "_$ac_cv_header_stdint_u" != "_" ; then
316 ac_header="$ac_cv_header_stdint_u"
317 echo "#define _STDINT_HEADER_U_INT32" '"'"$ac_header"'"' >>$ac_stdint
319 echo "/* #undef _STDINT_HEADER_U_INT32 */" >>$ac_stdint
324 if test "_$ac_header" != "_" ; then if test "$ac_header" != "stddef.h" ; then
325 echo "#include <$ac_header>" >>$ac_stdint
329 echo "/* which 64bit typedef has been found */" >>$ac_stdint
330 if test "$ac_cv_type_uint64_t" = "yes" ; then
331 echo "#define _STDINT_HAVE_UINT64_T" "1" >>$ac_stdint
333 echo "/* #undef _STDINT_HAVE_UINT64_T */" >>$ac_stdint
335 if test "$ac_cv_type_u_int64_t" = "yes" ; then
336 echo "#define _STDINT_HAVE_U_INT64_T" "1" >>$ac_stdint
338 echo "/* #undef _STDINT_HAVE_U_INT64_T */" >>$ac_stdint
342 echo "/* which type model has been detected */" >>$ac_stdint
343 if test "_$ac_cv_char_data_model" != "_" ; then
344 echo "#define _STDINT_CHAR_MODEL" "$ac_cv_char_data_model" >>$ac_stdint
345 echo "#define _STDINT_LONG_MODEL" "$ac_cv_long_data_model" >>$ac_stdint
347 echo "/* #undef _STDINT_CHAR_MODEL // skipped */" >>$ac_stdint
348 echo "/* #undef _STDINT_LONG_MODEL // skipped */" >>$ac_stdint
352 echo "/* whether int_least types were detected */" >>$ac_stdint
353 if test "$ac_cv_type_int_least32_t" = "yes"; then
354 echo "#define _STDINT_HAVE_INT_LEAST32_T" "1" >>$ac_stdint
356 echo "/* #undef _STDINT_HAVE_INT_LEAST32_T */" >>$ac_stdint
358 echo "/* whether int_fast types were detected */" >>$ac_stdint
359 if test "$ac_cv_type_int_fast32_t" = "yes"; then
360 echo "#define _STDINT_HAVE_INT_FAST32_T" "1" >>$ac_stdint
362 echo "/* #undef _STDINT_HAVE_INT_FAST32_T */" >>$ac_stdint
364 echo "/* whether intmax_t type was detected */" >>$ac_stdint
365 if test "$ac_cv_type_intmax_t" = "yes"; then
366 echo "#define _STDINT_HAVE_INTMAX_T" "1" >>$ac_stdint
368 echo "/* #undef _STDINT_HAVE_INTMAX_T */" >>$ac_stdint
372 cat >>$ac_stdint <<STDINT_EOF
373 /* .................... detections part ............................ */
375 /* whether we need to define bitspecific types from compiler base types */
376 #ifndef _STDINT_HEADER_INTPTR
377 #ifndef _STDINT_HEADER_UINT32
378 #ifndef _STDINT_HEADER_U_INT32
379 #define _STDINT_NEED_INT_MODEL_T
381 #define _STDINT_HAVE_U_INT_TYPES
386 #ifdef _STDINT_HAVE_U_INT_TYPES
387 #undef _STDINT_NEED_INT_MODEL_T
390 #ifdef _STDINT_CHAR_MODEL
391 #if _STDINT_CHAR_MODEL+0 == 122 || _STDINT_CHAR_MODEL+0 == 124
392 #ifndef _STDINT_BYTE_MODEL
393 #define _STDINT_BYTE_MODEL 12
398 #ifndef _STDINT_HAVE_INT_LEAST32_T
399 #define _STDINT_NEED_INT_LEAST_T
402 #ifndef _STDINT_HAVE_INT_FAST32_T
403 #define _STDINT_NEED_INT_FAST_T
406 #ifndef _STDINT_HEADER_INTPTR
407 #define _STDINT_NEED_INTPTR_T
408 #ifndef _STDINT_HAVE_INTMAX_T
409 #define _STDINT_NEED_INTMAX_T
414 /* .................... definition part ............................ */
416 /* some system headers have good uint64_t */
417 #ifndef _HAVE_UINT64_T
418 #if defined _STDINT_HAVE_UINT64_T || defined HAVE_UINT64_T
419 #define _HAVE_UINT64_T
420 #elif defined _STDINT_HAVE_U_INT64_T || defined HAVE_U_INT64_T
421 #define _HAVE_UINT64_T
422 typedef u_int64_t uint64_t;
426 #ifndef _HAVE_UINT64_T
427 /* .. here are some common heuristics using compiler runtime specifics */
428 #if defined __STDC_VERSION__ && defined __STDC_VERSION__ >= 199901L
429 #define _HAVE_UINT64_T
430 #define _HAVE_LONGLONG_UINT64_T
431 typedef long long int64_t;
432 typedef unsigned long long uint64_t;
434 #elif !defined __STRICT_ANSI__
435 #if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__
436 #define _HAVE_UINT64_T
437 typedef __int64 int64_t;
438 typedef unsigned __int64 uint64_t;
440 #elif defined __GNUC__ || defined __MWERKS__ || defined __ELF__
441 /* note: all ELF-systems seem to have loff-support which needs 64-bit */
442 #if !defined _NO_LONGLONG
443 #define _HAVE_UINT64_T
444 #define _HAVE_LONGLONG_UINT64_T
445 typedef long long int64_t;
446 typedef unsigned long long uint64_t;
449 #elif defined __alpha || (defined __mips && defined _ABIN32)
450 #if !defined _NO_LONGLONG
451 typedef long int64_t;
452 typedef unsigned long uint64_t;
454 /* compiler/cpu type to define int64_t */
459 #if defined _STDINT_HAVE_U_INT_TYPES
460 /* int8_t int16_t int32_t defined by inet code, redeclare the u_intXX types */
461 typedef u_int8_t uint8_t;
462 typedef u_int16_t uint16_t;
463 typedef u_int32_t uint32_t;
465 /* glibc compatibility */
466 #ifndef __int8_t_defined
467 #define __int8_t_defined
471 #ifdef _STDINT_NEED_INT_MODEL_T
472 /* we must guess all the basic types. Apart from byte-adressable system, */
473 /* there a few 32-bit-only dsp-systems that we guard with BYTE_MODEL 8-} */
474 /* (btw, those nibble-addressable systems are way off, or so we assume) */
476 dnl /* have a look at "64bit and data size neutrality" at */
477 dnl /* http://unix.org/version2/whatsnew/login_64bit.html */
478 dnl /* (the shorthand "ILP" types always have a "P" part) */
480 #if defined _STDINT_BYTE_MODEL
481 #if _STDINT_LONG_MODEL+0 == 242
482 /* 2:4:2 = IP16 = a normal 16-bit system */
483 typedef unsigned char uint8_t;
484 typedef unsigned short uint16_t;
485 typedef unsigned long uint32_t;
486 #ifndef __int8_t_defined
487 #define __int8_t_defined
489 typedef short int16_t;
490 typedef long int32_t;
492 #elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL == 444
493 /* 2:4:4 = LP32 = a 32-bit system derived from a 16-bit */
494 /* 4:4:4 = ILP32 = a normal 32-bit system */
495 typedef unsigned char uint8_t;
496 typedef unsigned short uint16_t;
497 typedef unsigned int uint32_t;
498 #ifndef __int8_t_defined
499 #define __int8_t_defined
501 typedef short int16_t;
504 #elif _STDINT_LONG_MODEL+0 == 484 || _STDINT_LONG_MODEL+0 == 488
505 /* 4:8:4 = IP32 = a 32-bit system prepared for 64-bit */
506 /* 4:8:8 = LP64 = a normal 64-bit system */
507 typedef unsigned char uint8_t;
508 typedef unsigned short uint16_t;
509 typedef unsigned int uint32_t;
510 #ifndef __int8_t_defined
511 #define __int8_t_defined
513 typedef short int16_t;
516 /* this system has a "long" of 64bit */
517 #ifndef _HAVE_UINT64_T
518 #define _HAVE_UINT64_T
519 typedef unsigned long uint64_t;
520 typedef long int64_t;
522 #elif _STDINT_LONG_MODEL+0 == 448
523 /* LLP64 a 64-bit system derived from a 32-bit system */
524 typedef unsigned char uint8_t;
525 typedef unsigned short uint16_t;
526 typedef unsigned int uint32_t;
527 #ifndef __int8_t_defined
528 #define __int8_t_defined
530 typedef short int16_t;
533 /* assuming the system has a "long long" */
534 #ifndef _HAVE_UINT64_T
535 #define _HAVE_UINT64_T
536 #define _HAVE_LONGLONG_UINT64_T
537 typedef unsigned long long uint64_t;
538 typedef long long int64_t;
541 #define _STDINT_NO_INT32_T
544 #define _STDINT_NO_INT8_T
545 #define _STDINT_NO_INT32_T
550 * quote from SunOS-5.8 sys/inttypes.h:
551 * Use at your own risk. As of February 1996, the committee is squarely
552 * behind the fixed sized types; the "least" and "fast" types are still being
553 * discussed. The probability that the "fast" types may be removed before
554 * the standard is finalized is high enough that they are not currently
558 #if defined _STDINT_NEED_INT_LEAST_T
559 typedef int8_t int_least8_t;
560 typedef int16_t int_least16_t;
561 typedef int32_t int_least32_t;
562 #ifdef _HAVE_UINT64_T
563 typedef int64_t int_least64_t;
566 typedef uint8_t uint_least8_t;
567 typedef uint16_t uint_least16_t;
568 typedef uint32_t uint_least32_t;
569 #ifdef _HAVE_UINT64_T
570 typedef uint64_t uint_least64_t;
575 #if defined _STDINT_NEED_INT_FAST_T
576 typedef int8_t int_fast8_t;
577 typedef int int_fast16_t;
578 typedef int32_t int_fast32_t;
579 #ifdef _HAVE_UINT64_T
580 typedef int64_t int_fast64_t;
583 typedef uint8_t uint_fast8_t;
584 typedef unsigned uint_fast16_t;
585 typedef uint32_t uint_fast32_t;
586 #ifdef _HAVE_UINT64_T
587 typedef uint64_t uint_fast64_t;
592 #ifdef _STDINT_NEED_INTMAX_T
593 #ifdef _HAVE_UINT64_T
594 typedef int64_t intmax_t;
595 typedef uint64_t uintmax_t;
597 typedef long intmax_t;
598 typedef unsigned long uintmax_t;
602 #ifdef _STDINT_NEED_INTPTR_T
603 #ifndef __intptr_t_defined
604 #define __intptr_t_defined
605 /* we encourage using "long" to store pointer values, never use "int" ! */
606 #if _STDINT_LONG_MODEL+0 == 242 || _STDINT_LONG_MODEL+0 == 484
607 typedef unsigned int uintptr_t;
608 typedef int intptr_t;
609 #elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL+0 == 444
610 typedef unsigned long uintptr_t;
611 typedef long intptr_t;
612 #elif _STDINT_LONG_MODEL+0 == 448 && defined _HAVE_UINT64_T
613 typedef uint64_t uintptr_t;
614 typedef int64_t intptr_t;
615 #else /* matches typical system types ILP32 and LP64 - but not IP16 or LLP64 */
616 typedef unsigned long uintptr_t;
617 typedef long intptr_t;
622 /* The ISO C99 standard specifies that in C++ implementations these
623 should only be defined if explicitly requested. */
624 #if !defined __cplusplus || defined __STDC_CONSTANT_MACROS
629 # define INT16_C(c) c
630 # define INT32_C(c) c
631 # ifdef _HAVE_LONGLONG_UINT64_T
632 # define INT64_C(c) c ## L
634 # define INT64_C(c) c ## LL
638 # define UINT8_C(c) c ## U
639 # define UINT16_C(c) c ## U
640 # define UINT32_C(c) c ## U
641 # ifdef _HAVE_LONGLONG_UINT64_T
642 # define UINT64_C(c) c ## UL
644 # define UINT64_C(c) c ## ULL
648 # ifdef _HAVE_LONGLONG_UINT64_T
649 # define INTMAX_C(c) c ## L
650 # define UINTMAX_C(c) c ## UL
652 # define INTMAX_C(c) c ## LL
653 # define UINTMAX_C(c) c ## ULL
660 /* These limits are merily those of a two complement byte-oriented system */
662 /* Minimum of signed integral types. */
663 # define INT8_MIN (-128)
664 # define INT16_MIN (-32767-1)
665 # define INT32_MIN (-2147483647-1)
667 # define INT64_MIN (-__INT64_C(9223372036854775807)-1)
669 /* Maximum of signed integral types. */
670 # define INT8_MAX (127)
671 # define INT16_MAX (32767)
672 # define INT32_MAX (2147483647)
674 # define INT64_MAX (__INT64_C(9223372036854775807))
677 /* Maximum of unsigned integral types. */
679 # define UINT8_MAX (255)
682 # define UINT16_MAX (65535)
684 # define UINT32_MAX (4294967295U)
686 # define UINT64_MAX (__UINT64_C(18446744073709551615))
689 /* Minimum of signed integral types having a minimum size. */
690 # define INT_LEAST8_MIN INT8_MIN
691 # define INT_LEAST16_MIN INT16_MIN
692 # define INT_LEAST32_MIN INT32_MIN
693 # define INT_LEAST64_MIN INT64_MIN
694 /* Maximum of signed integral types having a minimum size. */
695 # define INT_LEAST8_MAX INT8_MAX
696 # define INT_LEAST16_MAX INT16_MAX
697 # define INT_LEAST32_MAX INT32_MAX
698 # define INT_LEAST64_MAX INT64_MAX
700 /* Maximum of unsigned integral types having a minimum size. */
701 # define UINT_LEAST8_MAX UINT8_MAX
702 # define UINT_LEAST16_MAX UINT16_MAX
703 # define UINT_LEAST32_MAX UINT32_MAX
704 # define UINT_LEAST64_MAX UINT64_MAX
713 if cmp -s $ac_stdint_h $ac_stdint 2>/dev/null; then
714 AC_MSG_NOTICE([$ac_stdint_h is unchanged])
716 ac_dir=`AS_DIRNAME(["$ac_stdint_h"])`
717 AS_MKDIR_P(["$ac_dir"])
719 mv $ac_stdint $ac_stdint_h
721 ],[# variables for create stdint.h replacement
724 ac_stdint_h="$ac_stdint_h"
725 _ac_stdint_h=AS_TR_CPP(_$PACKAGE-$ac_stdint_h)
726 ac_cv_stdint_message="$ac_cv_stdint_message"
727 ac_cv_header_stdint_t="$ac_cv_header_stdint_t"
728 ac_cv_header_stdint_x="$ac_cv_header_stdint_x"
729 ac_cv_header_stdint_o="$ac_cv_header_stdint_o"
730 ac_cv_header_stdint_u="$ac_cv_header_stdint_u"
731 ac_cv_type_uint64_t="$ac_cv_type_uint64_t"
732 ac_cv_type_u_int64_t="$ac_cv_type_u_int64_t"
733 ac_cv_char_data_model="$ac_cv_char_data_model"
734 ac_cv_long_data_model="$ac_cv_long_data_model"
735 ac_cv_type_int_least32_t="$ac_cv_type_int_least32_t"
736 ac_cv_type_int_fast32_t="$ac_cv_type_int_fast32_t"
737 ac_cv_type_intmax_t="$ac_cv_type_intmax_t"