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
|
.\" $OpenBSD: pkg-config.1,v 1.14 2010/09/03 11:09:29 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: September 3 2010 $
.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
.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 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 .
|