Blame gst-element-check-1.0.m4

Packit f546b1
dnl Perform a check for a GStreamer element using gst-inspect-x.y
Packit f546b1
dnl
Packit f546b1
dnl GST_ELEMENT_CHECK(ELEMENT-NAME, MIN-VERSION, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
Packit f546b1
dnl
Packit f546b1
dnl ELEMENT-NAME        : element factory name (mandatory)
Packit f546b1
dnl MIN-VERSION         : minimum version required, e.g. 1.0 or 1.0.5 (mandatory)
Packit f546b1
dnl ACTION-IF_FOUND     : action if element exists and is of the desired version
Packit f546b1
dnl ACTION-IF-NOT-FOUND : action if element does not exist or is too old
Packit f546b1
dnl
Packit f546b1
dnl gstapiversion=`echo $2 | tr '.' '\n' | head -n 2 | tr '\n' '.' | sed 's/\.$//'`
Packit f546b1
Packit f546b1
AC_DEFUN([GST_ELEMENT_CHECK],
Packit f546b1
[
Packit f546b1
  AC_REQUIRE([PKG_PROG_PKG_CONFIG])
Packit f546b1
Packit f546b1
  gstapiversion=`echo "$2" | while IFS=. read a b; do echo "$a.0"; done`
Packit f546b1
  gsttoolsdir=`$PKG_CONFIG --variable=toolsdir gstreamer-$gstapiversion`
Packit f546b1
  if test "x$gsttoolsdir" != "x"; then
Packit f546b1
    gstinspect="$gsttoolsdir/gst-inspect-$gstapiversion"
Packit f546b1
    AC_MSG_CHECKING(GStreamer $gstapiversion element $1 >= $2)
Packit f546b1
    if [ $gstinspect --exists --atleast-version=$2 $1 ]; then
Packit f546b1
      AC_MSG_RESULT([found])
Packit f546b1
      $3
Packit f546b1
    else
Packit f546b1
      if [ $gstinspect --exists $1 ]; then
Packit f546b1
        AC_MSG_RESULT([found, but too old])
Packit f546b1
      else
Packit f546b1
        AC_MSG_RESULT([not found])
Packit f546b1
      fi
Packit f546b1
      $4
Packit f546b1
    fi
Packit f546b1
  fi
Packit f546b1
])