Commit | Line | Data |
---|---|---|
07c58694 PB |
1 | AC_DEFUN([GCC_STDINT_TYPES], |
2 | [AC_REQUIRE([AC_TYPE_INT8_T]) | |
3 | AC_REQUIRE([AC_TYPE_INT16_T]) | |
4 | AC_REQUIRE([AC_TYPE_INT32_T]) | |
5 | AC_REQUIRE([AC_TYPE_INT64_T]) | |
6 | AC_REQUIRE([AC_TYPE_INTMAX_T]) | |
7 | AC_REQUIRE([AC_TYPE_INTPTR_T]) | |
8 | AC_REQUIRE([AC_TYPE_UINT8_T]) | |
9 | AC_REQUIRE([AC_TYPE_UINT16_T]) | |
10 | AC_REQUIRE([AC_TYPE_UINT32_T]) | |
11 | AC_REQUIRE([AC_TYPE_UINT64_T]) | |
12 | AC_REQUIRE([AC_TYPE_UINTMAX_T]) | |
13 | AC_REQUIRE([AC_TYPE_UINTPTR_T])]) | |
8eb2f3f0 | 14 | |
f3b4f6d0 PB |
15 | dnl @synopsis GCC_HEADER_STDINT [( HEADER-TO-GENERATE [, HEADERS-TO-CHECK])] |
16 | dnl | |
17 | dnl the "ISO C9X: 7.18 Integer types <stdint.h>" section requires the | |
18 | dnl existence of an include file <stdint.h> that defines a set of | |
19 | dnl typedefs, especially uint8_t,int32_t,uintptr_t. | |
20 | dnl Many older installations will not provide this file, but some will | |
acf89cab | 21 | dnl have the very same definitions in <inttypes.h>. In other environments |
f3b4f6d0 PB |
22 | dnl we can use the inet-types in <sys/types.h> which would define the |
23 | dnl typedefs int8_t and u_int8_t respectivly. | |
24 | dnl | |
25 | dnl This macros will create a local "_stdint.h" or the headerfile given as | |
26 | dnl an argument. In many cases that file will pick the definition from a | |
27 | dnl "#include <stdint.h>" or "#include <inttypes.h>" statement, while | |
28 | dnl in other environments it will provide the set of basic 'stdint's defined: | |
29 | dnl int8_t,uint8_t,int16_t,uint16_t,int32_t,uint32_t,intptr_t,uintptr_t | |
30 | dnl int_least32_t.. int_fast32_t.. intmax_t | |
31 | dnl which may or may not rely on the definitions of other files. | |
32 | dnl | |
33 | dnl Sometimes the stdint.h or inttypes.h headers conflict with sys/types.h, | |
34 | dnl so we test the headers together with sys/types.h and always include it | |
35 | dnl into the generated header (to match the tests with the generated file). | |
36 | dnl Hopefully this is not a big annoyance. | |
37 | dnl | |
38 | dnl If your installed header files require the stdint-types you will want to | |
39 | dnl create an installable file mylib-int.h that all your other installable | |
40 | dnl header may include. So, for a library package named "mylib", just use | |
41 | dnl GCC_HEADER_STDINT(mylib-int.h) | |
42 | dnl in configure.in and install that header file in Makefile.am along with | |
43 | dnl the other headers (mylib.h). The mylib-specific headers can simply | |
44 | dnl use "#include <mylib-int.h>" to obtain the stdint-types. | |
45 | dnl | |
46 | dnl Remember, if the system already had a valid <stdint.h>, the generated | |
47 | dnl file will include it directly. No need for fuzzy HAVE_STDINT_H things... | |
48 | dnl | |
49 | dnl @author Guido Draheim <guidod@gmx.de>, Paolo Bonzini <bonzini@gnu.org> | |
50 | ||
8eb2f3f0 | 51 | AC_DEFUN([GCC_HEADER_STDINT], |
f3b4f6d0 PB |
52 | [m4_define(_GCC_STDINT_H, m4_ifval($1, $1, _stdint.h)) |
53 | ||
54 | inttype_headers=`echo inttypes.h sys/inttypes.h $2 | sed -e 's/,/ /g'` | |
55 | ||
56 | acx_cv_header_stdint=stddef.h | |
57 | acx_cv_header_stdint_kind="(already complete)" | |
58 | for i in stdint.h $inttype_headers; do | |
59 | unset ac_cv_type_uintptr_t | |
60 | unset ac_cv_type_uintmax_t | |
61 | unset ac_cv_type_int_least32_t | |
62 | unset ac_cv_type_int_fast32_t | |
63 | unset ac_cv_type_uint64_t | |
64 | _AS_ECHO_N([looking for a compliant stdint.h in $i, ]) | |
65 | AC_CHECK_TYPE(uintmax_t,[acx_cv_header_stdint=$i],continue,[#include <sys/types.h> | |
66 | #include <$i>]) | |
67 | AC_CHECK_TYPE(uintptr_t,,[acx_cv_header_stdint_kind="(mostly complete)"], [#include <sys/types.h> | |
68 | #include <$i>]) | |
69 | AC_CHECK_TYPE(int_least32_t,,[acx_cv_header_stdint_kind="(mostly complete)"], [#include <sys/types.h> | |
70 | #include <$i>]) | |
71 | AC_CHECK_TYPE(int_fast32_t,,[acx_cv_header_stdint_kind="(mostly complete)"], [#include <sys/types.h> | |
72 | #include <$i>]) | |
73 | AC_CHECK_TYPE(uint64_t,,[acx_cv_header_stdint_kind="(lacks uint64_t)"], [#include <sys/types.h> | |
74 | #include <$i>]) | |
75 | break | |
76 | done | |
77 | if test "$acx_cv_header_stdint" = stddef.h; then | |
78 | acx_cv_header_stdint_kind="(lacks uintmax_t)" | |
79 | for i in stdint.h $inttype_headers; do | |
80 | unset ac_cv_type_uintptr_t | |
81 | unset ac_cv_type_uint32_t | |
82 | unset ac_cv_type_uint64_t | |
83 | _AS_ECHO_N([looking for an incomplete stdint.h in $i, ]) | |
84 | AC_CHECK_TYPE(uint32_t,[acx_cv_header_stdint=$i],continue,[#include <sys/types.h> | |
85 | #include <$i>]) | |
86 | AC_CHECK_TYPE(uint64_t,,,[#include <sys/types.h> | |
87 | #include <$i>]) | |
88 | AC_CHECK_TYPE(uintptr_t,,,[#include <sys/types.h> | |
89 | #include <$i>]) | |
90 | break | |
91 | done | |
92 | fi | |
93 | if test "$acx_cv_header_stdint" = stddef.h; then | |
94 | acx_cv_header_stdint_kind="(u_intXX_t style)" | |
95 | for i in sys/types.h $inttype_headers; do | |
96 | unset ac_cv_type_u_int32_t | |
97 | unset ac_cv_type_u_int64_t | |
98 | _AS_ECHO_N([looking for u_intXX_t types in $i, ]) | |
99 | AC_CHECK_TYPE(u_int32_t,[acx_cv_header_stdint=$i],continue,[#include <sys/types.h> | |
100 | #include <$i>]) | |
101 | AC_CHECK_TYPE(u_int64_t,,,[#include <sys/types.h> | |
102 | #include <$i>]) | |
103 | break | |
104 | done | |
105 | fi | |
106 | if test "$acx_cv_header_stdint" = stddef.h; then | |
107 | acx_cv_header_stdint_kind="(using manual detection)" | |
108 | fi | |
109 | ||
110 | test -z "$ac_cv_type_uintptr_t" && ac_cv_type_uintptr_t=no | |
111 | test -z "$ac_cv_type_uint64_t" && ac_cv_type_uint64_t=no | |
112 | test -z "$ac_cv_type_u_int64_t" && ac_cv_type_u_int64_t=no | |
113 | test -z "$ac_cv_type_int_least32_t" && ac_cv_type_int_least32_t=no | |
114 | test -z "$ac_cv_type_int_fast32_t" && ac_cv_type_int_fast32_t=no | |
115 | ||
116 | # ----------------- Summarize what we found so far | |
117 | ||
118 | AC_MSG_CHECKING([what to include in _GCC_STDINT_H]) | |
119 | ||
120 | case `AS_BASENAME(_GCC_STDINT_H)` in | |
121 | stdint.h) AC_MSG_WARN([are you sure you want it there?]) ;; | |
122 | inttypes.h) AC_MSG_WARN([are you sure you want it there?]) ;; | |
123 | *) ;; | |
124 | esac | |
125 | ||
126 | AC_MSG_RESULT($acx_cv_header_stdint $acx_cv_header_stdint_kind) | |
127 | ||
128 | # ----------------- done included file, check C basic types -------- | |
129 | ||
130 | # Lacking an uintptr_t? Test size of void * | |
131 | case "$acx_cv_header_stdint:$ac_cv_type_uintptr_t" in | |
132 | stddef.h:* | *:no) AC_CHECK_SIZEOF(void *) ;; | |
133 | esac | |
134 | ||
135 | # Lacking an uint64_t? Test size of long | |
136 | case "$acx_cv_header_stdint:$ac_cv_type_uint64_t:$ac_cv_type_u_int64_t" in | |
137 | stddef.h:*:* | *:no:no) AC_CHECK_SIZEOF(long) ;; | |
138 | esac | |
139 | ||
140 | if test $acx_cv_header_stdint = stddef.h; then | |
141 | # Lacking a good header? Test size of everything and deduce all types. | |
142 | AC_CHECK_SIZEOF(int) | |
143 | AC_CHECK_SIZEOF(short) | |
144 | AC_CHECK_SIZEOF(char) | |
145 | ||
146 | AC_MSG_CHECKING(for type equivalent to int8_t) | |
147 | case "$ac_cv_sizeof_char" in | |
148 | 1) acx_cv_type_int8_t=char ;; | |
58bbed62 | 149 | *) AC_MSG_ERROR([no 8-bit type, please report a bug]) |
f3b4f6d0 PB |
150 | esac |
151 | AC_MSG_RESULT($acx_cv_type_int8_t) | |
152 | ||
153 | AC_MSG_CHECKING(for type equivalent to int16_t) | |
154 | case "$ac_cv_sizeof_int:$ac_cv_sizeof_short" in | |
155 | 2:*) acx_cv_type_int16_t=int ;; | |
156 | *:2) acx_cv_type_int16_t=short ;; | |
58bbed62 | 157 | *) AC_MSG_ERROR([no 16-bit type, please report a bug]) |
f3b4f6d0 PB |
158 | esac |
159 | AC_MSG_RESULT($acx_cv_type_int16_t) | |
160 | ||
161 | AC_MSG_CHECKING(for type equivalent to int32_t) | |
162 | case "$ac_cv_sizeof_int:$ac_cv_sizeof_long" in | |
163 | 4:*) acx_cv_type_int32_t=int ;; | |
164 | *:4) acx_cv_type_int32_t=long ;; | |
58bbed62 | 165 | *) AC_MSG_ERROR([no 32-bit type, please report a bug]) |
f3b4f6d0 PB |
166 | esac |
167 | AC_MSG_RESULT($acx_cv_type_int32_t) | |
168 | fi | |
169 | ||
170 | # These tests are here to make the output prettier | |
8eb2f3f0 | 171 | |
f3b4f6d0 PB |
172 | if test "$ac_cv_type_uint64_t" != yes && test "$ac_cv_type_u_int64_t" != yes; then |
173 | case "$ac_cv_sizeof_long" in | |
174 | 8) acx_cv_type_int64_t=long ;; | |
175 | esac | |
176 | AC_MSG_CHECKING(for type equivalent to int64_t) | |
177 | AC_MSG_RESULT(${acx_cv_type_int64_t-'using preprocessor symbols'}) | |
178 | fi | |
179 | ||
180 | # Now we can use the above types | |
181 | ||
182 | if test "$ac_cv_type_uintptr_t" != yes; then | |
183 | AC_MSG_CHECKING(for type equivalent to intptr_t) | |
184 | case $ac_cv_sizeof_void_p in | |
185 | 2) acx_cv_type_intptr_t=int16_t ;; | |
186 | 4) acx_cv_type_intptr_t=int32_t ;; | |
187 | 8) acx_cv_type_intptr_t=int64_t ;; | |
58bbed62 | 188 | *) AC_MSG_ERROR([no equivalent for intptr_t, please report a bug]) |
f3b4f6d0 PB |
189 | esac |
190 | AC_MSG_RESULT($acx_cv_type_intptr_t) | |
191 | fi | |
192 | ||
193 | # ----------------- done all checks, emit header ------------- | |
8eb2f3f0 | 194 | AC_CONFIG_COMMANDS(_GCC_STDINT_H, [ |
f3b4f6d0 PB |
195 | if test "$GCC" = yes; then |
196 | echo "/* generated for " `$CC --version | sed 1q` "*/" > tmp-stdint.h | |
197 | else | |
198 | echo "/* generated for $CC */" > tmp-stdint.h | |
199 | fi | |
200 | ||
201 | sed 's/^ *//' >> tmp-stdint.h <<EOF | |
202 | ||
203 | #ifndef GCC_GENERATED_STDINT_H | |
204 | #define GCC_GENERATED_STDINT_H 1 | |
205 | ||
206 | #include <sys/types.h> | |
8eb2f3f0 | 207 | EOF |
8eb2f3f0 | 208 | |
f3b4f6d0 PB |
209 | if test "$acx_cv_header_stdint" != stdint.h; then |
210 | echo "#include <stddef.h>" >> tmp-stdint.h | |
211 | fi | |
212 | if test "$acx_cv_header_stdint" != stddef.h; then | |
213 | echo "#include <$acx_cv_header_stdint>" >> tmp-stdint.h | |
214 | fi | |
215 | ||
216 | sed 's/^ *//' >> tmp-stdint.h <<EOF | |
217 | /* glibc uses these symbols as guards to prevent redefinitions. */ | |
218 | #ifdef __int8_t_defined | |
219 | #define _INT8_T | |
220 | #define _INT16_T | |
221 | #define _INT32_T | |
222 | #endif | |
223 | #ifdef __uint32_t_defined | |
224 | #define _UINT32_T | |
225 | #endif | |
226 | ||
227 | EOF | |
228 | ||
229 | # ----------------- done header, emit basic int types ------------- | |
230 | if test "$acx_cv_header_stdint" = stddef.h; then | |
231 | sed 's/^ *//' >> tmp-stdint.h <<EOF | |
232 | ||
233 | #ifndef _UINT8_T | |
234 | #define _UINT8_T | |
235 | #ifndef __uint8_t_defined | |
236 | #define __uint8_t_defined | |
a009f2e7 | 237 | #ifndef uint8_t |
f3b4f6d0 PB |
238 | typedef unsigned $acx_cv_type_int8_t uint8_t; |
239 | #endif | |
240 | #endif | |
a009f2e7 | 241 | #endif |
f3b4f6d0 PB |
242 | |
243 | #ifndef _UINT16_T | |
244 | #define _UINT16_T | |
245 | #ifndef __uint16_t_defined | |
246 | #define __uint16_t_defined | |
a009f2e7 | 247 | #ifndef uint16_t |
f3b4f6d0 PB |
248 | typedef unsigned $acx_cv_type_int16_t uint16_t; |
249 | #endif | |
250 | #endif | |
a009f2e7 | 251 | #endif |
f3b4f6d0 PB |
252 | |
253 | #ifndef _UINT32_T | |
254 | #define _UINT32_T | |
255 | #ifndef __uint32_t_defined | |
256 | #define __uint32_t_defined | |
a009f2e7 | 257 | #ifndef uint32_t |
f3b4f6d0 PB |
258 | typedef unsigned $acx_cv_type_int32_t uint32_t; |
259 | #endif | |
260 | #endif | |
a009f2e7 | 261 | #endif |
f3b4f6d0 PB |
262 | |
263 | #ifndef _INT8_T | |
264 | #define _INT8_T | |
265 | #ifndef __int8_t_defined | |
266 | #define __int8_t_defined | |
a009f2e7 | 267 | #ifndef int8_t |
f3b4f6d0 PB |
268 | typedef $acx_cv_type_int8_t int8_t; |
269 | #endif | |
270 | #endif | |
a009f2e7 | 271 | #endif |
f3b4f6d0 PB |
272 | |
273 | #ifndef _INT16_T | |
274 | #define _INT16_T | |
275 | #ifndef __int16_t_defined | |
276 | #define __int16_t_defined | |
a009f2e7 | 277 | #ifndef int16_t |
f3b4f6d0 PB |
278 | typedef $acx_cv_type_int16_t int16_t; |
279 | #endif | |
280 | #endif | |
a009f2e7 | 281 | #endif |
f3b4f6d0 PB |
282 | |
283 | #ifndef _INT32_T | |
284 | #define _INT32_T | |
285 | #ifndef __int32_t_defined | |
286 | #define __int32_t_defined | |
a009f2e7 | 287 | #ifndef int32_t |
f3b4f6d0 PB |
288 | typedef $acx_cv_type_int32_t int32_t; |
289 | #endif | |
290 | #endif | |
a009f2e7 | 291 | #endif |
f3b4f6d0 PB |
292 | EOF |
293 | elif test "$ac_cv_type_u_int32_t" = yes; then | |
294 | sed 's/^ *//' >> tmp-stdint.h <<EOF | |
295 | ||
296 | /* int8_t int16_t int32_t defined by inet code, we do the u_intXX types */ | |
297 | #ifndef _INT8_T | |
298 | #define _INT8_T | |
299 | #endif | |
300 | #ifndef _INT16_T | |
301 | #define _INT16_T | |
302 | #endif | |
303 | #ifndef _INT32_T | |
304 | #define _INT32_T | |
305 | #endif | |
306 | ||
307 | #ifndef _UINT8_T | |
308 | #define _UINT8_T | |
309 | #ifndef __uint8_t_defined | |
310 | #define __uint8_t_defined | |
a009f2e7 | 311 | #ifndef uint8_t |
f3b4f6d0 PB |
312 | typedef u_int8_t uint8_t; |
313 | #endif | |
314 | #endif | |
a009f2e7 | 315 | #endif |
f3b4f6d0 PB |
316 | |
317 | #ifndef _UINT16_T | |
318 | #define _UINT16_T | |
319 | #ifndef __uint16_t_defined | |
320 | #define __uint16_t_defined | |
a009f2e7 | 321 | #ifndef uint16_t |
f3b4f6d0 PB |
322 | typedef u_int16_t uint16_t; |
323 | #endif | |
324 | #endif | |
a009f2e7 | 325 | #endif |
f3b4f6d0 PB |
326 | |
327 | #ifndef _UINT32_T | |
328 | #define _UINT32_T | |
329 | #ifndef __uint32_t_defined | |
330 | #define __uint32_t_defined | |
a009f2e7 | 331 | #ifndef uint32_t |
f3b4f6d0 PB |
332 | typedef u_int32_t uint32_t; |
333 | #endif | |
334 | #endif | |
a009f2e7 | 335 | #endif |
f3b4f6d0 PB |
336 | EOF |
337 | else | |
338 | sed 's/^ *//' >> tmp-stdint.h <<EOF | |
339 | ||
340 | /* Some systems have guard macros to prevent redefinitions, define them. */ | |
341 | #ifndef _INT8_T | |
342 | #define _INT8_T | |
343 | #endif | |
344 | #ifndef _INT16_T | |
345 | #define _INT16_T | |
346 | #endif | |
347 | #ifndef _INT32_T | |
348 | #define _INT32_T | |
349 | #endif | |
350 | #ifndef _UINT8_T | |
351 | #define _UINT8_T | |
352 | #endif | |
353 | #ifndef _UINT16_T | |
354 | #define _UINT16_T | |
355 | #endif | |
356 | #ifndef _UINT32_T | |
357 | #define _UINT32_T | |
358 | #endif | |
359 | EOF | |
360 | fi | |
361 | ||
362 | # ------------- done basic int types, emit int64_t types ------------ | |
363 | if test "$ac_cv_type_uint64_t" = yes; then | |
364 | sed 's/^ *//' >> tmp-stdint.h <<EOF | |
365 | ||
366 | /* system headers have good uint64_t and int64_t */ | |
367 | #ifndef _INT64_T | |
368 | #define _INT64_T | |
369 | #endif | |
370 | #ifndef _UINT64_T | |
371 | #define _UINT64_T | |
372 | #endif | |
373 | EOF | |
374 | elif test "$ac_cv_type_u_int64_t" = yes; then | |
375 | sed 's/^ *//' >> tmp-stdint.h <<EOF | |
376 | ||
377 | /* system headers have an u_int64_t (and int64_t) */ | |
378 | #ifndef _INT64_T | |
379 | #define _INT64_T | |
380 | #endif | |
381 | #ifndef _UINT64_T | |
382 | #define _UINT64_T | |
383 | #ifndef __uint64_t_defined | |
384 | #define __uint64_t_defined | |
a009f2e7 | 385 | #ifndef uint64_t |
f3b4f6d0 PB |
386 | typedef u_int64_t uint64_t; |
387 | #endif | |
388 | #endif | |
a009f2e7 | 389 | #endif |
f3b4f6d0 PB |
390 | EOF |
391 | elif test -n "$acx_cv_type_int64_t"; then | |
392 | sed 's/^ *//' >> tmp-stdint.h <<EOF | |
393 | ||
394 | /* architecture has a 64-bit type, $acx_cv_type_int64_t */ | |
395 | #ifndef _INT64_T | |
396 | #define _INT64_T | |
a009f2e7 | 397 | #ifndef int64_t |
f3b4f6d0 PB |
398 | typedef $acx_cv_type_int64_t int64_t; |
399 | #endif | |
a009f2e7 | 400 | #endif |
f3b4f6d0 PB |
401 | #ifndef _UINT64_T |
402 | #define _UINT64_T | |
403 | #ifndef __uint64_t_defined | |
404 | #define __uint64_t_defined | |
a009f2e7 | 405 | #ifndef uint64_t |
f3b4f6d0 PB |
406 | typedef unsigned $acx_cv_type_int64_t uint64_t; |
407 | #endif | |
408 | #endif | |
a009f2e7 | 409 | #endif |
f3b4f6d0 PB |
410 | EOF |
411 | else | |
412 | sed 's/^ *//' >> tmp-stdint.h <<EOF | |
413 | ||
414 | /* some common heuristics for int64_t, using compiler-specific tests */ | |
415 | #if defined __STDC_VERSION__ && (__STDC_VERSION__-0) >= 199901L | |
416 | #ifndef _INT64_T | |
417 | #define _INT64_T | |
418 | #ifndef __int64_t_defined | |
a009f2e7 | 419 | #ifndef int64_t |
f3b4f6d0 PB |
420 | typedef long long int64_t; |
421 | #endif | |
422 | #endif | |
a009f2e7 | 423 | #endif |
f3b4f6d0 PB |
424 | #ifndef _UINT64_T |
425 | #define _UINT64_T | |
a009f2e7 | 426 | #ifndef uint64_t |
f3b4f6d0 PB |
427 | typedef unsigned long long uint64_t; |
428 | #endif | |
a009f2e7 | 429 | #endif |
f3b4f6d0 PB |
430 | |
431 | #elif defined __GNUC__ && defined (__STDC__) && __STDC__-0 | |
432 | /* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and | |
433 | does not implement __extension__. But that compiler doesn't define | |
434 | __GNUC_MINOR__. */ | |
435 | # if __GNUC__ < 2 || (__NeXT__ && !__GNUC_MINOR__) | |
436 | # define __extension__ | |
437 | # endif | |
438 | ||
439 | # ifndef _INT64_T | |
440 | # define _INT64_T | |
a009f2e7 | 441 | # ifndef int64_t |
f3b4f6d0 PB |
442 | __extension__ typedef long long int64_t; |
443 | # endif | |
a009f2e7 | 444 | # endif |
f3b4f6d0 PB |
445 | # ifndef _UINT64_T |
446 | # define _UINT64_T | |
a009f2e7 | 447 | # ifndef uint64_t |
f3b4f6d0 PB |
448 | __extension__ typedef unsigned long long uint64_t; |
449 | # endif | |
a009f2e7 | 450 | # endif |
f3b4f6d0 PB |
451 | |
452 | #elif !defined __STRICT_ANSI__ | |
453 | # if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__ | |
454 | ||
455 | # ifndef _INT64_T | |
456 | # define _INT64_T | |
a009f2e7 | 457 | # ifndef int64_t |
f3b4f6d0 PB |
458 | typedef __int64 int64_t; |
459 | # endif | |
a009f2e7 | 460 | # endif |
f3b4f6d0 PB |
461 | # ifndef _UINT64_T |
462 | # define _UINT64_T | |
a009f2e7 | 463 | # ifndef uint64_t |
f3b4f6d0 PB |
464 | typedef unsigned __int64 uint64_t; |
465 | # endif | |
a009f2e7 | 466 | # endif |
f3b4f6d0 PB |
467 | # endif /* compiler */ |
468 | ||
469 | #endif /* ANSI version */ | |
470 | EOF | |
471 | fi | |
472 | ||
473 | # ------------- done int64_t types, emit intptr types ------------ | |
474 | if test "$ac_cv_type_uintptr_t" != yes; then | |
475 | sed 's/^ *//' >> tmp-stdint.h <<EOF | |
476 | ||
477 | /* Define intptr_t based on sizeof(void*) = $ac_cv_sizeof_void_p */ | |
478 | #ifndef __uintptr_t_defined | |
a009f2e7 | 479 | #ifndef uintptr_t |
f3b4f6d0 PB |
480 | typedef u$acx_cv_type_intptr_t uintptr_t; |
481 | #endif | |
a009f2e7 | 482 | #endif |
f3b4f6d0 | 483 | #ifndef __intptr_t_defined |
a009f2e7 | 484 | #ifndef intptr_t |
f3b4f6d0 PB |
485 | typedef $acx_cv_type_intptr_t intptr_t; |
486 | #endif | |
a009f2e7 | 487 | #endif |
f3b4f6d0 PB |
488 | EOF |
489 | fi | |
490 | ||
491 | # ------------- done intptr types, emit int_least types ------------ | |
8eb2f3f0 | 492 | if test "$ac_cv_type_int_least32_t" != yes; then |
f3b4f6d0 | 493 | sed 's/^ *//' >> tmp-stdint.h <<EOF |
8eb2f3f0 PB |
494 | |
495 | /* Define int_least types */ | |
496 | typedef int8_t int_least8_t; | |
497 | typedef int16_t int_least16_t; | |
498 | typedef int32_t int_least32_t; | |
f3b4f6d0 | 499 | #ifdef _INT64_T |
8eb2f3f0 | 500 | typedef int64_t int_least64_t; |
f3b4f6d0 | 501 | #endif |
8eb2f3f0 PB |
502 | |
503 | typedef uint8_t uint_least8_t; | |
504 | typedef uint16_t uint_least16_t; | |
505 | typedef uint32_t uint_least32_t; | |
f3b4f6d0 | 506 | #ifdef _UINT64_T |
8eb2f3f0 | 507 | typedef uint64_t uint_least64_t; |
f3b4f6d0 | 508 | #endif |
8eb2f3f0 PB |
509 | EOF |
510 | fi | |
511 | ||
f3b4f6d0 | 512 | # ------------- done intptr types, emit int_fast types ------------ |
8eb2f3f0 PB |
513 | if test "$ac_cv_type_int_fast32_t" != yes; then |
514 | dnl NOTE: The following code assumes that sizeof (int) > 1. | |
515 | dnl Fix when strange machines are reported. | |
f3b4f6d0 | 516 | sed 's/^ *//' >> tmp-stdint.h <<EOF |
8eb2f3f0 PB |
517 | |
518 | /* Define int_fast types. short is often slow */ | |
519 | typedef int8_t int_fast8_t; | |
520 | typedef int int_fast16_t; | |
521 | typedef int32_t int_fast32_t; | |
f3b4f6d0 | 522 | #ifdef _INT64_T |
8eb2f3f0 | 523 | typedef int64_t int_fast64_t; |
f3b4f6d0 | 524 | #endif |
8eb2f3f0 PB |
525 | |
526 | typedef uint8_t uint_fast8_t; | |
527 | typedef unsigned int uint_fast16_t; | |
528 | typedef uint32_t uint_fast32_t; | |
f3b4f6d0 | 529 | #ifdef _UINT64_T |
8eb2f3f0 | 530 | typedef uint64_t uint_fast64_t; |
f3b4f6d0 | 531 | #endif |
8eb2f3f0 PB |
532 | EOF |
533 | fi | |
534 | ||
f3b4f6d0 PB |
535 | if test "$ac_cv_type_uintmax_t" != yes; then |
536 | sed 's/^ *//' >> tmp-stdint.h <<EOF | |
537 | ||
538 | /* Define intmax based on what we found */ | |
a009f2e7 | 539 | #ifndef intmax_t |
f3b4f6d0 PB |
540 | #ifdef _INT64_T |
541 | typedef int64_t intmax_t; | |
542 | #else | |
543 | typedef long intmax_t; | |
544 | #endif | |
a009f2e7 RW |
545 | #endif |
546 | #ifndef uintmax_t | |
f3b4f6d0 PB |
547 | #ifdef _UINT64_T |
548 | typedef uint64_t uintmax_t; | |
549 | #else | |
550 | typedef unsigned long uintmax_t; | |
551 | #endif | |
a009f2e7 | 552 | #endif |
f3b4f6d0 PB |
553 | EOF |
554 | fi | |
555 | ||
556 | sed 's/^ *//' >> tmp-stdint.h <<EOF | |
557 | ||
558 | #endif /* GCC_GENERATED_STDINT_H */ | |
559 | EOF | |
8eb2f3f0 | 560 | |
f3b4f6d0 PB |
561 | if test -r ]_GCC_STDINT_H[ && cmp -s tmp-stdint.h ]_GCC_STDINT_H[; then |
562 | rm -f tmp-stdint.h | |
8eb2f3f0 | 563 | else |
f3b4f6d0 | 564 | mv -f tmp-stdint.h ]_GCC_STDINT_H[ |
8eb2f3f0 PB |
565 | fi |
566 | ||
567 | ], [ | |
f3b4f6d0 PB |
568 | GCC="$GCC" |
569 | CC="$CC" | |
570 | acx_cv_header_stdint="$acx_cv_header_stdint" | |
571 | acx_cv_type_int8_t="$acx_cv_type_int8_t" | |
572 | acx_cv_type_int16_t="$acx_cv_type_int16_t" | |
573 | acx_cv_type_int32_t="$acx_cv_type_int32_t" | |
574 | acx_cv_type_int64_t="$acx_cv_type_int64_t" | |
575 | acx_cv_type_intptr_t="$acx_cv_type_intptr_t" | |
576 | ac_cv_type_uintmax_t="$ac_cv_type_uintmax_t" | |
577 | ac_cv_type_uintptr_t="$ac_cv_type_uintptr_t" | |
578 | ac_cv_type_uint64_t="$ac_cv_type_uint64_t" | |
579 | ac_cv_type_u_int64_t="$ac_cv_type_u_int64_t" | |
580 | ac_cv_type_u_int32_t="$ac_cv_type_u_int32_t" | |
8eb2f3f0 PB |
581 | ac_cv_type_int_least32_t="$ac_cv_type_int_least32_t" |
582 | ac_cv_type_int_fast32_t="$ac_cv_type_int_fast32_t" | |
f3b4f6d0 | 583 | ac_cv_sizeof_void_p="$ac_cv_sizeof_void_p" |
8eb2f3f0 PB |
584 | ]) |
585 | ||
586 | ]) |