# PaCkAgE DaTaStReAm
pkg-config 1 708
# end of header
07070100122586000081a400000000000000000000000151ae9af5000001200000010000010031ffffffffffffffff0000001300000000pkg-config/pkginfo PKG=pkg-config
NAME=pkg-config 0.28 SPARC 64bit Solaris 10
VERSION=0.28
PSTAMP=04th June 2013
VENDOR=Tollef Fog Heen
EMAIL=http://pkg-config.freedesktop.org/wiki/
DESC=pkg-config compiling helper tool
ARCH=sparc
CATEGORY=utility
CLASSES=none
BASEDIR=/
ISTATES=S s 1 2 3
RSTATES=S s 1 2 3
07070100122585000081a400000000000000000000000151ae9af6000003740000010000010031ffffffffffffffff0000001200000000pkg-config/pkgmap : 1 708
1 d none /usr ? ? ?
1 d none /usr/local ? ? ?
1 d none /usr/local/bin 0755 root root
1 f none /usr/local/bin/pkg-config 0755 root root 144648 22436 1370397404
1 f none /usr/local/bin/sparc-sun-solaris2.10-pkg-config 0755 root root 144520 14739 1370307052
1 d none /usr/local/share 0755 root root
1 d none /usr/local/share/aclocal 0755 root root
1 f none /usr/local/share/aclocal/pkg.m4 0644 root root 7799 34409 1370307052
1 d none /usr/local/share/doc 0755 root root
1 d none /usr/local/share/doc/pkg-config 0755 root root
1 f none /usr/local/share/doc/pkg-config/pkg-config-guide.html 0644 root root 17635 18511 1370307052
1 d none /usr/local/share/man 0755 root root
1 d none /usr/local/share/man/man1 0755 root root
1 f none /usr/local/share/man/man1/pkg-config.1 0644 root root 19178 46953 1370307052
1 i checkinstall 785 2565 1370397428
1 i pkginfo 288 22721 1370397429
07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000b00000000TRAILER!!! 07070100122586000081a400000000000000000000000151ae9af5000001200000010000010031ffffffffffffffff0000000800000000pkginfo PKG=pkg-config
NAME=pkg-config 0.28 SPARC 64bit Solaris 10
VERSION=0.28
PSTAMP=04th June 2013
VENDOR=Tollef Fog Heen
EMAIL=http://pkg-config.freedesktop.org/wiki/
DESC=pkg-config compiling helper tool
ARCH=sparc
CATEGORY=utility
CLASSES=none
BASEDIR=/
ISTATES=S s 1 2 3
RSTATES=S s 1 2 3
07070100122585000081a400000000000000000000000151ae9af6000003740000010000010031ffffffffffffffff0000000700000000pkgmap : 1 708
1 d none /usr ? ? ?
1 d none /usr/local ? ? ?
1 d none /usr/local/bin 0755 root root
1 f none /usr/local/bin/pkg-config 0755 root root 144648 22436 1370397404
1 f none /usr/local/bin/sparc-sun-solaris2.10-pkg-config 0755 root root 144520 14739 1370307052
1 d none /usr/local/share 0755 root root
1 d none /usr/local/share/aclocal 0755 root root
1 f none /usr/local/share/aclocal/pkg.m4 0644 root root 7799 34409 1370307052
1 d none /usr/local/share/doc 0755 root root
1 d none /usr/local/share/doc/pkg-config 0755 root root
1 f none /usr/local/share/doc/pkg-config/pkg-config-guide.html 0644 root root 17635 18511 1370307052
1 d none /usr/local/share/man 0755 root root
1 d none /usr/local/share/man/man1 0755 root root
1 f none /usr/local/share/man/man1/pkg-config.1 0644 root root 19178 46953 1370307052
1 i checkinstall 785 2565 1370397428
1 i pkginfo 288 22721 1370397429
07070100122596000041ed00000000000000000000000251ae9af6000000000000010000010031ffffffffffffffff0000000800000000install 07070100122597000081ed00000000000000000000000151ae9af4000003110000010000010031ffffffffffffffff0000001500000000install/checkinstall #!/bin/sh
#
expected_bits="64"
expected_release="5.10"
expected_platform="sparc"
#
release=`uname -r`
platform=`uname -p`
bits=`isainfo -b`
#
if [ ${platform} != ${expected_platform} ]; then
echo "\n\n\n\tThis package must be installed on a ${expected_platform} architecture\n"
echo "\tAborting installation.\n\n\n"
exit 1
fi
if [ ${release} != ${expected_release} ]; then
echo "\n\n\n\tThis package must be installed on a ${expected_release} machine\n"
echo "\tAborting installation.\n\n\n"
exit 1
fi
if [ ${bits} != ${expected_bits} ]; then
echo "\n\n\n\tThis package must be installed on a ${expected_bits} bit machine\n"
echo "\tYour machine is running a ${bits} bit O.S. currently\n"
echo "\tAborting installation.\n\n\n"
exit 1
fi
exit 0
07070100122587000041ed00000000000000000000000351ae9af6000000000000010000010031ffffffffffffffff0000000500000000root 07070100122588000041ed00000000000000000000000351ae9af6000000000000010000010031ffffffffffffffff0000000900000000root/usr 07070100122589000041ed00000000000000000000000451ae9af6000000000000010000010031ffffffffffffffff0000000f00000000root/usr/local 0707010012258d000041ed00000000000000000000000551ae9af6000000000000010000010031ffffffffffffffff0000001500000000root/usr/local/share 07070100122590000041ed00000000000000000000000351ae9af6000000000000010000010031ffffffffffffffff0000001900000000root/usr/local/share/doc 07070100122591000041ed00000000000000000000000251ae9af6000000000000010000010031ffffffffffffffff0000002400000000root/usr/local/share/doc/pkg-config 07070100122592000081a400000000000000000000000151ad39ec000044e30000010000010031ffffffffffffffff0000003a00000000root/usr/local/share/doc/pkg-config/pkg-config-guide.html
Guide to pkg-config
Dan Nicholson
This document aims to give an overview to using the pkg-config
tool from the perspective of both a user and a developer. It reviews the
concepts behind pkg-config, how to write pkg-config files
to support your project, and how to use pkg-config to integrate
with 3rd party projects.
More information on pkg-config can be found at the
website and in the
pkg-config(1) manual page.
This document assumes usage of pkg-config on a Unix-like
operating system such as Linux. Some of the details may be different on
other platforms.
Modern computer systems use many layered components to provide
applications to the user. One of the difficulties in assembling these parts
is properly integrating them. pkg-config collects metadata about
the installed libraries on the system and easily provides it to the user.
Without a metadata system such as pkg-config, it can be very
difficult to locate and obtain details about the services provided on a
given computer. For a developer, installing pkg-config files with
your package greatly eases adoption of your API.
The primary use of pkg-config is to provide the necessary
details for compiling and linking a program to a library. This metadata is
stored in pkg-config files. These files have the suffix
.pc and reside in specific locations known to the
pkg-config tool. This will be described in more detail later.
The file format contains predefined metadata keywords and freeform
variables. An example may be illustrative:
prefix=/usr/local
exec_prefix=${prefix}
includedir=${prefix}/include
libdir=${exec_prefix}/lib
Name: foo
Description: The foo library
Version: 1.0.0
Cflags: -I${includedir}/foo
Libs: -L${libdir} -lfoo
The keyword definitions such as Name: begin with a keyword
followed by a colon and the value. The variables such as prefix=
are a string and value separated by an equals sign. The keywords are defined
and exported by pkg-config. The variables are not necessary, but
can be used by the keyword definitions for flexibility or to store data not
covered by pkg-config.
Here is a short description of the keyword fields. A more in depth
description of these fields and how to use them effectively will be given in
the Writing pkg-config files section.
- Name: A human-readable name for the library or package. This
does not affect usage of the pkg-config tool, which uses the name
of the .pc file.
- Description: A brief description of the package.
- URL: An URL where people can get more information about and
download the package.
- Version: A string specifically defining the version of the
package.
- Requires: A list of packages required by this package. The
versions of these packages may be specified using the comparison operators
=, <, >, <= or >=.
- Requires.private: A list of private packages required by this
package but not exposed to applications. The version specific rules from
the Requires field also apply here.
- Conflicts: An optional field describing packages that this one
conflicts with. The version specific rules from the Requires
field also apply here. This field also takes multiple instances of the
same package. E.g., Conflicts: bar < 1.2.3, bar >= 1.3.0.
- Cflags: The compiler flags specific to this package and any
required libraries that don't support pkg-config. If the required
libraries support pkg-config, they should be added to
Requires or Requires.private.
- Libs: The link flags specific to this package and any required
libraries that don't support pkg-config. The same rule as
Cflags applies here.
- Libs.private: The link flags for private libraries required by
this package but not exposed to applications. The same rule as
Cflags applies here.
When creating pkg-config files for a package, it is first
necessary to decide how they will be distributed. Each file is best used to
describe a single library, so each package should have at least as many
pkg-config files as they do installed libraries.
The package name is determined through the filename of the
pkg-config metadata file. This is the portion of the filename prior
to the .pc suffix. A common choice is to match the library name to
the .pc name. For instance, a package installing libfoo.so
would have a corresponding libfoo.pc file containing the
pkg-config metadata. This choice is not necessary; the .pc
file should simply be a unique identifier for your library. Following the
above example, foo.pc or foolib.pc would probably work
just as well.
The Name, Description and URL fields are
purely informational and should be easy to fill in. The Version
field is a bit trickier to ensure that it is usable by consumers of the
data. pkg-config uses the algorithm from
RPM for version comparisons. This works best
with a dotted decimal number such as 1.2.3 since letters can cause
unexpected results. The number should be monotonically increasing and be
as specific as possible in describing the library. Usually it's sufficient
to use the package's version number here since it's easy for consumers to
track.
Before describing the more useful fields, it will be helpful to
demonstrate variable definitions. The most common usage is to define the
installation paths so that they don't clutter the metadata fields. Since
the variables are expanded recursively, this is very helpful when used in
conjunction with autoconf derived paths.
prefix=/usr/local
includedir=${prefix}/include
Cflags: -I${includedir}/foo
The most important pkg-config metadata fields are
Requires, Requires.private, Cflags, Libs
and Libs.private. They will define the metadata used by external
projects to compile and link with the library.
Requires and Requires.private define other modules
needed by the library. It is usually preferred to use the private variant of
Requires to avoid exposing unnecessary libraries to the program
that is linking with your library. If the program will not be using the
symbols of the required library, it should not be linking directly to that
library. See the discussion of
overlinking for a more
thorough explanation.
Since pkg-config always exposes the link flags of the
Requires libraries, these modules will become direct dependencies
of the program. On the other hand, libraries from Requires.private
will only be included when static linking. For this reason, it is usually
only appropriate to add modules from the same package in Requires.
The Libs field contains the link flags necessary to use that
library. In addition, Libs and Libs.private contain link
flags for other libraries not supported by pkg-config. Similar to
the Requires field, it is preferred to add link flags for external
libraries to the Libs.private field so programs do not acquire an
additional direct dependency.
Finally, the Cflags contains the compiler flags for using the
library. Unlike the Libs field, there is not a private variant of
Cflags. This is because the data types and macro definitions are
needed regardless of the linking scenario.
Assuming that there are .pc files installed on the system, the
pkg-config tool is used to extract the metadata for usage. A short
description of the options can be seen by executing
pkg-config --help. A more in depth discussion can be found in the
pkg-config(1) manual page. This section will provide a brief
explanation of common usages.
Consider a system with two modules, foo and bar.
Their .pc files might look like this:
foo.pc:
prefix=/usr
exec_prefix=${prefix}
includedir=${prefix}/include
libdir=${exec_prefix}/lib
Name: foo
Description: The foo library
Version: 1.0.0
Cflags: -I${includedir}/foo
Libs: -L${libdir} -lfoo
bar.pc:
prefix=/usr
exec_prefix=${prefix}
includedir=${prefix}/include
libdir=${exec_prefix}/lib
Name: bar
Description: The bar library
Version: 2.1.2
Requires.private: foo >= 0.7
Cflags: -I${includedir}
Libs: -L${libdir} -lbar
The version of the modules can be obtained with the --modversion
option.
$ pkg-config --modversion foo
1.0.0
$ pkg-config --modversion bar
2.1.2
To print the link flags needed for each module, use the --libs
option.
$ pkg-config --libs foo
-lfoo
$ pkg-config --libs bar
-lbar
Notice that pkg-config has suppressed part of the Libs
field for both modules. This is because it treats the -L flag
specially and knows that the ${libdir} directory /usr/lib
is part of the system linker search path. This keeps pkg-config
from interfering with the linker operation.
Also, although foo is required by bar, the link flags
for foo are not output. This is because foo is not
directly needed by an application that only wants to use the bar
library. For statically linking a bar application, we need both
sets of linker flags:
$ pkg-config --libs --static bar
-lbar -lfoo
pkg-config needs to output both sets of link flags in this case
to ensure that the statically linked application will find all the necessary
symbols. On the other hand, it will always output all the Cflags.
$ pkg-config --cflags bar
-I/usr/include/foo
$ pkg-config --cflags --static bar
-I/usr/include/foo
Another useful option, --exists, can be used to test for a
module's availability.
$ pkg-config --exists foo
$ echo $?
0
One of the nicest features of pkg-config is providing version
checking. It can be used to determine if a sufficient version is available.
$ pkg-config --libs "bar >= 2.7"
Requested 'bar >= 2.7' but version of bar is 2.1.2
Some commands will provide more verbose output when combined with the
--print-errors option.
$ pkg-config --exists --print-errors xoxo
Package xoxo was not found in the pkg-config search path.
Perhaps you should add the directory containing `xoxo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'xoxo' found
The message above references the PKG_CONFIG_PATH environment
variable. This variable is used to augment pkg-config's search
path. On a typical Unix system, it will search in the directories
/usr/lib/pkgconfig and /usr/share/pkgconfig. This will
usually cover system installed modules. However, some local modules may be
installed in a different prefix such as /usr/local. In that case,
it's necessary to prepend the search path so that pkg-config can
locate the .pc files.
$ pkg-config --modversion hello
Package hello was not found in the pkg-config search path.
Perhaps you should add the directory containing `hello.pc'
to the PKG_CONFIG_PATH environment variable
No package 'hello' found
$ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
$ pkg-config --modversion hello
1.0.0
A few autoconf macros
are also provided to ease integration of pkg-config modules into
projects.
- PKG_PROG_PKG_CONFIG([MIN-VERSION]): Locates the
pkg-config tool on the system and checks the version for
compatibility.
- PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]):
Checks to see whether a particular set of modules exists.
- PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]):
Checks to see whether a particular set of modules exists. If so, it sets
<VARIABLE-PREFIX>_CFLAGS and
<VARIABLE-PREFIX>_LIBS according to the output from
pkg-config --cflags and pkg-config --libs.
- My program uses library x. What do I do?
The pkg-config output can easily be used on the compiler
command line. Assuming the x library has a x.pc
pkg-config file:
cc `pkg-config --cflags --libs x` -o myapp myapp.c
The integration can be more robust when used with
autoconf and
automake. By using the
supplied PKG_CHECK_MODULES macro, the metadata is easily accessed
in the build process.
configure.ac:
PKG_CHECK_MODULES([X], [x])
Makefile.am:
myapp_CFLAGS = $(X_CFLAGS)
myapp_LDADD = $(X_LIBS)
If the x module is found, the macro will fill and substitute
the X_CFLAGS and X_LIBS variables. If the module is not
found, an error will be produced. Optional 3rd and 4th arguments can be
supplied to PKG_CHECK_MODULES to control actions when the module
is found or not.
- My library z installs header files which include libx
headers. What do I put in my z.pc file?
If the x library has pkg-config support, add it to
the Requires.private field. If it does not, augment the
Cflags field with the necessary compiler flags for using the
libx headers. In either case, pkg-config will output
the compiler flags when --static is used or not.
- My library z uses libx internally, but does not
expose libx data types in its public API. What do I put in my
z.pc file?
Again, add the module to Requires.private if it supports
pkg-config. In this case, the compiler flags will be emitted
unnecessarily, but it ensures that the linker flags will be present when
linking statically. If libx does not support pkg-config,
add the necessary linker flags to Libs.private.
Dan Nicholson <dbn.lists (at) gmail (dot) com>
Copyright (C) 2010 Dan Nicholson.
This document is licensed under the
GNU General Public License, Version 2
or any later version.
07070100122593000041ed00000000000000000000000351ae9af6000000000000010000010031ffffffffffffffff0000001900000000root/usr/local/share/man 07070100122594000041ed00000000000000000000000251ae9af6000000000000010000010031ffffffffffffffff0000001e00000000root/usr/local/share/man/man1 07070100122595000081a400000000000000000000000151ad39ec00004aea0000010000010031ffffffffffffffff0000002b00000000root/usr/local/share/man/man1/pkg-config.1 .\"
.\" pkg-config manual page.
.\" (C) Red Hat, Inc. based on gnome-config man page (C) Miguel de Icaza (miguel@gnu.org)
.\"
.
.TH pkg-config 1
.SH NAME
pkg-config \- Return metainformation about installed libraries
.SH SYNOPSIS
.PP
.B pkg-config
[\-\-modversion] [\-\-version] [\-\-help] [\-\-print-errors]
[\-\-silence-errors] [\-\-errors-to-stdout] [\-\-debug]
[\-\-cflags] [\-\-libs] [\-\-libs-only-L]
[\-\-libs-only-l] [\-\-cflags-only-I]
[\-\-variable=VARIABLENAME]
[\-\-define-variable=VARIABLENAME=VARIABLEVALUE]
[\-\-print-variables]
[\-\-uninstalled]
[\-\-exists] [\-\-atleast-version=VERSION] [\-\-exact-version=VERSION]
[\-\-max-version=VERSION] [\-\-list\-all] [LIBRARIES...]
[\-\-print-provides] [\-\-print-requires] [\-\-print-requires-private] [LIBRARIES...]
.SH DESCRIPTION
The \fIpkg-config\fP 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:
.PP
.nf
program: program.c
cc program.c $(pkg-config --cflags --libs gnomeui)
.fi
.PP
.I pkg-config
retrieves information about packages from special metadata
files. These files are named after the package, and has a
.I .pc
extension. On most systems, \fIpkg-config\fP looks in
.I /usr/lib/pkgconfig, /usr/share/pkgconfig, /usr/local/lib/pkgconfig
and
.I /usr/local/share/pkgconfig
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.
.PP
The package name specified on the \fIpkg-config\fP command line is
defined to be the name of the metadata file, minus the \fI.pc\fP
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").
.PP
In addition to specifying a package name on the command line, the full
path to a given \fI.pc\fP file may be given instead. This allows a
user to directly query a particular \fI.pc\fP file.
.\"
.SH OPTIONS
The following options are supported:
.TP
.I "--modversion"
Requests that the version information of the libraries specified on
the command line be displayed. If \fIpkg-config\fP 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 \fIpkg-config\fP
exits successfully. If one or more libraries is unknown,
.I pkg-config
exits with a nonzero code, and the contents of stdout are undefined.
.TP
.I "--version"
Displays the version of
.I pkg-config
and terminates.
.TP
.I "--help"
Displays a help message and terminates.
.TP
.I "--print-errors"
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 \fI.pc\fP file, then this option will cause errors explaining the
problem to be printed. With "predicate" options such as "--exists"
.I "pkg-config"
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.
.TP
.I "--silence-errors"
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 \fI.pc\fP file, then this option will keep errors explaining the
problem from being printed. With "predicate" options such as
"--exists" \fIpkg-config\fP 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.
.TP
.I "--errors-to-stdout"
If printing errors, print them to stdout rather than the default stderr
.TP
.I "--debug"
Print debugging information. This is slightly different than the
PKG_CONFIG_DEBUG_SPEW environment variable, which also enable
"--print-errors".
.PP
The following options are used to compile and link programs:
.TP
.I "--cflags"
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. \fIpkg-config\fP exits with a nonzero code if it
can't find metadata for one or more of the packages on the command
line.
.TP
.I "--cflags-only-I"
This prints the -I part of "--cflags". That is, it defines the header
search path but doesn't specify anything else.
.TP
.I "--libs"
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.
.TP
.I "--libs-only-L"
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.
.TP
.I "--libs-only-l"
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.
.TP
.I "--variable=VARIABLENAME"
This returns the value of a variable defined in a package's \fI.pc\fP
file. Most packages define the variable "prefix", for example, so you
can say:
.nf
$ pkg-config --variable=prefix glib-2.0
/usr/
.fi
.TP
.I "--define-variable=VARIABLENAME=VARIABLEVALUE"
This sets a global value for a variable, overriding the value in any
.I .pc
files. Most packages define the variable "prefix", for example, so you
can say:
.nf
$ pkg-config --print-errors --define-variable=prefix=/foo \e
--variable=prefix glib-2.0
/foo
.fi
.TP
.I "--print-variables"
Returns a list of all variables defined in the package.
.TP
.I "--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 against
uninstalled packages. If you specify the "--uninstalled" option,
.I pkg-config
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
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.)
.TP
.I "--exists"
.TP
.I "--atleast-version=VERSION"
.TP
.I "--exact-version=VERSION"
.TP
.I "--max-version=VERSION"
These options test whether the package or list of packages on the
command line are known to \fIpkg-config\fP, 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
exits successfully. Otherwise it exits unsuccessfully. Only the first
VERSION comparing option will be honored. Subsequent options of this
type will be ignored.
Rather than using the version-test options, you can simply give a version
constraint after each package name, for example:
.nf
$ pkg-config --exists 'glib-2.0 >= 1.3.4 libxml = 1.8.3'
.fi
Remember to use \-\-print-errors if you want error messages. When no
output options are supplied to \fIpkg-config\fP, \-\-exists is implied.
.TP
.I "--msvc-syntax"
This option is available only on Windows. It causes \fIpkg-config\fP
to output -l and -L flags in the form recognized by the Microsoft
Visual C++ command-line compiler, \fIcl\fP. Specifically, instead of
.I -Lx:/some/path
it prints \fI/libpath:x/some/path\fP, and instead of \fI-lfoo\fP it
prints \fIfoo.lib\fP. Note that the --libs output consists of flags
for the linker, and should be placed on the cl command line after a
/link switch.
.TP
.I "--dont-define-prefix"
This option is available only on Windows. It prevents \fIpkg-config\fP
from automatically trying to override the value of the variable
"prefix" in each .pc file.
.TP
.I "--prefix-variable=PREFIX"
Also this option is available only on Windows. It sets the name of the
variable that \fIpkg-config\fP automatically sets as described above.
.TP
.I "--static"
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.
.TP
.I "--list-all"
List all modules found in the \fIpkg-config\fP path.
.TP
.I "--print-provides"
List all modules the given packages provides.
.TP
.I "--print-requires"
List all modules the given packages requires.
.TP
.I "--print-requires-private"
List all modules the given packages requires for static linking (see --static).
.\"
.SH ENVIRONMENT VARIABLES
.TP
.I "PKG_CONFIG_PATH"
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/\fPpkgconfig:\fIdatadir\fP/pkgconfig where \fIlibdir\fP is
the libdir for \fIpkg-config\fP and \fIdatadir\fP is the datadir
for \fIpkg-config\fP when it was installed.
.TP
.I "PKG_CONFIG_DEBUG_SPEW"
If set, causes \fIpkg-config\fP to print all kinds of
debugging information and report all errors.
.TP
.I "PKG_CONFIG_TOP_BUILD_DIR"
A value to set for the magic variable \fIpc_top_builddir\fP
which may appear in \fI.pc\fP 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 \fIpkg-config\fP will be used.
This only matters when compiling/linking against a package that hasn't
yet 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 against
uninstalled packages. If this environment variable is set, it
disables 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 or -L/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 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)
.TP
.I "PKG_CONFIG_LIBDIR"
Replaces the default \fIpkg-config\fP search directory, usually \fI/usr/lib/pkgconfig\fP
.\"
.SH QUERYING PKG-CONFIG'S DEFAULTS
.I pkg-config
can be used to query itself for the default search path, version number
and other information, for instance using:
.nf
$ pkg-config --variable pc_path pkg-config
.fi
or
.nf
$ pkg-config --modversion pkg-config
.fi
.SH WINDOWS SPECIALITIES
If a .pc file is found in a directory that matches the usual
conventions (i.e., ends with \\lib\\pkgconfig or \\share\\pkgconfig),
the prefix for that package is assumed to be the grandparent of the
directory where the file was found, and the \fIprefix\fP variable is
overridden for that file accordingly.
If the value of a variable in a .pc file begins with the original,
non-overridden, value of the \fIprefix\fP variable, then the overridden
value of \fIprefix\fP is used instead.
.\"
.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])
.fi
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.
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.
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 \fIpkg-config\fP again.
.\"
.TP
.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.
.\"
.TP
.I "PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])"
Check to see whether a particular set of modules exists. Similar
to PKG_CHECK_MODULES(), but does not set variables or print errors.
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.
.TP
.I "PKG_INSTALLDIR(DIRECTORY)"
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.
.TP
.I "PKG_NOARCH_INSTALLDIR(DIRECTORY)"
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.
.TP
.I "PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])"
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.
.SH METADATA FILE SYNTAX
To 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
.I libdir\fP/pkgconfig.
.PP
Here is an example file:
.nf
# 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: http://www.gtk.org
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
.fi
.PP
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.
.PP
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 \fIpkg-config\fP; variables do not, you can have any
variables that you wish (however, users may expect to retrieve the
usual directory name variables).
.PP
Note that variable references are written "${foo}"; you can escape
literal "${" as "$${".
.TP
.I "Name:"
This field should be a human-readable name for the package. Note that
it 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 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 \fIpkg-config\fP to perform extra sanity
checks. You may only mention the same package one time on the
.I "Requires:"
line. If the version of a package is unspecified, any version will
be used with no checking.
.TP
.I Requires.private:
A list of packages required by this package. The difference from
.I Requires
is that the packages listed under
.I Requires.private
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
shall be used exclusively to specify the dependencies between the
libraries.
.TP
.I "Conflicts:"
This optional line allows \fIpkg-config\fP to perform additional
sanity checks, primarily to detect broken user installations. The
syntax is the same as
.I "Requires:"
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 \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 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
in that it references libraries that do not have package files
installed.
.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
.I pkg-config
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
was written by Miguel de Icaza, Raja Harinath and various 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.
Bugs can be reported at http://bugs.freedesktop.org/ under the
.I pkg-config
component.
0707010012258e000041ed00000000000000000000000251ae9af6000000000000010000010031ffffffffffffffff0000001d00000000root/usr/local/share/aclocal 0707010012258f000081a400000000000000000000000151ad39ec00001e770000010000010031ffffffffffffffff0000002400000000root/usr/local/share/aclocal/pkg.m4 # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
# serial 1 (pkg-config-0.24)
#
# Copyright © 2004 Scott James Remnant .
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
# ----------------------------------
AC_DEFUN([PKG_PROG_PKG_CONFIG],
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
fi
if test -n "$PKG_CONFIG"; then
_pkg_min_version=m4_default([$1], [0.9.0])
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
PKG_CONFIG=""
fi
fi[]dnl
])# PKG_PROG_PKG_CONFIG
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
#
# Check to see whether a particular set of modules exists. Similar
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
#
# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
# only at the first occurence in configure.ac, so if the first place
# it's called might be skipped (such as if it is within an "if", you
# have to call PKG_CHECK_EXISTS manually
# --------------------------------------------------------------
AC_DEFUN([PKG_CHECK_EXISTS],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
if test -n "$PKG_CONFIG" && \
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
m4_default([$2], [:])
m4_ifvaln([$3], [else
$3])dnl
fi])
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
# ---------------------------------------------
m4_define([_PKG_CONFIG],
[if test -n "$$1"; then
pkg_cv_[]$1="$$1"
elif test -n "$PKG_CONFIG"; then
PKG_CHECK_EXISTS([$3],
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes ],
[pkg_failed=yes])
else
pkg_failed=untried
fi[]dnl
])# _PKG_CONFIG
# _PKG_SHORT_ERRORS_SUPPORTED
# -----------------------------
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi[]dnl
])# _PKG_SHORT_ERRORS_SUPPORTED
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
# [ACTION-IF-NOT-FOUND])
#
#
# 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
#
#
# --------------------------------------------------------------
AC_DEFUN([PKG_CHECK_MODULES],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
pkg_failed=no
AC_MSG_CHECKING([for $1])
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])
if test $pkg_failed = yes; then
AC_MSG_RESULT([no])
_PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
else
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
m4_default([$4], [AC_MSG_ERROR(
[Package requirements ($2) were not met:
$$1_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
_PKG_TEXT])[]dnl
])
elif test $pkg_failed = untried; then
AC_MSG_RESULT([no])
m4_default([$4], [AC_MSG_FAILURE(
[The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
_PKG_TEXT
To get pkg-config, see .])[]dnl
])
else
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
AC_MSG_RESULT([yes])
$3
fi[]dnl
])# PKG_CHECK_MODULES
# PKG_INSTALLDIR(DIRECTORY)
# -------------------------
# 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.
AC_DEFUN([PKG_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
m4_pushdef([pkg_description],
[pkg-config installation directory @<:@]pkg_default[@:>@])
AC_ARG_WITH([pkgconfigdir],
[AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
[with_pkgconfigdir=]pkg_default)
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
]) dnl PKG_INSTALLDIR
# PKG_NOARCH_INSTALLDIR(DIRECTORY)
# -------------------------
# 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.
AC_DEFUN([PKG_NOARCH_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
m4_pushdef([pkg_description],
[pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
AC_ARG_WITH([noarch-pkgconfigdir],
[AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
[with_noarch_pkgconfigdir=]pkg_default)
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
]) dnl PKG_NOARCH_INSTALLDIR
# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
# -------------------------------------------
# Retrieves the value of the pkg-config variable for the given module.
AC_DEFUN([PKG_CHECK_VAR],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
_PKG_CONFIG([$1], [variable="][$3]["], [$2])
AS_VAR_COPY([$1], [pkg_cv_][$1])
AS_VAR_IF([$1], [""], [$5], [$4])dnl
])# PKG_CHECK_VAR
0707010012258a000041ed00000000000000000000000251ae9af6000000000000010000010031ffffffffffffffff0000001300000000root/usr/local/bin 0707010012258c000081ed00000000000000000000000151ad39ec000234880000010000010031ffffffffffffffff0000003400000000root/usr/local/bin/sparc-sun-solaris2.10-pkg-config ELF + -@ @ , @ 8 @ @ @ X X P P P P /usr/lib/sparcv9/ld.so.1
! # $ % ' ) * . 1 5 6 8 9 : ; <