xref: /openbsd/usr.bin/pkg-config/pkg-config.1 (revision 404b540a)
1.\"	$OpenBSD: pkg-config.1,v 1.13 2007/05/31 19:20:14 jmc Exp $
2.\"
3.\"	Copyright (c) 2006 Chris Kuethe <ckuethe@openbsd.org>
4.\"
5.\"	Permission to use, copy, modify, and distribute this software for any
6.\"	purpose with or without fee is hereby granted, provided that the above
7.\"	copyright notice and this permission notice appear in all copies.
8.\"
9.\"	THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\"	WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\"	MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\"	ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\"	WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\"	ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\"	OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: May 31 2007 $
18.Dt PKG-CONFIG 1
19.Os
20.Sh NAME
21.Nm pkg-config
22.Nd fetch metadata about installed software packages
23.Sh SYNOPSIS
24.Nm pkg-config
25.Op Ar options
26.Ar pkg-name Op Ar pkg-name ...
27.Sh DESCRIPTION
28The
29.Nm
30utility retrieves metadata about the installation of software packages.
31This metadata includes version, compiler and linker flags, and dependency
32information.
33It is inspired by, and intended to operate as a drop-in replacement to,
34the program of the same name available from freedesktop.org.
35.Pp
36Metadata is stored in files named after the package they describe; the
37Yoyodyne package would likely be described by "yoyodyne.pc".
38Not all software packages provide
39.Nm
40metadata.
41Packages controlled by the
42.Xr ports 7
43system store their metadata, if provided, in
44.Pa ${LOCALBASE}/lib/pkgconfig ;
45the X Window System stores its metadata in
46.Pa ${X11BASE}/lib/pkgconfig .
47The
48.Nm
49utility will search these locations by default.
50.Pp
51Because
52.Nm
53attempts to output the full set of compiler or linker flags required to
54use a package, it will also output the flags required for any prerequisite
55packages.
56If the "foo" package depends on the "bar" package, "pkg-config --cflags foo"
57might output something like "-I/usr/local/include/foo
58-I/usr/local/include/bar", even though the compiler flags for "bar" were not
59explicitly requested.
60.Pp
61The options are as follows:
62.Bl -tag -width Ds
63.It Cm --atleast-pkgconfig-version Ar version
64Exit with error if the version of
65.Nm
66is not greater than or equal to the specified version.
67.It Cm --atleast-version Ar version
68Exit with error if the specified package's version is not greater than
69or equal to the specified version.
70.It Cm --cflags
71Return all compiler flags required to compile against the package.
72.It Cm --cflags-only-I
73Return only the include path flags required to compile against the package.
74.It Cm --cflags-only-other
75Return all compiler flags, other than the include path flags, required to
76compile against the package.
77.It Cm --debug
78Enable internal development and debugging messages.
79.It Cm --errors-to-stdout
80Direct error messages to stdout rather than stderr.
81.It Cm --exists
82Return true if all the specified packages are installed.
83This is the default operation.
84.It Cm --help \*(Ba --usage
85Print a help message and exit.
86.It Cm --libs
87Return all linker flags required to link against the package.
88.It Cm --libs-only-L
89Return only the library path (-L/path/to/lib) flags required to link
90against the package.
91.It Cm --libs-only-l
92Return only the library (-lwhatever) flags required to link against
93the package.
94.It Cm --libs-only-other
95Return linker flags, other than the library and path flags, required to
96compile against the package.
97.It Cm --list-all
98List all installed packages and exit.
99.It Cm --modversion
100Fetch package version.
101If no package is given,
102.Nm
103returns its own version.
104.It Cm --print-errors
105Print error messages and exit with an error when errors occur.
106This is the default operation.
107.It Cm --silence-errors
108Do not print error messages, just exit with an error.
109.It Cm --static
110Return the compiler and/or linker flags required for static linking.
111.It Cm --uninstalled
112Allow packages not controlled by
113.Nm
114to be used.
115.It Cm --variable Ar name
116Fetch the value of the named variable.
117.It Cm --version
118Print version of
119.Nm
120and exit.
121.El
122.Pp
123.Ex -std pkg-config
124.Sh ENVIRONMENT
125.Bl -tag -width PKG_CONFIG_PATH
126.It Ev PKG_CONFIG_PATH
127This can be used to specify a colon-separated list of paths to search for
128package files.
129If given, this list of paths is prepended to the standard search path.
130.El
131.Sh SEE ALSO
132.Xr pkg_info 1 ,
133.Xr ports 7
134.Sh HISTORY
135The
136.Nm
137utility first appeared in
138.Ox 4.1 .
139