Subject: Re: bug#17339: [bug-gnu-emacs] emacs-24.3.90: big build report

From: Glenn Morris <[email-masked]>
Date: Thu, 01 May 2014 17:59:48 -0400

Glenn Morris wrote:

> "Nelson H. F. Beebe" wrote:
[...]
>> (2) On NetBSD 6, configure tests for -lpng fail because that library does
>>     not exist; instead, the vendor provides only -lpng16.  I fooled the
>>     emacs configure script by creating this symlink:
>>
>> 		    /usr/local/lib/libpng.a: symbolic link to `/usr/pkg/lib/libpng16.a'
>>
>>     so that -lpng is now found.
>
> This has come up before; http://debbugs.gnu.org/11797#8 .

I applied the following:

--- a/configure.ac	2014-04-29 14:49:11 +0000
+++ b/configure.ac	2014-05-01 21:57:27 +0000
@@ -3101,8 +3101,15 @@
   fi
 
   if test "${HAVE_PNG}" = "yes"; then
-    AC_DEFINE(HAVE_PNG, 1, [Define to 1 if you have the png library (-lpng).])
-    LIBPNG="-lpng -lz -lm"
+    AC_DEFINE(HAVE_PNG, 1, [Define to 1 if you have the png library.])
+
+    dnl Some systems, eg NetBSD 6, only provide eg "libpng16", not "libpng".
+    lpng=`libpng-config --libs 2> /dev/null`
+    case $lpng in
+      -l*) : ;;
+      *) lpng="-lpng" ;;
+    esac
+    LIBPNG="$lpng -lz -lm"
 
     AC_CHECK_DECL(png_longjmp,
       [],
@@ -4976,7 +4983,7 @@
 echo "  Does Emacs use -ljpeg?                                  ${HAVE_JPEG}"
 echo "  Does Emacs use -ltiff?                                  ${HAVE_TIFF}"
 echo "  Does Emacs use a gif library?                           ${HAVE_GIF} $LIBGIF"
-echo "  Does Emacs use -lpng?                                   ${HAVE_PNG}"
+echo "  Does Emacs use a png library?                           ${HAVE_PNG} $LIBPNG"
 echo "  Does Emacs use -lrsvg-2?                                ${HAVE_RSVG}"
 echo "  Does Emacs use imagemagick?                             ${HAVE_IMAGEMAGICK}"