1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-27 01:25:34 +00:00

Link against lua51, not lua50.

This commit is contained in:
Witold Filipczyk 2010-07-21 19:07:49 +02:00 committed by Witold Filipczyk
parent 13f1c878ac
commit 331a4dc62b
4 changed files with 18 additions and 18 deletions

1
NEWS
View File

@ -69,6 +69,7 @@ Miscellaneous:
* enhancement: Add ``Search contents'' button to the cache manager with * enhancement: Add ``Search contents'' button to the cache manager with
which one can search through the cache items' data rather than their which one can search through the cache items' data rather than their
metadata. metadata.
* link against lua51 not lua50
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
The following changes should be removed from NEWS before ELinks 0.13.0 The following changes should be removed from NEWS before ELinks 0.13.0

View File

@ -900,10 +900,10 @@ if test -z "$disable_lua"; then
withval=""; withval="";
fi fi
for luadir in "$withval" "" /usr /usr/local; do for luadir in "$withval" "" /usr /usr/local; do
for suffix in "" 50; do for suffix in "" 51; do
if test "$cf_result" = no && ( test -f "$luadir/include/lua.h" || \ if test "$cf_result" = no && ( test -f "$luadir/include/lua.h" || \
test -f "$luadir/include/lua$suffix/lua.h" ) ; then test -f "$luadir/include/lua$suffix/lua.h" ) ; then
LUA_LIBS="-L$luadir/lib -llua$suffix -llualib$suffix -lm" LUA_LIBS="-L$luadir/lib -llua$suffix -lm"
LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix" LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix"
LIBS="$LUA_LIBS $LIBS_X" LIBS="$LUA_LIBS $LIBS_X"
@ -911,13 +911,11 @@ if test -z "$disable_lua"; then
CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS" CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS"
# Check that it is a compatible Lua version # Check that it is a compatible Lua version
AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <lua.h> AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <lauxlib.h>]
#include <lualib.h>]], [[ lua_State *L = lua_open(); #include <lua.h>
luaopen_base(L); #include <lualib.h>
luaopen_table(L); ], [[ lua_State *L = luaL_newstate();
luaopen_io(L); luaL_openlibs(L);
luaopen_string(L);
luaopen_math(L);
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
lua_close(L);]])],[cf_result=yes],[cf_result=no]) lua_close(L);]])],[cf_result=yes],[cf_result=no])
fi fi

View File

@ -12,6 +12,7 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#include <lauxlib.h>
#include <lua.h> #include <lua.h>
#include <lualib.h> #include <lualib.h>
@ -659,7 +660,7 @@ do_hooks_file(LS, unsigned char *prefix, unsigned char *filename)
if (file_can_read(file)) { if (file_can_read(file)) {
int oldtop = lua_gettop(S); int oldtop = lua_gettop(S);
if (lua_dofile(S, file) != 0) if (luaL_dofile(S, file) != 0)
sleep(3); /* Let some time to see error messages. */ sleep(3); /* Let some time to see error messages. */
lua_settop(S, oldtop); lua_settop(S, oldtop);
} }
@ -670,13 +671,9 @@ do_hooks_file(LS, unsigned char *prefix, unsigned char *filename)
void void
init_lua(struct module *module) init_lua(struct module *module)
{ {
L = lua_open(); L = luaL_newstate();
luaopen_base(L); luaL_openlibs(L);
luaopen_table(L);
luaopen_io(L);
luaopen_string(L);
luaopen_math(L);
lua_register(L, LUA_ALERT, l_alert); lua_register(L, LUA_ALERT, l_alert);
lua_register(L, "current_url", l_current_url); lua_register(L, "current_url", l_current_url);
@ -781,7 +778,7 @@ handle_ret_eval(struct session *ses)
int oldtop = lua_gettop(L); int oldtop = lua_gettop(L);
if (prepare_lua(ses) == 0) { if (prepare_lua(ses) == 0) {
lua_dostring(L, expr); luaL_dostring(L, expr);
lua_settop(L, oldtop); lua_settop(L, oldtop);
finish_lua(); finish_lua();
} }

View File

@ -4,6 +4,10 @@
#include "config.h" #include "config.h"
#endif #endif
#include <lauxlib.h>
#include <lua.h>
#include <lualib.h>
#include "elinks.h" #include "elinks.h"
#include "cache/cache.h" #include "cache/cache.h"
@ -200,7 +204,7 @@ static enum evhook_status
script_hook_quit(va_list ap, void *data) script_hook_quit(va_list ap, void *data)
{ {
if (!prepare_lua(NULL)) { if (!prepare_lua(NULL)) {
lua_dostring(lua_state, "if quit_hook then quit_hook() end"); luaL_dostring(lua_state, "if quit_hook then quit_hook() end");
finish_lua(); finish_lua();
} }