File: gst-element-check.m4

package info (click to toggle)
gstreamer1.0 1.4.4-2+deb8u1
  • links: PTS
  • area: main
  • in suites: jessie
  • size: 30,228 kB
  • ctags: 22,496
  • sloc: ansic: 137,307; xml: 18,193; sh: 12,851; makefile: 2,105; perl: 1,537; yacc: 865; python: 433; lex: 164; lisp: 154; cpp: 38; sed: 16
file content (33 lines) | stat: -rw-r--r-- 1,194 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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])
      $3
    else
      if [ $gstinspect --exists $1 ]; then
        AC_MSG_RESULT([found, but too old])
      else
        AC_MSG_RESULT([not found])
      fi
      $4
    fi
  fi
])