Index: src/options.cc
===================================================================
--- src/options.cc	(revision 185)
+++ src/options.cc	(working copy)
@@ -29,10 +29,15 @@
 #include <cstdlib>
 #include <set>
 
+#ifndef CXXLUA
 extern "C" {
 #include <lua.h>
 #include <lauxlib.h>
 }
+#else
+#include <lua.h>
+#include <lauxlib.h>
+#endif 
 
 #ifdef __MINGW32__
 #       include <windows.h>
Index: src/lua.hh
===================================================================
--- src/lua.hh	(revision 185)
+++ src/lua.hh	(working copy)
@@ -23,10 +23,13 @@
 #include "ecl_geom.hh"
 #include "objects_decl.hh"
 
-extern "C" {
-    struct lua_State;
-}
+#ifdef CXXLUA
+struct lua_State;
+#else 
+extern "C" struct lua_State;
+#endif
 
+
 namespace lua
 {
     using namespace enigma;
Index: src/editor.cc
===================================================================
--- src/editor.cc	(revision 185)
+++ src/editor.cc	(working copy)
@@ -35,10 +35,16 @@
 #include "display_internal.hh"
 #include "d_engine.hh"
 
+#ifndef CXXLUA
 extern "C" {
 #include "lualib.h"
 #include "tolua++.h"
 }
+#else
+#include "lualib.h"
+#include "tolua++.h"
+#endif 
+
 #include "lua-editor.hh"
 
 using namespace std;
Index: src/d_models.cc
===================================================================
--- src/d_models.cc	(revision 185)
+++ src/d_models.cc	(working copy)
@@ -36,11 +36,17 @@
 using namespace std;
 using namespace ecl;
 
-
+#ifndef CXXLUA
 extern "C" {
 #include "lualib.h"
 #include "tolua++.h"
 }
+#else
+#include "lualib.h"
+#include "tolua++.h"
+#endif 
+
+
 #include "lua-global.hh"
 #include "lua-display.hh"
 #include "lua-enigma.hh"
Index: src/lev/Proxy.cc
===================================================================
--- src/lev/Proxy.cc	(revision 185)
+++ src/lev/Proxy.cc	(working copy)
@@ -37,11 +37,16 @@
 #include <xercesc/util/XMLUniDefs.hpp>
 #include <xercesc/framework/MemBufInputSource.hpp>
 #include <xercesc/framework/Wrapper4InputSource.hpp>
- 
+
+#ifndef CXXLUA
 extern "C" {
 #include "lua.h"
 #include "lauxlib.h"
 }
+#else
+#include "lua.h"
+#include "lauxlib.h"
+#endif 
 
 
 using namespace std;
Index: src/lua.cc
===================================================================
--- src/lua.cc	(revision 185)
+++ src/lua.cc	(working copy)
@@ -26,11 +26,17 @@
 #include "sound.hh"
 #include "options.hh"
 
+#ifndef CXXLUA
 extern "C" {
 #include "lualib.h"
 #include "tolua++.h"
 }
+#else
+#include "lualib.h"
+#include "tolua++.h"
+#endif 
 
+
 #include "lua-display.hh"
 #include "lua-enigma.hh"
 #include "lua-ecl.hh"
Index: src/sound.cc
===================================================================
--- src/sound.cc	(revision 185)
+++ src/sound.cc	(working copy)
@@ -30,9 +30,13 @@
 #include <cassert>
 #include <memory>
 
+#ifndef CXXLUA
 extern "C" {
 #include "lua.h"
 }
+#else
+#include "lua.h"
+#endif 
 
 
 using namespace std;
Index: lib-src/lua/tolua++.h
===================================================================
--- lib-src/lua/tolua++.h	(revision 185)
+++ lib-src/lua/tolua++.h	(working copy)
@@ -39,8 +39,14 @@
 
 typedef int lua_Object;
 
+#if defined(__cplusplus) && defined(CXXLUA)
+  extern "C++" {
+#endif
 #include "lua.h"
 #include "lauxlib.h"
+#if defined(__cplusplus) && defined(CXXLUA)
+  }
+#endif
 
 struct tolua_Error
 {
Index: lib-src/lua/Makefile.am
===================================================================
--- lib-src/lua/Makefile.am	(revision 185)
+++ lib-src/lua/Makefile.am	(working copy)
@@ -13,13 +13,26 @@
 
 else
 
-CFLAGSDEFAULT = @CFLAGS@
+CFLAGSDEFAULT= @CFLAGS@ 
 
 endif
 
-CFLAGS = $(CFLAGSDEFAULT)
 
+if CXXLUA
 
+## Compile as c++
+CXXLUAFLAGS = -x c++ @CXXFLAGS@
+
+else
+
+CXXLUAFLAGS=
+
+endif
+
+
+CFLAGS = $(CFLAGSDEFAULT) $(CXXLUAFLAGS)
+
+
 liblua_a_SOURCES = \
  lapi.c lauxlib.c lbaselib.c lcode.c ldblib.c ldebug.c \
  ldo.c ldump.c lfunc.c lgc.c linit.c liolib.c llex.c \
Index: lib-src/lua/luaconf.h
===================================================================
--- lib-src/lua/luaconf.h	(revision 185)
+++ lib-src/lua/luaconf.h	(working copy)
@@ -731,6 +731,11 @@
 */
 
 
+#if defined(__cplusplus) && defined(CXXLUA)
+#undef LUAI_TRY
+#define LUAI_TRY(L,c,a)	try { a } catch(lua_longjmp*) \
+	{ if ((c)->status == 0) (c)->status = -1; }
+#endif
 
 #endif
 
Index: tools/Makefile.am
===================================================================
--- tools/Makefile.am	(revision 185)
+++ tools/Makefile.am	(working copy)
@@ -7,8 +7,13 @@
 TTFTOOL = 
 endif
 
+if CXXLUA
+noinst_PROGRAMS =  $(TTFTOOL)
+else
 noinst_PROGRAMS = tolua $(TTFTOOL)
+endif
 
+
 ttf2bmf_SOURCES = ttf2bmf.cc getopt.c getopt1.c getopt.h
 ttf2bmf_CXXFLAGS = @SDL_CFLAGS@
 ttf2bmf_LDADD = -lSDL_ttf
Index: configure.ac
===================================================================
--- configure.ac	(revision 185)
+++ configure.ac	(working copy)
@@ -250,6 +250,27 @@
 	AC_MSG_RESULT(no)
 fi
 
+dnl ----------------------------------------
+dnl Check for C++ Lua
+dnl ----------------------------------------
+
+if test "$MINGW32" = yes; then
+   enable_cxxlua=yes
+fi
+
+AC_MSG_CHECKING(whether to build lua using c++)
+AC_ARG_ENABLE(cxxlua,
+  AS_HELP_STRING(--enable-cxxlua, Build Lua with C++ [default=no]), 
+  , enable_cxxlua=no)
+if test "x$enable_cxxlua" = xyes; then
+  CXXFLAGS="$CXXFLAGS -DCXXLUA"
+  AC_MSG_RESULT(yes)
+else
+  AC_MSG_RESULT(no)
+fi
+
+AM_CONDITIONAL(CXXLUA, test x$enable_cxxlua = xyes)
+
 dnl ----------------------------------------------------------
 dnl Check whether compiler warnings should be emitted
 dnl ----------------------------------------------------------
