|
Packit |
db3073 |
.\"
|
|
Packit |
db3073 |
.\" pkg-config manual page.
|
|
Packit |
db3073 |
.\" (C) Red Hat, Inc. based on gnome-config man page (C) Miguel de Icaza (miguel@gnu.org)
|
|
Packit |
db3073 |
.\"
|
|
Packit |
db3073 |
.
|
|
Packit |
db3073 |
.TH pkg-config 1
|
|
Packit |
db3073 |
.SH NAME
|
|
Packit |
db3073 |
pkg-config \- Return metainformation about installed libraries
|
|
Packit |
db3073 |
.SH SYNOPSIS
|
|
Packit |
db3073 |
.PP
|
|
Packit |
db3073 |
.B pkg-config
|
|
Packit |
db3073 |
[\-\-modversion] [\-\-version] [\-\-help] [\-\-print-errors]
|
|
Packit |
db3073 |
[\-\-silence-errors] [\-\-errors-to-stdout] [\-\-debug]
|
|
Packit |
db3073 |
[\-\-cflags] [\-\-libs] [\-\-libs-only-L]
|
|
Packit |
db3073 |
[\-\-libs-only-l] [\-\-cflags-only-I]
|
|
Packit |
db3073 |
[\-\-variable=VARIABLENAME]
|
|
Packit |
db3073 |
[\-\-define-variable=VARIABLENAME=VARIABLEVALUE]
|
|
Packit |
db3073 |
[\-\-print-variables]
|
|
Packit |
db3073 |
[\-\-uninstalled]
|
|
Packit |
db3073 |
[\-\-exists] [\-\-atleast-version=VERSION] [\-\-exact-version=VERSION]
|
|
Packit |
db3073 |
[\-\-max-version=VERSION] [\-\-list\-all] [LIBRARIES...]
|
|
Packit |
db3073 |
[\-\-print-provides] [\-\-print-requires] [\-\-print-requires-private] [LIBRARIES...]
|
|
Packit |
db3073 |
.SH DESCRIPTION
|
|
Packit |
db3073 |
|
|
Packit |
db3073 |
The \fIpkg-config\fP program is used to retrieve information about
|
|
Packit |
db3073 |
installed libraries in the system. It is typically used to compile
|
|
Packit |
db3073 |
and link against one or more libraries. Here is a typical usage
|
|
Packit |
db3073 |
scenario in a Makefile:
|
|
Packit |
db3073 |
.PP
|
|
Packit |
db3073 |
.nf
|
|
Packit |
db3073 |
program: program.c
|
|
Packit |
db3073 |
cc program.c $(pkg-config --cflags --libs gnomeui)
|
|
Packit |
db3073 |
.fi
|
|
Packit |
db3073 |
.PP
|
|
Packit |
db3073 |
.I pkg-config
|
|
Packit |
db3073 |
retrieves information about packages from special metadata
|
|
Packit |
db3073 |
files. These files are named after the package, and has a
|
|
Packit |
db3073 |
.I .pc
|
|
Packit |
db3073 |
extension. On most systems, \fIpkg-config\fP looks in
|
|
Packit |
db3073 |
.I /usr/lib/pkgconfig, /usr/share/pkgconfig, /usr/local/lib/pkgconfig
|
|
Packit |
db3073 |
and
|
|
Packit |
db3073 |
.I /usr/local/share/pkgconfig
|
|
Packit |
db3073 |
for these files. It will additionally look in the colon-separated
|
|
Packit |
db3073 |
(on Windows, semicolon-separated) list of directories specified by the
|
|
Packit |
db3073 |
PKG_CONFIG_PATH environment variable.
|
|
Packit |
db3073 |
.PP
|
|
Packit |
db3073 |
The package name specified on the \fIpkg-config\fP command line is
|
|
Packit |
db3073 |
defined to be the name of the metadata file, minus the \fI.pc\fP
|
|
Packit |
db3073 |
extension. If a library can install multiple versions simultaneously,
|
|
Packit |
db3073 |
it must give each version its own name (for example, GTK 1.2 might
|
|
Packit |
db3073 |
have the package name "gtk+" while GTK 2.0 has "gtk+-2.0").
|
|
Packit |
db3073 |
.PP
|
|
Packit |
db3073 |
In addition to specifying a package name on the command line, the full
|
|
Packit |
db3073 |
path to a given \fI.pc\fP file may be given instead. This allows a
|
|
Packit |
db3073 |
user to directly query a particular \fI.pc\fP file.
|
|
Packit |
db3073 |
.\"
|
|
Packit |
db3073 |
.SH OPTIONS
|
|
Packit |
db3073 |
The following options are supported:
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "--modversion"
|
|
Packit |
db3073 |
Requests that the version information of the libraries specified on
|
|
Packit |
db3073 |
the command line be displayed. If \fIpkg-config\fP can find all the
|
|
Packit |
db3073 |
libraries on the command line, each library's version string is
|
|
Packit |
db3073 |
printed to stdout, one version per line. In this case \fIpkg-config\fP
|
|
Packit |
db3073 |
exits successfully. If one or more libraries is unknown,
|
|
Packit |
db3073 |
.I pkg-config
|
|
Packit |
db3073 |
exits with a nonzero code, and the contents of stdout are undefined.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "--version"
|
|
Packit |
db3073 |
Displays the version of
|
|
Packit |
db3073 |
.I pkg-config
|
|
Packit |
db3073 |
and terminates.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "--help"
|
|
Packit |
db3073 |
Displays a help message and terminates.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "--print-errors"
|
|
Packit |
db3073 |
If one or more of the modules on the command line, or their
|
|
Packit |
db3073 |
dependencies, are not found, or if an error occurs in parsing
|
|
Packit |
db3073 |
a \fI.pc\fP file, then this option will cause errors explaining the
|
|
Packit |
db3073 |
problem to be printed. With "predicate" options such as "--exists"
|
|
Packit |
db3073 |
.I "pkg-config"
|
|
Packit |
db3073 |
runs silently by default, because it's usually used
|
|
Packit |
db3073 |
in scripts that want to control what's output. This option can be used
|
|
Packit |
db3073 |
alone (to just print errors encountered locating modules on the
|
|
Packit |
db3073 |
command line) or with other options. The PKG_CONFIG_DEBUG_SPEW
|
|
Packit |
db3073 |
environment variable overrides this option.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "--silence-errors"
|
|
Packit |
db3073 |
If one or more of the modules on the command line, or their
|
|
Packit |
db3073 |
dependencies, are not found, or if an error occurs in parsing a
|
|
Packit |
db3073 |
a \fI.pc\fP file, then this option will keep errors explaining the
|
|
Packit |
db3073 |
problem from being printed. With "predicate" options such as
|
|
Packit |
db3073 |
"--exists" \fIpkg-config\fP runs silently by default, because it's
|
|
Packit |
db3073 |
usually used in scripts that want to control what's output. So this
|
|
Packit |
db3073 |
option is only useful with options such as "--cflags" or
|
|
Packit |
db3073 |
"--modversion" that print errors by default. The PKG_CONFIG_DEBUG_SPEW
|
|
Packit |
db3073 |
environment variable overrides this option.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "--errors-to-stdout"
|
|
Packit |
db3073 |
If printing errors, print them to stdout rather than the default stderr
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "--debug"
|
|
Packit |
db3073 |
Print debugging information. This is slightly different than the
|
|
Packit |
db3073 |
PKG_CONFIG_DEBUG_SPEW environment variable, which also enable
|
|
Packit |
db3073 |
"--print-errors".
|
|
Packit |
db3073 |
|
|
Packit |
db3073 |
.PP
|
|
Packit |
db3073 |
The following options are used to compile and link programs:
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "--cflags"
|
|
Packit |
db3073 |
This prints pre-processor and compile flags required to compile the
|
|
Packit |
db3073 |
packages on the command line, including flags for all their
|
|
Packit |
db3073 |
dependencies. Flags are "compressed" so that each identical flag
|
|
Packit |
db3073 |
appears only once. \fIpkg-config\fP exits with a nonzero code if it
|
|
Packit |
db3073 |
can't find metadata for one or more of the packages on the command
|
|
Packit |
db3073 |
line.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "--cflags-only-I"
|
|
Packit |
db3073 |
This prints the -I part of "--cflags". That is, it defines the header
|
|
Packit |
db3073 |
search path but doesn't specify anything else.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "--libs"
|
|
Packit |
db3073 |
This option is identical to "--cflags", only it prints the link
|
|
Packit |
db3073 |
flags. As with "--cflags", duplicate flags are merged (maintaining
|
|
Packit |
db3073 |
proper ordering), and flags for dependencies are included in the
|
|
Packit |
db3073 |
output.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "--libs-only-L"
|
|
Packit |
db3073 |
This prints the -L/-R part of "--libs". That is, it defines the
|
|
Packit |
db3073 |
library search path but doesn't specify which libraries to link with.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "--libs-only-l"
|
|
Packit |
db3073 |
This prints the -l part of "--libs" for the libraries specified on
|
|
Packit |
db3073 |
the command line. Note that the union of "--libs-only-l" and
|
|
Packit |
db3073 |
"--libs-only-L" may be smaller than "--libs", due to flags such as
|
|
Packit |
db3073 |
-rdynamic.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "--variable=VARIABLENAME"
|
|
Packit |
db3073 |
This returns the value of a variable defined in a package's \fI.pc\fP
|
|
Packit |
db3073 |
file. Most packages define the variable "prefix", for example, so you
|
|
Packit |
db3073 |
can say:
|
|
Packit |
db3073 |
.nf
|
|
Packit |
db3073 |
$ pkg-config --variable=prefix glib-2.0
|
|
Packit |
db3073 |
/usr/
|
|
Packit |
db3073 |
.fi
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "--define-variable=VARIABLENAME=VARIABLEVALUE"
|
|
Packit |
db3073 |
This sets a global value for a variable, overriding the value in any
|
|
Packit |
db3073 |
.I .pc
|
|
Packit |
db3073 |
files. Most packages define the variable "prefix", for example, so you
|
|
Packit |
db3073 |
can say:
|
|
Packit |
db3073 |
.nf
|
|
Packit |
db3073 |
$ pkg-config --print-errors --define-variable=prefix=/foo \e
|
|
Packit |
db3073 |
--variable=prefix glib-2.0
|
|
Packit |
db3073 |
/foo
|
|
Packit |
db3073 |
.fi
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "--print-variables"
|
|
Packit |
db3073 |
Returns a list of all variables defined in the package.
|
|
Packit |
db3073 |
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "--uninstalled"
|
|
Packit |
db3073 |
Normally if you request the package "foo" and the package
|
|
Packit |
db3073 |
"foo-uninstalled" exists, \fIpkg-config\fP will prefer the
|
|
Packit |
db3073 |
"-uninstalled" variant. This allows compilation/linking against
|
|
Packit |
db3073 |
uninstalled packages. If you specify the "--uninstalled" option,
|
|
Packit |
db3073 |
.I pkg-config
|
|
Packit |
db3073 |
will return successfully if any "-uninstalled" packages are being
|
|
Packit |
db3073 |
used, and return failure (false) otherwise. (The
|
|
Packit |
db3073 |
PKG_CONFIG_DISABLE_UNINSTALLED environment variable keeps
|
|
Packit |
db3073 |
.I pkg-config
|
|
Packit |
db3073 |
from implicitly choosing "-uninstalled" packages, so if that variable
|
|
Packit |
db3073 |
is set, they will only have been used if you pass a name like
|
|
Packit |
db3073 |
"foo-uninstalled" on the command line explicitly.)
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "--exists"
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "--atleast-version=VERSION"
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "--exact-version=VERSION"
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "--max-version=VERSION"
|
|
Packit |
db3073 |
These options test whether the package or list of packages on the
|
|
Packit |
db3073 |
command line are known to \fIpkg-config\fP, and optionally whether the
|
|
Packit |
db3073 |
version number of a package meets certain constraints. If all packages
|
|
Packit |
db3073 |
exist and meet the specified version constraints,
|
|
Packit |
db3073 |
.I pkg-config
|
|
Packit |
db3073 |
exits successfully. Otherwise it exits unsuccessfully. Only the first
|
|
Packit |
db3073 |
VERSION comparing option will be honored. Subsequent options of this
|
|
Packit |
db3073 |
type will be ignored.
|
|
Packit |
db3073 |
|
|
Packit |
db3073 |
Rather than using the version-test options, you can simply give a version
|
|
Packit |
db3073 |
constraint after each package name, for example:
|
|
Packit |
db3073 |
.nf
|
|
Packit |
db3073 |
$ pkg-config --exists 'glib-2.0 >= 1.3.4 libxml = 1.8.3'
|
|
Packit |
db3073 |
.fi
|
|
Packit |
db3073 |
Remember to use \-\-print-errors if you want error messages. When no
|
|
Packit |
db3073 |
output options are supplied to \fIpkg-config\fP, \-\-exists is implied.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "--msvc-syntax"
|
|
Packit |
db3073 |
This option is available only on Windows. It causes \fIpkg-config\fP
|
|
Packit |
db3073 |
to output -l and -L flags in the form recognized by the Microsoft
|
|
Packit |
db3073 |
Visual C++ command-line compiler, \fIcl\fP. Specifically, instead of
|
|
Packit |
db3073 |
.I -Lx:/some/path
|
|
Packit |
db3073 |
it prints \fI/libpath:x/some/path\fP, and instead of \fI-lfoo\fP it
|
|
Packit |
db3073 |
prints \fIfoo.lib\fP. Note that the --libs output consists of flags
|
|
Packit |
db3073 |
for the linker, and should be placed on the cl command line after a
|
|
Packit |
db3073 |
/link switch.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "--dont-define-prefix"
|
|
Packit |
db3073 |
This option is available only on Windows. It prevents \fIpkg-config\fP
|
|
Packit |
db3073 |
from automatically trying to override the value of the variable
|
|
Packit |
db3073 |
"prefix" in each .pc file.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "--prefix-variable=PREFIX"
|
|
Packit |
db3073 |
Also this option is available only on Windows. It sets the name of the
|
|
Packit |
db3073 |
variable that \fIpkg-config\fP automatically sets as described above.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "--static"
|
|
Packit |
db3073 |
Output libraries suitable for static linking. That means including
|
|
Packit |
db3073 |
any private libraries in the output. This relies on proper tagging in
|
|
Packit |
db3073 |
the .pc files, else a too large number of libraries will ordinarily be
|
|
Packit |
db3073 |
output.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "--list-all"
|
|
Packit |
db3073 |
List all modules found in the \fIpkg-config\fP path.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "--print-provides"
|
|
Packit |
db3073 |
List all modules the given packages provides.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "--print-requires"
|
|
Packit |
db3073 |
List all modules the given packages requires.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "--print-requires-private"
|
|
Packit |
db3073 |
List all modules the given packages requires for static linking (see --static).
|
|
Packit |
db3073 |
.\"
|
|
Packit |
db3073 |
.SH ENVIRONMENT VARIABLES
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "PKG_CONFIG_PATH"
|
|
Packit |
db3073 |
A colon-separated (on Windows, semicolon-separated) list of
|
|
Packit |
db3073 |
directories to search for .pc files. The default directory will
|
|
Packit |
db3073 |
always be searched after searching the path; the default is
|
|
Packit |
db3073 |
.I \%libdir/\fPpkgconfig:\fIdatadir\fP/pkgconfig where \fIlibdir\fP is
|
|
Packit |
db3073 |
the libdir for \fIpkg-config\fP and \fIdatadir\fP is the datadir
|
|
Packit |
db3073 |
for \fIpkg-config\fP when it was installed.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "PKG_CONFIG_DEBUG_SPEW"
|
|
Packit |
db3073 |
If set, causes \fIpkg-config\fP to print all kinds of
|
|
Packit |
db3073 |
debugging information and report all errors.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "PKG_CONFIG_TOP_BUILD_DIR"
|
|
Packit |
db3073 |
A value to set for the magic variable \fIpc_top_builddir\fP
|
|
Packit |
db3073 |
which may appear in \fI.pc\fP files. If the environment variable is
|
|
Packit |
db3073 |
not set, the default value '$(top_builddir)' will be used. This
|
|
Packit |
db3073 |
variable should refer to the top builddir of the Makefile where the
|
|
Packit |
db3073 |
compile/link flags reported by \fIpkg-config\fP will be used.
|
|
Packit |
db3073 |
This only matters when compiling/linking against a package that hasn't
|
|
Packit |
db3073 |
yet been installed.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "PKG_CONFIG_DISABLE_UNINSTALLED"
|
|
Packit |
db3073 |
Normally if you request the package "foo" and the package
|
|
Packit |
db3073 |
"foo-uninstalled" exists, \fIpkg-config\fP will prefer the
|
|
Packit |
db3073 |
"-uninstalled" variant. This allows compilation/linking against
|
|
Packit |
db3073 |
uninstalled packages. If this environment variable is set, it
|
|
Packit |
db3073 |
disables said behavior.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "PKG_CONFIG_ALLOW_SYSTEM_CFLAGS"
|
|
Packit |
db3073 |
Don't strip -I/usr/include out of cflags.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "PKG_CONFIG_ALLOW_SYSTEM_LIBS"
|
|
Packit |
db3073 |
Don't strip -L/usr/lib or -L/lib out of libs.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "PKG_CONFIG_SYSROOT_DIR"
|
|
Packit |
db3073 |
Modify -I and -L to use the directories located in target sysroot.
|
|
Packit |
db3073 |
this option is useful when cross-compiling packages that use pkg-config
|
|
Packit |
db3073 |
to determine CFLAGS and LDFLAGS. -I and -L are modified to point to
|
|
Packit |
db3073 |
the new system root. this means that a -I/usr/include/libfoo will
|
|
Packit |
db3073 |
become -I/var/target/usr/include/libfoo with a PKG_CONFIG_SYSROOT_DIR
|
|
Packit |
db3073 |
equal to /var/target (same rule apply to -L)
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "PKG_CONFIG_LIBDIR"
|
|
Packit |
db3073 |
Replaces the default \fIpkg-config\fP search directory, usually \fI/usr/lib/pkgconfig\fP
|
|
Packit |
db3073 |
.\"
|
|
Packit |
db3073 |
.SH QUERYING PKG-CONFIG'S DEFAULTS
|
|
Packit |
db3073 |
.I pkg-config
|
|
Packit |
db3073 |
can be used to query itself for the default search path, version number
|
|
Packit |
db3073 |
and other information, for instance using:
|
|
Packit |
db3073 |
.nf
|
|
Packit |
db3073 |
$ pkg-config --variable pc_path pkg-config
|
|
Packit |
db3073 |
.fi
|
|
Packit |
db3073 |
or
|
|
Packit |
db3073 |
.nf
|
|
Packit |
db3073 |
$ pkg-config --modversion pkg-config
|
|
Packit |
db3073 |
.fi
|
|
Packit |
db3073 |
.SH WINDOWS SPECIALITIES
|
|
Packit |
db3073 |
If a .pc file is found in a directory that matches the usual
|
|
Packit |
db3073 |
conventions (i.e., ends with \\lib\\pkgconfig or \\share\\pkgconfig),
|
|
Packit |
db3073 |
the prefix for that package is assumed to be the grandparent of the
|
|
Packit |
db3073 |
directory where the file was found, and the \fIprefix\fP variable is
|
|
Packit |
db3073 |
overridden for that file accordingly.
|
|
Packit |
db3073 |
|
|
Packit |
db3073 |
If the value of a variable in a .pc file begins with the original,
|
|
Packit |
db3073 |
non-overridden, value of the \fIprefix\fP variable, then the overridden
|
|
Packit |
db3073 |
value of \fIprefix\fP is used instead.
|
|
Packit |
db3073 |
.\"
|
|
Packit |
db3073 |
.SH AUTOCONF MACROS
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]])"
|
|
Packit |
db3073 |
|
|
Packit |
db3073 |
The macro PKG_CHECK_MODULES can be used in \fIconfigure.ac\fP to
|
|
Packit |
db3073 |
check whether modules exist. A typical usage would be:
|
|
Packit |
db3073 |
.nf
|
|
Packit |
db3073 |
PKG_CHECK_MODULES([MYSTUFF], [gtk+-2.0 >= 1.3.5 libxml = 1.8.4])
|
|
Packit |
db3073 |
.fi
|
|
Packit |
db3073 |
|
|
Packit |
db3073 |
This would result in MYSTUFF_LIBS and MYSTUFF_CFLAGS substitution
|
|
Packit |
db3073 |
variables, set to the libs and cflags for the given module list.
|
|
Packit |
db3073 |
If a module is missing or has the wrong version, by default configure
|
|
Packit |
db3073 |
will abort with a message. To replace the default action,
|
|
Packit |
db3073 |
specify an \%ACTION-IF-NOT-FOUND. \%PKG_CHECK_MODULES will not print any
|
|
Packit |
db3073 |
error messages if you specify your own ACTION-IF-NOT-FOUND.
|
|
Packit |
db3073 |
However, it will set the variable MYSTUFF_PKG_ERRORS, which you can
|
|
Packit |
db3073 |
use to display what went wrong.
|
|
Packit |
db3073 |
|
|
Packit |
db3073 |
Note that if there is a possibility the first call to
|
|
Packit |
db3073 |
PKG_CHECK_MODULES might not happen, you should be sure to include an
|
|
Packit |
db3073 |
explicit call to PKG_PROG_PKG_CONFIG in your configure.ac.
|
|
Packit |
db3073 |
|
|
Packit |
db3073 |
Also note that repeated usage of VARIABLE-PREFIX is not recommended.
|
|
Packit |
db3073 |
After the first successful usage, subsequent calls with the same
|
|
Packit |
db3073 |
VARIABLE-PREFIX will simply use the _LIBS and _CFLAGS variables set from
|
|
Packit |
db3073 |
the previous usage without calling \fIpkg-config\fP again.
|
|
Packit |
db3073 |
.\"
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "PKG_PROG_PKG_CONFIG([MIN-VERSION])"
|
|
Packit |
db3073 |
|
|
Packit |
db3073 |
Defines the PKG_CONFIG variable to the best pkg-config available,
|
|
Packit |
db3073 |
useful if you need pkg-config but don't want to use PKG_CHECK_MODULES.
|
|
Packit |
db3073 |
.\"
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])"
|
|
Packit |
db3073 |
|
|
Packit |
db3073 |
Check to see whether a particular set of modules exists. Similar
|
|
Packit |
db3073 |
to PKG_CHECK_MODULES(), but does not set variables or print errors.
|
|
Packit |
db3073 |
|
|
Packit |
db3073 |
Similar to PKG_CHECK_MODULES, make sure that the first instance of
|
|
Packit |
db3073 |
this or PKG_CHECK_MODULES is called, or make sure to call
|
|
Packit |
db3073 |
PKG_CHECK_EXISTS manually.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "PKG_INSTALLDIR(DIRECTORY)"
|
|
Packit |
db3073 |
|
|
Packit |
db3073 |
Substitutes the variable pkgconfigdir as the location where a module
|
|
Packit |
db3073 |
should install pkg-config .pc files. By default the directory is
|
|
Packit |
db3073 |
$libdir/pkgconfig, but the default can be changed by passing DIRECTORY.
|
|
Packit |
db3073 |
The user can override through the --with-pkgconfigdir parameter.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "PKG_NOARCH_INSTALLDIR(DIRECTORY)"
|
|
Packit |
db3073 |
|
|
Packit |
db3073 |
Substitutes the variable noarch_pkgconfigdir as the location where a
|
|
Packit |
db3073 |
module should install arch-independent pkg-config .pc files. By default
|
|
Packit |
db3073 |
the directory is $datadir/pkgconfig, but the default can be changed by
|
|
Packit |
db3073 |
passing DIRECTORY. The user can override through the
|
|
Packit |
db3073 |
--with-noarch-pkgconfigdir parameter.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])"
|
|
Packit |
db3073 |
|
|
Packit |
db3073 |
Retrieves the value of the pkg-config variable CONFIG-VARIABLE from
|
|
Packit |
db3073 |
MODULE and stores it in VARIABLE. Note that repeated usage of VARIABLE
|
|
Packit |
db3073 |
is not recommended as the check will be skipped if the variable is
|
|
Packit |
db3073 |
already set.
|
|
Packit |
db3073 |
|
|
Packit |
db3073 |
.SH METADATA FILE SYNTAX
|
|
Packit |
db3073 |
To add a library to the set of packages \fIpkg-config\fP knows about,
|
|
Packit |
db3073 |
simply install a \fI.pc\fP file. You should install this file to
|
|
Packit |
db3073 |
.I libdir\fP/pkgconfig.
|
|
Packit |
db3073 |
.PP
|
|
Packit |
db3073 |
Here is an example file:
|
|
Packit |
db3073 |
.nf
|
|
Packit |
db3073 |
# This is a comment
|
|
Packit |
db3073 |
prefix=/home/hp/unst # this defines a variable
|
|
Packit |
db3073 |
exec_prefix=${prefix} # defining another variable in terms of the first
|
|
Packit |
db3073 |
libdir=${exec_prefix}/lib
|
|
Packit |
db3073 |
includedir=${prefix}/include
|
|
Packit |
db3073 |
|
|
Packit |
db3073 |
Name: GObject # human-readable name
|
|
Packit |
db3073 |
Description: Object/type system for GLib # human-readable description
|
|
Packit |
db3073 |
Version: 1.3.1
|
|
Packit |
db3073 |
URL: http://www.gtk.org
|
|
Packit |
db3073 |
Requires: glib-2.0 = 1.3.1
|
|
Packit |
db3073 |
Conflicts: foobar <= 4.5
|
|
Packit |
db3073 |
Libs: -L${libdir} -lgobject-1.3
|
|
Packit |
db3073 |
Libs.private: -lm
|
|
Packit |
db3073 |
Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib/include
|
|
Packit |
db3073 |
.fi
|
|
Packit |
db3073 |
.PP
|
|
Packit |
db3073 |
You would normally generate the file using configure, so that the
|
|
Packit |
db3073 |
prefix, etc. are set to the proper values. The GNU Autoconf manual
|
|
Packit |
db3073 |
recommends generating files like .pc files at build time rather than
|
|
Packit |
db3073 |
configure time, so when you build the .pc file is a matter of taste
|
|
Packit |
db3073 |
and preference.
|
|
Packit |
db3073 |
.PP
|
|
Packit |
db3073 |
Files have two kinds of line: keyword lines start with a keyword plus
|
|
Packit |
db3073 |
a colon, and variable definitions start with an alphanumeric string
|
|
Packit |
db3073 |
plus an equals sign. Keywords are defined in advance and have special
|
|
Packit |
db3073 |
meaning to \fIpkg-config\fP; variables do not, you can have any
|
|
Packit |
db3073 |
variables that you wish (however, users may expect to retrieve the
|
|
Packit |
db3073 |
usual directory name variables).
|
|
Packit |
db3073 |
.PP
|
|
Packit |
db3073 |
Note that variable references are written "${foo}"; you can escape
|
|
Packit |
db3073 |
literal "${" as "$${".
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "Name:"
|
|
Packit |
db3073 |
This field should be a human-readable name for the package. Note that
|
|
Packit |
db3073 |
it is not the name passed as an argument to \fIpkg-config\fP.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "Description:"
|
|
Packit |
db3073 |
This should be a brief description of the package
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "URL:"
|
|
Packit |
db3073 |
An URL where people can get more information about and download the package
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "Version:"
|
|
Packit |
db3073 |
This should be the most-specific-possible package version string.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "Requires:"
|
|
Packit |
db3073 |
This is a comma-separated list of packages that are required by your
|
|
Packit |
db3073 |
package. Flags from dependent packages will be merged in to the flags
|
|
Packit |
db3073 |
reported for your package. Optionally, you can specify the version
|
|
Packit |
db3073 |
of the required package (using the operators =, <, >, >=, <=);
|
|
Packit |
db3073 |
specifying a version allows \fIpkg-config\fP to perform extra sanity
|
|
Packit |
db3073 |
checks. You may only mention the same package one time on the
|
|
Packit |
db3073 |
.I "Requires:"
|
|
Packit |
db3073 |
line. If the version of a package is unspecified, any version will
|
|
Packit |
db3073 |
be used with no checking.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I Requires.private:
|
|
Packit |
db3073 |
A list of packages required by this package. The difference from
|
|
Packit |
db3073 |
.I Requires
|
|
Packit |
db3073 |
is that the packages listed under
|
|
Packit |
db3073 |
.I Requires.private
|
|
Packit |
db3073 |
are not taken into account when a flag list is computed for
|
|
Packit |
db3073 |
dynamically linked executable (i.e., when \-\-static was not
|
|
Packit |
db3073 |
specified). In the situation where each .pc file corresponds to a
|
|
Packit |
db3073 |
library,
|
|
Packit |
db3073 |
.I Requires.private
|
|
Packit |
db3073 |
shall be used exclusively to specify the dependencies between the
|
|
Packit |
db3073 |
libraries.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "Conflicts:"
|
|
Packit |
db3073 |
This optional line allows \fIpkg-config\fP to perform additional
|
|
Packit |
db3073 |
sanity checks, primarily to detect broken user installations. The
|
|
Packit |
db3073 |
syntax is the same as
|
|
Packit |
db3073 |
.I "Requires:"
|
|
Packit |
db3073 |
except that
|
|
Packit |
db3073 |
you can list the same package more than once here, for example
|
|
Packit |
db3073 |
"foobar = 1.2.3, foobar = 1.2.5, foobar >= 1.3", if you have reason to
|
|
Packit |
db3073 |
do so. If a version isn't specified, then your package conflicts with
|
|
Packit |
db3073 |
all versions of the mentioned package.
|
|
Packit |
db3073 |
If a user tries to use your package and a conflicting package at the
|
|
Packit |
db3073 |
same time, then \fIpkg-config\fP will complain.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "Libs:"
|
|
Packit |
db3073 |
This line should give the link flags specific to your package.
|
|
Packit |
db3073 |
Don't add any flags for required packages; \fIpkg-config\fP will
|
|
Packit |
db3073 |
add those automatically.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "Libs.private:"
|
|
Packit |
db3073 |
This line should list any private libraries in use. Private libraries
|
|
Packit |
db3073 |
are libraries which are not exposed through your library, but are
|
|
Packit |
db3073 |
needed in the case of static linking. This differs from
|
|
Packit |
db3073 |
.I Requires.private
|
|
Packit |
db3073 |
in that it references libraries that do not have package files
|
|
Packit |
db3073 |
installed.
|
|
Packit |
db3073 |
.TP
|
|
Packit |
db3073 |
.I "Cflags:"
|
|
Packit |
db3073 |
This line should list the compile flags specific to your package.
|
|
Packit |
db3073 |
Don't add any flags for required packages; \fIpkg-config\fP will
|
|
Packit |
db3073 |
add those automatically.
|
|
Packit |
db3073 |
.\"
|
|
Packit |
db3073 |
.SH AUTHOR
|
|
Packit |
db3073 |
|
|
Packit |
db3073 |
.I pkg-config
|
|
Packit |
db3073 |
was written by James Henstridge, rewritten by Martijn van Beers, and
|
|
Packit |
db3073 |
rewritten again by Havoc Pennington. Tim Janik, Owen Taylor, and Raja
|
|
Packit |
db3073 |
Harinath submitted suggestions and some code.
|
|
Packit |
db3073 |
.I gnome-config
|
|
Packit |
db3073 |
was written by Miguel de Icaza, Raja Harinath and various hackers in
|
|
Packit |
db3073 |
the GNOME team. It was inspired by Owen Taylor's \fIgtk-config\fP
|
|
Packit |
db3073 |
program.
|
|
Packit |
db3073 |
.\"
|
|
Packit |
db3073 |
.SH BUGS
|
|
Packit |
db3073 |
|
|
Packit |
db3073 |
\fIpkg-config\fP does not handle mixing of parameters with and without
|
|
Packit |
db3073 |
= well. Stick with one.
|
|
Packit |
db3073 |
|
|
Packit |
db3073 |
Bugs can be reported at http://bugs.freedesktop.org/ under the
|
|
Packit |
db3073 |
.I pkg-config
|
|
Packit |
db3073 |
component.
|