fetch metadata about installed software
||[options] pkg-name [pkg-name ...]|
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
metadata. Libraries from base install their metadata in
/usr/lib/pkgconfig; packages controlled by the
ports(7) system store their metadata in
/usr/local/share/pkgconfig; the X Window System
stores its metadata in /usr/X11R6/lib/pkgconfig and
pkg-config utility will search these locations by
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:
- Exit with error if the version of
pkg-configis not greater than or equal to the specified 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.
- 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.
- 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.
- Exit with error if the specified package's version is greater than the specified version.
- Fetch package version. If no package is given,
pkg-configreturns 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-configto be used.
- Validate the package without processing its dependencies.
- Fetch the value of the named variable.
- Print version of
- If set, this will cause
pkg-configto print various debugging information.
- By default
pkg-configprefers 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
- This is used to specify a log file to which
pkg-configwill 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
-Lto 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
- When set to a list of paths, separated by :, these paths will be excluded
from the output of include paths set with
- If set,
pkg-configuses the specified value for pc_top_builddir instead of $(top_builddir).
- Override the $VARIABLE in $PACKAGE with the given value.
pkg-config utility exits 0 on
success, and >0 if an error occurs.
pkg-config utility first appeared in
pkg-config was written by
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
and Jasper Lievisse Adriaanse
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
- 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
Cflags and -i
-iflag that can be encountered in Cflags is not treated differently from
-Iin this implementation.
pkg-configdoes 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.