Subject: Re: 25.1; configure.ac libpng search error

From: Paul Eggert <[email-masked]>
Date: Sat, 24 Dec 2016 17:08:10 -0800

> I believe the fix is to change line 3413 of configure.ac to read:
>
>     png_libs=`(libpng-config --ldflags) 2>&AS_MESSAGE_LOG_FD` || {

Thanks, I did something along those lines by installing the attached patch into 
master, and I'm boldly marking the bug report as done.

> although IMO that's not quite sufficient, because it doesn't set RPATH.

--ldflags is supposed to output any -R options needed, no? If it's not, it 
sounds like the libpng-config configuration is incorrect.
>From 5bdbbe3e89adbb2a2092cc73586ffc38ddbb95d9 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Sat, 24 Dec 2016 17:03:22 -0800
Subject: [PATCH] Use libpng-config --ldflags, not --libs

Problem reported by James K. Lowden (Bug#25268).
* configure.ac (LIBPNG): Pass --ldflags, not --libs, to libpng-config.
---
 configure.ac | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5aaf006..cd6c689 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3476,7 +3476,7 @@ AC_DEFUN
   elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then
     AC_MSG_CHECKING([for png])
     png_cflags=`(libpng-config --cflags) 2>&AS_MESSAGE_LOG_FD` &&
-    png_libs=`(libpng-config --libs) 2>&AS_MESSAGE_LOG_FD` || {
+    png_ldflags=`(libpng-config --ldflags) 2>&AS_MESSAGE_LOG_FD` || {
       # libpng-config does not work; configure by hand.
       # Debian unstable as of July 2003 has multiple libpngs, and puts png.h
       # in /usr/include/libpng.
@@ -3486,18 +3486,18 @@ AC_DEFUN
       else
 	png_cflags=
       fi
-      png_libs='-lpng'
+      png_ldflags='-lpng'
     }
     SAVE_CFLAGS=$CFLAGS
     SAVE_LIBS=$LIBS
     CFLAGS="$CFLAGS $png_cflags"
-    LIBS="$png_libs -lz -lm $LIBS"
+    LIBS="$png_ldflags -lz -lm $LIBS"
     AC_LINK_IFELSE(
       [AC_LANG_PROGRAM([[#include <png.h>]],
 	 [[return !png_get_channels (0, 0);]])],
       [HAVE_PNG=yes
        PNG_CFLAGS=`AS_ECHO(["$png_cflags"]) | sed -e "$edit_cflags"`
-       LIBPNG=$png_libs
+       LIBPNG=$png_ldflags
        # $LIBPNG requires explicit -lz in some cases.
        # We don't know what those cases are, exactly, so play it safe and
        # append -lz to any nonempty $LIBPNG, unless we're already using LIBZ.
-- 
2.7.4