The pkg-config utility retrieves metadata about the
installation of software packages. This metadata includes version, compiler
and linker flags, and dependency information. It is inspired by, and intended
to operate as a drop-in replacement to, the program of the same name available
from freedesktop.org.

Metadata is stored in files named after the package they describe; the Yoyodyne
package would likely be described by "yoyodyne.pc". Not all software
packages provide pkg-config metadata. Libraries
from base install their metadata in
/usr/lib/pkgconfig; packages controlled by the
ports(7) system store their
metadata in ${LOCALBASE}/lib/pkgconfig and
${LOCALBASE}/share/pkgconfig; the X Window System
stores its metadata in ${X11BASE}/lib/pkgconfig
and ${X11BASE}/share/pkgconfig. The
pkg-config utility will search these locations by
default.

Because pkg-config attempts to output the full set
of compiler or linker flags required to use a package, it will also output the
flags required for any prerequisite packages. If the "foo" package
depends on the "bar" package, "pkg-config --cflags foo"
might output something like "-I/usr/local/include/foo
-I/usr/local/include/bar", even though the compiler flags for
"bar" were not explicitly requested.

By default pkg-config prefers
a package named "foo-uninstalled" over "foo" when the
package "foo" is requested. This allows linking/compiling
against uninstalled packages. Setting this flag disables the default
behaviour.

This modifies -I and
-L to use the target sysroot directory. Thus
-I/usr/local/include will become -I/target/usr/local/include when
PKG_CONFIG_SYSROOT_DIR is set to /target, which is useful when cross
compiling packages that use pkg-config.

pkg-config was written by
Chris Kuethe
<ckuethe@openbsd.org>
as a replacement for the original freedesktop.org
pkg-config implementation. It was later extended
and kept in sync (where relevant) with the original version by
Marc Espie
<espie@openbsd.org>
and
Jasper Lievisse Adriaanse
<jasper@openbsd.org>.

It was decided not to support the Conflicts keyword as
there is currently too little benefit from it in
OpenBSD where the ports tree is supposed to
prevent conflicts from arising in the first place. Lines with this keyword
are not treated as errors, they are just ignored. And they are not taken
into account when --print-errors is
passed.

pkg-config does not go to
great lengths to try to fix whitespace abuse. Whitespace in Libs and
Cflags lines that are escaped using \ are treated correctly. But strings
enclosed in quotation marks that contain whitespaces are not.