[jamming] external program output -> variable

Matze Braun matze at braunis.de
Wed May 5 03:48:28 PDT 2004

On Wed, 5 May 2004, Igor Bukanov wrote:

> Hello!
> Is it possible to initialize a variable from an output of external program?
> freedesktop.org provides a utility called pkg-config, 
> http://www.freedesktop.org/Software/pkgconfig that prints compilation 
> and linking flags for various libraries and I would like to initialize 
> CCFLAGS and LINKFLAGS from its output.
> Currently I use a hack like:
> CCFLAGS += "`pkg-config --cflags gtk+-2.0`" ;
> LINKLIBS += "`pkg-config --libs gtk+-2.0`" ;
> but this relies on shell magic and will execute pkg-config for each and 
> every compilation and linking. Instead I would like to write something like:
> CCFLAGS += [ RunCommand pkg-config --cflags gtk+-2.0 ] ;
> LINKLIBS += [ RunCommand pkg-config --libs gtk+-2.0 ] ;
> The question then is how to implement RunCommand ?
I use autoconf scripts for my projects. I packed my custom rules and stuff 
a together. You can find it here if you wanna take a look on how 
integration with autoconf could look like:



More information about the jamming mailing list