1 dnl Check if the compiler can handle unsigned long constants, ie 2ul.
2 AC_DEFUN([AMANDA_C_UNSIGNED_LONG_CONSTANTS],
5 [for working unsigned long constants],
6 amanda_cv_c_unsigned_long_constants,
14 amanda_cv_c_unsigned_long_constants=yes,
15 amanda_cv_c_unsigned_long_constants=no
19 if test "$amanda_cv_c_unsigned_long_constants" = yes; then
20 AC_DEFINE(HAVE_UNSIGNED_LONG_CONSTANTS,1,[Define if the compiler support unsigned long constants. ])
25 dnl Check for the argument type for shmat() and shmdt()
26 AC_DEFUN([AMANDA_FUNC_SHM_ARG_TYPE],
29 [for shmdt() argument type],
30 amanda_cv_shmdt_arg_type,
32 if test "$ac_cv_func_shmget" = yes; then
33 cat <<EOF >conftest.$ac_ext
35 #ifdef HAVE_SYS_TYPES_H
36 # include <sys/types.h>
46 extern "C" void *shmat(int, void *, int);
57 ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext >/dev/null 2>/dev/null
59 amanda_cv_shmdt_arg_type=void
61 amanda_cv_shmdt_arg_type=char
65 amanda_cv_shmdt_arg_type=nothing
69 AC_DEFINE_UNQUOTED(SHM_ARG_TYPE,$amanda_cv_shmdt_arg_type,[Define to type of shmget() function argument. ])
73 dnl Figure out the select() argument type.
74 AC_DEFUN([AMANDA_FUNC_SELECT_ARG_TYPE],
77 [for select() argument type],
78 amanda_cv_select_arg_type,
81 cat <<EOF >conftest.$ac_ext
83 #ifdef HAVE_SYS_TIME_H
84 # include <sys/time.h>
86 #ifdef HAVE_SYS_TYPES_H
87 # include <sys/types.h>
89 #ifdef HAVE_SYS_SELECT_H
90 # include <sys/select.h>
92 #ifdef HAVE_SYS_SOCKET_H
93 # include <sys/socket.h>
101 #ifdef FD_SET_POINTER
102 (void)select(0, (fd_set *) 0, (fd_set *) 0, (fd_set *) 0, 0);
104 (void)select(0, (int *) 0, (int *) 0, (int *) 0, 0);
110 dnl Figure out the select argument type by first trying to
111 dnl compile with the fd_set argument. If the compile fails,
112 dnl then we know to use the int. If it suceeds, then try to
113 dnl use the int. If the int fails, then use fd_set. If
114 dnl both suceeed, then do a line count on the number of
115 dnl lines that the compiler spit out, assuming that the
116 dnl compile outputing more lines had more errors.
117 amanda_cv_select_arg_type=no
118 select_compile="${CC-cc} -c $CFLAGS $CPPFLAGS"
119 $select_compile -DFD_SET_POINTER conftest.$ac_ext 1>conftest.fd_set 2>&1
120 if test $? -ne 0; then
121 amanda_cv_select_arg_type=int
123 if test "$amanda_cv_select_arg_type" = no; then
124 $select_compile conftest.$ac_ext 1>conftest.int 2>&1
125 if test $? -ne 0; then
126 amanda_cv_select_arg_type=fd_set
129 if test "$amanda_cv_select_arg_type" = no; then
130 wc_fdset=`wc -l <conftest.fd_set`
131 wc_int=`wc -l <conftest.int`
132 if test "$wc_fdset" -le "$wc_int"; then
133 amanda_cv_select_arg_type=fd_set
135 amanda_cv_select_arg_type=int
141 AC_DEFINE_UNQUOTED(SELECT_ARG_TYPE,$amanda_cv_select_arg_type,[Define to type of select arguments. ])
145 dnl Check if setsockopt can use the SO_SNDTIMEO option.
146 dnl This defines HAVE_SO_SNDTIMEO if setsockopt works
147 dnl with SO_SNDTIMEO.
148 AC_DEFUN([AMANDA_FUNC_SETSOCKOPT_SO_SNDTIMEO],
151 [for setsockopt SO_SNDTIMEO option],
152 amanda_cv_setsockopt_SO_SNDTIMEO,
156 #include <sys/types.h>
157 #include <sys/socket.h>
158 #ifdef TIME_WITH_SYS_TIME
159 # include <sys/time.h>
162 # ifdef HAVE_SYS_TIME_H
163 # include <sys/time.h>
171 int sock = socket(AF_INET, SOCK_STREAM, 0);
172 struct timeval timeout;
175 return (setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO,
176 (void *)&timeout, sizeof(timeout)));
182 amanda_cv_setsockopt_SO_SNDTIMEO=yes,
183 amanda_cv_setsockopt_SO_SNDTIMEO=no,
184 amanda_cv_setsockopt_SO_SNDTIMEO=no
188 if test "$amanda_cv_setsockopt_SO_SNDTIMEO" = yes; then
189 AC_DEFINE(HAVE_SO_SNDTIMEO,1,[Define if SO_SNDTIMEO is available. ])
194 dnl Find out how {awk,gawk,nawk,mawk} likes to assign variables, if it
195 dnl can do so at all.
196 AC_DEFUN([AMANDA_PROG_AWK_VAR],
198 AC_REQUIRE([AC_PROG_AWK])
200 [for $AWK command line variable assignment],
201 amanda_cv_awk_var_assignment,
203 echo 'BEGIN{print i; exit}' > conftest.awk
204 result=`$AWK -f conftest.awk i=xx | wc -c`
205 if test "$result" -le 1; then
206 result=`$AWK -f conftest.awk -v i=xx | wc -c`
207 if test "$result" -le 1; then
208 amanda_cv_awk_var_assignment=no
210 amanda_cv_awk_var_assignment="yes with -v"
213 amanda_cv_awk_var_assignment="yes"
218 AWK_VAR_ASSIGNMENT_OPT=
219 case "$amanda_cv_awk_var_assignment" in
224 HAVE_AWK_WITH_VAR=yes
227 HAVE_AWK_WITH_VAR=yes
228 AWK_VAR_ASSIGNMENT_OPT=-v
231 AC_SUBST(AWK_VAR_ASSIGNMENT_OPT)
235 dnl Check for the one or two argument version of gettimeofday.
236 AC_DEFUN([AMANDA_FUNC_GETTIMEOFDAY_ARGS],
238 AC_REQUIRE([AC_HEADER_TIME])
240 [for gettimeofday number of arguments],
241 amanda_cv_gettimeofday_args,
245 #ifdef TIME_WITH_SYS_TIME
246 # include <sys/time.h>
249 # ifdef HAVE_SYS_TIME_H
250 # include <sys/time.h>
258 struct timezone zone;
259 gettimeofday(&val, &zone);
261 amanda_cv_gettimeofday_args=2,
262 amanda_cv_gettimeofday_args=1
266 if test "$amanda_cv_gettimeofday_args" = 2; then
267 AC_DEFINE(HAVE_TWO_ARG_GETTIMEOFDAY,1,[Define if gettimeofday takes two arguments. ])
274 dnl Check if the compiler understands volatile.
275 AC_DEFUN([AMANDA_C_VOLATILE],
278 [for working volatile],
279 amanda_cv_c_volatile,
283 volatile int aaa = 0;
285 amanda_cv_c_volatile=yes,
286 amanda_cv_c_volatile=no
290 if test $amanda_cv_c_volatile = no; then
291 AC_DEFINE(volatile, [],[Define to empty if the compiler does not support volatile. ])
297 dnl Check for if pid_t is a long, int, or short.
298 AC_DEFUN([AMANDA_TYPE_PID_T],
300 AC_REQUIRE([AC_TYPE_PID_T])
301 AC_CACHE_CHECK([for pid_t type], amanda_cv_pid_type,
303 amanda_cv_pid_type=unknown
304 if test "$ac_cv_type_pid_t" = no; then
305 amanda_cv_pid_type=int
307 for TEST_amanda_cv_pid_type in long short int; do
308 if test $amanda_cv_pid_type = unknown; then
309 AC_EGREP_CPP(typedef.*${TEST_amanda_cv_pid_type}.*pid_t,
311 #include <sys/types.h>
317 amanda_cv_pid_type=$TEST_amanda_cv_pid_type)
319 if test $amanda_cv_pid_type = unknown; then
320 AC_EGREP_CPP(ZZZZ.*${TEST_amanda_cv_pid_type},
322 #include <sys/types.h>
329 amanda_cv_pid_type=$TEST_amanda_cv_pid_type)
332 if test $amanda_cv_pid_type = unknown; then
333 amanda_cv_pid_type=int
337 case $amanda_cv_pid_type in
338 int) AC_DEFINE_UNQUOTED(PRINTF_PID_T,"%d",[Define to printf formatting string to print a PID. ]) ;;
339 long) AC_DEFINE_UNQUOTED(PRINTF_PID_T,"%ld") ;;
340 short) AC_DEFINE_UNQUOTED(PRINTF_PID_T,"%d") ;;
347 dnl ICE_CHECK_DECL (FUNCTION, HEADER-FILE...)
348 dnl If FUNCTION is available, define `HAVE_FUNCTION'. If it is declared
349 dnl in one of the headers named in the whitespace-separated list
350 dnl HEADER_FILE, define `HAVE_FUNCTION_DECL` (in all capitals).
352 AC_DEFUN([ICE_CHECK_DECL],
355 AC_CHECK_FUNCS($1, ice_have_$1=yes)
356 if test "${ice_have_$1}" = yes; then
357 AC_MSG_CHECKING(for $1 declaration in $2)
358 AC_CACHE_VAL(ice_cv_have_$1_decl,
360 ice_cv_have_$1_decl=no
362 ice_re_params='[a-zA-Z_][a-zA-Z0-9_]*'
363 ice_re_word='(^|[^a-zA-Z0-9_])'
366 # Check for ordinary declaration
367 AC_EGREP_HEADER([${ice_re_word}$1[ ]*\(], $header,
368 ice_cv_have_$1_decl=yes)
369 if test "$ice_cv_have_$1_decl" = yes; then
372 # Check for "fixed" declaration like "getpid _PARAMS((int))"
373 AC_EGREP_HEADER([${ice_re_word}$1[ ]*$ice_re_params\(\(], $header,
374 ice_cv_have_$1_decl=yes)
375 if test "$ice_cv_have_$1_decl" = yes; then
380 AC_MSG_RESULT($ice_cv_have_$1_decl)
381 if test "$ice_cv_have_$1_decl" = yes; then
382 AC_DEFINE_UNQUOTED([HAVE_]translit($1,[a-z],[A-Z])[_DECL],1,[Define if $1 is declared. ])
386 dnl Test for the presence of <sys/wait.h>, 'union wait', arg-type of 'wait()'.
387 dnl by T.E.Dickey" , Jim Spath <jspath@mail.bcpl.lib.md.us>
389 dnl FIXME: These tests should have been in autoconf 1.11!
391 dnl Note that we cannot simply grep for 'union wait' in the wait.h file,
392 dnl because some Posix systems turn this on only when a BSD variable is
393 dnl defined. Since I'm trying to do without special defines, I'll live
394 dnl with the default behavior of the include-file.
396 dnl I do _2_ compile checks, because we may have union-wait, but the
397 dnl prototype for 'wait()' may want an int.
399 dnl Don't use HAVE_UNION_WAIT, because the autoconf documentation implies
400 dnl that if we've got union-wait, we'll automatically use it.
402 dnl Garrett Wollman adds:
403 dnl The tests described above don't quite do the right thing,
404 dnl since some systems have hacks which allow `union wait' to
405 dnl still work even though `int' is preferred (and generates
406 dnl fewer warnings). Since all of these systems use prototypes,
407 dnl we can use the prototype of wait(2) to disambiguate them.
409 dnl Alexandre Oliva adds:
410 dnl A single compile check is enough. If we don't have union wait,
411 dnl it's obvious that the test will fail, and that we must use int.
412 dnl If we do, the prototype (on STDC systems) and WIFEXITED will tell
413 dnl whether we're supposed to be using union wait instead of int.
417 AC_REQUIRE([AC_TYPE_PID_T])
418 AC_HAVE_HEADERS(sys/wait.h wait.h)
419 AC_CACHE_CHECK([whether wait uses union wait], [cf_cv_arg_union_wait],
421 #include <sys/types.h>
424 # include <sys/wait.h>
432 pid_t wait(union wait *);
436 wait(&x); i = WIFEXITED(x)
437 ], [cf_cv_arg_union_wait=yes], [cf_cv_arg_union_wait=no])])
438 if test $cf_cv_arg_union_wait = yes; then
439 AC_DEFINE(WAIT_USES_UNION,1,[Defined if wait() puts the status in a union wait instead of int. ])
444 dnl @synopsis AX_CREATE_STDINT_H [( HEADER-TO-GENERATE [, HEDERS-TO-CHECK])]
446 dnl the "ISO C9X: 7.18 Integer types <stdint.h>" section requires the
447 dnl existence of an include file <stdint.h> that defines a set of
448 dnl typedefs, especially uint8_t,int32_t,uintptr_t.
449 dnl Many older installations will not provide this file, but some will
450 dnl have the very same definitions in <inttypes.h>. In other enviroments
451 dnl we can use the inet-types in <sys/types.h> which would define the
452 dnl typedefs int8_t and u_int8_t respectivly.
454 dnl This macros will create a local "_stdint.h" or the headerfile given as
455 dnl an argument. In many cases that file will just "#include <stdint.h>"
456 dnl or "#include <inttypes.h>", while in other environments it will provide
457 dnl the set of basic 'stdint's definitions/typedefs:
458 dnl int8_t,uint8_t,int16_t,uint16_t,int32_t,uint32_t,intptr_t,uintptr_t
459 dnl int_least32_t.. int_fast32_t.. intmax_t
460 dnl which may or may not rely on the definitions of other files,
461 dnl or using the AC_CHECK_SIZEOF macro to determine the actual
462 dnl sizeof each type.
464 dnl if your header files require the stdint-types you will want to create an
465 dnl installable file mylib-int.h that all your other installable header
466 dnl may include. So if you have a library package named "mylib", just use
467 dnl AX_CREATE_STDINT_H(mylib-int.h)
468 dnl in configure.ac and go to install that very header file in Makefile.am
469 dnl along with the other headers (mylib.h) - and the mylib-specific headers
470 dnl can simply use "#include <mylib-int.h>" to obtain the stdint-types.
472 dnl Remember, if the system already had a valid <stdint.h>, the generated
473 dnl file will include it directly. No need for fuzzy HAVE_STDINT_H things...
475 dnl @, (status: used on new platforms) (see http://ac-archive.sf.net/gstdint/)
476 dnl @version $Id: acinclude.m4i,v 1.1.2.5.6.2 2004/04/29 20:47:40 martinea Exp $
477 dnl @author Guido Draheim <guidod@gmx.de>
479 AC_DEFUN([AX_CREATE_STDINT_H],
480 [# ------ AX CREATE STDINT H -------------------------------------
481 AC_MSG_CHECKING([for stdint types])
482 ac_stdint_h=`echo ifelse($1, , _stdint.h, $1)`
483 # try to shortcircuit - if the default include path of the compiler
484 # can find a "stdint.h" header then we assume that all compilers can.
485 AC_CACHE_VAL([ac_cv_header_stdint_t],[
486 old_CXXFLAGS="$CXXFLAGS" ; CXXFLAGS=""
487 old_CPPFLAGS="$CPPFLAGS" ; CPPFLAGS=""
488 old_CFLAGS="$CFLAGS" ; CFLAGS=""
489 AC_TRY_COMPILE([#include <stdint.h>],[int_least32_t v = 0;],
490 [ac_cv_stdint_result="(assuming C99 compatible system)"
491 ac_cv_header_stdint_t="stdint.h"; ],
492 [ac_cv_header_stdint_t=""])
493 CXXFLAGS="$old_CXXFLAGS"
494 CPPFLAGS="$old_CPPFLAGS"
495 CFLAGS="$old_CFLAGS" ])
497 v="... $ac_cv_header_stdint_h"
498 if test "$ac_stdint_h" = "stdint.h" ; then
499 AC_MSG_RESULT([(are you sure you want them in ./stdint.h?)])
500 elif test "$ac_stdint_h" = "inttypes.h" ; then
501 AC_MSG_RESULT([(are you sure you want them in ./inttypes.h?)])
502 elif test "_$ac_cv_header_stdint_t" = "_" ; then
503 AC_MSG_RESULT([(putting them into $ac_stdint_h)$v])
505 ac_cv_header_stdint="$ac_cv_header_stdint_t"
506 AC_MSG_RESULT([$ac_cv_header_stdint (shortcircuit)])
509 if test "_$ac_cv_header_stdint_t" = "_" ; then # can not shortcircuit..
511 dnl .....intro message done, now do a few system checks.....
512 dnl btw, all CHECK_TYPE macros do automatically "DEFINE" a type, therefore
513 dnl we use the autoconf implementation detail _AC CHECK_TYPE_NEW instead
515 inttype_headers=`echo $2 | sed -e 's/,/ /g'`
517 ac_cv_stdint_result="(no helpful system typedefs seen)"
518 AC_CACHE_CHECK([for stdint uintptr_t], [ac_cv_header_stdint_x],[
519 ac_cv_header_stdint_x="" # the 1997 typedefs (inttypes.h)
520 AC_MSG_RESULT([(..)])
521 for i in stdint.h inttypes.h sys/inttypes.h $inttype_headers ; do
522 unset ac_cv_type_uintptr_t
523 unset ac_cv_type_uint64_t
524 _AC_CHECK_TYPE_NEW(uintptr_t,[ac_cv_header_stdint_x=$i],dnl
525 continue,[#include <$i>])
526 AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>])
527 ac_cv_stdint_result="(seen uintptr_t$and64 in $i)"
530 AC_MSG_CHECKING([for stdint uintptr_t])
533 if test "_$ac_cv_header_stdint_x" = "_" ; then
534 AC_CACHE_CHECK([for stdint uint32_t], [ac_cv_header_stdint_o],[
535 ac_cv_header_stdint_o="" # the 1995 typedefs (sys/inttypes.h)
536 AC_MSG_RESULT([(..)])
537 for i in inttypes.h sys/inttypes.h stdint.h $inttype_headers ; do
538 unset ac_cv_type_uint32_t
539 unset ac_cv_type_uint64_t
540 AC_CHECK_TYPE(uint32_t,[ac_cv_header_stdint_o=$i],dnl
541 continue,[#include <$i>])
542 AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>])
543 ac_cv_stdint_result="(seen uint32_t$and64 in $i)"
546 AC_MSG_CHECKING([for stdint uint32_t])
550 if test "_$ac_cv_header_stdint_x" = "_" ; then
551 if test "_$ac_cv_header_stdint_o" = "_" ; then
552 AC_CACHE_CHECK([for stdint u_int32_t], [ac_cv_header_stdint_u],[
553 ac_cv_header_stdint_u="" # the BSD typedefs (sys/types.h)
554 AC_MSG_RESULT([(..)])
555 for i in sys/types.h inttypes.h sys/inttypes.h $inttype_headers ; do
556 unset ac_cv_type_u_int32_t
557 unset ac_cv_type_u_int64_t
558 AC_CHECK_TYPE(u_int32_t,[ac_cv_header_stdint_u=$i],dnl
559 continue,[#include <$i>])
560 AC_CHECK_TYPE(u_int64_t,[and64="/u_int64_t"],[and64=""],[#include<$i>])
561 ac_cv_stdint_result="(seen u_int32_t$and64 in $i)"
564 AC_MSG_CHECKING([for stdint u_int32_t])
568 dnl if there was no good C99 header file, do some typedef checks...
569 if test "_$ac_cv_header_stdint_x" = "_" ; then
570 AC_MSG_CHECKING([for stdint datatype model])
571 AC_MSG_RESULT([(..)])
572 AC_CHECK_SIZEOF(char)
573 AC_CHECK_SIZEOF(short)
575 AC_CHECK_SIZEOF(long)
576 AC_CHECK_SIZEOF(void*)
577 ac_cv_stdint_char_model=""
578 ac_cv_stdint_char_model="$ac_cv_stdint_char_model$ac_cv_sizeof_char"
579 ac_cv_stdint_char_model="$ac_cv_stdint_char_model$ac_cv_sizeof_short"
580 ac_cv_stdint_char_model="$ac_cv_stdint_char_model$ac_cv_sizeof_int"
581 ac_cv_stdint_long_model=""
582 ac_cv_stdint_long_model="$ac_cv_stdint_long_model$ac_cv_sizeof_int"
583 ac_cv_stdint_long_model="$ac_cv_stdint_long_model$ac_cv_sizeof_long"
584 ac_cv_stdint_long_model="$ac_cv_stdint_long_model$ac_cv_sizeof_voidp"
585 name="$ac_cv_stdint_long_model"
586 case "$ac_cv_stdint_char_model/$ac_cv_stdint_long_model" in
587 122/242) name="$name, IP16 (standard 16bit machine)" ;;
588 122/244) name="$name, LP32 (standard 32bit mac/win)" ;;
589 122/*) name="$name (unusual int16 model)" ;;
590 124/444) name="$name, ILP32 (standard 32bit unixish)" ;;
591 124/488) name="$name, LP64 (standard 64bit unixish)" ;;
592 124/448) name="$name, LLP64 (unusual 64bit unixish)" ;;
593 124/*) name="$name (unusual int32 model)" ;;
594 128/888) name="$name, ILP64 (unusual 64bit numeric)" ;;
595 128/*) name="$name (unusual int64 model)" ;;
596 222/*|444/*) name="$name (unusual dsptype)" ;;
597 *) name="$name (very unusal model)" ;;
599 AC_MSG_RESULT([combined for stdint datatype model... $name])
602 if test "_$ac_cv_header_stdint_x" != "_" ; then
603 ac_cv_header_stdint="$ac_cv_header_stdint_x"
604 elif test "_$ac_cv_header_stdint_o" != "_" ; then
605 ac_cv_header_stdint="$ac_cv_header_stdint_o"
606 elif test "_$ac_cv_header_stdint_u" != "_" ; then
607 ac_cv_header_stdint="$ac_cv_header_stdint_u"
609 ac_cv_header_stdint="stddef.h"
612 AC_MSG_CHECKING([for extra inttypes in chosen header])
613 AC_MSG_RESULT([($ac_cv_header_stdint)])
614 dnl see if int_least and int_fast types are present in _this_ header.
615 unset ac_cv_type_int_least32_t
616 unset ac_cv_type_int_fast32_t
617 AC_CHECK_TYPE(int_least32_t,,,[#include <$ac_cv_header_stdint>])
618 AC_CHECK_TYPE(int_fast32_t,,,[#include<$ac_cv_header_stdint>])
619 AC_CHECK_TYPE(intmax_t,,,[#include <$ac_cv_header_stdint>])
621 fi # shortcircut to system "stdint.h"
622 # ------------------ PREPARE VARIABLES ------------------------------
623 if test "$GCC" = "yes" ; then
624 ac_cv_stdint_message="using gnu compiler "`$CC --version | head -1`
626 ac_cv_stdint_message="using $CC"
629 AC_MSG_RESULT([make use of $ac_cv_header_stdint in $ac_stdint_h dnl
630 $ac_cv_stdint_result])
632 # ----------------- DONE inttypes.h checks START header -------------
633 AC_CONFIG_COMMANDS([$ac_stdint_h],[
634 AC_MSG_NOTICE(creating $ac_stdint_h : $_ac_stdint_h)
635 ac_stdint=$tmp/_stdint.h
637 echo "#ifndef" $_ac_stdint_h >$ac_stdint
638 echo "#define" $_ac_stdint_h "1" >>$ac_stdint
639 echo "#ifndef" _GENERATED_STDINT_H >>$ac_stdint
640 echo "#define" _GENERATED_STDINT_H '"'$PACKAGE $VERSION'"' >>$ac_stdint
641 echo "/* generated $ac_cv_stdint_message */" >>$ac_stdint
642 if test "_$ac_cv_header_stdint_t" != "_" ; then
643 echo "#define _STDINT_HAVE_STDINT_H" "1" >>$ac_stdint
646 cat >>$ac_stdint <<STDINT_EOF
648 /* ................... shortcircuit part ........................... */
650 #if defined HAVE_STDINT_H || defined _STDINT_HAVE_STDINT_H
655 /* .................... configured part ............................ */
659 echo "/* whether we have a C99 compatible stdint header file */" >>$ac_stdint
660 if test "_$ac_cv_header_stdint_x" != "_" ; then
661 ac_header="$ac_cv_header_stdint_x"
662 echo "#define _STDINT_HEADER_INTPTR" '"'"$ac_header"'"' >>$ac_stdint
664 echo "/* #undef _STDINT_HEADER_INTPTR */" >>$ac_stdint
667 echo "/* whether we have a C96 compatible inttypes header file */" >>$ac_stdint
668 if test "_$ac_cv_header_stdint_o" != "_" ; then
669 ac_header="$ac_cv_header_stdint_o"
670 echo "#define _STDINT_HEADER_UINT32" '"'"$ac_header"'"' >>$ac_stdint
672 echo "/* #undef _STDINT_HEADER_UINT32 */" >>$ac_stdint
675 echo "/* whether we have a BSD compatible inet types header */" >>$ac_stdint
676 if test "_$ac_cv_header_stdint_u" != "_" ; then
677 ac_header="$ac_cv_header_stdint_u"
678 echo "#define _STDINT_HEADER_U_INT32" '"'"$ac_header"'"' >>$ac_stdint
680 echo "/* #undef _STDINT_HEADER_U_INT32 */" >>$ac_stdint
685 if test "_$ac_header" != "_" ; then if test "$ac_header" != "stddef.h" ; then
686 echo "#include <$ac_header>" >>$ac_stdint
690 echo "/* which 64bit typedef has been found */" >>$ac_stdint
691 if test "$ac_cv_type_uint64_t" = "yes" ; then
692 echo "#define _STDINT_HAVE_UINT64_T" "1" >>$ac_stdint
694 echo "/* #undef _STDINT_HAVE_UINT64_T */" >>$ac_stdint
696 if test "$ac_cv_type_u_int64_t" = "yes" ; then
697 echo "#define _STDINT_HAVE_U_INT64_T" "1" >>$ac_stdint
699 echo "/* #undef _STDINT_HAVE_U_INT64_T */" >>$ac_stdint
703 echo "/* which type model has been detected */" >>$ac_stdint
704 if test "_$ac_cv_stdint_char_model" != "_" ; then
705 echo "#define _STDINT_CHAR_MODEL" "$ac_cv_stdint_char_model" >>$ac_stdint
706 echo "#define _STDINT_LONG_MODEL" "$ac_cv_stdint_long_model" >>$ac_stdint
708 echo "/* #undef _STDINT_CHAR_MODEL // skipped */" >>$ac_stdint
709 echo "/* #undef _STDINT_LONG_MODEL // skipped */" >>$ac_stdint
713 echo "/* whether int_least types were detected */" >>$ac_stdint
714 if test "$ac_cv_type_int_least32_t" = "yes"; then
715 echo "#define _STDINT_HAVE_INT_LEAST32_T" "1" >>$ac_stdint
717 echo "/* #undef _STDINT_HAVE_INT_LEAST32_T */" >>$ac_stdint
719 echo "/* whether int_fast types were detected */" >>$ac_stdint
720 if test "$ac_cv_type_int_fast32_t" = "yes"; then
721 echo "#define _STDINT_HAVE_INT_FAST32_T" "1" >>$ac_stdint
723 echo "/* #undef _STDINT_HAVE_INT_FAST32_T */" >>$ac_stdint
725 echo "/* whether intmax_t type was detected */" >>$ac_stdint
726 if test "$ac_cv_type_intmax_t" = "yes"; then
727 echo "#define _STDINT_HAVE_INTMAX_T" "1" >>$ac_stdint
729 echo "/* #undef _STDINT_HAVE_INTMAX_T */" >>$ac_stdint
733 cat >>$ac_stdint <<STDINT_EOF
734 /* .................... detections part ............................ */
736 /* whether we need to define bitspecific types from compiler base types */
737 #ifndef _STDINT_HEADER_INTPTR
738 #ifndef _STDINT_HEADER_UINT32
739 #ifndef _STDINT_HEADER_U_INT32
740 #define _STDINT_NEED_INT_MODEL_T
742 #define _STDINT_HAVE_U_INT_TYPES
747 #ifdef _STDINT_HAVE_U_INT_TYPES
748 #undef _STDINT_NEED_INT_MODEL_T
751 #ifdef _STDINT_CHAR_MODEL
752 #if _STDINT_CHAR_MODEL+0 == 122 || _STDINT_CHAR_MODEL+0 == 124
753 #ifndef _STDINT_BYTE_MODEL
754 #define _STDINT_BYTE_MODEL 12
759 #ifndef _STDINT_HAVE_INT_LEAST32_T
760 #define _STDINT_NEED_INT_LEAST_T
763 #ifndef _STDINT_HAVE_INT_FAST32_T
764 #define _STDINT_NEED_INT_FAST_T
767 #ifndef _STDINT_HEADER_INTPTR
768 #define _STDINT_NEED_INTPTR_T
769 #ifndef _STDINT_HAVE_INTMAX_T
770 #define _STDINT_NEED_INTMAX_T
775 /* .................... definition part ............................ */
777 /* some system headers have good uint64_t */
778 #ifndef _HAVE_UINT64_T
779 #if defined _STDINT_HAVE_UINT64_T || defined HAVE_UINT64_T
780 #define _HAVE_UINT64_T
781 #elif defined _STDINT_HAVE_U_INT64_T || defined HAVE_U_INT64_T
782 #define _HAVE_UINT64_T
783 typedef u_int64_t uint64_t;
787 #ifndef _HAVE_UINT64_T
788 /* .. here are some common heuristics using compiler runtime specifics */
789 #if defined __STDC_VERSION__ && defined __STDC_VERSION__ >= 199901L
790 #define _HAVE_UINT64_T
791 typedef long long int64_t;
792 typedef unsigned long long uint64_t;
794 #elif !defined __STRICT_ANSI__
795 #if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__
796 #define _HAVE_UINT64_T
797 typedef __int64 int64_t;
798 typedef unsigned __int64 uint64_t;
800 #elif defined __GNUC__ || defined __MWERKS__ || defined __ELF__
801 /* note: all ELF-systems seem to have loff-support which needs 64-bit */
802 #if !defined _NO_LONGLONG
803 #define _HAVE_UINT64_T
804 typedef long long int64_t;
805 typedef unsigned long long uint64_t;
808 #elif defined __alpha || (defined __mips && defined _ABIN32)
809 #if !defined _NO_LONGLONG
810 typedef long int64_t;
811 typedef unsigned long uint64_t;
813 /* compiler/cpu type to define int64_t */
818 #if defined _STDINT_HAVE_U_INT_TYPES
819 /* int8_t int16_t int32_t defined by inet code, redeclare the u_intXX types */
820 typedef u_int8_t uint8_t;
821 typedef u_int16_t uint16_t;
822 typedef u_int32_t uint32_t;
824 /* glibc compatibility */
825 #ifndef __int8_t_defined
826 #define __int8_t_defined
830 #ifdef _STDINT_NEED_INT_MODEL_T
831 /* we must guess all the basic types. Apart from byte-adressable system, */
832 /* there a few 32-bit-only dsp-systems that we guard with BYTE_MODEL 8-} */
833 /* (btw, those nibble-addressable systems are way off, or so we assume) */
835 dnl /* have a look at "64bit and data size neutrality" at */
836 dnl /* http://unix.org/version2/whatsnew/login_64bit.html */
837 dnl /* (the shorthand "ILP" types always have a "P" part) */
839 #if defined _STDINT_BYTE_MODEL
840 #if _STDINT_LONG_MODEL+0 == 242
841 /* 2:4:2 = IP16 = a normal 16-bit system */
842 typedef unsigned char uint8_t;
843 typedef unsigned short uint16_t;
844 typedef unsigned long uint32_t;
845 #ifndef __int8_t_defined
846 #define __int8_t_defined
848 typedef short int16_t;
849 typedef long int32_t;
851 #elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL == 444
852 /* 2:4:4 = LP32 = a 32-bit system derived from a 16-bit */
853 /* 4:4:4 = ILP32 = a normal 32-bit system */
854 typedef unsigned char uint8_t;
855 typedef unsigned short uint16_t;
856 typedef unsigned int uint32_t;
857 #ifndef __int8_t_defined
858 #define __int8_t_defined
860 typedef short int16_t;
863 #elif _STDINT_LONG_MODEL+0 == 484 || _STDINT_LONG_MODEL+0 == 488
864 /* 4:8:4 = IP32 = a 32-bit system prepared for 64-bit */
865 /* 4:8:8 = LP64 = a normal 64-bit system */
866 typedef unsigned char uint8_t;
867 typedef unsigned short uint16_t;
868 typedef unsigned int uint32_t;
869 #ifndef __int8_t_defined
870 #define __int8_t_defined
872 typedef short int16_t;
875 /* this system has a "long" of 64bit */
876 #ifndef _HAVE_UINT64_T
877 #define _HAVE_UINT64_T
878 typedef unsigned long uint64_t;
879 typedef long int64_t;
881 #elif _STDINT_LONG_MODEL+0 == 448
882 /* LLP64 a 64-bit system derived from a 32-bit system */
883 typedef unsigned char uint8_t;
884 typedef unsigned short uint16_t;
885 typedef unsigned int uint32_t;
886 #ifndef __int8_t_defined
887 #define __int8_t_defined
889 typedef short int16_t;
892 /* assuming the system has a "long long" */
893 #ifndef _HAVE_UINT64_T
894 #define _HAVE_UINT64_T
895 typedef unsigned long long uint64_t;
896 typedef long long int64_t;
899 #define _STDINT_NO_INT32_T
902 #define _STDINT_NO_INT8_T
903 #define _STDINT_NO_INT32_T
908 * quote from SunOS-5.8 sys/inttypes.h:
909 * Use at your own risk. As of February 1996, the committee is squarely
910 * behind the fixed sized types; the "least" and "fast" types are still being
911 * discussed. The probability that the "fast" types may be removed before
912 * the standard is finalized is high enough that they are not currently
916 #if defined _STDINT_NEED_INT_LEAST_T
917 typedef int8_t int_least8_t;
918 typedef int16_t int_least16_t;
919 typedef int32_t int_least32_t;
920 #ifdef _HAVE_UINT64_T
921 typedef int64_t int_least64_t;
924 typedef uint8_t uint_least8_t;
925 typedef uint16_t uint_least16_t;
926 typedef uint32_t uint_least32_t;
927 #ifdef _HAVE_UINT64_T
928 typedef uint64_t uint_least64_t;
933 #if defined _STDINT_NEED_INT_FAST_T
934 typedef int8_t int_fast8_t;
935 typedef int int_fast16_t;
936 typedef int32_t int_fast32_t;
937 #ifdef _HAVE_UINT64_T
938 typedef int64_t int_fast64_t;
941 typedef uint8_t uint_fast8_t;
942 typedef unsigned uint_fast16_t;
943 typedef uint32_t uint_fast32_t;
944 #ifdef _HAVE_UINT64_T
945 typedef uint64_t uint_fast64_t;
950 #ifdef _STDINT_NEED_INTMAX_T
951 #ifdef _HAVE_UINT64_T
952 typedef int64_t intmax_t;
953 typedef uint64_t uintmax_t;
955 typedef long intmax_t;
956 typedef unsigned long uintmax_t;
960 #ifdef _STDINT_NEED_INTPTR_T
961 #ifndef __intptr_t_defined
962 #define __intptr_t_defined
963 /* we encourage using "long" to store pointer values, never use "int" ! */
964 #if _STDINT_LONG_MODEL+0 == 242 || _STDINT_LONG_MODEL+0 == 484
965 typedef unsinged int uintptr_t;
966 typedef int intptr_t;
967 #elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL+0 == 444
968 typedef unsigned long uintptr_t;
969 typedef long intptr_t;
970 #elif _STDINT_LONG_MODEL+0 == 448 && defined _HAVE_UINT64_T
971 typedef uint64_t uintptr_t;
972 typedef int64_t intptr_t;
973 #else /* matches typical system types ILP32 and LP64 - but not IP16 or LLP64 */
974 typedef unsigned long uintptr_t;
975 typedef long intptr_t;
986 if cmp -s $ac_stdint_h $ac_stdint 2>/dev/null; then
987 AC_MSG_NOTICE([$ac_stdint_h is unchanged])
989 ac_dir=`AS_DIRNAME(["$ac_stdint_h"])`
990 AS_MKDIR_P(["$ac_dir"])
992 mv $ac_stdint $ac_stdint_h
994 ],[# variables for create stdint.h replacement
997 ac_stdint_h="$ac_stdint_h"
998 _ac_stdint_h=AS_TR_CPP(_$PACKAGE-$ac_stdint_h)
999 ac_cv_stdint_message="$ac_cv_stdint_message"
1000 ac_cv_header_stdint_t="$ac_cv_header_stdint_t"
1001 ac_cv_header_stdint_x="$ac_cv_header_stdint_x"
1002 ac_cv_header_stdint_o="$ac_cv_header_stdint_o"
1003 ac_cv_header_stdint_u="$ac_cv_header_stdint_u"
1004 ac_cv_type_uint64_t="$ac_cv_type_uint64_t"
1005 ac_cv_type_u_int64_t="$ac_cv_type_u_int64_t"
1006 ac_cv_stdint_char_model="$ac_cv_stdint_char_model"
1007 ac_cv_stdint_long_model="$ac_cv_stdint_long_model"
1008 ac_cv_type_int_least32_t="$ac_cv_type_int_least32_t"
1009 ac_cv_type_int_fast32_t="$ac_cv_type_int_fast32_t"
1010 ac_cv_type_intmax_t="$ac_cv_type_intmax_t"