From 377170fa319d39d5442b674fc978adc8f24db5e9 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Tue, 28 Jul 2020 06:59:20 -0700 Subject: [PATCH] PKG_CHECK_MODULES: Properly check if $pkg_cv_[]$1[]_LIBS works There is no need to check $pkg_cv_[]$1[]_LIBS works if package check failed. config/ PR binutils/26301 * pkg.m4 (PKG_CHECK_MODULES): Use AC_TRY_LINK only if $pkg_failed = no. binutils/ PR binutils/26301 * configure: Regenerated. gdb/ PR binutils/26301 * configure: Regenerated. --- binutils/ChangeLog | 5 +++++ binutils/configure | 14 ++++++++------ config/ChangeLog | 6 ++++++ config/pkg.m4 | 10 ++++++---- gdb/ChangeLog | 5 +++++ gdb/configure | 14 ++++++++------ 6 files changed, 38 insertions(+), 16 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 2c76b2aab0d..5d32d262c03 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -3,6 +3,11 @@ PR binutils/26301 * configure: Regenerated. +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 4620a6b105d..18316b7696d 100755 --- a/binutils/configure +++ b/binutils/configure @@ -12439,27 +12439,29 @@ fi pkg_failed=untried fi -pkg_save_LDFLAGS="$LDFLAGS" -LDFLAGS="$LDFLAGS $pkg_cv_DEBUGINFOD_LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +if test $pkg_failed = no; then + 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 + LDFLAGS=$pkg_save_LDFLAGS +fi diff --git a/config/ChangeLog b/config/ChangeLog index 2cd61774cf1..f93d86a969b 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,9 @@ +2020-07-28 H.J. Lu + + PR binutils/26301 + * pkg.m4 (PKG_CHECK_MODULES): Use AC_TRY_LINK only if + $pkg_failed = no. + 2020-07-28 H.J. Lu PR binutils/26301 diff --git a/config/pkg.m4 b/config/pkg.m4 index 45587e97c8b..7ebf517cd6a 100644 --- a/config/pkg.m4 +++ b/config/pkg.m4 @@ -148,10 +148,12 @@ _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 +if test $pkg_failed = no; then + pkg_save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $pkg_cv_[]$1[]_LIBS" + AC_TRY_LINK([],[], [], [pkg_failed=yes]) + LDFLAGS=$pkg_save_LDFLAGS +fi m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. diff --git a/gdb/ChangeLog b/gdb/ChangeLog index defca83c263..96ffac92573 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -3,6 +3,11 @@ PR binutils/26301 * configure: Regenerated. +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 eb38aaacfca..5ef85e8c866 100755 --- a/gdb/configure +++ b/gdb/configure @@ -7037,27 +7037,29 @@ fi pkg_failed=untried fi -pkg_save_LDFLAGS="$LDFLAGS" -LDFLAGS="$LDFLAGS $pkg_cv_DEBUGINFOD_LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +if test $pkg_failed = no; then + 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 + LDFLAGS=$pkg_save_LDFLAGS +fi -- 2.30.2