diff --git a/configure.ac b/configure.ac index 160c79f72a..0c30551993 100644 --- a/configure.ac +++ b/configure.ac @@ -517,6 +517,9 @@ AC_SUBST(SYS_XMLRPC_CFLAGS) AC_SUBST(SYS_XMLRPC_LDFLAGS) AM_CONDITIONAL([SYSTEM_XMLRPCC],[test "${enable_xmlrpcc}" = "yes"]) +AC_ARG_ENABLE([system-lua],[AS_HELP_STRING([--enable-system-lua],[use system lib for lua])],,[enable_system_lua="no"]) +AM_CONDITIONAL([SYSTEM_LUA],[test "${enable_system_lua}" = "yes"]) + AC_ARG_ENABLE(srtp, [AC_HELP_STRING([--disable-srtp],[build without srtp support])],[enable_srtp="$enableval"],[enable_srtp="yes"]) diff --git a/src/mod/languages/mod_lua/Makefile.am b/src/mod/languages/mod_lua/Makefile.am index 2a0b51e933..57a2c6b213 100644 --- a/src/mod/languages/mod_lua/Makefile.am +++ b/src/mod/languages/mod_lua/Makefile.am @@ -3,26 +3,22 @@ include $(top_srcdir)/build/modmake.rulesam MODNAME=mod_lua -LUA_DIR=$(switch_srcdir)/src/mod/languages/mod_lua/lua -LIBLUA_A=$(LUA_DIR)/liblua.a - AM_CFLAGS += $(CFLAGS) -D_GNU_SOURCE mod_LTLIBRARIES = mod_lua.la -mod_lua_la_SOURCES = mod_lua.cpp freeswitch_lua.cpp mod_lua_wrap.cpp lua/lapi.c lua/lcode.c lua/lctype.c lua/ldebug.c lua/ldo.c lua/ldump.c lua/lfunc.c lua/lgc.c lua/llex.c lua/lmem.c lua/lobject.c lua/lopcodes.c lua/lparser.c lua/lstate.c lua/lstring.c lua/ltable.c lua/ltm.c lua/lundump.c lua/lvm.c lua/lzio.c lua/lauxlib.c lua/lbaselib.c lua/lbitlib.c lua/lcorolib.c lua/ldblib.c lua/liolib.c lua/lmathlib.c lua/loslib.c lua/lstrlib.c lua/ltablib.c lua/loadlib.c lua/linit.c +mod_lua_la_SOURCES = mod_lua.cpp freeswitch_lua.cpp mod_lua_wrap.cpp + +if SYSTEM_LUA +mod_lua_la_CXXFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS) +mod_lua_la_CFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS) +else +mod_lua_la_SOURCES += lua/lapi.c lua/lcode.c lua/lctype.c lua/ldebug.c lua/ldo.c lua/ldump.c lua/lfunc.c lua/lgc.c lua/llex.c lua/lmem.c lua/lobject.c lua/lopcodes.c lua/lparser.c lua/lstate.c lua/lstring.c lua/ltable.c lua/ltm.c lua/lundump.c lua/lvm.c lua/lzio.c lua/lauxlib.c lua/lbaselib.c lua/lbitlib.c lua/lcorolib.c lua/ldblib.c lua/liolib.c lua/lmathlib.c lua/loslib.c lua/lstrlib.c lua/ltablib.c lua/loadlib.c lua/linit.c +LUA_DIR=$(switch_srcdir)/src/mod/languages/mod_lua/lua mod_lua_la_CXXFLAGS = -I$(LUA_DIR) $(AM_CPPFLAGS) -DLUA_USE_LINUX mod_lua_la_CFLAGS = -I$(LUA_DIR) $(AM_CPPFLAGS) -DLUA_USE_LINUX -mod_lua_la_LIBADD = $(switch_builddir)/libfreeswitch.la -mod_lua_la_LDFLAGS = -avoid-version -module -no-undefined -shared -lm $(AM_LDFLAGS) $(SOLINK) #$(LIBLUA_A) +endif -#BUILT_SOURCES = $(LIBLUA_A) -#$(mod_lua_la_SOURCES) : $(BUILT_SOURCES) -# -#$(LIBLUA_A): -# cd $(LUA_DIR) && $(MAKE) CC="$(CC)" AR="$(AR) rcu" CFLAGS="$(AM_CFLAGS) -DLUA_USE_LINUX -w" liblua.a -#luaclean: -# cd $(LUA_DIR) && $(MAKE) clean -# -#allclean: clean luaclean +mod_lua_la_LIBADD = $(switch_builddir)/libfreeswitch.la +mod_lua_la_LDFLAGS = -avoid-version -module -no-undefined -shared -lm -llua $(AM_LDFLAGS) $(SOLINK) reswig: swigclean lua_wrap diff --git a/src/mod/languages/mod_lua/freeswitch_lua.h b/src/mod/languages/mod_lua/freeswitch_lua.h index a1a289a70b..780fc2e545 100644 --- a/src/mod/languages/mod_lua/freeswitch_lua.h +++ b/src/mod/languages/mod_lua/freeswitch_lua.h @@ -9,6 +9,9 @@ extern "C" { } #include +#ifndef lua_pushglobaltable +#define lua_pushglobaltable(L) lua_pushvalue(L,LUA_GLOBALSINDEX) +#endif typedef struct{ lua_State* L;