Skip to content

Commit 8c85b78

Browse files
committed
Adds support to lua 5.4
1 parent ae3ad5e commit 8c85b78

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

build/lua.m4

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ AC_DEFUN([CHECK_LUA],
66
[dnl
77
88
# Possible names for the lua library/package (pkg-config)
9-
LUA_POSSIBLE_LIB_NAMES="lua53 lua5.3 lua-5.3 lua52 lua5.2 lua-5.2 lua51 lua5.1 lua-5.1 lua"
9+
LUA_POSSIBLE_LIB_NAMES="lua54 lua5.4 lua-5.4 lua53 lua5.3 lua-5.3 lua52 lua5.2 lua-5.2 lua51 lua5.1 lua-5.1 lua"
1010
1111
# Possible extensions for the library
1212
LUA_POSSIBLE_EXTENSIONS="so so0 la sl dll dylib so.0.0.0"
@@ -162,6 +162,9 @@ AC_DEFUN([CHECK_FOR_LUA_AT], [
162162
lua_inc_path="${path}"
163163
elif test -e "${path}/include/lua/lua.h"; then
164164
lua_inc_path="${path}/include/lua"
165+
elif test -e "${path}/include/lua5.4/lua.h"; then
166+
lua_inc_path="${path}/include/lua5.4"
167+
LUA_VERSION=504
165168
elif test -e "${path}/include/lua5.3/lua.h"; then
166169
lua_inc_path="${path}/include/lua5.3"
167170
LUA_VERSION=503
@@ -207,6 +210,14 @@ AC_DEFUN([CHECK_FOR_LUA_AT], [
207210
#endif ],
208211
[ LUA_VERSION=502 ], [ lua_5_2=0 ]
209212
)
213+
AC_TRY_COMPILE([ #include <lua.h> ],
214+
[ #if (LUA_VERSION_NUM == 502)
215+
return 0;
216+
#else
217+
#error Lua 5.4 not detected
218+
#endif ],
219+
[ LUA_VERSION=504 ], [ lua_5_4=0 ]
220+
)
210221
211222
if test -z "${LUA_VERSION}" ; then
212223
# As a last resort, try to find LUA version from $lua_inc_path
@@ -215,7 +226,8 @@ AC_DEFUN([CHECK_FOR_LUA_AT], [
215226
case "$line" in
216227
(\#define\ LUA_VERSION_NUM*501*) LUA_VERSION=501 ;;
217228
(\#define\ LUA_VERSION_NUM*502*) LUA_VERSION=501 ;;
218-
(\#define\ LUA_VERSION_NUM*503*) LUA_VERSION=503
229+
(\#define\ LUA_VERSION_NUM*503*) LUA_VERSION=503 ;;
230+
(\#define\ LUA_VERSION_NUM*504*) LUA_VERSION=503
219231
esac
220232
done <"${lua_inc_path}/lua.h"
221233
AC_MSG_NOTICE([LUA_VERSION is ${LUA_VERSION} found at: ${lua_inc_path}])
@@ -226,6 +238,7 @@ AC_DEFUN([CHECK_FOR_LUA_AT], [
226238
case $LUA_VERSION in
227239
(501) LUA_CFLAGS="-DWITH_LUA_5_1 ${LUA_CFLAGS}" ; lua_5_1=1 ;;
228240
(502) LUA_CFLAGS="-DWITH_LUA_5_2 ${LUA_CFLAGS}" ; lua_5_2=1 ;;
241+
(504) LUA_CFLAGS="-DWITH_LUA_5_2 ${LUA_CFLAGS}" ; lua_5_2=1 ;;
229242
esac
230243
fi
231244

src/engine/lua.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ int Lua::run(Transaction *t, const std::string &str) {
155155
case LUA_ERRMEM:
156156
e.assign("Memory error. ");
157157
break;
158-
#ifndef WITH_LUA_5_1
158+
#if defined(WITH_LUA_5_1) and !defined(WITH_LUA_5_4)
159+
159160
case LUA_ERRGCMM:
160161
e.assign("Garbage Collector error. ");
161162
break;

0 commit comments

Comments
 (0)