From: Arch Librarian Date: Thu, 14 Jul 2005 13:07:25 +0000 (+0000) Subject: 2005-06-27 Tollef Fog Heen X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=306214992470533299fc54a4111324bbf20d275f;p=pkg-config 2005-06-27 Tollef Fog Heen Author: tfheen Date: 2005-06-26 22:51:05 GMT 2005-06-27 Tollef Fog Heen * pkg.m4: Add PKG_CHECK_EXISTS to check if a module exists. Thanks to James Henstridge for the patch. --- diff --git a/ChangeLog b/ChangeLog index b5688ea..7c74aac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-06-27 Tollef Fog Heen + + * 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 * pkg.m4: Get rid of caching again. This breaks too much stuff, diff --git a/pkg.m4 b/pkg.m4 index 69a890c..7e9c5a0 100644 --- 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