From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (wildebeest.demon.nl [212.238.236.112]) by sourceware.org (Postfix) with ESMTPS id 924C83842402; Tue, 28 Jul 2020 12:54:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 924C83842402 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mark@klomp.org Received: from tarox.wildebeest.org (tarox.wildebeest.org [172.31.17.39]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id A1D53321A59E; Tue, 28 Jul 2020 14:54:11 +0200 (CEST) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id 5FEE74001E0C; Tue, 28 Jul 2020 14:54:11 +0200 (CEST) Message-ID: Subject: Re: V2 [PATCH] PKG_CHECK_MODULES: Check if $pkg_cv_[]$1[]_LIBS works From: Mark Wielaard To: "H.J. Lu" , Aaron Merey Cc: Simon Marchi , Tom Tromey , GCC Patches , Aaron Merey via Binutils , GDB Date: Tue, 28 Jul 2020 14:54:11 +0200 In-Reply-To: References: <20200502022903.175852-1-amerey@redhat.com> <3d9da16939fa6b503188033b56d30531e03d5d2a.camel@redhat.com> <87a72ino27.fsf@tromey.com> <64517fee-8b8f-84b2-a116-c3d146ff1119@simark.ca> <87eep4hp3s.fsf@tromey.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Evolution 3.28.5 (3.28.5-8.el7) Mime-Version: 1.0 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2020 12:54:14 -0000 Hi, On Mon, 2020-07-27 at 12:32 -0700, H.J. Lu via Binutils wrote: > diff --git a/config/pkg.m4 b/config/pkg.m4 > index 13a8890178..45587e97c8 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]) > =20 > +dnl Check whether $pkg_cv_[]$1[]_LIBS works. > +pkg_save_LDFLAGS=3D"$LDFLAGS" > +LDFLAGS=3D"$LDFLAGS $pkg_cv_[]$1[]_LIBS" > +AC_TRY_LINK([],[return 0;], [pkg_failed=3Dno], [pkg_failed=3Dyes]) > +LDFLAGS=3D$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.]) This hunk seems wrong. You are testing whether the $pkg_cv_[]$1[]_LIBS flags work, but they might be empty if the library wasn't found (pkg_failed=3Dyes). Then the AC_TRY_LINK will obviously succeed, and then you set pkg_failed=3Dno. But that indicates that the library was found. Cheers, Mark