From dd57d05a523746af54557e4cf5a9768ebe029d77 Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Tue, 2 Dec 2014 11:31:27 +0100 Subject: build-sys: Move celt check to m4 macro --- common/Makefile.am | 4 +--- configure.ac | 17 +---------------- m4/spice-deps.m4 | 26 ++++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/common/Makefile.am b/common/Makefile.am index cbb8f8b..362fce6 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -94,15 +94,13 @@ AM_CPPFLAGS = \ $(SPICE_COMMON_CFLAGS) \ $(GL_CFLAGS) \ $(PIXMAN_CFLAGS) \ - $(CELT051_CFLAGS) \ $(OPUS_CFLAGS) \ $(PROTOCOL_CFLAGS) \ $(NULL) 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 27893cc..93ffc76 100644 --- a/configure.ac +++ b/configure.ac @@ -40,25 +40,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/spice-deps.m4 b/m4/spice-deps.m4 index f5bf05f..443718b 100644 --- a/m4/spice-deps.m4 +++ b/m4/spice-deps.m4 @@ -54,3 +54,29 @@ AC_DEFUN([SPICE_CHECK_SMARTCARD], [ AS_VAR_APPEND([$1_CFLAGS], [" $SMARTCARD_CFLAGS"]) AS_VAR_APPEND([$1_LIBS], [" $SMARTCARD_LIBS"]) ]) + + +# SPICE_CHECK_CELT051(PREFIX) +# --------------------------- +# Adds a --disable-celt051 switch in order to enable/disable CELT 0.5.1 +# support, and checks if the needed libraries are available. If found, it will +# append the flags to use to the $PREFIX_CFLAGS and $PREFIX_LIBS variables, and +# it will define a HAVE_CELT051 preprocessor symbol as well as a HAVE_CELT051 +# Makefile conditional. +#---------------------------- +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"]) +]) -- cgit v1.2.3