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

Fidelis Assis fidelis at pobox.com
Mon Sep 28 16:22:19 CEST 2009

Hi Sebastian,

Sebastian Harl escreveu:
> Hi,
> 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). Now I see that I fixed one but
broke other non standard cases, like yours :(.

 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.

 - 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 :).

Fidelis Assis

More information about the rrd-developers mailing list