pkg-config, which we used to help build matplotlib the other day (here).
The web page is here and there is a guide here.
As it says on the first page:
pkg-config is a helper tool used when compiling applications and libraries. It helps you insert the correct compiler options on the command line so an application can use gcc -o test test.c `pkg-config --libs --cflags glib-2.0` for instance, rather than hard-coding values on where to find glib (or other libraries). It is language-agnostic, so it can be used for defining the location of documentation tools, for instance.
And from the man page:
The pkg-config program is used to retrieve
information about installed libraries in the
system. It is typically used to compile and
link against one or more libraries. Here is a
typical usage scenario in a Makefile:
cc program.c $(pkg-config --cflags --libs gnomeui)
pkg-config retrieves information about pack-
ages from special metadata files. These files
are named after the package, and has a .pc
extension. On most systems, pkg-config looks
for these files. It will additionally look
in the colon-separated (on Windows, semicolon-
separated) list of directories specified by
the PKG_CONFIG_PATH environment variable.
The package name specified on the pkg-config
command line is defined to be the name of the
metadata file, minus the .pc extension. If a
library can install multiple versions simulta-
neously, it must give each version its own
name (for example, GTK 1.2 might have the
package name "gtk+" while GTK 2.0 has
What's happening is that the matplotlib
pkg-configif it's present. The binary is in
/usr/local/bin/pkg-config. It looks for a subdirectory of
.pcfiles for packages that specify metadata about themselves to take advantage of
We used Homebrew only to grab
pkg-config. You could get it yourself: 0.26 is the newest, but requires
glib-2.0; 0.25 bundles
pkg-config. 0.25 builds with no dependencies using the standard
./configure; make; make install. Download page for version 0.25 and 0.26 is here. Or of course, you can use Homebrew like we did.
Not clear why it doesn't ship with OS X. The license is GPLv2. But then, so is BASH.
Some minor issues:
• when I tried using
pkg-configon my iMac (Snow Leopard, littered with MacPorts and other stuff), matplotlib seemed to build and install but died with:
For reasons that I don't understand, the version of the file in the build directory
is not the same as the one in
Simply replacing the
site-packagesversion fixed the problem:
• the Homebrew "Formula" in
/usr/local/Library/Formula/pkg-config.rbtells the installed
pkg-configwhich paths to search for
I'm not quite sure how that would work for a manual install.
• the libpng in
/usr/local/libthat I installed shadowed the one in
/usr/X11/libso to use the X11 version, I removed the files from
• The notation
libpngdoes depend on
zlib, but it's already been linked against it (hence private). I'm not sure where it is, though.