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

Christophe Fergeau cfergeau at redhat.com
Wed Nov 4 02:33:19 PST 2015


Hey,

On Tue, Nov 03, 2015 at 01:05:49PM +0100, Francois Gouget wrote:
> 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)

On el6, this needs a fallback definition:
+m4_ifndef([AS_VAR_COPY],
+          [m4_define([AS_VAR_COPY],
+          [AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])])

I can add that before pushing. Looks good otherwise (though my m4-foo is
weaker than what you are doing in this patch ;)

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20151104/ebb66c76/attachment.sig>


More information about the Spice-devel mailing list