2 # ----------------------
3 # Whether to use libbfd for debugging RTS
7 AC_DEFUN([FP_BFD_FLAG], [
9 AC_ARG_ENABLE(bfd-debug,
10 [AS_HELP_STRING([--enable-bfd-debug],
11 [Enable symbol resolution for -debug rts ('+RTS -Di') via binutils' libbfd [default=no]])],
17 # ----------------------
18 # Checks for libraries in the default way, which will define various
20 AC_DEFUN([FP_WHEN_ENABLED_BFD], [
21 # don't pollute general LIBS environment
23 AC_CHECK_HEADERS([bfd.h])
24 dnl ** check whether this machine has BFD and libiberty installed (used for debugging)
25 dnl the order of these tests matters: bfd needs libiberty
26 AC_CHECK_LIB(iberty, xmalloc)
27 dnl 'bfd_init' is a rare non-macro in libbfd
28 AC_CHECK_LIB(bfd, bfd_init)
34 /* mimic our rts/Printer.c */
39 name = "some.executable";
41 abfd = bfd_openr(name, "default");
42 bfd_check_format_matches (abfd, bfd_object, &matching);
45 storage_needed = bfd_get_symtab_upper_bound (abfd);
48 asymbol **symbol_table;
49 long number_of_symbols;
52 number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table);
53 bfd_get_symbol_info(abfd,symbol_table[0],&info);
56 [], dnl bfd seems to work
57 [AC_MSG_ERROR([can't use 'bfd' library])])