[Spice-commits] 3 commits - m4/spice-deps.m4

Christophe Fergau teuf at kemper.freedesktop.org
Mon Nov 16 07:37:40 PST 2015


 m4/spice-deps.m4 |   77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)

New commits:
commit f471022453c20e7fcfb54b865d5fbfbcf71fa6c2
Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Tue Nov 3 13:05:49 2015 +0100

    build-sys: Add SPICE_CHECK_GSTREAMER_ELEMENTS()
    
    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>

diff --git a/m4/spice-deps.m4 b/m4/spice-deps.m4
index bb58d0f..cb2b4c0 100644
--- a/m4/spice-deps.m4
+++ b/m4/spice-deps.m4
@@ -1,6 +1,10 @@
 # For autoconf < 2.63
 m4_ifndef([AS_VAR_APPEND],
           AC_DEFUN([AS_VAR_APPEND], $1=$$1$2))
+m4_ifndef([AS_VAR_COPY],
+          [m4_define([AS_VAR_COPY],
+          [AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])])
+
 
 # SPICE_WARNING(warning)
 # SPICE_PRINT_MESSAGES
@@ -216,14 +220,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"])
+      ])
+])
commit 437b817f49287e82cc800f3c1632e2499e0176da
Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Tue Nov 3 13:05:40 2015 +0100

    build-sys: Add SPICE_CHECK_GSTREAMER()
    
    This simplifies checking for GStreamer modules by setting all the
    variables we normally need.
    
    Signed-off-by: Francois Gouget <fgouget at codeweavers.com>

diff --git a/m4/spice-deps.m4 b/m4/spice-deps.m4
index 57d5b78..bb58d0f 100644
--- a/m4/spice-deps.m4
+++ b/m4/spice-deps.m4
@@ -207,3 +207,23 @@ AC_DEFUN([SPICE_CHECK_LZ4], [
       AC_DEFINE(USE_LZ4, [1], [Define to build with lz4 support])
     fi
 ])
+
+
+# SPICE_CHECK_GSTREAMER(VAR, version, packages-to-check-for, [action-if-found, [action-if-not-found]])
+# ---------------------
+# Checks whether the specified GStreamer modules are present and sets the
+# corresponding autoconf variables and preprocessor definitions.
+# ---------------------
+AC_DEFUN([SPICE_CHECK_GSTREAMER], [
+    AS_VAR_PUSHDEF([have_gst],[have_]m4_tolower([$1]))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])
+         $4],
+        [have_gst="no"
+         $5])
+    AS_VAR_POPDEF([have_gst])dnl
+])
commit 899a7c75e31c4ac9d64ab6ec7b61b2b6c6de3e3a
Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Tue Nov 3 13:05:28 2015 +0100

    build-sys: Add the SPICE_WARNING() and SPICE_PRINT_MESSAGES m4 macros
    
    A call to SPICE_WARNING() anywhere in the configure file results in the
    warning being printed at the end of the configure run where it will be
    be visible. This makes it possible to keep the SPICE_WARNING() calls
    together with the related feature checks instead of having to put a
    separate AC_MSG_WARN() call near the end.
    
    Signed-off-by: Francois Gouget <fgouget at codeweavers.com>

diff --git a/m4/spice-deps.m4 b/m4/spice-deps.m4
index 0f90cec..57d5b78 100644
--- a/m4/spice-deps.m4
+++ b/m4/spice-deps.m4
@@ -1,3 +1,24 @@
+# For autoconf < 2.63
+m4_ifndef([AS_VAR_APPEND],
+          AC_DEFUN([AS_VAR_APPEND], $1=$$1$2))
+
+# SPICE_WARNING(warning)
+# SPICE_PRINT_MESSAGES
+# ----------------------
+# Collect warnings and print them at the end so they are clearly visible.
+# ---------------------
+AC_DEFUN([SPICE_WARNING],AS_VAR_APPEND([spice_warnings],["|$1"]))
+AC_DEFUN([SPICE_PRINT_MESSAGES],[
+    ac_save_IFS="$IFS"
+    IFS="|"
+    for msg in $spice_warnings; do
+        IFS="$ac_save_IFS"
+        AS_VAR_IF([msg],[],,[AC_MSG_WARN([$msg]); echo >&2])
+    done
+    IFS="$ac_save_IFS"
+])
+
+
 # SPICE_CHECK_SYSDEPS()
 # ---------------------
 # Checks for header files and library functions needed by spice-common.


More information about the Spice-commits mailing list