---
 common/Makefile.am |  3 +--
 configure.ac       |  5 +----
 m4/spice-deps.m4   | 18 ++++++++++++++++++
 3 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/common/Makefile.am b/common/Makefile.am
index 362fce6..c5e2e2a 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -94,13 +94,12 @@ AM_CPPFLAGS =                               \
        $(SPICE_COMMON_CFLAGS)          \
        $(GL_CFLAGS)                    \
        $(PIXMAN_CFLAGS)                \
-       $(OPUS_CFLAGS)                  \
        $(PROTOCOL_CFLAGS)              \
        $(NULL)
 
 libspice_common_la_LIBADD =                            \
        $(SPICE_COMMON_LIBS)                            \
-       $(OPUS_LIBS)
+       $(NULL)
 
 MARSHALLERS_DEPS =                                     \
        $(top_srcdir)/python_modules/__init__.py        \
diff --git a/configure.ac b/configure.ac
index 93ffc76..d3c318a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,13 +41,10 @@ AC_SUBST(PIXMAN_CFLAGS)
 
 SPICE_CHECK_SMARTCARD(SPICE_COMMON)
 SPICE_CHECK_CELT051(SPICE_COMMON)
+SPICE_CHECK_OPUS(SPICE_COMMON)
 AC_SUBST(SPICE_COMMON_CFLAGS)
 AC_SUBST(SPICE_COMMON_LIBS)
 
-PKG_CHECK_MODULES([OPUS], [opus >= 0.9.14], have_opus=yes, have_opus=no)
-AM_CONDITIONAL([HAVE_OPUS], [test "x$have_opus" = "xyes"])
-AM_COND_IF([HAVE_OPUS], AC_DEFINE([HAVE_OPUS], 1, [Define if we have Opus]))
-
 AC_ARG_ENABLE([opengl],
   AS_HELP_STRING([--enable-opengl=@<:@yes/no@:>@],
                  [Enable opengl support (not recommended) @<:@default=no@:>@]),
diff --git a/m4/spice-deps.m4 b/m4/spice-deps.m4
index f056921..2e4c6be 100644
--- a/m4/spice-deps.m4
+++ b/m4/spice-deps.m4
@@ -80,3 +80,21 @@ AC_DEFUN([SPICE_CHECK_CELT051], [
     AS_VAR_APPEND([$1_CFLAGS], [" $CELT051_CFLAGS"])
     AS_VAR_APPEND([$1_LIBS], [" $CELT051_LIBS"])
 ])
+
+
+# SPICE_CHECK_OPUS(PREFIX)
+# ------------------------
+# Check for the availability of Opus. If found, it will set the $PREFIX_CFLAGS
+# and $PREFIX_LIBS variables, and it will define a 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])
+
+    AM_CONDITIONAL([HAVE_OPUS], [test "x$have_opus" = "xyes"])
+    if test "x$have_opus" = "xyes" ; then
+      AC_DEFINE([HAVE_OPUS], [1], [Define if we have OPUS])
+    fi
+    AS_VAR_APPEND([$1_CFLAGS], [" $OPUS_CFLAGS"])
+    AS_VAR_APPEND([$1_LIBS], [" $OPUS_LIBS"])
+])
-- 
2.1.0

_______________________________________________
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to