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.
nah 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 AND $ 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: <snip.mk> 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)) </snip.mk>
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.
gfsmdr IOhannes