[lua] updated configure script yet again

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10218 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Mark Gossage 2008-01-24 06:16:45 +00:00
commit 09113cc0bf
4 changed files with 50 additions and 8 deletions

View file

@ -1,6 +1,11 @@
Version 1.3.34 (in progress)
============================
01/24/2008: mgossage
More updates to the configure script for detecting lua.
Also looks in /usr/include/lua*
Also changed typemaps.i not to check for NULL before freeing a pointer
01/21/2008: wsfulton
[Python] For STL containers, SWIG no longer attempts to convert from one
STL container to another, eg from std::vector<int> to std::vector<double>

View file

@ -172,16 +172,25 @@ void SWIG_write_NAME_num_array(lua_State* L,TYPE *array,int size);
int SWIG_read_NAME_num_array(lua_State* L,int index,TYPE *array,int size);
*/
%{
#ifdef __cplusplus /* generic alloc/dealloc fns*/
/* Reported that you don't need to check for NULL for delete & free
There probably is some compiler that its not true for, so the code is left here just in case.
#ifdef __cplusplus
#define SWIG_ALLOC_ARRAY(TYPE,LEN) new TYPE[LEN]
#define SWIG_FREE_ARRAY(PTR) if(PTR){delete[] PTR;}
#else
#define SWIG_ALLOC_ARRAY(TYPE,LEN) (TYPE *)malloc(LEN*sizeof(TYPE))
#define SWIG_FREE_ARRAY(PTR) if(PTR){free(PTR);}
#endif
*/
%{
#ifdef __cplusplus /* generic alloc/dealloc fns*/
#define SWIG_ALLOC_ARRAY(TYPE,LEN) new TYPE[LEN]
#define SWIG_FREE_ARRAY(PTR) delete[] PTR;
#else
#define SWIG_ALLOC_ARRAY(TYPE,LEN) (TYPE *)malloc(LEN*sizeof(TYPE))
#define SWIG_FREE_ARRAY(PTR) free(PTR);
#endif
/* counting the size of arrays:*/
int SWIG_itable_size(lua_State* L, int index)
{

View file

@ -55,7 +55,7 @@ SWIGRUNTIME void
SWIG_InitializeModule(void *clientdata) {
size_t i;
swig_module_info *module_head, *iter;
int found;
int found, init;
clientdata = clientdata;
@ -65,6 +65,9 @@ SWIG_InitializeModule(void *clientdata) {
swig_module.type_initial = swig_type_initial;
swig_module.cast_initial = swig_cast_initial;
swig_module.next = &swig_module;
init = 1;
} else {
init = 0;
}
/* Try and load any already created modules */
@ -93,6 +96,12 @@ SWIG_InitializeModule(void *clientdata) {
module_head->next = &swig_module;
}
/* When multiple interpeters are used, a module could have already been initialized in
a different interpreter, but not yet have a pointer in this interpreter.
In this case, we do not want to continue adding types... everything should be
set up already */
if (init == 0) return;
/* Now work on filling in swig_module.types */
#ifdef SWIGRUNTIME_DEBUG
printf("SWIG_InitializeModule: size %d\n", swig_module.size);

View file

@ -1649,17 +1649,36 @@ fi
if test -n "$LUAINCLUDE"; then
AC_CHECK_FILE($LUAINCLUDE/lua.h,[LUAFLAGS="$ISYSTEM$LUAINCLUDE"],[LUABIN=])
else
AC_CHECK_HEADER(lua.h,[LUAFLAGS=""],[LUABIN=])
LUA_OK="1"
AC_CHECK_HEADER(lua.h,[LUAFLAGS=""],[LUA_OK=""])
# if we didn't get it, going to have to look elsewhere (the hard way)
if test -z "$LUA_OK"; then
AC_MSG_CHECKING(for lua.h in other locations)
# note: ubuntu seems to like /usr/include/lua5.1/lua.h
dirs="/usr/include/lua* /usr/local/include"
for i in $dirs; do
#echo "$i"
if test -r $i/lua.h; then
AC_MSG_RESULT($i/lua.h)
LUAFLAGS="$ISYSTEM$i"
break;
fi
done
if test -z "$LUAFLAGS"; then
AC_MSG_RESULT(not found)
LUABIN="" # clear the bin
fi
fi
fi
# look for the library files & set LUALINK accordingly
# will clear LUABIN if not present
lua_save_LIBS=$LIBS # the code seems to disrupt LIBS, so saving
if test -z "$LUALIB"; then
AC_SEARCH_LIBS(lua_close, [lua lua51 lua5.1 lua50 lua5.0], [LUALINK="-l$ac_lib"],[LUABIN=])
else
if test -n "$LUALIB"; then
AC_CHECK_FILE($LUALIB/liblua.a,[LUALINK="-L$LUALIB -llua"],[LUABIN=])
else
AC_SEARCH_LIBS(lua_close, [lua lua51 lua5.1 lua50 lua5.0], [LUALINK="-l$ac_lib"],[LUABIN=])
fi
# adding lualib for lua 5.0