lua: fix detection of Lua 5.2 in autotools (patch #8270)

lua_open() isn't defined on Lua 5.2 on Fedora 20. luaL_newstate() is
used in lua 5.1+, but lua 5.0 only has lua_main(). This adds a test
using luaL_newstate() if the lua_main() test fails.
This commit is contained in:
Andrew Potter 2014-01-11 11:47:19 +01:00 committed by Sebastien Helleu
parent 520f7369ba
commit 52f2d5bf13
2 changed files with 10 additions and 4 deletions

View File

@ -98,6 +98,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
* irc: add option irc.look.notice_welcome_tags
* irc: add server option "default_msg_kick" to customize default kick/kickban
message (task #12777)
* lua: fix detection of Lua 5.2 in autotools (patch #8270)
* lua: fix crash on calls to callbacks during load of script
* python: fix load of scripts with python >= 3.3
* relay: fix memory leak on unload of relay plugin

View File

@ -698,13 +698,18 @@ if test "x$enable_lua" = "xyes" ; then
AC_MSG_CHECKING(for Lua compiling and linking)
LUA_TEST=`LT=luatest.c ; echo "#include <lua.h>" > $LT; echo "#include <lualib.h>" >> $LT; echo "int main() { luaopen_base((lua_State *)lua_open()); return 0; }" >> $LT ; $CC -Wall $LT -o $LT.out $LUA_CFLAGS $LUA_LFLAGS $CFLAGS $LDFLAGS 1>/dev/null 2>&1 ; echo $?; rm -f $LT $LT.out 1>/dev/null 2>&1`
if test "x$LUA_TEST" != "x0" ; then
AC_MSG_RESULT(no)
AC_MSG_WARN([
LUA52_TEST=`LT=luatest.c ; echo "#include <lua.h>" > $LT; echo "#include <lualib.h>" >> $LT; echo "int main() { luaopen_base((lua_State *)luaL_newstate()); return 0; }" >> $LT ; $CC -Wall $LT -o $LT.out $LUA_CFLAGS $LUA_LFLAGS $CFLAGS $LDFLAGS 1>/dev/null 2>&1 ; echo $?; rm -f $LT $LT.out 1>/dev/null 2>&1`
if test "x$LUA52_TEST" != "x0" ; then
AC_MSG_RESULT(no)
AC_MSG_WARN([
*** Lua (>=5.0) headers and/or librairies couldn't be found on your system.
*** Try to install liblua, liblualib and liblua-dev with your software package manager.
*** WeeChat will be built without Lua support.])
enable_lua="no"
not_found="$not_found lua"
enable_lua="no"
not_found="$not_found lua"
else
AC_MSG_RESULT(yes)
fi
else
AC_MSG_RESULT(yes)
fi