[lxc-devel] [PATCH] configure: enable Lua if found and continue without if not

Stéphane Graber stgraber at ubuntu.com
Fri Sep 6 19:18:46 UTC 2013


On Fri, Sep 06, 2013 at 09:09:57PM +0200, Natanael Copa wrote:
> 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 <ncopa at alpinelinux.org>

I suppose at some point it'd be nice to find a way not to have configure
show "checking for LUA... no" 3 times in a row, but that's really just a
cosmetic issue.

Thanks for the change!

Acked-by: Stéphane Graber <stgraber at ubuntu.com>

> ---
>  configure.ac | 40 +++++++++++++++++++++++++++-------------
>  1 file changed, 27 insertions(+), 13 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 481bf06..4eaf329 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])
> -- 
> 1.8.4
> 
> 
> ------------------------------------------------------------------------------
> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
> Discover the easy way to master current and previous Microsoft technologies
> and advance your career. Get an incredible 1,500+ hours of step-by-step
> tutorial videos with LearnDevNow. Subscribe today and save!
> http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
> _______________________________________________
> Lxc-devel mailing list
> Lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20130906/facead58/attachment.pgp>


More information about the lxc-devel mailing list