build: By default, error out if Opus is missing

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.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
Christophe Fergeau 2018-06-05 11:26:58 +02:00 committed by Frediano Ziglio
parent 72b0d603e1
commit f522473842
3 changed files with 23 additions and 6 deletions

View File

@ -149,7 +149,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"; 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
AC_MSG_ERROR([--enable-opus has been specified, but Opus is missing])
fi
fi
AM_CONDITIONAL([HAVE_OPUS], [test "x$have_opus" = "xyes"])
if test "x$have_opus" = "xyes" ; then

View File

@ -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

View File

@ -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,