diff --git a/configure.ac b/configure.ac index 19970171..21052670 100644 --- a/configure.ac +++ b/configure.ac @@ -88,7 +88,7 @@ AC_CHECK_HEADERS(cxxabi.h) AC_LANG_POP(C++) dnl Common C functions -AC_CHECK_FUNCS(getcwd _getcwd backtrace_symbols) +AC_CHECK_FUNCS(getenv getcwd _getcwd backtrace_symbols) if test "${enable_debug}" = "yes"; then diff --git a/src/lua/lapi.c b/src/lua/lapi.c index 1854fe61..154be02d 100644 --- a/src/lua/lapi.c +++ b/src/lua/lapi.c @@ -4,6 +4,9 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END #include #include diff --git a/src/lua/lauxlib.c b/src/lua/lauxlib.c index 36ae7e62..feee6603 100644 --- a/src/lua/lauxlib.c +++ b/src/lua/lauxlib.c @@ -4,6 +4,9 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END #include #include diff --git a/src/lua/lbaselib.c b/src/lua/lbaselib.c index dbfcb02c..e52f3f92 100644 --- a/src/lua/lbaselib.c +++ b/src/lua/lbaselib.c @@ -4,6 +4,9 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END #include diff --git a/src/lua/lbitlib.c b/src/lua/lbitlib.c index 7533b85c..361556a5 100644 --- a/src/lua/lbitlib.c +++ b/src/lua/lbitlib.c @@ -4,6 +4,10 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END + #define lbitlib_c #define LUA_LIB diff --git a/src/lua/lcode.c b/src/lua/lcode.c index 614e452f..bcc0bdad 100644 --- a/src/lua/lcode.c +++ b/src/lua/lcode.c @@ -4,6 +4,9 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END #include diff --git a/src/lua/lcorolib.c b/src/lua/lcorolib.c index c7932d90..eef4447e 100644 --- a/src/lua/lcorolib.c +++ b/src/lua/lcorolib.c @@ -4,6 +4,9 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END #include diff --git a/src/lua/lctype.c b/src/lua/lctype.c index 55e433a5..74729150 100644 --- a/src/lua/lctype.c +++ b/src/lua/lctype.c @@ -4,6 +4,10 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END + #define lctype_c #define LUA_CORE diff --git a/src/lua/ldblib.c b/src/lua/ldblib.c index c0226945..7553814b 100644 --- a/src/lua/ldblib.c +++ b/src/lua/ldblib.c @@ -4,6 +4,9 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END #include #include diff --git a/src/lua/ldebug.c b/src/lua/ldebug.c index 43f8f046..6de67128 100644 --- a/src/lua/ldebug.c +++ b/src/lua/ldebug.c @@ -4,6 +4,9 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END #include #include diff --git a/src/lua/ldo.c b/src/lua/ldo.c index d18e33cd..ecd69b3d 100644 --- a/src/lua/ldo.c +++ b/src/lua/ldo.c @@ -4,6 +4,9 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END #include #include diff --git a/src/lua/ldump.c b/src/lua/ldump.c index d5e6a47c..2a722720 100644 --- a/src/lua/ldump.c +++ b/src/lua/ldump.c @@ -4,6 +4,10 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END + #include #define ldump_c diff --git a/src/lua/lfunc.c b/src/lua/lfunc.c index 4fd27fe5..5fa15e09 100644 --- a/src/lua/lfunc.c +++ b/src/lua/lfunc.c @@ -4,6 +4,9 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END #include diff --git a/src/lua/lgc.c b/src/lua/lgc.c index 06f972a7..efeedd00 100644 --- a/src/lua/lgc.c +++ b/src/lua/lgc.c @@ -4,6 +4,10 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END + #include #define lgc_c diff --git a/src/lua/linit.c b/src/lua/linit.c index 8d3aa657..a62aeeca 100644 --- a/src/lua/linit.c +++ b/src/lua/linit.c @@ -4,6 +4,9 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END /* ** If you embed Lua in your program and need to open the standard diff --git a/src/lua/liolib.c b/src/lua/liolib.c index 4814aa2c..568db36d 100644 --- a/src/lua/liolib.c +++ b/src/lua/liolib.c @@ -4,6 +4,9 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END /* ** POSIX idiosyncrasy! diff --git a/src/lua/llex.c b/src/lua/llex.c index c4d8c65b..6119f70f 100644 --- a/src/lua/llex.c +++ b/src/lua/llex.c @@ -4,6 +4,9 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END #include #include diff --git a/src/lua/lmathlib.c b/src/lua/lmathlib.c index c3c605e8..3cbc66a8 100644 --- a/src/lua/lmathlib.c +++ b/src/lua/lmathlib.c @@ -4,6 +4,9 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END #include #include diff --git a/src/lua/lmem.c b/src/lua/lmem.c index 3f88496e..1821d618 100644 --- a/src/lua/lmem.c +++ b/src/lua/lmem.c @@ -4,6 +4,9 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END #include diff --git a/src/lua/loadlib.c b/src/lua/loadlib.c index a9959277..0c9cd185 100644 --- a/src/lua/loadlib.c +++ b/src/lua/loadlib.c @@ -8,6 +8,9 @@ ** systems. */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END /* ** if needed, includes windows header before everything else @@ -636,9 +639,13 @@ static int noenv (lua_State *L) { static void setpath (lua_State *L, const char *fieldname, const char *envname1, const char *envname2, const char *def) { +#if HAVE_GETENV // LOL BEGIN const char *path = getenv(envname1); if (path == NULL) /* no environment variable? */ path = getenv(envname2); /* try alternative name */ +#else + const char *path = NULL; +#endif // LOL END if (path == NULL || noenv(L)) /* no environment variable? */ lua_pushstring(L, def); /* use default */ else { diff --git a/src/lua/lobject.c b/src/lua/lobject.c index cf0f7544..aceea74c 100644 --- a/src/lua/lobject.c +++ b/src/lua/lobject.c @@ -4,6 +4,10 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END + #include #include #include diff --git a/src/lua/lopcodes.c b/src/lua/lopcodes.c index ef736927..b13e5018 100644 --- a/src/lua/lopcodes.c +++ b/src/lua/lopcodes.c @@ -4,6 +4,9 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END #define lopcodes_c #define LUA_CORE diff --git a/src/lua/loslib.c b/src/lua/loslib.c index 489755b6..2c7b0989 100644 --- a/src/lua/loslib.c +++ b/src/lua/loslib.c @@ -4,6 +4,9 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END #include #include @@ -114,7 +117,11 @@ static int os_tmpname (lua_State *L) { static int os_getenv (lua_State *L) { +#if HAVE_GETENV // LOL BEGIN lua_pushstring(L, getenv(luaL_checkstring(L, 1))); /* if NULL push nil */ +#else + lua_pushstring(L, NULL); +#endif // LOL END return 1; } diff --git a/src/lua/lparser.c b/src/lua/lparser.c index b3eb3ca9..cba91c09 100644 --- a/src/lua/lparser.c +++ b/src/lua/lparser.c @@ -4,6 +4,9 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END #include diff --git a/src/lua/lstate.c b/src/lua/lstate.c index 3c00c285..bbb4faf4 100644 --- a/src/lua/lstate.c +++ b/src/lua/lstate.c @@ -4,6 +4,9 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END #include #include diff --git a/src/lua/lstring.c b/src/lua/lstring.c index 8b959f19..88cbc4c0 100644 --- a/src/lua/lstring.c +++ b/src/lua/lstring.c @@ -4,6 +4,9 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END #include diff --git a/src/lua/lstrlib.c b/src/lua/lstrlib.c index e13098bb..7d8bdc79 100644 --- a/src/lua/lstrlib.c +++ b/src/lua/lstrlib.c @@ -4,6 +4,9 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END #include #include diff --git a/src/lua/ltable.c b/src/lua/ltable.c index ffa5ecb3..f966bab0 100644 --- a/src/lua/ltable.c +++ b/src/lua/ltable.c @@ -4,6 +4,9 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END /* ** Implementation of tables (aka arrays, objects, or hash tables). diff --git a/src/lua/ltablib.c b/src/lua/ltablib.c index a52add03..85b401ed 100644 --- a/src/lua/ltablib.c +++ b/src/lua/ltablib.c @@ -4,6 +4,9 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END #include diff --git a/src/lua/ltm.c b/src/lua/ltm.c index e70006dd..272f9e37 100644 --- a/src/lua/ltm.c +++ b/src/lua/ltm.c @@ -4,6 +4,9 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END #include diff --git a/src/lua/lua.c b/src/lua/lua.c index cfa16ecb..c1b03112 100644 --- a/src/lua/lua.c +++ b/src/lua/lua.c @@ -4,6 +4,9 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END #if 0 // LOL BEGIN #include diff --git a/src/lua/luac.c b/src/lua/luac.c index 5081836d..3e3be8db 100644 --- a/src/lua/luac.c +++ b/src/lua/luac.c @@ -4,6 +4,10 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END + #include #include #include diff --git a/src/lua/lundump.c b/src/lua/lundump.c index 54de011a..35bcd85e 100644 --- a/src/lua/lundump.c +++ b/src/lua/lundump.c @@ -4,6 +4,10 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END + #include #define lundump_c diff --git a/src/lua/lvm.c b/src/lua/lvm.c index b77eac26..73e490a9 100644 --- a/src/lua/lvm.c +++ b/src/lua/lvm.c @@ -4,6 +4,9 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END #include #include diff --git a/src/lua/lzio.c b/src/lua/lzio.c index 8b77054e..862caac9 100644 --- a/src/lua/lzio.c +++ b/src/lua/lzio.c @@ -4,6 +4,9 @@ ** See Copyright Notice in lua.h */ +#if defined HAVE_CONFIG_H // LOL BEGIN +# include "config.h" +#endif // LOL END #include