gst-element-check-1.0.m4 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. dnl Perform a check for a GStreamer element using gst-inspect-x.y
  2. dnl
  3. dnl GST_ELEMENT_CHECK(ELEMENT-NAME, MIN-VERSION, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
  4. dnl
  5. dnl ELEMENT-NAME : element factory name (mandatory)
  6. dnl MIN-VERSION : minimum version required, e.g. 1.0 or 1.0.5 (mandatory)
  7. dnl ACTION-IF_FOUND : action if element exists and is of the desired version
  8. dnl ACTION-IF-NOT-FOUND : action if element does not exist or is too old
  9. dnl
  10. dnl gstapiversion=`echo $2 | tr '.' '\n' | head -n 2 | tr '\n' '.' | sed 's/\.$//'`
  11. AC_DEFUN([GST_ELEMENT_CHECK],
  12. [
  13. AC_REQUIRE([PKG_PROG_PKG_CONFIG])
  14. gstapiversion=`echo "$2" | while IFS=. read a b; do echo "$a.0"; done`
  15. gsttoolsdir=`$PKG_CONFIG --variable=toolsdir gstreamer-$gstapiversion`
  16. if test "x$gsttoolsdir" != "x"; then
  17. gstinspect="$gsttoolsdir/gst-inspect-$gstapiversion"
  18. AC_MSG_CHECKING(GStreamer $gstapiversion element $1 >= $2)
  19. if [ $gstinspect --exists --atleast-version=$2 $1 ]; then
  20. AC_MSG_RESULT([found])
  21. $3
  22. else
  23. if [ $gstinspect --exists $1 ]; then
  24. AC_MSG_RESULT([found, but too old])
  25. else
  26. AC_MSG_RESULT([not found])
  27. fi
  28. $4
  29. fi
  30. fi
  31. ])