[Spice-devel] [common 03/11] build-sys: Add SPICE_CHECK_GSTREAMER_ELEMENTS()

Francois Gouget fgouget at codeweavers.com
Tue Nov 3 04:05:49 PST 2015


This makes it possible to warn the developer that the GStreamer elements
needed at runtime are missing and give him a hint on how to fix the
issue.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 m4/spice-deps.m4 | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/m4/spice-deps.m4 b/m4/spice-deps.m4
index bb58d0f..e7190f6 100644
--- a/m4/spice-deps.m4
+++ b/m4/spice-deps.m4
@@ -216,14 +216,46 @@ AC_DEFUN([SPICE_CHECK_LZ4], [
 # ---------------------
 AC_DEFUN([SPICE_CHECK_GSTREAMER], [
     AS_VAR_PUSHDEF([have_gst],[have_]m4_tolower([$1]))dnl
+    AS_VAR_PUSHDEF([gst_inspect],[GST_INSPECT_$2])dnl
     PKG_CHECK_MODULES([$1], [$3],
         [have_gst="yes"
          AC_SUBST(AS_TR_SH([[$1]_CFLAGS]))
          AC_SUBST(AS_TR_SH([[$1]_LIBS]))
          AS_VAR_APPEND([SPICE_REQUIRES], [" $3"])
          AC_DEFINE(AS_TR_SH([HAVE_$1]), [1], [Define if supporting GStreamer $2])
+         AC_PATH_PROG(gst_inspect, gst-inspect-$2)
+         AS_IF([test "x$gst_inspect" = x],
+               SPICE_WARNING([Cannot verify that the required runtime GStreamer $2 elements are present because gst-inspect-$2 is missing]))
          $4],
         [have_gst="no"
          $5])
+    AS_VAR_POPDEF([gst_inspect])dnl
     AS_VAR_POPDEF([have_gst])dnl
 ])
+
+# SPICE_CHECK_GSTREAMER_ELEMENTS(gst-inspect, package, elements-to-check-for)
+# ---------------------
+# Checks that the specified GStreamer elements are installed. If not it
+# issues a warning and sets missing_gstreamer_elements.
+# ---------------------
+AC_DEFUN([SPICE_CHECK_GSTREAMER_ELEMENTS], [
+AS_IF([test "x$1" != x],
+      [missing=""
+       for element in $3
+       do
+           AS_VAR_PUSHDEF([cache_var],[spice_cv_prog_${1}_${element}])dnl
+           AC_CACHE_CHECK([for the $element GStreamer element], cache_var,
+                          [found=no
+                           "$1" $element >/dev/null 2>/dev/null && found=yes
+                           eval "cache_var=$found"])
+           AS_VAR_COPY(res, cache_var)
+           AS_IF([test "x$res" = "xno"], [missing="$missing $element"])
+           AS_VAR_POPDEF([cache_var])dnl
+       done
+       AS_IF([test "x$missing" != x],
+             [SPICE_WARNING([The$missing GStreamer element(s) are missing. You should be able to find them in the $2 package.])
+              missing_gstreamer_elements="yes"],
+             [test "x$missing_gstreamer_elements" = x],
+             [missing_gstreamer_elements="no"])
+      ])
+])
-- 
2.6.1


More information about the Spice-devel mailing list