1
dnl Try to detect the type of the third arg to getsockname() et al
2
AC_DEFUN([LSH_TYPE_SOCKLEN_T],
3
[AH_TEMPLATE([socklen_t], [Length type used by getsockopt])
4
AC_CACHE_CHECK([for socklen_t in sys/socket.h], ac_cv_type_socklen_t,
5
[AC_EGREP_HEADER(socklen_t, sys/socket.h,
6
[ac_cv_type_socklen_t=yes], [ac_cv_type_socklen_t=no])])
7
if test $ac_cv_type_socklen_t = no; then
8
AC_MSG_CHECKING(for AIX)
15
AC_DEFINE(socklen_t, size_t)
18
AC_DEFINE(socklen_t, int)
23
dnl LSH_PATH_ADD(path-id, directory)
24
AC_DEFUN([LSH_PATH_ADD],
27
if test -d "$2/." ; then
28
ac_real_dir=`cd $2 && pwd`
29
if test -n "$ac_real_dir" ; then
31
for old in $1_REAL_DIRS ; do
33
if test x$ac_real_dir = x$old ; then
38
if test $ac_found = yes ; then
39
AC_MSG_RESULT(already added)
42
# LDFLAGS="$LDFLAGS -L $2"
43
$1_REAL_DIRS="$ac_real_dir [$]$1_REAL_DIRS"
44
$1_DIRS="$2 [$]$1_DIRS"
48
if test $ac_exists = no ; then
49
AC_MSG_RESULT(not found)
53
dnl LSH_RPATH_ADD(dir)
54
AC_DEFUN([LSH_RPATH_ADD], [LSH_PATH_ADD(RPATH_CANDIDATE, $1)])
56
dnl LSH_RPATH_INIT(candidates)
57
AC_DEFUN([LSH_RPATH_INIT],
58
[AC_MSG_CHECKING([for -R flag])
71
if test "$TCC" = "yes"; then
72
# tcc doesn't know about -R
79
RPATHFLAG="-Wl,-rpath,"
86
if test x$RPATHFLAG = x ; then
89
AC_MSG_RESULT([using $RPATHFLAG])
92
RPATH_CANDIDATE_REAL_DIRS=''
93
RPATH_CANDIDATE_DIRS=''
95
AC_MSG_RESULT([Searching for libraries])
102
dnl Try to execute a main program, and if it fails, try adding some
105
AC_DEFUN([LSH_RPATH_FIX],
106
[if test $cross_compiling = no -a "x$RPATHFLAG" != x ; then
108
AC_TRY_RUN([int main(int argc, char **argv) { return 0; }],
109
ac_success=yes, ac_success=no, :)
111
if test $ac_success = no ; then
112
AC_MSG_CHECKING([Running simple test program failed. Trying -R flags])
113
dnl echo RPATH_CANDIDATE_DIRS = $RPATH_CANDIDATE_DIRS
115
ac_rpath_save_LDFLAGS="$LDFLAGS"
116
for d in $RPATH_CANDIDATE_DIRS ; do
117
if test $ac_success = yes ; then
118
ac_remaining_dirs="$ac_remaining_dirs $d"
120
LDFLAGS="$RPATHFLAG$d $LDFLAGS"
121
dnl echo LDFLAGS = $LDFLAGS
122
AC_TRY_RUN([int main(int argc, char **argv) { return 0; }],
124
ac_rpath_save_LDFLAGS="$LDFLAGS"
125
AC_MSG_RESULT([adding $RPATHFLAG$d])
127
[ac_remaining_dirs="$ac_remaining_dirs $d"], :)
128
LDFLAGS="$ac_rpath_save_LDFLAGS"
131
RPATH_CANDIDATE_DIRS=$ac_remaining_dirs
133
if test $ac_success = no ; then
134
AC_MSG_RESULT(failed)
139
dnl Like AC_CHECK_LIB, but uses $KRB_LIBS rather than $LIBS.
140
dnl LSH_CHECK_KRB_LIB(LIBRARY, FUNCTION, [, ACTION-IF-FOUND [,
141
dnl ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
143
AC_DEFUN([LSH_CHECK_KRB_LIB],
144
[AC_CHECK_LIB([$1], [$2],
146
[[ac_tr_lib=HAVE_LIB`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
147
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
148
AC_DEFINE_UNQUOTED($ac_tr_lib)
149
KRB_LIBS="-l$1 $KRB_LIBS"
156
dnl LSH_LIB_ARGP(ACTION-IF-OK, ACTION-IF-BAD)
157
AC_DEFUN([LSH_LIB_ARGP],
158
[ ac_argp_save_LIBS="$LIBS"
159
ac_argp_save_LDFLAGS="$LDFLAGS"
161
# First check if we can link with argp.
162
AC_SEARCH_LIBS(argp_parse, argp,
164
AC_CACHE_CHECK([for working argp],
165
lsh_cv_lib_argp_works,
170
static const struct argp_option
173
{ NULL, 0, NULL, 0, NULL, 0 }
182
child_parser(int key, char *arg, struct argp_state *state)
184
struct child_state *input = (struct child_state *) state->input;
189
return ARGP_ERR_UNKNOWN;
198
const struct argp child_argp =
202
NULL, NULL, NULL, NULL, NULL
207
struct child_state child;
212
main_parser(int key, char *arg, struct argp_state *state)
214
struct main_state *input = (struct main_state *) state->input;
219
return ARGP_ERR_UNKNOWN;
221
state->child_inputs[0] = &input->child;
225
input->m = input->child.n;
232
static const struct argp_child
235
{ &child_argp, 0, "", 0 },
239
static const struct argp
241
{ options, main_parser,
248
int main(int argc, char **argv)
250
struct main_state input = { { 0 }, 0 };
251
char *v[2] = { "foo", NULL };
253
argp_parse(&main_argp, 1, v, 0, NULL, &input);
255
if ( (input.m == 1) && (input.child.n == 1) )
260
], lsh_cv_lib_argp_works=yes,
261
lsh_cv_lib_argp_works=no,
262
lsh_cv_lib_argp_works=no)])
264
if test x$lsh_cv_lib_argp_works = xyes ; then
268
LIBS="$ac_argp_save_LIBS"
269
LDFLAGS="$ac_argp_save_LDFLAGS"
272
if test x$ac_argp_ok = xyes ; then
273
ifelse([$1],, true, [$1])
275
ifelse([$2],, true, [$2])
279
dnl LSH_GCC_ATTRIBUTES
280
dnl Check for gcc's __attribute__ construction
282
AC_DEFUN([LSH_GCC_ATTRIBUTES],
283
[AC_CACHE_CHECK(for __attribute__,
289
static void foo(void) __attribute__ ((noreturn));
291
static void __attribute__ ((noreturn))
297
lsh_cv_c_attribute=yes,
298
lsh_cv_c_attribute=no)])
300
AH_TEMPLATE([HAVE_GCC_ATTRIBUTE], [Define if the compiler understands __attribute__])
301
if test "x$lsh_cv_c_attribute" = "xyes"; then
302
AC_DEFINE(HAVE_GCC_ATTRIBUTE)
306
[#if __GNUC__ && HAVE_GCC_ATTRIBUTE
307
# define NORETURN __attribute__ ((__noreturn__))
308
# define PRINTF_STYLE(f, a) __attribute__ ((__format__ (__printf__, f, a)))
309
# define UNUSED __attribute__ ((__unused__))
312
# define PRINTF_STYLE(f, a)
317
AC_DEFUN([LSH_GCC_FUNCTION_NAME],
318
[# Check for gcc's __FUNCTION__ variable
319
AH_TEMPLATE([HAVE_GCC_FUNCTION],
320
[Define if the compiler understands __FUNCTION__])
322
[#if HAVE_GCC_FUNCTION
323
# define FUNCTION_NAME __FUNCTION__
325
# define FUNCTION_NAME "Unknown"
329
AC_CACHE_CHECK(for __FUNCTION__,
333
# error __FUNCTION__ is broken in gcc-3
335
void foo(void) { char c = __FUNCTION__[0]; } ],
336
lsh_cv_c_FUNCTION=yes,
337
lsh_cv_c_FUNCTION=no)])
339
if test "x$lsh_cv_c_FUNCTION" = "xyes"; then
340
AC_DEFINE(HAVE_GCC_FUNCTION)
344
# Check for alloca, and include the standard blurb in config.h
345
AC_DEFUN([LSH_FUNC_ALLOCA],
347
AC_CHECK_HEADERS([malloc.h])
349
[/* AIX requires this to be the first thing in the file. */
357
# ifndef alloca /* predefined by HP cc +Olibcalls */
362
#else /* defined __GNUC__ */
367
/* Needed for alloca on windows */
373
AC_DEFUN([LSH_FUNC_STRERROR],
374
[AC_CHECK_FUNCS(strerror)
377
#define STRERROR strerror
379
#define STRERROR(x) (sys_errlist[x])
383
AC_DEFUN([LSH_FUNC_STRSIGNAL],
384
[AC_CHECK_FUNCS(strsignal)
385
AC_CHECK_DECLS([sys_siglist, _sys_siglist])
388
# define STRSIGNAL strsignal
389
#else /* !HAVE_STRSIGNAL */
390
# if HAVE_DECL_SYS_SIGLIST
391
# define STRSIGNAL(x) (sys_siglist[x])
393
# if HAVE_DECL__SYS_SIGLIST
394
# define STRSIGNAL(x) (_sys_siglist[x])
396
# define STRSIGNAL(x) "Unknown signal"
398
# warning Using dummy STRSIGNAL
402
#endif /* !HAVE_STRSIGNAL */
405
dnl @synopsis AX_CREATE_STDINT_H [( HEADER-TO-GENERATE [, HEADERS-TO-CHECK])]
407
dnl the "ISO C9X: 7.18 Integer types <stdint.h>" section requires the
408
dnl existence of an include file <stdint.h> that defines a set of
409
dnl typedefs, especially uint8_t,int32_t,uintptr_t.
410
dnl Many older installations will not provide this file, but some will
411
dnl have the very same definitions in <inttypes.h>. In other enviroments
412
dnl we can use the inet-types in <sys/types.h> which would define the
413
dnl typedefs int8_t and u_int8_t respectivly.
415
dnl This macros will create a local "_stdint.h" or the headerfile given as
416
dnl an argument. In many cases that file will just "#include <stdint.h>"
417
dnl or "#include <inttypes.h>", while in other environments it will provide
418
dnl the set of basic 'stdint's definitions/typedefs:
419
dnl int8_t,uint8_t,int16_t,uint16_t,int32_t,uint32_t,intptr_t,uintptr_t
420
dnl int_least32_t.. int_fast32_t.. intmax_t
421
dnl which may or may not rely on the definitions of other files,
422
dnl or using the AC_CHECK_SIZEOF macro to determine the actual
423
dnl sizeof each type.
425
dnl if your header files require the stdint-types you will want to create an
426
dnl installable file mylib-int.h that all your other installable header
427
dnl may include. So if you have a library package named "mylib", just use
428
dnl AX_CREATE_STDINT_H(mylib-int.h)
429
dnl in configure.ac and go to install that very header file in Makefile.am
430
dnl along with the other headers (mylib.h) - and the mylib-specific headers
431
dnl can simply use "#include <mylib-int.h>" to obtain the stdint-types.
433
dnl Remember, if the system already had a valid <stdint.h>, the generated
434
dnl file will include it directly. No need for fuzzy HAVE_STDINT_H things...
436
dnl @, (status: used on new platforms) (see http://ac-archive.sf.net/gstdint/)
437
dnl @version $Id: acinclude.m4,v 1.19 2004/03/01 15:49:39 nisse Exp $
438
dnl @author Guido Draheim <guidod@gmx.de>
440
AC_DEFUN([AX_CREATE_STDINT_H],
441
[# ------ AX CREATE STDINT H -------------------------------------
442
AC_MSG_CHECKING([for stdint types])
443
ac_stdint_h=`echo ifelse($1, , _stdint.h, $1)`
444
# try to shortcircuit - if the default include path of the compiler
445
# can find a "stdint.h" header then we assume that all compilers can.
446
AC_CACHE_VAL([ac_cv_header_stdint_t],[
447
old_CXXFLAGS="$CXXFLAGS" ; CXXFLAGS=""
448
old_CPPFLAGS="$CPPFLAGS" ; CPPFLAGS=""
449
old_CFLAGS="$CFLAGS" ; CFLAGS=""
450
AC_TRY_COMPILE([#include <stdint.h>],[int_least32_t v = 0;],
451
[ac_cv_stdint_result="(assuming C99 compatible system)"
452
ac_cv_header_stdint_t="stdint.h"; ],
453
[ac_cv_header_stdint_t=""])
454
CXXFLAGS="$old_CXXFLAGS"
455
CPPFLAGS="$old_CPPFLAGS"
456
CFLAGS="$old_CFLAGS" ])
458
v="... $ac_cv_header_stdint_h"
459
if test "$ac_stdint_h" = "stdint.h" ; then
460
AC_MSG_RESULT([(are you sure you want them in ./stdint.h?)])
461
elif test "$ac_stdint_h" = "inttypes.h" ; then
462
AC_MSG_RESULT([(are you sure you want them in ./inttypes.h?)])
463
elif test "_$ac_cv_header_stdint_t" = "_" ; then
464
AC_MSG_RESULT([(putting them into $ac_stdint_h)$v])
466
ac_cv_header_stdint="$ac_cv_header_stdint_t"
467
AC_MSG_RESULT([$ac_cv_header_stdint (shortcircuit)])
470
if test "_$ac_cv_header_stdint_t" = "_" ; then # can not shortcircuit..
472
dnl .....intro message done, now do a few system checks.....
473
dnl btw, all CHECK_TYPE macros do automatically "DEFINE" a type, therefore
474
dnl we use the autoconf implementation detail _AC CHECK_TYPE_NEW instead
476
inttype_headers=`echo $2 | sed -e 's/,/ /g'`
478
ac_cv_stdint_result="(no helpful system typedefs seen)"
479
AC_CACHE_CHECK([for stdint uintptr_t], [ac_cv_header_stdint_x],[
480
ac_cv_header_stdint_x="" # the 1997 typedefs (inttypes.h)
481
AC_MSG_RESULT([(..)])
482
for i in stdint.h inttypes.h sys/inttypes.h $inttype_headers ; do
483
unset ac_cv_type_uintptr_t
484
unset ac_cv_type_uint64_t
485
_AC_CHECK_TYPE_NEW(uintptr_t,[ac_cv_header_stdint_x=$i],dnl
486
continue,[#include <$i>])
487
AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>])
488
ac_cv_stdint_result="(seen uintptr_t$and64 in $i)"
491
AC_MSG_CHECKING([for stdint uintptr_t])
494
if test "_$ac_cv_header_stdint_x" = "_" ; then
495
AC_CACHE_CHECK([for stdint uint32_t], [ac_cv_header_stdint_o],[
496
ac_cv_header_stdint_o="" # the 1995 typedefs (sys/inttypes.h)
497
AC_MSG_RESULT([(..)])
498
for i in inttypes.h sys/inttypes.h stdint.h $inttype_headers ; do
499
unset ac_cv_type_uint32_t
500
unset ac_cv_type_uint64_t
501
AC_CHECK_TYPE(uint32_t,[ac_cv_header_stdint_o=$i],dnl
502
continue,[#include <$i>])
503
AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>])
504
ac_cv_stdint_result="(seen uint32_t$and64 in $i)"
507
AC_MSG_CHECKING([for stdint uint32_t])
511
if test "_$ac_cv_header_stdint_x" = "_" ; then
512
if test "_$ac_cv_header_stdint_o" = "_" ; then
513
AC_CACHE_CHECK([for stdint u_int32_t], [ac_cv_header_stdint_u],[
514
ac_cv_header_stdint_u="" # the BSD typedefs (sys/types.h)
515
AC_MSG_RESULT([(..)])
516
for i in sys/types.h inttypes.h sys/inttypes.h $inttype_headers ; do
517
unset ac_cv_type_u_int32_t
518
unset ac_cv_type_u_int64_t
519
AC_CHECK_TYPE(u_int32_t,[ac_cv_header_stdint_u=$i],dnl
520
continue,[#include <$i>])
521
AC_CHECK_TYPE(u_int64_t,[and64="/u_int64_t"],[and64=""],[#include<$i>])
522
ac_cv_stdint_result="(seen u_int32_t$and64 in $i)"
525
AC_MSG_CHECKING([for stdint u_int32_t])
529
dnl if there was no good C99 header file, do some typedef checks...
530
if test "_$ac_cv_header_stdint_x" = "_" ; then
531
AC_MSG_CHECKING([for stdint datatype model])
532
AC_MSG_RESULT([(..)])
533
AC_CHECK_SIZEOF(char)
534
AC_CHECK_SIZEOF(short)
536
AC_CHECK_SIZEOF(long)
537
AC_CHECK_SIZEOF(void*)
538
ac_cv_stdint_char_model=""
539
ac_cv_stdint_char_model="$ac_cv_stdint_char_model$ac_cv_sizeof_char"
540
ac_cv_stdint_char_model="$ac_cv_stdint_char_model$ac_cv_sizeof_short"
541
ac_cv_stdint_char_model="$ac_cv_stdint_char_model$ac_cv_sizeof_int"
542
ac_cv_stdint_long_model=""
543
ac_cv_stdint_long_model="$ac_cv_stdint_long_model$ac_cv_sizeof_int"
544
ac_cv_stdint_long_model="$ac_cv_stdint_long_model$ac_cv_sizeof_long"
545
ac_cv_stdint_long_model="$ac_cv_stdint_long_model$ac_cv_sizeof_voidp"
546
name="$ac_cv_stdint_long_model"
547
case "$ac_cv_stdint_char_model/$ac_cv_stdint_long_model" in
548
122/242) name="$name, IP16 (standard 16bit machine)" ;;
549
122/244) name="$name, LP32 (standard 32bit mac/win)" ;;
550
122/*) name="$name (unusual int16 model)" ;;
551
124/444) name="$name, ILP32 (standard 32bit unixish)" ;;
552
124/488) name="$name, LP64 (standard 64bit unixish)" ;;
553
124/448) name="$name, LLP64 (unusual 64bit unixish)" ;;
554
124/*) name="$name (unusual int32 model)" ;;
555
128/888) name="$name, ILP64 (unusual 64bit numeric)" ;;
556
128/*) name="$name (unusual int64 model)" ;;
557
222/*|444/*) name="$name (unusual dsptype)" ;;
558
*) name="$name (very unusal model)" ;;
560
AC_MSG_RESULT([combined for stdint datatype model... $name])
563
if test "_$ac_cv_header_stdint_x" != "_" ; then
564
ac_cv_header_stdint="$ac_cv_header_stdint_x"
565
elif test "_$ac_cv_header_stdint_o" != "_" ; then
566
ac_cv_header_stdint="$ac_cv_header_stdint_o"
567
elif test "_$ac_cv_header_stdint_u" != "_" ; then
568
ac_cv_header_stdint="$ac_cv_header_stdint_u"
570
ac_cv_header_stdint="stddef.h"
573
AC_MSG_CHECKING([for extra inttypes in chosen header])
574
AC_MSG_RESULT([($ac_cv_header_stdint)])
575
dnl see if int_least and int_fast types are present in _this_ header.
576
unset ac_cv_type_int_least32_t
577
unset ac_cv_type_int_fast32_t
578
AC_CHECK_TYPE(int_least32_t,,,[#include <$ac_cv_header_stdint>])
579
AC_CHECK_TYPE(int_fast32_t,,,[#include<$ac_cv_header_stdint>])
580
AC_CHECK_TYPE(intmax_t,,,[#include <$ac_cv_header_stdint>])
582
fi # shortcircut to system "stdint.h"
583
# ------------------ PREPARE VARIABLES ------------------------------
584
if test "$GCC" = "yes" ; then
585
ac_cv_stdint_message="using gnu compiler "`$CC --version | head -1`
587
ac_cv_stdint_message="using $CC"
590
AC_MSG_RESULT([make use of $ac_cv_header_stdint in $ac_stdint_h dnl
591
$ac_cv_stdint_result])
593
# ----------------- DONE inttypes.h checks START header -------------
594
AC_CONFIG_COMMANDS([$ac_stdint_h],[
595
AC_MSG_NOTICE(creating $ac_stdint_h : $_ac_stdint_h)
596
ac_stdint=$tmp/_stdint.h
598
echo "#ifndef" $_ac_stdint_h >$ac_stdint
599
echo "#define" $_ac_stdint_h "1" >>$ac_stdint
600
echo "#ifndef" _GENERATED_STDINT_H >>$ac_stdint
601
echo "#define" _GENERATED_STDINT_H '"'$PACKAGE $VERSION'"' >>$ac_stdint
602
echo "/* generated $ac_cv_stdint_message */" >>$ac_stdint
603
if test "_$ac_cv_header_stdint_t" != "_" ; then
604
echo "#define _STDINT_HAVE_STDINT_H" "1" >>$ac_stdint
607
cat >>$ac_stdint <<STDINT_EOF
609
/* ................... shortcircuit part ........................... */
611
#if defined HAVE_STDINT_H || defined _STDINT_HAVE_STDINT_H
616
/* .................... configured part ............................ */
620
echo "/* whether we have a C99 compatible stdint header file */" >>$ac_stdint
621
if test "_$ac_cv_header_stdint_x" != "_" ; then
622
ac_header="$ac_cv_header_stdint_x"
623
echo "#define _STDINT_HEADER_INTPTR" '"'"$ac_header"'"' >>$ac_stdint
625
echo "/* #undef _STDINT_HEADER_INTPTR */" >>$ac_stdint
628
echo "/* whether we have a C96 compatible inttypes header file */" >>$ac_stdint
629
if test "_$ac_cv_header_stdint_o" != "_" ; then
630
ac_header="$ac_cv_header_stdint_o"
631
echo "#define _STDINT_HEADER_UINT32" '"'"$ac_header"'"' >>$ac_stdint
633
echo "/* #undef _STDINT_HEADER_UINT32 */" >>$ac_stdint
636
echo "/* whether we have a BSD compatible inet types header */" >>$ac_stdint
637
if test "_$ac_cv_header_stdint_u" != "_" ; then
638
ac_header="$ac_cv_header_stdint_u"
639
echo "#define _STDINT_HEADER_U_INT32" '"'"$ac_header"'"' >>$ac_stdint
641
echo "/* #undef _STDINT_HEADER_U_INT32 */" >>$ac_stdint
646
if test "_$ac_header" != "_" ; then if test "$ac_header" != "stddef.h" ; then
647
echo "#include <$ac_header>" >>$ac_stdint
651
echo "/* which 64bit typedef has been found */" >>$ac_stdint
652
if test "$ac_cv_type_uint64_t" = "yes" ; then
653
echo "#define _STDINT_HAVE_UINT64_T" "1" >>$ac_stdint
655
echo "/* #undef _STDINT_HAVE_UINT64_T */" >>$ac_stdint
657
if test "$ac_cv_type_u_int64_t" = "yes" ; then
658
echo "#define _STDINT_HAVE_U_INT64_T" "1" >>$ac_stdint
660
echo "/* #undef _STDINT_HAVE_U_INT64_T */" >>$ac_stdint
664
echo "/* which type model has been detected */" >>$ac_stdint
665
if test "_$ac_cv_stdint_char_model" != "_" ; then
666
echo "#define _STDINT_CHAR_MODEL" "$ac_cv_stdint_char_model" >>$ac_stdint
667
echo "#define _STDINT_LONG_MODEL" "$ac_cv_stdint_long_model" >>$ac_stdint
669
echo "/* #undef _STDINT_CHAR_MODEL // skipped */" >>$ac_stdint
670
echo "/* #undef _STDINT_LONG_MODEL // skipped */" >>$ac_stdint
674
echo "/* whether int_least types were detected */" >>$ac_stdint
675
if test "$ac_cv_type_int_least32_t" = "yes"; then
676
echo "#define _STDINT_HAVE_INT_LEAST32_T" "1" >>$ac_stdint
678
echo "/* #undef _STDINT_HAVE_INT_LEAST32_T */" >>$ac_stdint
680
echo "/* whether int_fast types were detected */" >>$ac_stdint
681
if test "$ac_cv_type_int_fast32_t" = "yes"; then
682
echo "#define _STDINT_HAVE_INT_FAST32_T" "1" >>$ac_stdint
684
echo "/* #undef _STDINT_HAVE_INT_FAST32_T */" >>$ac_stdint
686
echo "/* whether intmax_t type was detected */" >>$ac_stdint
687
if test "$ac_cv_type_intmax_t" = "yes"; then
688
echo "#define _STDINT_HAVE_INTMAX_T" "1" >>$ac_stdint
690
echo "/* #undef _STDINT_HAVE_INTMAX_T */" >>$ac_stdint
694
cat >>$ac_stdint <<STDINT_EOF
695
/* .................... detections part ............................ */
697
/* whether we need to define bitspecific types from compiler base types */
698
#ifndef _STDINT_HEADER_INTPTR
699
#ifndef _STDINT_HEADER_UINT32
700
#ifndef _STDINT_HEADER_U_INT32
701
#define _STDINT_NEED_INT_MODEL_T
703
#define _STDINT_HAVE_U_INT_TYPES
708
#ifdef _STDINT_HAVE_U_INT_TYPES
709
#undef _STDINT_NEED_INT_MODEL_T
712
#ifdef _STDINT_CHAR_MODEL
713
#if _STDINT_CHAR_MODEL+0 == 122 || _STDINT_CHAR_MODEL+0 == 124
714
#ifndef _STDINT_BYTE_MODEL
715
#define _STDINT_BYTE_MODEL 12
720
#ifndef _STDINT_HAVE_INT_LEAST32_T
721
#define _STDINT_NEED_INT_LEAST_T
724
#ifndef _STDINT_HAVE_INT_FAST32_T
725
#define _STDINT_NEED_INT_FAST_T
728
#ifndef _STDINT_HEADER_INTPTR
729
#define _STDINT_NEED_INTPTR_T
730
#ifndef _STDINT_HAVE_INTMAX_T
731
#define _STDINT_NEED_INTMAX_T
736
/* .................... definition part ............................ */
738
/* some system headers have good uint64_t */
739
#ifndef _HAVE_UINT64_T
740
#if defined _STDINT_HAVE_UINT64_T || defined HAVE_UINT64_T
741
#define _HAVE_UINT64_T
742
#elif defined _STDINT_HAVE_U_INT64_T || defined HAVE_U_INT64_T
743
#define _HAVE_UINT64_T
744
typedef u_int64_t uint64_t;
748
#ifndef _HAVE_UINT64_T
749
/* .. here are some common heuristics using compiler runtime specifics */
750
#if defined __STDC_VERSION__ && defined __STDC_VERSION__ >= 199901L
751
#define _HAVE_UINT64_T
752
typedef long long int64_t;
753
typedef unsigned long long uint64_t;
755
#elif !defined __STRICT_ANSI__
756
#if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__
757
#define _HAVE_UINT64_T
758
typedef __int64 int64_t;
759
typedef unsigned __int64 uint64_t;
761
#elif defined __GNUC__ || defined __MWERKS__ || defined __ELF__
762
/* note: all ELF-systems seem to have loff-support which needs 64-bit */
763
#if !defined _NO_LONGLONG
764
#define _HAVE_UINT64_T
765
typedef long long int64_t;
766
typedef unsigned long long uint64_t;
769
#elif defined __alpha || (defined __mips && defined _ABIN32)
770
#if !defined _NO_LONGLONG
771
typedef long int64_t;
772
typedef unsigned long uint64_t;
774
/* compiler/cpu type to define int64_t */
779
#if defined _STDINT_HAVE_U_INT_TYPES
780
/* int8_t int16_t int32_t defined by inet code, redeclare the u_intXX types */
781
typedef u_int8_t uint8_t;
782
typedef u_int16_t uint16_t;
783
typedef u_int32_t uint32_t;
785
/* glibc compatibility */
786
#ifndef __int8_t_defined
787
#define __int8_t_defined
791
#ifdef _STDINT_NEED_INT_MODEL_T
792
/* we must guess all the basic types. Apart from byte-adressable system, */
793
/* there a few 32-bit-only dsp-systems that we guard with BYTE_MODEL 8-} */
794
/* (btw, those nibble-addressable systems are way off, or so we assume) */
796
dnl /* have a look at "64bit and data size neutrality" at */
797
dnl /* http://unix.org/version2/whatsnew/login_64bit.html */
798
dnl /* (the shorthand "ILP" types always have a "P" part) */
800
#if defined _STDINT_BYTE_MODEL
801
#if _STDINT_LONG_MODEL+0 == 242
802
/* 2:4:2 = IP16 = a normal 16-bit system */
803
typedef unsigned char uint8_t;
804
typedef unsigned short uint16_t;
805
typedef unsigned long uint32_t;
806
#ifndef __int8_t_defined
807
#define __int8_t_defined
809
typedef short int16_t;
810
typedef long int32_t;
812
#elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL == 444
813
/* 2:4:4 = LP32 = a 32-bit system derived from a 16-bit */
814
/* 4:4:4 = ILP32 = a normal 32-bit system */
815
typedef unsigned char uint8_t;
816
typedef unsigned short uint16_t;
817
typedef unsigned int uint32_t;
818
#ifndef __int8_t_defined
819
#define __int8_t_defined
821
typedef short int16_t;
824
#elif _STDINT_LONG_MODEL+0 == 484 || _STDINT_LONG_MODEL+0 == 488
825
/* 4:8:4 = IP32 = a 32-bit system prepared for 64-bit */
826
/* 4:8:8 = LP64 = a normal 64-bit system */
827
typedef unsigned char uint8_t;
828
typedef unsigned short uint16_t;
829
typedef unsigned int uint32_t;
830
#ifndef __int8_t_defined
831
#define __int8_t_defined
833
typedef short int16_t;
836
/* this system has a "long" of 64bit */
837
#ifndef _HAVE_UINT64_T
838
#define _HAVE_UINT64_T
839
typedef unsigned long uint64_t;
840
typedef long int64_t;
842
#elif _STDINT_LONG_MODEL+0 == 448
843
/* LLP64 a 64-bit system derived from a 32-bit system */
844
typedef unsigned char uint8_t;
845
typedef unsigned short uint16_t;
846
typedef unsigned int uint32_t;
847
#ifndef __int8_t_defined
848
#define __int8_t_defined
850
typedef short int16_t;
853
/* assuming the system has a "long long" */
854
#ifndef _HAVE_UINT64_T
855
#define _HAVE_UINT64_T
856
typedef unsigned long long uint64_t;
857
typedef long long int64_t;
860
#define _STDINT_NO_INT32_T
863
#define _STDINT_NO_INT8_T
864
#define _STDINT_NO_INT32_T
869
* quote from SunOS-5.8 sys/inttypes.h:
870
* Use at your own risk. As of February 1996, the committee is squarely
871
* behind the fixed sized types; the "least" and "fast" types are still being
872
* discussed. The probability that the "fast" types may be removed before
873
* the standard is finalized is high enough that they are not currently
877
#if defined _STDINT_NEED_INT_LEAST_T
878
typedef int8_t int_least8_t;
879
typedef int16_t int_least16_t;
880
typedef int32_t int_least32_t;
881
#ifdef _HAVE_UINT64_T
882
typedef int64_t int_least64_t;
885
typedef uint8_t uint_least8_t;
886
typedef uint16_t uint_least16_t;
887
typedef uint32_t uint_least32_t;
888
#ifdef _HAVE_UINT64_T
889
typedef uint64_t uint_least64_t;
894
#if defined _STDINT_NEED_INT_FAST_T
895
typedef int8_t int_fast8_t;
896
typedef int int_fast16_t;
897
typedef int32_t int_fast32_t;
898
#ifdef _HAVE_UINT64_T
899
typedef int64_t int_fast64_t;
902
typedef uint8_t uint_fast8_t;
903
typedef unsigned uint_fast16_t;
904
typedef uint32_t uint_fast32_t;
905
#ifdef _HAVE_UINT64_T
906
typedef uint64_t uint_fast64_t;
911
#ifdef _STDINT_NEED_INTMAX_T
912
#ifdef _HAVE_UINT64_T
913
typedef int64_t intmax_t;
914
typedef uint64_t uintmax_t;
916
typedef long intmax_t;
917
typedef unsigned long uintmax_t;
921
#ifdef _STDINT_NEED_INTPTR_T
922
#ifndef __intptr_t_defined
923
#define __intptr_t_defined
924
/* we encourage using "long" to store pointer values, never use "int" ! */
925
#if _STDINT_LONG_MODEL+0 == 242 || _STDINT_LONG_MODEL+0 == 484
926
typedef unsinged int uintptr_t;
927
typedef int intptr_t;
928
#elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL+0 == 444
929
typedef unsigned long uintptr_t;
930
typedef long intptr_t;
931
#elif _STDINT_LONG_MODEL+0 == 448 && defined _HAVE_UINT64_T
932
typedef uint64_t uintptr_t;
933
typedef int64_t intptr_t;
934
#else /* matches typical system types ILP32 and LP64 - but not IP16 or LLP64 */
935
typedef unsigned long uintptr_t;
936
typedef long intptr_t;
947
if cmp -s $ac_stdint_h $ac_stdint 2>/dev/null; then
948
AC_MSG_NOTICE([$ac_stdint_h is unchanged])
950
ac_dir=`AS_DIRNAME(["$ac_stdint_h"])`
951
AS_MKDIR_P(["$ac_dir"])
953
mv $ac_stdint $ac_stdint_h
955
],[# variables for create stdint.h replacement
958
ac_stdint_h="$ac_stdint_h"
959
_ac_stdint_h=AS_TR_CPP(_$PACKAGE-$ac_stdint_h)
960
ac_cv_stdint_message="$ac_cv_stdint_message"
961
ac_cv_header_stdint_t="$ac_cv_header_stdint_t"
962
ac_cv_header_stdint_x="$ac_cv_header_stdint_x"
963
ac_cv_header_stdint_o="$ac_cv_header_stdint_o"
964
ac_cv_header_stdint_u="$ac_cv_header_stdint_u"
965
ac_cv_type_uint64_t="$ac_cv_type_uint64_t"
966
ac_cv_type_u_int64_t="$ac_cv_type_u_int64_t"
967
ac_cv_stdint_char_model="$ac_cv_stdint_char_model"
968
ac_cv_stdint_long_model="$ac_cv_stdint_long_model"
969
ac_cv_type_int_least32_t="$ac_cv_type_int_least32_t"
970
ac_cv_type_int_fast32_t="$ac_cv_type_int_fast32_t"
971
ac_cv_type_intmax_t="$ac_cv_type_intmax_t"