[PD-dev] building pdlua (was Re: [PD] pdlua)

IOhannes m zmölnig zmoelnig at iem.at
Wed Jul 23 09:55:24 CEST 2014

On 07/22/2014 06:31 PM, Dan Wilcox wrote:
> (replaying again with correct subject, stupid gmail & mime messages ...)
> Does the lua install include lua-config / pkg-config files on Linux? If so,
> you could call one of them:
> http://manpages.ubuntu.com/manpages/lucid/man1/lua-config50.1.html
> That's the best way since it doesnt involve hard coding or overrides except
> for weird cases.

the problem here is, that lua5.1 and lua5.2 (and probably other versions
of lua) are co-installable.
so we have both
 $ pkg-config --cflags lua5.1
 $ pkg-config --cflags lua5.2

both are valid setups.

i don't know an easy way to detect which one is installed and chose the
"first available" one, that does not involve a complicated build-system
like autotools.

something that comes to my mind:
LUA_VERSION=$(shell (pkg-config --exists lua5.3 && echo lua5.3) || \
                    (pkg-config --exists lua5.2 && echo lua5.2) || \
                    (pkg-config --exists lua5.1 && echo lua5.1) || \
                    (pkg-config --exists lua && echo lua))
LUA_CFLAGS=$(shell pkg-config --cflags $(LUA_VERSION))
LUA_LIBS=$(shell pkg-config --libs $(LUA_VERSION))

however, this depends on pkg-config to be available on the target
platform, and it will leave LUA_CFLAGS/LUA_LIBS unset if either
pkg-config is not found or none of the enumerated lua-versions is
installed (read: there's no default)

the nice thing is, that you can easily override the LUA_VERSION, e.g. using:
 make LUAVERSION=lua5.1
if you want to use lua-5.1 explicitely even though you have both 5.2 and
5.1 installed.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20140723/a28a22d0/attachment.sig>

More information about the Pd-dev mailing list