variables given thru shell commands in *.pc files

Michał Górny mgorny at
Fri Sep 20 05:24:46 PDT 2013

Dnia 2013-09-20, o godz. 13:44:10
Basile Starynkevitch <basile at> napisał(a):

> I was thinking of adding some syntax to get pkg-config variables shell expanded. 
> So having in some *.pc a line like
>   somevar =| some-command
> would like the backquote or the $(...) notation in shells assign to somevar 
> the output given by some-command.
> Then we might have a file mysql.pc which could e.g. contain
>   ## file mysql.pc
>   ## command-expanded variables
>   version =| mysql_config --version
>   libdir =| mysql_config --variable=pkglibdir
>   mysql_cflags =| mysql_config --cflags
>   mysql_libs =| mysql_config --libs
>   Name: mysql
>   Version: ${version}
>   Description: MySQL database version ${version}
>   Cflags: ${mysql_cflags}
>   Libs: ${mysql_libs}
>   ## eof mysql.pc
> I would believe that such feature might be easy to implement (basically, calling popen).
> I do admit that it may open security risks (since some command is arbitrarily run).

How would that work for cross-compiling? Currently you can use
pkg-config compiled on build host to read data from target's .pc files.

Best regards,
Michał Górny
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 966 bytes
Desc: not available
URL: <>

More information about the pkg-config mailing list