From 9698cf9b1c485edbbeabc9f65bfd0fdef92e3854 Mon Sep 17 00:00:00 2001 From: Nick Alcock Date: Wed, 29 May 2019 11:11:37 +0200 Subject: Fix libctf build on non-ELF targets. All machinery works as on ELF, except for automatic loading of ELF string and symbol tables in the BFD-style open machinery. * Makefile.def (dependencies): configure-libctf depends on all-bfd and all its deps. * Makefile.in: Regenerated. libctf/ * configure.in: Check for bfd_section_from_elf_index. * configure: Regenerate. * config.h.in [HAVE_BFD_ELF]: Likewise. * libctf/ctf_open_bfd (ctf_bfdopen_ctfsect): Use it. abfd is potentially unused now. --- libctf/configure | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) (limited to 'libctf/configure') diff --git a/libctf/configure b/libctf/configure index 2213393..1c03401 100755 --- a/libctf/configure +++ b/libctf/configure @@ -5974,6 +5974,114 @@ $as_echo "#define HAVE_MMAP 1" >>confdefs.h fi rm -f conftest.mmap conftest.txt +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 +$as_echo_n "checking for library containing dlopen... " >&6; } +if ${ac_cv_search_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +for ac_lib in '' dl; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_dlopen=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_dlopen+:} false; then : + break +fi +done +if ${ac_cv_search_dlopen+:} false; then : + +else + ac_cv_search_dlopen=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 +$as_echo "$ac_cv_search_dlopen" >&6; } +ac_res=$ac_cv_search_dlopen +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + + +# Similar to GDB_AC_CHECK_BFD. +OLD_CFLAGS=$CFLAGS +OLD_LDFLAGS=$LDFLAGS +OLD_LIBS=$LIBS +# Put the old CFLAGS/LDFLAGS last, in case the user's (C|LD)FLAGS +# points somewhere with bfd, with -I/foo/lib and -L/foo/lib. We +# always want our bfd. +CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS" +ZLIBDIR=`echo $zlibdir | sed 's,\$(top_builddir)/,,g'` +LDFLAGS="-L../bfd -L../libiberty $ZLIBDIR $LDFLAGS" +intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'` +LIBS="-lbfd -liberty -lz $intl $LIBS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ELF support in BFD" >&5 +$as_echo_n "checking for ELF support in BFD... " >&6; } +if ${ac_cv_libctf_bfd_elf+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include "bfd.h" + #include "elf-bfd.h" +int +main () +{ +(void) bfd_section_from_elf_index (NULL, 0); + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_libctf_bfd_elf=yes +else + ac_cv_libctf_bfd_elf=no +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_libctf_bfd_elf" >&5 +$as_echo "$ac_cv_libctf_bfd_elf" >&6; } +CFLAGS=$OLD_CFLAGS +LDFLAGS=$OLD_LDFLAGS +LIBS=$OLD_LIBS + +if test $ac_cv_libctf_bfd_elf = yes; then + +$as_echo "#define HAVE_BFD_ELF 1" >>confdefs.h + +fi + for ac_header in byteswap.h do : ac_fn_c_check_header_mongrel "$LINENO" "byteswap.h" "ac_cv_header_byteswap_h" "$ac_includes_default" -- cgit v1.1