lua-users home
lua-l archive

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


I know this question isn't related to the Lua language itself, but
rather to various linux distributions and how the Lua library is made
available on them; but I hope I can get some help here anyway.

My problem is that I've recently started getting quite a lot of bug
reports from people who complain my game won't compile anymore, due to
some Lua issues. I've figured out what all those people have in
common, namely the fact that they've just upgraded from Lua 5.0 to Lua
5.1. I know it's not Lua's fault that some Linux distributions don't
offer packages like liblua50 and liblua51, but instead just have a
single package called something like liblua; it's annoying none the

Currently my configure (autoconf) script works by looking for both
liblua and liblua50, and simply links with anything it can find, and
includes any header files it can find (sometimes found in #include
<lua50/*>, sometimes found in #include <lua/*>, and sometimes found
only in #include <*>).
This worked fine when everybody was just using Lua 5.0, but now some
people are using Lua 5.1 which isn't backward compatible.

Of course I could just use the new Lua libraries instead (i.e. stop
using some macros), but what when Lua 5.2 comes out and it's the same
problem all over again? And, frankly, I don't feel like changing stuff
in my current code, as it works fine as it is. (if there's
security/bug-fixes in Lua 5.1, I hope they're released for Lua 5.0
too, so people don't need to change API to be up to date).
Another thing is that my game project might not be as active when Lua
5.2 comes out, so maybe there'll be none to fix it.

I hope there's a neat way to handle this problem, and maybe someone
who can redirect me to some autoconf code which can do it. Well, is
there? :)

Here's a snippet from my

AC_SEARCH_LIBS(lua_pushboolean,lua lua50, [], [AC_MSG_ERROR(liblua50
or liblua required)])
AC_SEARCH_LIBS(luaopen_math,lualib lualib50, [],
[AC_MSG_ERROR(liblualib50 or liblualib required)])




And this is where the headers are pulled in:

   #if defined(HAVE_LUA50_LUA_H)
     #include <lua50/lua.h>
   #elif defined(HAVE_LUA_LUA_H)
     #include <lua/lua.h>
   #elif defined(HAVE_LUA_H)
     #include <lua.h>
     #error Missing lua.h

   #if defined(HAVE_LUA50_LAUXLIB_H)
     #include <lua50/lauxlib.h>
   #elif defined(HAVE_LUA_LAUXLIB_H)
     #include <lua/lauxlib.h>
   #elif defined(HAVE_LAUXLIB_H)
     #include <lauxlib.h>
     #error Missing lauxlib.h

   #if defined(HAVE_LUA50_LUALIB_H)
     #include <lua50/lualib.h>
   #elif defined(HAVE_LUA_LUALIB_H)
     #include <lua/lualib.h>
   #elif defined(HAVE_LUALIB_H)
     #include <lualib.h>
     #error Missing lualib.h

Thanks in advance!

Rasmus Neckelmann