add Tizen tv profile only configuration
[platform/upstream/fontconfig.git] / m4 / ax_create_stdint_h.m4
1 dnl @synopsis AX_CREATE_STDINT_H [( HEADER-TO-GENERATE [, HEDERS-TO-CHECK])]
2 dnl
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.
10 dnl
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:
15 dnl
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
18 dnl
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
21 dnl type.
22 dnl
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
27 dnl
28 dnl      AX_CREATE_STDINT_H(mylib-int.h)
29 dnl
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.
34 dnl
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
38 dnl disabled its stdint.h for non-c99 compilation and the c99-mode
39 dnl is not the default. Therefore this macro will not use the
40 dnl compiler's stdint.h - please complain to the GCC developers).
41 dnl
42 dnl @category C
43 dnl @author Guido U. Draheim <guidod@gmx.de>
44 dnl @version 2003-12-07
45 dnl @license GPLWithACException
46
47 AC_DEFUN([AX_CHECK_DATA_MODEL],[
48    AC_CHECK_SIZEOF(char)
49    AC_CHECK_SIZEOF(short)
50    AC_CHECK_SIZEOF(int)
51    AC_CHECK_SIZEOF(long)
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" ;;
80    esac
81    AC_MSG_RESULT([$ac_cv_data_model ($ac_cv_long_data_model, $n)])
82 ])
83
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)
88   AC_MSG_RESULT([(..)])
89   for i in m4_ifval([$1],[$1],[stdint.h inttypes.h sys/inttypes.h sys/types.h])
90   do
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([$2],[$2]) break
96   done
97   AC_MSG_CHECKING([for stdint uintptr_t])
98  ])
99 ])
100
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])
106   do
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([$2],[$2]) break
112    break;
113   done
114   AC_MSG_CHECKING([for stdint uint32_t])
115  ])
116 ])
117
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([$2],[$2]) break
128    break;
129   done
130   AC_MSG_CHECKING([for stdint u_int32_t])
131  ])
132 ])
133
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 
149 CFLAGS="-std=c99"
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)])
152 fi
153 CXXFLAGS="$old_CXXFLAGS"
154 CPPFLAGS="$old_CPPFLAGS"
155 CFLAGS="$old_CFLAGS" ])
156
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])
164 else
165  ac_cv_header_stdint="$ac_cv_header_stdint_t"
166  AC_MSG_RESULT([$ac_cv_header_stdint (shortcircuit)])
167 fi
168
169 if test "_$ac_cv_header_stdint_t" = "_" ; then # can not shortcircuit..
170
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)
175
176 inttype_headers=`echo $2 | sed -e 's/,/ /g'`
177
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)")
182
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)")
187 fi
188
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)")
194 fi fi
195
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([(..)])
200    AX_CHECK_DATA_MODEL
201 fi
202
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"
209 else
210    ac_cv_header_stdint="stddef.h"
211 fi
212
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>])
221
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`
226 else
227 ac_cv_stdint_message="using $CC"
228 fi
229
230 AC_MSG_RESULT([make use of $ac_cv_header_stdint in $ac_stdint_h dnl
231 $ac_cv_stdint_result])
232
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
238
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
249 else
250
251 cat >>$ac_stdint <<STDINT_EOF
252
253 /* ................... shortcircuit part ........................... */
254
255 #if defined HAVE_STDINT_H || defined _STDINT_HAVE_STDINT_H
256 #include <stdint.h>
257 #else
258 #include <stddef.h>
259
260 /* .................... configured part ............................ */
261
262 STDINT_EOF
263
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
268 else
269   echo "/* #undef _STDINT_HEADER_INTPTR */" >>$ac_stdint
270 fi
271
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
276 else
277   echo "/* #undef _STDINT_HEADER_UINT32 */" >>$ac_stdint
278 fi
279
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
284 else
285   echo "/* #undef _STDINT_HEADER_U_INT32 */" >>$ac_stdint
286 fi
287
288 echo "" >>$ac_stdint
289
290 if test "_$ac_header" != "_" ; then if test "$ac_header" != "stddef.h" ; then
291   echo "#include <$ac_header>" >>$ac_stdint
292   echo "" >>$ac_stdint
293 fi fi
294
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
298 else
299 echo "/* #undef _STDINT_HAVE_UINT64_T */" >>$ac_stdint
300 fi
301 if test "$ac_cv_type_u_int64_t" = "yes" ; then
302 echo "#define   _STDINT_HAVE_U_INT64_T" "1"  >>$ac_stdint
303 else
304 echo "/* #undef _STDINT_HAVE_U_INT64_T */" >>$ac_stdint
305 fi
306 echo "" >>$ac_stdint
307
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
312 else
313 echo "/* #undef _STDINT_CHAR_MODEL // skipped */" >>$ac_stdint
314 echo "/* #undef _STDINT_LONG_MODEL // skipped */" >>$ac_stdint
315 fi
316 echo "" >>$ac_stdint
317
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
321 else
322 echo "/* #undef _STDINT_HAVE_INT_LEAST32_T */" >>$ac_stdint
323 fi
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
327 else
328 echo "/* #undef _STDINT_HAVE_INT_FAST32_T */" >>$ac_stdint
329 fi
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
333 else
334 echo "/* #undef _STDINT_HAVE_INTMAX_T */" >>$ac_stdint
335 fi
336 echo "" >>$ac_stdint
337
338   cat >>$ac_stdint <<STDINT_EOF
339 /* .................... detections part ............................ */
340
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
346 #else
347 #define _STDINT_HAVE_U_INT_TYPES
348 #endif
349 #endif
350 #endif
351
352 #ifdef _STDINT_HAVE_U_INT_TYPES
353 #undef _STDINT_NEED_INT_MODEL_T
354 #endif
355
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
360 #endif
361 #endif
362 #endif
363
364 #ifndef _STDINT_HAVE_INT_LEAST32_T
365 #define _STDINT_NEED_INT_LEAST_T
366 #endif
367
368 #ifndef _STDINT_HAVE_INT_FAST32_T
369 #define _STDINT_NEED_INT_FAST_T
370 #endif
371
372 #ifndef _STDINT_HEADER_INTPTR
373 #define _STDINT_NEED_INTPTR_T
374 #ifndef _STDINT_HAVE_INTMAX_T
375 #define _STDINT_NEED_INTMAX_T
376 #endif
377 #endif
378
379
380 /* .................... definition part ............................ */
381
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;
389 #endif
390 #endif
391
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;
399
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;
405
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;
413 #endif
414
415 #elif defined __alpha || (defined __mips && defined _ABIN32)
416 #if !defined _NO_LONGLONG
417 typedef long int64_t;
418 typedef unsigned long uint64_t;
419 #endif
420   /* compiler/cpu type to define int64_t */
421 #endif
422 #endif
423 #endif
424
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;
430
431 /* glibc compatibility */
432 #ifndef __int8_t_defined
433 #define __int8_t_defined
434 #endif
435 #endif
436
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) */
441
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) */
445
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
454 typedef          char    int8_t;
455 typedef          short   int16_t;
456 typedef          long    int32_t;
457 #endif
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
466 typedef          char    int8_t;
467 typedef          short   int16_t;
468 typedef          int     int32_t;
469 #endif
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
478 typedef          char    int8_t;
479 typedef          short   int16_t;
480 typedef          int     int32_t;
481 #endif
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;
487 #endif
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
495 typedef          char    int8_t;
496 typedef          short   int16_t;
497 typedef          int     int32_t;
498 #endif
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;
505 #endif
506 #else
507 #define _STDINT_NO_INT32_T
508 #endif
509 #else
510 #define _STDINT_NO_INT8_T
511 #define _STDINT_NO_INT32_T
512 #endif
513 #endif
514
515 /*
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
521  * implemented.
522  */
523
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;
530 #endif
531
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;
537 #endif
538   /* least types */
539 #endif
540
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;
547 #endif
548
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;
554 #endif
555   /* fast types */
556 #endif
557
558 #ifdef _STDINT_NEED_INTMAX_T
559 #ifdef _HAVE_UINT64_T
560 typedef  int64_t       intmax_t;
561 typedef uint64_t      uintmax_t;
562 #else
563 typedef          long  intmax_t;
564 typedef unsigned long uintmax_t;
565 #endif
566 #endif
567
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;
584 #endif
585 #endif
586 #endif
587
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
591 #ifndef UINT32_C
592
593 /* Signed.  */
594 # define INT8_C(c)      c
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
599 # else
600 #  define INT64_C(c)    c ## LL
601 # endif
602
603 /* Unsigned.  */
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
609 # else
610 #  define UINT64_C(c)   c ## ULL
611 # endif
612
613 /* Maximal type.  */
614 # ifdef _HAVE_LONGLONG_UINT64_T
615 #  define INTMAX_C(c)   c ## L
616 #  define UINTMAX_C(c)  c ## UL
617 # else
618 #  define INTMAX_C(c)   c ## LL
619 #  define UINTMAX_C(c)  c ## ULL
620 # endif
621
622   /* literalnumbers */
623 #endif
624 #endif
625
626 /* These limits are merily those of a two complement byte-oriented system */
627
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))
638
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))
644
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
655
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
661
662   /* shortcircuit*/
663 #endif
664   /* once */
665 #endif
666 #endif
667 STDINT_EOF
668 fi
669     if cmp -s $ac_stdint_h $ac_stdint 2>/dev/null; then
670       AC_MSG_NOTICE([$ac_stdint_h is unchanged])
671     else
672       ac_dir=`AS_DIRNAME(["$ac_stdint_h"])`
673       AS_MKDIR_P(["$ac_dir"])
674       rm -f $ac_stdint_h
675       mv $ac_stdint $ac_stdint_h
676     fi
677 ],[# variables for create stdint.h replacement
678 PACKAGE="$PACKAGE"
679 VERSION="$VERSION"
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"
694 ])
695 ])