]> err.no Git - pkg-config/commitdiff
2005-06-27 Tollef Fog Heen <tfheen@err.no>
authorArch Librarian <arch@canonical.com>
Thu, 14 Jul 2005 13:07:25 +0000 (13:07 +0000)
committerArch Librarian <arch@canonical.com>
Thu, 14 Jul 2005 13:07:25 +0000 (13:07 +0000)
Author: tfheen
Date: 2005-06-26 22:51:05 GMT
2005-06-27  Tollef Fog Heen  <tfheen@err.no>

    * pkg.m4: Add PKG_CHECK_EXISTS to check if a module exists.
    Thanks to James Henstridge for the patch.

ChangeLog
pkg.m4

index b5688ea1448066d4337e6118295546e38b5457ce..7c74aac1e9a5a04c3a79ee8d289e77e85bf2a6b6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-06-27  Tollef Fog Heen  <tfheen@err.no>
+
+       * pkg.m4: Add PKG_CHECK_EXISTS to check if a module exists.
+       Thanks to James Henstridge for the patch.
+
 2005-06-26  Tollef Fog Heen  <tfheen@err.no>
 
        * pkg.m4: Get rid of caching again.  This breaks too much stuff,
diff --git a/pkg.m4 b/pkg.m4
index 69a890cab67cc95072a4288fe3b40157ac17694d..7e9c5a0b01812b947ea2a6dc55d80aa21e39f4c8 100644 (file)
--- a/pkg.m4
+++ b/pkg.m4
@@ -43,16 +43,33 @@ if test -n "$PKG_CONFIG"; then
 fi[]dnl
 ])# PKG_PROG_PKG_CONFIG
 
+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# Check to see whether a particular set of modules exists.  Similar
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
+#
+#
+# Similar to PKG_CHECK_MODULES, make sure that the first instance of
+# this or PKG_CHECK_MODULES is called, or make sure to call
+# PKG_CHECK_EXISTS manually
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+  m4_ifval([$2], [$2], [:])
+m4_ifvaln([$3], [else
+  $3])dnl
+fi])
+
+
 # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
 # ---------------------------------------------
 m4_define([_PKG_CONFIG],
 [if test -n "$PKG_CONFIG"; then
-       if AC_RUN_LOG([$PKG_CONFIG --exists "$3" >/dev/null 2>&1]); then
-               pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
-       else
-               pkg_failed=yes
-       fi
-else
+        PKG_CHECK_EXISTS([$3],
+                         [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
+                        [pkg_failed=yes])
        pkg_failed=untried
 fi[]dnl
 ])# _PKG_CONFIG