Pkg-config

From LQWiki
Jump to navigation Jump to search

pkg-config is a simple package management tool used to display compiler and linker flags for a given library. Previous methods at doing this either involve hard-coding these values, or using a (libname)-config tool that outputted the compiler/linker flags for the library (libname), both of which have problems that pkg-config fixes.

For a library to be registered with pkg-config, it has to create a .pc file and install it. Installation directories are stored in the environment variables, but it's usually somewhere in the libdir.

Example

The following command shows a list of all registered libraries.

$ pkg-config --list-all
xf86rushproto          XF86RushProto - XF86Rush extension headers
fontsproto             FontsProto - Fonts extension headers
com_err                com_err - Common error description library
...

More information

For more information see the man page for pkg-config, which is quite thorough in documenting all aspects of using pkg-config.

External Links