pkg-config
From Wikipedia, the free encyclopedia
pkg-config is a piece of computer software that provides a unified interface for querying installed libraries for the purpose of compiling software from its source code. pkg-config was originally designed for GNU/Linux but is now also available for the various BSDs, Microsoft Windows, Mac OS X, and Solaris.
It outputs various information about installed libraries. This information may include:
- Parameters for C or C++ compiler
- Parameters for linker
- Version of the package in question
- Presence of a package (with specified range of versions) in the system
[edit] How it Works
When a library is installed (say from an RPM, deb or other binary packaging system), a .pc file should be included and placed into a directory with other .pc files (the exact directory is dependent upon your system and outlined in the pkg-config man page). This file has several entries.
These entries typically contain the libraries that the other programs using the package needs to compile as well as the location of header files, version information and a description.
Here is an example .pc file for libpng:
prefix=/usr/local exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${exec_prefix}/include Name: libpng12 Description: Loads and saves PNG files Version: 1.2.8 Libs: -L${libdir} -lpng12 -lz Cflags: -I${includedir}/libpng12
This file tells us that libraries can be found in /usr/local/lib and headers in /usr/local/include, that the library name is libpng12 and the version is 1.2.8. It also provides the linker flags that are needed to compile code depending upon libpng.
If one installs from source, often there will be no .pc file generated, and one may need to be manually written to reflect the install.
[edit] External links
|