Pkg-config
pkg-config is a 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. Later, it was rewritten in C leveraging GLib.
pkg-config is a 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. Later, it was rewritten in C leveraging GLib. ==Example== The following example .pc file defines information for libpng. It starts with defining variables that are used throughout the rest of the file. It includes descriptive information including name "libpng" and version "1.2.8". The Cflags entry defines an option that the C preprocessor uses to locate the library's header files in /usr/local/include/libpng12 . The Libs entry defines options that define the location of library binaries, /usr/local/lib , and identify which library binary files to link. 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 pkg-config --libs --cflags libpng is passed to gcc via its command line interface. $ gcc -o test test.c $(pkg-config --libs --cflags libpng)
References
- Re: the *-config scripts · retrieved 2020-01-21 · rev 1359592962
Cite this reference
MLA "Re: the *-config scripts." Havoc Pennington (4 June 2000). 2020-01-21. https://mail.gnome.org/archives/gtk-devel-list/2000-June/msg00023.html. Accessed 24 November 2026.
Chicago "Re: the *-config scripts." Havoc Pennington (4 June 2000). 2020-01-21. https://mail.gnome.org/archives/gtk-devel-list/2000-June/msg00023.html.
APA Havoc Pennington (4 June 2000). (2020). Re: the *-config scripts. Retrieved November 24, 2026, from https://mail.gnome.org/archives/gtk-devel-list/2000-June/msg00023.html
- pkg-config · retrieved 2020-01-21 · rev 1359592962
Cite this reference
MLA "pkg-config." Havoc Pennington (23 July 2000). 2020-01-21. https://mail.gnome.org/archives/gtk-devel-list/2000-July/msg00295.html. Accessed 24 November 2026.
Chicago "pkg-config." Havoc Pennington (23 July 2000). 2020-01-21. https://mail.gnome.org/archives/gtk-devel-list/2000-July/msg00295.html.
APA Havoc Pennington (23 July 2000). (2020). pkg-config. Retrieved November 24, 2026, from https://mail.gnome.org/archives/gtk-devel-list/2000-July/msg00295.html
- a b c d https://lists.archlinux.org/pipermail/arch-dev-public/2018-May/029252.html Replacing pkg-config with pkgconf] on arch-dev-public@lists.archlinux.org Wikipedia revision 1359592962, retrieved 2026-11-20 · retrieved 2026-11-19 · rev 1359592962
Cite this reference
MLA "a b c d https://lists.archlinux.org/pipermail/arch-dev-public/2018-May/029252.html Replacing pkg-config with pkgconf] on arch-dev-public@lists.archlinux.org Wikipedia revision 1359592962, retrieved 2026-11-20." a b c d https://lists. 2026-11-19. https://lists.archlinux.org/pipermail/arch-dev-public/2018-May/029252.html. Accessed 24 November 2026.
Chicago "a b c d https://lists.archlinux.org/pipermail/arch-dev-public/2018-May/029252.html Replacing pkg-config with pkgconf] on arch-dev-public@lists.archlinux.org Wikipedia revision 1359592962, retrieved 2026-11-20." a b c d https://lists. 2026-11-19. https://lists.archlinux.org/pipermail/arch-dev-public/2018-May/029252.html.
APA a b c d https://lists. (2026). a b c d https://lists.archlinux.org/pipermail/arch-dev-public/2018-May/029252.html Replacing pkg-config with pkgconf] on arch-dev-public@lists.archlinux.org Wikipedia revision 1359592962, retrieved 2026-11-20. Retrieved November 24, 2026, from https://lists.archlinux.org/pipermail/arch-dev-public/2018-May/029252.html
- a b c d e Found on spread of pkgconf but not spread of pkg-config on repology Wikipedia revision 1359592962, retrieved 2026-11-20 · retrieved 2026-11-19 · rev 1359592962
Cite this reference
MLA "a b c d e Found on spread of pkgconf but not spread of pkg-config on repology Wikipedia revision 1359592962, retrieved 2026-11-20." a b c d e Found on spread of pkgconf but not spread of pkg-config on repology Wikipedia revision 1359592962, retrieved 2. 2026-11-19. https://repology.org/project/pkgconf/versions. Accessed 24 November 2026.
Chicago "a b c d e Found on spread of pkgconf but not spread of pkg-config on repology Wikipedia revision 1359592962, retrieved 2026-11-20." a b c d e Found on spread of pkgconf but not spread of pkg-config on repology Wikipedia revision 1359592962, retrieved 2. 2026-11-19. https://repology.org/project/pkgconf/versions.
APA a b c d e Found on spread of pkgconf but not spread of pkg-config on repology Wikipedia revision 1359592962, retrieved 2. (2026). a b c d e Found on spread of pkgconf but not spread of pkg-config on repology Wikipedia revision 1359592962, retrieved 2026-11-20. Retrieved November 24, 2026, from https://repology.org/project/pkgconf/versions
Cite this article
MLA
"Pkg-config." encyclopegia.org, 2026, https://encyclopegia.org/wiki/pkg-config. Accessed 24 November 2026.
Chicago
"Pkg-config." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/pkg-config.
APA
encyclopegia.org. (2026). Pkg-config. Retrieved November 24, 2026, from https://encyclopegia.org/wiki/pkg-config
Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON