aboutsummaryrefslogtreecommitdiff
path: root/gdb/acinclude.m4
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-01-02 14:54:17 +0000
committerTom Tromey <tromey@redhat.com>2013-01-02 14:54:17 +0000
commitdef63ff00a1e687b2463b4ec6ce249722223242e (patch)
treeb4e99cefbe56617fb61a34f208126991ab33b0d0 /gdb/acinclude.m4
parent517bb291f28f940b186e9dc899eb621f71839e82 (diff)
downloadgdb-def63ff00a1e687b2463b4ec6ce249722223242e.zip
gdb-def63ff00a1e687b2463b4ec6ce249722223242e.tar.gz
gdb-def63ff00a1e687b2463b4ec6ce249722223242e.tar.bz2
* acinclude.m4 (GDB_AC_CHECK_BFD): New macro.
* configure.ac: Use GDB_AC_CHECK_BFD. * configure: Rebuild.
Diffstat (limited to 'gdb/acinclude.m4')
-rw-r--r--gdb/acinclude.m434
1 files changed, 34 insertions, 0 deletions
diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
index c9b32a0..5399e40 100644
--- a/gdb/acinclude.m4
+++ b/gdb/acinclude.m4
@@ -421,3 +421,37 @@ AC_DEFUN([GDB_AC_WITH_DIR], [
AC_SUBST([$1])
GDB_AC_DEFINE_RELOCATABLE([$1], [$2], ${ac_define_dir})
])
+
+dnl GDB_AC_CHECK_BFD([MESSAGE], [CV], [CODE], [HEADER])
+dnl Check whether BFD provides a feature.
+dnl MESSAGE is the "checking" message to display.
+dnl CV is the name of the cache variable where the result is stored.
+dnl The result will be "yes" or "no".
+dnl CODE is some code to compile that checks for the feature.
+dnl A link test is run.
+dnl HEADER is the name of an extra BFD header to include.
+AC_DEFUN([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"
+ LDFLAGS="-L../bfd -L../libiberty $LDFLAGS"
+ intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
+ # -ldl is provided by bfd/Makfile.am (LIBDL) <PLUGINS>.
+ if test "$plugins" = "yes"; then
+ LIBS="-ldl $LIBS"
+ fi
+ LIBS="-lbfd -liberty $intl $LIBS"
+ AC_CACHE_CHECK([$1], [$2],
+ [AC_TRY_LINK(
+ [#include <stdlib.h>
+ #include "bfd.h"
+ #include "$4"
+ ],
+ [return $3;], [[$2]=yes], [[$2]=no])])
+ CFLAGS=$OLD_CFLAGS
+ LDFLAGS=$OLD_LDFLAGS
+ LIBS=$OLD_LIBS])