diff options
author | Paolo Bonzini <bonzini@gnu.org> | 2009-09-09 19:46:42 +0000 |
---|---|---|
committer | Paolo Bonzini <bonzini@gnu.org> | 2009-09-09 19:46:42 +0000 |
commit | f3b4f6d02487afe84460c2d5a9601ee3914a0d61 (patch) | |
tree | ea0d594e907ac95da72558c878bd89ee155258b3 | |
parent | 67d74e430ea9b97d9c0f09f48473a7fe81010d08 (diff) | |
download | gdb-f3b4f6d02487afe84460c2d5a9601ee3914a0d61.zip gdb-f3b4f6d02487afe84460c2d5a9601ee3914a0d61.tar.gz gdb-f3b4f6d02487afe84460c2d5a9601ee3914a0d61.tar.bz2 |
config:
2009-09-09 Paolo Bonzini <bonzini@gnu.org>
* stdint.m4 (GCC_HEADER_STDINT): Revert changes to this macro in
the previous two patches.
bfd:
2009-09-09 Paolo Bonzini <bonzini@gnu.org>
* configure: Regenerate.
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rwxr-xr-x | bfd/configure | 1103 | ||||
-rw-r--r-- | config/ChangeLog | 5 | ||||
-rw-r--r-- | config/stdint.m4 | 513 |
4 files changed, 1126 insertions, 501 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 7453dcc..4bac3b0 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,7 @@ +2009-09-09 Paolo Bonzini <bonzini@gnu.org> + + * configure: Regenerate. + 2009-09-09 Daniel Jacobowitz <dan@codesourcery.com> * elf32-arm.c (elf32_arm_final_link_relocate): Set sym_flags @@ -7,7 +11,7 @@ 2009-09-09 Paolo Bonzini <bonzini@gnu.org> - * configure: Regnerate. + * configure: Regenerate. 2009-09-09 Nick Clifton <nickc@redhat.com> diff --git a/bfd/configure b/bfd/configure index fbd7c86..865ef69 100755 --- a/bfd/configure +++ b/bfd/configure @@ -2212,77 +2212,6 @@ rm -f conftest.val } # ac_fn_c_compute_int -# ac_fn_c_find_intX_t LINENO BITS VAR -# ----------------------------------- -# Finds a signed integer type with width BITS, setting cache variable VAR -# accordingly. -ac_fn_c_find_intX_t () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 -$as_echo_n "checking for int$2_t... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - for ac_type in int$2_t 'int' 'long int' \ - 'long long int' 'short int' 'signed char'; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(0 < ($ac_type) (((($ac_type) 1 << ($2 - 2)) - 1) * 2 + 1))]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(($ac_type) (((($ac_type) 1 << ($2 - 2)) - 1) * 2 + 1) - < ($ac_type) (((($ac_type) 1 << ($2 - 2)) - 1) * 2 + 2))]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - case $ac_type in #( - int$2_t) : - eval "$3=yes" ;; #( - *) : - eval "$3=\$ac_type" ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - eval as_val=\$$3 - if test "x$as_val" = x""no; then : - -else - break -fi - done -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_find_intX_t - # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache @@ -2337,58 +2266,6 @@ $as_echo "$ac_res" >&6; } } # ac_fn_c_check_type -# ac_fn_c_find_uintX_t LINENO BITS VAR -# ------------------------------------ -# Finds an unsigned integer type with width BITS, setting cache variable VAR -# accordingly. -ac_fn_c_find_uintX_t () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 -$as_echo_n "checking for uint$2_t... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ - 'unsigned long long int' 'unsigned short int' 'unsigned char'; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(($ac_type) -1 >> ($2 - 1) == 1)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - case $ac_type in #( - uint$2_t) : - eval "$3=yes" ;; #( - *) : - eval "$3=\$ac_type" ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - eval as_val=\$$3 - if test "x$as_val" = x""no; then : - -else - break -fi - done -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_find_uintX_t - # ac_fn_c_check_decl LINENO SYMBOL VAR # ------------------------------------ # Tests whether SYMBOL is declared, setting cache variable VAR accordingly. @@ -6105,13 +5982,13 @@ if test "${lt_cv_nm_interface+set}" = set; then : else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:6108: $ac_compile\"" >&5) + (eval echo "\"\$as_me:5985: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:6111: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:5988: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:6114: output\"" >&5) + (eval echo "\"\$as_me:5991: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -7316,7 +7193,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 7319 "configure"' > conftest.$ac_ext + echo '#line 7196 "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -8547,11 +8424,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8550: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8427: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8554: \$? = $ac_status" >&5 + echo "$as_me:8431: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -8886,11 +8763,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8889: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8766: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8893: \$? = $ac_status" >&5 + echo "$as_me:8770: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -8991,11 +8868,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8994: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8871: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:8998: \$? = $ac_status" >&5 + echo "$as_me:8875: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -9046,11 +8923,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9049: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8926: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:9053: \$? = $ac_status" >&5 + echo "$as_me:8930: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -11428,7 +11305,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11431 "configure" +#line 11308 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11524,7 +11401,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11527 "configure" +#line 11404 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12881,408 +12758,412 @@ fi done -ac_fn_c_find_intX_t "$LINENO" "8" "ac_cv_c_int8_t" -case $ac_cv_c_int8_t in #( - no|yes) ;; #( - *) - -cat >>confdefs.h <<_ACEOF -#define int8_t $ac_cv_c_int8_t -_ACEOF -;; -esac - -ac_fn_c_find_intX_t "$LINENO" "16" "ac_cv_c_int16_t" -case $ac_cv_c_int16_t in #( - no|yes) ;; #( - *) - -cat >>confdefs.h <<_ACEOF -#define int16_t $ac_cv_c_int16_t -_ACEOF -;; -esac - -ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t" -case $ac_cv_c_int32_t in #( - no|yes) ;; #( - *) - -cat >>confdefs.h <<_ACEOF -#define int32_t $ac_cv_c_int32_t -_ACEOF -;; -esac - -ac_fn_c_find_intX_t "$LINENO" "64" "ac_cv_c_int64_t" -case $ac_cv_c_int64_t in #( - no|yes) ;; #( - *) -cat >>confdefs.h <<_ACEOF -#define int64_t $ac_cv_c_int64_t -_ACEOF -;; -esac +inttype_headers=`echo inttypes.h sys/inttypes.h | sed -e 's/,/ /g'` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for long long int" >&5 -$as_echo_n "checking for long long int... " >&6; } -if test "${ac_cv_type_long_long_int+set}" = set; then : - $as_echo_n "(cached) " >&6 +acx_cv_header_stdint=stddef.h +acx_cv_header_stdint_kind="(already complete)" +for i in stdint.h $inttype_headers; do + unset ac_cv_type_uintptr_t + unset ac_cv_type_uintmax_t + unset ac_cv_type_int_least32_t + unset ac_cv_type_int_fast32_t + unset ac_cv_type_uint64_t + $as_echo_n "looking for a compliant stdint.h in $i, " >&6 + ac_fn_c_check_type "$LINENO" "uintmax_t" "ac_cv_type_uintmax_t" "#include <sys/types.h> +#include <$i> +" +if test "x$ac_cv_type_uintmax_t" = x""yes; then : + acx_cv_header_stdint=$i else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + continue +fi - /* For now, do not test the preprocessor; as of 2007 there are too many - implementations with broken preprocessors. Perhaps this can - be revisited in 2012. In the meantime, code should not expect - #if to work with literals wider than 32 bits. */ - /* Test literals. */ - long long int ll = 9223372036854775807ll; - long long int nll = -9223372036854775807LL; - unsigned long long int ull = 18446744073709551615ULL; - /* Test constant expressions. */ - typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) - ? 1 : -1)]; - typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 - ? 1 : -1)]; - int i = 63; -int -main () -{ -/* Test availability of runtime routines for shift and division. */ - long long int llmax = 9223372036854775807ll; - unsigned long long int ullmax = 18446744073709551615ull; - return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) - | (llmax / ll) | (llmax % ll) - | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) - | (ullmax / ull) | (ullmax % ull)); - ; - return 0; -} + ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "#include <sys/types.h> +#include <$i> +" +if test "x$ac_cv_type_uintptr_t" = x""yes; then : -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - if test "$cross_compiling" = yes; then : - ac_cv_type_long_long_int=yes else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <limits.h> - #ifndef LLONG_MAX - # define HALF \ - (1LL << (sizeof (long long int) * CHAR_BIT - 2)) - # define LLONG_MAX (HALF - 1 + HALF) - #endif -int -main () -{ -long long int n = 1; - int i; - for (i = 0; ; i++) - { - long long int m = n << i; - if (m >> i != n) - return 1; - if (LLONG_MAX / 2 < m) - break; - } - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_type_long_long_int=yes -else - ac_cv_type_long_long_int=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext + acx_cv_header_stdint_kind="(mostly complete)" fi + ac_fn_c_check_type "$LINENO" "int_least32_t" "ac_cv_type_int_least32_t" "#include <sys/types.h> +#include <$i> +" +if test "x$ac_cv_type_int_least32_t" = x""yes; then : + else - ac_cv_type_long_long_int=no + acx_cv_header_stdint_kind="(mostly complete)" fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_long_long_int" >&5 -$as_echo "$ac_cv_type_long_long_int" >&6; } - if test $ac_cv_type_long_long_int = yes; then - -$as_echo "#define HAVE_LONG_LONG_INT 1" >>confdefs.h - - fi - + ac_fn_c_check_type "$LINENO" "int_fast32_t" "ac_cv_type_int_fast32_t" "#include <sys/types.h> +#include <$i> +" +if test "x$ac_cv_type_int_fast32_t" = x""yes; then : - ac_fn_c_check_type "$LINENO" "intmax_t" "ac_cv_type_intmax_t" "$ac_includes_default" -if test "x$ac_cv_type_intmax_t" = x""yes; then : +else + acx_cv_header_stdint_kind="(mostly complete)" +fi -$as_echo "#define HAVE_INTMAX_T 1" >>confdefs.h + ac_fn_c_check_type "$LINENO" "uint64_t" "ac_cv_type_uint64_t" "#include <sys/types.h> +#include <$i> +" +if test "x$ac_cv_type_uint64_t" = x""yes; then : else - test $ac_cv_type_long_long_int = yes \ - && ac_type='long long int' \ - || ac_type='long int' - -cat >>confdefs.h <<_ACEOF -#define intmax_t $ac_type -_ACEOF + acx_cv_header_stdint_kind="(lacks uint64_t)" +fi + break +done +if test "$acx_cv_header_stdint" = stddef.h; then + acx_cv_header_stdint_kind="(lacks uintmax_t)" + for i in stdint.h $inttype_headers; do + unset ac_cv_type_uintptr_t + unset ac_cv_type_uint32_t + unset ac_cv_type_uint64_t + $as_echo_n "looking for an incomplete stdint.h in $i, " >&6 + ac_fn_c_check_type "$LINENO" "uint32_t" "ac_cv_type_uint32_t" "#include <sys/types.h> +#include <$i> +" +if test "x$ac_cv_type_uint32_t" = x""yes; then : + acx_cv_header_stdint=$i +else + continue fi + ac_fn_c_check_type "$LINENO" "uint64_t" "ac_cv_type_uint64_t" "#include <sys/types.h> +#include <$i> +" +if test "x$ac_cv_type_uint64_t" = x""yes; then : +fi - ac_fn_c_check_type "$LINENO" "intptr_t" "ac_cv_type_intptr_t" "$ac_includes_default" -if test "x$ac_cv_type_intptr_t" = x""yes; then : + ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "#include <sys/types.h> +#include <$i> +" +if test "x$ac_cv_type_uintptr_t" = x""yes; then : -$as_echo "#define HAVE_INTPTR_T 1" >>confdefs.h +fi + break + done +fi +if test "$acx_cv_header_stdint" = stddef.h; then + acx_cv_header_stdint_kind="(u_intXX_t style)" + for i in sys/types.h $inttype_headers; do + unset ac_cv_type_u_int32_t + unset ac_cv_type_u_int64_t + $as_echo_n "looking for u_intXX_t types in $i, " >&6 + ac_fn_c_check_type "$LINENO" "u_int32_t" "ac_cv_type_u_int32_t" "#include <sys/types.h> +#include <$i> +" +if test "x$ac_cv_type_u_int32_t" = x""yes; then : + acx_cv_header_stdint=$i else - for ac_type in 'int' 'long int' 'long long int'; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($ac_type))]; -test_array [0] = 0 + continue +fi - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : + ac_fn_c_check_type "$LINENO" "u_int64_t" "ac_cv_type_u_int64_t" "#include <sys/types.h> +#include <$i> +" +if test "x$ac_cv_type_u_int64_t" = x""yes; then : -cat >>confdefs.h <<_ACEOF -#define intptr_t $ac_type -_ACEOF +fi - ac_type= + break + done fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test -z "$ac_type" && break - done +if test "$acx_cv_header_stdint" = stddef.h; then + acx_cv_header_stdint_kind="(using manual detection)" fi +test -z "$ac_cv_type_uintptr_t" && ac_cv_type_uintptr_t=no +test -z "$ac_cv_type_uint64_t" && ac_cv_type_uint64_t=no +test -z "$ac_cv_type_u_int64_t" && ac_cv_type_u_int64_t=no +test -z "$ac_cv_type_int_least32_t" && ac_cv_type_int_least32_t=no +test -z "$ac_cv_type_int_fast32_t" && ac_cv_type_int_fast32_t=no -ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t" -case $ac_cv_c_uint8_t in #( - no|yes) ;; #( - *) - -$as_echo "#define _UINT8_T 1" >>confdefs.h +# ----------------- Summarize what we found so far +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking what to include in bfd_stdint.h" >&5 +$as_echo_n "checking what to include in bfd_stdint.h... " >&6; } -cat >>confdefs.h <<_ACEOF -#define uint8_t $ac_cv_c_uint8_t -_ACEOF -;; - esac - -ac_fn_c_find_uintX_t "$LINENO" "16" "ac_cv_c_uint16_t" -case $ac_cv_c_uint16_t in #( - no|yes) ;; #( - *) - - -cat >>confdefs.h <<_ACEOF -#define uint16_t $ac_cv_c_uint16_t -_ACEOF -;; - esac +case `$as_basename -- bfd_stdint.h || +$as_expr X/bfd_stdint.h : '.*/\([^/][^/]*\)/*$' \| \ + Xbfd_stdint.h : 'X\(//\)$' \| \ + Xbfd_stdint.h : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/bfd_stdint.h | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` in + stdint.h) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: are you sure you want it there?" >&5 +$as_echo "$as_me: WARNING: are you sure you want it there?" >&2;} ;; + inttypes.h) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: are you sure you want it there?" >&5 +$as_echo "$as_me: WARNING: are you sure you want it there?" >&2;} ;; + *) ;; +esac -ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" -case $ac_cv_c_uint32_t in #( - no|yes) ;; #( - *) +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_header_stdint $acx_cv_header_stdint_kind" >&5 +$as_echo "$acx_cv_header_stdint $acx_cv_header_stdint_kind" >&6; } -$as_echo "#define _UINT32_T 1" >>confdefs.h +# ----------------- done included file, check C basic types -------- +# Lacking an uintptr_t? Test size of void * +case "$acx_cv_header_stdint:$ac_cv_type_uintptr_t" in + stddef.h:* | *:no) # The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5 +$as_echo_n "checking size of void *... " >&6; } +if test "${ac_cv_sizeof_void_p+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then : -cat >>confdefs.h <<_ACEOF -#define uint32_t $ac_cv_c_uint32_t -_ACEOF -;; - esac +else + if test "$ac_cv_type_void_p" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ as_fn_set_status 77 +as_fn_error "cannot compute sizeof (void *) +See \`config.log' for more details." "$LINENO" 5; }; } + else + ac_cv_sizeof_void_p=0 + fi +fi -ac_fn_c_find_uintX_t "$LINENO" "64" "ac_cv_c_uint64_t" -case $ac_cv_c_uint64_t in #( - no|yes) ;; #( - *) +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5 +$as_echo "$ac_cv_sizeof_void_p" >&6; } -$as_echo "#define _UINT64_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF -#define uint64_t $ac_cv_c_uint64_t +#define SIZEOF_VOID_P $ac_cv_sizeof_void_p _ACEOF -;; - esac + ;; +esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for unsigned long long int" >&5 -$as_echo_n "checking for unsigned long long int... " >&6; } -if test "${ac_cv_type_unsigned_long_long_int+set}" = set; then : +# Lacking an uint64_t? Test size of long +case "$acx_cv_header_stdint:$ac_cv_type_uint64_t:$ac_cv_type_u_int64_t" in + stddef.h:*:* | *:no:no) # The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 +$as_echo_n "checking size of long... " >&6; } +if test "${ac_cv_sizeof_long+set}" = set; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - /* For now, do not test the preprocessor; as of 2007 there are too many - implementations with broken preprocessors. Perhaps this can - be revisited in 2012. In the meantime, code should not expect - #if to work with literals wider than 32 bits. */ - /* Test literals. */ - long long int ll = 9223372036854775807ll; - long long int nll = -9223372036854775807LL; - unsigned long long int ull = 18446744073709551615ULL; - /* Test constant expressions. */ - typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) - ? 1 : -1)]; - typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 - ? 1 : -1)]; - int i = 63; -int -main () -{ -/* Test availability of runtime routines for shift and division. */ - long long int llmax = 9223372036854775807ll; - unsigned long long int ullmax = 18446744073709551615ull; - return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) - | (llmax / ll) | (llmax % ll) - | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) - | (ullmax / ull) | (ullmax % ull)); - ; - return 0; -} + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_type_unsigned_long_long_int=yes else - ac_cv_type_unsigned_long_long_int=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + if test "$ac_cv_type_long" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ as_fn_set_status 77 +as_fn_error "cannot compute sizeof (long) +See \`config.log' for more details." "$LINENO" 5; }; } + else + ac_cv_sizeof_long=0 + fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_unsigned_long_long_int" >&5 -$as_echo "$ac_cv_type_unsigned_long_long_int" >&6; } - if test $ac_cv_type_unsigned_long_long_int = yes; then -$as_echo "#define HAVE_UNSIGNED_LONG_LONG_INT 1" >>confdefs.h - - fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 +$as_echo "$ac_cv_sizeof_long" >&6; } - ac_fn_c_check_type "$LINENO" "uintmax_t" "ac_cv_type_uintmax_t" "$ac_includes_default" -if test "x$ac_cv_type_uintmax_t" = x""yes; then : +cat >>confdefs.h <<_ACEOF +#define SIZEOF_LONG $ac_cv_sizeof_long +_ACEOF -$as_echo "#define HAVE_UINTMAX_T 1" >>confdefs.h + ;; +esac +if test $acx_cv_header_stdint = stddef.h; then + # Lacking a good header? Test size of everything and deduce all types. + # The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 +$as_echo_n "checking size of int... " >&6; } +if test "${ac_cv_sizeof_int+set}" = set; then : + $as_echo_n "(cached) " >&6 else - test $ac_cv_type_unsigned_long_long_int = yes \ - && ac_type='unsigned long long int' \ - || ac_type='unsigned long int' - -cat >>confdefs.h <<_ACEOF -#define uintmax_t $ac_type -_ACEOF + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : +else + if test "$ac_cv_type_int" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ as_fn_set_status 77 +as_fn_error "cannot compute sizeof (int) +See \`config.log' for more details." "$LINENO" 5; }; } + else + ac_cv_sizeof_int=0 + fi fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 +$as_echo "$ac_cv_sizeof_int" >&6; } - ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "$ac_includes_default" -if test "x$ac_cv_type_uintptr_t" = x""yes; then : - -$as_echo "#define HAVE_UINTPTR_T 1" >>confdefs.h - -else - for ac_type in 'unsigned int' 'unsigned long int' \ - 'unsigned long long int'; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($ac_type))]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : cat >>confdefs.h <<_ACEOF -#define uintptr_t $ac_type +#define SIZEOF_INT $ac_cv_sizeof_int _ACEOF - ac_type= -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test -z "$ac_type" && break - done -fi - - - + # The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5 +$as_echo_n "checking size of short... " >&6; } +if test "${ac_cv_sizeof_short+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then : +else + if test "$ac_cv_type_short" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ as_fn_set_status 77 +as_fn_error "cannot compute sizeof (short) +See \`config.log' for more details." "$LINENO" 5; }; } + else + ac_cv_sizeof_short=0 + fi +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5 +$as_echo "$ac_cv_sizeof_short" >&6; } +cat >>confdefs.h <<_ACEOF +#define SIZEOF_SHORT $ac_cv_sizeof_short +_ACEOF + # The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of char" >&5 +$as_echo_n "checking size of char... " >&6; } +if test "${ac_cv_sizeof_char+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (char))" "ac_cv_sizeof_char" "$ac_includes_default"; then : +else + if test "$ac_cv_type_char" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ as_fn_set_status 77 +as_fn_error "cannot compute sizeof (char) +See \`config.log' for more details." "$LINENO" 5; }; } + else + ac_cv_sizeof_char=0 + fi +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_char" >&5 +$as_echo "$ac_cv_sizeof_char" >&6; } -ac_fn_c_check_type "$LINENO" "int_least32_t" "ac_cv_type_int_least32_t" "#include <sys/types.h> -#ifdef HAVE_STDINT_H -#include <stdint.h> -#endif -#ifdef HAVE_INTTYPES_H -#include <inttypes.h> -#endif -" -if test "x$ac_cv_type_int_least32_t" = x""yes; then : cat >>confdefs.h <<_ACEOF -#define HAVE_INT_LEAST32_T 1 +#define SIZEOF_CHAR $ac_cv_sizeof_char _ACEOF -fi -ac_fn_c_check_type "$LINENO" "int_fast32_t" "ac_cv_type_int_fast32_t" "#include <sys/types.h> -#ifdef HAVE_STDINT_H -#include <stdint.h> -#endif -#ifdef HAVE_INTTYPES_H -#include <inttypes.h> -#endif -" -if test "x$ac_cv_type_int_fast32_t" = x""yes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_INT_FAST32_T 1 -_ACEOF - + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type equivalent to int8_t" >&5 +$as_echo_n "checking for type equivalent to int8_t... " >&6; } + case "$ac_cv_sizeof_char" in + 1) acx_cv_type_int8_t=char ;; + *) { as_fn_set_status please report a bug +as_fn_error "no 8-bit type" "$LINENO" 5; } + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_type_int8_t" >&5 +$as_echo "$acx_cv_type_int8_t" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type equivalent to int16_t" >&5 +$as_echo_n "checking for type equivalent to int16_t... " >&6; } + case "$ac_cv_sizeof_int:$ac_cv_sizeof_short" in + 2:*) acx_cv_type_int16_t=int ;; + *:2) acx_cv_type_int16_t=short ;; + *) { as_fn_set_status please report a bug +as_fn_error "no 16-bit type" "$LINENO" 5; } + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_type_int16_t" >&5 +$as_echo "$acx_cv_type_int16_t" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type equivalent to int32_t" >&5 +$as_echo_n "checking for type equivalent to int32_t... " >&6; } + case "$ac_cv_sizeof_int:$ac_cv_sizeof_long" in + 4:*) acx_cv_type_int32_t=int ;; + *:4) acx_cv_type_int32_t=long ;; + *) { as_fn_set_status please report a bug +as_fn_error "no 32-bit type" "$LINENO" 5; } + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_type_int32_t" >&5 +$as_echo "$acx_cv_type_int32_t" >&6; } fi +# These tests are here to make the output prettier +if test "$ac_cv_type_uint64_t" != yes && test "$ac_cv_type_u_int64_t" != yes; then + case "$ac_cv_sizeof_long" in + 8) acx_cv_type_int64_t=long ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type equivalent to int64_t" >&5 +$as_echo_n "checking for type equivalent to int64_t... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${acx_cv_type_int64_t-'using preprocessor symbols'}" >&5 +$as_echo "${acx_cv_type_int64_t-'using preprocessor symbols'}" >&6; } +fi + +# Now we can use the above types + +if test "$ac_cv_type_uintptr_t" != yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type equivalent to intptr_t" >&5 +$as_echo_n "checking for type equivalent to intptr_t... " >&6; } + case $ac_cv_sizeof_void_p in + 2) acx_cv_type_intptr_t=int16_t ;; + 4) acx_cv_type_intptr_t=int32_t ;; + 8) acx_cv_type_intptr_t=int64_t ;; + *) { as_fn_set_status please report a bug +as_fn_error "no equivalent for intptr_t" "$LINENO" 5; } + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_type_intptr_t" >&5 +$as_echo "$acx_cv_type_intptr_t" >&6; } +fi - - +# ----------------- done all checks, emit header ------------- ac_config_commands="$ac_config_commands bfd_stdint.h" @@ -16555,8 +16436,22 @@ fi LINGUAS="${LINGUAS-%UNSET%}" +GCC="$GCC" +CC="$CC" +acx_cv_header_stdint="$acx_cv_header_stdint" +acx_cv_type_int8_t="$acx_cv_type_int8_t" +acx_cv_type_int16_t="$acx_cv_type_int16_t" +acx_cv_type_int32_t="$acx_cv_type_int32_t" +acx_cv_type_int64_t="$acx_cv_type_int64_t" +acx_cv_type_intptr_t="$acx_cv_type_intptr_t" +ac_cv_type_uintmax_t="$ac_cv_type_uintmax_t" +ac_cv_type_uintptr_t="$ac_cv_type_uintptr_t" +ac_cv_type_uint64_t="$ac_cv_type_uint64_t" +ac_cv_type_u_int64_t="$ac_cv_type_u_int64_t" +ac_cv_type_u_int32_t="$ac_cv_type_u_int32_t" ac_cv_type_int_least32_t="$ac_cv_type_int_least32_t" ac_cv_type_int_fast32_t="$ac_cv_type_int_fast32_t" +ac_cv_sizeof_void_p="$ac_cv_sizeof_void_p" @@ -17994,58 +17889,330 @@ _LT_EOF esac done ;; "bfd_stdint.h":C) -cat > $tmp/bfd_stdint.h <<EOF -#ifndef GCC_GENERATED_STDINT_H -#define GCC_GENERATED_STDINT_H 1 +if test "$GCC" = yes; then + echo "/* generated for " `$CC --version | sed 1q` "*/" > tmp-stdint.h +else + echo "/* generated for $CC */" > tmp-stdint.h +fi -#include "config.h" -#include <sys/types.h> -#ifdef HAVE_STDINT_H -#include <stdint.h> -#endif -#ifdef HAVE_INTTYPES_H -#include <inttypes.h> -#endif +sed 's/^ *//' >> tmp-stdint.h <<EOF + + #ifndef GCC_GENERATED_STDINT_H + #define GCC_GENERATED_STDINT_H 1 + + #include <sys/types.h> +EOF + +if test "$acx_cv_header_stdint" != stdint.h; then + echo "#include <stddef.h>" >> tmp-stdint.h +fi +if test "$acx_cv_header_stdint" != stddef.h; then + echo "#include <$acx_cv_header_stdint>" >> tmp-stdint.h +fi + +sed 's/^ *//' >> tmp-stdint.h <<EOF + /* glibc uses these symbols as guards to prevent redefinitions. */ + #ifdef __int8_t_defined + #define _INT8_T + #define _INT16_T + #define _INT32_T + #endif + #ifdef __uint32_t_defined + #define _UINT32_T + #endif + +EOF + +# ----------------- done header, emit basic int types ------------- +if test "$acx_cv_header_stdint" = stddef.h; then + sed 's/^ *//' >> tmp-stdint.h <<EOF + + #ifndef _UINT8_T + #define _UINT8_T + #ifndef __uint8_t_defined + #define __uint8_t_defined + typedef unsigned $acx_cv_type_int8_t uint8_t; + #endif + #endif + + #ifndef _UINT16_T + #define _UINT16_T + #ifndef __uint16_t_defined + #define __uint16_t_defined + typedef unsigned $acx_cv_type_int16_t uint16_t; + #endif + #endif + + #ifndef _UINT32_T + #define _UINT32_T + #ifndef __uint32_t_defined + #define __uint32_t_defined + typedef unsigned $acx_cv_type_int32_t uint32_t; + #endif + #endif + + #ifndef _INT8_T + #define _INT8_T + #ifndef __int8_t_defined + #define __int8_t_defined + typedef $acx_cv_type_int8_t int8_t; + #endif + #endif + + #ifndef _INT16_T + #define _INT16_T + #ifndef __int16_t_defined + #define __int16_t_defined + typedef $acx_cv_type_int16_t int16_t; + #endif + #endif + + #ifndef _INT32_T + #define _INT32_T + #ifndef __int32_t_defined + #define __int32_t_defined + typedef $acx_cv_type_int32_t int32_t; + #endif + #endif +EOF +elif test "$ac_cv_type_u_int32_t" = yes; then + sed 's/^ *//' >> tmp-stdint.h <<EOF + + /* int8_t int16_t int32_t defined by inet code, we do the u_intXX types */ + #ifndef _INT8_T + #define _INT8_T + #endif + #ifndef _INT16_T + #define _INT16_T + #endif + #ifndef _INT32_T + #define _INT32_T + #endif + + #ifndef _UINT8_T + #define _UINT8_T + #ifndef __uint8_t_defined + #define __uint8_t_defined + typedef u_int8_t uint8_t; + #endif + #endif + + #ifndef _UINT16_T + #define _UINT16_T + #ifndef __uint16_t_defined + #define __uint16_t_defined + typedef u_int16_t uint16_t; + #endif + #endif + + #ifndef _UINT32_T + #define _UINT32_T + #ifndef __uint32_t_defined + #define __uint32_t_defined + typedef u_int32_t uint32_t; + #endif + #endif EOF +else + sed 's/^ *//' >> tmp-stdint.h <<EOF + + /* Some systems have guard macros to prevent redefinitions, define them. */ + #ifndef _INT8_T + #define _INT8_T + #endif + #ifndef _INT16_T + #define _INT16_T + #endif + #ifndef _INT32_T + #define _INT32_T + #endif + #ifndef _UINT8_T + #define _UINT8_T + #endif + #ifndef _UINT16_T + #define _UINT16_T + #endif + #ifndef _UINT32_T + #define _UINT32_T + #endif +EOF +fi + +# ------------- done basic int types, emit int64_t types ------------ +if test "$ac_cv_type_uint64_t" = yes; then + sed 's/^ *//' >> tmp-stdint.h <<EOF + /* system headers have good uint64_t and int64_t */ + #ifndef _INT64_T + #define _INT64_T + #endif + #ifndef _UINT64_T + #define _UINT64_T + #endif +EOF +elif test "$ac_cv_type_u_int64_t" = yes; then + sed 's/^ *//' >> tmp-stdint.h <<EOF + + /* system headers have an u_int64_t (and int64_t) */ + #ifndef _INT64_T + #define _INT64_T + #endif + #ifndef _UINT64_T + #define _UINT64_T + #ifndef __uint64_t_defined + #define __uint64_t_defined + typedef u_int64_t uint64_t; + #endif + #endif +EOF +elif test -n "$acx_cv_type_int64_t"; then + sed 's/^ *//' >> tmp-stdint.h <<EOF + + /* architecture has a 64-bit type, $acx_cv_type_int64_t */ + #ifndef _INT64_T + #define _INT64_T + typedef $acx_cv_type_int64_t int64_t; + #endif + #ifndef _UINT64_T + #define _UINT64_T + #ifndef __uint64_t_defined + #define __uint64_t_defined + typedef unsigned $acx_cv_type_int64_t uint64_t; + #endif + #endif +EOF +else + sed 's/^ *//' >> tmp-stdint.h <<EOF + + /* some common heuristics for int64_t, using compiler-specific tests */ + #if defined __STDC_VERSION__ && (__STDC_VERSION__-0) >= 199901L + #ifndef _INT64_T + #define _INT64_T + #ifndef __int64_t_defined + typedef long long int64_t; + #endif + #endif + #ifndef _UINT64_T + #define _UINT64_T + typedef unsigned long long uint64_t; + #endif + + #elif defined __GNUC__ && defined (__STDC__) && __STDC__-0 + /* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and + does not implement __extension__. But that compiler doesn't define + __GNUC_MINOR__. */ + # if __GNUC__ < 2 || (__NeXT__ && !__GNUC_MINOR__) + # define __extension__ + # endif + + # ifndef _INT64_T + # define _INT64_T + __extension__ typedef long long int64_t; + # endif + # ifndef _UINT64_T + # define _UINT64_T + __extension__ typedef unsigned long long uint64_t; + # endif + + #elif !defined __STRICT_ANSI__ + # if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__ + + # ifndef _INT64_T + # define _INT64_T + typedef __int64 int64_t; + # endif + # ifndef _UINT64_T + # define _UINT64_T + typedef unsigned __int64 uint64_t; + # endif + # endif /* compiler */ + + #endif /* ANSI version */ +EOF +fi + +# ------------- done int64_t types, emit intptr types ------------ +if test "$ac_cv_type_uintptr_t" != yes; then + sed 's/^ *//' >> tmp-stdint.h <<EOF + + /* Define intptr_t based on sizeof(void*) = $ac_cv_sizeof_void_p */ + #ifndef __uintptr_t_defined + typedef u$acx_cv_type_intptr_t uintptr_t; + #endif + #ifndef __intptr_t_defined + typedef $acx_cv_type_intptr_t intptr_t; + #endif +EOF +fi + +# ------------- done intptr types, emit int_least types ------------ if test "$ac_cv_type_int_least32_t" != yes; then - sed 's/^ *//' >> $tmp/bfd_stdint.h <<EOF + sed 's/^ *//' >> tmp-stdint.h <<EOF /* Define int_least types */ typedef int8_t int_least8_t; typedef int16_t int_least16_t; typedef int32_t int_least32_t; + #ifdef _INT64_T typedef int64_t int_least64_t; + #endif typedef uint8_t uint_least8_t; typedef uint16_t uint_least16_t; typedef uint32_t uint_least32_t; + #ifdef _UINT64_T typedef uint64_t uint_least64_t; + #endif EOF fi +# ------------- done intptr types, emit int_fast types ------------ if test "$ac_cv_type_int_fast32_t" != yes; then - sed 's/^ *//' >> $tmp/bfd_stdint.h <<EOF + sed 's/^ *//' >> tmp-stdint.h <<EOF /* Define int_fast types. short is often slow */ typedef int8_t int_fast8_t; typedef int int_fast16_t; typedef int32_t int_fast32_t; + #ifdef _INT64_T typedef int64_t int_fast64_t; + #endif typedef uint8_t uint_fast8_t; typedef unsigned int uint_fast16_t; typedef uint32_t uint_fast32_t; + #ifdef _UINT64_T typedef uint64_t uint_fast64_t; + #endif +EOF +fi + +if test "$ac_cv_type_uintmax_t" != yes; then + sed 's/^ *//' >> tmp-stdint.h <<EOF + + /* Define intmax based on what we found */ + #ifdef _INT64_T + typedef int64_t intmax_t; + #else + typedef long intmax_t; + #endif + #ifdef _UINT64_T + typedef uint64_t uintmax_t; + #else + typedef unsigned long uintmax_t; + #endif EOF fi -echo '#endif /* GCC_GENERATED_STDINT_H */' >> $tmp/bfd_stdint.h +sed 's/^ *//' >> tmp-stdint.h <<EOF + + #endif /* GCC_GENERATED_STDINT_H */ +EOF -if test -r bfd_stdint.h && cmp -s $tmp/bfd_stdint.h bfd_stdint.h; then - rm -f $tmp/bfd_stdint.h +if test -r bfd_stdint.h && cmp -s tmp-stdint.h bfd_stdint.h; then + rm -f tmp-stdint.h else - mv -f $tmp/bfd_stdint.h bfd_stdint.h + mv -f tmp-stdint.h bfd_stdint.h fi ;; diff --git a/config/ChangeLog b/config/ChangeLog index 34cdad5..ceea52e 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,5 +1,10 @@ 2009-09-09 Paolo Bonzini <bonzini@gnu.org> + * stdint.m4 (GCC_HEADER_STDINT): Revert changes to this macro in + the previous two patches. + +2009-09-09 Paolo Bonzini <bonzini@gnu.org> + * stdint.m4: Store temporary file in $tmp/_GCC_STDINT_H. 2009-09-08 Paolo Bonzini <bonzini@gnu.org> diff --git a/config/stdint.m4 b/config/stdint.m4 index 6c64c58..b26b4fc 100644 --- a/config/stdint.m4 +++ b/config/stdint.m4 @@ -12,82 +12,531 @@ AC_REQUIRE([AC_TYPE_UINT64_T]) AC_REQUIRE([AC_TYPE_UINTMAX_T]) AC_REQUIRE([AC_TYPE_UINTPTR_T])]) +dnl @synopsis GCC_HEADER_STDINT [( HEADER-TO-GENERATE [, HEADERS-TO-CHECK])] +dnl +dnl the "ISO C9X: 7.18 Integer types <stdint.h>" section requires the +dnl existence of an include file <stdint.h> that defines a set of +dnl typedefs, especially uint8_t,int32_t,uintptr_t. +dnl Many older installations will not provide this file, but some will +dnl have the very same definitions in <inttypes.h>. In other enviroments +dnl we can use the inet-types in <sys/types.h> which would define the +dnl typedefs int8_t and u_int8_t respectivly. +dnl +dnl This macros will create a local "_stdint.h" or the headerfile given as +dnl an argument. In many cases that file will pick the definition from a +dnl "#include <stdint.h>" or "#include <inttypes.h>" statement, while +dnl in other environments it will provide the set of basic 'stdint's defined: +dnl int8_t,uint8_t,int16_t,uint16_t,int32_t,uint32_t,intptr_t,uintptr_t +dnl int_least32_t.. int_fast32_t.. intmax_t +dnl which may or may not rely on the definitions of other files. +dnl +dnl Sometimes the stdint.h or inttypes.h headers conflict with sys/types.h, +dnl so we test the headers together with sys/types.h and always include it +dnl into the generated header (to match the tests with the generated file). +dnl Hopefully this is not a big annoyance. +dnl +dnl If your installed header files require the stdint-types you will want to +dnl create an installable file mylib-int.h that all your other installable +dnl header may include. So, for a library package named "mylib", just use +dnl GCC_HEADER_STDINT(mylib-int.h) +dnl in configure.in and install that header file in Makefile.am along with +dnl the other headers (mylib.h). The mylib-specific headers can simply +dnl use "#include <mylib-int.h>" to obtain the stdint-types. +dnl +dnl Remember, if the system already had a valid <stdint.h>, the generated +dnl file will include it directly. No need for fuzzy HAVE_STDINT_H things... +dnl +dnl @author Guido Draheim <guidod@gmx.de>, Paolo Bonzini <bonzini@gnu.org> + AC_DEFUN([GCC_HEADER_STDINT], -[AC_REQUIRE([GCC_STDINT_TYPES]) -AC_CHECK_TYPES([int_least32_t, int_fast32_t],,,[#include <sys/types.h> -#ifdef HAVE_STDINT_H -#include <stdint.h> -#endif -#ifdef HAVE_INTTYPES_H -#include <inttypes.h> -#endif]) - -m4_define([_GCC_STDINT_H], m4_ifval($1, $1, _stdint.h)) -m4_if(m4_bmatch(m4_quote(/_GCC_STDINT_H), - /stdint\.h$, bad, - /inttypes\.h$, bad, ok), bad, - [m4_fatal([cannot overwrite ]m4_quote(_GCC_STDINT_H))]) +[m4_define(_GCC_STDINT_H, m4_ifval($1, $1, _stdint.h)) + +inttype_headers=`echo inttypes.h sys/inttypes.h $2 | sed -e 's/,/ /g'` + +acx_cv_header_stdint=stddef.h +acx_cv_header_stdint_kind="(already complete)" +for i in stdint.h $inttype_headers; do + unset ac_cv_type_uintptr_t + unset ac_cv_type_uintmax_t + unset ac_cv_type_int_least32_t + unset ac_cv_type_int_fast32_t + unset ac_cv_type_uint64_t + _AS_ECHO_N([looking for a compliant stdint.h in $i, ]) + AC_CHECK_TYPE(uintmax_t,[acx_cv_header_stdint=$i],continue,[#include <sys/types.h> +#include <$i>]) + AC_CHECK_TYPE(uintptr_t,,[acx_cv_header_stdint_kind="(mostly complete)"], [#include <sys/types.h> +#include <$i>]) + AC_CHECK_TYPE(int_least32_t,,[acx_cv_header_stdint_kind="(mostly complete)"], [#include <sys/types.h> +#include <$i>]) + AC_CHECK_TYPE(int_fast32_t,,[acx_cv_header_stdint_kind="(mostly complete)"], [#include <sys/types.h> +#include <$i>]) + AC_CHECK_TYPE(uint64_t,,[acx_cv_header_stdint_kind="(lacks uint64_t)"], [#include <sys/types.h> +#include <$i>]) + break +done +if test "$acx_cv_header_stdint" = stddef.h; then + acx_cv_header_stdint_kind="(lacks uintmax_t)" + for i in stdint.h $inttype_headers; do + unset ac_cv_type_uintptr_t + unset ac_cv_type_uint32_t + unset ac_cv_type_uint64_t + _AS_ECHO_N([looking for an incomplete stdint.h in $i, ]) + AC_CHECK_TYPE(uint32_t,[acx_cv_header_stdint=$i],continue,[#include <sys/types.h> +#include <$i>]) + AC_CHECK_TYPE(uint64_t,,,[#include <sys/types.h> +#include <$i>]) + AC_CHECK_TYPE(uintptr_t,,,[#include <sys/types.h> +#include <$i>]) + break + done +fi +if test "$acx_cv_header_stdint" = stddef.h; then + acx_cv_header_stdint_kind="(u_intXX_t style)" + for i in sys/types.h $inttype_headers; do + unset ac_cv_type_u_int32_t + unset ac_cv_type_u_int64_t + _AS_ECHO_N([looking for u_intXX_t types in $i, ]) + AC_CHECK_TYPE(u_int32_t,[acx_cv_header_stdint=$i],continue,[#include <sys/types.h> +#include <$i>]) + AC_CHECK_TYPE(u_int64_t,,,[#include <sys/types.h> +#include <$i>]) + break + done +fi +if test "$acx_cv_header_stdint" = stddef.h; then + acx_cv_header_stdint_kind="(using manual detection)" +fi + +test -z "$ac_cv_type_uintptr_t" && ac_cv_type_uintptr_t=no +test -z "$ac_cv_type_uint64_t" && ac_cv_type_uint64_t=no +test -z "$ac_cv_type_u_int64_t" && ac_cv_type_u_int64_t=no +test -z "$ac_cv_type_int_least32_t" && ac_cv_type_int_least32_t=no +test -z "$ac_cv_type_int_fast32_t" && ac_cv_type_int_fast32_t=no + +# ----------------- Summarize what we found so far + +AC_MSG_CHECKING([what to include in _GCC_STDINT_H]) + +case `AS_BASENAME(_GCC_STDINT_H)` in + stdint.h) AC_MSG_WARN([are you sure you want it there?]) ;; + inttypes.h) AC_MSG_WARN([are you sure you want it there?]) ;; + *) ;; +esac + +AC_MSG_RESULT($acx_cv_header_stdint $acx_cv_header_stdint_kind) + +# ----------------- done included file, check C basic types -------- + +# Lacking an uintptr_t? Test size of void * +case "$acx_cv_header_stdint:$ac_cv_type_uintptr_t" in + stddef.h:* | *:no) AC_CHECK_SIZEOF(void *) ;; +esac + +# Lacking an uint64_t? Test size of long +case "$acx_cv_header_stdint:$ac_cv_type_uint64_t:$ac_cv_type_u_int64_t" in + stddef.h:*:* | *:no:no) AC_CHECK_SIZEOF(long) ;; +esac + +if test $acx_cv_header_stdint = stddef.h; then + # Lacking a good header? Test size of everything and deduce all types. + AC_CHECK_SIZEOF(int) + AC_CHECK_SIZEOF(short) + AC_CHECK_SIZEOF(char) + + AC_MSG_CHECKING(for type equivalent to int8_t) + case "$ac_cv_sizeof_char" in + 1) acx_cv_type_int8_t=char ;; + *) AC_MSG_ERROR(no 8-bit type, please report a bug) + esac + AC_MSG_RESULT($acx_cv_type_int8_t) + + AC_MSG_CHECKING(for type equivalent to int16_t) + case "$ac_cv_sizeof_int:$ac_cv_sizeof_short" in + 2:*) acx_cv_type_int16_t=int ;; + *:2) acx_cv_type_int16_t=short ;; + *) AC_MSG_ERROR(no 16-bit type, please report a bug) + esac + AC_MSG_RESULT($acx_cv_type_int16_t) + + AC_MSG_CHECKING(for type equivalent to int32_t) + case "$ac_cv_sizeof_int:$ac_cv_sizeof_long" in + 4:*) acx_cv_type_int32_t=int ;; + *:4) acx_cv_type_int32_t=long ;; + *) AC_MSG_ERROR(no 32-bit type, please report a bug) + esac + AC_MSG_RESULT($acx_cv_type_int32_t) +fi + +# These tests are here to make the output prettier +if test "$ac_cv_type_uint64_t" != yes && test "$ac_cv_type_u_int64_t" != yes; then + case "$ac_cv_sizeof_long" in + 8) acx_cv_type_int64_t=long ;; + esac + AC_MSG_CHECKING(for type equivalent to int64_t) + AC_MSG_RESULT(${acx_cv_type_int64_t-'using preprocessor symbols'}) +fi + +# Now we can use the above types + +if test "$ac_cv_type_uintptr_t" != yes; then + AC_MSG_CHECKING(for type equivalent to intptr_t) + case $ac_cv_sizeof_void_p in + 2) acx_cv_type_intptr_t=int16_t ;; + 4) acx_cv_type_intptr_t=int32_t ;; + 8) acx_cv_type_intptr_t=int64_t ;; + *) AC_MSG_ERROR(no equivalent for intptr_t, please report a bug) + esac + AC_MSG_RESULT($acx_cv_type_intptr_t) +fi + +# ----------------- done all checks, emit header ------------- AC_CONFIG_COMMANDS(_GCC_STDINT_H, [ -cat > $tmp/_GCC_STDINT_H <<EOF -#ifndef GCC_GENERATED_STDINT_H -#define GCC_GENERATED_STDINT_H 1 - -#include "config.h" -#include <sys/types.h> -#ifdef HAVE_STDINT_H -#include <stdint.h> -#endif -#ifdef HAVE_INTTYPES_H -#include <inttypes.h> -#endif +if test "$GCC" = yes; then + echo "/* generated for " `$CC --version | sed 1q` "*/" > tmp-stdint.h +else + echo "/* generated for $CC */" > tmp-stdint.h +fi + +sed 's/^ *//' >> tmp-stdint.h <<EOF + + #ifndef GCC_GENERATED_STDINT_H + #define GCC_GENERATED_STDINT_H 1 + + #include <sys/types.h> EOF +if test "$acx_cv_header_stdint" != stdint.h; then + echo "#include <stddef.h>" >> tmp-stdint.h +fi +if test "$acx_cv_header_stdint" != stddef.h; then + echo "#include <$acx_cv_header_stdint>" >> tmp-stdint.h +fi + +sed 's/^ *//' >> tmp-stdint.h <<EOF + /* glibc uses these symbols as guards to prevent redefinitions. */ + #ifdef __int8_t_defined + #define _INT8_T + #define _INT16_T + #define _INT32_T + #endif + #ifdef __uint32_t_defined + #define _UINT32_T + #endif + +EOF + +# ----------------- done header, emit basic int types ------------- +if test "$acx_cv_header_stdint" = stddef.h; then + sed 's/^ *//' >> tmp-stdint.h <<EOF + + #ifndef _UINT8_T + #define _UINT8_T + #ifndef __uint8_t_defined + #define __uint8_t_defined + typedef unsigned $acx_cv_type_int8_t uint8_t; + #endif + #endif + + #ifndef _UINT16_T + #define _UINT16_T + #ifndef __uint16_t_defined + #define __uint16_t_defined + typedef unsigned $acx_cv_type_int16_t uint16_t; + #endif + #endif + + #ifndef _UINT32_T + #define _UINT32_T + #ifndef __uint32_t_defined + #define __uint32_t_defined + typedef unsigned $acx_cv_type_int32_t uint32_t; + #endif + #endif + + #ifndef _INT8_T + #define _INT8_T + #ifndef __int8_t_defined + #define __int8_t_defined + typedef $acx_cv_type_int8_t int8_t; + #endif + #endif + + #ifndef _INT16_T + #define _INT16_T + #ifndef __int16_t_defined + #define __int16_t_defined + typedef $acx_cv_type_int16_t int16_t; + #endif + #endif + + #ifndef _INT32_T + #define _INT32_T + #ifndef __int32_t_defined + #define __int32_t_defined + typedef $acx_cv_type_int32_t int32_t; + #endif + #endif +EOF +elif test "$ac_cv_type_u_int32_t" = yes; then + sed 's/^ *//' >> tmp-stdint.h <<EOF + + /* int8_t int16_t int32_t defined by inet code, we do the u_intXX types */ + #ifndef _INT8_T + #define _INT8_T + #endif + #ifndef _INT16_T + #define _INT16_T + #endif + #ifndef _INT32_T + #define _INT32_T + #endif + + #ifndef _UINT8_T + #define _UINT8_T + #ifndef __uint8_t_defined + #define __uint8_t_defined + typedef u_int8_t uint8_t; + #endif + #endif + + #ifndef _UINT16_T + #define _UINT16_T + #ifndef __uint16_t_defined + #define __uint16_t_defined + typedef u_int16_t uint16_t; + #endif + #endif + + #ifndef _UINT32_T + #define _UINT32_T + #ifndef __uint32_t_defined + #define __uint32_t_defined + typedef u_int32_t uint32_t; + #endif + #endif +EOF +else + sed 's/^ *//' >> tmp-stdint.h <<EOF + + /* Some systems have guard macros to prevent redefinitions, define them. */ + #ifndef _INT8_T + #define _INT8_T + #endif + #ifndef _INT16_T + #define _INT16_T + #endif + #ifndef _INT32_T + #define _INT32_T + #endif + #ifndef _UINT8_T + #define _UINT8_T + #endif + #ifndef _UINT16_T + #define _UINT16_T + #endif + #ifndef _UINT32_T + #define _UINT32_T + #endif +EOF +fi + +# ------------- done basic int types, emit int64_t types ------------ +if test "$ac_cv_type_uint64_t" = yes; then + sed 's/^ *//' >> tmp-stdint.h <<EOF + + /* system headers have good uint64_t and int64_t */ + #ifndef _INT64_T + #define _INT64_T + #endif + #ifndef _UINT64_T + #define _UINT64_T + #endif +EOF +elif test "$ac_cv_type_u_int64_t" = yes; then + sed 's/^ *//' >> tmp-stdint.h <<EOF + + /* system headers have an u_int64_t (and int64_t) */ + #ifndef _INT64_T + #define _INT64_T + #endif + #ifndef _UINT64_T + #define _UINT64_T + #ifndef __uint64_t_defined + #define __uint64_t_defined + typedef u_int64_t uint64_t; + #endif + #endif +EOF +elif test -n "$acx_cv_type_int64_t"; then + sed 's/^ *//' >> tmp-stdint.h <<EOF + + /* architecture has a 64-bit type, $acx_cv_type_int64_t */ + #ifndef _INT64_T + #define _INT64_T + typedef $acx_cv_type_int64_t int64_t; + #endif + #ifndef _UINT64_T + #define _UINT64_T + #ifndef __uint64_t_defined + #define __uint64_t_defined + typedef unsigned $acx_cv_type_int64_t uint64_t; + #endif + #endif +EOF +else + sed 's/^ *//' >> tmp-stdint.h <<EOF + + /* some common heuristics for int64_t, using compiler-specific tests */ + #if defined __STDC_VERSION__ && (__STDC_VERSION__-0) >= 199901L + #ifndef _INT64_T + #define _INT64_T + #ifndef __int64_t_defined + typedef long long int64_t; + #endif + #endif + #ifndef _UINT64_T + #define _UINT64_T + typedef unsigned long long uint64_t; + #endif + + #elif defined __GNUC__ && defined (__STDC__) && __STDC__-0 + /* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and + does not implement __extension__. But that compiler doesn't define + __GNUC_MINOR__. */ + # if __GNUC__ < 2 || (__NeXT__ && !__GNUC_MINOR__) + # define __extension__ + # endif + + # ifndef _INT64_T + # define _INT64_T + __extension__ typedef long long int64_t; + # endif + # ifndef _UINT64_T + # define _UINT64_T + __extension__ typedef unsigned long long uint64_t; + # endif + + #elif !defined __STRICT_ANSI__ + # if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__ + + # ifndef _INT64_T + # define _INT64_T + typedef __int64 int64_t; + # endif + # ifndef _UINT64_T + # define _UINT64_T + typedef unsigned __int64 uint64_t; + # endif + # endif /* compiler */ + + #endif /* ANSI version */ +EOF +fi + +# ------------- done int64_t types, emit intptr types ------------ +if test "$ac_cv_type_uintptr_t" != yes; then + sed 's/^ *//' >> tmp-stdint.h <<EOF + + /* Define intptr_t based on sizeof(void*) = $ac_cv_sizeof_void_p */ + #ifndef __uintptr_t_defined + typedef u$acx_cv_type_intptr_t uintptr_t; + #endif + #ifndef __intptr_t_defined + typedef $acx_cv_type_intptr_t intptr_t; + #endif +EOF +fi + +# ------------- done intptr types, emit int_least types ------------ if test "$ac_cv_type_int_least32_t" != yes; then - sed 's/^ *//' >> $tmp/_GCC_STDINT_H <<EOF + sed 's/^ *//' >> tmp-stdint.h <<EOF /* Define int_least types */ typedef int8_t int_least8_t; typedef int16_t int_least16_t; typedef int32_t int_least32_t; + #ifdef _INT64_T typedef int64_t int_least64_t; + #endif typedef uint8_t uint_least8_t; typedef uint16_t uint_least16_t; typedef uint32_t uint_least32_t; + #ifdef _UINT64_T typedef uint64_t uint_least64_t; + #endif EOF fi +# ------------- done intptr types, emit int_fast types ------------ if test "$ac_cv_type_int_fast32_t" != yes; then dnl NOTE: The following code assumes that sizeof (int) > 1. dnl Fix when strange machines are reported. - sed 's/^ *//' >> $tmp/_GCC_STDINT_H <<EOF + sed 's/^ *//' >> tmp-stdint.h <<EOF /* Define int_fast types. short is often slow */ typedef int8_t int_fast8_t; typedef int int_fast16_t; typedef int32_t int_fast32_t; + #ifdef _INT64_T typedef int64_t int_fast64_t; + #endif typedef uint8_t uint_fast8_t; typedef unsigned int uint_fast16_t; typedef uint32_t uint_fast32_t; + #ifdef _UINT64_T typedef uint64_t uint_fast64_t; + #endif EOF fi -echo '@%:@endif /* GCC_GENERATED_STDINT_H */' >> $tmp/_GCC_STDINT_H +if test "$ac_cv_type_uintmax_t" != yes; then + sed 's/^ *//' >> tmp-stdint.h <<EOF + + /* Define intmax based on what we found */ + #ifdef _INT64_T + typedef int64_t intmax_t; + #else + typedef long intmax_t; + #endif + #ifdef _UINT64_T + typedef uint64_t uintmax_t; + #else + typedef unsigned long uintmax_t; + #endif +EOF +fi + +sed 's/^ *//' >> tmp-stdint.h <<EOF + + #endif /* GCC_GENERATED_STDINT_H */ +EOF -if test -r _GCC_STDINT_H && cmp -s $tmp/_GCC_STDINT_H _GCC_STDINT_H; then - rm -f $tmp/_GCC_STDINT_H +if test -r ]_GCC_STDINT_H[ && cmp -s tmp-stdint.h ]_GCC_STDINT_H[; then + rm -f tmp-stdint.h else - mv -f $tmp/_GCC_STDINT_H _GCC_STDINT_H + mv -f tmp-stdint.h ]_GCC_STDINT_H[ fi ], [ +GCC="$GCC" +CC="$CC" +acx_cv_header_stdint="$acx_cv_header_stdint" +acx_cv_type_int8_t="$acx_cv_type_int8_t" +acx_cv_type_int16_t="$acx_cv_type_int16_t" +acx_cv_type_int32_t="$acx_cv_type_int32_t" +acx_cv_type_int64_t="$acx_cv_type_int64_t" +acx_cv_type_intptr_t="$acx_cv_type_intptr_t" +ac_cv_type_uintmax_t="$ac_cv_type_uintmax_t" +ac_cv_type_uintptr_t="$ac_cv_type_uintptr_t" +ac_cv_type_uint64_t="$ac_cv_type_uint64_t" +ac_cv_type_u_int64_t="$ac_cv_type_u_int64_t" +ac_cv_type_u_int32_t="$ac_cv_type_u_int32_t" ac_cv_type_int_least32_t="$ac_cv_type_int_least32_t" ac_cv_type_int_fast32_t="$ac_cv_type_int_fast32_t" +ac_cv_sizeof_void_p="$ac_cv_sizeof_void_p" ]) ]) |