Support for Lua added - patch from Mark Gossage
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7363 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
139bd9b8c5
commit
15150feff5
9 changed files with 175 additions and 7 deletions
|
|
@ -1,6 +1,14 @@
|
||||||
Version 1.3.26 (in progress)
|
Version 1.3.26 (in progress)
|
||||||
============================
|
============================
|
||||||
|
|
||||||
|
08/15/2005: wsfulton
|
||||||
|
[Lua] Support added for Lua. Patch #1242772 from Mark Gossage.
|
||||||
|
It supports most C/C++ features (functions, struct, classes, arrays, pointers,
|
||||||
|
exceptions), as well as lots of documentation and a few test cases & examples.
|
||||||
|
|
||||||
|
08/14/2005: wsfulton
|
||||||
|
[Xml] Fix incorrect xml escaping in base class name when base class is a template.
|
||||||
|
|
||||||
08/13/2005: efuzzyone
|
08/13/2005: efuzzyone
|
||||||
[CLISP] Added support for handling enums. Does not adds the return type declaration
|
[CLISP] Added support for handling enums. Does not adds the return type declaration
|
||||||
to the function definition, if a function returns void.
|
to the function definition, if a function returns void.
|
||||||
|
|
|
||||||
|
|
@ -26,4 +26,5 @@ Pike.html
|
||||||
Python.html
|
Python.html
|
||||||
Ruby.html
|
Ruby.html
|
||||||
Tcl.html
|
Tcl.html
|
||||||
|
Lua.html
|
||||||
Extending.html
|
Extending.html
|
||||||
|
|
|
||||||
|
|
@ -863,3 +863,56 @@ csharp_compile: $(SRCS)
|
||||||
csharp_clean:
|
csharp_clean:
|
||||||
rm -f *.@OBJEXT@ *@CSHARPSO@ *_wrap* *~ .~* core @EXTRA_CLEAN@ runme runme.exe gc.log `find . -name \*.cs | grep -v runme.cs`
|
rm -f *.@OBJEXT@ *@CSHARPSO@ *_wrap* *~ .~* core @EXTRA_CLEAN@ runme runme.exe gc.log `find . -name \*.cs | grep -v runme.cs`
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
##### LUA ######
|
||||||
|
##################################################################
|
||||||
|
|
||||||
|
# lua flags
|
||||||
|
LUA_INCLUDE= @LUAINCLUDE@
|
||||||
|
LUA_LIB = @LUALIB@ -llua -llualib
|
||||||
|
|
||||||
|
# Extra specific dynamic linking options
|
||||||
|
LUA_DLNK = @LUADYNAMICLINKING@
|
||||||
|
LUA_SO = @LUA_SO@
|
||||||
|
|
||||||
|
# Extra code for lua static link
|
||||||
|
LUA_INTERP = ../lua.c
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------
|
||||||
|
# Build a C dynamically loadable module
|
||||||
|
# ----------------------------------------------------------------
|
||||||
|
|
||||||
|
lua: $(SRCS)
|
||||||
|
$(SWIG) -lua $(SWIGOPT) $(INTERFACE)
|
||||||
|
$(CC) -c $(CCSHARED) $(CFLAGS) $(ISRCS) $(SRCS) $(INCLUDES) $(LUA_INCLUDE)
|
||||||
|
$(LDSHARED) $(OBJS) $(IOBJS) $(LIBS) $(LUA_LIB) -o $(LIBPREFIX)$(TARGET)$(LUA_SO)
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------
|
||||||
|
# Build a C++ dynamically loadable module
|
||||||
|
# -----------------------------------------------------------------
|
||||||
|
|
||||||
|
lua_cpp: $(SRCS)
|
||||||
|
$(SWIG) -c++ -lua $(SWIGOPT) $(INTERFACE)
|
||||||
|
$(CXX) -c $(CCSHARED) $(CFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES) $(LUA_INCLUDE)
|
||||||
|
$(CXXSHARED) $(OBJS) $(IOBJS) $(LIBS) $(LUA_LIB) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(LUA_SO)
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------
|
||||||
|
# Build statically linked Lua interpreter
|
||||||
|
# -----------------------------------------------------------------
|
||||||
|
|
||||||
|
lua_static: $(SRCS)
|
||||||
|
$(SWIG) -lua -module example $(SWIGOPT) $(INTERFACE)
|
||||||
|
$(CC) $(CFLAGS) $(ISRCS) $(SRCS) $(LUA_INTERP) $(INCLUDES) \
|
||||||
|
$(LUA_INCLUDE) $(LIBS) $(LUA_LIB) -o $(TARGET)
|
||||||
|
|
||||||
|
lua_static_cpp: $(SRCS)
|
||||||
|
$(SWIG) -c++ -lua -module example $(SWIGOPT) $(INTERFACE)
|
||||||
|
$(CXX) $(CFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(LUA_INTERP) $(INCLUDES) \
|
||||||
|
$(LUA_INCLUDE) $(LIBS) $(LUA_LIB) -o $(TARGET)
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------
|
||||||
|
# Cleaning the lua examples
|
||||||
|
# -----------------------------------------------------------------
|
||||||
|
|
||||||
|
lua_clean:
|
||||||
|
rm -f *.@OBJEXT@ *$(SO) *_wrap* *~ .~* core @EXTRA_CLEAN@ mylua@EXEEXT@
|
||||||
|
|
|
||||||
|
|
@ -178,6 +178,7 @@ CPP_TEST_CASES += \
|
||||||
namespace_virtual_method \
|
namespace_virtual_method \
|
||||||
newobject1 \
|
newobject1 \
|
||||||
ordering \
|
ordering \
|
||||||
|
operator_overload \
|
||||||
overload_copy \
|
overload_copy \
|
||||||
overload_extend \
|
overload_extend \
|
||||||
overload_rename \
|
overload_rename \
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ skip-pike = test -n "@SKIP_PIKE@"
|
||||||
skip-chicken = test -n "@SKIP_CHICKEN@"
|
skip-chicken = test -n "@SKIP_CHICKEN@"
|
||||||
skip-csharp = test -n "@SKIP_CSHARP@"
|
skip-csharp = test -n "@SKIP_CSHARP@"
|
||||||
skip-modula3 = test -n "@SKIP_MODULA3@"
|
skip-modula3 = test -n "@SKIP_MODULA3@"
|
||||||
|
skip-lua = test -n "@SKIP_LUA@"
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
# CHECK
|
# CHECK
|
||||||
|
|
@ -71,6 +72,7 @@ check-aliveness:
|
||||||
@$(skip-chicken) || ./$(TARGET) -chicken -help
|
@$(skip-chicken) || ./$(TARGET) -chicken -help
|
||||||
@$(skip-csharp) || ./$(TARGET) -csharp -help
|
@$(skip-csharp) || ./$(TARGET) -csharp -help
|
||||||
@$(skip-modula3) || ./$(TARGET) -modula3 -help
|
@$(skip-modula3) || ./$(TARGET) -modula3 -help
|
||||||
|
@$(skip-lua) || ./$(TARGET) -lua -help
|
||||||
|
|
||||||
check-examples: \
|
check-examples: \
|
||||||
check-tcl-examples \
|
check-tcl-examples \
|
||||||
|
|
@ -85,7 +87,8 @@ check-examples: \
|
||||||
check-pike-examples \
|
check-pike-examples \
|
||||||
check-chicken-examples \
|
check-chicken-examples \
|
||||||
check-csharp-examples \
|
check-csharp-examples \
|
||||||
check-modula3-examples
|
check-modula3-examples \
|
||||||
|
check-lua-examples
|
||||||
|
|
||||||
check-%-examples:
|
check-%-examples:
|
||||||
@passed=true; \
|
@passed=true; \
|
||||||
|
|
@ -119,6 +122,7 @@ check-test-suite: \
|
||||||
check-pike-test-suite \
|
check-pike-test-suite \
|
||||||
check-csharp-test-suite \
|
check-csharp-test-suite \
|
||||||
check-modula3-test-suite \
|
check-modula3-test-suite \
|
||||||
|
check-lua-test-suite \
|
||||||
# check-chicken-test-suite
|
# check-chicken-test-suite
|
||||||
|
|
||||||
check-%-test-suite:
|
check-%-test-suite:
|
||||||
|
|
@ -150,6 +154,7 @@ check-gifplot: \
|
||||||
check-php4-gifplot \
|
check-php4-gifplot \
|
||||||
check-pike-gifplot \
|
check-pike-gifplot \
|
||||||
check-chicken-gifplot \
|
check-chicken-gifplot \
|
||||||
|
# check-lua-gifplot \
|
||||||
# check-csharp-gifplot \
|
# check-csharp-gifplot \
|
||||||
# check-modula3-gifplot
|
# check-modula3-gifplot
|
||||||
|
|
||||||
|
|
@ -191,6 +196,7 @@ all-test-suite: \
|
||||||
all-pike-test-suite \
|
all-pike-test-suite \
|
||||||
all-csharp-test-suite \
|
all-csharp-test-suite \
|
||||||
all-modula3-test-suite \
|
all-modula3-test-suite \
|
||||||
|
all-lua-test-suite \
|
||||||
# all-chicken-test-suite
|
# all-chicken-test-suite
|
||||||
|
|
||||||
all-%-test-suite:
|
all-%-test-suite:
|
||||||
|
|
@ -214,6 +220,7 @@ broken-test-suite: \
|
||||||
broken-pike-test-suite \
|
broken-pike-test-suite \
|
||||||
broken-csharp-test-suite \
|
broken-csharp-test-suite \
|
||||||
broken-modula3-test-suite \
|
broken-modula3-test-suite \
|
||||||
|
broken-lua-test-suite \
|
||||||
# broken-chicken-test-suite
|
# broken-chicken-test-suite
|
||||||
|
|
||||||
broken-%-test-suite:
|
broken-%-test-suite:
|
||||||
|
|
@ -283,6 +290,7 @@ noskip-test-suite: \
|
||||||
noskip-php4-test-suite \
|
noskip-php4-test-suite \
|
||||||
noskip-pike-test-suite \
|
noskip-pike-test-suite \
|
||||||
noskip-csharp-test-suite \
|
noskip-csharp-test-suite \
|
||||||
|
noskip-lua-test-suite \
|
||||||
noskip-chicken-test-suite
|
noskip-chicken-test-suite
|
||||||
|
|
||||||
noskip-%-test-suite:
|
noskip-%-test-suite:
|
||||||
|
|
@ -315,7 +323,7 @@ install-main:
|
||||||
@$(INSTALL_PROGRAM) $(TARGET) $(DESTDIR)$(BIN_DIR)/$(TARGET)
|
@$(INSTALL_PROGRAM) $(TARGET) $(DESTDIR)$(BIN_DIR)/$(TARGET)
|
||||||
|
|
||||||
lib-languages = tcl perl5 python guile java mzscheme ruby php4 ocaml \
|
lib-languages = tcl perl5 python guile java mzscheme ruby php4 ocaml \
|
||||||
pike chicken csharp modula3 allegrocl clisp
|
pike chicken csharp modula3 allegrocl clisp lua
|
||||||
|
|
||||||
lib-modules = std
|
lib-modules = std
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ eswig_SOURCES = CParse/cscanner.c \
|
||||||
Modules/guile.cxx \
|
Modules/guile.cxx \
|
||||||
Modules/java.cxx \
|
Modules/java.cxx \
|
||||||
Modules/lang.cxx \
|
Modules/lang.cxx \
|
||||||
|
Modules/lua.cxx \
|
||||||
Modules/main.cxx \
|
Modules/main.cxx \
|
||||||
Modules/modula3.cxx \
|
Modules/modula3.cxx \
|
||||||
Modules/module.cxx \
|
Modules/module.cxx \
|
||||||
|
|
|
||||||
|
|
@ -338,7 +338,7 @@ void SWIG_getoptions(int argc, char *argv[])
|
||||||
int includecount = 0;
|
int includecount = 0;
|
||||||
// Get options
|
// Get options
|
||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
if (argv[i]) {
|
if (argv[i] && !Swig_check_marked(i)) {
|
||||||
if (strncmp(argv[i],"-I-",3) == 0) {
|
if (strncmp(argv[i],"-I-",3) == 0) {
|
||||||
// Don't push/pop directories
|
// Don't push/pop directories
|
||||||
Swig_set_push_dir(0);
|
Swig_set_push_dir(0);
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ extern "C" {
|
||||||
Language *swig_chicken(void);
|
Language *swig_chicken(void);
|
||||||
Language *swig_csharp(void);
|
Language *swig_csharp(void);
|
||||||
Language *swig_allegrocl(void);
|
Language *swig_allegrocl(void);
|
||||||
|
Language *swig_lua(void);
|
||||||
Language *swig_clisp(void);
|
Language *swig_clisp(void);
|
||||||
Language *swig_uffi(void);
|
Language *swig_uffi(void);
|
||||||
}
|
}
|
||||||
|
|
@ -69,6 +70,7 @@ swig_module modules[] = {
|
||||||
{"-csharp", swig_csharp, "C#"},
|
{"-csharp", swig_csharp, "C#"},
|
||||||
{"-guile", swig_guile, "Guile"},
|
{"-guile", swig_guile, "Guile"},
|
||||||
{"-java", swig_java, "Java"},
|
{"-java", swig_java, "Java"},
|
||||||
|
{"-lua", swig_lua, "Lua"},
|
||||||
{"-modula3", swig_modula3, "Modula 3"},
|
{"-modula3", swig_modula3, "Modula 3"},
|
||||||
{"-mzscheme", swig_mzscheme, "Mzscheme"},
|
{"-mzscheme", swig_mzscheme, "Mzscheme"},
|
||||||
{"-ocaml", swig_ocaml, "Ocaml"},
|
{"-ocaml", swig_ocaml, "Ocaml"},
|
||||||
|
|
|
||||||
|
|
@ -260,6 +260,12 @@ case $host in
|
||||||
*) TCL_CXXSHARED=$TRYLINKINGWITHCXX;;
|
*) TCL_CXXSHARED=$TRYLINKINGWITHCXX;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
AC_SUBST(LUA_SO)
|
||||||
|
case $host in
|
||||||
|
*-*-darwin*) LUA_SO=.so;;
|
||||||
|
*) LUA_SO=$SO;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Optional CFLAGS used to silence compiler warnings on some platforms.
|
# Optional CFLAGS used to silence compiler warnings on some platforms.
|
||||||
|
|
||||||
AC_SUBST(PLATFLAGS)
|
AC_SUBST(PLATFLAGS)
|
||||||
|
|
@ -1490,6 +1496,87 @@ AC_SUBST(CSHARPLIBRARYPREFIX) # Is this going to be used?
|
||||||
AC_SUBST(CSHARPCFLAGS)
|
AC_SUBST(CSHARPCFLAGS)
|
||||||
AC_SUBST(CSHARPSO)
|
AC_SUBST(CSHARPSO)
|
||||||
|
|
||||||
|
#----------------------------------------------------------------
|
||||||
|
# Look for Lua
|
||||||
|
#----------------------------------------------------------------
|
||||||
|
|
||||||
|
LUABIN=
|
||||||
|
LUAINCLUDE=
|
||||||
|
LUALIB=
|
||||||
|
|
||||||
|
AC_ARG_WITH(lua, AS_HELP_STRING([--without-lua], [Disable Lua])
|
||||||
|
AS_HELP_STRING([--with-lua=path], [Set location of Lua executable]),[ LUABIN="$withval"], [LUABIN=])
|
||||||
|
AC_ARG_WITH(luaincl,[ --with-luaincl=path Set location of Lua include directory],[
|
||||||
|
LUAINCLUDE="$ISYSTEM$withval"], [LUAINCLUDE=])
|
||||||
|
AC_ARG_WITH(lualib,[ --with-lualib=path Set location of Lua library directory],[
|
||||||
|
LUALIB="-L$withval"], [LUALIB=])
|
||||||
|
|
||||||
|
# First, check for "--without-lua" or "--with-lua=no".
|
||||||
|
if test x"${LUABIN}" = xno -o x"${with_alllang}" = xno ; then
|
||||||
|
AC_MSG_NOTICE([Disabling Lua])
|
||||||
|
else
|
||||||
|
|
||||||
|
# can we find lua?
|
||||||
|
if test -z "$LUABIN"; then
|
||||||
|
AC_PATH_PROG(LUABIN, lua)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# look for the header files
|
||||||
|
AC_MSG_CHECKING(for Lua header files)
|
||||||
|
if test -z "$LUAINCLUDE"; then
|
||||||
|
#AC_TRY_CPP([#include <lua.h>], , LUAINCLUDE="")
|
||||||
|
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <lua.h>]])], , LUAINCLUDE="")
|
||||||
|
if test -z "$LUAINCLUDE"; then
|
||||||
|
dirs="/usr/local/include /usr/include /opt/local/include"
|
||||||
|
for i in $dirs ; do
|
||||||
|
if test -r $i/tcl.h; then
|
||||||
|
AC_MSG_RESULT($i)
|
||||||
|
LUAINCLUDE="$ISYSTEM$i"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if test -z "$LUAINCLUDE"; then
|
||||||
|
AC_MSG_RESULT(not found)
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT($LUAINCLUDE)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# look for the library files
|
||||||
|
AC_MSG_CHECKING(for Lua library)
|
||||||
|
if test -z "$LUALIB"; then
|
||||||
|
dirs="/usr/local/lib /usr/lib /opt/local/lib"
|
||||||
|
for i in $dirs ; do
|
||||||
|
if test -r $i/liblua.a; then
|
||||||
|
AC_MSG_RESULT($i)
|
||||||
|
LUALIB="-L$i"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
if test -z "$LUALIB"; then
|
||||||
|
AC_MSG_RESULT(not found)
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT($LUALIB)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# copied from PYTHON code, but I think this is not needed for lua...
|
||||||
|
# Cygwin (Windows) needs the library for dynamic linking
|
||||||
|
#case $host in
|
||||||
|
#*-*-cygwin* | *-*-mingw*) LUADYNAMICLINKING="-L$LUALIB $PYLINK"
|
||||||
|
# PYINCLUDE="-DUSE_DL_IMPORT $PYINCLUDE"
|
||||||
|
# ;;
|
||||||
|
#*)LUADYNAMICLINKING="";;
|
||||||
|
#esac
|
||||||
|
|
||||||
|
fi # if not disabled
|
||||||
|
|
||||||
|
AC_SUBST(LUADYNAMICLINKING)
|
||||||
|
AC_SUBST(LUAINCLUDE)
|
||||||
|
AC_SUBST(LUALIB)
|
||||||
|
AC_SUBST(LUABIN)
|
||||||
|
|
||||||
#----------------------------------------------------------------
|
#----------------------------------------------------------------
|
||||||
# Determine which languages to use for examples/test-suite
|
# Determine which languages to use for examples/test-suite
|
||||||
#----------------------------------------------------------------
|
#----------------------------------------------------------------
|
||||||
|
|
@ -1590,6 +1677,12 @@ AC_SUBST(SKIP_CSHARP)
|
||||||
SKIP_MODULA3="1" # Always skipped!
|
SKIP_MODULA3="1" # Always skipped!
|
||||||
AC_SUBST(SKIP_MODULA3)
|
AC_SUBST(SKIP_MODULA3)
|
||||||
|
|
||||||
|
SKIP_LUA=
|
||||||
|
# do we really need the LUABIN?
|
||||||
|
if test -z "$LUABIN" || test -z "$LUAINCLUDE" || test -z "$LUALIB" ; then
|
||||||
|
SKIP_LUA="1"
|
||||||
|
fi
|
||||||
|
AC_SUBST(SKIP_LUA)
|
||||||
|
|
||||||
#----------------------------------------------------------------
|
#----------------------------------------------------------------
|
||||||
# Miscellaneous
|
# Miscellaneous
|
||||||
|
|
@ -1648,6 +1741,7 @@ AC_CONFIG_FILES([ \
|
||||||
Examples/test-suite/python/Makefile \
|
Examples/test-suite/python/Makefile \
|
||||||
Examples/test-suite/ruby/Makefile \
|
Examples/test-suite/ruby/Makefile \
|
||||||
Examples/test-suite/tcl/Makefile \
|
Examples/test-suite/tcl/Makefile \
|
||||||
|
Examples/test-suite/lua/Makefile \
|
||||||
])
|
])
|
||||||
AC_CONFIG_FILES([preinst-swig], [chmod +x preinst-swig])
|
AC_CONFIG_FILES([preinst-swig], [chmod +x preinst-swig])
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue