pkg-config --exists does not check Requires: any longer

Peter O'Gorman pkg-config at
Thu Feb 17 10:29:26 PST 2011


We do builds with each package in its own prefix, which means that we
often end up setting a long PKG_CONFIG_PATH, sometimes we miss a
dir that contains a required .pc file, and that used to be fine, as
PKG_CHECK_MODULES() would complain, we'd add the dir and rinse and

We recently updated our pkg-config from 0.23 to 0.25 and find that
PKG_CHECK_MODULES no longer complains if a dir is missing, and the
_CFLAGS and _LIBS for the module end up empty.

It appears to be due to this change:
        * pkg.[ch], main.c, check/check-missing: Don't recurse Requires at
        all unless we need to.  Add check.  Again, thanks to Loïc Minier
        for most of the idea and the implementation.

For example (having set PKG_CONFIG_PATH, but not including the path to
% pkg-config --exists libxml-2.0
% echo $?
% pkg-config --cflags libxml-2.0
Package libiconv was not found in the pkg-config search path.
Perhaps you should add the directory containing `libiconv.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libiconv', required by 'libXML', not found

We have worked around this, patch below, but wonder if the above
behaviour is intentional?

Peter O'Gorman
pogma at

Index: main.c
--- main.c.orig 2010-05-10 17:58:57.000000000 +0000
+++ main.c      2011-02-17 17:59:00.949717873 +0000
@@ -406,7 +406,7 @@
   /* ignore Requires if no Cflags or Libs are requested */
-  if (!want_I_cflags && !want_other_cflags && !want_cflags &&
+  if (!want_exists && !want_I_cflags && !want_other_cflags && !want_cflags &&
       !want_libs && !want_l_libs && !want_L_libs && !want_requires)

More information about the pkg-config mailing list