[rrd-developers] Checking for lua in the configure script

Sebastian Harl sh at tokkee.org
Tue Sep 29 12:44:58 CEST 2009

Hi Fidelis,

On Mon, Sep 28, 2009 at 11:22:19AM -0300, Fidelis Assis wrote:
> Sebastian Harl escreveu:
> > In configure.ac, I found the following shell snippet:
> > 
> >   lua_exec_prefix=`$PKGCONFIG --variable=prefix $f 2>/dev/null`
> >   # same binaries?
> >   if test "$lua_exec_prefix/bin/lua" = "$LUA"; then
> >       # OK, found CFLAGS. Get Lua LFLAGS and modules install dir
> >       LUA_CFLAGS=`$PKGCONFIG --cflags $f 2>/dev/null`
> >       LUA_LFLAGS=`$PKGCONFIG --libs $f 2>/dev/null`
> >       LUA_INSTALL_CMOD=`$PKGCONFIG --variable=INSTALL_CMOD $f 2>/dev/null`
> >       LUA_INSTALL_LMOD=`$PKGCONFIG --variable=INSTALL_LMOD $f 2>/dev/null`
> >       break
> >   fi
> > 
> > What's the reason for that check?
> The reason is that pkg-config can only be used with the proper binary
> version, and I could not find a better way to guarantee that. For instance,
> if one downloads and installs a newer version directly from Lua site, not
> yet available in the distro, there will be a build failure without that
> check (pkg-config would report wrong paths).

Hrm … I'm not sure, I understood that correctly? What kind of wrong
paths does it return? That sounds like a bug in lua to me that should be
fixed. Since you're checking for an appropriate version (>= 5.1), that
should make sure that an appropriate version is available. Could you
please provide an example how that fails? Maybe someone can come up with
a better solution.

> Now I see that I fixed one but broke other non standard cases, like
> yours :(.

Hrm … not sure if having multiple versions installed in parallel should
be called a "non standard case" ;-)

>  Debian ships multiple versions of lua
> > and lets the user chose the default version (through the "alternatives"
> > system). A symlink /usr/bin/lua is then created pointing to the chosen
> > version. For the Debian packing of RRDtool I'd like to specify an exact
> > version though (i.e. LUA=/usr/bin/lua5.1)
> That's already the one to be used in first place. Only if lua5.1 is not
> found, or if you install another version from sources (tar.gz), you'll get
> different version.

Well, no - Debian provides, e.g. lua50 as well - depending on the user
configuration, /usr/bin/lua either points to lua50 or lua5.1 …

>  - in that case, that check
> > fails though and, thus, LUA_CFLAGS and LUA_LDFLAGS are empty causing a
> > build failure because the lua header files cannot be found.
> Sorry for the inconvenience, I'll think more on how to do a better check and
> not break your case. Suggestions are welcome :).

I'm pretty sure, we'll find a solution ;-) In the worst case, I'd have
to build-conflict with any other lua version to make sure /usr/bin/lua
points to lua5.1 - that's quite ugly though and I'd have to touch the
package any time a new version of lua has been uploaded, so I'd like to
avoid that.


Sebastian "tokkee" Harl +++ GnuPG-ID: 0x8501C7FC +++ http://tokkee.org/

Those who would give up Essential Liberty to purchase a little Temporary
Safety, deserve neither Liberty nor Safety.         -- Benjamin Franklin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20090929/2b81e3aa/attachment.pgp 

More information about the rrd-developers mailing list