[Top][All Lists]

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

Re: can I use pkg-config in my

From: Brian Dessent
Subject: Re: can I use pkg-config in my
Date: Tue, 27 May 2008 00:51:11 -0700

eawiggins wrote:

> bin_PROGRAMS= myprog
> cxp_CPPFLAGS= -I$(top_srcdir)/include $(shell pkg-config --cflags glib-2.0)
> cxp_SOURCES= main.cpp
> cxp_LDADD= $(OGRE_LIBS) $(OIS_LIBS) $(shell pkg-config --libs glib-2.0)

In addition to what Erik said, this is bad:

- $(shell) is a GNU make feature, and is not portable to other makes.
- Using $(shell) with a deferred assignment ('=') means the shell
command is executed every time that variable is expanded by make, which
could potentially be dozens of times; this can be very bad for
- Using $(shell) hides the value of the variable from automake, since it
is only expanded when make is run.

You should do all the pkg-config stuff from, and then just
refer to the substituted values in the  In fact the
pkg-config software already comes with all the m4 macros for this, e.g.
whatever_LIBS += @GLIB_LIBS@

You can even get fancy, such as if you have version prerequisites you
can specify them with PKG_CHECK_MODULES([GLIB], [glib-2.0 >= x.y.z]).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]