You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2012/07/14 22:51:32 UTC
git commit: TS-1350: Detect and prefer LuaJIT
Updated Branches:
refs/heads/master 0467d1009 -> 9db4645bb
TS-1350: Detect and prefer LuaJIT
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/9db4645b
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/9db4645b
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/9db4645b
Branch: refs/heads/master
Commit: 9db4645bb51941a849235194387b55b3f580d433
Parents: 0467d10
Author: James Peach <jp...@apache.org>
Authored: Sat Jul 14 13:51:18 2012 -0700
Committer: James Peach <jp...@apache.org>
Committed: Sat Jul 14 13:51:18 2012 -0700
----------------------------------------------------------------------
CHANGES | 4 ++-
build/lua.m4 | 4 ---
configure.ac | 46 ++++++++++++++++++++++++++++----
plugins/experimental/lua/hook.cc | 2 +-
plugins/experimental/lua/lapi.cc | 6 ++++
5 files changed, 50 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9db4645b/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index a4b478d..f7b02e2 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
-*- coding: utf-8 -*-
Changes with Apache Traffic Server 3.3.0
- *) [TS-538] Remove deprecates INKStats API
+ *) [TS-1350] Detect and prefer LuaJIT
+
+ *) [TS-538] Remove deprecated INKStats API
*) [TS-1345] fix signed/unsigned compilation issues in Vec
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9db4645b/build/lua.m4
----------------------------------------------------------------------
diff --git a/build/lua.m4 b/build/lua.m4
index 187c230..0ac7244 100644
--- a/build/lua.m4
+++ b/build/lua.m4
@@ -130,10 +130,6 @@ if test -z "${LUA_LIBS}"; then
fi,
$2)
else
- AC_MSG_NOTICE([using '${LUA_LIBS}' for Lua Library])
- AC_ARG_ENABLE(luajit,
- AC_HELP_STRING(--enable-luajit,Enable LuaJit Support),
- TS_ADDTO(CPPFLAGS, ["-DTS_ENABLE_LUAJIT"]))
ifelse([$1], , , $1)
fi
])
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9db4645b/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index 4c06d9f..069cd84 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1060,13 +1060,47 @@ TS_CHECK_TCMALLOC
AX_LIB_READLINE
#
-# Check for Lua, at least version 5.1, sets LUA_CFLAGS and LUA_LIBS.
-CHECK_LUA(
- [ enable_lua_support="yes" ],
- [ enable_lua_support="no" ]
-)
+# Check for Lua, at least version 5.1, sets LUA_CFLAGS and LUA_LIBS. We support both standard
+# Lua and LuaJIT, preferring LuaJIT if the user did not indicate a preference.
+AC_ARG_ENABLE([luajit], [
+ AS_HELP_STRING([--enable-luajit], [enable LuaJIT support @<:@default=check@:>@])
+], [
+ enable_luajit="${enableval}"
+], [
+ enable_luajit=check
+])
+
+PKG_CHECK_MODULES([luajit], [luajit], [have_luajit=yes], [have_luajit=no])
+CHECK_LUA([have_lua=yes], [have_lua=no])
+
+AS_IF([ test "x$enable_luajit" = "xno" ], [
+ # LuaJIT disabled, just check for the regular Lua support.
+ enable_lua_support="${have_lua}"
+], [test "x$enable_luajit" = "xyes"], [
+ # LuaJIT required. Fail if it's not available.
+ AS_IF([ test "x${have_luajit}" = "xyes" ], [
+ LUA_CFLAGS="${luajit_CFLAGS}"
+ LUA_LIBS="${luajit_LIBS}"
+ enable_lua_support=LuaJIT
+ ], [
+ AC_MSG_ERROR([LuaJIT package not available])
+ ])
+], [
+ # No user preference, prefer LuaJIT over standard Lua.
+ AS_IF([ test "x${have_luajit}" = "xyes" ], [
+ LUA_CFLAGS="${luajit_CFLAGS}"
+ LUA_LIBS="${luajit_LIBS}"
+ enable_lua_support=LuaJIT
+ ], [
+ enable_lua_support="${have_lua}"
+ ])
+])
-AM_CONDITIONAL([BUILD_LUA_SUPPORT], [ test "x${enable_lua_support}" = "xyes" ])
+AC_SUBST(LUA_CFLAGS)
+AC_SUBST(LUA_LIBS)
+AC_MSG_CHECKING([whether to enable Lua support])
+AM_CONDITIONAL([BUILD_LUA_SUPPORT], [ test "x${enable_lua_support}" != "xno" ])
+AC_MSG_RESULT([$enable_lua_support])
# -----------------------------------------------------------------------------
# 5. CHECK FOR HEADER FILES
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9db4645b/plugins/experimental/lua/hook.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/lua/hook.cc b/plugins/experimental/lua/hook.cc
index 8b5e16b..0794acc 100644
--- a/plugins/experimental/lua/hook.cc
+++ b/plugins/experimental/lua/hook.cc
@@ -187,7 +187,7 @@ LuaHookApiInit(lua_State * lua)
continue;
}
- TSAssert(i == HttpHookDemuxTable[i].hookid);
+ TSAssert((int)i == HttpHookDemuxTable[i].hookid);
LuaSetConstantField(lua, HttpHookDemuxTable[i].name, HttpHookDemuxTable[i].hookid);
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9db4645b/plugins/experimental/lua/lapi.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/lua/lapi.cc b/plugins/experimental/lua/lapi.cc
index d9695b4..2eafcee 100644
--- a/plugins/experimental/lua/lapi.cc
+++ b/plugins/experimental/lua/lapi.cc
@@ -506,6 +506,12 @@ LuaHttpSsnRegister(lua_State * lua)
ssn = LuaHttpSession::get(lua, 1);
hookid = luaL_checkint(lua, 2);
+ // XXX: need to actually register the hooks here ...
+
+ // Prevent unused variable warnings.
+ (void)ssn;
+ (void)hookid;
+
return 1;
}