[Spice-devel] [spice-common 3/7] build: By default, error out if Opus is missing

Frediano Ziglio fziglio at redhat.com
Tue Jun 5 08:35:38 UTC 2018


> 
> Following the commit disabling celt by default, it's quite easy to have
> a build without both celt and opus. After this commit, Opus will have to
> be installed for a successful build unless one passes --disable-opus.
> ---
>  m4/spice-deps.m4  | 13 ++++++++++++-
>  meson.build       | 11 ++++++-----
>  meson_options.txt |  5 +++++
>  3 files changed, 23 insertions(+), 6 deletions(-)
> 
> diff --git a/m4/spice-deps.m4 b/m4/spice-deps.m4
> index 5606230..36b559c 100644
> --- a/m4/spice-deps.m4
> +++ b/m4/spice-deps.m4
> @@ -150,7 +150,18 @@ AC_DEFUN([SPICE_CHECK_CELT051], [
>  # HAVE_OPUS preprocessor symbol as well as a HAVE_OPUS Makefile conditional.
>  # ----------------
>  AC_DEFUN([SPICE_CHECK_OPUS], [
> -    PKG_CHECK_MODULES([OPUS], [opus >= 0.9.14], [have_opus=yes],
> [have_opus=no])
> +    AC_ARG_ENABLE([opus],
> +        [  --disable-opus       Disable Opus audio codec (enabled by
> default)],,
> +        [enable_opus="auto"])
> +    if test "x$enable_opus" != "xno"; then
> +        PKG_CHECK_MODULES([OPUS], [opus >= 0.9.14], [have_opus=yes],
> [have_opus=no])
> +        if test "x$enable_opus" == "xauto" && test "x$have_opus" == "xno";

test syntax, test a = b, not test a == b.

> then
> +            AC_MSG_ERROR(["Opus could not be detected, explicitly use
> --disable-opus if that's intentional"])
> +        fi
> +        if test "x$enable_opus" == "xyes" && test "x$have_opus" != "xyes";
> then

same

> +            AC_MSG_ERROR(["--enable-opus has been specified, but Opus .5.1
> is missing"])
> +        fi
> +    fi
>  
>      AM_CONDITIONAL([HAVE_OPUS], [test "x$have_opus" = "xyes"])
>      if test "x$have_opus" = "xyes" ; then
> diff --git a/meson.build b/meson.build
> index 4dd4610..2cf2c3c 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -118,12 +118,13 @@ endforeach
>  #
>  # Non-mandatory/optional dependencies
>  #
> -deps = [['opus', '>= 0.9.14', 'HAVE_OPUS'],]
> -
>  # Check deps which are optional but enabled by default. This foreach block
>  only
>  # checks the option, and adds the package to the deps list, while the real
>  check
>  # for the dependency is done in the foeach block below.
> -optional_deps = [['celt051', '>= 0.5.1.1', 'HAVE_CELT051'],]
> +optional_deps = [
> +                    ['celt051', '>= 0.5.1.1', false, 'HAVE_CELT051'],
> +                    ['opus', '>= 0.9.14', true, 'HAVE_OPUS'],
> +                ]
>  foreach dep : optional_deps
>    if get_option(dep[0])
>      deps += [dep]
> @@ -131,10 +132,10 @@ foreach dep : optional_deps
>  endforeach
>  
>  foreach dep : deps
> -  d = dependency(dep[0], required : false, version : dep[1])
> +  d = dependency(dep[0], required : dep[2], version : dep[1])
>    if d.found()
>      spice_common_deps += d
> -    spice_common_config_data.set(dep[2], '1')
> +    spice_common_config_data.set(dep[3], '1')
>    endif
>  endforeach
>  
> diff --git a/meson_options.txt b/meson_options.txt
> index 9f07bcc..9796833 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -15,6 +15,11 @@ option('celt051',
>      value : false,
>      description: 'Enable celt051 audio codec (default=false)')
>  
> +option('opus',
> +    type : 'boolean',
> +    value : true,
> +    description: 'Enable Opus audio codec (default=true)')
> +
>  option('python-checks',
>      type : 'boolean',
>      value : true,

Frediano


More information about the Spice-devel mailing list