| PKG-CONFIG(1) | General Commands Manual | PKG-CONFIG(1) |
pkg-config — fetch
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 /usr/local/lib/pkgconfig and
/usr/local/share/pkgconfig; the X Window System
stores its metadata in /usr/X11R6/lib/pkgconfig and
/usr/X11R6/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:
--atleast-pkgconfig-version
versionpkg-config is
not greater than or equal to the specified version.--atleast-version
version--cflags--cflags-only-I--cflags-only-other--debug--errors-to-stdout--exact-version
version--exists--help
|
--usage--libs--libs-only-L--libs-only-l--libs-only-other--list-all--max-version
version--modversionpkg-config returns its own version.--print-errors--print-provides--print-requires--print-requires-private--silence-errors--static--uninstalledpkg-config to be
used.--validate--variable
name--versionpkg-config and exit.PKG_CONFIG_DEBUG_SPEWpkg-config to print
various debugging information.PKG_CONFIG_DISABLE_UNINSTALLEDpkg-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.PKG_CONFIG_LIBDIRpkg-config search directory.PKG_CONFIG_LOGpkg-config will write the passed arguments.PKG_CONFIG_PATHPKG_CONFIG_SYSROOT_DIR-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_SYSTEM_INCLUDE_PATH-I.PKG_CONFIG_TOP_BUILD_DIRpkg-config uses the specified value for
pc_top_builddir
instead of $(top_builddir).PKG_CONFIG_$PACKAGE_$VARIABLEThe pkg-config utility exits 0 on
success, and >0 if an error occurs.
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:
Conflicts--print-errors is passed.Cflags
and -i-i flag that can be encountered in Cflags is
not treated differently from -I in this
implementation.Whitespacepkg-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.| March 31, 2022 | openbsd |