--atleast-pkgconfig-version widely misused

Martin Unsal martinunsal at gmail.com
Tue Mar 30 17:42:35 PDT 2010


Hi all,

I'm running into a bug but I'm not sure if it's properly considered a bug in
pkg-config, or in a widely used aclocal.m4 test, or (I believe) both. I
wanted to run this past the developers and see what you think.

1) The bug in pkg-config is that it expects a command line of the form:
 $ pkgconfig --atleast-pkgconfig-version=0.9.0
but silently accepts (and misparses) a command line of the form:
 $ pkgconfig --atleast-pkgconfig-version 0.9.0

Consider the following. All but the last invocation produce the expected
result. The last invocation produces an unexpected result, and is arguably a
bug.

$ ./pkg-config --version
0.23
$ ./pkg-config --atleast-pkgconfig-version=0.24.0
$ echo $?
1
$ ./pkg-config --atleast-pkgconfig-version 0.24.0
$ echo $?
1
$ ./pkg-config --define-variable=0=0 --atleast-pkgconfig-version=0.24.0
$ echo $?
1
$ ./pkg-config --define-variable=0=0 --atleast-pkgconfig-version 0.24.0
$ echo $?
0

Digging further indicates that the first three invocations call
compare_versions("0.23", "0.24.0") returning -1, whereas the last invocation
calls compare_versions("0.23", "0=0") returning 1.

2) The bug in aclocal.m4 tests is simply that it invokes
--atleast-pkgconfig-version with the wrong syntax. This is widespread,
almost everywhere pkg-config is used by configure, in the
PKG_PROG_PKG_CONFIG macro.

I ran into this problem doing something like this:

PKG_CONFIG="/usr/bin/pkg-config --define-variable=prefix=/foo/bar"
./configure

... which does not function as expected and I believe is a perfectly
reasonable thing to expect to do with pkg-config and configure!

What do you think?

Thanks,
Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pkg-config/attachments/20100330/f4f6f6b4/attachment.html>


More information about the pkg-config mailing list