~ubuntu-branches/ubuntu/maverick/uim/maverick

« back to all changes in this revision

Viewing changes to m4/ax_create_stdint_h.m4

  • Committer: Bazaar Package Importer
  • Author(s): Masahito Omote
  • Date: 2006-11-23 15:10:53 UTC
  • mfrom: (3.1.8 edgy)
  • Revision ID: james.westby@ubuntu.com-20061123151053-q42sk1lvks41xpfx
Tags: 1:1.2.1-9
uim-gtk2.0.postinst: Don't call update-gtk-immodules on purge.
(closes: Bug#398530)

Show diffs side-by-side

added added

removed removed

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