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