lua-5.2: build-sys: allow building against a specified Lua version.
authorKrisztian Litkey <kli@iki.fi>
Sun, 9 Mar 2014 16:21:47 +0000 (18:21 +0200)
committerKrisztian Litkey <krisztian.litkey@intel.com>
Tue, 11 Mar 2014 10:26:45 +0000 (12:26 +0200)
configure.ac
src/Makefile.am

index 15e9cbc..9cd0085 100644 (file)
@@ -46,6 +46,9 @@ AC_PROG_YACC
 AM_PROG_LEX
 AC_SUBST(LEXLIB)
 
+# Make first invocation of PKG_CHECK_MODULES 'if-then-else-fi'-safe.
+PKG_PROG_PKG_CONFIG
+
 # Don't require ctags (we keep linker scripts and debug files in the repo now).
 #AC_CHECK_PROG(CTAGS, ctags, "ctags")
 #if test "$CTAGS" != "ctags" ; then
@@ -109,13 +112,17 @@ fi
 
 AC_SUBST(WARNING_CFLAGS)
 
-# check for Lua
-PKG_CHECK_MODULES(LUA, lua >= 5.1.1, [try_lua51=no], [try_lua51=yes])
+# By default use the system default Lua (assumed to be called lua(.pc).
+# You can override this using the --with-lua option. For instance
+# on Ubuntu you'd need to use --with-lua=lua5.1.
+AC_ARG_WITH(lua,
+            [  --with-lua                build with specified Lua (pkgconfig filename without .pc suffix)],
+           [with_lua=$withval], [with_lua=lua])
+
+# Check for Lua.
+AC_MSG_NOTICE([Compiling with Lua package $with_lua.])
+PKG_CHECK_MODULES(LUA, $with_lua >= 5.1.1)
 
-# At least Ubuntu packages lua 5.1 as lua5.1... try that if needed.
-if test "$try_lua51" = "yes"; then
-    PKG_CHECK_MODULES(LUA, lua5.1 >= 5.1.1)
-fi
 AC_SUBST(LUA_CFLAGS)
 AC_SUBST(LUA_LIBS)
 
@@ -622,6 +629,9 @@ AC_OUTPUT
 # Display the configuration.
 echo "----- configuration -----"
 echo "Extra C warnings flags: $WARNING_CFLAGS"
+echo "Lua (pkgconfig file) to use: $with_lua"
+echo "    * cflags: $LUA_CFLAGS"
+echo "    * libs: $LUA_LIBS"
 echo "D-Bus (libdbus) support: $enable_libdbus"
 echo "D-Bus (systemd-bus) support: $enable_sdbus"
 echo "PulseAudio mainloop support: $enable_pulse"
index 8c6f684..3db6e44 100644 (file)
@@ -157,6 +157,7 @@ libmurphy_lua_utils_ladir =                                 \
                $(includedir)/murphy/core/lua-utils
 
 libmurphy_lua_utils_la_HEADERS =                               \
+               core/lua-utils/lua-utils.h                      \
                core/lua-utils/strarray.h                       \
                core/lua-utils/funcbridge.h                     \
                core/lua-utils/object.h                         \
@@ -164,6 +165,7 @@ libmurphy_lua_utils_la_HEADERS =                            \
                core/lua-utils/include.h
 
 libmurphy_lua_utils_la_REGULAR_SOURCES =                       \
+               core/lua-utils/lua-utils.c                      \
                core/lua-utils/strarray.c                       \
                core/lua-utils/funcbridge.c                     \
                core/lua-utils/object.c                         \