From: Natanael Copa Date: Fri, 6 Sep 2013 19:09:57 +0000 (+0200) Subject: configure: enable Lua if found and continue without if not X-Git-Tag: lxc-1.0.0.alpha1~1^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f756cda05c4058dd7f5d46f2cf51c3bc7fd002d1;p=thirdparty%2Flxc.git configure: enable Lua if found and continue without if not Search for Lua if no --enable-lua/--disable-lua specified but continue without if not found. If --enable-lua is specified and Lua is not found then return error. If --disable-lua is specified, then don't search for Lua. Signed-off-by: Natanael Copa Acked-by: Stéphane Graber --- diff --git a/configure.ac b/configure.ac index 481bf0627..4eaf329b0 100644 --- a/configure.ac +++ b/configure.ac @@ -174,29 +174,43 @@ m4_ifdef([PKG_CHECK_VAR], [], # Lua module and scripts AC_ARG_ENABLE([lua], [AC_HELP_STRING([--enable-lua], [enable lua binding])], - [enable_lua=yes], [enable_lua=no]) + [], [enable_lua=check]) AC_ARG_WITH([lua-pc], [AS_HELP_STRING( [--with-lua-pc=PKG], [Specify pkg-config package name for lua] - )], - [LUAPKGCONFIG=$with_lua_pc - enable_lua=yes]) + )], [], [with_lua_pc=no]) + +if test "x$enable_lua" = "xyes" -a "x$with_lua_pc" != "xno"; then + # exit with error if not found + PKG_CHECK_MODULES([LUA], [$with_lua_pc], [LUAPKGCONFIG=$with_lua_pc]) +fi + +if test "x$enable_lua" = "xcheck" -a "x$with_lua_pc" != "xno"; then + PKG_CHECK_MODULES([LUA], [$with_lua_pc], + [LUAPKGCONFIG=$with_lua_pc + enable_lua=yes], + [enable_lua=no]) +fi + +if test "x$enable_lua" != "xno"; then + PKG_CHECK_MODULES([LUA], [lua], [LUAPKGCONFIG=lua], + [PKG_CHECK_MODULES([LUA], [lua5.2], [LUAPKGCONFIG=lua5.2], + [PKG_CHECK_MODULES([LUA], [lua5.1], [LUAPKGCONFIG=lua5.1], + [AS_IF([test "x$enable_lua" = "xyes"], + [AC_MSG_ERROR([Lua not found. Please use --with-lua-pc=PKG])], + [enable_lua=no])] + )] + )]) + AS_IF([test "x$LUAPKGCONFIG" != "x"], [enable_lua=yes]) +fi AM_CONDITIONAL([ENABLE_LUA], [test "x$enable_lua" = "xyes"]) AM_COND_IF([ENABLE_LUA], - [AS_IF([test "x$with_lua_pc" = "xyes"], - [PKG_CHECK_MODULES([LUA], [lua],[LUAPKGCONFIG=lua], - [PKG_CHECK_MODULES([LUA], [lua5.2],[LUAPKGCONFIG=lua5.2], - [PKG_CHECK_MODULES([LUA], [lua5.1], - [LUAPKGCONFIG=lua5.1])] - )] - )], - [PKG_CHECK_MODULES([LUA], [$with_lua_pc])]) - AC_MSG_CHECKING([Lua version]) + [AC_MSG_CHECKING([Lua version]) PKG_CHECK_VAR([LUA_VERSION], [$LUAPKGCONFIG], [V],, [PKG_CHECK_VAR([LUA_VERSION], [$LUAPKGCONFIG], [major_version])]) AC_MSG_RESULT([$LUA_VERSION])