From 1d5269c994bf4af088b1a9d0ed39825541623a99 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 4 Dec 2021 00:28:14 -0500 Subject: unify 64-bit bfd checks Move the 64-bit bfd logic out of bfd/configure.ac and into bfd64.m4 under config so it can be shared between all the other subdirs. This replaces want64 with enable_64_bit_bfd which was already being declared, but not used directly. --- ld/configure | 214 ++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 117 insertions(+), 97 deletions(-) (limited to 'ld/configure') diff --git a/ld/configure b/ld/configure index c4ba490..f5c329c 100755 --- a/ld/configure +++ b/ld/configure @@ -686,6 +686,8 @@ install_as_default TARGET_SYSTEM_ROOT_DEFINE TARGET_SYSTEM_ROOT use_sysroot +ENABLE_BFD_64_BIT_FALSE +ENABLE_BFD_64_BIT_TRUE LARGEFILE_CPPFLAGS CXXCPP OTOOL64 @@ -2097,52 +2099,6 @@ fi } # ac_fn_cxx_try_link -# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES -# --------------------------------------------- -# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR -# accordingly. -ac_fn_c_check_decl () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - as_decl_name=`echo $2|sed 's/ *(.*//'` - as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 -$as_echo_n "checking whether $as_decl_name is declared... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -#ifndef $as_decl_name -#ifdef __cplusplus - (void) $as_decl_use; -#else - (void) $as_decl_name; -#endif -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -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; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_decl - # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- # Tries to find the compile-time value of EXPR in a program that includes @@ -2325,6 +2281,52 @@ rm -f conftest.val as_fn_set_status $ac_retval } # ac_fn_c_compute_int + +# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES +# --------------------------------------------- +# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR +# accordingly. +ac_fn_c_check_decl () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + as_decl_name=`echo $2|sed 's/ *(.*//'` + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +$as_echo_n "checking whether $as_decl_name is declared... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +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; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_decl cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -11452,7 +11454,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11455 "configure" +#line 11457 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11558,7 +11560,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11561 "configure" +#line 11563 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -15200,17 +15202,72 @@ if test "${enable_targets+set}" = set; then : *) enable_targets=$enableval ;; esac fi + # Check whether --enable-64-bit-bfd was given. if test "${enable_64_bit_bfd+set}" = set; then : - enableval=$enable_64_bit_bfd; case "${enableval}" in - yes) want64=true ;; - no) want64=false ;; - *) as_fn_error $? "bad value ${enableval} for 64-bit-bfd option" "$LINENO" 5 ;; + enableval=$enable_64_bit_bfd; case $enableval in #( + yes|no) : + ;; #( + *) : + as_fn_error $? "bad value ${enableval} for 64-bit-bfd option" "$LINENO" 5 ;; #( + *) : + ;; esac else - want64=false + enable_64_bit_bfd=no +fi + + +if test "x$enable_64_bit_bfd" = "xno"; then : + # 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 ${ac_cv_sizeof_void_p+:} false; 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 : + +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_error 77 "cannot compute sizeof (void *) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_void_p=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5 +$as_echo "$ac_cv_sizeof_void_p" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_VOID_P $ac_cv_sizeof_void_p +_ACEOF + + + if test "x$ac_cv_sizeof_void_p" = "x8"; then : + enable_64_bit_bfd=yes fi +fi + + if test "x$enable_64_bit_bfd" = "xyes"; then + ENABLE_BFD_64_BIT_TRUE= + ENABLE_BFD_64_BIT_FALSE='#' +else + ENABLE_BFD_64_BIT_TRUE='#' + ENABLE_BFD_64_BIT_FALSE= +fi + + + # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : @@ -16739,47 +16796,6 @@ all_emul_extras= all_libpath= TDIRS= -# If the host is 64-bit, then we enable 64-bit targets by default. -# This is consistent with what ../bfd/configure.ac does. -if test x${want64} = xfalse; then - # 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 ${ac_cv_sizeof_void_p+:} false; 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 : - -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_error 77 "cannot compute sizeof (void *) -See \`config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof_void_p=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5 -$as_echo "$ac_cv_sizeof_void_p" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_VOID_P $ac_cv_sizeof_void_p -_ACEOF - - - if test "x${ac_cv_sizeof_void_p}" = "x8"; then - want64=true - fi -fi - elf_list_options=false elf_shlib_list_options=false elf_plt_unwind_list_options=false @@ -16805,11 +16821,11 @@ do EMUL=$targ_emul fi - if test x${want64} = xfalse; then + if test x${enable_64_bit_bfd} = xno; then . ${srcdir}/../bfd/config.bfd fi - if test x${want64} = xtrue; then + if test x${enable_64_bit_bfd} = xyes; then targ_extra_emuls="$targ_extra_emuls $targ64_extra_emuls" targ_extra_libpath="$targ_extra_libpath $targ64_extra_libpath" fi @@ -16962,7 +16978,7 @@ _ACEOF if test x${all_targets} = xtrue; then - if test x${want64} = xtrue; then + if test x${enable_64_bit_bfd} = xyes; then EMULATION_OFILES='$(ALL_EMULATIONS) $(ALL_64_EMULATIONS)' EMUL_EXTRA_OFILES='$(ALL_EMUL_EXTRA_OFILES) $(ALL_64_EMUL_EXTRA_OFILES)' else @@ -17162,6 +17178,10 @@ if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_BFD_64_BIT_TRUE}" && test -z "${ENABLE_BFD_64_BIT_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_BFD_64_BIT\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${ENABLE_LIBCTF_TRUE}" && test -z "${ENABLE_LIBCTF_FALSE}"; then as_fn_error $? "conditional \"ENABLE_LIBCTF\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 -- cgit v1.1