summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac6
-rw-r--r--src/mod_magnet.c7
2 files changed, 12 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index de334e5d..32e0734a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1330,7 +1330,11 @@ AC_MSG_RESULT([$WITH_LUA])
if test "$WITH_LUA" != no; then
found_lua=0
if test "$WITH_LUA" != yes; then
- PKG_CHECK_MODULES([LUA], [$WITH_LUA >= 5.1],
+ lua_min_ver=5.1
+ if test "$WITH_LUA" = "luajit"; then
+ lua_min_ver=0
+ fi
+ PKG_CHECK_MODULES([LUA], [$WITH_LUA >= $lua_min_ver],
[found_lua=1],
[AC_MSG_NOTICE([Couldn\'t find requested lua pkg-config module $WITH_LUA])]
)
diff --git a/src/mod_magnet.c b/src/mod_magnet.c
index 030ac90b..cdf52fff 100644
--- a/src/mod_magnet.c
+++ b/src/mod_magnet.c
@@ -201,6 +201,12 @@ SETDEFAULTS_FUNC(mod_magnet_set_defaults) {
#endif
#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502
+#ifdef __has_include
+#if __has_include(<luajit.h>)
+#include <luajit.h>
+#endif
+#endif
+#if !defined(LUAJIT_VERSION_NUM) || LUAJIT_VERSION_NUM < 20005
static lua_Integer
lua_tointegerx (lua_State * const L, int idx, int *isnum)
{
@@ -210,6 +216,7 @@ lua_tointegerx (lua_State * const L, int idx, int *isnum)
return *isnum ? lua_tointeger(L, idx) : 0;
}
#endif
+#endif
#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502
/* lua5.1 backward compat definition */