799 lines
25 KiB
HTML
799 lines
25 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of pkg-config</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>pkg-config</H1>
|
|
Section: User Commands (1)<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
pkg-config - Return metainformation about installed libraries
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<P>
|
|
|
|
<B>pkg-config</B>
|
|
|
|
[--modversion] [--version] [--help]
|
|
[--atleast-pkgconfig-version=VERSION]
|
|
[--print-errors] [--short-errors]
|
|
[--silence-errors] [--errors-to-stdout] [--debug]
|
|
[--cflags] [--libs] [--libs-only-L]
|
|
[--libs-only-l] [--cflags-only-I]
|
|
[--libs-only-other] [--cflags-only-other]
|
|
[--variable=VARIABLENAME]
|
|
[--define-variable=VARIABLENAME=VARIABLEVALUE]
|
|
[--print-variables]
|
|
[--uninstalled]
|
|
[--exists] [--atleast-version=VERSION] [--exact-version=VERSION]
|
|
[--max-version=VERSION] [--validate] [--list-all] [--print-provides]
|
|
[--print-requires] [--print-requires-private] [LIBRARIES...]
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<P>
|
|
The <I>pkg-config</I> program is used to retrieve information about
|
|
installed libraries in the system. It is typically used to compile
|
|
and link against one or more libraries. Here is a typical usage
|
|
scenario in a Makefile:
|
|
<P>
|
|
|
|
<PRE>
|
|
program: program.c
|
|
cc program.c $(pkg-config --cflags --libs gnomeui)
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
<I>pkg-config</I>
|
|
|
|
retrieves information about packages from special metadata
|
|
files. These files are named after the package, and has a
|
|
<I>.pc</I>
|
|
|
|
extension. On most systems, <I>pkg-config</I> looks in
|
|
<I>/usr/lib/pkgconfig, /usr/share/pkgconfig, /usr/local/lib/pkgconfig</I>
|
|
|
|
and
|
|
<I>/usr/local/share/pkgconfig</I>
|
|
|
|
for these files. It will additionally look in the colon-separated
|
|
(on Windows, semicolon-separated) list of directories specified by the
|
|
PKG_CONFIG_PATH environment variable.
|
|
<P>
|
|
|
|
The package name specified on the <I>pkg-config</I> command line is
|
|
defined to be the name of the metadata file, minus the <I>.pc</I>
|
|
extension. If a library can install multiple versions simultaneously,
|
|
it must give each version its own name (for example, GTK 1.2 might
|
|
have the package name "gtk+" while GTK 2.0 has "gtk+-2.0").
|
|
<P>
|
|
|
|
In addition to specifying a package name on the command line, the full
|
|
path to a given <I>.pc</I> file may be given instead. This allows a
|
|
user to directly query a particular <I>.pc</I> file.
|
|
|
|
<A NAME="lbAE"> </A>
|
|
<H2>OPTIONS</H2>
|
|
|
|
The following options are supported:
|
|
<DL COMPACT>
|
|
<DT id="1"><I>--modversion</I>
|
|
|
|
<DD>
|
|
Requests that the version information of the libraries specified on
|
|
the command line be displayed. If <I>pkg-config</I> can find all the
|
|
libraries on the command line, each library's version string is
|
|
printed to stdout, one version per line. In this case <I>pkg-config</I>
|
|
exits successfully. If one or more libraries is unknown,
|
|
<I>pkg-config</I>
|
|
|
|
exits with a nonzero code, and the contents of stdout are undefined.
|
|
<DT id="2"><I>--version</I>
|
|
|
|
<DD>
|
|
Displays the version of
|
|
<I>pkg-config</I>
|
|
|
|
and terminates.
|
|
<DT id="3"><I>--atleast-pkgconfig-version=VERSION</I>
|
|
|
|
<DD>
|
|
Requires at least the given version of pkg-config.
|
|
<DT id="4"><I>--help</I>
|
|
|
|
<DD>
|
|
Displays a help message and terminates.
|
|
<DT id="5"><I>--print-errors</I>
|
|
|
|
<DD>
|
|
If one or more of the modules on the command line, or their
|
|
dependencies, are not found, or if an error occurs in parsing
|
|
a <I>.pc</I> file, then this option will cause errors explaining the
|
|
problem to be printed. With "predicate" options such as "--exists"
|
|
<I>pkg-config</I>
|
|
|
|
runs silently by default, because it's usually used
|
|
in scripts that want to control what's output. This option can be used
|
|
alone (to just print errors encountered locating modules on the
|
|
command line) or with other options. The PKG_CONFIG_DEBUG_SPEW
|
|
environment variable overrides this option.
|
|
<DT id="6"><I>--short-errors</I>
|
|
|
|
<DD>
|
|
Print short error messages.
|
|
<DT id="7"><I>--silence-errors</I>
|
|
|
|
<DD>
|
|
If one or more of the modules on the command line, or their
|
|
dependencies, are not found, or if an error occurs in parsing a
|
|
a <I>.pc</I> file, then this option will keep errors explaining the
|
|
problem from being printed. With "predicate" options such as
|
|
"--exists" <I>pkg-config</I> runs silently by default, because it's
|
|
usually used in scripts that want to control what's output. So this
|
|
option is only useful with options such as "--cflags" or
|
|
"--modversion" that print errors by default. The PKG_CONFIG_DEBUG_SPEW
|
|
environment variable overrides this option.
|
|
<DT id="8"><I>--errors-to-stdout</I>
|
|
|
|
<DD>
|
|
If printing errors, print them to stdout rather than the default stderr
|
|
<DT id="9"><I>--debug</I>
|
|
|
|
<DD>
|
|
Print debugging information. This is slightly different than the
|
|
PKG_CONFIG_DEBUG_SPEW environment variable, which also enable
|
|
"--print-errors".
|
|
<P>
|
|
</DL>
|
|
<P>
|
|
|
|
The following options are used to compile and link programs:
|
|
<DL COMPACT>
|
|
<DT id="10"><I>--cflags</I>
|
|
|
|
<DD>
|
|
This prints pre-processor and compile flags required to compile the
|
|
packages on the command line, including flags for all their
|
|
dependencies. Flags are "compressed" so that each identical flag
|
|
appears only once. <I>pkg-config</I> exits with a nonzero code if it
|
|
can't find metadata for one or more of the packages on the command
|
|
line.
|
|
<DT id="11"><I>--cflags-only-I</I>
|
|
|
|
<DD>
|
|
This prints the -I part of "--cflags". That is, it defines the header
|
|
search path but doesn't specify anything else.
|
|
<DT id="12"><I>--cflags-only-other</I>
|
|
|
|
<DD>
|
|
This prints parts of "--cflags" not covered by "--cflags-only-I".
|
|
<DT id="13"><I>--libs</I>
|
|
|
|
<DD>
|
|
This option is identical to "--cflags", only it prints the link
|
|
flags. As with "--cflags", duplicate flags are merged (maintaining
|
|
proper ordering), and flags for dependencies are included in the
|
|
output.
|
|
<DT id="14"><I>--libs-only-L</I>
|
|
|
|
<DD>
|
|
This prints the -L/-R part of "--libs". That is, it defines the
|
|
library search path but doesn't specify which libraries to link with.
|
|
<DT id="15"><I>--libs-only-l</I>
|
|
|
|
<DD>
|
|
This prints the -l part of "--libs" for the libraries specified on
|
|
the command line. Note that the union of "--libs-only-l" and
|
|
"--libs-only-L" may be smaller than "--libs", due to flags such as
|
|
-rdynamic.
|
|
<DT id="16"><I>--libs-only-other</I>
|
|
|
|
<DD>
|
|
This prints the parts of "--libs" not covered by "--libs-only-L" and
|
|
"--libs-only-l", such as "--pthread".
|
|
<DT id="17"><I>--variable=VARIABLENAME</I>
|
|
|
|
<DD>
|
|
This returns the value of a variable defined in a package's <I>.pc</I>
|
|
file. Most packages define the variable "prefix", for example, so you
|
|
can say:
|
|
<PRE>
|
|
$ pkg-config --variable=prefix glib-2.0
|
|
/usr/
|
|
</PRE>
|
|
|
|
<DT id="18"><I>--define-variable=VARIABLENAME=VARIABLEVALUE</I>
|
|
|
|
<DD>
|
|
This sets a global value for a variable, overriding the value in any
|
|
<I>.pc</I>
|
|
|
|
files. Most packages define the variable "prefix", for example, so you
|
|
can say:
|
|
<PRE>
|
|
$ pkg-config --print-errors --define-variable=prefix=/foo \
|
|
--variable=prefix glib-2.0
|
|
/foo
|
|
</PRE>
|
|
|
|
<DT id="19"><I>--print-variables</I>
|
|
|
|
<DD>
|
|
Returns a list of all variables defined in the package.
|
|
<P>
|
|
<DT id="20"><I>--uninstalled</I>
|
|
|
|
<DD>
|
|
Normally if you request the package "foo" and the package
|
|
"foo-uninstalled" exists, <I>pkg-config</I> will prefer the
|
|
"-uninstalled" variant. This allows compilation/linking against
|
|
uninstalled packages. If you specify the "--uninstalled" option,
|
|
<I>pkg-config</I>
|
|
|
|
will return successfully if any "-uninstalled" packages are being
|
|
used, and return failure (false) otherwise. (The
|
|
PKG_CONFIG_DISABLE_UNINSTALLED environment variable keeps
|
|
<I>pkg-config</I>
|
|
|
|
from implicitly choosing "-uninstalled" packages, so if that variable
|
|
is set, they will only have been used if you pass a name like
|
|
"foo-uninstalled" on the command line explicitly.)
|
|
<DT id="21"><I>--exists</I>
|
|
|
|
<DD>
|
|
<DT id="22"><I>--atleast-version=VERSION</I>
|
|
|
|
<DD>
|
|
<DT id="23"><I>--exact-version=VERSION</I>
|
|
|
|
<DD>
|
|
<DT id="24"><I>--max-version=VERSION</I>
|
|
|
|
<DD>
|
|
These options test whether the package or list of packages on the
|
|
command line are known to <I>pkg-config</I>, and optionally whether the
|
|
version number of a package meets certain constraints. If all packages
|
|
exist and meet the specified version constraints,
|
|
<I>pkg-config</I>
|
|
|
|
exits successfully. Otherwise it exits unsuccessfully. Only the first
|
|
VERSION comparing option will be honored. Subsequent options of this
|
|
type will be ignored.
|
|
<P>
|
|
Rather than using the version-test options, you can simply give a version
|
|
constraint after each package name, for example:
|
|
<PRE>
|
|
$ pkg-config --exists 'glib-2.0 >= 1.3.4 libxml = 1.8.3'
|
|
</PRE>
|
|
|
|
Remember to use --print-errors if you want error messages. When no
|
|
output options are supplied to <I>pkg-config</I>, --exists is implied.
|
|
<DT id="25"><I>--validate</I>
|
|
|
|
<DD>
|
|
Checks the syntax of a package's
|
|
<I>.pc</I>
|
|
|
|
file for validity. This is the same as --exists except that
|
|
dependencies are not verified. This can be useful for package developers
|
|
to test their
|
|
<I>.pc</I>
|
|
|
|
file prior to release:
|
|
<PRE>
|
|
$ pkg-config --validate ./my-package.pc
|
|
</PRE>
|
|
|
|
<DT id="26"><I>--msvc-syntax</I>
|
|
|
|
<DD>
|
|
This option is available only on Windows. It causes <I>pkg-config</I>
|
|
to output -l and -L flags in the form recognized by the Microsoft
|
|
Visual C++ command-line compiler, <I>cl</I>. Specifically, instead of
|
|
<I>-Lx:/some/path</I>
|
|
|
|
it prints <I>/libpath:x/some/path</I>, and instead of <I>-lfoo</I> it
|
|
prints <I>foo.lib</I>. Note that the --libs output consists of flags
|
|
for the linker, and should be placed on the cl command line after a
|
|
/link switch.
|
|
<DT id="27"><I>--define-prefix</I>
|
|
|
|
<DD>
|
|
|
|
<I>--dont-define-prefix</I>
|
|
|
|
These options control whether
|
|
<I>pkg-config</I>
|
|
|
|
overrides the value of the variable
|
|
<I>prefix</I>
|
|
|
|
in each .pc file. With --define-prefix,
|
|
<I>pkg-config</I>
|
|
|
|
uses the installed location of the .pc file to determine the
|
|
prefix. --dont-define-prefix prevents this behavior. The default is
|
|
usually --define-prefix.
|
|
<P>
|
|
When this feature is enabled and a .pc file is found in a directory named
|
|
<I>pkgconfig</I>,
|
|
|
|
the prefix for that package is assumed to be the grandparent of the
|
|
directory where the file was found, and the
|
|
<I>prefix</I>
|
|
|
|
variable is overridden for that file accordingly.
|
|
<P>
|
|
If the value of a variable in a .pc file begins with the original,
|
|
non-overridden, value of the
|
|
<I>prefix</I>
|
|
|
|
variable, then the overridden value of
|
|
<I>prefix</I>
|
|
|
|
is used instead. This allows the feature to work even when the variables
|
|
have been expanded in the .pc file.
|
|
<DT id="28"><I>--prefix-variable=PREFIX</I>
|
|
|
|
<DD>
|
|
Set the name of the variable that
|
|
<I>pkg-config</I>
|
|
|
|
overrides instead of
|
|
<I>prefix</I>
|
|
|
|
when using the --define-prefix feature.
|
|
<DT id="29"><I>--static</I>
|
|
|
|
<DD>
|
|
Output libraries suitable for static linking. That means including
|
|
any private libraries in the output. This relies on proper tagging in
|
|
the .pc files, else a too large number of libraries will ordinarily be
|
|
output.
|
|
<DT id="30"><I>--list-all</I>
|
|
|
|
<DD>
|
|
List all modules found in the <I>pkg-config</I> path.
|
|
<DT id="31"><I>--print-provides</I>
|
|
|
|
<DD>
|
|
List all modules the given packages provides.
|
|
<DT id="32"><I>--print-requires</I>
|
|
|
|
<DD>
|
|
List all modules the given packages requires.
|
|
<DT id="33"><I>--print-requires-private</I>
|
|
|
|
<DD>
|
|
List all modules the given packages requires for static linking (see --static).
|
|
|
|
</DL>
|
|
<A NAME="lbAF"> </A>
|
|
<H2>ENVIRONMENT VARIABLES</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="34"><I>PKG_CONFIG_PATH</I>
|
|
|
|
<DD>
|
|
A colon-separated (on Windows, semicolon-separated) list of
|
|
directories to search for .pc files. The default directory will
|
|
always be searched after searching the path; the default is
|
|
<I>libdir/</I>pkgconfig:<I>datadir</I>/pkgconfig where <I>libdir</I> is
|
|
|
|
the libdir for <I>pkg-config</I> and <I>datadir</I> is the datadir
|
|
for <I>pkg-config</I> when it was installed.
|
|
<DT id="35"><I>PKG_CONFIG_DEBUG_SPEW</I>
|
|
|
|
<DD>
|
|
If set, causes <I>pkg-config</I> to print all kinds of
|
|
debugging information and report all errors.
|
|
<DT id="36"><I>PKG_CONFIG_TOP_BUILD_DIR</I>
|
|
|
|
<DD>
|
|
A value to set for the magic variable <I>pc_top_builddir</I>
|
|
which may appear in <I>.pc</I> files. If the environment variable is
|
|
not set, the default value '$(top_builddir)' will be used. This
|
|
variable should refer to the top builddir of the Makefile where the
|
|
compile/link flags reported by <I>pkg-config</I> will be used.
|
|
This only matters when compiling/linking against a package that hasn't
|
|
yet been installed.
|
|
<DT id="37"><I>PKG_CONFIG_DISABLE_UNINSTALLED</I>
|
|
|
|
<DD>
|
|
Normally if you request the package "foo" and the package
|
|
"foo-uninstalled" exists, <I>pkg-config</I> will prefer the
|
|
"-uninstalled" variant. This allows compilation/linking against
|
|
uninstalled packages. If this environment variable is set, it
|
|
disables said behavior.
|
|
<DT id="38"><I>PKG_CONFIG_ALLOW_SYSTEM_CFLAGS</I>
|
|
|
|
<DD>
|
|
Don't strip -I/usr/include out of cflags.
|
|
<DT id="39"><I>PKG_CONFIG_ALLOW_SYSTEM_LIBS</I>
|
|
|
|
<DD>
|
|
Don't strip -L/usr/lib or -L/lib out of libs.
|
|
<DT id="40"><I>PKG_CONFIG_SYSROOT_DIR</I>
|
|
|
|
<DD>
|
|
Modify -I and -L to use the directories located in target sysroot.
|
|
this option is useful when cross-compiling packages that use pkg-config
|
|
to determine CFLAGS and LDFLAGS. -I and -L are modified to point to
|
|
the new system root. this means that a -I/usr/include/libfoo will
|
|
become -I/var/target/usr/include/libfoo with a PKG_CONFIG_SYSROOT_DIR
|
|
equal to /var/target (same rule apply to -L)
|
|
<DT id="41"><I>PKG_CONFIG_LIBDIR</I>
|
|
|
|
<DD>
|
|
Replaces the default
|
|
<I>pkg-config</I>
|
|
|
|
search directory, usually
|
|
<I>/usr/lib/pkgconfig</I>:<I>/usr/share/pkgconfig</I>.
|
|
|
|
<DT id="42"><I>PKG_CONFIG_$PACKAGE_$VARIABLE</I>
|
|
|
|
<DD>
|
|
Overrides the variable VARIABLE in the package PACKAGE. The environment
|
|
variable should have the package name and package variable upper cased
|
|
with non-alphanumeric characters converted to underscores. For example,
|
|
setting PKG_CONFIG_GLADEUI_2_0_CATALOGDIR will override the variable
|
|
"catalogdir" in the "gladeui-2.0" package.
|
|
|
|
</DL>
|
|
<A NAME="lbAG"> </A>
|
|
<H2>PKG-CONFIG DERIVED VARIABLES</H2>
|
|
|
|
<I>pkg-config</I>
|
|
|
|
sets a few metadata variables that can be used in .pc files or queried
|
|
at runtime.
|
|
<DL COMPACT>
|
|
<DT id="43"><I>pc_path</I>
|
|
|
|
<DD>
|
|
The default search path used by
|
|
<I>pkg-config</I>
|
|
|
|
when searching for .pc files. This can be used in a query for the
|
|
<I>pkg-config</I>
|
|
|
|
module itself itself:
|
|
<PRE>
|
|
$ pkg-config --variable pc_path pkg-config
|
|
</PRE>
|
|
|
|
<DT id="44"><I>pcfiledir</I>
|
|
|
|
<DD>
|
|
The installed location of the .pc file. This can be used to query the
|
|
location of the .pc file for a particular module, but it can also be
|
|
used to make .pc files relocatable. For instance:
|
|
<PRE>
|
|
prefix=${pcfiledir}/../..
|
|
exec_prefix=${prefix}
|
|
libdir=${exec_prefix}/lib
|
|
includedir=${prefix}/include
|
|
</PRE>
|
|
|
|
<DT id="45"><I>pc_sysrootdir</I>
|
|
|
|
<DD>
|
|
The sysroot directory set by the user. When the sysroot directory has
|
|
not been set, this value is
|
|
<I>/</I>.
|
|
|
|
See the
|
|
<I>PKG_CONFIG_SYSROOT_DIR</I>
|
|
|
|
environment variable for more details.
|
|
<DT id="46"><I>pc_top_builddir</I>
|
|
|
|
<DD>
|
|
Location of the user's top build directory when calling
|
|
<I>pkg-config.</I>
|
|
|
|
This is useful to dynamically set paths in uninstalled .pc files. See
|
|
the
|
|
<I>PKG_CONFIG_TOP_BUILD_DIR</I>
|
|
|
|
environment variable for more details.
|
|
|
|
</DL>
|
|
<A NAME="lbAH"> </A>
|
|
<H2>WINDOWS SPECIALITIES</H2>
|
|
|
|
The
|
|
<I>pkg-config</I>
|
|
|
|
default search path is ignored on Windows. Instead, the search path is
|
|
constructed by using the installed directory of
|
|
<I>pkg-config</I>
|
|
|
|
and then appending
|
|
<I>lib\pkgconfig</I>
|
|
|
|
and
|
|
<I>share\pkgconfig</I>.
|
|
|
|
This can be augmented or replaced using the standard environment
|
|
variables described above.
|
|
|
|
<A NAME="lbAI"> </A>
|
|
<H2>AUTOCONF MACROS</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="47"><I>PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]])</I>
|
|
|
|
<DD>
|
|
<P>
|
|
The macro PKG_CHECK_MODULES can be used in <I>configure.ac</I> to
|
|
check whether modules exist. A typical usage would be:
|
|
<PRE>
|
|
PKG_CHECK_MODULES([MYSTUFF], [gtk+-2.0 >= 1.3.5 libxml = 1.8.4])
|
|
</PRE>
|
|
|
|
<P>
|
|
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.
|
|
<P>
|
|
Note that if there is a possibility the first call to
|
|
PKG_CHECK_MODULES might not happen, you should be sure to include an
|
|
explicit call to PKG_PROG_PKG_CONFIG in your configure.ac.
|
|
<P>
|
|
Also note that repeated usage of VARIABLE-PREFIX is not recommended.
|
|
After the first successful usage, subsequent calls with the same
|
|
VARIABLE-PREFIX will simply use the _LIBS and _CFLAGS variables set from
|
|
the previous usage without calling <I>pkg-config</I> again.
|
|
|
|
<DT id="48"><I>PKG_PREREQ(MIN-VERSION)</I>
|
|
|
|
<DD>
|
|
Checks that the version of the pkg-config autoconf macros in use is at
|
|
least MIN-VERSION. This can be used to ensure a particular pkg-config
|
|
macro will be available.
|
|
|
|
<DT id="49"><I>PKG_PROG_PKG_CONFIG([MIN-VERSION])</I>
|
|
|
|
<DD>
|
|
<P>
|
|
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.
|
|
|
|
<DT id="50"><I>PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]])</I>
|
|
|
|
<DD>
|
|
Enables static linking through --static prior to calling
|
|
PKG_CHECK_MODULES.
|
|
<DT id="51"><I>PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])</I>
|
|
|
|
<DD>
|
|
<P>
|
|
Check to see whether a particular set of modules exists. Similar
|
|
to PKG_CHECK_MODULES(), but does not set variables or print errors.
|
|
<P>
|
|
Similar to PKG_CHECK_MODULES, make sure that the first instance of
|
|
this or PKG_CHECK_MODULES is called, or make sure to call
|
|
PKG_CHECK_EXISTS manually.
|
|
<DT id="52"><I>PKG_INSTALLDIR(DIRECTORY)</I>
|
|
|
|
<DD>
|
|
<P>
|
|
Substitutes the variable pkgconfigdir as the location where a module
|
|
should install pkg-config .pc files. By default the directory is
|
|
$libdir/pkgconfig, but the default can be changed by passing DIRECTORY.
|
|
The user can override through the --with-pkgconfigdir parameter.
|
|
<DT id="53"><I>PKG_NOARCH_INSTALLDIR(DIRECTORY)</I>
|
|
|
|
<DD>
|
|
<P>
|
|
Substitutes the variable noarch_pkgconfigdir as the location where a
|
|
module should install arch-independent pkg-config .pc files. By default
|
|
the directory is $datadir/pkgconfig, but the default can be changed by
|
|
passing DIRECTORY. The user can override through the
|
|
--with-noarch-pkgconfigdir parameter.
|
|
<DT id="54"><I>PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])</I>
|
|
|
|
<DD>
|
|
<P>
|
|
Retrieves the value of the pkg-config variable CONFIG-VARIABLE from
|
|
MODULE and stores it in VARIABLE. Note that repeated usage of VARIABLE
|
|
is not recommended as the check will be skipped if the variable is
|
|
already set.
|
|
<P>
|
|
</DL>
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>METADATA FILE SYNTAX</H2>
|
|
|
|
To add a library to the set of packages <I>pkg-config</I> knows about,
|
|
simply install a <I>.pc</I> file. You should install this file to
|
|
<I>libdir</I>/pkgconfig.
|
|
|
|
<P>
|
|
|
|
Here is an example file:
|
|
<PRE>
|
|
# This is a comment
|
|
prefix=/home/hp/unst # this defines a variable
|
|
exec_prefix=${prefix} # defining another variable in terms of the first
|
|
libdir=${exec_prefix}/lib
|
|
includedir=${prefix}/include
|
|
|
|
Name: GObject # human-readable name
|
|
Description: Object/type system for GLib # human-readable description
|
|
Version: 1.3.1
|
|
URL: <A HREF="http://www.gtk.org">http://www.gtk.org</A>
|
|
Requires: glib-2.0 = 1.3.1
|
|
Conflicts: foobar <= 4.5
|
|
Libs: -L${libdir} -lgobject-1.3
|
|
Libs.private: -lm
|
|
Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib/include
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
You would normally generate the file using configure, so that the
|
|
prefix, etc. are set to the proper values. The GNU Autoconf manual
|
|
recommends generating files like .pc files at build time rather than
|
|
configure time, so when you build the .pc file is a matter of taste
|
|
and preference.
|
|
<P>
|
|
|
|
Files have two kinds of line: keyword lines start with a keyword plus
|
|
a colon, and variable definitions start with an alphanumeric string
|
|
plus an equals sign. Keywords are defined in advance and have special
|
|
meaning to <I>pkg-config</I>; variables do not, you can have any
|
|
variables that you wish (however, users may expect to retrieve the
|
|
usual directory name variables).
|
|
<P>
|
|
|
|
Note that variable references are written "${foo}"; you can escape
|
|
literal "${" as "$${".
|
|
<DL COMPACT>
|
|
<DT id="55"><I>Name:</I>
|
|
|
|
<DD>
|
|
This field should be a human-readable name for the package. Note that
|
|
it is not the name passed as an argument to <I>pkg-config</I>.
|
|
<DT id="56"><I>Description:</I>
|
|
|
|
<DD>
|
|
This should be a brief description of the package
|
|
<DT id="57"><I>URL:</I>
|
|
|
|
<DD>
|
|
An URL where people can get more information about and download the package
|
|
<DT id="58"><I>Version:</I>
|
|
|
|
<DD>
|
|
This should be the most-specific-possible package version string.
|
|
<DT id="59"><I>Requires:</I>
|
|
|
|
<DD>
|
|
This is a comma-separated list of packages that are required by your
|
|
package. Flags from dependent packages will be merged in to the flags
|
|
reported for your package. Optionally, you can specify the version
|
|
of the required package (using the operators =, <, >, >=, <=);
|
|
specifying a version allows <I>pkg-config</I> to perform extra sanity
|
|
checks. You may only mention the same package one time on the
|
|
<I>Requires:</I>
|
|
|
|
line. If the version of a package is unspecified, any version will
|
|
be used with no checking.
|
|
<DT id="60"><I>Requires.private:</I>
|
|
|
|
<DD>
|
|
A list of packages required by this package. The difference from
|
|
<I>Requires</I>
|
|
|
|
is that the packages listed under
|
|
<I>Requires.private</I>
|
|
|
|
are not taken into account when a flag list is computed for
|
|
dynamically linked executable (i.e., when --static was not
|
|
specified). In the situation where each .pc file corresponds to a
|
|
library,
|
|
<I>Requires.private</I>
|
|
|
|
shall be used exclusively to specify the dependencies between the
|
|
libraries.
|
|
<DT id="61"><I>Conflicts:</I>
|
|
|
|
<DD>
|
|
This optional line allows <I>pkg-config</I> to perform additional
|
|
sanity checks, primarily to detect broken user installations. The
|
|
syntax is the same as
|
|
<I>Requires:</I>
|
|
|
|
except that
|
|
you 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 to
|
|
do so. If a version isn't specified, then your package conflicts with
|
|
all versions of the mentioned package.
|
|
If a user tries to use your package and a conflicting package at the
|
|
same time, then <I>pkg-config</I> will complain.
|
|
<DT id="62"><I>Libs:</I>
|
|
|
|
<DD>
|
|
This line should give the link flags specific to your package.
|
|
Don't add any flags for required packages; <I>pkg-config</I> will
|
|
add those automatically.
|
|
<DT id="63"><I>Libs.private:</I>
|
|
|
|
<DD>
|
|
This line should list any private libraries in use. Private libraries
|
|
are libraries which are not exposed through your library, but are
|
|
needed in the case of static linking. This differs from
|
|
<I>Requires.private</I>
|
|
|
|
in that it references libraries that do not have package files
|
|
installed.
|
|
<DT id="64"><I>Cflags:</I>
|
|
|
|
<DD>
|
|
This line should list the compile flags specific to your package.
|
|
Don't add any flags for required packages; <I>pkg-config</I> will
|
|
add those automatically.
|
|
|
|
</DL>
|
|
<A NAME="lbAK"> </A>
|
|
<H2>AUTHOR</H2>
|
|
|
|
<P>
|
|
<I>pkg-config</I>
|
|
|
|
was written by James Henstridge, rewritten by Martijn van Beers, and
|
|
rewritten again by Havoc Pennington. Tim Janik, Owen Taylor, and Raja
|
|
Harinath submitted suggestions and some code.
|
|
<I>gnome-config</I>
|
|
|
|
was written by Miguel de Icaza, Raja Harinath and various hackers in
|
|
the GNOME team. It was inspired by Owen Taylor's <I>gtk-config</I>
|
|
program.
|
|
|
|
<A NAME="lbAL"> </A>
|
|
<H2>BUGS</H2>
|
|
|
|
<P>
|
|
<I>pkg-config</I> does not handle mixing of parameters with and without
|
|
= well. Stick with one.
|
|
<P>
|
|
Bugs can be reported at <A HREF="http://bugs.freedesktop.org/">http://bugs.freedesktop.org/</A> under the
|
|
<I>pkg-config</I>
|
|
|
|
component.
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="65"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="66"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="67"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="68"><A HREF="#lbAE">OPTIONS</A><DD>
|
|
<DT id="69"><A HREF="#lbAF">ENVIRONMENT VARIABLES</A><DD>
|
|
<DT id="70"><A HREF="#lbAG">PKG-CONFIG DERIVED VARIABLES</A><DD>
|
|
<DT id="71"><A HREF="#lbAH">WINDOWS SPECIALITIES</A><DD>
|
|
<DT id="72"><A HREF="#lbAI">AUTOCONF MACROS</A><DD>
|
|
<DT id="73"><A HREF="#lbAJ">METADATA FILE SYNTAX</A><DD>
|
|
<DT id="74"><A HREF="#lbAK">AUTHOR</A><DD>
|
|
<DT id="75"><A HREF="#lbAL">BUGS</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:23 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|