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

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


---
 common/Makefile.am |  4 +---
 configure.ac       | 17 +----------------
 m4/celt051.m4      | 16 ++++++++++++++++
 3 files changed, 18 insertions(+), 19 deletions(-)
 create mode 100644 m4/celt051.m4

diff --git a/common/Makefile.am b/common/Makefile.am
index 4b39f79..f437736 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -95,7 +95,6 @@ AM_CPPFLAGS =				\
 	$(SPICE_COMMON_CFLAGS)		\
 	$(GL_CFLAGS)			\
 	$(PIXMAN_CFLAGS)		\
-	$(CELT051_CFLAGS)		\
 	$(OPUS_CFLAGS)		        \
 	$(PROTOCOL_CFLAGS)		\
 	$(VISIBILITY_HIDDEN_CFLAGS)	\
@@ -105,8 +104,7 @@ AM_CPPFLAGS =				\
 
 libspice_common_la_LIBADD =				\
 	$(SPICE_COMMON_LIBS)				\
-	$(OPUS_LIBS)		                        \
-	$(CELT051_LIBS)
+	$(OPUS_LIBS)
 
 MARSHALLERS_DEPS =					\
 	$(top_srcdir)/python_modules/__init__.py	\
diff --git a/configure.ac b/configure.ac
index 145dac4..c11163b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,25 +36,10 @@ PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.17.7)
 AC_SUBST(PIXMAN_CFLAGS)
 
 SPICE_CHECK_SMARTCARD(SPICE_COMMON)
+SPICE_CHECK_CELT051(SPICE_COMMON)
 AC_SUBST(SPICE_COMMON_CFLAGS)
 AC_SUBST(SPICE_COMMON_LIBS)
 
-AC_ARG_ENABLE(celt051,
-[  --disable-celt051       Disable celt051 audio codec (enabled by default)],,
-[enable_celt051="yes"])
-
-if test "x$enable_celt051" = "xyes"; then
-    PKG_CHECK_MODULES(CELT051, celt051 >= 0.5.1.1, have_celt051=yes, have_celt051=no)
-    AC_SUBST(CELT051_CFLAGS)
-    AC_SUBST(CELT051_LIBS)
-    AC_SUBST(CELT051_LIBDIR)
-else
-    have_celt051=no
-fi
-
-AM_CONDITIONAL([HAVE_CELT051], [test "x$have_celt051" = "xyes"])
-AM_COND_IF([HAVE_CELT051], AC_DEFINE([HAVE_CELT051], 1, [Define if we have celt051 codec]))
-
 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]))
diff --git a/m4/celt051.m4 b/m4/celt051.m4
new file mode 100644
index 0000000..45ea1f4
--- /dev/null
+++ b/m4/celt051.m4
@@ -0,0 +1,16 @@
+AC_DEFUN([SPICE_CHECK_CELT051], [
+    AC_ARG_ENABLE([celt051],
+        [  --disable-celt051       Disable celt051 audio codec (enabled by default)],,
+        [enable_celt051="yes"])
+
+    if test "x$enable_celt051" = "xyes"; then
+        PKG_CHECK_MODULES([CELT051], [celt051 >= 0.5.1.1], [have_celt051=yes], [have_celt051=no])
+    else
+        have_celt051=no
+    fi
+
+    AM_CONDITIONAL([HAVE_CELT051], [test "x$have_celt051" = "xyes"])
+    AM_COND_IF([HAVE_CELT051], AC_DEFINE([HAVE_CELT051], 1, [Define if we have celt051 codec]))
+    AS_VAR_APPEND([$1_CFLAGS], [" $CELT051_CFLAGS"])
+    AS_VAR_APPEND([$1_LIBS], [" $CELT051_LIBS"])
+])
-- 
2.1.0



More information about the Spice-devel mailing list