]> git.eshelyaron.com Git - emacs.git/commitdiff
Revert recent libpng changes.
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 4 May 2014 18:51:32 +0000 (11:51 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 4 May 2014 18:51:32 +0000 (11:51 -0700)
They fix only bugs that aren't being reported, so it may be better
to do them on the trunk.
* configure.ac (PNG_CFLAGS): Remove.  All uses removed.
(LIBPNG): Don't be consistent about -lpng16 versus -lpng.
Ignore libpng-config's exit status.  Always append -lz -lm.
* src/Makefile.in (PNG_CFLAGS): Remove; all uses removed.
* src/image.c [HAVE_LIBPNG_PNG_H]: Include <libpng/png.h>, not <png.h>.

Fixes: debbugs:17339
ChangeLog
configure.ac
src/ChangeLog
src/Makefile.in
src/image.c

index 8589f4123856b81ff946c1a753caf2e8336bbb44..7df946dd9eff83ac70b373da75b335bddaefa68f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2014-05-04  Paul Eggert  <eggert@cs.ucla.edu>
 
+       Revert recent libpng changes (Bug#17339).
+       They fix only bugs that aren't being reported, so it may be better
+       to do them on the trunk.
+       * configure.ac (PNG_CFLAGS): Remove.  All uses removed.
+       (LIBPNG): Don't be consistent about -lpng16 versus -lpng.
+       Ignore libpng-config's exit status.  Always append -lz -lm.
+
        * configure.ac (LIBPNG): Add -lz -lm on platforms where they're needed
        but libpng-config --libs omits them.  Problem reported by Glenn
        Morris.
index 1f458771bbd8da11505a696989eae52148b41022..8b042d23e3c52376b78681d8a7505629c5eb55b4 100644 (file)
@@ -3068,70 +3068,62 @@ AC_SUBST(LIBJPEG)
 ### mingw32 doesn't use -lpng, since it loads the library dynamically.
 HAVE_PNG=no
 LIBPNG=
-PNG_CFLAGS=
 if test "${opsys}" = "mingw32"; then
   if test "${with_png}" != "no"; then
-    AC_CHECK_HEADER([png.h], [HAVE_PNG=yes])
+    AC_CHECK_HEADER(png.h, HAVE_PNG=yes, HAVE_PNG=no)
+  fi
+  if test "${HAVE_PNG}" = "yes"; then
+    AC_DEFINE(HAVE_PNG, 1, [Define to 1 if you have the png library (-lpng).])
+
+    AC_CHECK_DECL(png_longjmp,
+      [],
+      [AC_DEFINE(PNG_DEPSTRUCT, [],
+        [Define to empty to suppress deprecation warnings when building
+         with --enable-gcc-warnings and with libpng versions before 1.5,
+         which lack png_longjmp.])],
+      [[#ifdef HAVE_LIBPNG_PNG_H
+       # include <libpng/png.h>
+       #else
+       # include <png.h>
+       #endif
+      ]])
   fi
 elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then
   if test "${with_png}" != "no"; then
-
-    dnl NetBSD 6 provides libpng16, not libpng.
-    if png_cflags=`(libpng-config --cflags) 2>&AS_MESSAGE_LOG_FD` &&
-       png_libs=`(libpng-config --libs) 2>&AS_MESSAGE_LOG_FD`
-    then
-      # 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 <png.h>
-                          ]],
-                          [[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.
-      AC_CHECK_HEADERS([png.h libpng/png.h],
-       [AC_CHECK_LIB([png], [png_get_channels],
-          [HAVE_PNG=yes
-           LIBPNG='-lpng -lz -lm'
-           if test "$ac_cv_header_libpng_png_h" = yes; then
-             PNG_CFLAGS=-I/usr/include/libpng
-           fi],
-          [],
-          [-lz -lm])
-        break])
+    # Debian unstable as of July 2003 has multiple libpngs, and puts png.h
+    # in /usr/include/libpng.
+    AC_CHECK_HEADERS(png.h libpng/png.h, break)
+    if test "$ac_cv_header_png_h" = yes || test "$ac_cv_header_libpng_png_h" = yes ; then
+      AC_CHECK_LIB(png, png_get_channels, HAVE_PNG=yes, , -lz -lm)
     fi
   fi
-fi
-if test $HAVE_PNG = yes; then
-  AC_DEFINE([HAVE_PNG], [1], [Define to 1 if you have the png library.])
-
-  SAVE_CFLAGS=$CFLAGS
-  CFLAGS="$CFLAGS $PNG_CFLAGS"
-  AC_CHECK_DECL([png_longjmp],
-    [],
-    [AC_DEFINE([PNG_DEPSTRUCT], [],
-       [Define to empty to suppress deprecation warnings when building
-       with --enable-gcc-warnings and with libpng versions before 1.5,
-       which lack png_longjmp.])],
-    [[#include <png.h>
-    ]])
-  CFLAGS=$SAVE_CFLAGS
+
+  if test "${HAVE_PNG}" = "yes"; then
+    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,
+      [],
+      [AC_DEFINE(PNG_DEPSTRUCT, [],
+        [Define to empty to suppress deprecation warnings when building
+         with --enable-gcc-warnings and with libpng versions before 1.5,
+         which lack png_longjmp.])],
+      [[#ifdef HAVE_LIBPNG_PNG_H
+       # include <libpng/png.h>
+       #else
+       # include <png.h>
+       #endif
+      ]])
+  fi
 fi
 AC_SUBST(LIBPNG)
-AC_SUBST(PNG_CFLAGS)
 
 HAVE_ZLIB=no
 LIBZ=
index 15b7c202034941a7a4f1e2c30de47c96c1669e35..0f6aaf93598150d5bad6ba1bb0c1b2bb87b4f792 100644 (file)
@@ -1,3 +1,9 @@
+2014-05-04  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Revert recent libpng changes (Bug#17339).
+       * Makefile.in (PNG_CFLAGS): Remove; all uses removed.
+       * image.c [HAVE_LIBPNG_PNG_H]: Include <libpng/png.h>, not <png.h>.
+
 2014-05-03  Paul Eggert  <eggert@cs.ucla.edu>
 
        Handle systems without WCONTINUED consistently.  (Bug#15110, 17339)
index c35e38bb290ca324c4d7de6ce67f7b1400d3f430..388923596c9fb853345f343f048be11d682f8679 100644 (file)
@@ -77,7 +77,6 @@ C_SWITCH_MACHINE=@C_SWITCH_MACHINE@
 C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@
 
 GNUSTEP_CFLAGS=@GNUSTEP_CFLAGS@
-PNG_CFLAGS=@PNG_CFLAGS@
 
 ## Define C_SWITCH_X_SITE to contain any special flags your compiler
 ## may need to deal with X Windows.  For instance, if you've defined
@@ -326,7 +325,6 @@ ALL_CFLAGS=-Demacs $(MYCPPFLAGS) -I. -I$(srcdir) \
   -I$(lib) -I$(srcdir)/../lib \
   $(C_SWITCH_MACHINE) $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \
   $(GNUSTEP_CFLAGS) $(CFLAGS_SOUND) $(RSVG_CFLAGS) $(IMAGEMAGICK_CFLAGS) \
-  $(PNG_CFLAGS) \
   $(LIBXML2_CFLAGS) $(DBUS_CFLAGS) $(XRANDR_CFLAGS) $(XINERAMA_CFLAGS) \
   $(SETTINGS_CFLAGS) $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS) \
   $(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) \
index dcbe5942b32945f0d7ec288443d9e401b62aeef2..4133aaa7621b630d054a1e580afe1c66f89dfef0 100644 (file)
@@ -22,8 +22,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <unistd.h>
 
 #ifdef HAVE_PNG
+#if defined HAVE_LIBPNG_PNG_H
+# include <libpng/png.h>
+#else
 # include <png.h>
 #endif
+#endif
 
 #include <setjmp.h>
 #include <c-ctype.h>