diff options
author | Jose E. Marchesi <jose.marchesi@oracle.com> | 2022-11-07 20:35:43 +0100 |
---|---|---|
committer | Jose E. Marchesi <jose.marchesi@oracle.com> | 2022-11-15 20:01:06 +0100 |
commit | 5218fa9e8937b007d554f1e01c2e4ecdb9b7e271 (patch) | |
tree | 9dae06d426e20b24f6bf2e98a4ab24c0f226eac7 /gdb/acinclude.m4 | |
parent | 2c2316c5fd2bf6310c21c1c88a940be8494d1870 (diff) | |
download | gdb-5218fa9e8937b007d554f1e01c2e4ecdb9b7e271.zip gdb-5218fa9e8937b007d554f1e01c2e4ecdb9b7e271.tar.gz gdb-5218fa9e8937b007d554f1e01c2e4ecdb9b7e271.tar.bz2 |
gdb: use libtool in GDB_AC_CHECK_BFD
The GDB_AC_CHECK_BFD macro defined in gdb/acinclude.m4 uses the
AC_LINK_IFELSE autoconf macro in order to link a simple program to
check features of libbfd.
If libbfd's link dependencies change, it was necessary to reflect them
either in the definition of the macro, or as a consequence of checking
for them with an autoconf macro resulting in an addition to LIBS.
This patch modifies the definition of the GDB_CHECK_BFD macro in order
to use libtool to perform the test link. This makes it possible to
not have to list dependencies of libbfd (which are indirect to GDB) at
all.
After this patch:
configure:28553: checking for ELF support in BFD
configure:28573: ./libtool --quiet --mode=link gcc -o conftest \
-I../../gdb/../include -I../bfd \
-I../../gdb/../bfd -g -O2 \
-L../bfd -L../libiberty conftest.c -lbfd -liberty \
-lncursesw -lm -ldl >&5
configure:28573: $? = 0
configure:28583: result: yes
Tests performed:
- Configure --with-system-zlib and --without-system-zlib.
- Check link dependencies of installed GDB with both --enable-shared
and --disable-shared.
- Run installed GDB in both cases.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb/acinclude.m4')
-rw-r--r-- | gdb/acinclude.m4 | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4 index 62fa66c..05106df 100644 --- a/gdb/acinclude.m4 +++ b/gdb/acinclude.m4 @@ -229,14 +229,15 @@ AC_DEFUN([GDB_AC_CHECK_BFD], [ OLD_CFLAGS=$CFLAGS OLD_LDFLAGS=$LDFLAGS OLD_LIBS=$LIBS + OLD_CC=$CC # 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" + LDFLAGS="-L../bfd -L../libiberty" intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'` - LIBS="-lbfd -liberty -lz $ZSTD_LIBS $intl $LIBS" + LIBS="-lbfd -liberty $intl $LIBS" + CC="./libtool --quiet --mode=link $CC" AC_CACHE_CHECK( [$1], [$2], @@ -252,6 +253,7 @@ AC_DEFUN([GDB_AC_CHECK_BFD], [ [[$2]=no] )] ) + CC=$OLD_CC CFLAGS=$OLD_CFLAGS LDFLAGS=$OLD_LDFLAGS LIBS=$OLD_LIBS]) |