home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 November / CPNL0711.ISO / communic / email / Evolution-2.8.2-2.msi / Data1.cab / pkg_config.1 < prev    next >
Text File  |  2007-03-07  |  15KB  |  417 lines

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