From ec5f5b309d86d33a978a2419015e9aaaa31758b9 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 3 May 2014 23:34:04 -0700 Subject: [PATCH] * configure.ac (LIBPNG): Add -lz -lm on platforms where they're needed but libpng-config --libs omits them. Problem reported by Glenn Morris. --- ChangeLog | 6 ++++++ configure.ac | 23 +++++++++++++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 83d378374b9..8589f412385 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-05-04 Paul Eggert + + * configure.ac (LIBPNG): Add -lz -lm on platforms where they're needed + but libpng-config --libs omits them. Problem reported by Glenn + Morris. + 2014-05-03 Paul Eggert Require ImageMagick >= 6.3.5, due to PixelSetMagickColor (Bug#17339). diff --git a/configure.ac b/configure.ac index 4fd842817b6..1f458771bbd 100644 --- a/configure.ac +++ b/configure.ac @@ -3080,10 +3080,25 @@ elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then if png_cflags=`(libpng-config --cflags) 2>&AS_MESSAGE_LOG_FD` && png_libs=`(libpng-config --libs) 2>&AS_MESSAGE_LOG_FD` then - HAVE_PNG=yes - PNG_CFLAGS=`AS_ECHO(["$png_cflags"]) | sed -e "$edit_cflags"` - LIBPNG=$png_libs - else + # On some platforms, LIBPNG must also contain -lz -lm. + SAVE_CFLAGS=$CFLAGS + SAVE_LIBS=$LIBS + CFLAGS="$CFLAGS $png_cflags" + for png_libextras in '' ' -lz -lm'; do + LIBS="$png_libs$png_libextras $SAVE_LIBS" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[#include + ]], + [[return png_get_channels (0, 0);]])], + [HAVE_PNG=yes + PNG_CFLAGS=`AS_ECHO(["$png_cflags"]) | sed -e "$edit_cflags"` + LIBPNG=$png_libs$png_libextras]) + test $HAVE_PNG = yes && break + done + CFLAGS=$SAVE_CFLAGS + LIBS=$SAVE_LIBS + fi + if test $HAVE_PNG != yes; then # libpng-config does not work; configure it by hand. # Debian unstable as of July 2003 has multiple libpngs, and puts png.h # in /usr/include/libpng. -- 2.11.4.GIT