From 4366f5842fc6ca0432c5dfa6b6dcb20d83aa4ee8 Mon Sep 17 00:00:00 2001 From: Tollef Fog Heen Date: Wed, 13 Apr 2011 21:45:57 +0200 Subject: [PATCH] Handle --exist working and --cflags or --libs failing --exists no longer does a full depth traversal, which means we need to pay attention to the exit status when calling pkg-config --libs and --cflags. If those fail, we run with --cflags and --libs to get the error message before printing it out. Fixes Freedesktop #36039 --- pkg.m4 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg.m4 b/pkg.m4 index 31169b4..a6451d8 100644 --- a/pkg.m4 +++ b/pkg.m4 @@ -72,7 +72,8 @@ m4_define([_PKG_CONFIG], pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], - [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], [pkg_failed=yes]) else pkg_failed=untried @@ -120,9 +121,9 @@ if test $pkg_failed = yes; then AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then - $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1` + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else - $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1` + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD