NAME
pkg-config
—
a system for configuring build
dependency information
SYNOPSIS
pkg-config |
[options] module ... |
DESCRIPTION
pkg-config
is a program which helps to
configure compiler and linker flags for development libraries. This allows
build systems to detect other dependencies and use them with the system
toolchain.
The options are as follows:
--about
- Print the version number, the Copyright notice, and the license of the
pkg-config
program to standard output and exit. Most other options and all command line arguments are ignored. --atleast-pkgconfig-version
=version- Exit with error if the requested version number is
greater than the version number of the
pkg-config
program. --atleast-version
=version- Exit with error if the version number of each module is less than the specified version number.
--cflags
,--cflags-only-I
,--cflags-only-other
- Print all compiler flags required to compile against the
module, or only the include path
(
-I
) flags, or only the compiler flags that are not include path flags, respectively. --debug
- Print some non-fatal warning messages to standard error output that would
otherwise silently be ignored. If
pkg-config
was compiled without defining the preprocessor macroPKGCONF_LITE
, this option also prints many debugging messages to standard error output. --define-prefix
- Attempts to determine the prefix variable to use for CFLAGS and LIBS entry relocations. This is mainly useful for platforms where framework SDKs are relocatable, such as Windows.
--define-variable
=varname=value- Define varname as value. Variables are used in query output, and some modules' results may change based on the presence of a variable definition.
--digraph
- Dump the dependency resolver's solution as a graphviz ‘dot’
file. This can be used with graphviz to visualize module
interdependencies. This option is only available if the preprocessor macro
PKGCONF_LITE
was not defined during compilation. --dont-define-prefix
- Disables the ‘define-prefix’ feature.
--dont-relocate-paths
- Disables the path relocation feature.
--env
=varname- Print the requested values as variable declarations in a similar format as the env(1) command.
--env-only
- Initialize the module search path from
--with-path
andPKG_CONFIG_PATH
only, ignoringPKG_CONFIG_LIBDIR
and the compiled-in default directories. --errors-to-stdout
- Print all error, warning, and debugging messages to standard output instead of to standard error output.
--exact-version
=version- Exit with error if no module has exactly the specified version number.
--exists
- Exit with a non-zero exit status if the dependency resolver is unable to
find all of the requested modules. This option is
active by default and cannot be disabled. However, various other options
cause
pkg-config
to exit and report success or failure before all arguments have been inspected. --fragment-filter
=types- Filter the fragment lists for the specified types.
--ignore-conflicts
- Ignore ‘Conflicts’ rules in modules.
--keep-system-cflags
,--keep-system-libs
- Keep CFLAGS or linker flag fragments that would be filtered due to being included by default in the compiler.
--libs
,--libs-only-L
,--libs-only-l
,--libs-only-other
- Print all linker flags required to link against the
module, or only the library path
(
-L
) flags, or only the library (-l
) flags, or only the linker flags that are neither library path nor library flags, respectively. --list-all
- Walk the module search path in the order of descending priority. For each
pc(5) file
found, print one line to standard output, containing the basename of the
file without the extension, the
Name
property, a dash (‘-’), and theDescription
property. --list-package-names
- Perform the same search as
--list-all
, but only print the basename of each pc(5) file without the extension, not the module name and the description. --log-file
=file- Set the name of the output file where information
about selected modules is logged, both about those selected by arguments
and as dependencies. For each selected module, one line is printed to
standard output, containing the basename of the
pc(5) file
without the extension, optionally an operator and version number
describing the desired range of versions, and either the actual version
number in square brackets or the string "NOT-FOUND". If this
option is not provided, the name of the output file is instead taken from
the
PKG_CONFIG_LOG
environment variable, and if that is not provided either, this kind of logging is disabled. --max-version
=version- Exit with error if the version number of each module is greater than the specified version number.
--maximum-traverse-depth
=depth- Impose a limit on the allowed depth in the dependency graph. For example, a depth of 2 restricts the resolver from acting on child dependencies of modules added to the resolver's solution.
--modversion
- For each specified module, print the version number
to standard output. If the
--verbose
option is also specified, the name of the respective module and a colon is printed before each version number. This option implies--maximum-traverse-depth
=1 and overrides and disables all--cflags
and--libs
flags. --no-cache
- Skip caching packages when they are loaded into the internal resolver. This may result in an alternate dependency graph being computed.
--no-provides
- Ignore ‘Provides’ rules in modules when resolving dependencies.
--no-uninstalled
- Forbids the dependency resolver from considering 'uninstalled' modules as part of a solution.
--path
- For the first module given on the command line, let the dependency resolver find the pc(5) file describing that module, print the absolute pathname of that file to standard output, and exit immediately, ignoring most other options and all other arguments.
--prefix-variable
=variable- Sets the ‘prefix’ variable used by the ‘define-prefix’ feature.
--print-errors
- Print some messages about fatal errors to standard error output that would
otherwise be omitted. This option is implied by many other options, but
not by all. It can be overridden with
--silence-errors
. --print-provides
- For each specified module, print one line to
standard output containing the
Name
property, an equal sign (‘=’), and theVersion
property. If the module contains one or moreProvides
properties, print additional lines in dependency list format, one name per line, each name optionally followed by an operator and a version. This option implies--maximum-traverse-depth
=1 and overrides and disables all--cflags
and--libs
flags. --print-requires
,--print-requires-private
- For each specified module, print the
Requires
orRequires.private
properties, respectively, in dependency list format to standard output. Both of these options imply--maximum-traverse-depth
=1 and override and disable all--cflags
and--libs
flags. --print-variables
- Print all seen variables for a module to the output channel.
--pure
- Treats the computed dependency graph as if it were pure. This is mainly
intended for use with the
--static
flag. --relocate
=path- Relocates a path using the pkgconf_path_relocate API. This is mainly used by the testsuite to provide a guaranteed interface to the system's path relocation backend.
- Compute a simple dependency graph that is only suitable for shared linking.
--short-errors
- When printing error messages about modules that are not found or conflict with each other, avoid printing additional, verbose instructions explaining potential methods for solving the problem.
--silence-errors
- Do not print any error, warning, or debugging messages at all. Overrides
all of
--debug
,--errors-to-stdout
, and--print-errors
. --simulate
- Simulates resolving a dependency graph based on the requested modules on
the command line. Dumps a series of trees denoting pkgconf's resolver
state. This option is only available if the preprocessor macro
PKGCONF_LITE
was not defined during compilation. --static
- Compute a deeper dependency graph and use compiler/linker flags intended for static linking.
--uninstalled
- Exit with a non-zero result if the dependency resolver uses an ‘uninstalled’ module as part of its solution.
--validate
package ...- Validate specific ‘.pc’ files for correctness.
--variable
=varname- Print the value of varname.
--verbose
- This option only has an effect if
--modversion
is also specified. It prints the name of the respective module and a colon before each version number. --version
- Print the version number of the
pkg-config
program to standard output and exit. Most other options and all command line arguments are ignored. --with-path
=path- Prepend the directory path to the module search
path, giving it priority over all other directories including those from
PKG_CONFIG_PATH
andPKG_CONFIG_LIBDIR
.
ENVIRONMENT
DESTDIR
- If set to PKG_CONFIG_SYSROOT_DIR, assume that PKG_CONFIG_FDO_SYSROOT_RULES is set.
PKG_CONFIG_DEBUG_SPEW
- If set, enables additional debug logging. The format of the debug log messages is implementation-specific.
PKG_CONFIG_DISABLE_UNINSTALLED
- If set, enables the same behaviour as the
--no-uninstalled
flag. PKG_CONFIG_DONT_RELOCATE_PATHS
- If set, disables the path relocation feature.
PKG_CONFIG_FDO_SYSROOT_RULES
- If set, follow the sysroot prefixing rules that freedesktop.org pkg-config uses.
PKG_CONFIG_LIBDIR
- A colon-separated list of low-priority directories where
pc(5) files are
looked up. The module search path is constructed by appending this list to
PKG_CONFIG_PATH
, which enjoys higher priority. IfPKG_CONFIG_LIBDIR
is not defined, the default list compiled into thepkg-config
program from thePKG_DEFAULT_PATH
preprocessor macro is appended instead. IfPKG_CONFIG_LIBDIR
is defined but empty, nothing is appended. PKG_CONFIG_LOG
- If set, log information about selected modules to the file with the name
stored in this variable. For more details, see the
--log-file
command line option, which overrides this variable. PKG_CONFIG_MSVC_SYNTAX
- If set, uses MSVC syntax for fragments.
PKG_CONFIG_PATH
- A colon-separated list of high-priority directories where
pc(5) files are
looked up. The module search path is constructed by prepending the
directory specified with
--with-path
, if any, and unless--env-only
is specified, by appending eitherPKG_CONFIG_LIBDIR
or the compiled-in default directories with lower priority. PKG_CONFIG_PURE_DEPGRAPH
- If set, enables the same behaviour as the
--pure
flag. PKG_CONFIG_SYSROOT_DIR
- ‘sysroot’ directory, will be prepended to every path defined
in
PKG_CONFIG_PATH
. Useful for cross compilation. PKG_CONFIG_SYSTEM_INCLUDE_PATH
- List of paths that are considered system include paths by the toolchain. This is a pkgconf-specific extension.
PKG_CONFIG_SYSTEM_LIBRARY_PATH
- List of paths that are considered system library paths by the toolchain. This is a pkgconf-specific extension.
PKG_CONFIG_TOP_BUILD_DIR
- Provides an alternative setting for the ‘pc_top_builddir’ global variable.
EXIT STATUS
The pkg-config
utility exits 0 on
success, and >0 if an error occurs.
EXAMPLES
Displaying the CFLAGS of a package:
$ pkg-config --cflags
foo
-fPIC -I/usr/include/foo