From 52f2d5bf131e8af78f57cff8c8f842a3f183fb82 Mon Sep 17 00:00:00 2001 From: Andrew Potter Date: Sat, 11 Jan 2014 11:47:19 +0100 Subject: [PATCH] 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. --- ChangeLog | 1 + configure.ac | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1bf8b0e63..c73bfbd08 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/configure.ac b/configure.ac index 7bac41004..a9e7895f1 100644 --- a/configure.ac +++ b/configure.ac @@ -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 " > $LT; echo "#include " >> $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 " > $LT; echo "#include " >> $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