m4/: add macro for easy checks for GStreamer libs
authorThomas Vander Stichele <thomas@apestaart.org>
Mon, 17 Oct 2005 15:36:48 +0000 (15:36 +0000)
committerThomas Vander Stichele <thomas@apestaart.org>
Mon, 17 Oct 2005 15:36:48 +0000 (15:36 +0000)
Original commit message from CVS:

* m4/gst-glib2.m4:
* m4/Makefile.am:
* m4/gst-check.m4:
add macro for easy checks for GStreamer libs

ChangeLog
m4/Makefile.am
m4/gst-check.m4 [new file with mode: 0644]

index b95e28e..cae7298 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2005-10-17  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gst-glib2.m4:
+       * m4/Makefile.am:
+       * m4/gst-check.m4:
+         add macro for easy checks for GStreamer libs
+
 2005-10-16  Thomas Vander Stichele  <thomas at apestaart dot org>
 
        * m4/gst-glib2.m4:
index 96ac11a..5f5d267 100644 (file)
@@ -14,6 +14,7 @@ EXTRA_DIST = \
        glib-gettext.m4 \
        gst-arch.m4 \
        gst-args.m4 \
+       gst-check.m4 \
        gst-debuginfo.m4 \
        gst-doc.m4 \
        gst-feature.m4 \
diff --git a/m4/gst-check.m4 b/m4/gst-check.m4
new file mode 100644 (file)
index 0000000..9f542ae
--- /dev/null
@@ -0,0 +1,77 @@
+dnl pkg-config-based checks for GStreamer modules
+
+dnl generic:
+dnl GST_CHECK_MODULES([PREFIX], [MODULE], [MINVER], [NAME], [REQUIRED])
+dnl sets HAVE_[$PREFIX], [$PREFIX]_*
+
+dnl specific:
+dnl GST_CHECK_GST([MAJMIN], [MINVER], [REQUIRED])
+dnl   also sets/ACSUBSTs GST_TOOLS_DIR and GST_PLUGINS_DIR
+dnl GST_CHECK_GST_BASE([MAJMIN], [MINVER], [REQUIRED])
+dnl GST_CHECK_GST_GDP([MAJMIN], [MINVER], [REQUIRED])
+dnl GST_CHECK_GST_CONTROLLER([MAJMIN], [MINVER], [REQUIRED])
+dnl GST_CHECK_GST_CHECK([MAJMIN], [MINVER], [REQUIRED])
+
+AC_DEFUN([GST_CHECK_MODULES],
+[
+  AC_REQUIRE([PKG_CHECK_MODULES])
+  module=[$2]
+  minver=[$3]
+  name="[$4]"
+  required=ifelse([$5], [$5], "yes") dnl fail by default
+
+  PKG_CHECK_MODULES([$1], $module >= $minver,
+    HAVE_[$1]="yes", HAVE_[$1]="no")
+
+  if test "x$HAVE_[$1]" = "xno"; then
+    if test "x$required" = "xyes"; then
+      AC_MSG_ERROR([no $module >= $minver ($name) found])
+    else
+      AC_MSG_NOTICE([no $module >= $minver ($name) found])
+    fi
+  fi
+]))
+
+AC_DEFUN([GST_CHECK_GST],
+[
+  GST_CHECK_MODULES(GST, gstreamer-[$1], [$2], [GStreamer], [$3])
+  GST_TOOLS_DIR=`pkg-config --variable=toolsdir gstreamer-$GST_MAJORMINOR`
+  if test -z $GST_TOOLS_DIR; then
+    AC_MSG_ERROR(
+      [no tools dir set in GStreamer pkg-config file; core upgrade needed.])
+  fi
+  AC_SUBST(GST_TOOLS_DIR)
+
+  dnl check for where core plug-ins got installed
+  dnl this is used for unit tests
+  GST_PLUGINS_DIR=`pkg-config --variable=pluginsdir gstreamer-$GST_MAJORMINOR`
+  if test -z $GST_PLUGINS_DIR; then
+    AC_MSG_ERROR(
+      [no pluginsdir set in GStreamer pkg-config file; core upgrade needed.])
+  fi
+  AC_SUBST(GST_PLUGINS_DIR)
+])
+
+AC_DEFUN([GST_CHECK_GST_BASE],
+[
+  GST_CHECK_MODULES(GST_BASE, gstreamer-base-[$1], [$2],
+    [GStreamer Base Libraries], [$3])
+])
+  
+AC_DEFUN([GST_CHECK_GST_GDP],
+[
+  GST_CHECK_MODULES(GST_GDP, gstreamer-dataprotocol-[$1], [$2],
+    [GStreamer Data Protocol Library], [$3])
+])
+  
+AC_DEFUN([GST_CHECK_GST_CONTROLLER],
+[
+  GST_CHECK_MODULES(GST_CONTROLLER, gstreamer-controller-[$1], [$2],
+    [GStreamer Controller Library], [$3])
+])  
+
+AC_DEFUN([GST_CHECK_GST_CHECK],
+[
+  GST_CHECK_MODULES(GST_CHECK, gstreamer-check-[$1], [$2],
+    [GStreamer Check unittest Library], [$3])
+])