[jamming] external program output -> variable

Igor Bukanov ml at igor.fastmail.fm
Wed May 5 00:39:56 PDT 2004


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 ?

Regards, Igor

More information about the jamming mailing list