📄 pkg-config.1
字号:
any private libraries in the output. This relies on proper tagging inthe .pc files, else a too large number of libraries will ordinarily beoutput..SH ENVIRONMENT VARIABLES.TP.I "PKG_CONFIG_PATH"A colon-separated (on Windows, semicolon-separated) list ofdirectories to search for .pc files. The default directory willalways be searched after searching the path; the default is\fIlibdir\fP/pkgconfig:\fIdatadir\fP/pkgconfig where \fIlibdir\fP isthe libdir where \fIpkg-config\fP and \fIdatadir\fP is the datadirwhere \fIpkg-config\fP was installed..TP.I "PKG_CONFIG_DEBUG_SPEW"If set, causes \fIpkg-config\fP to print all kinds ofdebugging information and report all errors..TP.I "PKG_CONFIG_TOP_BUILD_DIR"A value to set for the magic variable \fIpc_top_builddir\fPwhich may appear in \fI.pc\fP files. If the environment variable isnot set, the default value '$(top_builddir)' will be used. Thisvariable should refer to the top builddir of the Makefile where the compile/link flags reported by \fIpkg-config\fP will be used.This only matters when compiling/linking against a package that hasn'tyet been installed..TP.I "PKG_CONFIG_DISABLE_UNINSTALLED"Normally if you request the package "foo" and the package"foo-uninstalled" exists, \fIpkg-config\fP will prefer the "-uninstalled" variant. This allows compilation/linking againstuninstalled packages. If this environment variable is set, itdisables said behavior..TP.I "PKG_CONFIG_ALLOW_SYSTEM_CFLAGS"Don't strip -I/usr/include out of cflags..TP.I "PKG_CONFIG_ALLOW_SYSTEM_LIBS"Don't strip -L/usr/lib out of libs.TP.I "PKG_CONFIG_SYSROOT_DIR"Modify -I and -L to use the directories located in target sysroot.this option is usefull when crosscompiling package that use pkg-configto determine CFLAGS anf LDFLAGS. -I and -L are modified to point to the new system root. this means that a -I/usr/include/libfoo willbecome -I/var/target/usr/include/libfoo with a PKG_CONFIG_SYSROOT_DIRequal to /var/target (same rule apply to -L).TP.I "PKG_CONFIG_LIBDIR"Replaces the default \fIpkg-config\fP search directory..SH WINDOWS SPECIALITIESIf a .pc file is found in a directory that matches the usualconventions (i.e., ends with \\lib\\pkgconfig or \\share\\pkgconfig),the prefix for that package is assumed to be the grandparent of thedirectory where the file was found, and the \fIprefix\fP variable isoverridden for that file accordingly..SH AUTOCONF MACROS.TP.I "PKG_CHECK_MODULES(VARIABLE-PREFIX,MODULES[,ACTION-IF-FOUND,[ACTION-IF-NOT-FOUND]])"The macro PKG_CHECK_MODULES can be used in \fIconfigure.ac\fP to check whether modules exist. A typical usage would be:.nf PKG_CHECK_MODULES([MYSTUFF], [gtk+-2.0 >= 1.3.5 libxml = 1.8.4]).fiThis would result in MYSTUFF_LIBS and MYSTUFF_CFLAGS substitutionvariables, set to the libs and cflags for the given module list. If a module is missing or has the wrong version, by default configurewill abort with a message. To replace the default action, specify an ACTION-IF-NOT-FOUND. PKG_CHECK_MODULES will not print anyerror 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.Note that if there is a possibility the first call toPKG_CHECK_MODULES might not happen, you should be sure to include anexplicit call to PKG_PROG_PKG_CONFIG in your configure.ac.I "PKG_PROG_PKG_CONFIG([MIN-VERSION])"Defines the PKG_CONFIG variable to the best pkg-config available,useful if you need pkg-config but don't want to use PKG_CHECK_MODULES..I "PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])"Check to see whether a particular set of modules exists. Similarto PKG_CHECK_MODULES(), but does not set variables or print errors.Similar to PKG_CHECK_MODULES, make sure that the first instance ofthis or PKG_CHECK_MODULES is called, or make sure to callPKG_CHECK_EXISTS manually.SH METADATA FILE SYNTAXTo add a library to the set of packages \fIpkg-config\fP knows about,simply install a \fI.pc\fP file. You should install this file to \fIlibdir\fP/pkgconfig..PPHere is an example file:.nf# This is a commentprefix=/home/hp/unst # this defines a variableexec_prefix=${prefix} # defining another variable in terms of the firstlibdir=${exec_prefix}/libincludedir=${prefix}/includeName: GObject # human-readable nameDescription: Object/type system for GLib # human-readable descriptionVersion: 1.3.1URL: http://www.gtk.orgRequires: glib-2.0 = 1.3.1Conflicts: foobar <= 4.5Libs: -L${libdir} -lgobject-1.3Libs.private: -lmCflags: -I${includedir}/glib-2.0 -I${libdir}/glib/include .fi.PPYou would normally generate the file using configure, of course, sothat the prefix, etc. are set to the proper values..PPFiles have two kinds of line: keyword lines start with a keyword plusa colon, and variable definitions start with an alphanumeric stringplus an equals sign. Keywords are defined in advance and have specialmeaning to \fIpkg-config\fP; variables do not, you can have anyvariables that you wish (however, users may expect to retrieve theusual directory name variables)..PPNote that variable references are written "${foo}"; you can escapeliteral "${" as "$${"..TP.I "Name:"This field should be a human-readable name for the package. Note thatit is not the name passed as an argument to \fIpkg-config\fP..TP.I "Description:"This should be a brief description of the package.TP.I "URL:"An URL where people can get more information about and download the package.TP.I "Version:"This should be the most-specific-possible package version string..TP.I "Requires:"This is a comma-separated list of packages that are required by yourpackage. Flags from dependent packages will be merged in to the flagsreported for your package. Optionally, you can specify the version of the required package (using the operators =, <, >, >=, <=);specifying a version allows \fIpkg-config\fP to perform extra sanitychecks. You may only mention the same package one time on the .I "Requires:"line. If the version of a package is unspecified, any version willbe used with no checking..TP.I "Conflicts:"This optional line allows \fIpkg-config\fP to perform additionalsanity checks, primarily to detect broken user installations. Thesyntax is the same as.I "Requires:"except thatyou can list the same package more than once here, for example "foobar = 1.2.3, foobar = 1.2.5, foobar >= 1.3", if you have reason todo so. If a version isn't specified, then your package conflicts withall versions of the mentioned package. If a user tries to use your package and a conflicting package at thesame time, then \fIpkg-config\fP will complain..TP.I "Libs:"This line should give the link flags specific to your package. Don't add any flags for required packages; \fIpkg-config\fP will add those automatically..TP.I "Libs.private:"This line should list any private libraries in use. Private librariesare libraries which are not exposed through your library, but areneeded in the case of static linking..TP.I "Cflags:"This line should list the compile flags specific to your package. Don't add any flags for required packages; \fIpkg-config\fP will add those automatically..SH AUTHOR\fIpkg-config\fP was written by James Henstridge, rewritten by Martijnvan Beers, and rewritten again by Havoc Pennington. Tim Janik, OwenTaylor, and Raja Harinath submitted suggestions and some code.\fIgnome-config\fP was written by Miguel de Icaza, Raja Harinath andvarious hackers in the GNOME team. It was inspired by Owen Taylor's\fIgtk-config\fP program..SH BUGS\fIpkg-config\fP does not handle mixing of parameters with and without= well. Stick with one.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -