]> err.no Git - pkg-config/commitdiff
Use --short-errors if it's available.
authorTollef Fog Heen <tfheen@err.no>
Sun, 16 Oct 2005 17:51:24 +0000 (17:51 +0000)
committerTollef Fog Heen <tfheen@err.no>
Sun, 16 Oct 2005 17:51:24 +0000 (17:51 +0000)
ChangeLog
pkg.m4

index ed12518a9d48e4004761517525ee65f02c8de38f..78518defd87584a8fcd6f0d1547e2302d1290a86 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2005-10-16  Tollef Fog Heen  <tfheen@err.no>
 
+       * pkg.m4: Use --short-errors if it's available.
+
        * pkg.c (get_package_quiet): Add get_package_quiet which is just
        the same as get_package except it sets warn to false.
 
diff --git a/pkg.m4 b/pkg.m4
index 3c20213900712b0b6b87f5cf3eb1d0db3a1a80ab..251a62dac0ecb32351c4adc1e91391ef7615c7a4 100644 (file)
--- a/pkg.m4
+++ b/pkg.m4
@@ -79,6 +79,18 @@ else
 fi[]dnl
 ])# _PKG_CONFIG
 
+# _PKG_SHORT_ERRORS_SUPPORTED
+# -----------------------------
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi[]dnl
+])# _PKG_SHORT_ERRORS_SUPPORTED
+
+
 # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
 # [ACTION-IF-NOT-FOUND])
 #
@@ -101,12 +113,20 @@ _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
 _PKG_CONFIG([$1][_LIBS], [libs], [$2])
 
 if test $pkg_failed = yes; then
-       $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
+        _PKG_SHORT_ERRORS_SUPPORTED
+        if test $_pkg_short_errors_supported = yes; then
+               $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
+        else 
+               $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
+        fi
        # Put the nasty error message in config.log where it belongs
        echo "$$1[]_PKG_ERRORS" 1>&AS_MESSAGE_LOG_FD
 
        ifelse([$4], , [AC_MSG_ERROR(dnl
-[Package requirements ($2) were not met.
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
 Consider adjusting the PKG_CONFIG_PATH environment variable if you
 installed software in a non-standard prefix.