1 diff -Nur sane-backends-1.0.19/m4.ne/byteorder.m4 sane-backends-1.0.19/m4/byteorder.m4
2 --- sane-backends-1.0.19/m4.ne/byteorder.m4 1970-01-01 01:00:00.000000000 +0100
3 +++ sane-backends-1.0.19/m4/byteorder.m4 2008-05-30 18:54:17.627166176 +0200
5 +dnl AC_NEED_BYTEORDER_H ( HEADER-TO-GENERATE )
6 +dnl Copyright 2001-2002 by Dan Fandrich <dan@coneharvesters.com>
7 +dnl This file may be copied and used freely without restrictions. No warranty
8 +dnl is expressed or implied.
10 +dnl Create a header file that guarantees that byte swapping macros of the
11 +dnl ntohl variety as well as the extended types included in OpenBSD and
12 +dnl NetBSD such as le32toh are defined. If possible, the standard ntohl
13 +dnl are overloaded as they are optimized for the given platform, but when
14 +dnl this is not possible (e.g. on a big-endian machine) they are defined
17 +dnl Look for a symbol in a header file
18 +dnl AC_HAVE_SYMBOL ( IDENTIFIER, HEADER-FILE, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND )
19 +AC_DEFUN([AC_HAVE_SYMBOL],
21 +AC_MSG_CHECKING(for $1 in $2)
22 +AC_EGREP_CPP([symbol is present|\<$1\>],[
36 +dnl Create a header file that defines extended byte swapping macros
37 +AC_DEFUN([AC_NEED_BYTEORDER_H],
40 +ac_dir=`echo $1|sed 's%/[^/][^/]*$%%'`
42 +if test "$ac_dir" != "$1" && test "$ac_dir" != .; then
43 + # The file is in a subdirectory.
44 + test ! -d "$ac_dir" && mkdir "$ac_dir"
47 +# We're only interested in the target CPU, but it's not always set
48 +effective_target="$target"
49 +if test "x$effective_target" = xNONE -o "x$effective_target" = x ; then
50 + effective_target="$host"
52 +AC_SUBST(effective_target)
55 +/* This file is generated automatically by configure */
56 +/* It is valid only for the system type ${effective_target} */
58 +#ifndef __BYTEORDER_H
59 +#define __BYTEORDER_H
63 +dnl First, do an endian check
66 +dnl Look for NetBSD-style extended byte swapping macros
67 +AC_HAVE_SYMBOL(le32toh,machine/endian.h,
70 +/* extended byte swapping macros are already available */
71 +#include <machine/endian.h>
77 +dnl Look for standard byte swapping macros
78 +AC_HAVE_SYMBOL(ntohl,arpa/inet.h,
80 +/* ntohl and relatives live here */
81 +#include <arpa/inet.h>
85 + [AC_HAVE_SYMBOL(ntohl,netinet/in.h,
87 +/* ntohl and relatives live here */
88 +#include <netinet/in.h>
93 +dnl Look for generic byte swapping macros
96 +AC_HAVE_SYMBOL(swap32,machine/endian.h,
98 +/* swap32 and swap16 are defined in machine/endian.h */
104 + AC_HAVE_SYMBOL(bswap_32,byteswap.h,
105 + [cat >> "$1" << EOF
106 +/* Define generic byte swapping functions */
107 +#include <byteswap.h>
108 +#define swap16(x) bswap_16(x)
109 +#define swap32(x) bswap_32(x)
110 +#define swap64(x) bswap_64(x)
116 + AC_HAVE_SYMBOL(bswap32,machine/endian.h,
117 + dnl We're already including machine/endian.h if this test succeeds
118 + [cat >> "$1" << EOF
119 +/* Define generic byte swapping functions */
121 + if test "$HAVE_LE32TOH" != "1"; then
122 + echo '#include <machine/endian.h>'>> "$1"
125 +#define swap16(x) bswap16(x)
126 +#define swap32(x) bswap32(x)
127 +#define swap64(x) bswap64(x)
133 + AC_HAVE_SYMBOL(__byte_swap_long,sys/types.h,
134 + [cat >> "$1" << EOF
135 +/* Define generic byte swapping functions */
136 +#include <sys/types.h>
137 +#define swap16(x) __byte_swap_word(x)
138 +#define swap32(x) __byte_swap_long(x)
139 +/* No optimized 64 bit byte swapping macro is available */
140 +#define swap64(x) ((uint64_t)(((uint64_t)(x) << 56) & 0xff00000000000000ULL | \\
141 + ((uint64_t)(x) << 40) & 0x00ff000000000000ULL | \\
142 + ((uint64_t)(x) << 24) & 0x0000ff0000000000ULL | \\
143 + ((uint64_t)(x) << 8) & 0x000000ff00000000ULL | \\
144 + ((x) >> 8) & 0x00000000ff000000ULL | \\
145 + ((x) >> 24) & 0x0000000000ff0000ULL | \\
146 + ((x) >> 40) & 0x000000000000ff00ULL | \\
147 + ((x) >> 56) & 0x00000000000000ffULL))
153 + AC_HAVE_SYMBOL(NXSwapLong,machine/byte_order.h,
154 + [cat >> "$1" << EOF
155 +/* Define generic byte swapping functions */
156 +#include <machine/byte_order.h>
157 +#define swap16(x) NXSwapShort(x)
158 +#define swap32(x) NXSwapLong(x)
159 +#define swap64(x) NXSwapLongLong(x)
163 + if test $ac_cv_c_bigendian = yes; then
165 +/* No other byte swapping functions are available on this big-endian system */
166 +#define swap16(x) ((uint16_t)(((x) << 8) | ((uint16_t)(x) >> 8)))
167 +#define swap32(x) ((uint32_t)(((uint32_t)(x) << 24) & 0xff000000UL | \\
168 + ((uint32_t)(x) << 8) & 0x00ff0000UL | \\
169 + ((x) >> 8) & 0x0000ff00UL | \\
170 + ((x) >> 24) & 0x000000ffUL))
171 +#define swap64(x) ((uint64_t)(((uint64_t)(x) << 56) & 0xff00000000000000ULL | \\
172 + ((uint64_t)(x) << 40) & 0x00ff000000000000ULL | \\
173 + ((uint64_t)(x) << 24) & 0x0000ff0000000000ULL | \\
174 + ((uint64_t)(x) << 8) & 0x000000ff00000000ULL | \\
175 + ((x) >> 8) & 0x00000000ff000000ULL | \\
176 + ((x) >> 24) & 0x0000000000ff0000ULL | \\
177 + ((x) >> 40) & 0x000000000000ff00ULL | \\
178 + ((x) >> 56) & 0x00000000000000ffULL))
183 +/* Use these as generic byteswapping macros on this little endian system */
184 +#define swap16(x) ntohs(x)
185 +#define swap32(x) ntohl(x)
186 +/* No optimized 64 bit byte swapping macro is available */
187 +#define swap64(x) ((uint64_t)(((uint64_t)(x) << 56) & 0xff00000000000000ULL | \\
188 + ((uint64_t)(x) << 40) & 0x00ff000000000000ULL | \\
189 + ((uint64_t)(x) << 24) & 0x0000ff0000000000ULL | \\
190 + ((uint64_t)(x) << 8) & 0x000000ff00000000ULL | \\
191 + ((x) >> 8) & 0x00000000ff000000ULL | \\
192 + ((x) >> 24) & 0x0000000000ff0000ULL | \\
193 + ((x) >> 40) & 0x000000000000ff00ULL | \\
194 + ((x) >> 56) & 0x00000000000000ffULL))
206 +if test "$HAVE_LE32TOH" != "1"; then
208 +/* The byte swapping macros have the form: */
209 +/* EENN[a]toh or htoEENN[a] where EE is be (big endian) or */
210 +/* le (little-endian), NN is 16 or 32 (number of bits) and a, */
211 +/* if present, indicates that the endian side is a pointer to an */
212 +/* array of uint8_t bytes instead of an integer of the specified length. */
213 +/* h refers to the host's ordering method. */
215 +/* So, to convert a 32-bit integer stored in a buffer in little-endian */
216 +/* format into a uint32_t usable on this machine, you could use: */
217 +/* uint32_t value = le32atoh(&buf[3]); */
218 +/* To put that value back into the buffer, you could use: */
219 +/* htole32a(&buf[3], value); */
221 +/* Define aliases for the standard byte swapping macros */
222 +/* Arguments to these macros must be properly aligned on natural word */
223 +/* boundaries in order to work properly on all architectures */
224 +#define htobe16(x) htons(x)
225 +#define htobe32(x) htonl(x)
226 +#define be16toh(x) ntohs(x)
227 +#define be32toh(x) ntohl(x)
229 +#define HTOBE16(x) (x) = htobe16(x)
230 +#define HTOBE32(x) (x) = htobe32(x)
231 +#define BE32TOH(x) (x) = be32toh(x)
232 +#define BE16TOH(x) (x) = be16toh(x)
236 + if test $ac_cv_c_bigendian = yes; then
238 +/* Define our own extended byte swapping macros for big-endian machines */
239 +#define htole16(x) swap16(x)
240 +#define htole32(x) swap32(x)
241 +#define le16toh(x) swap16(x)
242 +#define le32toh(x) swap32(x)
244 +#define htobe64(x) (x)
245 +#define be64toh(x) (x)
247 +#define HTOLE16(x) (x) = htole16(x)
248 +#define HTOLE32(x) (x) = htole32(x)
249 +#define LE16TOH(x) (x) = le16toh(x)
250 +#define LE32TOH(x) (x) = le32toh(x)
252 +#define HTOBE64(x) (void) (x)
253 +#define BE64TOH(x) (void) (x)
258 +/* On little endian machines, these macros are null */
259 +#define htole16(x) (x)
260 +#define htole32(x) (x)
261 +#define htole64(x) (x)
262 +#define le16toh(x) (x)
263 +#define le32toh(x) (x)
264 +#define le64toh(x) (x)
266 +#define HTOLE16(x) (void) (x)
267 +#define HTOLE32(x) (void) (x)
268 +#define HTOLE64(x) (void) (x)
269 +#define LE16TOH(x) (void) (x)
270 +#define LE32TOH(x) (void) (x)
271 +#define LE64TOH(x) (void) (x)
273 +/* These don't have standard aliases */
274 +#define htobe64(x) swap64(x)
275 +#define be64toh(x) swap64(x)
277 +#define HTOBE64(x) (x) = htobe64(x)
278 +#define BE64TOH(x) (x) = be64toh(x)
285 +/* Define the C99 standard length-specific integer types */
286 +#include <_stdint.h>
290 +case "${effective_target}" in
293 +/* Here are some macros to create integers from a byte array */
294 +/* These are used to get and put integers from/into a uint8_t array */
295 +/* with a specific endianness. This is the most portable way to generate */
296 +/* and read messages to a network or serial device. Each member of a */
297 +/* packet structure must be handled separately. */
299 +/* The i386 and compatibles can handle unaligned memory access, */
300 +/* so use the optimized macros above to do this job */
301 +#define be16atoh(x) be16toh(*(uint16_t*)(x))
302 +#define be32atoh(x) be32toh(*(uint32_t*)(x))
303 +#define be64atoh(x) be64toh(*(uint64_t*)(x))
304 +#define le16atoh(x) le16toh(*(uint16_t*)(x))
305 +#define le32atoh(x) le32toh(*(uint32_t*)(x))
306 +#define le64atoh(x) le64toh(*(uint64_t*)(x))
308 +#define htobe16a(a,x) *(uint16_t*)(a) = htobe16(x)
309 +#define htobe32a(a,x) *(uint32_t*)(a) = htobe32(x)
310 +#define htobe64a(a,x) *(uint64_t*)(a) = htobe64(x)
311 +#define htole16a(a,x) *(uint16_t*)(a) = htole16(x)
312 +#define htole32a(a,x) *(uint32_t*)(a) = htole32(x)
313 +#define htole64a(a,x) *(uint64_t*)(a) = htole64(x)
320 +/* Here are some macros to create integers from a byte array */
321 +/* These are used to get and put integers from/into a uint8_t array */
322 +/* with a specific endianness. This is the most portable way to generate */
323 +/* and read messages to a network or serial device. Each member of a */
324 +/* packet structure must be handled separately. */
326 +/* Non-optimized but portable macros */
327 +#define be16atoh(x) ((uint16_t)(((x)[0]<<8)|(x)[1]))
328 +#define be32atoh(x) ((uint32_t)(((x)[0]<<24)|((x)[1]<<16)|((x)[2]<<8)|(x)[3]))
329 +#define be64atoh(x) ((uint64_t)(((x)[0]<<56)|((x)[1]<<48)|((x)[2]<<40)| \\
330 + ((x)[3]<<32)|((x)[4]<<24)|((x)[5]<<16)|((x)[6]<<8)|(x)[7]))
331 +#define le16atoh(x) ((uint16_t)(((x)[1]<<8)|(x)[0]))
332 +#define le32atoh(x) ((uint32_t)(((x)[3]<<24)|((x)[2]<<16)|((x)[1]<<8)|(x)[0]))
333 +#define le64atoh(x) ((uint64_t)(((x)[7]<<56)|((x)[6]<<48)|((x)[5]<<40)| \\
334 + ((x)[4]<<32)|((x)[3]<<24)|((x)[2]<<16)|((x)[1]<<8)|(x)[0]))
336 +#define htobe16a(a,x) (a)[0]=(uint8_t)((x)>>8), (a)[1]=(uint8_t)(x)
337 +#define htobe32a(a,x) (a)[0]=(uint8_t)((x)>>24), (a)[1]=(uint8_t)((x)>>16), \\
338 + (a)[2]=(uint8_t)((x)>>8), (a)[3]=(uint8_t)(x)
339 +#define htobe64a(a,x) (a)[0]=(uint8_t)((x)>>56), (a)[1]=(uint8_t)((x)>>48), \\
340 + (a)[2]=(uint8_t)((x)>>40), (a)[3]=(uint8_t)((x)>>32), \\
341 + (a)[4]=(uint8_t)((x)>>24), (a)[5]=(uint8_t)((x)>>16), \\
342 + (a)[6]=(uint8_t)((x)>>8), (a)[7]=(uint8_t)(x)
343 +#define htole16a(a,x) (a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x)
344 +#define htole32a(a,x) (a)[3]=(uint8_t)((x)>>24), (a)[2]=(uint8_t)((x)>>16), \\
345 + (a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x)
346 +#define htole64a(a,x) (a)[7]=(uint8_t)((x)>>56), (a)[6]=(uint8_t)((x)>>48), \\
347 + (a)[5]=(uint8_t)((x)>>40), (a)[4]=(uint8_t)((x)>>32), \\
348 + (a)[3]=(uint8_t)((x)>>24), (a)[2]=(uint8_t)((x)>>16), \\
349 + (a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x)
357 +#endif /*__BYTEORDER_H*/
359 diff -Nur sane-backends-1.0.19/m4.ne/stdint.m4 sane-backends-1.0.19/m4/stdint.m4
360 --- sane-backends-1.0.19/m4.ne/stdint.m4 1970-01-01 01:00:00.000000000 +0100
361 +++ sane-backends-1.0.19/m4/stdint.m4 2008-05-30 18:54:17.627166176 +0200
363 +dnl AC_NEED_STDINT_H ( HEADER-TO-GENERATE )
364 +dnl Copyright 2001-2002 by Dan Fandrich <dan@coneharvesters.com>
365 +dnl This file may be copied and used freely without restrictions. No warranty
366 +dnl is expressed or implied.
368 +dnl Look for a header file that defines size-specific integer types like the
369 +dnl ones recommended to be in stdint.h in the C99 standard (e.g. uint32_t).
370 +dnl This is a dumbed-down version of the macro of the same name in the file
371 +dnl ac_need_stdint_h.m4 which is part of the ac-archive, available at
372 +dnl <URL:http://ac-archive.sourceforge.net/> (also, another macro
373 +dnl AC_CREATE_STDINT_H by the same author). This version is not as smart,
374 +dnl but works on older autoconf versions and has a different license.
376 +dnl AX_CHECK_DEFINED_TYPE ( TYPE, FILE, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND )
377 +dnl This is similar to _AC_CHECK_TYPE_NEW (a.k.a. new syntax version of
378 +dnl AC_CHECK_TYPE) in autoconf 2.50 but works on older versions
379 +AC_DEFUN([AX_CHECK_DEFINED_TYPE],
380 +[AC_MSG_CHECKING([for $1 in $2])
381 +AC_EGREP_CPP(changequote(<<,>>)dnl
382 +<<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl
383 +changequote([,]), [#include <$2>],
384 +ac_cv_type_$1=yes, ac_cv_type_$1=no)dnl
385 +AC_MSG_RESULT($ac_cv_type_$1)
386 +if test $ac_cv_type_$1 = yes; then
393 +dnl Look for a header file that defines size-specific integer types
394 +AC_DEFUN([AX_NEED_STDINT_H],
397 +ac_dir=`echo "$1"|sed 's%/[^/][^/]*$%%'`
398 +changequote([, ])dnl
399 +if test "$ac_dir" != "$1" && test "$ac_dir" != .; then
400 + # The file is in a subdirectory.
401 + test ! -d "$ac_dir" && mkdir "$ac_dir"
404 +AX_CHECK_DEFINED_TYPE(uint8_t,
408 +/* This file is generated automatically by configure */
411 +[AX_CHECK_DEFINED_TYPE(uint8_t,
414 +/* This file is generated automatically by configure */
415 +#include <inttypes.h>
417 +[AX_CHECK_DEFINED_TYPE(uint8_t,
420 +/* This file is generated automatically by configure */
421 +#include <sys/types.h>
423 +[AX_CHECK_DEFINED_TYPE(u_int8_t,
426 +/* This file is generated automatically by configure */
429 +#include <sys/types.h>
430 +typedef u_int8_t uint8_t;
431 +typedef u_int16_t uint16_t;
432 +typedef u_int32_t uint32_t;
435 +AX_CHECK_DEFINED_TYPE(u_int64_t,
438 +typedef u_int64_t uint64_t;
439 +#endif /*!__STDINT_H*/
442 +/* 64-bit types are not available on this system */
443 +/* typedef u_int64_t uint64_t; */
444 +#endif /*!__STDINT_H*/
448 +[AC_MSG_WARN([I can't find size-specific integer definitions on this system])
449 +if test -e "$1" ; then
455 +AC_DEFUN([AX_CHECK_DATA_MODEL],[
456 + AC_CHECK_SIZEOF(char)
457 + AC_CHECK_SIZEOF(short)
458 + AC_CHECK_SIZEOF(int)
459 + AC_CHECK_SIZEOF(long)
460 + AC_CHECK_SIZEOF(void*)
461 + ac_cv_char_data_model=""
462 + ac_cv_char_data_model="$ac_cv_char_data_model$ac_cv_sizeof_char"
463 + ac_cv_char_data_model="$ac_cv_char_data_model$ac_cv_sizeof_short"
464 + ac_cv_char_data_model="$ac_cv_char_data_model$ac_cv_sizeof_int"
465 + ac_cv_long_data_model=""
466 + ac_cv_long_data_model="$ac_cv_long_data_model$ac_cv_sizeof_int"
467 + ac_cv_long_data_model="$ac_cv_long_data_model$ac_cv_sizeof_long"
468 + ac_cv_long_data_model="$ac_cv_long_data_model$ac_cv_sizeof_voidp"
469 + AC_MSG_CHECKING([data model])
470 + case "$ac_cv_char_data_model/$ac_cv_long_data_model" in
471 + 122/242) ac_cv_data_model="IP16" ; n="standard 16bit machine" ;;
472 + 122/244) ac_cv_data_model="LP32" ; n="standard 32bit machine" ;;
473 + 122/*) ac_cv_data_model="i16" ; n="unusual int16 model" ;;
474 + 124/444) ac_cv_data_model="ILP32" ; n="standard 32bit unixish" ;;
475 + 124/488) ac_cv_data_model="LP64" ; n="standard 64bit unixish" ;;
476 + 124/448) ac_cv_data_model="LLP64" ; n="unusual 64bit unixish" ;;
477 + 124/*) ac_cv_data_model="i32" ; n="unusual int32 model" ;;
478 + 128/888) ac_cv_data_model="ILP64" ; n="unusual 64bit numeric" ;;
479 + 128/*) ac_cv_data_model="i64" ; n="unusual int64 model" ;;
480 + 222/*2) ac_cv_data_model="DSP16" ; n="strict 16bit dsptype" ;;
481 + 333/*3) ac_cv_data_model="DSP24" ; n="strict 24bit dsptype" ;;
482 + 444/*4) ac_cv_data_model="DSP32" ; n="strict 32bit dsptype" ;;
483 + 666/*6) ac_cv_data_model="DSP48" ; n="strict 48bit dsptype" ;;
484 + 888/*8) ac_cv_data_model="DSP64" ; n="strict 64bit dsptype" ;;
485 + 222/*|333/*|444/*|666/*|888/*) :
486 + ac_cv_data_model="iDSP" ; n="unusual dsptype" ;;
487 + *) ac_cv_data_model="none" ; n="very unusual model" ;;
489 + AC_MSG_RESULT([$ac_cv_data_model ($ac_cv_long_data_model, $n)])
492 +dnl AX_CHECK_HEADER_STDINT_X([HEADERLIST][,ACTION-IF])
493 +AC_DEFUN([AX_CHECK_HEADER_STDINT_X],[
494 +AC_CACHE_CHECK([for stdint uintptr_t], [ac_cv_header_stdint_x],[
495 + ac_cv_header_stdint_x="" # the 1997 typedefs (inttypes.h)
496 + AC_MSG_RESULT([(..)])
497 + for i in m4_ifval([$1],[$1],[stdint.h inttypes.h sys/inttypes.h]) ; do
498 + unset ac_cv_type_uintptr_t
499 + unset ac_cv_type_uint64_t
500 + AC_CHECK_TYPE(uintptr_t,[ac_cv_header_stdint_x=$i],continue,[#include <$i>])
501 + AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>])
502 + m4_ifvaln([$1],[$1]) break
504 + AC_MSG_CHECKING([for stdint uintptr_t])
508 +AC_DEFUN([AX_CHECK_HEADER_STDINT_O],[
509 +AC_CACHE_CHECK([for stdint uint32_t], [ac_cv_header_stdint_o],[
510 + ac_cv_header_stdint_o="" # the 1995 typedefs (sys/inttypes.h)
511 + AC_MSG_RESULT([(..)])
512 + for i in m4_ifval([$1],[$1],[inttypes.h sys/inttypes.h stdint.h]) ; do
513 + unset ac_cv_type_uint32_t
514 + unset ac_cv_type_uint64_t
515 + AC_CHECK_TYPE(uint32_t,[ac_cv_header_stdint_o=$i],continue,[#include <$i>])
516 + AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>])
517 + m4_ifvaln([$1],[$1]) break
520 + AC_MSG_CHECKING([for stdint uint32_t])
524 +AC_DEFUN([AX_CHECK_HEADER_STDINT_U],[
525 +AC_CACHE_CHECK([for stdint u_int32_t], [ac_cv_header_stdint_u],[
526 + ac_cv_header_stdint_u="" # the BSD typedefs (sys/types.h)
527 + AC_MSG_RESULT([(..)])
528 + for i in m4_ifval([$1],[$1],[sys/types.h inttypes.h sys/inttypes.h]) ; do
529 + unset ac_cv_type_u_int32_t
530 + unset ac_cv_type_u_int64_t
531 + AC_CHECK_TYPE(u_int32_t,[ac_cv_header_stdint_u=$i],continue,[#include <$i>])
532 + AC_CHECK_TYPE(u_int64_t,[and64="/u_int64_t"],[and64=""],[#include<$i>])
533 + m4_ifvaln([$1],[$1]) break
536 + AC_MSG_CHECKING([for stdint u_int32_t])
540 +AC_DEFUN([AX_CREATE_STDINT_H],
541 +[# ------ AX CREATE STDINT H -------------------------------------
542 +AC_MSG_CHECKING([for stdint types])
543 +ac_stdint_h=`echo ifelse($1, , _stdint.h, $1)`
544 +# try to shortcircuit - if the default include path of the compiler
545 +# can find a "stdint.h" header then we assume that all compilers can.
546 +AC_CACHE_VAL([ac_cv_header_stdint_t],[
547 +old_CXXFLAGS="$CXXFLAGS" ; CXXFLAGS=""
548 +old_CPPFLAGS="$CPPFLAGS" ; CPPFLAGS=""
549 +old_CFLAGS="$CFLAGS" ; CFLAGS=""
550 +AC_TRY_COMPILE([#include <stdint.h>],[int_least32_t v = 0;],
551 +[ac_cv_stdint_result="(assuming C99 compatible system)"
552 + ac_cv_header_stdint_t="stdint.h"; ],
553 +[ac_cv_header_stdint_t=""])
554 +CXXFLAGS="$old_CXXFLAGS"
555 +CPPFLAGS="$old_CPPFLAGS"
556 +CFLAGS="$old_CFLAGS" ])
558 +v="... $ac_cv_header_stdint_h"
559 +if test "$ac_stdint_h" = "stdint.h" ; then
560 + AC_MSG_RESULT([(are you sure you want them in ./stdint.h?)])
561 +elif test "$ac_stdint_h" = "inttypes.h" ; then
562 + AC_MSG_RESULT([(are you sure you want them in ./inttypes.h?)])
563 +elif test "_$ac_cv_header_stdint_t" = "_" ; then
564 + AC_MSG_RESULT([(putting them into $ac_stdint_h)$v])
566 + ac_cv_header_stdint="$ac_cv_header_stdint_t"
567 + AC_MSG_RESULT([$ac_cv_header_stdint (shortcircuit)])
570 +if test "_$ac_cv_header_stdint_t" = "_" ; then # can not shortcircuit..
572 +dnl .....intro message done, now do a few system checks.....
573 +dnl btw, all old CHECK_TYPE macros do automatically "DEFINE" a type,
574 +dnl therefore we use the autoconf implementation detail CHECK_TYPE_NEW
575 +dnl instead that is triggered with 3 or more arguments (see types.m4)
577 +inttype_headers=`echo $2 | sed -e 's/,/ /g'`
579 +ac_cv_stdint_result="(no helpful system typedefs seen)"
580 +AX_CHECK_HEADER_STDINT_X(dnl
581 + stdint.h inttypes.h sys/inttypes.h $inttype_headers,
582 + ac_cv_stdint_result="(seen uintptr_t$and64 in $i)")
584 +if test "_$ac_cv_header_stdint_x" = "_" ; then
585 +AX_CHECK_HEADER_STDINT_O(dnl,
586 + inttypes.h sys/inttypes.h stdint.h $inttype_headers,
587 + ac_cv_stdint_result="(seen uint32_t$and64 in $i)")
590 +if test "_$ac_cv_header_stdint_x" = "_" ; then
591 +if test "_$ac_cv_header_stdint_o" = "_" ; then
592 +AX_CHECK_HEADER_STDINT_U(dnl,
593 + sys/types.h inttypes.h sys/inttypes.h $inttype_headers,
594 + ac_cv_stdint_result="(seen u_int32_t$and64 in $i)")
597 +dnl if there was no good C99 header file, do some typedef checks...
598 +if test "_$ac_cv_header_stdint_x" = "_" ; then
599 + AC_MSG_CHECKING([for stdint datatype model])
600 + AC_MSG_RESULT([(..)])
601 + AX_CHECK_DATA_MODEL
604 +if test "_$ac_cv_header_stdint_x" != "_" ; then
605 + ac_cv_header_stdint="$ac_cv_header_stdint_x"
606 +elif test "_$ac_cv_header_stdint_o" != "_" ; then
607 + ac_cv_header_stdint="$ac_cv_header_stdint_o"
608 +elif test "_$ac_cv_header_stdint_u" != "_" ; then
609 + ac_cv_header_stdint="$ac_cv_header_stdint_u"
611 + ac_cv_header_stdint="stddef.h"
614 +AC_MSG_CHECKING([for extra inttypes in chosen header])
615 +AC_MSG_RESULT([($ac_cv_header_stdint)])
616 +dnl see if int_least and int_fast types are present in _this_ header.
617 +unset ac_cv_type_int_least32_t
618 +unset ac_cv_type_int_fast32_t
619 +AC_CHECK_TYPE(int_least32_t,,,[#include <$ac_cv_header_stdint>])
620 +AC_CHECK_TYPE(int_fast32_t,,,[#include<$ac_cv_header_stdint>])
621 +AC_CHECK_TYPE(intmax_t,,,[#include <$ac_cv_header_stdint>])
623 +fi # shortcircut to system "stdint.h"
624 +# ------------------ PREPARE VARIABLES ------------------------------
625 +if test "$GCC" = "yes" ; then
626 +ac_cv_stdint_message="using gnu compiler "`$CC --version | head -1`
628 +ac_cv_stdint_message="using $CC"
631 +AC_MSG_RESULT([make use of $ac_cv_header_stdint in $ac_stdint_h dnl
632 +$ac_cv_stdint_result])
634 +dnl -----------------------------------------------------------------
635 +# ----------------- DONE inttypes.h checks START header -------------
636 +AC_CONFIG_COMMANDS([$ac_stdint_h],[
637 +AC_MSG_NOTICE(creating $ac_stdint_h : $_ac_stdint_h)
638 +ac_stdint=$tmp/_stdint.h
640 +echo "#ifndef" $_ac_stdint_h >$ac_stdint
641 +echo "#define" $_ac_stdint_h "1" >>$ac_stdint
642 +echo "#ifndef" _GENERATED_STDINT_H >>$ac_stdint
643 +echo "#define" _GENERATED_STDINT_H '"'$PACKAGE $VERSION'"' >>$ac_stdint
644 +echo "/* generated $ac_cv_stdint_message */" >>$ac_stdint
645 +if test "_$ac_cv_header_stdint_t" != "_" ; then
646 +echo "#define _STDINT_HAVE_STDINT_H" "1" >>$ac_stdint
647 +echo "#include <stdint.h>" >>$ac_stdint
648 +echo "#endif" >>$ac_stdint
649 +echo "#endif" >>$ac_stdint
652 +cat >>$ac_stdint <<STDINT_EOF
654 +/* ................... shortcircuit part ........................... */
656 +#if defined HAVE_STDINT_H || defined _STDINT_HAVE_STDINT_H
661 +/* .................... configured part ............................ */
665 +echo "/* whether we have a C99 compatible stdint header file */" >>$ac_stdint
666 +if test "_$ac_cv_header_stdint_x" != "_" ; then
667 + ac_header="$ac_cv_header_stdint_x"
668 + echo "#define _STDINT_HEADER_INTPTR" '"'"$ac_header"'"' >>$ac_stdint
670 + echo "/* #undef _STDINT_HEADER_INTPTR */" >>$ac_stdint
673 +echo "/* whether we have a C96 compatible inttypes header file */" >>$ac_stdint
674 +if test "_$ac_cv_header_stdint_o" != "_" ; then
675 + ac_header="$ac_cv_header_stdint_o"
676 + echo "#define _STDINT_HEADER_UINT32" '"'"$ac_header"'"' >>$ac_stdint
678 + echo "/* #undef _STDINT_HEADER_UINT32 */" >>$ac_stdint
681 +echo "/* whether we have a BSD compatible inet types header */" >>$ac_stdint
682 +if test "_$ac_cv_header_stdint_u" != "_" ; then
683 + ac_header="$ac_cv_header_stdint_u"
684 + echo "#define _STDINT_HEADER_U_INT32" '"'"$ac_header"'"' >>$ac_stdint
686 + echo "/* #undef _STDINT_HEADER_U_INT32 */" >>$ac_stdint
689 +echo "" >>$ac_stdint
691 +if test "_$ac_header" != "_" ; then if test "$ac_header" != "stddef.h" ; then
692 + echo "#include <$ac_header>" >>$ac_stdint
693 + echo "" >>$ac_stdint
696 +echo "/* which 64bit typedef has been found */" >>$ac_stdint
697 +if test "$ac_cv_type_uint64_t" = "yes" ; then
698 +echo "#define _STDINT_HAVE_UINT64_T" "1" >>$ac_stdint
700 +echo "/* #undef _STDINT_HAVE_UINT64_T */" >>$ac_stdint
702 +if test "$ac_cv_type_u_int64_t" = "yes" ; then
703 +echo "#define _STDINT_HAVE_U_INT64_T" "1" >>$ac_stdint
705 +echo "/* #undef _STDINT_HAVE_U_INT64_T */" >>$ac_stdint
707 +echo "" >>$ac_stdint
709 +echo "/* which type model has been detected */" >>$ac_stdint
710 +if test "_$ac_cv_char_data_model" != "_" ; then
711 +echo "#define _STDINT_CHAR_MODEL" "$ac_cv_char_data_model" >>$ac_stdint
712 +echo "#define _STDINT_LONG_MODEL" "$ac_cv_long_data_model" >>$ac_stdint
714 +echo "/* #undef _STDINT_CHAR_MODEL // skipped */" >>$ac_stdint
715 +echo "/* #undef _STDINT_LONG_MODEL // skipped */" >>$ac_stdint
717 +echo "" >>$ac_stdint
719 +echo "/* whether int_least types were detected */" >>$ac_stdint
720 +if test "$ac_cv_type_int_least32_t" = "yes"; then
721 +echo "#define _STDINT_HAVE_INT_LEAST32_T" "1" >>$ac_stdint
723 +echo "/* #undef _STDINT_HAVE_INT_LEAST32_T */" >>$ac_stdint
725 +echo "/* whether int_fast types were detected */" >>$ac_stdint
726 +if test "$ac_cv_type_int_fast32_t" = "yes"; then
727 +echo "#define _STDINT_HAVE_INT_FAST32_T" "1" >>$ac_stdint
729 +echo "/* #undef _STDINT_HAVE_INT_FAST32_T */" >>$ac_stdint
731 +echo "/* whether intmax_t type was detected */" >>$ac_stdint
732 +if test "$ac_cv_type_intmax_t" = "yes"; then
733 +echo "#define _STDINT_HAVE_INTMAX_T" "1" >>$ac_stdint
735 +echo "/* #undef _STDINT_HAVE_INTMAX_T */" >>$ac_stdint
737 +echo "" >>$ac_stdint
739 + cat >>$ac_stdint <<STDINT_EOF
740 +/* .................... detections part ............................ */
742 +/* whether we need to define bitspecific types from compiler base types */
743 +#ifndef _STDINT_HEADER_INTPTR
744 +#ifndef _STDINT_HEADER_UINT32
745 +#ifndef _STDINT_HEADER_U_INT32
746 +#define _STDINT_NEED_INT_MODEL_T
748 +#define _STDINT_HAVE_U_INT_TYPES
753 +#ifdef _STDINT_HAVE_U_INT_TYPES
754 +#undef _STDINT_NEED_INT_MODEL_T
757 +#ifdef _STDINT_CHAR_MODEL
758 +#if _STDINT_CHAR_MODEL+0 == 122 || _STDINT_CHAR_MODEL+0 == 124
759 +#ifndef _STDINT_BYTE_MODEL
760 +#define _STDINT_BYTE_MODEL 12
765 +#ifndef _STDINT_HAVE_INT_LEAST32_T
766 +#define _STDINT_NEED_INT_LEAST_T
769 +#ifndef _STDINT_HAVE_INT_FAST32_T
770 +#define _STDINT_NEED_INT_FAST_T
773 +#ifndef _STDINT_HEADER_INTPTR
774 +#define _STDINT_NEED_INTPTR_T
775 +#ifndef _STDINT_HAVE_INTMAX_T
776 +#define _STDINT_NEED_INTMAX_T
781 +/* .................... definition part ............................ */
783 +/* some system headers have good uint64_t */
784 +#ifndef _HAVE_UINT64_T
785 +#if defined _STDINT_HAVE_UINT64_T || defined HAVE_UINT64_T
786 +#define _HAVE_UINT64_T
787 +#elif defined _STDINT_HAVE_U_INT64_T || defined HAVE_U_INT64_T
788 +#define _HAVE_UINT64_T
789 +typedef u_int64_t uint64_t;
793 +#ifndef _HAVE_UINT64_T
794 +/* .. here are some common heuristics using compiler runtime specifics */
795 +#if defined __STDC_VERSION__ && defined __STDC_VERSION__ >= 199901L
796 +#define _HAVE_UINT64_T
797 +#define _HAVE_LONGLONG_UINT64_T
798 +typedef long long int64_t;
799 +typedef unsigned long long uint64_t;
801 +#elif !defined __STRICT_ANSI__
802 +#if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__
803 +#define _HAVE_UINT64_T
804 +typedef __int64 int64_t;
805 +typedef unsigned __int64 uint64_t;
807 +#elif defined __GNUC__ || defined __MWERKS__ || defined __ELF__
808 +/* note: all ELF-systems seem to have loff-support which needs 64-bit */
809 +#if !defined _NO_LONGLONG
810 +#define _HAVE_UINT64_T
811 +#define _HAVE_LONGLONG_UINT64_T
812 +typedef long long int64_t;
813 +typedef unsigned long long uint64_t;
816 +#elif defined __alpha || (defined __mips && defined _ABIN32)
817 +#if !defined _NO_LONGLONG
818 +typedef long int64_t;
819 +typedef unsigned long uint64_t;
821 + /* compiler/cpu type to define int64_t */
826 +#if defined _STDINT_HAVE_U_INT_TYPES
827 +/* int8_t int16_t int32_t defined by inet code, redeclare the u_intXX types */
828 +typedef u_int8_t uint8_t;
829 +typedef u_int16_t uint16_t;
830 +typedef u_int32_t uint32_t;
832 +/* glibc compatibility */
833 +#ifndef __int8_t_defined
834 +#define __int8_t_defined
838 +#ifdef _STDINT_NEED_INT_MODEL_T
839 +/* we must guess all the basic types. Apart from byte-adressable system, */
840 +/* there a few 32-bit-only dsp-systems that we guard with BYTE_MODEL 8-} */
841 +/* (btw, those nibble-addressable systems are way off, or so we assume) */
843 +dnl /* have a look at "64bit and data size neutrality" at */
844 +dnl /* http://unix.org/version2/whatsnew/login_64bit.html */
845 +dnl /* (the shorthand "ILP" types always have a "P" part) */
847 +#if defined _STDINT_BYTE_MODEL
848 +#if _STDINT_LONG_MODEL+0 == 242
849 +/* 2:4:2 = IP16 = a normal 16-bit system */
850 +typedef unsigned char uint8_t;
851 +typedef unsigned short uint16_t;
852 +typedef unsigned long uint32_t;
853 +#ifndef __int8_t_defined
854 +#define __int8_t_defined
855 +typedef char int8_t;
856 +typedef short int16_t;
857 +typedef long int32_t;
859 +#elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL == 444
860 +/* 2:4:4 = LP32 = a 32-bit system derived from a 16-bit */
861 +/* 4:4:4 = ILP32 = a normal 32-bit system */
862 +typedef unsigned char uint8_t;
863 +typedef unsigned short uint16_t;
864 +typedef unsigned int uint32_t;
865 +#ifndef __int8_t_defined
866 +#define __int8_t_defined
867 +typedef char int8_t;
868 +typedef short int16_t;
869 +typedef int int32_t;
871 +#elif _STDINT_LONG_MODEL+0 == 484 || _STDINT_LONG_MODEL+0 == 488
872 +/* 4:8:4 = IP32 = a 32-bit system prepared for 64-bit */
873 +/* 4:8:8 = LP64 = a normal 64-bit system */
874 +typedef unsigned char uint8_t;
875 +typedef unsigned short uint16_t;
876 +typedef unsigned int uint32_t;
877 +#ifndef __int8_t_defined
878 +#define __int8_t_defined
879 +typedef char int8_t;
880 +typedef short int16_t;
881 +typedef int int32_t;
883 +/* this system has a "long" of 64bit */
884 +#ifndef _HAVE_UINT64_T
885 +#define _HAVE_UINT64_T
886 +typedef unsigned long uint64_t;
887 +typedef long int64_t;
889 +#elif _STDINT_LONG_MODEL+0 == 448
890 +/* LLP64 a 64-bit system derived from a 32-bit system */
891 +typedef unsigned char uint8_t;
892 +typedef unsigned short uint16_t;
893 +typedef unsigned int uint32_t;
894 +#ifndef __int8_t_defined
895 +#define __int8_t_defined
896 +typedef char int8_t;
897 +typedef short int16_t;
898 +typedef int int32_t;
900 +/* assuming the system has a "long long" */
901 +#ifndef _HAVE_UINT64_T
902 +#define _HAVE_UINT64_T
903 +#define _HAVE_LONGLONG_UINT64_T
904 +typedef unsigned long long uint64_t;
905 +typedef long long int64_t;
908 +#define _STDINT_NO_INT32_T
911 +#define _STDINT_NO_INT8_T
912 +#define _STDINT_NO_INT32_T
917 + * quote from SunOS-5.8 sys/inttypes.h:
918 + * Use at your own risk. As of February 1996, the committee is squarely
919 + * behind the fixed sized types; the "least" and "fast" types are still being
920 + * discussed. The probability that the "fast" types may be removed before
921 + * the standard is finalized is high enough that they are not currently
925 +#if defined _STDINT_NEED_INT_LEAST_T
926 +typedef int8_t int_least8_t;
927 +typedef int16_t int_least16_t;
928 +typedef int32_t int_least32_t;
929 +#ifdef _HAVE_UINT64_T
930 +typedef int64_t int_least64_t;
933 +typedef uint8_t uint_least8_t;
934 +typedef uint16_t uint_least16_t;
935 +typedef uint32_t uint_least32_t;
936 +#ifdef _HAVE_UINT64_T
937 +typedef uint64_t uint_least64_t;
942 +#if defined _STDINT_NEED_INT_FAST_T
943 +typedef int8_t int_fast8_t;
944 +typedef int int_fast16_t;
945 +typedef int32_t int_fast32_t;
946 +#ifdef _HAVE_UINT64_T
947 +typedef int64_t int_fast64_t;
950 +typedef uint8_t uint_fast8_t;
951 +typedef unsigned uint_fast16_t;
952 +typedef uint32_t uint_fast32_t;
953 +#ifdef _HAVE_UINT64_T
954 +typedef uint64_t uint_fast64_t;
959 +#ifdef _STDINT_NEED_INTMAX_T
960 +#ifdef _HAVE_UINT64_T
961 +typedef int64_t intmax_t;
962 +typedef uint64_t uintmax_t;
964 +typedef long intmax_t;
965 +typedef unsigned long uintmax_t;
969 +#ifdef _STDINT_NEED_INTPTR_T
970 +#ifndef __intptr_t_defined
971 +#define __intptr_t_defined
972 +/* we encourage using "long" to store pointer values, never use "int" ! */
973 +#if _STDINT_LONG_MODEL+0 == 242 || _STDINT_LONG_MODEL+0 == 484
974 +typedef unsinged int uintptr_t;
975 +typedef int intptr_t;
976 +#elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL+0 == 444
977 +typedef unsigned long uintptr_t;
978 +typedef long intptr_t;
979 +#elif _STDINT_LONG_MODEL+0 == 448 && defined _HAVE_UINT64_T
980 +typedef uint64_t uintptr_t;
981 +typedef int64_t intptr_t;
982 +#else /* matches typical system types ILP32 and LP64 - but not IP16 or LLP64 */
983 +typedef unsigned long uintptr_t;
984 +typedef long intptr_t;
989 +/* The ISO C99 standard specifies that in C++ implementations these
990 + should only be defined if explicitly requested. */
991 +#if !defined __cplusplus || defined __STDC_CONSTANT_MACROS
995 +# define INT8_C(c) c
996 +# define INT16_C(c) c
997 +# define INT32_C(c) c
998 +# ifdef _HAVE_LONGLONG_UINT64_T
999 +# define INT64_C(c) c ## L
1001 +# define INT64_C(c) c ## LL
1005 +# define UINT8_C(c) c ## U
1006 +# define UINT16_C(c) c ## U
1007 +# define UINT32_C(c) c ## U
1008 +# ifdef _HAVE_LONGLONG_UINT64_T
1009 +# define UINT64_C(c) c ## UL
1011 +# define UINT64_C(c) c ## ULL
1014 +/* Maximal type. */
1015 +# ifdef _HAVE_LONGLONG_UINT64_T
1016 +# define INTMAX_C(c) c ## L
1017 +# define UINTMAX_C(c) c ## UL
1019 +# define INTMAX_C(c) c ## LL
1020 +# define UINTMAX_C(c) c ## ULL
1023 + /* literalnumbers */
1027 +/* These limits are merily those of a two complement byte-oriented system */
1029 +/* Minimum of signed integral types. */
1030 +# define INT8_MIN (-128)
1031 +# define INT16_MIN (-32767-1)
1032 +# define INT32_MIN (-2147483647-1)
1033 +# define INT64_MIN (-__INT64_C(9223372036854775807)-1)
1034 +/* Maximum of signed integral types. */
1035 +# define INT8_MAX (127)
1036 +# define INT16_MAX (32767)
1037 +# define INT32_MAX (2147483647)
1038 +# define INT64_MAX (__INT64_C(9223372036854775807))
1040 +/* Maximum of unsigned integral types. */
1041 +# define UINT8_MAX (255)
1042 +# define UINT16_MAX (65535)
1043 +# define UINT32_MAX (4294967295U)
1044 +# define UINT64_MAX (__UINT64_C(18446744073709551615))
1046 +/* Minimum of signed integral types having a minimum size. */
1047 +# define INT_LEAST8_MIN INT8_MIN
1048 +# define INT_LEAST16_MIN INT16_MIN
1049 +# define INT_LEAST32_MIN INT32_MIN
1050 +# define INT_LEAST64_MIN INT64_MIN
1051 +/* Maximum of signed integral types having a minimum size. */
1052 +# define INT_LEAST8_MAX INT8_MAX
1053 +# define INT_LEAST16_MAX INT16_MAX
1054 +# define INT_LEAST32_MAX INT32_MAX
1055 +# define INT_LEAST64_MAX INT64_MAX
1057 +/* Maximum of unsigned integral types having a minimum size. */
1058 +# define UINT_LEAST8_MAX UINT8_MAX
1059 +# define UINT_LEAST16_MAX UINT16_MAX
1060 +# define UINT_LEAST32_MAX UINT32_MAX
1061 +# define UINT_LEAST64_MAX UINT64_MAX
1070 + if cmp -s $ac_stdint_h $ac_stdint 2>/dev/null; then
1071 + AC_MSG_NOTICE([$ac_stdint_h is unchanged])
1073 + ac_dir=`AS_DIRNAME(["$ac_stdint_h"])`
1074 + AS_MKDIR_P(["$ac_dir"])
1075 + rm -f $ac_stdint_h
1076 + mv $ac_stdint $ac_stdint_h
1078 +],[# variables for create stdint.h replacement
1081 +ac_stdint_h="$ac_stdint_h"
1082 +_ac_stdint_h=AS_TR_CPP(_$PACKAGE-$ac_stdint_h)
1083 +ac_cv_stdint_message="$ac_cv_stdint_message"
1084 +ac_cv_header_stdint_t="$ac_cv_header_stdint_t"
1085 +ac_cv_header_stdint_x="$ac_cv_header_stdint_x"
1086 +ac_cv_header_stdint_o="$ac_cv_header_stdint_o"
1087 +ac_cv_header_stdint_u="$ac_cv_header_stdint_u"
1088 +ac_cv_type_uint64_t="$ac_cv_type_uint64_t"
1089 +ac_cv_type_u_int64_t="$ac_cv_type_u_int64_t"
1090 +ac_cv_char_data_model="$ac_cv_char_data_model"
1091 +ac_cv_long_data_model="$ac_cv_long_data_model"
1092 +ac_cv_type_int_least32_t="$ac_cv_type_int_least32_t"
1093 +ac_cv_type_int_fast32_t="$ac_cv_type_int_fast32_t"
1094 +ac_cv_type_intmax_t="$ac_cv_type_intmax_t"