1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
.\" $OpenBSD: pkg-config.1,v 1.16 2011/03/10 19:07:45 jasper 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: March 10 2011 $
.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.
Libraries from base install their metadata in
.Pa /usr/lib/pkgconfig ;
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
.Sh ENVIRONMENT
.Bl -tag -width Ds
.It Ev PKG_CONFIG_DEBUG_SPEW
If set, this will cause
.Nm
to print various debugging information.
.It Ev PKG_CONFIG_DISABLE_UNINSTALLED
By default
.Nm
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.
.It Ev PKG_CONFIG_LIBDIR
This can be used to specify a colon-separated list of paths to search for
package files.
This will replace the default
.Nm
search directory.
.It Ev PKG_CONFIG_LOGFILE
This is used to specify a logfile to which
.Nm
will write the passed arguments.
.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.
.It Ev PKG_CONFIG_TOP_BUILD_DIR
If set
.Nm
uses the specified value for
.Em pc_top_builddir
instead of $(top_builddir).
.El
.Sh EXIT STATUS
.Ex -std pkg-config
.Sh SEE ALSO
.Xr pkg_info 1 ,
.Xr ports 7
.Sh HISTORY
The
.Nm
utility first appeared in
.Ox 4.1 .
|