diff --git a/configure.ac b/configure.ac index 0c30551993..b483f8f8e7 100644 --- a/configure.ac +++ b/configure.ac @@ -518,6 +518,18 @@ 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"]) +if test "${enable_system_lua}" = "yes" ; then + PKG_CHECK_MODULES([LUA],[lua5.2],[have_lua=yes],[have_lua=no]) + if test "${have_lua}" = "no" ; then + PKG_CHECK_MODULES([LUA],[lua5.1],[have_lua=yes],[have_lua=no]) + fi + if test "${have_lua}" = "no" ; then + PKG_CHECK_MODULES([LUA],[lua],[have_lua=yes],[have_lua=no]) + fi + if test x"${LUA_LIBS}" = x"" ; then + LUA_LIBS="-llua" + fi +fi AM_CONDITIONAL([SYSTEM_LUA],[test "${enable_system_lua}" = "yes"]) AC_ARG_ENABLE(srtp, diff --git a/src/mod/languages/mod_lua/Makefile.am b/src/mod/languages/mod_lua/Makefile.am index 18001c2a23..717f4f6fad 100644 --- a/src/mod/languages/mod_lua/Makefile.am +++ b/src/mod/languages/mod_lua/Makefile.am @@ -8,8 +8,8 @@ mod_LTLIBRARIES = mod_lua.la 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) +mod_lua_la_CXXFLAGS = $(AM_CPPFLAGS) $(LUA_CFLAGS) $(CPPFLAGS) +mod_lua_la_CFLAGS = $(AM_CPPFLAGS) $(LUA_CFLAGS) $(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 @@ -21,7 +21,7 @@ mod_lua_la_LIBADD = $(switch_builddir)/libfreeswitch.la mod_lua_la_LDFLAGS = -avoid-version -module -no-undefined -shared -lm $(AM_LDFLAGS) $(SOLINK) if SYSTEM_LUA -mod_lua_la_LDFLAGS += -llua +mod_lua_la_LDFLAGS += $(LUA_LIBS) endif reswig: swigclean lua_wrap