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
This commit is contained in:
Tim-Philipp Müller 2012-09-01 18:06:58 +01:00
parent 4ab9587417
commit 8cd5813fa6
5 changed files with 36 additions and 28 deletions

3
.gitignore vendored
View file

@ -37,7 +37,6 @@ mkinstalldirs
py-compile
registry.*
coverage-report.txt
gst-element-check.m4
.deps
.libs
*~
@ -50,4 +49,4 @@ Build
*.ipch
*.sdf
*.opensdf
*.DS_Store
*.DS_Store

View file

@ -30,7 +30,7 @@ include $(top_srcdir)/common/win32.mak
EXTRA_DIST = \
gstreamer.spec gstreamer.spec.in \
gst-element-check.m4.in \
gst-element-check.m4 \
configure.ac autogen.sh depcomp \
MAINTAINERS ABOUT-NLS RELEASE gstreamer.doap \
scripts/gst-uninstalled \
@ -153,7 +153,7 @@ endif
check: $(CHECK_EXPORTS) check-enum-gettypes
gst-element-check-@GST_API_VERSION@.m4: gst-element-check.m4
$(AM_V_GEN)cp gst-element-check.m4 gst-element-check-@GST_API_VERSION@.m4
$(AM_V_GEN)cp $(srcdir)/gst-element-check.m4 gst-element-check-@GST_API_VERSION@.m4
# cruft: plugins that have been merged or moved or renamed

View file

@ -796,7 +796,6 @@ pkgconfig/gstreamer-controller.pc
pkgconfig/gstreamer-controller-uninstalled.pc
pkgconfig/gstreamer-net.pc
pkgconfig/gstreamer-net-uninstalled.pc
gst-element-check.m4
gstreamer.spec
)

33
gst-element-check.m4 Normal file
View file

@ -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
])

View file

@ -1,23 +0,0 @@
dnl Perform a check for a GStreamer element using gst-inspect
dnl Thomas Vander Stichele <thomas at apestaart dot org>
dnl Last modification: 25/01/2005
dnl AM_GST_ELEMENT_CHECK(ELEMENT-NAME, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
AC_DEFUN([AM_GST_ELEMENT_CHECK],
[
if test "x$GST_INSPECT" = "x"; then
AC_CHECK_PROG(GST_INSPECT, gst-inspect-@GST_API_VERSION@, gst-inspect-@GST_API_VERSION@, [])
fi
if test "x$GST_INSPECT" != "x"; then
AC_MSG_CHECKING(GStreamer @GST_API_VERSION@ element $1)
if [ $GST_INSPECT $1 > /dev/null 2> /dev/null ]; then
AC_MSG_RESULT(found.)
$2
else
AC_MSG_RESULT(not found.)
$3
fi
fi
])