diff options
Diffstat (limited to 'config')
-rw-r--r-- | config/ChangeLog | 6 | ||||
-rw-r--r-- | config/pkg.m4 | 10 |
2 files changed, 12 insertions, 4 deletions
diff --git a/config/ChangeLog b/config/ChangeLog index 2cd61774cf1..f93d86a969b 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,6 +1,12 @@ 2020-07-28 H.J. Lu <hongjiu.lu@intel.com> PR binutils/26301 + * pkg.m4 (PKG_CHECK_MODULES): Use AC_TRY_LINK only if + $pkg_failed = no. + +2020-07-28 H.J. Lu <hongjiu.lu@intel.com> + + PR binutils/26301 * pkg.m4 (PKG_CHECK_MODULES): Add AC_TRY_LINK to check if $pkg_cv_[]$1[]_LIBS works. 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. |