.\"	$OpenBSD: pkg-config.1,v 1.13 2007/05/31 19:20:14 jmc Exp $
.\"
.\"	Copyright (c) 2006 Chris Kuethe <ckuethe@openbsd.org>
.\"
.\"	Permission to use, copy, modify, and distribute this software for any
.\"	purpose with or without fee is hereby granted, provided that the above
.\"	copyright notice and this permission notice appear in all copies.
.\"
.\"	THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\"	WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\"	MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\"	ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\"	WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\"	ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\"	OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: May 31 2007 $
.Dt PKG-CONFIG 1
.Os
.Sh NAME
.Nm pkg-config
.Nd fetch metadata about installed software packages
.Sh SYNOPSIS
.Nm pkg-config
.Op Ar options
.Ar pkg-name Op Ar pkg-name ...
.Sh DESCRIPTION
The
.Nm
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.
.Pp
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
.Nm
metadata.
Packages controlled by the
.Xr ports 7
system store their metadata, if provided, in
.Pa ${LOCALBASE}/lib/pkgconfig ;
the X Window System stores its metadata in
.Pa ${X11BASE}/lib/pkgconfig .
The
.Nm
utility will search these locations by default.
.Pp
Because
.Nm
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.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Cm --atleast-pkgconfig-version Ar version
Exit with error if the version of
.Nm
is not greater than or equal to the specified version.
.It Cm --atleast-version Ar version
Exit with error if the specified package's version is not greater than
or equal to the specified version.
.It Cm --cflags
Return all compiler flags required to compile against the package.
.It Cm --cflags-only-I
Return only the include path flags required to compile against the package.
.It Cm --cflags-only-other
Return all compiler flags, other than the include path flags, required to
compile against the package.
.It Cm --debug
Enable internal development and debugging messages.
.It Cm --errors-to-stdout
Direct error messages to stdout rather than stderr.
.It Cm --exists
Return true if all the specified packages are installed.
This is the default operation.
.It Cm --help \*(Ba --usage
Print a help message and exit.
.It Cm --libs
Return all linker flags required to link against the package.
.It Cm --libs-only-L
Return only the library path (-L/path/to/lib) flags required to link
against the package.
.It Cm --libs-only-l
Return only the library (-lwhatever) flags required to link against
the package.
.It Cm --libs-only-other
Return linker flags, other than the library and path flags, required to
compile against the package.
.It Cm --list-all
List all installed packages and exit.
.It Cm --modversion
Fetch package version.
If no package is given,
.Nm
returns its own version.
.It Cm --print-errors
Print error messages and exit with an error when errors occur.
This is the default operation.
.It Cm --silence-errors
Do not print error messages, just exit with an error.
.It Cm --static
Return the compiler and/or linker flags required for static linking.
.It Cm --uninstalled
Allow packages not controlled by
.Nm
to be used.
.It Cm --variable Ar name
Fetch the value of the named variable.
.It Cm --version
Print version of
.Nm
and exit.
.El
.Pp
.Ex -std pkg-config
.Sh ENVIRONMENT
.Bl -tag -width PKG_CONFIG_PATH
.It Ev PKG_CONFIG_PATH
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.
.El
.Sh SEE ALSO
.Xr pkg_info 1 ,
.Xr ports 7
.Sh HISTORY
The
.Nm
utility first appeared in
.Ox 4.1 .