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