Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 Synopsis  





2 Alternative implementations  





3 References  





4 External links  














pkg-config






Čeština
Deutsch
Español
Français


Українська

 

Edit links
 









Article
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Cite this page
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 


pkg-config
Original author(s)James Henstridge; rewritten by Havoc Pennington
Developer(s)Tollef Fog Heen / freedesktop.org
Initial release2000; 24 years ago (2000) or earlier
Stable release

0.29.2 / March 20, 2017; 7 years ago (2017-03-20)

Repositorygitlab.freedesktop.org/pkg-config/pkg-config
Written inC
Operating systemUnix-like
TypeProgramming tool
LicenseGNU GPL
Websitewww.freedesktop.org/wiki/Software/pkg-config/

pkg-config is a computer program that defines and supports a unified interface for querying installed libraries for the purpose of compiling software that depends on them. It allows programmers and installation scripts to work without explicit knowledge of detailed library path information. pkg-config was originally designed for Linux, but it is now also available for BSD, Microsoft Windows, macOS, and Solaris.

It outputs various information about installed libraries. This information may include:

The first implementation was written in shell.[1] Later, it was rewritten in C using the GLib library.[2]

Synopsis[edit]

When a library is installed (automatically through the use of an RPM, deb, or other binary packaging system or by compiling from the source), a .pc file should be included and placed into a directory with other .pc files (the exact directory is dependent upon the system and outlined in the pkg-config man page). This file has several entries.

These entries typically contain a list of dependent libraries that programs using the package also need to compile. Entries also typically include 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: libpng
Description: Loads and saves PNG files
Version: 1.2.8
Libs: -L${libdir} -lpng12 -lz
Cflags: -I${includedir}/libpng12

This file demonstrates how libpng informs that its libraries can be found in /usr/local/lib and its headers in /usr/local/include, that the library name is libpng, and that the version is 1.2.8. It also gives the additional linker flags that are needed to compile code that uses this library.

Here is an example of usage of pkg-config while compiling:

$ gcc -o test test.c $(pkg-config --libs --cflags libpng)

pkg-config can be used by build automation software such as CMake.

Alternative implementations[edit]

References[edit]

  1. ^ Havoc Pennington (4 June 2000). "Re: the *-config scripts". Retrieved 2020-01-22.
  • ^ Havoc Pennington (23 July 2000). "pkg-config". Retrieved 2020-01-22.
  • ^ a b c d Found on spread of pkgconf but not spread of pkg-config on repology
  • ^ a b c d Replacing pkg-config with pkgconfonarch-dev-public@lists.archlinux.org
  • ^ default, instead of pkg-config, on Alpine Linux,[3] Arch Linux,[4] CentOS 8+,[3] Fedora,[4] FreeBSD,[4] Mageia 7+,[3] Manjaro[3] and NetBSD[4]
  • External links[edit]


    Retrieved from "https://en.wikipedia.org/w/index.php?title=Pkg-config&oldid=1216789687"

    Categories: 
    Computer libraries
    Freedesktop.org
    Linux configuration utilities
    Hidden categories: 
    Articles with short description
    Short description is different from Wikidata
     



    This page was last edited on 2 April 2024, at 00:22 (UTC).

    Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Mobile view



    Wikimedia Foundation
    Powered by MediaWiki