summaryrefslogtreecommitdiff
path: root/gst-element-check.m4
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.net>2012-09-01 18:06:58 +0100
committerTim-Philipp Müller <tim@centricular.net>2012-09-01 23:32:17 +0100
commit8cd5813fa661d262159787c75a5695bde7df237d (patch)
tree06b85d426ef931868963210868d918816b012e17 /gst-element-check.m4
parent4ab9587417e8bdc292275e3901c59747c8a25e11 (diff)
downloadgstreamer-8cd5813fa661d262159787c75a5695bde7df237d.tar.gz
gst-element-check.m4: rename AM_GST_ELEMENT_CHECK to GST_ELEMENT_CHECK
And allow passing of a minimum version (if not needed, pass 1.0). https://bugzilla.gnome.org/show_bug.cgi?id=682968
Diffstat (limited to 'gst-element-check.m4')
-rw-r--r--gst-element-check.m433
1 files changed, 33 insertions, 0 deletions
diff --git a/gst-element-check.m4 b/gst-element-check.m4
new file mode 100644
index 0000000000..49ddc61ce4
--- /dev/null
+++ b/gst-element-check.m4
@@ -0,0 +1,33 @@
+dnl Perform a check for a GStreamer element using gst-inspect-x.y
+dnl
+dnl GST_ELEMENT_CHECK(ELEMENT-NAME, MIN-VERSION, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
+dnl
+dnl ELEMENT-NAME : element factory name (mandatory)
+dnl MIN-VERSION : minimum version required, e.g. 1.0 or 1.0.5 (mandatory)
+dnl ACTION-IF_FOUND : action if element exists and is of the desired version
+dnl ACTION-IF-NOT-FOUND : action if element does not exist or is too old
+dnl
+dnl gstapiversion=`echo $2 | tr '.' '\n' | head -n 2 | tr '\n' '.' | sed 's/\.$//'`
+
+AC_DEFUN([GST_ELEMENT_CHECK],
+[
+ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+
+ gstapiversion=`echo "$2" | while IFS=. read a b; do echo "$a.0"; done`
+ gsttoolsdir=`$PKG_CONFIG --variable=toolsdir gstreamer-$gstapiversion`
+ if test "x$gsttoolsdir" != "x"; then
+ gstinspect="$gsttoolsdir/gst-inspect-$gstapiversion"
+ AC_MSG_CHECKING(GStreamer $gstapiversion element $1 >= $2)
+ if [ $gstinspect --exists --atleast-version=$2 $1 ]; then
+ AC_MSG_RESULT([found])
+ $2
+ else
+ if [ $gstinspect --exists $1 ]; then
+ AC_MSG_RESULT([found, but too old])
+ else
+ AC_MSG_RESULT([not found])
+ fi
+ $3
+ fi
+ fi
+])