Add support for using system LuaJIT rather than the bundled copy
Closes #1904.
This commit is contained in:
parent
45315476bd
commit
0ed6dd46fb
4 changed files with 53 additions and 7 deletions
|
@ -79,7 +79,7 @@ CFLAGS_ICONV = @ICONV_CFLAGS@
|
|||
CFLAGS_ICU = @ICU_I18N_CFLAGS@
|
||||
CFLAGS_LIBASS = @LIBASS_CFLAGS@
|
||||
CFLAGS_LIBPULSE = @LIBPULSE_CFLAGS@
|
||||
CFLAGS_LUA = -I$(TOP)vendor/luajit/include
|
||||
CFLAGS_LUA = @LUAJIT_CFLAGS@
|
||||
CFLAGS_OPENAL = @OPENAL_CFLAGS@
|
||||
CFLAGS_OSS = @OSS_CFLAGS@
|
||||
CFLAGS_PORTAUDIO = @PORTAUDIO_CFLAGS@
|
||||
|
@ -97,7 +97,7 @@ LIBS_ICONV = @ICONV_LIBS@
|
|||
LIBS_ICU = @ICU_UC_LIBS@ @ICU_I18N_LIBS@
|
||||
LIBS_LIBASS = @LIBASS_LIBS@
|
||||
LIBS_LIBPULSE = @LIBPULSE_LIBS@
|
||||
LIBS_LUA = $(TOP)vendor/luajit/src/libluajit.a
|
||||
LIBS_LUA = @LUAJIT_LIBS@
|
||||
LIBS_OPENAL = @OPENAL_LIBS@
|
||||
LIBS_PORTAUDIO = @PORTAUDIO_LIBS@
|
||||
LIBS_PTHREAD = @PTHREAD_LIBS@
|
||||
|
|
46
configure.ac
46
configure.ac
|
@ -383,6 +383,51 @@ 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])
|
||||
AGI_OPT_PKG(uchardet, [build without automatic character set detection [auto]], [Enable uchardet 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"])])
|
||||
|
||||
# Check if it's compiled in Lua 5.2 mode
|
||||
AS_IF([test x$with_system_luajit != xno], [
|
||||
aegisub_save_LIBS="$LIBS"
|
||||
aegisub_save_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $LUAJIT_CFLAGS"
|
||||
LIBS="$LIBS $LUAJIT_LIBS"
|
||||
AC_CACHE_CHECK(
|
||||
[whether LuaJIT is compiled in 5.2 mode], [agi_cv_luajit_is_52],
|
||||
[AC_RUN_IFELSE([AC_LANG_PROGRAM(
|
||||
[[#include <lauxlib.h>]],
|
||||
[[lua_State *L = luaL_newstate();
|
||||
if (!L) return 1;
|
||||
// This is valid in lua 5.2, but a syntax error in 5.1
|
||||
const char testprogram[] = "function foo() while true do break return end end";
|
||||
return luaL_loadstring(L, testprogram) == LUA_ERRSYNTAX;
|
||||
]])], [agi_cv_luajit_is_52="yes"], [agi_cv_luajit_is_52="no"])])
|
||||
CPPFLAGS="$aegisub_save_CPPFLAGS"
|
||||
LIBS="$aegisub_save_LIBS"
|
||||
|
||||
if test $agi_cv_luajit_is_52 != yes; then
|
||||
AS_IF([test x$with_system_luajit = xyes],
|
||||
[AC_MSG_FAILURE([LuaJIT must be compiled in Lua 5.2 mode])])
|
||||
with_system_luajit="no"
|
||||
else
|
||||
with_system_luajit="yes"
|
||||
system_luajit="system"
|
||||
fi
|
||||
])
|
||||
|
||||
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'])])
|
||||
|
||||
######################################################
|
||||
# Debugging support
|
||||
######################################################
|
||||
|
@ -572,4 +617,5 @@ Misc Packages
|
|||
uchardet: $with_uchardet $uchardet_disabled
|
||||
Hunspell: $with_hunspell $hunspell_disabled
|
||||
FFTW3: $with_fftw3 $fftw3_disabled
|
||||
LuaJIT: $system_luajit
|
||||
])
|
||||
|
|
|
@ -198,10 +198,10 @@ $(d)subtitles_provider.o_FLAGS := $(CFLAGS_LIBASS)
|
|||
$(d)subtitles_provider_libass.o_FLAGS := $(CFLAGS_LIBASS) -Wno-c++11-narrowing
|
||||
$(d)text_file_reader.o_FLAGS := -D_X86_
|
||||
$(d)video_provider_manager.o_FLAGS := $(CFLAGS_FFMS2)
|
||||
$(d)auto4_lua.o_FLAGS := -I$(TOP)vendor/luajit/include
|
||||
$(d)auto4_lua_assfile.o_FLAGS := -I$(TOP)vendor/luajit/include
|
||||
$(d)auto4_lua_dialog.o_FLAGS := -I$(TOP)vendor/luajit/include
|
||||
$(d)auto4_lua_progresssink.o_FLAGS := -I$(TOP)vendor/luajit/include
|
||||
$(d)auto4_lua.o_FLAGS := $(CFLAGS_LUA)
|
||||
$(d)auto4_lua_assfile.o_FLAGS := $(CFLAGS_LUA)
|
||||
$(d)auto4_lua_dialog.o_FLAGS := $(CFLAGS_LUA)
|
||||
$(d)auto4_lua_progresssink.o_FLAGS := $(CFLAGS_LUA)
|
||||
|
||||
$(src_OBJ): $(d)libresrc/bitmap.h $(d)libresrc/default_config.h
|
||||
|
||||
|
|
|
@ -396,7 +396,7 @@ namespace {
|
|||
name = GetPrettyFilename().string();
|
||||
|
||||
// create lua environment
|
||||
L = lua_open();
|
||||
L = luaL_newstate();
|
||||
if (!L) {
|
||||
description = "Could not initialize Lua state";
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue