Skip to content

Commit

Permalink
use pkg-config for lua autodetection and add make install target
Browse files Browse the repository at this point in the history
  • Loading branch information
Soeren Sonnenburg committed Aug 23, 2011
1 parent ff913e7 commit 79b2a0e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
3 changes: 2 additions & 1 deletion src/Makefile.template
Expand Up @@ -301,7 +301,8 @@ install-ruby_modular: $(TEMPLATE_TARGET)
install -m755 modshogun.$(EXT_LIB) "$(RUBY_EXTENSIONS_INSTALL_DIR)"

install-lua_modular: $(TEMPLATE_TARGET)
#TODO
install -d -m755 "$(LUA_EXTENSIONS_INSTALL_DIR)"
install -m755 modshogun.$(EXT_LIB) "$(LUA_EXTENSIONS_INSTALL_DIR)"

install-csharp_modular: $(TEMPLATE_TARGET)
#TODO
Expand Down
21 changes: 11 additions & 10 deletions src/configure
Expand Up @@ -795,23 +795,23 @@ test_lua()
then
LUAVER=`lua -v 2>&1 | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '('`
LV=`echo $LUAVER | cut -f 1-2 -d '.'`
LVS=`echo $LUAVER | cut -f 1-2 -d '.' | tr -d '.'`
LUACONFIG=lua-config$LVS
EXT_IF_SWIG_LUA_MODULAR='stop'
PRE_LIB_SWIG_LUA_MODULAR=
EXT_LIB_SWIG_LUA_MODULAR=.so
SWIGFLAGS_LUA_MODULAR="-c++ -lua"

if $LUACONFIG --include >/dev/null 2>&1
then
LINKFLAGS_LUA="`$LUACONFIG --libs` --shared"
INCLUDES_LUA="`$LUACONFIG --include`"
else
LINKFLAGS_LUA="-llualib${LV} -llua${LV} --shared"
INCLUDES_LUA="-I/usr/include/lua${LV} -I/usr/local/include/lua${LV}"
LINKFLAGS_LUA="-llua${LV} --shared"
INCLUDES_LUA="`pkg-config --cflags-only-I lua$LV 2>/dev/null`"
LINKFLAGS_LUA="`pkg-config --libs lua$LV 2>/dev/null`"
LUA_EXTENSIONS_INSTALL_DIR="`pkg-config lua$LV --define-variable=prefix=$_prefix --variable INSTALL_CMOD`"

if test -z "$INCLUDES_LUA" ; then
INCLUDES_LUA="-I/usr/include/lua${LV} -I/usr/local/include/lua${LV}"
fi
if test -z "$LINKFLAGS_LUA" ; then
LINKFLAGS_LUA="-llua${LV}"
fi

LINKFLAGS_LUA="$LINKFLAGS_LUA --shared"
echores "${LUAVER}"
_lua_modular=yes
else
Expand Down Expand Up @@ -4569,6 +4569,7 @@ PRELINKFLAGS_LUA_MODULAR= ${PRELINKFLAGS_LUA}
LINKFLAGS_LUA_MODULAR = ${LINKFLAGS_LUA}
POSTLINKFLAGS_LUA_MODULAR= ${POSTLINKFLAGS_LUA}
SWIGFLAGS_LUA_MODULAR = ${SWIGFLAGS_LUA_MODULAR}
LUA_EXTENSIONS_INSTALL_DIR = ${LUA_EXTENSIONS_INSTALL_DIR}
CLASSPATH = ${CLASSPATH}
LINK = ${LINK}
Expand Down

0 comments on commit 79b2a0e

Please sign in to comment.