pkg-config m4 macro



Hi,

In the CVS version of pkg-config I've added this macro:

 PKG_CHECK_MODULES (MYSTUFF, glib-2.0 >= 1.3.3 gtk+-2.0 = 1.3.3)

this will define the MYSTUFF_CFLAGS and MYSTUFF_LIBS variables with 
cflags/libs for the modules listed (glib and gtk), and will abort if 
the version predicates don't match. You can also use <=, <, etc., as
you might expect. Of course this example is kind of dumb since
gtk drags in glib anyway, so specifying glib there is pointless, but
you get the idea.

On the command line, pkg-config also now accepts version predicates in
the package list, so:

 pkg-config --cflags 'gtk+-2.0 = 1.3.3'

will exit nonzero if the GTK version is not 1.3.3, and otherwise will
return the cflags. You can also do stuff like:

 if pkg-config --exists 'gtk+-2.0 = 1.3.3 gnome-vfs >= 1.0'; then
    GTK_CFLAGS=`pkg-config --cflags gtk+-2.0`
    VFS_CFLAGS=`pkg-config --cflags gnome-vfs`
 fi

or whatever.

Note the use of quotes, if you don't quote '=' and '>=' and so on the
shell will mangle them.

So something along these lines will be in the next pkg-config release,
should be convenient to use.

Havoc






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]