Control: tags -1 patch

On Sat, 2013-12-21 at 12:24:49 -0800, Russ Allbery wrote:
> Package: pkg-config
> Version: 0.26-1
> Severity: minor

> In Autoconf output from PKG_CHECK_MODULES in pkg.m4, the "checking for"
> message refers to the first argument of PKG_CHECK_MODULES, the variable
> prefix, instead of the second argument, the module being checked for.
> 
> I've seen this result in strange output (like ALL CAPS module names) in
> various packages, and now have run into it in one of mine.  When
> probing for the libsystemd-daemon module, one can't use a variable
> prefix that matches the module name (since - isn't allowed in variable
> names), so the Autoconf output is going to refer to something odd, like
> SYSTEMD_DAEMON or libsystemd_daemon.
> 
> I think the status output should reference the module name being
> probed for, both because it looks nicer and because, when debugging
> problems, this references the actual thing being probed for on the
> system, rather than an internal implementation detail.

I agree wholeheartedly! I guess one possible objection is that this is
not that internal, as that name is also used by the AC_ARG_VARs so
that the user can override the values, but still, this does not match
with other checks such as the compiler which prints the actual program
instead of CC.

I noticed this bug report some time ago, but I've got bothered enough
now to try to move it forward. And I've turned the above description
and the below "patch"…

> This could be easily done by changing the line:
> 
>     AC_MSG_CHECKING([for $1])
> 
> in pkg.m4 to:
> 
>     AC_MSG_CHECKING([for $2])

…into a git formatted patch (against current master). But because
I've actually reworded things a bit, and I feel like I've actually put
words in Russ' mouth, I'd rather you'd take a look before considering
forwarding it upstream! I'll also very happily defer if you'd want to
do that yourself!

Patch attached.

Thanks,
Guillem
From fcdcf0d60ea52a4cfd636046e049c11cdc4497a9 Mon Sep 17 00:00:00 2001
From: Russ Allbery <r...@debian.org>
Date: Thu, 22 Sep 2016 23:44:02 +0200
Subject: [PATCH] Make PKG_CHECK_MODULES report the module name instead of the
 variable prefix
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

In Autoconf output from PKG_CHECK_MODULES in pkg.m4, the "checking for"
message refers to the first argument of PKG_CHECK_MODULES, the variable
prefix, instead of the second argument, the module being checked for.

This results in strange output (like ALL CAPS module names) in various
packages. And when probing for modules, one can't always use a variable
prefix that matches the module name (since ‘-’ and other characters
aren't allowed in variable names), so the Autoconf output is going to
refer to something odd.

The status output should reference the module name being probed for,
both because it looks nicer and because, when debugging problems, this
references the actual thing being probed for on the system, rather than
an internal implementation detail.

Signed-off-by: Guillem Jover <guil...@hadrons.org>
---
 pkg.m4.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkg.m4.in b/pkg.m4.in
index eb44361..2b341dd 100644
--- a/pkg.m4.in
+++ b/pkg.m4.in
@@ -142,7 +142,7 @@ AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
 AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
 
 pkg_failed=no
-AC_MSG_CHECKING([for $1])
+AC_MSG_CHECKING([for $2])
 
 _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
 _PKG_CONFIG([$1][_LIBS], [libs], [$2])
-- 
2.9.3

Reply via email to