about summary refs log tree commit diff
diff options
context:
space:
mode:
-rwxr-xr-xbuildtools/configure.pl20
1 files changed, 15 insertions, 5 deletions
diff --git a/buildtools/configure.pl b/buildtools/configure.pl
index 332113d5..93045b77 100755
--- a/buildtools/configure.pl
+++ b/buildtools/configure.pl
@@ -1164,14 +1164,18 @@ sub getPngLibrary($@) {
 
     my ($pnglib, $pnghdr_dir);
 
-    if (commandExists('libpng-config')) {
-        # We don't need to ask where Libpng is; there's a 'libpng-config'
-        # That tells exactly how to access it, and the make files will use
-        # that.
+    if (system('pkg-config libpng --exists') == 0) {
+        # We don't need to ask where Libpng is; the Pkg-config database knows
+        # and the make files will use that.
         #
         # To limit the confusion when someone tries to use our result in
         # spite of the fact that 'libpng-config' exists, we assign suggestive
-        # dummy values.
+        # dummy values (just for use in human debugging).
+        $pnglib     = 'USE_PKG_CONFIG.a';
+        $pnghdr_dir = 'USE_PKG_CONFIG.a';
+    } elsif (commandExists('libpng-config')) {
+        # As with Pkg-config above, we can find out how to access the
+        # library by invoking a 'libpng-config' command.
         $pnglib     = 'USE_LIBPNG-CONFIG.a';
         $pnghdr_dir = 'USE_LIBPNG-CONFIG.a';
     } else {
@@ -1258,6 +1262,12 @@ sub getX11Library($@) {
     if (system('pkg-config x11 --exists') == 0) {
         # We don't need to ask where X libraries are; pkg-config knows and the
         # make files will use that.
+        #
+        # To limit the confusion when someone tries to use our result in
+        # spite of the fact that 'libpng-config' exists, we assign suggestive
+        # dummy values (just for use in human debugging).
+        $x11lib     = 'USE_PKGCONFIG.a';
+        $x11hdr_dir = 'USE_PKGCONFIG.a';
     } else {
         {
             my $default;