OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [classpath/] [m4/] [ax_create_stdint_h.m4] - Blame information for rev 779

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.