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 ${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:
--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--modversion
pkg-config
returns its own version.--print-errors
--print-provides
--print-requires
--print-requires-private
--silence-errors
--static
--uninstalled
pkg-config
to be
used.--validate
--variable
name--version
pkg-config
and exit.PKG_CONFIG_DEBUG_SPEW
pkg-config
to print
various debugging information.PKG_CONFIG_DISABLE_UNINSTALLED
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.PKG_CONFIG_LIBDIR
pkg-config
search directory.PKG_CONFIG_LOG
pkg-config
will write the passed arguments.PKG_CONFIG_PATH
PKG_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_DIR
pkg-config
uses the specified value for
pc_top_builddir
instead of $(top_builddir).PKG_CONFIG_$PACKAGE_$VARIABLE
The 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.Whitespace
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.September 15, 2020 | OpenBSD-7.0 |