Source: Upstream
Upstream: Yes
Reason: Use system luajit
 diff --git a/configure.ac b/configure.ac
index be657b0..2c03951 100644
--- configure.ac
+++ configure.ac
@@ -376,6 +376,34 @@ AGI_OPT_PKG(ffms2, [build without ffms2 A/V provider [auto]], [Enable FFMS2 supp
 AGI_OPT_PKG(fftw3, [build without fftw support [auto]], [Enable fftw support])
 AGI_OPT_PKG(hunspell, [build without hunspell spell-checking [auto]], [Enable Hunspell support])
 
+########
+# LuaJIT
+########
+system_luajit="bundled"
+AC_ARG_WITH(system-luajit, AS_HELP_STRING([--without-system-luajit], [Use built-in LuaJIT [auto]]))
+# Check if it's available at all
+AS_IF([test x$with_system_luajit = xno], [],
+      [PKG_CHECK_MODULES(LUAJIT, luajit >= 2.0.0, [], [
+       AS_IF([test x$with_system_luajit = xyes],
+             [AC_MSG_FAILURE([--with-sytem-luajit was specified, but luajit could not be found])])
+       with_system_luajit="no"])])
+
+with_system_luajit="yes"
+system_luajit="system"
+
+
+AS_IF([test $with_system_luajit = no],
+      [AC_SUBST([LUAJIT_CFLAGS], ['-I$(TOP)vendor/luajit/include'])
+       AC_SUBST([LUAJIT_LIBS], ['$(TOP)vendor/luajit/src/libluajit.a'])])
+
+# We also need a Lua binary to run part of the build system
+# Which version doesn't matter as the scripts are portable between them
+AC_CHECK_PROGS([LUA], [lua luajit lua5.3 lua-5.3 lua5.2 lua-5.2 lua5.1 lua-5.1])
+
+# If the user doesn't have an installed copy of Lua, just use the one built
+# as part of building LuaJIT
+AS_IF([test -z $LUA], [LUA="$srcdir/vendor/luajit/src/host/minilua"])
+
 ######################################################
 # Debugging support
 ######################################################

