<s>
pkg-config	B-Application
is	O
a	O
computer	O
program	O
that	O
defines	O
and	O
supports	O
a	O
unified	O
interface	O
for	O
querying	O
installed	O
libraries	B-Library
for	O
the	O
purpose	O
of	O
compiling	B-Language
software	O
that	O
depends	O
on	O
them	O
.	O
</s>
<s>
pkg-config	B-Application
was	O
originally	O
designed	O
for	O
Linux	B-Application
,	O
but	O
it	O
is	O
now	O
also	O
available	O
for	O
BSD	B-Operating_System
,	O
Microsoft	B-Application
Windows	I-Application
,	O
macOS	B-Application
,	O
and	O
Solaris	B-Application
.	O
</s>
<s>
It	O
outputs	O
various	O
information	O
about	O
installed	O
libraries	B-Library
.	O
</s>
<s>
Later	O
,	O
it	O
was	O
rewritten	O
in	O
C	B-Language
using	O
the	O
GLib	B-Language
library	O
.	O
</s>
<s>
When	O
a	O
library	O
is	O
installed	O
(	O
automatically	O
through	O
the	O
use	O
of	O
an	O
RPM	B-Application
,	O
deb	O
,	O
or	O
other	O
binary	O
packaging	O
system	O
or	O
by	O
compiling	B-Language
from	O
the	O
source	O
)	O
,	O
a	O
.pc	O
file	O
should	O
be	O
included	O
and	O
placed	O
into	O
a	O
directory	O
with	O
other	O
.pc	O
files	O
(	O
the	O
exact	O
directory	O
is	O
dependent	O
upon	O
the	O
system	O
and	O
outlined	O
in	O
the	O
pkg-config	B-Application
man	O
page	O
)	O
.	O
</s>
<s>
These	O
entries	O
typically	O
contain	O
a	O
list	O
of	O
dependent	O
libraries	B-Library
that	O
programs	O
using	O
the	O
package	O
also	O
need	O
to	O
compile	B-Language
.	O
</s>
<s>
Entries	O
also	O
typically	O
include	O
the	O
location	O
of	O
header	B-Language
files	I-Language
,	O
version	O
information	O
and	O
a	O
description	O
.	O
</s>
<s>
Here	O
is	O
an	O
example	O
.pc	O
file	O
for	O
libpng	B-Language
:	O
</s>
<s>
This	O
file	O
demonstrates	O
how	O
libpng	B-Language
informs	O
that	O
its	O
libraries	B-Library
can	O
be	O
found	O
in	O
/usr/local/lib	O
and	O
its	O
headers	O
in	O
/usr/local/include	O
,	O
that	O
the	O
library	O
name	O
is	O
libpng	B-Language
,	O
and	O
that	O
the	O
version	O
is	O
1.2.8	O
.	O
</s>
<s>
It	O
also	O
gives	O
the	O
additional	O
linker	B-Application
flags	O
that	O
are	O
needed	O
to	O
compile	B-Language
code	O
that	O
uses	O
this	O
library	O
.	O
</s>
<s>
Here	O
is	O
an	O
example	O
of	O
usage	O
of	O
pkg-config	B-Application
while	O
compiling	B-Language
:	O
</s>
<s>
pkg-config	B-Application
can	O
be	O
used	O
by	O
build	B-Application
automation	I-Application
software	O
such	O
as	O
CMake	B-Language
.	O
</s>
<s>
GNU	B-Application
Libtool	I-Application
is	O
an	O
alternative	O
solution	O
for	O
managing	O
the	O
paths	O
,	O
dependencies	O
,	O
and	O
required	O
flags	O
when	O
linking	B-Application
to	O
a	O
library	O
.	O
</s>
<s>
pkg-config	B-Application
needs	O
to	O
be	O
invoked	O
explicitly	O
for	O
each	O
dependency	O
,	O
while	O
libtool	B-Application
wraps	O
the	O
call	O
to	O
the	O
compiler	B-Language
.	O
</s>
<s>
pkg-config	B-Application
has	O
the	O
--static	O
option	O
to	O
distinguish	O
between	O
static	O
and	O
dynamic	O
linking	B-Application
,	O
for	O
a	O
static	O
build	O
the	O
complete	O
list	O
of	O
dependencies	O
is	O
passed	O
to	O
the	O
compiler	B-Language
.	O
</s>
<s>
libtool	B-Application
does	O
not	O
distinguish	O
between	O
static	O
and	O
dynamic	O
linking	B-Application
,	O
always	O
passing	O
the	O
complete	O
list	O
of	O
dependencies	O
.	O
</s>
<s>
libtool	B-Application
is	O
only	O
useful	O
if	O
both	O
the	O
application	O
and	O
the	O
library	O
are	O
built	O
using	O
libtool	B-Application
,	O
while	O
library	O
written	O
in	O
any	O
language	O
can	O
ship	O
a	O
.pc	O
file	O
.	O
</s>
<s>
pkg-config	B-Application
relies	O
on	O
the	O
library	O
search	O
path	O
,	O
while	O
libtool	B-Application
references	O
libraries	B-Library
by	O
their	O
absolute	O
path	O
.	O
</s>
<s>
This	O
causes	O
build	O
failures	O
with	O
libtool	B-Application
when	O
,	O
for	O
example	O
,	O
a	O
library	O
is	O
moved	O
from	O
/lib	O
to	O
/usr/lib	O
.	O
</s>
