Pkg-config
pkg-config is software development tool that queries information about libraries from a local, file-based database for the purpose of building a codebase that depends on them. It allows for sharing a codebase in a cross-platform way by using host-specific library information that is stored outside of yet referenced by the codebase. This indirection allows the codebase to build on a host without encoding host-specific library information in the codebase. The tool is invoked via its command line interface (CLI), and it reports library information via standard output. Some information, such as version information, is more useful to the programmer. Other information, such as command-line options (flags), is more useful to build tools such as a compiler and a linker. The tool was originally designed for Linux, and is now also available for BSD, Windows, macOS, and Solaris. The first implementation was written in shell script.[1] Later, it was rewritten in C leveraging GLib.[2] DatabaseTo enable use of the tool, a referenced library must have a corresponding A ExampleThe following example prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${exec_prefix}/include
Name: libpng
Description: Loads and saves PNG files
Version: 1.2.8
Libs: -L${libdir} -lpng12 -lz
Cflags: -I${includedir}/libpng12
The following is an example build command that uses this file to specify options to gcc. The output of command $ gcc -o test test.c $(pkg-config --libs --cflags libpng)
Alternative implementationsNotable variants of pkg-config:
References
External links
|