1266ef
diff -up lua-5.3.0/configure.ac.autoxxx lua-5.3.0/configure.ac
1266ef
--- lua-5.3.0/configure.ac.autoxxx	2015-01-15 10:20:03.826889574 -0500
1266ef
+++ lua-5.3.0/configure.ac	2015-01-15 10:20:03.826889574 -0500
1266ef
@@ -0,0 +1,69 @@
1266ef
+AC_PREREQ(2.59)
1266ef
+AC_INIT([lua], [5.3.0], [https://bugzilla.redhat.com/], [lua-at], [http://www.lua.org])
1266ef
+AC_SUBST([MAJOR_VERSION], [5.3])
1266ef
+
1266ef
+AC_CONFIG_HEADERS([config.h])
1266ef
+AC_CONFIG_SRCDIR([src/lapi.c])
1266ef
+
1266ef
+AM_INIT_AUTOMAKE([1.9 foreign])
1266ef
+
1266ef
+AC_PROG_CC
1266ef
+AC_PROG_LIBTOOL
1266ef
+
1266ef
+AC_ARG_WITH(
1266ef
+  [readline],
1266ef
+  [AC_HELP_STRING([--with-readline], [Use readline for interpreter input [default=yes]])],
1266ef
+  [use_readline=$withval],
1266ef
+  [use_readline=yes]
1266ef
+)
1266ef
+
1266ef
+LUA_LIBS="-lm"
1266ef
+
1266ef
+# Check for readline
1266ef
+READLINE_DEFS="#undef LUA_USE_READLINE"
1266ef
+if test "x$use_readline" == "xyes"; then
1266ef
+  AC_CHECK_LIB([readline], [readline], [:], [use_readline=no], [-lncurses])
1266ef
+  AC_CHECK_HEADERS([readline/readline.h readline/history.h], [], [use_readline=no])
1266ef
+  if test "x$use_readline" == "xno"; then
1266ef
+    AC_MSG_WARN([readline headers could not be found, disabling readline support])
1266ef
+  else
1266ef
+    READLINE_DEFS="#define LUA_USE_READLINE"
1266ef
+    READLINE_LIBS="-lreadline -lncurses"
1266ef
+  fi
1266ef
+fi
1266ef
+AC_SUBST(READLINE_DEFS)
1266ef
+AC_SUBST(READLINE_LIBS)
1266ef
+
1266ef
+case "$host" in
1266ef
+  *-mingw*)  use_os=win32  ;;
1266ef
+  *-darwin*) use_os=macosx ;;
1266ef
+  *)         use_os=posix  ;;
1266ef
+esac
1266ef
+
1266ef
+POSIX_DEFS="#undef LUA_USE_POSIX"
1266ef
+LUA_DL_DEFS="#undef LUA_USE_DLOPEN"
1266ef
+LUA_BUILD_AS_DLL_DEFS="#undef LUA_BUILD_AS_DLL"
1266ef
+
1266ef
+if test "x$use_os" == "xwin32"; then
1266ef
+  LUA_BUILD_AS_DLL_DEFS="#define LUA_BUILD_AS_DLL"
1266ef
+elif test "x$use_os" == "xmacosx"; then
1266ef
+  POSIX_DEFS="#define LUA_USE_POSIX"
1266ef
+  LUA_DL_DEFS="#define LUA_DL_DYLD"
1266ef
+elif test "x$use_os" == "xposix"; then
1266ef
+  POSIX_DEFS="#define LUA_USE_POSIX"
1266ef
+  LUA_DL_DEFS="#define LUA_DL_DLOPEN"
1266ef
+  LUA_LIBS="$LUA_LIBS -ldl"
1266ef
+fi
1266ef
+AC_SUBST(POSIX_DEFS)
1266ef
+AC_SUBST(LUA_DL_DEFS)
1266ef
+AC_SUBST(LUA_BUILD_AS_DLL_DEFS)
1266ef
+
1266ef
+AC_SUBST(LUA_LIBS)
1266ef
+
1266ef
+AC_CONFIG_FILES([Makefile
1266ef
+                 src/Makefile
1266ef
+                 src/lua.pc
1266ef
+                 src/luaconf.h.template
1266ef
+                 doc/Makefile
1266ef
+])
1266ef
+AC_OUTPUT
1266ef
diff -up lua-5.3.0/doc/Makefile.am.autoxxx lua-5.3.0/doc/Makefile.am
1266ef
--- lua-5.3.0/doc/Makefile.am.autoxxx	2015-01-15 10:20:03.826889574 -0500
1266ef
+++ lua-5.3.0/doc/Makefile.am	2015-01-15 10:20:03.826889574 -0500
1266ef
@@ -0,0 +1,4 @@
1266ef
+man1_MANS = lua.1 luac.1
1266ef
+
1266ef
+EXTRA_DIST = \
1266ef
+	contents.html logo.gif lua.1 luac.1 lua.css manual.css manual.html osi-certified-72x60.png readme.html
1266ef
diff -up lua-5.3.0/Makefile.am.autoxxx lua-5.3.0/Makefile.am
1266ef
--- lua-5.3.0/Makefile.am.autoxxx	2015-01-15 10:20:03.826889574 -0500
1266ef
+++ lua-5.3.0/Makefile.am	2015-01-15 10:20:03.826889574 -0500
1266ef
@@ -0,0 +1,3 @@
1266ef
+SUBDIRS = src doc
1266ef
+
1266ef
+EXTRA_DIST = README
1266ef
diff -up lua-5.3.0/src/.gitignore.autoxxx lua-5.3.0/src/.gitignore
1266ef
--- lua-5.3.0/src/.gitignore.autoxxx	2015-01-15 10:20:03.826889574 -0500
1266ef
+++ lua-5.3.0/src/.gitignore	2015-01-15 10:20:03.826889574 -0500
1266ef
@@ -0,0 +1,5 @@
1266ef
+lua
1266ef
+lua.pc
1266ef
+luac
1266ef
+luaconf.h
1266ef
+luaconf.h.template
1266ef
diff -up lua-5.3.0/src/luaconf.h.template.in.autoxxx lua-5.3.0/src/luaconf.h.template.in
1266ef
--- lua-5.3.0/src/luaconf.h.template.in.autoxxx	2015-01-15 10:20:03.828889562 -0500
1266ef
+++ lua-5.3.0/src/luaconf.h.template.in	2015-01-15 10:22:37.420027778 -0500
1266ef
@@ -11,6 +11,11 @@
1266ef
 #include <limits.h>
1266ef
 #include <stddef.h>
1266ef
 
1266ef
+@POSIX_DEFS@
1266ef
+@LUA_DL_DEFS@
1266ef
+@LUA_BUILD_AS_DLL_DEFS@
1266ef
+@READLINE_DEFS@
1266ef
+
1266ef
 
1266ef
 /*
1266ef
 ** ===================================================================
1266ef
@@ -175,9 +180,9 @@
1266ef
 
1266ef
 #else			/* }{ */
1266ef
 
1266ef
-#define LUA_ROOT	"/usr/local/"
1266ef
-#define LUA_LDIR	LUA_ROOT "share/lua/" LUA_VDIR "/"
1266ef
-#define LUA_CDIR	LUA_ROOT "lib/lua/" LUA_VDIR "/"
1266ef
+#define LUA_ROOT	"@prefix@/"
1266ef
+#define LUA_LDIR	"@pkgdatadir@/lua/" LUA_VDIR "/"
1266ef
+#define LUA_CDIR	"@libdir@/lua/" LUA_VDIR "/"
1266ef
 #define LUA_PATH_DEFAULT  \
1266ef
 		LUA_LDIR"?.lua;"  LUA_LDIR"?/init.lua;" \
1266ef
 		LUA_CDIR"?.lua;"  LUA_CDIR"?/init.lua;" \
1266ef
diff -up lua-5.3.0/src/lua.pc.in.autoxxx lua-5.3.0/src/lua.pc.in
1266ef
--- lua-5.3.0/src/lua.pc.in.autoxxx	2015-01-15 10:20:03.827889568 -0500
1266ef
+++ lua-5.3.0/src/lua.pc.in	2015-01-15 10:20:03.827889568 -0500
1266ef
@@ -0,0 +1,13 @@
1266ef
+V= @MAJOR_VERSION@
1266ef
+R= @VERSION@
1266ef
+prefix= @prefix@
1266ef
+exec_prefix=${prefix}
1266ef
+libdir= @libdir@
1266ef
+includedir=${prefix}/include
1266ef
+
1266ef
+Name: Lua
1266ef
+Description: An Extensible Extension Language
1266ef
+Version: ${R}
1266ef
+Requires:
1266ef
+Libs: -llua @LUA_LIBS@
1266ef
+Cflags: -I${includedir}
1266ef
diff -up lua-5.3.0/src/Makefile.am.autoxxx lua-5.3.0/src/Makefile.am
1266ef
--- lua-5.3.0/src/Makefile.am.autoxxx	2015-01-15 10:20:03.826889574 -0500
1266ef
+++ lua-5.3.0/src/Makefile.am	2015-01-15 10:20:03.826889574 -0500
1266ef
@@ -0,0 +1,46 @@
1266ef
+AM_CFLAGS = -Wall
1266ef
+
1266ef
+include_HEADERS = lua.h lualib.h lauxlib.h lua.hpp
1266ef
+
1266ef
+nodist_include_HEADERS = luaconf.h
1266ef
+
1266ef
+lib_LTLIBRARIES = liblua.la
1266ef
+liblua_la_LDFLAGS = -release @MAJOR_VERSION@
1266ef
+liblua_la_SOURCES = \
1266ef
+	lapi.c lauxlib.c lbaselib.c lbitlib.c lcode.c lcorolib.c lctype.c ldblib.c \
1266ef
+	ldebug.c ldo.c ldump.c lfunc.c lgc.c linit.c liolib.c llex.c lmathlib.c lmem.c \
1266ef
+	loadlib.c lobject.c lopcodes.c loslib.c lparser.c lstate.c lstring.c lstrlib.c \
1266ef
+	ltable.c ltablib.c ltm.c lundump.c lutf8lib.c lvm.c lzio.c \
1266ef
+	lapi.h lcode.h lctype.h ldebug.h ldo.h lfunc.h lgc.h llex.h llimits.h \
1266ef
+	lmem.h lobject.h lopcodes.h lparser.h lstate.h lstring.h ltable.h ltm.h \
1266ef
+	lundump.h lvm.h lzio.h
1266ef
+
1266ef
+pkgconfigdir = $(libdir)/pkgconfig
1266ef
+pkgconfig_DATA = lua.pc
1266ef
+
1266ef
+bin_PROGRAMS = lua luac
1266ef
+
1266ef
+lua_SOURCES = lua.c
1266ef
+lua_LDADD = liblua.la @LUA_LIBS@ @READLINE_LIBS@
1266ef
+lua_DEPENDENCIES = liblua.la
1266ef
+
1266ef
+luac_SOURCES = luac.c
1266ef
+# Statically link liblua against luac since luac uses symbols not exported in liblua
1266ef
+luac_LDADD = .libs/liblua.a @LUA_LIBS@
1266ef
+luac_DEPENDENCIES = liblua.la
1266ef
+
1266ef
+EXTRA_DIST = luaconf.h.template
1266ef
+BUILT_SOURCES = luaconf.h
1266ef
+CLEANFILES = luaconf.h luaconf.h.template
1266ef
+
1266ef
+readline_defs = @READLINE_DEFS@
1266ef
+
1266ef
+edit = 	sed \
1266ef
+	  -e 's,%prefix%,$(prefix),g' \
1266ef
+	  -e 's,%lua_datadir%,$(datadir),g' \
1266ef
+	  -e 's,%lua_libdir%,$(libdir),g'
1266ef
+
1266ef
+luaconf.h : luaconf.h.template
1266ef
+	rm -f $@ $@.tmp
1266ef
+	$(edit) $< >$@.tmp
1266ef
+	mv $@.tmp $@