In debian systems, liblua5.1.so is not found under /usr/lib like in other linux distributions. The test made by upstream in the configure.ac to find out if LUA_LIB should be "-llua" or "-llua5.1" sets the wrong value for debian. LUA_LIB must be "-llua5.1". 
--- a/configure.ac
+++ b/configure.ac
@@ -64,7 +64,7 @@
 	[PCRE_CONFIG="pcre-config"])
 AC_ARG_WITH(lua,AS_HELP_STRING(--with-lua=PATH,path to lua source dir),
 	[if test ! -d $withval; then AC_MSG_ERROR($withval is not a directory); else LUA_LIB_PATH="-L${withval}"; LUA_INCLUDES="-I${withval}"; LUA_LIB="-llua"; fi],
-        [LUA_LIB_PATH=""; if test -d /usr/include/lua5.1; then LUA_INCLUDES="-I/usr/include/lua5.1"; else LUA_INCLUDES=""; fi; if test -f /usr/lib/liblua5.1.a -o -f /usr/lib/liblua5.1.so -o -f /usr/lib/i386-linux-gnu/liblua5.1.so -o -f /usr/lib/i386-linux-gnu/liblua5.1.a; then LUA_LIB="-llua5.1"; else LUA_LIB="-llua"; fi])
+        [LUA_LIB_PATH=""; if test -d /usr/include/lua5.1; then LUA_INCLUDES="-I/usr/include/lua5.1"; else LUA_INCLUDES=""; fi; LUA_LIB="-llua5.1"])
 AC_ARG_WITH(spidermonkey,AS_HELP_STRING(--with-spidermonkey=PATH,path to js-config script),
 	[if test ! -x $withval/js-config; then AC_MSG_ERROR($withval/js-config do not exist or is not executable); else JS_CONFIG="$withval/js-config"; fi],
 	[JS_CONFIG="js-config"])
