Home | History | Annotate | Download | only in m4
      1 dnl AX_BINUTILS - check for needed binutils stuff
      2 
      3 AC_DEFUN([AX_BINUTILS],
      4 [
      5 dnl some distro have a libiberty.a but does not have a libiberty.h
      6 AC_CHECK_HEADERS(libiberty.h)
      7 AC_CHECK_LIB(iberty, cplus_demangle,, AC_MSG_ERROR([liberty library not found]))
      8 AC_CHECK_FUNCS(xcalloc)
      9 AC_CHECK_FUNCS(xmemdup)
     10 AC_CHECK_LIB(dl, dlopen, LIBS="$LIBS -ldl"; DL_LIB="-ldl", DL_LIB="")
     11 AC_CHECK_LIB(intl, main, LIBS="$LIBS -lintl"; INTL_LIB="-lintl", INTL_LIB="")
     12 
     13 AC_CHECK_LIB(bfd, bfd_openr, LIBS="-lbfd $LIBS"; Z_LIB="",
     14 	[AC_CHECK_LIB(z, compress,
     15 dnl Use a different bfd function here so as not to use cached result from above
     16 		[AC_CHECK_LIB(bfd, bfd_fdopenr, LIBS="-lbfd -lz $LIBS"; Z_LIB="-lz",
     17 			[AC_MSG_ERROR([bfd library not found])], -lz)
     18 		],
     19 		[AC_MSG_ERROR([libz library not found; required by libbfd])])
     20 	]
     21 )
     22 
     23 AC_LANG_PUSH(C)
     24 # Determine if bfd_get_synthetic_symtab macro is available
     25 OS="`uname`"
     26 if test "$OS" = "Linux"; then
     27 	AC_MSG_CHECKING([whether bfd_get_synthetic_symtab() exists in BFD library])
     28 	rm -f test-for-synth
     29 	AC_LANG_CONFTEST(
     30 		[AC_LANG_PROGRAM([[#include <bfd.h>]],
     31 			[[asymbol * synthsyms;	bfd * ibfd = 0; 
     32 			long synth_count = bfd_get_synthetic_symtab(ibfd, 0, 0, 0, 0, &synthsyms);
     33 			extern const bfd_target bfd_elf64_powerpc_vec;
     34 			extern const bfd_target bfd_elf64_powerpcle_vec;
     35 			char * ppc_name = bfd_elf64_powerpc_vec.name;
     36 			char * ppcle_name = bfd_elf64_powerpcle_vec.name;
     37 			printf("%s %s\n", ppc_name, ppcle_name);]])
     38 		])
     39 	$CC conftest.$ac_ext $CFLAGS $LDFLAGS $LIBS -o  test-for-synth > /dev/null 2>&1
     40 	if test -f test-for-synth; then
     41 		echo "yes"
     42 		SYNTHESIZE_SYMBOLS='1'
     43 	else
     44 		echo "no"
     45 		SYNTHESIZE_SYMBOLS='0'
     46 	fi
     47 	AC_DEFINE_UNQUOTED(SYNTHESIZE_SYMBOLS, $SYNTHESIZE_SYMBOLS, [Synthesize special symbols when needed])
     48 	rm -f test-for-synth*
     49 
     50 fi
     51 AC_LANG_POP(C)
     52 ]
     53 )
     54