[Spice-devel] [spice-common 06/13] build-sys: Move opus check to m4 macro

Christophe Fergeau cfergeau at redhat.com
Wed Dec 3 09:15:21 PST 2014


---
 common/Makefile.am |  3 +--
 configure.ac       |  5 +----
 m4/opus.m4         | 10 ++++++++++
 3 files changed, 12 insertions(+), 6 deletions(-)
 create mode 100644 m4/opus.m4

diff --git a/common/Makefile.am b/common/Makefile.am
index f437736..b06fae7 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -95,7 +95,6 @@ AM_CPPFLAGS =				\
 	$(SPICE_COMMON_CFLAGS)		\
 	$(GL_CFLAGS)			\
 	$(PIXMAN_CFLAGS)		\
-	$(OPUS_CFLAGS)		        \
 	$(PROTOCOL_CFLAGS)		\
 	$(VISIBILITY_HIDDEN_CFLAGS)	\
 	$(WARN_CFLAGS)			\
@@ -104,7 +103,7 @@ AM_CPPFLAGS =				\
 
 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 c11163b..893d01e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,13 +37,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/opus.m4 b/m4/opus.m4
new file mode 100644
index 0000000..bbc0270
--- /dev/null
+++ b/m4/opus.m4
@@ -0,0 +1,10 @@
+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



More information about the Spice-devel mailing list