version 1 showing authors affecting page license.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
pkg-config |
|
|
2 |
!!!pkg-config |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
OPTIONS |
|
|
7 |
ENVIRONMENT VARIABLES |
|
|
8 |
WINDOWS SPECIALITIES |
|
|
9 |
AUTOCONF MACROS |
|
|
10 |
METADATA FILE SYNTAX |
|
|
11 |
AUTHOR |
|
|
12 |
BUGS |
|
|
13 |
---- |
|
|
14 |
!!NAME |
|
|
15 |
|
|
|
16 |
|
|
|
17 |
pkg-config - Return metainformation about installed libraries |
|
|
18 |
!!SYNOPSIS |
|
|
19 |
|
|
|
20 |
|
|
|
21 |
__pkg-config__ [[--modversion] [[--help] [[--print-errors] |
|
|
22 |
[[--silence-errors] [[--cflags] [[--libs] [[--libs-only-L] |
|
|
23 |
[[--libs-only-l] [[--cflags-only-I] [[--variable=VARIABLENAME] |
|
|
24 |
[[--define-variable=VARIABLENAME=VARIABLEVALUE] |
|
|
25 |
[[--uninstalled] [[--exists] [[--atleast-version=VERSION] |
|
|
26 |
[[--exact-version=VERSION] [[--max-version=VERSION] |
|
|
27 |
[[LIBRARIES...] |
|
|
28 |
!!DESCRIPTION |
|
|
29 |
|
|
|
30 |
|
|
|
31 |
The ''pkg-config'' program is used to retrieve |
|
|
32 |
information about installed libraries in the system. It is |
|
|
33 |
typically used to compile and link against one or more |
|
|
34 |
libraries. Here is a typical usage scenario in a |
|
|
35 |
Makefile: |
|
|
36 |
|
|
|
37 |
|
|
|
38 |
program: program.c |
|
|
39 |
cc program.c `pkg-config --cflags --libs gnomeui` |
|
|
40 |
|
|
|
41 |
|
|
|
42 |
''pkg-config'' retrieves information about packages from |
|
|
43 |
special metadata files. These files are named after the |
|
|
44 |
package, with the extension ''.pc''. By default, |
|
|
45 |
pkg-config looks in the directory |
|
|
46 |
''prefix''/lib/pkgconfig for these files; it will also |
|
|
47 |
look in the colon-separated (on Windows, |
|
|
48 |
semicolon-separated) list of directories specified by the |
|
|
49 |
PKG_CONFIG_PATH environment variable. |
|
|
50 |
|
|
|
51 |
|
|
|
52 |
The package name specified on the ''pkg-config'' command |
|
|
53 |
line is defined to be the name of the metadata file, minus |
|
|
54 |
the ''.pc'' extension. If a library can install multiple |
|
|
55 |
versions simultaneously, it must give each version its own |
|
|
56 |
name (for example, GTK 1.2 might have the package name |
|
|
57 |
'' |
|
|
58 |
!!OPTIONS |
|
|
59 |
|
|
|
60 |
|
|
|
61 |
The following options are supported: |
|
|
62 |
|
|
|
63 |
|
|
|
64 |
''--modversion'' |
|
|
65 |
|
|
|
66 |
|
|
|
67 |
Requests that the version information of the libraries |
|
|
68 |
specified on the command line be displayed. If |
|
|
69 |
''pkg-config'' can find all the libraries on the command |
|
|
70 |
line, each library's version string is printed to stdout, |
|
|
71 |
one version per line. In this case ''pkg-config'' exits |
|
|
72 |
successfully. If one or more libraries is unknown, |
|
|
73 |
''pkg-config'' exits with a nonzero code, and the |
|
|
74 |
contents of stdout are undefined. |
|
|
75 |
|
|
|
76 |
|
|
|
77 |
''--help'' |
|
|
78 |
|
|
|
79 |
|
|
|
80 |
Displays a help message and terminates. |
|
|
81 |
|
|
|
82 |
|
|
|
83 |
''--print-errors'' |
|
|
84 |
|
|
|
85 |
|
|
|
86 |
If one or more of the modules on the command line, or their |
|
|
87 |
dependencies, are not found, or if an error occurs in |
|
|
88 |
parsing a problem to be printed. With |
|
|
89 |
pkg-config'' runs |
|
|
90 |
silently by default, because it's usually used in scripts |
|
|
91 |
that want to control what's output. This option can be used |
|
|
92 |
alone (to just print errors encountered locating modules on |
|
|
93 |
the command line) or with other options. The |
|
|
94 |
PKG_CONFIG_DEBUG_SPEW environment variable overrides this |
|
|
95 |
option. |
|
|
96 |
|
|
|
97 |
|
|
|
98 |
''--silence-errors'' |
|
|
99 |
|
|
|
100 |
|
|
|
101 |
If one or more of the modules on the command line, or their |
|
|
102 |
dependencies, are not found, or if an error occurs in |
|
|
103 |
parsing a problem from being printed. With |
|
|
104 |
pkg-config'' runs silently by default, because it's |
|
|
105 |
usually used in scripts that want to control what's output. |
|
|
106 |
So this option is only useful with options such as |
|
|
107 |
'' |
|
|
108 |
|
|
|
109 |
|
|
|
110 |
''--errors-to-stdout'' |
|
|
111 |
|
|
|
112 |
|
|
|
113 |
If printing errors, print them to stdout rather than the |
|
|
114 |
default stderr |
|
|
115 |
|
|
|
116 |
|
|
|
117 |
The following options are used to compile and link |
|
|
118 |
programs: |
|
|
119 |
|
|
|
120 |
|
|
|
121 |
''--cflags'' |
|
|
122 |
|
|
|
123 |
|
|
|
124 |
This prints pre-processor and compile flags required to |
|
|
125 |
compile the packages on the command line, including flags |
|
|
126 |
for all their dependencies. Flags are |
|
|
127 |
pkg-config'' exits with a nonzero code if it can't find |
|
|
128 |
metadata for one or more of the packages on the command |
|
|
129 |
line. |
|
|
130 |
|
|
|
131 |
|
|
|
132 |
''--libs'' |
|
|
133 |
|
|
|
134 |
|
|
|
135 |
This option is identical to |
|
|
136 |
|
|
|
137 |
|
|
|
138 |
''--libs-only-L'' |
|
|
139 |
|
|
|
140 |
|
|
|
141 |
This prints the -L/-R part of |
|
|
142 |
|
|
|
143 |
|
|
|
144 |
''--libs-only-l'' |
|
|
145 |
|
|
|
146 |
|
|
|
147 |
This prints the -l part of |
|
|
148 |
|
|
|
149 |
|
|
|
150 |
''--variable=VARIABLENAME'' |
|
|
151 |
|
|
|
152 |
|
|
|
153 |
This returns the value of a variable defined in a package's |
|
|
154 |
''.pc'' file. Most packages define the variable |
|
|
155 |
'' |
|
|
156 |
|
|
|
157 |
|
|
|
158 |
$ pkg-config --variable=prefix glib-2.0 |
|
|
159 |
/usr/ |
|
|
160 |
|
|
|
161 |
|
|
|
162 |
''--define-variable=VARIABLENAME=VARIABLEVALUE'' |
|
|
163 |
|
|
|
164 |
|
|
|
165 |
This sets a global value for a variable, overriding the |
|
|
166 |
value in any example, so you can say: |
|
|
167 |
|
|
|
168 |
|
|
|
169 |
$ pkg-config --print-errors --define-variable=prefix=/foo --variable=prefix glib-2.0 |
|
|
170 |
/foo |
|
|
171 |
|
|
|
172 |
|
|
|
173 |
''--uninstalled'' |
|
|
174 |
|
|
|
175 |
|
|
|
176 |
Normally if you request the package |
|
|
177 |
pkg-config'' will prefer the |
|
|
178 |
''pkg-config'' will return successfully if any |
|
|
179 |
''pkg-config'' from implicitly choosing |
|
|
180 |
'' |
|
|
181 |
|
|
|
182 |
|
|
|
183 |
''--exists'' |
|
|
184 |
|
|
|
185 |
|
|
|
186 |
''--atleast-version=VERSION'' |
|
|
187 |
|
|
|
188 |
|
|
|
189 |
''--exact-version=VERSION'' |
|
|
190 |
|
|
|
191 |
|
|
|
192 |
''--max-version=VERSION'' |
|
|
193 |
|
|
|
194 |
|
|
|
195 |
These options test whether the package or list of packages |
|
|
196 |
on the command line are known to ''pkg-config'', and |
|
|
197 |
optionally whether the version number of a package meets |
|
|
198 |
certain contraints. If all packages exist and meet the |
|
|
199 |
specified version constraints, ''pkg-config'' exits |
|
|
200 |
successfully. Otherwise it exits |
|
|
201 |
unsuccessfully. |
|
|
202 |
|
|
|
203 |
|
|
|
204 |
Rather than using the version-test options, you can simply |
|
|
205 |
give a version constraint after each package name, for |
|
|
206 |
example: |
|
|
207 |
|
|
|
208 |
|
|
|
209 |
$ pkg-config --exists 'glib-2.0 |
|
|
210 |
Remember to use --print-errors if you want error messages. |
|
|
211 |
|
|
|
212 |
|
|
|
213 |
''--msvc-syntax'' |
|
|
214 |
|
|
|
215 |
|
|
|
216 |
This option is available only on Windows. It causes |
|
|
217 |
''pkg-config'' to output -l and -L flags in the form |
|
|
218 |
recognized by the Microsoft Visual C++ command-line |
|
|
219 |
compiler, ''cl''. Specifically, instead of |
|
|
220 |
''-Lx:/some/path'' it prints ''/libpath:x/some/path'', |
|
|
221 |
and instead of ''-lfoo'' it prints ''foo.lib''. Note |
|
|
222 |
that the --libs output consists of flags for the linker, and |
|
|
223 |
should be placed on the cl command line after a /link |
|
|
224 |
switch. |
|
|
225 |
|
|
|
226 |
|
|
|
227 |
''--dont-define-prefix'' |
|
|
228 |
|
|
|
229 |
|
|
|
230 |
This option is available only on Windows. It prevents |
|
|
231 |
''pkg-config'' from automatically trying to override the |
|
|
232 |
value of the variable |
|
|
233 |
'' |
|
|
234 |
|
|
|
235 |
|
|
|
236 |
''--prefix-variable=PREFIX'' |
|
|
237 |
|
|
|
238 |
|
|
|
239 |
Also this option is available only on Windows. It sets the |
|
|
240 |
name of the variable that ''pkg-config'' automatically |
|
|
241 |
sets as described above. |
|
|
242 |
!!ENVIRONMENT VARIABLES |
|
|
243 |
|
|
|
244 |
|
|
|
245 |
''PKG_CONFIG_PATH'' |
|
|
246 |
|
|
|
247 |
|
|
|
248 |
A colon-separated (on Windows, semicolon-separated) list of |
|
|
249 |
directories to search for .pc files. The default directory |
|
|
250 |
will always be searched after searching the path; the |
|
|
251 |
default is ''libdir''/pkgconfig where ''libdir'' is |
|
|
252 |
the libdir where ''pkg-config'' was |
|
|
253 |
installed. |
|
|
254 |
|
|
|
255 |
|
|
|
256 |
''PKG_CONFIG_DEBUG_SPEW'' |
|
|
257 |
|
|
|
258 |
|
|
|
259 |
If set, causes ''pkg-config'' to print all kinds of |
|
|
260 |
debugging information and report all errors. |
|
|
261 |
|
|
|
262 |
|
|
|
263 |
''PKG_CONFIG_TOP_BUILD_DIR'' |
|
|
264 |
|
|
|
265 |
|
|
|
266 |
A value to set for the magic variable ''pc_top_builddir'' |
|
|
267 |
which may appear in ''.pc'' files. If the environment |
|
|
268 |
variable is not set, the default value '$(top_builddir)' |
|
|
269 |
will be used. This variable should refer to the top builddir |
|
|
270 |
of the Makefile where the compile/link flags reported by |
|
|
271 |
''pkg-config'' will be used. This only matters when |
|
|
272 |
compiling/linking against a package that hasn't yet been |
|
|
273 |
installed. |
|
|
274 |
|
|
|
275 |
|
|
|
276 |
''PKG_CONFIG_DISABLE_UNINSTALLED'' |
|
|
277 |
|
|
|
278 |
|
|
|
279 |
Normally if you request the package |
|
|
280 |
pkg-config'' will prefer the |
|
|
281 |
'' |
|
|
282 |
|
|
|
283 |
|
|
|
284 |
''PKG_CONFIG_ALLOW_SYSTEM_CFLAGS'' |
|
|
285 |
|
|
|
286 |
|
|
|
287 |
Don't strip -I/usr/include out of cflags. |
|
|
288 |
|
|
|
289 |
|
|
|
290 |
''PKG_CONFIG_ALLOW_SYSTEM_LIBS'' |
|
|
291 |
|
|
|
292 |
|
|
|
293 |
Don't strip -L/usr/lib out of libs |
|
|
294 |
!!WINDOWS SPECIALITIES |
|
|
295 |
|
|
|
296 |
|
|
|
297 |
If a .pc file is found in a directory that matches the usual |
|
|
298 |
conventions (i.e., ends with libpkgconfig), the prefix for |
|
|
299 |
that package is assumed to be the grandparent of the |
|
|
300 |
directory where the file was found, and the ''prefix'' |
|
|
301 |
variable is overridden for that file |
|
|
302 |
accordingly. |
|
|
303 |
|
|
|
304 |
|
|
|
305 |
In addition to the ''PKG_CONFIG_PATH'' environment |
|
|
306 |
variable, the Registry keys |
|
|
307 |
''HKEY_CURRENT_USERSoftwarepkgconfigPKG_CONFIG_PATH'' and |
|
|
308 |
''HKEY_LOCAL_MACHINESoftwarepkgconfigPKG_CONFIG_PATH'' |
|
|
309 |
can be used to specify directories to search for .pc files. |
|
|
310 |
Each (string) value in these keys is treated as a directory |
|
|
311 |
where to look for .pc files. |
|
|
312 |
!!AUTOCONF MACROS |
|
|
313 |
|
|
|
314 |
|
|
|
315 |
''PKG_CHECK_MODULES(VARIABLEBASE,MODULELIST[[,ACTION-IF-FOUND,[[ACTION-IF-NOT-FOUND]])'' |
|
|
316 |
|
|
|
317 |
|
|
|
318 |
The macro PKG_CHECK_MODULES can be used in |
|
|
319 |
''configure.in'' to check whether modules exist. A |
|
|
320 |
typical usage would be: |
|
|
321 |
|
|
|
322 |
|
|
|
323 |
PKG_CHECK_MODULES(MYSTUFF, gtk+-2.0 |
|
|
324 |
This would result in MYSTUFF_LIBS and MYSTUFF_CFLAGS substitution variables, set to the libs and cflags for the given module list. If a module is missing or has the wrong version, by default configure will abort with a message. To replace the default action, specify an ACTION-IF-NOT-FOUND. PKG_CHECK_MODULES will not print any error messages if you specify your own ACTION-IF-NOT-FOUND. However, it will set the variable MYSTUFF_PKG_ERRORS, which you can use to display what went wrong. |
|
|
325 |
!!METADATA FILE SYNTAX |
|
|
326 |
|
|
|
327 |
|
|
|
328 |
To add a library to the set of packages ''pkg-config'' |
|
|
329 |
knows about, simply install a ''.pc'' file. You should |
|
|
330 |
install this file to ''libdir''/pkgconfig. |
|
|
331 |
|
|
|
332 |
|
|
|
333 |
Here is an example file: |
|
|
334 |
|
|
|
335 |
|
|
|
336 |
# This is a comment |
|
|
337 |
prefix=/home/hp/unst # this defines a variable |
|
|
338 |
exec_prefix=${prefix} # defining another variable in terms of the first |
|
|
339 |
libdir=${exec_prefix}/lib |
|
|
340 |
includedir=${prefix}/include |
|
|
341 |
Name: GObject # human-readable name |
|
|
342 |
Description: Object/type system for GLib # human-readable description |
|
|
343 |
Version: 1.3.1 |
|
|
344 |
Requires: glib-2.0 = 1.3.1 |
|
|
345 |
Conflicts: foobar |
|
|
346 |
|
|
|
347 |
|
|
|
348 |
You would normally generate the file using configure, of |
|
|
349 |
course, so that the prefix, etc. are set to the proper |
|
|
350 |
values. |
|
|
351 |
|
|
|
352 |
|
|
|
353 |
Files have two kinds of line: keyword lines start with a |
|
|
354 |
keyword plus a colon, and variable definitions start with an |
|
|
355 |
alphanumeric string plus an equals sign. Keywords are |
|
|
356 |
defined in advance and have special meaning to |
|
|
357 |
''pkg-config''; variables do not, you can have any |
|
|
358 |
variables that you wish (however, users may expect to |
|
|
359 |
retrieve the usual directory name variables). |
|
|
360 |
|
|
|
361 |
|
|
|
362 |
Note that variable references are written |
|
|
363 |
|
|
|
364 |
|
|
|
365 |
''Name:'' |
|
|
366 |
|
|
|
367 |
|
|
|
368 |
This field should be a human-readable name for the package. |
|
|
369 |
Note that it is not the name passed as an argument to |
|
|
370 |
''pkg-config''. |
|
|
371 |
|
|
|
372 |
|
|
|
373 |
''Description:'' |
|
|
374 |
|
|
|
375 |
|
|
|
376 |
This should be a brief description of the |
|
|
377 |
package |
|
|
378 |
|
|
|
379 |
|
|
|
380 |
''Version:'' |
|
|
381 |
|
|
|
382 |
|
|
|
383 |
This should be the most-specific-possible package version |
|
|
384 |
string. |
|
|
385 |
|
|
|
386 |
|
|
|
387 |
''Requires:'' |
|
|
388 |
|
|
|
389 |
|
|
|
390 |
This is a comma-separated list of packages that are required |
|
|
391 |
by your package. Flags from dependent packages will be |
|
|
392 |
merged in to the flags reported for your package. |
|
|
393 |
Optionally, you can specify the version of the required |
|
|
394 |
package (using the operators =, |
|
|
395 |
pkg-config'' to perform |
|
|
396 |
extra sanity checks. You may only mention the same package |
|
|
397 |
one time on the ''Requires:'' line. If the version of a |
|
|
398 |
package is unspecified, any version will be used with no |
|
|
399 |
checking. |
|
|
400 |
|
|
|
401 |
|
|
|
402 |
''Conflicts:'' |
|
|
403 |
|
|
|
404 |
|
|
|
405 |
This optional line allows ''pkg-config'' to perform |
|
|
406 |
additional sanity checks, primarily to detect broken user |
|
|
407 |
installations. The syntax is the same as ''Requires:'' |
|
|
408 |
except that you can list the same package more than once |
|
|
409 |
here, for example |
|
|
410 |
''pkg-config'' will complain. |
|
|
411 |
|
|
|
412 |
|
|
|
413 |
''Libs:'' |
|
|
414 |
|
|
|
415 |
|
|
|
416 |
This line should give the link flags specific to your |
|
|
417 |
package. Don't add any flags for required packages; |
|
|
418 |
''pkg-config'' will add those automatically. |
|
|
419 |
|
|
|
420 |
|
|
|
421 |
''Cflags:'' |
|
|
422 |
|
|
|
423 |
|
|
|
424 |
This line should list the compile flags specific to your |
|
|
425 |
package. Don't add any flags for required packages; |
|
|
426 |
''pkg-config'' will add those automatically. |
|
|
427 |
!!AUTHOR |
|
|
428 |
|
|
|
429 |
|
|
|
430 |
''pkg-config'' was written by James Henstridge, rewritten |
|
|
431 |
by Martijn van Beers, and rewritten again by Havoc |
|
|
432 |
Pennington. Tim Janik, Owen Taylor, and Raja Harinath |
|
|
433 |
submitted suggestions and some code. ''gnome-config'' was |
|
|
434 |
written by Miguel de Icaza, Raja Harinath and various |
|
|
435 |
hackers in the GNOME team. It was inspired by Owen Taylor's |
|
|
436 |
''gtk-config'' program. |
|
|
437 |
!!BUGS |
|
|
438 |
|
|
|
439 |
|
|
|
440 |
Hah! |
|
|
441 |
---- |