diff --git a/desmume/configure.ac b/desmume/configure.ac index 73eaf6567..d50f3e6a2 100644 --- a/desmume/configure.ac +++ b/desmume/configure.ac @@ -130,11 +130,25 @@ AC_PROVIDE_IFELSE([PKG_PROG_PKG_CONFIG], [ dnl uninstalled glade ui dir AC_DEFINE_UNQUOTED(GLADEUI_UNINSTALLED_DIR,"`pwd`/src/gtk-glade/glade/",[path to glade ui dir]) AC_SUBST(GLADEUI_UNINSTALLED_DIR) + + # Need check for both lua and lua5.1 to run on debian, see mysql bug #29945 + PKG_CHECK_MODULES(LUA, + $LUAPC >= 5.1, + HAVE_LUA=yes, + HAVE_LUA=no) + PKG_CHECK_MODULES(LUA, + lua5.1 >= 5.1, + HAVE_LUA=yes, + HAVE_LUA=no) + AC_SUBST(LUA_CFLAGS) + AC_SUBST(LUA_LIBS) fi ],[ - echo "WARNING: pkg-config is not available therefore gtk and gtk-glade UIs are not available either." + echo "WARNING: pkg-config is not available therefore gtk, gtk-glade UIs and lua scripting are not available either." ]) +AM_CONDITIONAL([HAVE_LUA], [test "${HAVE_LUA}" = "yes"]) + dnl - set conditional for glib, needed to avoid commandline.cpp compilation for cli frontend since it depends on glib AM_CONDITIONAL([HAVE_GLIB], [test "${FOUND_GLIB}" = "yes"]) diff --git a/desmume/src/Makefile.am b/desmume/src/Makefile.am index 67a1d90f7..dc119f95a 100644 --- a/desmume/src/Makefile.am +++ b/desmume/src/Makefile.am @@ -1,6 +1,6 @@ include $(top_srcdir)/src/desmume.mk -AM_CPPFLAGS += $(SDL_CFLAGS) $(GTK_CFLAGS) $(GTHREAD_CFLAGS) $(X_CFLAGS) +AM_CPPFLAGS += $(SDL_CFLAGS) $(GTK_CFLAGS) $(GTHREAD_CFLAGS) $(X_CFLAGS) $(LUA_CFLAGS) EXTRA_DIST = build.bat instruction_tabdef.inc thumb_tabdef.inc fs-linux.cpp fs-windows.cpp \ matrix_sse2-x64.asm matrix_sse2-x86.asm @@ -56,6 +56,9 @@ libdesmume_a_SOURCES = \ if HAVE_GLIB libdesmume_a_SOURCES += commandline.h commandline.cpp endif +if HAVE_LUA +libdesmume_a_SOURCES += lua-engine.cpp +endif if HAVE_GDB_STUB libdesmume_a_SOURCES += gdbstub.h endif diff --git a/desmume/src/lua-engine.cpp b/desmume/src/lua-engine.cpp index 53ae944ee..ea7a3fa0f 100644 --- a/desmume/src/lua-engine.cpp +++ b/desmume/src/lua-engine.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #endif extern "C" @@ -682,7 +683,7 @@ static int savestate_create(lua_State *L) { // So I turned the filename selection code into my bitch. :) // Numbers are 0 through 9 though. - struct stat sbuf; + struct stat sbuf; char filename[MAX_PATH]; strncpy(filename, pathFilenameToROMwithoutExt, MAX_PATH); @@ -1769,7 +1770,7 @@ int LUA_LoadLuaCode(const char *filename) { //StopSound();//StopSound(); //mbg merge 7/23/08 MessageBox(NULL, lua_tostring(L,-1), "Lua load error", MB_OK | MB_ICONSTOP); #else - fprintf(stderr, "Failed to compile file: %s\n", lua_tostring(LUA,-1)); + fprintf(stderr, "Failed to compile file: %s\n", lua_tostring(L,-1)); #endif // Wipe the stack. Our thread