aboutsummaryrefslogtreecommitdiff
path: root/config/pkg.m4
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2020-07-28 06:59:20 -0700
committerH.J. Lu <hjl.tools@gmail.com>2020-07-28 06:59:30 -0700
commit377170fa319d39d5442b674fc978adc8f24db5e9 (patch)
treee89927bdb3250038a3eb7abce9d586e57acfba92 /config/pkg.m4
parent866b34a12df543caae10dd5a8de988e40ee012cd (diff)
downloadgdb-377170fa319d39d5442b674fc978adc8f24db5e9.zip
gdb-377170fa319d39d5442b674fc978adc8f24db5e9.tar.gz
gdb-377170fa319d39d5442b674fc978adc8f24db5e9.tar.bz2
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.
Diffstat (limited to 'config/pkg.m4')
-rw-r--r--config/pkg.m410
1 files changed, 6 insertions, 4 deletions
diff --git a/config/pkg.m4 b/config/pkg.m4
index 45587e9..7ebf517 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.