From d70f978b44aafc22d87c0e72d0875008c3d9e311 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Tue, 28 Jul 2020 03:50:10 -0700 Subject: [PATCH] PKG_CHECK_MODULES: Check if $pkg_cv_[]$1[]_LIBS works It is quite normal to have headers without library on multilib OSes. Add AC_TRY_LINK to PKG_CHECK_MODULES to check if $pkg_cv_[]$1[]_LIBS works. config/ PR binutils/26301 * pkg.m4 (PKG_CHECK_MODULES): Add AC_TRY_LINK to check if $pkg_cv_[]$1[]_LIBS works. binutils/ PR binutils/26301 * configure: Regenerated. gdb/ PR binutils/26301 * configure: Regenerated. --- ChangeLog | 2 -- binutils/ChangeLog | 5 +++++ binutils/configure | 22 ++++++++++++++++++++++ config/ChangeLog | 11 +++++++++++ config/pkg.m4 | 6 ++++++ gdb/ChangeLog | 5 +++++ gdb/configure | 22 ++++++++++++++++++++++ 7 files changed, 71 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index aca3f52cdb3..3e0e274ba31 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,5 @@ 2020-07-24 Aaron Merey - * config/debuginfod.m4: use PKG_CHECK_MODULES. - * config/pkg.m4: New file. * configure: Rebuild. * configure.ac: Remove AC_DEBUGINFOD. diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 2522808763a..2c76b2aab0d 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2020-07-28 H.J. Lu + + PR binutils/26301 + * configure: Regenerated. + 2020-07-27 Alan Modra * objdump.c (dump_section): Don't return without calling diff --git a/binutils/configure b/binutils/configure index c9fc5108e02..4620a6b105d 100755 --- a/binutils/configure +++ b/binutils/configure @@ -12439,6 +12439,28 @@ fi pkg_failed=untried fi +pkg_save_LDFLAGS="$LDFLAGS" +LDFLAGS="$LDFLAGS $pkg_cv_DEBUGINFOD_LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + pkg_failed=no +else + pkg_failed=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LDFLAGS=$pkg_save_LDFLAGS + if test $pkg_failed = yes; then diff --git a/config/ChangeLog b/config/ChangeLog index 12795fc4973..2cd61774cf1 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,14 @@ +2020-07-28 H.J. Lu + + PR binutils/26301 + * pkg.m4 (PKG_CHECK_MODULES): Add AC_TRY_LINK to check if + $pkg_cv_[]$1[]_LIBS works. + +2020-07-24 Aaron Merey + + * debuginfod.m4: use PKG_CHECK_MODULES. + * pkg.m4: New file. + 2020-07-04 Nick Clifton Binutils 2.35 branch created. diff --git a/config/pkg.m4 b/config/pkg.m4 index 13a88901786..45587e97c8b 100644 --- a/config/pkg.m4 +++ b/config/pkg.m4 @@ -147,6 +147,12 @@ AC_MSG_CHECKING([for $2]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) +dnl Check whether $pkg_cv_[]$1[]_LIBS works. +pkg_save_LDFLAGS="$LDFLAGS" +LDFLAGS="$LDFLAGS $pkg_cv_[]$1[]_LIBS" +AC_TRY_LINK([],[return 0;], [pkg_failed=no], [pkg_failed=yes]) +LDFLAGS=$pkg_save_LDFLAGS + m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 234dc240786..defca83c263 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2020-07-28 H.J. Lu + + PR binutils/26301 + * configure: Regenerated. + 2020-07-28 Andrew Burgess * python/py-frame.c: Remove 'user-regs.h' include. diff --git a/gdb/configure b/gdb/configure index adcfa49c633..eb38aaacfca 100755 --- a/gdb/configure +++ b/gdb/configure @@ -7037,6 +7037,28 @@ fi pkg_failed=untried fi +pkg_save_LDFLAGS="$LDFLAGS" +LDFLAGS="$LDFLAGS $pkg_cv_DEBUGINFOD_LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + pkg_failed=no +else + pkg_failed=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LDFLAGS=$pkg_save_LDFLAGS + if test $pkg_failed = yes; then -- 2.30.2