Index: mono-debugger-2.4.2/backend/arch/Makefile.am =================================================================== --- mono-debugger-2.4.2.orig/backend/arch/Makefile.am +++ mono-debugger-2.4.2/backend/arch/Makefile.am @@ -1,15 +1,23 @@ +if !SYSTEM_LIBBFD SUBDIRS = libiberty bfd opcodes +libbfd_libs = opcodes/libopcodes.la bfd/libbfd.la +libbfd_includes = -I$(srcdir)/bfd -I$(srcdir)/bfd/include -I$(srcdir)/opcodes +else +libbfd_libs = -lopcodes -lbfd +libbfd_includes = +endif + noinst_LTLIBRARIES = libmonodebuggerbfdglue.la libmonodebuggerbfdglue_la_SOURCES = \ bfdglue.c \ bfdglue.h -libmonodebuggerbfdglue_la_LIBADD = opcodes/libopcodes.la bfd/libbfd.la @BASE_DEPENDENCIES_LIBS@ +libmonodebuggerbfdglue_la_LIBADD = $(libbfd_libs) @BASE_DEPENDENCIES_LIBS@ libmonodebuggerbfdglue_la_LDFLAGS = -no-undefined -module -export-dynamic -shared -INCLUDES = -I$(srcdir)/bfd -I$(srcdir)/bfd/include -I$(srcdir)/opcodes @BASE_DEPENDENCIES_CFLAGS@ +INCLUDES = $(libbfd_includes) @BASE_DEPENDENCIES_CFLAGS@ CLEANFILES = lib*.a lib*.dll Index: mono-debugger-2.4.2/configure.in =================================================================== --- mono-debugger-2.4.2.orig/configure.in +++ mono-debugger-2.4.2/configure.in @@ -57,6 +57,19 @@ case "$host" in esac AC_MSG_RESULT(ok) +AC_ARG_WITH([system-libbfd], + AS_HELP_STRING([--with-system-libbfd], [Use the system copy of libbfd and libopcodes.])) + +AS_IF([test "x$with_system_libbfd" = "xyes"], + [ + AC_CHECK_HEADERS([bfd.h], [], [AC_MSG_ERROR([Missing bfd.h header])]) + AC_CHECK_LIB([bfd], [bfd_init], [:], [AC_MSG_ERROR([Missing libbfd library])]) + AC_CHECK_LIB([opcodes], [init_disassemble_info], [:], [AC_MSG_ERROR([Missing libopcodes library])], [-liberty]) + AC_CHECK_MEMBERS([asection.rawsize], [], [], [[#include ]]) + ]) + +AM_CONDITIONAL([SYSTEM_LIBBFD], [test "x$with_system_libbfd" = "xyes"]) + AC_ARG_WITH(bfd-target, [ --with-bfd-target Manually override the BFD target], if test x$with_bfd_target != "x"; then Index: mono-debugger-2.4.2/backend/arch/bfdglue.c =================================================================== --- mono-debugger-2.4.2.orig/backend/arch/bfdglue.c +++ mono-debugger-2.4.2/backend/arch/bfdglue.c @@ -1,3 +1,5 @@ +#include + #include #include #include @@ -227,7 +229,11 @@ bfd_glue_get_errormsg (void) guint32 bfd_glue_get_section_size (asection *p) { +#ifdef HAVE_ASECTION_RAWSIZE + return p->rawsize ? p->rawsize : p->size; +#else return p->_raw_size; +#endif } BfdGlueSectionFlags