Blame common/m4/gst-check.m4

Packit a6ee4b
dnl pkg-config-based checks for GStreamer modules and dependency modules
Packit a6ee4b
Packit a6ee4b
dnl generic:
Packit a6ee4b
dnl AG_GST_PKG_CHECK_MODULES([PREFIX], [WHICH], [REQUIRED])
Packit a6ee4b
dnl sets HAVE_[$PREFIX], [$PREFIX]_*
Packit a6ee4b
dnl AG_GST_CHECK_MODULES([PREFIX], [MODULE], [MINVER], [NAME], [REQUIRED])
Packit a6ee4b
dnl sets HAVE_[$PREFIX], [$PREFIX]_*
Packit a6ee4b
Packit a6ee4b
dnl specific:
Packit a6ee4b
dnl AG_GST_CHECK_GST([MAJMIN], [MINVER], [REQUIRED])
Packit a6ee4b
dnl   also sets/ACSUBSTs GST_TOOLS_DIR and GST_PLUGINS_DIR
Packit a6ee4b
dnl AG_GST_CHECK_GST_BASE([MAJMIN], [MINVER], [REQUIRED])
Packit a6ee4b
dnl AG_GST_CHECK_GST_CONTROLLER([MAJMIN], [MINVER], [REQUIRED])
Packit a6ee4b
dnl AG_GST_CHECK_GST_NET([MAJMIN], [MINVER], [REQUIRED])
Packit a6ee4b
dnl AG_GST_CHECK_GST_CHECK([MAJMIN], [MINVER], [REQUIRED])
Packit a6ee4b
dnl AG_GST_CHECK_GST_PLUGINS_BASE([MAJMIN], [MINVER], [REQUIRED])
Packit a6ee4b
dnl   also sets/ACSUBSTs GSTPB_PLUGINS_DIR
Packit a6ee4b
Packit a6ee4b
AC_DEFUN([AG_GST_PKG_CHECK_MODULES],
Packit a6ee4b
[
Packit a6ee4b
  which="[$2]"
Packit a6ee4b
  dnl not required by default, since we use this mostly for plugin deps
Packit a6ee4b
  required=ifelse([$3], , "no", [$3])
Packit a6ee4b
Packit a6ee4b
  PKG_CHECK_MODULES([$1], $which,
Packit a6ee4b
    [
Packit a6ee4b
      HAVE_[$1]="yes"
Packit a6ee4b
    ],
Packit a6ee4b
    [
Packit a6ee4b
      HAVE_[$1]="no"
Packit a6ee4b
      if test "x$required" = "xyes"; then
Packit a6ee4b
        AC_MSG_ERROR($[$1]_PKG_ERRORS)
Packit a6ee4b
      else
Packit a6ee4b
        AC_MSG_NOTICE($[$1]_PKG_ERRORS)
Packit a6ee4b
      fi
Packit a6ee4b
    ])
Packit a6ee4b
Packit a6ee4b
  dnl AC_SUBST of CFLAGS and LIBS was not done before automake 1.7
Packit a6ee4b
  dnl It gets done automatically in automake >= 1.7, which we now require
Packit a6ee4b
]))
Packit a6ee4b
Packit a6ee4b
AC_DEFUN([AG_GST_CHECK_MODULES],
Packit a6ee4b
[
Packit a6ee4b
  module=[$2]
Packit a6ee4b
  minver=[$3]
Packit a6ee4b
  name="[$4]"
Packit a6ee4b
  required=ifelse([$5], , "yes", [$5]) dnl required by default
Packit a6ee4b
Packit a6ee4b
  PKG_CHECK_MODULES([$1], $module >= $minver,
Packit a6ee4b
    [
Packit a6ee4b
      HAVE_[$1]="yes"
Packit a6ee4b
    ],
Packit a6ee4b
    [
Packit a6ee4b
      HAVE_[$1]="no"
Packit a6ee4b
      AC_MSG_NOTICE($[$1]_PKG_ERRORS)
Packit a6ee4b
      if test "x$required" = "xyes"; then
Packit a6ee4b
        AC_MSG_ERROR([no $module >= $minver ($name) found])
Packit a6ee4b
      else
Packit a6ee4b
        AC_MSG_NOTICE([no $module >= $minver ($name) found])
Packit a6ee4b
      fi
Packit a6ee4b
    ])
Packit a6ee4b
Packit a6ee4b
  dnl AC_SUBST of CFLAGS and LIBS was not done before automake 1.7
Packit a6ee4b
  dnl It gets done automatically in automake >= 1.7, which we now require
Packit a6ee4b
]))
Packit a6ee4b
Packit a6ee4b
AC_DEFUN([AG_GST_CHECK_GST],
Packit a6ee4b
[
Packit a6ee4b
  AG_GST_CHECK_MODULES(GST, gstreamer-[$1], [$2], [GStreamer], [$3])
Packit a6ee4b
  dnl allow setting before calling this macro to override
Packit a6ee4b
  if test -z $GST_TOOLS_DIR; then
Packit a6ee4b
    GST_TOOLS_DIR=`$PKG_CONFIG --variable=toolsdir gstreamer-[$1]`
Packit a6ee4b
    if test -z $GST_TOOLS_DIR; then
Packit a6ee4b
      AC_MSG_ERROR(
Packit a6ee4b
        [no tools dir set in GStreamer pkg-config file, core upgrade needed.])
Packit a6ee4b
    fi
Packit a6ee4b
  fi
Packit a6ee4b
  AC_MSG_NOTICE([using GStreamer tools in $GST_TOOLS_DIR])
Packit a6ee4b
  AC_SUBST(GST_TOOLS_DIR)
Packit a6ee4b
Packit a6ee4b
  dnl check for where core plug-ins got installed
Packit a6ee4b
  dnl this is used for unit tests
Packit a6ee4b
  dnl allow setting before calling this macro to override
Packit a6ee4b
  if test -z $GST_PLUGINS_DIR; then
Packit a6ee4b
    GST_PLUGINS_DIR=`$PKG_CONFIG --variable=pluginsdir gstreamer-[$1]`
Packit a6ee4b
    if test -z $GST_PLUGINS_DIR; then
Packit a6ee4b
      AC_MSG_ERROR(
Packit a6ee4b
        [no pluginsdir set in GStreamer pkg-config file, core upgrade needed.])
Packit a6ee4b
    fi
Packit a6ee4b
  fi
Packit a6ee4b
  AC_MSG_NOTICE([using GStreamer plug-ins in $GST_PLUGINS_DIR])
Packit a6ee4b
  AC_SUBST(GST_PLUGINS_DIR)
Packit a6ee4b
])
Packit a6ee4b
Packit a6ee4b
AC_DEFUN([AG_GST_CHECK_GST_BASE],
Packit a6ee4b
[
Packit a6ee4b
  AG_GST_CHECK_MODULES(GST_BASE, gstreamer-base-[$1], [$2],
Packit a6ee4b
    [GStreamer Base Libraries], [$3])
Packit a6ee4b
])
Packit a6ee4b
Packit a6ee4b
AC_DEFUN([AG_GST_CHECK_GST_CONTROLLER],
Packit a6ee4b
[
Packit a6ee4b
  AG_GST_CHECK_MODULES(GST_CONTROLLER, gstreamer-controller-[$1], [$2],
Packit a6ee4b
    [GStreamer Controller Library], [$3])
Packit a6ee4b
])
Packit a6ee4b
Packit a6ee4b
AC_DEFUN([AG_GST_CHECK_GST_NET],
Packit a6ee4b
[
Packit a6ee4b
  AG_GST_CHECK_MODULES(GST_NET, gstreamer-net-[$1], [$2],
Packit a6ee4b
    [GStreamer Network Library], [$3])
Packit a6ee4b
])
Packit a6ee4b
Packit a6ee4b
AC_DEFUN([AG_GST_CHECK_GST_CHECK],
Packit a6ee4b
[
Packit a6ee4b
  AG_GST_CHECK_MODULES(GST_CHECK, gstreamer-check-[$1], [$2],
Packit a6ee4b
    [GStreamer Check unittest Library], [$3])
Packit a6ee4b
])
Packit a6ee4b
Packit a6ee4b
dnl ===========================================================================
Packit a6ee4b
dnl AG_GST_CHECK_UNINSTALLED_SETUP([ACTION-IF-UNINSTALLED], [ACTION-IF-NOT])
Packit a6ee4b
dnl
Packit a6ee4b
dnl ACTION-IF-UNINSTALLED  (optional) extra actions to perform if the setup
Packit a6ee4b
dnl                        is an uninstalled setup
Packit a6ee4b
dnl ACTION-IF-NOT          (optional) extra actions to perform if the setup
Packit a6ee4b
dnl                        is not an uninstalled setup
Packit a6ee4b
dnl ===========================================================================
Packit a6ee4b
AC_DEFUN([AG_GST_CHECK_UNINSTALLED_SETUP],
Packit a6ee4b
[
Packit a6ee4b
  AC_MSG_CHECKING([whether this is an uninstalled GStreamer setup])
Packit a6ee4b
  AC_CACHE_VAL(gst_cv_is_uninstalled_setup,[
Packit a6ee4b
    gst_cv_is_uninstalled_setup=no
Packit a6ee4b
    if (set -u; : $GST_PLUGIN_SYSTEM_PATH) 2>/dev/null ; then
Packit a6ee4b
      if test -z "$GST_PLUGIN_SYSTEM_PATH" \
Packit a6ee4b
           -a -n "$GST_PLUGIN_SCANNER"     \
Packit a6ee4b
           -a -n "$GST_PLUGIN_PATH"        \
Packit a6ee4b
           -a -n "$GST_REGISTRY"           \
Packit a6ee4b
           -a -n "$DYLD_LIBRARY_PATH"      \
Packit a6ee4b
           -a -n "$LD_LIBRARY_PATH"; then
Packit a6ee4b
        gst_cv_is_uninstalled_setup=yes;
Packit a6ee4b
      fi
Packit a6ee4b
    fi
Packit a6ee4b
  ])
Packit a6ee4b
  AC_MSG_RESULT($gst_cv_is_uninstalled_setup)
Packit a6ee4b
  if test "x$gst_cv_is_uninstalled_setup" = "xyes"; then
Packit a6ee4b
    ifelse([$1], , :, [$1])
Packit a6ee4b
  else
Packit a6ee4b
    ifelse([$2], , :, [$2])
Packit a6ee4b
  fi
Packit a6ee4b
])
Packit a6ee4b
Packit a6ee4b
dnl ===========================================================================
Packit a6ee4b
dnl AG_GST_CHECK_GST_PLUGINS_BASE([GST-API_VERSION], [MIN-VERSION], [REQUIRED])
Packit a6ee4b
dnl
Packit a6ee4b
dnl Sets GST_PLUGINS_BASE_CFLAGS and GST_PLUGINS_BASE_LIBS.
Packit a6ee4b
dnl
Packit a6ee4b
dnl Also sets GSTPB_PLUGINS_DIR (and for consistency also GST_PLUGINS_BASE_DIR)
Packit a6ee4b
dnl for use in Makefile.am. This is only really needed/useful in uninstalled
Packit a6ee4b
dnl setups, since in an installed setup all plugins will be found in
Packit a6ee4b
dnl GST_PLUGINS_DIR anyway.
Packit a6ee4b
dnl ===========================================================================
Packit a6ee4b
AC_DEFUN([AG_GST_CHECK_GST_PLUGINS_BASE],
Packit a6ee4b
[
Packit a6ee4b
  AG_GST_CHECK_MODULES(GST_PLUGINS_BASE, gstreamer-plugins-base-[$1], [$2],
Packit a6ee4b
    [GStreamer Base Plugins], [$3])
Packit a6ee4b
Packit a6ee4b
  if test "x$HAVE_GST_PLUGINS_BASE" = "xyes"; then
Packit a6ee4b
    dnl check for where base plugins got installed
Packit a6ee4b
    dnl this is used for unit tests
Packit a6ee4b
    dnl allow setting before calling this macro to override
Packit a6ee4b
    if test -z $GSTPB_PLUGINS_DIR; then
Packit a6ee4b
      GSTPB_PLUGINS_DIR=`$PKG_CONFIG --variable=pluginsdir gstreamer-plugins-base-[$1]`
Packit a6ee4b
      if test -z $GSTPB_PLUGINS_DIR; then
Packit a6ee4b
        AC_MSG_ERROR(
Packit a6ee4b
          [no pluginsdir set in GStreamer Base Plugins pkg-config file])
Packit a6ee4b
      fi
Packit a6ee4b
    fi
Packit a6ee4b
    AC_MSG_NOTICE([using GStreamer Base Plugins in $GSTPB_PLUGINS_DIR])
Packit a6ee4b
    GST_PLUGINS_BASE_DIR="$GSTPB_PLUGINS_DIR/gst:$GSTPB_PLUGINS_DIR/sys:$GSTPB_PLUGINS_DIR/ext"
Packit a6ee4b
    AC_SUBST(GST_PLUGINS_BASE_DIR)
Packit a6ee4b
    AC_SUBST(GSTPB_PLUGINS_DIR)
Packit a6ee4b
  fi
Packit a6ee4b
])
Packit a6ee4b
Packit a6ee4b
dnl ===========================================================================
Packit a6ee4b
dnl AG_GST_CHECK_GST_PLUGINS_GOOD([GST-API_VERSION], [MIN-VERSION])
Packit a6ee4b
dnl
Packit a6ee4b
dnl Will set GST_PLUGINS_GOOD_DIR for use in Makefile.am. Note that this will
Packit a6ee4b
dnl only be set in an uninstalled setup, since -good ships no .pc file and in
Packit a6ee4b
dnl an installed setup all plugins will be found in GST_PLUGINS_DIR anyway.
Packit a6ee4b
dnl ===========================================================================
Packit a6ee4b
AC_DEFUN([AG_GST_CHECK_GST_PLUGINS_GOOD],
Packit a6ee4b
[
Packit a6ee4b
  AG_GST_CHECK_MODULES(GST_PLUGINS_GOOD, gstreamer-plugins-good-[$1], [$2],
Packit a6ee4b
    [GStreamer Good Plugins], [no])
Packit a6ee4b
Packit a6ee4b
  if test "x$HAVE_GST_PLUGINS_GOOD" = "xyes"; then
Packit a6ee4b
    dnl check for where good plugins got installed
Packit a6ee4b
    dnl this is used for unit tests
Packit a6ee4b
    dnl allow setting before calling this macro to override
Packit a6ee4b
    if test -z $GST_PLUGINS_GOOD_DIR; then
Packit a6ee4b
      GST_PLUGINS_GOOD_DIR=`$PKG_CONFIG --variable=pluginsdir gstreamer-plugins-good-[$1]`
Packit a6ee4b
      if test -z $GST_PLUGINS_GOOD_DIR; then
Packit a6ee4b
        AC_MSG_ERROR([no pluginsdir set in GStreamer Good Plugins pkg-config file])
Packit a6ee4b
      fi
Packit a6ee4b
    fi
Packit a6ee4b
    AC_MSG_NOTICE([using GStreamer Good Plugins in $GST_PLUGINS_GOOD_DIR])
Packit a6ee4b
    GST_PLUGINS_GOOD_DIR="$GST_PLUGINS_GOOD_DIR/gst:$GST_PLUGINS_GOOD_DIR/sys:$GST_PLUGINS_GOOD_DIR/ext"
Packit a6ee4b
    AC_SUBST(GST_PLUGINS_GOOD_DIR)
Packit a6ee4b
  fi
Packit a6ee4b
])
Packit a6ee4b
Packit a6ee4b
dnl ===========================================================================
Packit a6ee4b
dnl AG_GST_CHECK_GST_PLUGINS_UGLY([GST-API_VERSION], [MIN-VERSION])
Packit a6ee4b
dnl
Packit a6ee4b
dnl Will set GST_PLUGINS_UGLY_DIR for use in Makefile.am. Note that this will
Packit a6ee4b
dnl only be set in an uninstalled setup, since -bad ships no .pc file and in
Packit a6ee4b
dnl an installed setup all plugins will be found in GST_PLUGINS_DIR anyway.
Packit a6ee4b
dnl ===========================================================================
Packit a6ee4b
AC_DEFUN([AG_GST_CHECK_GST_PLUGINS_UGLY],
Packit a6ee4b
[
Packit a6ee4b
  AG_GST_CHECK_MODULES(GST_PLUGINS_UGLY, gstreamer-plugins-ugly-[$1], [$2],
Packit a6ee4b
    [GStreamer Ugly Plugins], [no])
Packit a6ee4b
Packit a6ee4b
  if test "x$HAVE_GST_PLUGINS_UGLY" = "xyes"; then
Packit a6ee4b
    dnl check for where ugly plugins got installed
Packit a6ee4b
    dnl this is used for unit tests
Packit a6ee4b
    dnl allow setting before calling this macro to override
Packit a6ee4b
    if test -z $GST_PLUGINS_UGLY_DIR; then
Packit a6ee4b
      GST_PLUGINS_UGLY_DIR=`$PKG_CONFIG --variable=pluginsdir gstreamer-plugins-ugly-[$1]`
Packit a6ee4b
      if test -z $GST_PLUGINS_UGLY_DIR; then
Packit a6ee4b
        AC_MSG_ERROR([no pluginsdir set in GStreamer Ugly Plugins pkg-config file])
Packit a6ee4b
      fi
Packit a6ee4b
    fi
Packit a6ee4b
    AC_MSG_NOTICE([using GStreamer Ugly Plugins in $GST_PLUGINS_UGLY_DIR])
Packit a6ee4b
    GST_PLUGINS_UGLY_DIR="$GST_PLUGINS_UGLY_DIR/gst:$GST_PLUGINS_UGLY_DIR/sys:$GST_PLUGINS_UGLY_DIR/ext"
Packit a6ee4b
    AC_SUBST(GST_PLUGINS_UGLY_DIR)
Packit a6ee4b
  fi
Packit a6ee4b
])
Packit a6ee4b
Packit a6ee4b
dnl ===========================================================================
Packit a6ee4b
dnl AG_GST_CHECK_GST_PLUGINS_BAD([GST-API_VERSION], [MIN-VERSION])
Packit a6ee4b
dnl
Packit a6ee4b
dnl Will set GST_PLUGINS_BAD_DIR for use in Makefile.am. Note that this will
Packit a6ee4b
dnl only be set in an uninstalled setup, since -ugly ships no .pc file and in
Packit a6ee4b
dnl an installed setup all plugins will be found in GST_PLUGINS_DIR anyway.
Packit a6ee4b
dnl ===========================================================================
Packit a6ee4b
AC_DEFUN([AG_GST_CHECK_GST_PLUGINS_BAD],
Packit a6ee4b
[
Packit a6ee4b
  AG_GST_CHECK_MODULES(GST_PLUGINS_BAD, gstreamer-plugins-bad-[$1], [$2],
Packit a6ee4b
    [GStreamer Bad Plugins], [no])
Packit a6ee4b
Packit a6ee4b
  if test "x$HAVE_GST_PLUGINS_BAD" = "xyes"; then
Packit a6ee4b
    dnl check for where bad plugins got installed
Packit a6ee4b
    dnl this is used for unit tests
Packit a6ee4b
    dnl allow setting before calling this macro to override
Packit a6ee4b
    if test -z $GST_PLUGINS_BAD_DIR; then
Packit a6ee4b
      GST_PLUGINS_BAD_DIR=`$PKG_CONFIG --variable=pluginsdir gstreamer-plugins-bad-[$1]`
Packit a6ee4b
      if test -z $GST_PLUGINS_BAD_DIR; then
Packit a6ee4b
        AC_MSG_ERROR([no pluginsdir set in GStreamer Bad Plugins pkg-config file])
Packit a6ee4b
      fi
Packit a6ee4b
    fi
Packit a6ee4b
    AC_MSG_NOTICE([using GStreamer Bad Plugins in $GST_PLUGINS_BAD_DIR])
Packit a6ee4b
    GST_PLUGINS_BAD_DIR="$GST_PLUGINS_BAD_DIR/gst:$GST_PLUGINS_BAD_DIR/sys:$GST_PLUGINS_BAD_DIR/ext"
Packit a6ee4b
    AC_SUBST(GST_PLUGINS_BAD_DIR)
Packit a6ee4b
  fi
Packit a6ee4b
])
Packit a6ee4b
Packit a6ee4b
dnl ===========================================================================
Packit a6ee4b
dnl AG_GST_CHECK_GST_PLUGINS_LIBAV([GST-API_VERSION], [MIN-VERSION])
Packit a6ee4b
dnl
Packit a6ee4b
dnl Will set GST_PLUGINS_LIBAV_DIR for use in Makefile.am. Note that this will
Packit a6ee4b
dnl only be set in an uninstalled setup, since -libav ships no .pc file and in
Packit a6ee4b
dnl an installed setup all plugins will be found in GST_PLUGINS_DIR anyway.
Packit a6ee4b
dnl ===========================================================================
Packit a6ee4b
AC_DEFUN([AG_GST_CHECK_GST_PLUGINS_LIBAV],
Packit a6ee4b
[
Packit a6ee4b
  AG_GST_CHECK_MODULES(GST_PLUGINS_LIBAV, gstreamer-plugins-libav-[$1], [$2],
Packit a6ee4b
    [GStreamer Libav Plugins], [no])
Packit a6ee4b
Packit a6ee4b
  if test "x$HAVE_GST_PLUGINS_LIBAV" = "xyes"; then
Packit a6ee4b
    dnl check for where libav plugins got installed
Packit a6ee4b
    dnl this is used for unit tests
Packit a6ee4b
    dnl allow setting before calling this macro to override
Packit a6ee4b
    if test -z $GST_PLUGINS_LIBAV_DIR; then
Packit a6ee4b
      GST_PLUGINS_LIBAV_DIR=`$PKG_CONFIG --variable=pluginsdir gstreamer-plugins-libav-[$1]`
Packit a6ee4b
      if test -z $GST_PLUGINS_LIBAV_DIR; then
Packit a6ee4b
        AC_MSG_ERROR([no pluginsdir set in GStreamer Libav Plugins pkg-config file])
Packit a6ee4b
      fi
Packit a6ee4b
    fi
Packit a6ee4b
    GST_PLUGINS_LIBAV_DIR="$GST_PLUGINS_LIBAV_DIR/ext/libav"
Packit a6ee4b
    AC_MSG_NOTICE([using GStreamer Libav Plugins in $GST_PLUGINS_LIBAV_DIR])
Packit a6ee4b
    AC_SUBST(GST_PLUGINS_LIBAV_DIR)
Packit a6ee4b
  fi
Packit a6ee4b
])