How to generate .pc files with Autotools

Daniel Leidert daniel.leidert.spam at
Tue Aug 28 11:02:12 PDT 2007

Am Dienstag, den 28.08.2007, 14:16 -0300 schrieb Murilo Belluzzo:

> I'm using the AutoTools to build a lib for the first time.  After many
> days of study and work, I finally made my library compile and install
> properly with "./configure and make".
> Now, I want to use pkg-config to make it easy for anyone to use my lib
> with PKG_CHECK_MODULES(). But, I get stuck on it because I couldn't
> find any tutorial or howto that teaches what I have to do to create
> the right .pc files for my lib and install them in the right place
> (even when ${prefix} is set to a path that is not the default). 

Many projects create a file with the following content:

/------------------ ------------------------

Name: <my library>
Description: <library to do something>
URL: <homepage>
Version: @VERSION@
Requires: <dependencies>
Libs: <link flags>
Cflags: <compile flags>

(replace "<...>" with strings, that fit your library, "@VAR@" is
replaced by configure)

then add this file to the list of files in AC_CONFIG_FILES
(, so its processed by configure. I would use to make sure, exec and exec-prefix cannot be "NONE".

> Can anyone tell me where I can find such information?

Simply look into packages shipping .pc files.

Regards, Daniel

More information about the pkg-config mailing list