From: "Arsen Arsenović" <arsen@aarsen.me>
To: gcc-patches@gcc.gnu.org
Cc: "H.J. Lu" <hjl.tools@gmail.com>
Subject: [PATCH 21/24] PKG_CHECK_MODULES: Properly check if $pkg_cv_[]$1[]_LIBS works
Date: Mon, 7 Aug 2023 12:33:03 +0200 [thread overview]
Message-ID: <20230807105935.2098236-22-arsen@aarsen.me> (raw)
In-Reply-To: <20230807105935.2098236-1-arsen@aarsen.me>
From: "H.J. Lu" <hjl.tools@gmail.com>
There is no need to check $pkg_cv_[]$1[]_LIBS works if package check
failed.
config/ChangeLog:
* pkg.m4 (PKG_CHECK_MODULES): Use AC_TRY_LINK only if
$pkg_failed = no.
---
config/pkg.m4 | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
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.
--
2.41.0
next prev parent reply other threads:[~2023-08-07 11:19 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-07 10:32 [PATCH 00/24] Sync shared build infrastructure with binutils-gdb Arsen Arsenović
2023-08-07 10:32 ` [PATCH 01/24] toplevel: Substitute GDCFLAGS instead of using CFLAGS Arsen Arsenović
2023-08-07 17:30 ` Jeff Law
2023-08-07 10:32 ` [PATCH 02/24] PR29961, plugin-api.h: "Could not detect architecture endianess" Arsen Arsenović
2023-08-07 19:16 ` Jeff Law
2023-08-07 10:32 ` [PATCH 03/24] gcc-4.5 build fixes Arsen Arsenović
2023-08-07 17:31 ` Jeff Law
2023-08-07 20:06 ` Eric Gallager
2023-08-07 10:32 ` [PATCH 04/24] Sync with binutils: GCC: Pass --plugin to AR and RANLIB Arsen Arsenović
2023-08-07 19:15 ` Jeff Law
2023-08-07 10:32 ` [PATCH 05/24] GCC: Check if AR works with --plugin and rc Arsen Arsenović
2023-08-07 17:41 ` Jeff Law
2023-08-07 10:32 ` [PATCH 06/24] toplevel: Recover tilegx/tilepro targets Arsen Arsenović
2023-08-07 17:42 ` Jeff Law
2023-08-07 20:07 ` Eric Gallager
2023-08-07 10:32 ` [PATCH 07/24] binutils, gdb: support zstd compressed debug sections Arsen Arsenović
2023-08-07 17:43 ` Jeff Law
2023-08-07 10:32 ` [PATCH 08/24] configure: require libzstd >= 1.4.0 Arsen Arsenović
2023-08-07 17:43 ` Jeff Law
2023-08-07 10:32 ` [PATCH 09/24] add --enable-default-compressed-debug-sections-algorithm configure option Arsen Arsenović
2023-08-07 17:53 ` Jeff Law
2023-08-07 10:32 ` [PATCH 10/24] gprofng: a new GNU profiler Arsen Arsenović
2023-08-07 17:44 ` Jeff Law
2023-08-07 10:32 ` [PATCH 11/24] Disable year 2038 support on 32-bit hosts by default Arsen Arsenović
2023-08-07 17:45 ` Jeff Law
2023-08-08 13:36 ` Luis Machado
2023-08-07 10:32 ` [PATCH 12/24] Pass PKG_CONFIG_PATH down from top-level Makefile Arsen Arsenović
2023-08-07 17:47 ` Jeff Law
2023-08-07 10:32 ` [PATCH 13/24] configure: reinstate 32b PA-RISC HP-UX target in toplevel Arsen Arsenović
2023-08-07 17:50 ` Jeff Law
2023-08-07 10:32 ` [PATCH 14/24] libtool.m4: fix nm BSD flag detection Arsen Arsenović
2023-08-07 19:13 ` Jeff Law
2023-08-07 22:03 ` Nick Alcock
2023-08-07 10:32 ` [PATCH 15/24] libtool.m4: fix the NM="/nm/over/here -B/option/with/path" case Arsen Arsenović
2023-08-07 19:12 ` Jeff Law
2023-08-07 10:32 ` [PATCH 16/24] Add support for the haiku operating system Arsen Arsenović
2023-08-07 17:51 ` Jeff Law
2023-08-07 10:32 ` [PATCH 17/24] egrep in binutils Arsen Arsenović
2023-08-07 17:52 ` Jeff Law
2023-08-07 10:33 ` [PATCH 18/24] PR27116, Spelling errors found by Debian style checker Arsen Arsenović
2023-08-07 17:52 ` Jeff Law
2023-08-07 10:33 ` [PATCH 19/24] Deprecate a.out support for NetBSD targets Arsen Arsenović
2023-08-07 18:01 ` Jeff Law
2023-08-07 10:33 ` [PATCH 20/24] PKG_CHECK_MODULES: Check if $pkg_cv_[]$1[]_LIBS works Arsen Arsenović
2023-08-07 17:54 ` Jeff Law
2023-08-07 10:33 ` Arsen Arsenović [this message]
2023-08-07 17:54 ` [PATCH 21/24] PKG_CHECK_MODULES: Properly check " Jeff Law
2023-08-07 10:33 ` [PATCH 22/24] libtool.m4: augment symcode for Solaris 11 Arsen Arsenović
2023-08-07 18:01 ` Jeff Law
2023-08-07 10:33 ` [PATCH 23/24] bfd: linker: merge .sframe sections Arsen Arsenović
2023-08-07 17:59 ` Jeff Law
2023-08-07 10:33 ` [PATCH 24/24] toplevel: Makefile.def: add install-strip dependency on libsframe Arsen Arsenović
2023-08-07 18:00 ` Jeff Law
2023-08-07 21:08 ` Arsen Arsenović
2023-08-07 19:54 ` [PATCH 00/24] Sync shared build infrastructure with binutils-gdb Eric Gallager
2023-08-07 23:03 ` Arsen Arsenović
2023-08-08 19:41 ` Joseph Myers
2023-08-08 22:26 ` Iain Sandoe
2023-08-08 23:10 ` Arsen Arsenović
2023-08-09 20:29 ` Joseph Myers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230807105935.2098236-22-arsen@aarsen.me \
--to=arsen@aarsen.me \
--cc=gcc-patches@gcc.gnu.org \
--cc=hjl.tools@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).