• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1dnl AC_NEED_STDINT_H ( HEADER-TO-GENERATE )
2dnl
3dnl Look for a header file that defines size-specific integer types like the
4dnl ones recommended to be in stdint.h in the C99 standard (e.g. uint32_t).
5
6dnl AX_CHECK_DEFINED_TYPE ( TYPE, FILE, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND )
7dnl This is similar to _AC_CHECK_TYPE_NEW (a.k.a. new syntax version of
8dnl AC_CHECK_TYPE) in autoconf 2.50 but works on older versions
9AC_DEFUN([AX_CHECK_DEFINED_TYPE],
10[AC_MSG_CHECKING([for $1 in $2])
11AC_EGREP_CPP(changequote(<<,>>)dnl
12<<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl
13changequote([,]), [#include <$2>],
14ac_cv_type_$1=yes, ac_cv_type_$1=no)dnl
15AC_MSG_RESULT($ac_cv_type_$1)
16if test $ac_cv_type_$1 = yes; then
17  $3
18else
19  $4
20fi
21])
22
23dnl Look for a header file that defines size-specific integer types
24AC_DEFUN([AX_NEED_STDINT_H],
25[
26changequote(, )dnl
27ac_dir=`echo "$1"|sed 's%/[^/][^/]*$%%'`
28changequote([, ])dnl
29if test "$ac_dir" != "$1" && test "$ac_dir" != .; then
30  # The file is in a subdirectory.
31  test ! -d "$ac_dir" && mkdir "$ac_dir"
32fi
33
34AX_CHECK_DEFINED_TYPE(uint8_t,
35stdint.h,
36[
37cat > "$1" <<EOF
38/* This file is generated automatically by configure */
39#include <stdint.h>
40EOF],
41[AX_CHECK_DEFINED_TYPE(uint8_t,
42inttypes.h,
43[cat > "$1" <<EOF
44/* This file is generated automatically by configure */
45#include <inttypes.h>
46EOF],
47[AX_CHECK_DEFINED_TYPE(uint8_t,
48sys/types.h,
49[cat > "$1" <<EOF
50/* This file is generated automatically by configure */
51#include <sys/types.h>
52EOF],
53[AX_CHECK_DEFINED_TYPE(u_int8_t,
54sys/types.h,
55[cat > "$1" <<EOF
56/* This file is generated automatically by configure */
57#ifndef __STDINT_H
58#define __STDINT_H
59#include <sys/types.h>
60typedef u_int8_t uint8_t;
61typedef u_int16_t uint16_t;
62typedef u_int32_t uint32_t;
63EOF
64
65AX_CHECK_DEFINED_TYPE(u_int64_t,
66sys/types.h,
67[cat >> "$1" <<EOF
68typedef u_int64_t uint64_t;
69#endif /*!__STDINT_H*/
70EOF],
71[cat >> "$1" <<EOF
72/* 64-bit types are not available on this system */
73/* typedef u_int64_t uint64_t; */
74#endif /*!__STDINT_H*/
75EOF])
76
77],
78[AC_MSG_WARN([I can't find size-specific integer definitions on this system])
79if test -e "$1" ; then
80	rm -f "$1"
81fi
82])])])])dnl
83])
84
85AC_DEFUN([AX_CHECK_DATA_MODEL],[
86   AC_CHECK_SIZEOF(char)
87   AC_CHECK_SIZEOF(short)
88   AC_CHECK_SIZEOF(int)
89   AC_CHECK_SIZEOF(long)
90   AC_CHECK_SIZEOF(void*)
91   ac_cv_char_data_model=""
92   ac_cv_char_data_model="$ac_cv_char_data_model$ac_cv_sizeof_char"
93   ac_cv_char_data_model="$ac_cv_char_data_model$ac_cv_sizeof_short"
94   ac_cv_char_data_model="$ac_cv_char_data_model$ac_cv_sizeof_int"
95   ac_cv_long_data_model=""
96   ac_cv_long_data_model="$ac_cv_long_data_model$ac_cv_sizeof_int"
97   ac_cv_long_data_model="$ac_cv_long_data_model$ac_cv_sizeof_long"
98   ac_cv_long_data_model="$ac_cv_long_data_model$ac_cv_sizeof_voidp"
99   AC_MSG_CHECKING([data model])
100   case "$ac_cv_char_data_model/$ac_cv_long_data_model" in
101    122/242)     ac_cv_data_model="IP16"  ; n="standard 16bit machine" ;;
102    122/244)     ac_cv_data_model="LP32"  ; n="standard 32bit machine" ;;
103    122/*)       ac_cv_data_model="i16"   ; n="unusual int16 model" ;;
104    124/444)     ac_cv_data_model="ILP32" ; n="standard 32bit unixish" ;;
105    124/488)     ac_cv_data_model="LP64"  ; n="standard 64bit unixish" ;;
106    124/448)     ac_cv_data_model="LLP64" ; n="unusual 64bit unixish" ;;
107    124/*)       ac_cv_data_model="i32"   ; n="unusual int32 model" ;;
108    128/888)     ac_cv_data_model="ILP64" ; n="unusual 64bit numeric" ;;
109    128/*)       ac_cv_data_model="i64"   ; n="unusual int64 model" ;;
110    222/*2)      ac_cv_data_model="DSP16" ; n="strict 16bit dsptype" ;;
111    333/*3)      ac_cv_data_model="DSP24" ; n="strict 24bit dsptype" ;;
112    444/*4)      ac_cv_data_model="DSP32" ; n="strict 32bit dsptype" ;;
113    666/*6)      ac_cv_data_model="DSP48" ; n="strict 48bit dsptype" ;;
114    888/*8)      ac_cv_data_model="DSP64" ; n="strict 64bit dsptype" ;;
115    222/*|333/*|444/*|666/*|888/*) :
116                 ac_cv_data_model="iDSP"  ; n="unusual dsptype" ;;
117     *)          ac_cv_data_model="none"  ; n="very unusual model" ;;
118   esac
119   AC_MSG_RESULT([$ac_cv_data_model ($ac_cv_long_data_model, $n)])
120])
121
122dnl AX_CHECK_HEADER_STDINT_X([HEADERLIST][,ACTION-IF])
123AC_DEFUN([AX_CHECK_HEADER_STDINT_X],[
124AC_CACHE_CHECK([for stdint uintptr_t], [ac_cv_header_stdint_x],[
125 ac_cv_header_stdint_x="" # the 1997 typedefs (inttypes.h)
126  AC_MSG_RESULT([(..)])
127  for i in m4_ifval([$1],[$1],[stdint.h inttypes.h sys/inttypes.h]) ; do
128   unset ac_cv_type_uintptr_t
129   unset ac_cv_type_uint64_t
130   AC_CHECK_TYPE(uintptr_t,[ac_cv_header_stdint_x=$i],continue,[#include <$i>])
131   AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>])
132   m4_ifvaln([$1],[$1]) break
133  done
134  AC_MSG_CHECKING([for stdint uintptr_t])
135 ])
136])
137
138AC_DEFUN([AX_CHECK_HEADER_STDINT_O],[
139AC_CACHE_CHECK([for stdint uint32_t], [ac_cv_header_stdint_o],[
140 ac_cv_header_stdint_o="" # the 1995 typedefs (sys/inttypes.h)
141  AC_MSG_RESULT([(..)])
142  for i in m4_ifval([$1],[$1],[inttypes.h sys/inttypes.h stdint.h]) ; do
143   unset ac_cv_type_uint32_t
144   unset ac_cv_type_uint64_t
145   AC_CHECK_TYPE(uint32_t,[ac_cv_header_stdint_o=$i],continue,[#include <$i>])
146   AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>])
147   m4_ifvaln([$1],[$1]) break
148   break;
149  done
150  AC_MSG_CHECKING([for stdint uint32_t])
151 ])
152])
153
154AC_DEFUN([AX_CHECK_HEADER_STDINT_U],[
155AC_CACHE_CHECK([for stdint u_int32_t], [ac_cv_header_stdint_u],[
156 ac_cv_header_stdint_u="" # the BSD typedefs (sys/types.h)
157  AC_MSG_RESULT([(..)])
158  for i in m4_ifval([$1],[$1],[sys/types.h inttypes.h sys/inttypes.h]) ; do
159   unset ac_cv_type_u_int32_t
160   unset ac_cv_type_u_int64_t
161   AC_CHECK_TYPE(u_int32_t,[ac_cv_header_stdint_u=$i],continue,[#include <$i>])
162   AC_CHECK_TYPE(u_int64_t,[and64="/u_int64_t"],[and64=""],[#include<$i>])
163   m4_ifvaln([$1],[$1]) break
164   break;
165  done
166  AC_MSG_CHECKING([for stdint u_int32_t])
167 ])
168])
169
170AC_DEFUN([AX_CREATE_STDINT_H],
171[# ------ AX CREATE STDINT H -------------------------------------
172AC_MSG_CHECKING([for stdint types])
173ac_stdint_h=`echo ifelse($1, , _stdint.h, $1)`
174# try to shortcircuit - if the default include path of the compiler
175# can find a "stdint.h" header then we assume that all compilers can.
176AC_CACHE_VAL([ac_cv_header_stdint_t],[
177old_CXXFLAGS="$CXXFLAGS" ; CXXFLAGS=""
178old_CPPFLAGS="$CPPFLAGS" ; CPPFLAGS=""
179old_CFLAGS="$CFLAGS"     ; CFLAGS=""
180AC_TRY_COMPILE([#include <stdint.h>],[int_least32_t v = 0;],
181[ac_cv_stdint_result="(assuming C99 compatible system)"
182 ac_cv_header_stdint_t="stdint.h"; ],
183[ac_cv_header_stdint_t=""])
184CXXFLAGS="$old_CXXFLAGS"
185CPPFLAGS="$old_CPPFLAGS"
186CFLAGS="$old_CFLAGS" ])
187
188v="... $ac_cv_header_stdint_h"
189if test "$ac_stdint_h" = "stdint.h" ; then
190 AC_MSG_RESULT([(are you sure you want them in ./stdint.h?)])
191elif test "$ac_stdint_h" = "inttypes.h" ; then
192 AC_MSG_RESULT([(are you sure you want them in ./inttypes.h?)])
193elif test "_$ac_cv_header_stdint_t" = "_" ; then
194 AC_MSG_RESULT([(putting them into $ac_stdint_h)$v])
195else
196 ac_cv_header_stdint="$ac_cv_header_stdint_t"
197 AC_MSG_RESULT([$ac_cv_header_stdint (shortcircuit)])
198fi
199
200if test "_$ac_cv_header_stdint_t" = "_" ; then # can not shortcircuit..
201
202dnl .....intro message done, now do a few system checks.....
203dnl btw, all old CHECK_TYPE macros do automatically "DEFINE" a type,
204dnl therefore we use the autoconf implementation detail CHECK_TYPE_NEW
205dnl instead that is triggered with 3 or more arguments (see types.m4)
206
207inttype_headers=`echo $2 | sed -e 's/,/ /g'`
208
209ac_cv_stdint_result="(no helpful system typedefs seen)"
210AX_CHECK_HEADER_STDINT_X(dnl
211   stdint.h inttypes.h sys/inttypes.h $inttype_headers,
212   ac_cv_stdint_result="(seen uintptr_t$and64 in $i)")
213
214if test "_$ac_cv_header_stdint_x" = "_" ; then
215AX_CHECK_HEADER_STDINT_O(dnl,
216   inttypes.h sys/inttypes.h stdint.h $inttype_headers,
217   ac_cv_stdint_result="(seen uint32_t$and64 in $i)")
218fi
219
220if test "_$ac_cv_header_stdint_x" = "_" ; then
221if test "_$ac_cv_header_stdint_o" = "_" ; then
222AX_CHECK_HEADER_STDINT_U(dnl,
223   sys/types.h inttypes.h sys/inttypes.h $inttype_headers,
224   ac_cv_stdint_result="(seen u_int32_t$and64 in $i)")
225fi fi
226
227dnl if there was no good C99 header file, do some typedef checks...
228if test "_$ac_cv_header_stdint_x" = "_" ; then
229   AC_MSG_CHECKING([for stdint datatype model])
230   AC_MSG_RESULT([(..)])
231   AX_CHECK_DATA_MODEL
232fi
233
234if test "_$ac_cv_header_stdint_x" != "_" ; then
235   ac_cv_header_stdint="$ac_cv_header_stdint_x"
236elif  test "_$ac_cv_header_stdint_o" != "_" ; then
237   ac_cv_header_stdint="$ac_cv_header_stdint_o"
238elif  test "_$ac_cv_header_stdint_u" != "_" ; then
239   ac_cv_header_stdint="$ac_cv_header_stdint_u"
240else
241   ac_cv_header_stdint="stddef.h"
242fi
243
244AC_MSG_CHECKING([for extra inttypes in chosen header])
245AC_MSG_RESULT([($ac_cv_header_stdint)])
246dnl see if int_least and int_fast types are present in _this_ header.
247unset ac_cv_type_int_least32_t
248unset ac_cv_type_int_fast32_t
249AC_CHECK_TYPE(int_least32_t,,,[#include <$ac_cv_header_stdint>])
250AC_CHECK_TYPE(int_fast32_t,,,[#include<$ac_cv_header_stdint>])
251AC_CHECK_TYPE(intmax_t,,,[#include <$ac_cv_header_stdint>])
252
253fi # shortcircut to system "stdint.h"
254# ------------------ PREPARE VARIABLES ------------------------------
255if test "$GCC" = "yes" ; then
256ac_cv_stdint_message="using gnu compiler "`$CC --version | head -1`
257else
258ac_cv_stdint_message="using $CC"
259fi
260
261AC_MSG_RESULT([make use of $ac_cv_header_stdint in $ac_stdint_h dnl
262$ac_cv_stdint_result])
263
264dnl -----------------------------------------------------------------
265# ----------------- DONE inttypes.h checks START header -------------
266AC_CONFIG_COMMANDS([$ac_stdint_h],[
267AC_MSG_NOTICE(creating $ac_stdint_h : $_ac_stdint_h)
268ac_stdint=$tmp/_stdint.h
269
270echo "#ifndef" $_ac_stdint_h >$ac_stdint
271echo "#define" $_ac_stdint_h "1" >>$ac_stdint
272echo "#ifndef" _GENERATED_STDINT_H >>$ac_stdint
273echo "#define" _GENERATED_STDINT_H '"'$PACKAGE $VERSION'"' >>$ac_stdint
274echo "/* generated $ac_cv_stdint_message */" >>$ac_stdint
275if test "_$ac_cv_header_stdint_t" != "_" ; then
276echo "#define _STDINT_HAVE_STDINT_H" "1" >>$ac_stdint
277echo "#include <stdint.h>" >>$ac_stdint
278echo "#endif" >>$ac_stdint
279echo "#endif" >>$ac_stdint
280else
281
282cat >>$ac_stdint <<STDINT_EOF
283
284/* ................... shortcircuit part ........................... */
285
286#if defined HAVE_STDINT_H || defined _STDINT_HAVE_STDINT_H
287#include <stdint.h>
288#else
289#include <stddef.h>
290
291/* .................... configured part ............................ */
292
293STDINT_EOF
294
295echo "/* whether we have a C99 compatible stdint header file */" >>$ac_stdint
296if test "_$ac_cv_header_stdint_x" != "_" ; then
297  ac_header="$ac_cv_header_stdint_x"
298  echo "#define _STDINT_HEADER_INTPTR" '"'"$ac_header"'"' >>$ac_stdint
299else
300  echo "/* #undef _STDINT_HEADER_INTPTR */" >>$ac_stdint
301fi
302
303echo "/* whether we have a C96 compatible inttypes header file */" >>$ac_stdint
304if  test "_$ac_cv_header_stdint_o" != "_" ; then
305  ac_header="$ac_cv_header_stdint_o"
306  echo "#define _STDINT_HEADER_UINT32" '"'"$ac_header"'"' >>$ac_stdint
307else
308  echo "/* #undef _STDINT_HEADER_UINT32 */" >>$ac_stdint
309fi
310
311echo "/* whether we have a BSD compatible inet types header */" >>$ac_stdint
312if  test "_$ac_cv_header_stdint_u" != "_" ; then
313  ac_header="$ac_cv_header_stdint_u"
314  echo "#define _STDINT_HEADER_U_INT32" '"'"$ac_header"'"' >>$ac_stdint
315else
316  echo "/* #undef _STDINT_HEADER_U_INT32 */" >>$ac_stdint
317fi
318
319echo "" >>$ac_stdint
320
321if test "_$ac_header" != "_" ; then if test "$ac_header" != "stddef.h" ; then
322  echo "#include <$ac_header>" >>$ac_stdint
323  echo "" >>$ac_stdint
324fi fi
325
326echo "/* which 64bit typedef has been found */" >>$ac_stdint
327if test "$ac_cv_type_uint64_t" = "yes" ; then
328echo "#define   _STDINT_HAVE_UINT64_T" "1"  >>$ac_stdint
329else
330echo "/* #undef _STDINT_HAVE_UINT64_T */" >>$ac_stdint
331fi
332if test "$ac_cv_type_u_int64_t" = "yes" ; then
333echo "#define   _STDINT_HAVE_U_INT64_T" "1"  >>$ac_stdint
334else
335echo "/* #undef _STDINT_HAVE_U_INT64_T */" >>$ac_stdint
336fi
337echo "" >>$ac_stdint
338
339echo "/* which type model has been detected */" >>$ac_stdint
340if test "_$ac_cv_char_data_model" != "_" ; then
341echo "#define   _STDINT_CHAR_MODEL" "$ac_cv_char_data_model" >>$ac_stdint
342echo "#define   _STDINT_LONG_MODEL" "$ac_cv_long_data_model" >>$ac_stdint
343else
344echo "/* #undef _STDINT_CHAR_MODEL // skipped */" >>$ac_stdint
345echo "/* #undef _STDINT_LONG_MODEL // skipped */" >>$ac_stdint
346fi
347echo "" >>$ac_stdint
348
349echo "/* whether int_least types were detected */" >>$ac_stdint
350if test "$ac_cv_type_int_least32_t" = "yes"; then
351echo "#define   _STDINT_HAVE_INT_LEAST32_T" "1"  >>$ac_stdint
352else
353echo "/* #undef _STDINT_HAVE_INT_LEAST32_T */" >>$ac_stdint
354fi
355echo "/* whether int_fast types were detected */" >>$ac_stdint
356if test "$ac_cv_type_int_fast32_t" = "yes"; then
357echo "#define   _STDINT_HAVE_INT_FAST32_T" "1" >>$ac_stdint
358else
359echo "/* #undef _STDINT_HAVE_INT_FAST32_T */" >>$ac_stdint
360fi
361echo "/* whether intmax_t type was detected */" >>$ac_stdint
362if test "$ac_cv_type_intmax_t" = "yes"; then
363echo "#define   _STDINT_HAVE_INTMAX_T" "1" >>$ac_stdint
364else
365echo "/* #undef _STDINT_HAVE_INTMAX_T */" >>$ac_stdint
366fi
367echo "" >>$ac_stdint
368
369  cat >>$ac_stdint <<STDINT_EOF
370/* .................... detections part ............................ */
371
372/* whether we need to define bitspecific types from compiler base types */
373#ifndef _STDINT_HEADER_INTPTR
374#ifndef _STDINT_HEADER_UINT32
375#ifndef _STDINT_HEADER_U_INT32
376#define _STDINT_NEED_INT_MODEL_T
377#else
378#define _STDINT_HAVE_U_INT_TYPES
379#endif
380#endif
381#endif
382
383#ifdef _STDINT_HAVE_U_INT_TYPES
384#undef _STDINT_NEED_INT_MODEL_T
385#endif
386
387#ifdef  _STDINT_CHAR_MODEL
388#if     _STDINT_CHAR_MODEL+0 == 122 || _STDINT_CHAR_MODEL+0 == 124
389#ifndef _STDINT_BYTE_MODEL
390#define _STDINT_BYTE_MODEL 12
391#endif
392#endif
393#endif
394
395#ifndef _STDINT_HAVE_INT_LEAST32_T
396#define _STDINT_NEED_INT_LEAST_T
397#endif
398
399#ifndef _STDINT_HAVE_INT_FAST32_T
400#define _STDINT_NEED_INT_FAST_T
401#endif
402
403#ifndef _STDINT_HEADER_INTPTR
404#define _STDINT_NEED_INTPTR_T
405#ifndef _STDINT_HAVE_INTMAX_T
406#define _STDINT_NEED_INTMAX_T
407#endif
408#endif
409
410
411/* .................... definition part ............................ */
412
413/* some system headers have good uint64_t */
414#ifndef _HAVE_UINT64_T
415#if     defined _STDINT_HAVE_UINT64_T  || defined HAVE_UINT64_T
416#define _HAVE_UINT64_T
417#elif   defined _STDINT_HAVE_U_INT64_T || defined HAVE_U_INT64_T
418#define _HAVE_UINT64_T
419typedef u_int64_t uint64_t;
420#endif
421#endif
422
423#ifndef _HAVE_UINT64_T
424/* .. here are some common heuristics using compiler runtime specifics */
425#if defined __STDC_VERSION__ && defined __STDC_VERSION__ >= 199901L
426#define _HAVE_UINT64_T
427#define _HAVE_LONGLONG_UINT64_T
428typedef long long int64_t;
429typedef unsigned long long uint64_t;
430
431#elif !defined __STRICT_ANSI__
432#if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__
433#define _HAVE_UINT64_T
434typedef __int64 int64_t;
435typedef unsigned __int64 uint64_t;
436
437#elif defined __GNUC__ || defined __MWERKS__ || defined __ELF__
438/* note: all ELF-systems seem to have loff-support which needs 64-bit */
439#if !defined _NO_LONGLONG
440#define _HAVE_UINT64_T
441#define _HAVE_LONGLONG_UINT64_T
442typedef long long int64_t;
443typedef unsigned long long uint64_t;
444#endif
445
446#elif defined __alpha || (defined __mips && defined _ABIN32)
447#if !defined _NO_LONGLONG
448typedef long int64_t;
449typedef unsigned long uint64_t;
450#endif
451  /* compiler/cpu type to define int64_t */
452#endif
453#endif
454#endif
455
456#if defined _STDINT_HAVE_U_INT_TYPES
457/* int8_t int16_t int32_t defined by inet code, redeclare the u_intXX types */
458typedef u_int8_t uint8_t;
459typedef u_int16_t uint16_t;
460typedef u_int32_t uint32_t;
461
462/* glibc compatibility */
463#ifndef __int8_t_defined
464#define __int8_t_defined
465#endif
466#endif
467
468#ifdef _STDINT_NEED_INT_MODEL_T
469/* we must guess all the basic types. Apart from byte-adressable system, */
470/* there a few 32-bit-only dsp-systems that we guard with BYTE_MODEL 8-} */
471/* (btw, those nibble-addressable systems are way off, or so we assume) */
472
473dnl   /* have a look at "64bit and data size neutrality" at */
474dnl   /* http://unix.org/version2/whatsnew/login_64bit.html */
475dnl   /* (the shorthand "ILP" types always have a "P" part) */
476
477#if defined _STDINT_BYTE_MODEL
478#if _STDINT_LONG_MODEL+0 == 242
479/* 2:4:2 =  IP16 = a normal 16-bit system                */
480typedef unsigned char   uint8_t;
481typedef unsigned short  uint16_t;
482typedef unsigned long   uint32_t;
483#ifndef __int8_t_defined
484#define __int8_t_defined
485typedef          char    int8_t;
486typedef          short   int16_t;
487typedef          long    int32_t;
488#endif
489#elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL == 444
490/* 2:4:4 =  LP32 = a 32-bit system derived from a 16-bit */
491/* 4:4:4 = ILP32 = a normal 32-bit system                */
492typedef unsigned char   uint8_t;
493typedef unsigned short  uint16_t;
494typedef unsigned int    uint32_t;
495#ifndef __int8_t_defined
496#define __int8_t_defined
497typedef          char    int8_t;
498typedef          short   int16_t;
499typedef          int     int32_t;
500#endif
501#elif _STDINT_LONG_MODEL+0 == 484 || _STDINT_LONG_MODEL+0 == 488
502/* 4:8:4 =  IP32 = a 32-bit system prepared for 64-bit    */
503/* 4:8:8 =  LP64 = a normal 64-bit system                 */
504typedef unsigned char   uint8_t;
505typedef unsigned short  uint16_t;
506typedef unsigned int    uint32_t;
507#ifndef __int8_t_defined
508#define __int8_t_defined
509typedef          char    int8_t;
510typedef          short   int16_t;
511typedef          int     int32_t;
512#endif
513/* this system has a "long" of 64bit */
514#ifndef _HAVE_UINT64_T
515#define _HAVE_UINT64_T
516typedef unsigned long   uint64_t;
517typedef          long    int64_t;
518#endif
519#elif _STDINT_LONG_MODEL+0 == 448
520/*      LLP64   a 64-bit system derived from a 32-bit system */
521typedef unsigned char   uint8_t;
522typedef unsigned short  uint16_t;
523typedef unsigned int    uint32_t;
524#ifndef __int8_t_defined
525#define __int8_t_defined
526typedef          char    int8_t;
527typedef          short   int16_t;
528typedef          int     int32_t;
529#endif
530/* assuming the system has a "long long" */
531#ifndef _HAVE_UINT64_T
532#define _HAVE_UINT64_T
533#define _HAVE_LONGLONG_UINT64_T
534typedef unsigned long long uint64_t;
535typedef          long long  int64_t;
536#endif
537#else
538#define _STDINT_NO_INT32_T
539#endif
540#else
541#define _STDINT_NO_INT8_T
542#define _STDINT_NO_INT32_T
543#endif
544#endif
545
546/*
547 * quote from SunOS-5.8 sys/inttypes.h:
548 * Use at your own risk.  As of February 1996, the committee is squarely
549 * behind the fixed sized types; the "least" and "fast" types are still being
550 * discussed.  The probability that the "fast" types may be removed before
551 * the standard is finalized is high enough that they are not currently
552 * implemented.
553 */
554
555#if defined _STDINT_NEED_INT_LEAST_T
556typedef  int8_t    int_least8_t;
557typedef  int16_t   int_least16_t;
558typedef  int32_t   int_least32_t;
559#ifdef _HAVE_UINT64_T
560typedef  int64_t   int_least64_t;
561#endif
562
563typedef uint8_t   uint_least8_t;
564typedef uint16_t  uint_least16_t;
565typedef uint32_t  uint_least32_t;
566#ifdef _HAVE_UINT64_T
567typedef uint64_t  uint_least64_t;
568#endif
569  /* least types */
570#endif
571
572#if defined _STDINT_NEED_INT_FAST_T
573typedef  int8_t    int_fast8_t;
574typedef  int       int_fast16_t;
575typedef  int32_t   int_fast32_t;
576#ifdef _HAVE_UINT64_T
577typedef  int64_t   int_fast64_t;
578#endif
579
580typedef uint8_t   uint_fast8_t;
581typedef unsigned  uint_fast16_t;
582typedef uint32_t  uint_fast32_t;
583#ifdef _HAVE_UINT64_T
584typedef uint64_t  uint_fast64_t;
585#endif
586  /* fast types */
587#endif
588
589#ifdef _STDINT_NEED_INTMAX_T
590#ifdef _HAVE_UINT64_T
591typedef  int64_t       intmax_t;
592typedef uint64_t      uintmax_t;
593#else
594typedef          long  intmax_t;
595typedef unsigned long uintmax_t;
596#endif
597#endif
598
599#ifdef _STDINT_NEED_INTPTR_T
600#ifndef __intptr_t_defined
601#define __intptr_t_defined
602/* we encourage using "long" to store pointer values, never use "int" ! */
603#if   _STDINT_LONG_MODEL+0 == 242 || _STDINT_LONG_MODEL+0 == 484
604typedef  unsigned int   uintptr_t;
605typedef           int    intptr_t;
606#elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL+0 == 444
607typedef  unsigned long  uintptr_t;
608typedef           long   intptr_t;
609#elif _STDINT_LONG_MODEL+0 == 448 && defined _HAVE_UINT64_T
610typedef        uint64_t uintptr_t;
611typedef         int64_t  intptr_t;
612#else /* matches typical system types ILP32 and LP64 - but not IP16 or LLP64 */
613typedef  unsigned long  uintptr_t;
614typedef           long   intptr_t;
615#endif
616#endif
617#endif
618
619/* The ISO C99 standard specifies that in C++ implementations these
620   should only be defined if explicitly requested.  */
621#if !defined __cplusplus || defined __STDC_CONSTANT_MACROS
622#ifndef UINT32_C
623
624/* Signed.  */
625# define INT8_C(c)      c
626# define INT16_C(c)     c
627# define INT32_C(c)     c
628# ifdef _HAVE_LONGLONG_UINT64_T
629#  define INT64_C(c)    c ## L
630# else
631#  define INT64_C(c)    c ## LL
632# endif
633
634/* Unsigned.  */
635# define UINT8_C(c)     c ## U
636# define UINT16_C(c)    c ## U
637# define UINT32_C(c)    c ## U
638# ifdef _HAVE_LONGLONG_UINT64_T
639#  define UINT64_C(c)   c ## UL
640# else
641#  define UINT64_C(c)   c ## ULL
642# endif
643
644/* Maximal type.  */
645# ifdef _HAVE_LONGLONG_UINT64_T
646#  define INTMAX_C(c)   c ## L
647#  define UINTMAX_C(c)  c ## UL
648# else
649#  define INTMAX_C(c)   c ## LL
650#  define UINTMAX_C(c)  c ## ULL
651# endif
652
653  /* literalnumbers */
654#endif
655#endif
656
657/* These limits are merily those of a two complement byte-oriented system */
658
659/* Minimum of signed integral types.  */
660# define INT8_MIN               (-128)
661# define INT16_MIN              (-32767-1)
662# define INT32_MIN              (-2147483647-1)
663# define INT64_MIN              (-__INT64_C(9223372036854775807)-1)
664/* Maximum of signed integral types.  */
665# define INT8_MAX               (127)
666# define INT16_MAX              (32767)
667# define INT32_MAX              (2147483647)
668# define INT64_MAX              (__INT64_C(9223372036854775807))
669
670/* Maximum of unsigned integral types.  */
671# define UINT8_MAX              (255)
672# define UINT16_MAX             (65535)
673# define UINT32_MAX             (4294967295U)
674# define UINT64_MAX             (__UINT64_C(18446744073709551615))
675
676/* Minimum of signed integral types having a minimum size.  */
677# define INT_LEAST8_MIN         INT8_MIN
678# define INT_LEAST16_MIN        INT16_MIN
679# define INT_LEAST32_MIN        INT32_MIN
680# define INT_LEAST64_MIN        INT64_MIN
681/* Maximum of signed integral types having a minimum size.  */
682# define INT_LEAST8_MAX         INT8_MAX
683# define INT_LEAST16_MAX        INT16_MAX
684# define INT_LEAST32_MAX        INT32_MAX
685# define INT_LEAST64_MAX        INT64_MAX
686
687/* Maximum of unsigned integral types having a minimum size.  */
688# define UINT_LEAST8_MAX        UINT8_MAX
689# define UINT_LEAST16_MAX       UINT16_MAX
690# define UINT_LEAST32_MAX       UINT32_MAX
691# define UINT_LEAST64_MAX       UINT64_MAX
692
693  /* shortcircuit*/
694#endif
695  /* once */
696#endif
697#endif
698STDINT_EOF
699fi
700    if cmp -s $ac_stdint_h $ac_stdint 2>/dev/null; then
701      AC_MSG_NOTICE([$ac_stdint_h is unchanged])
702    else
703      ac_dir=`AS_DIRNAME(["$ac_stdint_h"])`
704      AS_MKDIR_P(["$ac_dir"])
705      rm -f $ac_stdint_h
706      mv $ac_stdint $ac_stdint_h
707    fi
708],[# variables for create stdint.h replacement
709PACKAGE="$PACKAGE"
710VERSION="$VERSION"
711ac_stdint_h="$ac_stdint_h"
712_ac_stdint_h=AS_TR_CPP(_$PACKAGE-$ac_stdint_h)
713ac_cv_stdint_message="$ac_cv_stdint_message"
714ac_cv_header_stdint_t="$ac_cv_header_stdint_t"
715ac_cv_header_stdint_x="$ac_cv_header_stdint_x"
716ac_cv_header_stdint_o="$ac_cv_header_stdint_o"
717ac_cv_header_stdint_u="$ac_cv_header_stdint_u"
718ac_cv_type_uint64_t="$ac_cv_type_uint64_t"
719ac_cv_type_u_int64_t="$ac_cv_type_u_int64_t"
720ac_cv_char_data_model="$ac_cv_char_data_model"
721ac_cv_long_data_model="$ac_cv_long_data_model"
722ac_cv_type_int_least32_t="$ac_cv_type_int_least32_t"
723ac_cv_type_int_fast32_t="$ac_cv_type_int_fast32_t"
724ac_cv_type_intmax_t="$ac_cv_type_intmax_t"
725])
726])
727