[vlc-devel] [PATCH 1/3] m4: Add VLC_ARG_ENABLE function.

Rémi Denis-Courmont remi at remlab.net
Thu Dec 1 19:49:31 CET 2011


Le jeudi 1 décembre 2011 18:43:16 Georgi Chorbadzhiyski, vous avez écrit :
> It does the same as AC_ARG_ENABLE but checks for if disable_all
> variable is set.
> ---
> 
> Somebody with better m4 knowledge should check this function. It
> probably could be written better.
> 
>  m4/with_pkg.m4 |   13 +++++++++++++
>  1 files changed, 13 insertions(+), 0 deletions(-)
> 
> diff --git a/m4/with_pkg.m4 b/m4/with_pkg.m4
> index 39439b7..340c695 100644
> --- a/m4/with_pkg.m4
> +++ b/m4/with_pkg.m4
> @@ -31,6 +31,19 @@ dnl Prepare a --with-variable-prefix triggered check for
> module, dnl disable by default.
>  dnl
> 
> +dnl VLC_ARG_ENABLE have same parameters as AC_ARG_ENABLE but checks for
> disable_all +AC_DEFUN([VLC_ARG_ENABLE],
> +[
> +    var=enable_$(echo $1 | tr .+- ___)
> +    eval xvar=\$${var}

This probably belongs in the default case of AC_ARG_ENABLE.

> +    AS_IF(
> +      [test x"${disable_all}" = "xyes" -a x"${xvar}" != "xyes" ],

The autoconf convention is that anything but no means yes. This is a 
consequence of how --enable-foo=BAR works.

> +      [eval ${var}=no
> +       AC_MSG_NOTICE([$1 disabled. Enable it with --enable-$1])],
> +      [AC_ARG_ENABLE([$1], [$2], [$3])]
> +    )
> +])
> +
>  AC_DEFUN([PKG_WITH_MODULES],
>  [
>  AC_REQUIRE([PKG_PROG_PKG_CONFIG])


-- 
Rémi Denis-Courmont
http://www.remlab.net/
http://fi.linkedin.com/in/remidenis



More information about the vlc-devel mailing list