OpenBSD manual page server

Manual Page Search Parameters

PKG-CONFIG(1) General Commands Manual PKG-CONFIG(1)

pkg-configfetch metadata about installed software packages

pkg-config [options] pkg-name [pkg-name ...]

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.

The options are as follows:

version
Exit with error if the version of pkg-config is not greater than or equal to the specified version.
version
Exit with error if the specified package's version is not greater than or equal to the specified version.
Return all compiler flags required to compile against the package.
Return only the include path flags required to compile against the package.
Return all compiler flags, other than the include path flags, required to compile against the package.
Enable internal development and debugging messages.
Direct error messages to stdout rather than stderr.
version
Exit with error if the specified packages's version does not equal the specified version.
Return true if all the specified packages are installed. This is the default operation.
| --usage
Print a help message and exit.
Return all linker flags required to link against the package.
Return only the library path (-L/path/to/lib) flags required to link against the package.
Return only the library (-lwhatever) flags required to link against the package.
Return linker flags, other than the library and path flags, required to compile against the package.
List all installed packages and exit.
version
Exit with error if the specified package's version is greater than the specified version.
Fetch package version. If no package is given, pkg-config returns its own version.
Print error messages and exit with an error when errors occur. This is the default operation.
Print all the modules the given package provides.
Print all the modules the given package requires.
Print all the modules the given package requires for static linking.
Do not print error messages, just exit with an error.
Return the compiler and/or linker flags required for static linking.
Allow packages not controlled by pkg-config to be used.
name
Fetch the value of the named variable.
Print version of pkg-config and exit.

If set, this will cause pkg-config to print various debugging information.
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 can be used to specify a colon-separated list of paths to search for package files. This will replace the default pkg-config search directory.
This is used to specify a log file to which pkg-config will write the passed arguments.
This can be used to specify a colon-separated list of paths to search for package files. If given, this list of paths is prepended to the standard search path.
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.
If set pkg-config uses the specified value for instead of $(top_builddir).

The pkg-config utility exits 0 on success, and >0 if an error occurs.

pkg_info(1), ports(7)

The pkg-config utility first appeared in OpenBSD 4.1.

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>.

pkg-config is a re-implementation of the "original" freedesktop.org program. While it tries to be compatible, there are several design/functionality differences one should be aware of:

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.
The -i flag that can be encountered in Cflags is not treated differently from -I in this implementation.
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.
July 16, 2013 OpenBSD-5.5