emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r117120: Port recent libpng changes to hosts with mi


From: Paul Eggert
Subject: [Emacs-diffs] trunk r117120: Port recent libpng changes to hosts with missing png.h.
Date: Sun, 18 May 2014 05:50:23 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117120
revision-id: address@hidden
parent: address@hidden
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sat 2014-05-17 22:50:17 -0700
message:
  Port recent libpng changes to hosts with missing png.h.
  
  * configure.ac (HAVE_PNG): Port to platforms where libpng-config
  succeeds but png.h is absent, by testing libpng-config's output
  rather than trusting it.  I ran into this problem when building
  Emacs trunk on a Solaris 10 host.
modified:
  ChangeLog                      changelog-20091113204419-o5vbwnq5f7feedwu-1538
  configure.ac                   
configure.in-20091113204419-o5vbwnq5f7feedwu-783
=== modified file 'ChangeLog'
--- a/ChangeLog 2014-05-17 08:11:31 +0000
+++ b/ChangeLog 2014-05-18 05:50:17 +0000
@@ -1,3 +1,11 @@
+2014-05-18  Paul Eggert  <address@hidden>
+
+       Port recent libpng changes to hosts with missing png.h.
+       * configure.ac (HAVE_PNG): Port to platforms where libpng-config
+       succeeds but png.h is absent, by testing libpng-config's output
+       rather than trusting it.  I ran into this problem when building
+       Emacs trunk on a Solaris 10 host.
+
 2014-05-17  Paul Eggert  <address@hidden>
 
        Assume C99 or later (Bug#17487).

=== modified file 'configure.ac'
--- a/configure.ac      2014-05-17 08:11:31 +0000
+++ b/configure.ac      2014-05-18 05:50:17 +0000
@@ -3064,31 +3064,40 @@
   # mingw32 loads the library dynamically.
   if test "$opsys" = mingw32; then
     AC_CHECK_HEADER([png.h], [HAVE_PNG=yes])
-  elif 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
-    # 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.
-    AC_CHECK_HEADERS([png.h libpng/png.h],
-      [AC_CHECK_LIB([png], [png_get_channels],
-        [HAVE_PNG=yes
-         LIBPNG='-lpng'
-         if test "$ac_cv_header_png_h" != yes; then
-           PNG_CFLAGS=-I/usr/include/libpng
-         fi
-         break],
-         [], [-lz -lm])])
-  fi
-  # $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.
-  if test -n "$LIBPNG" && test -z "$LIBZ"; then
-    LIBPNG="$LIBPNG -lz"
+    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` || {
+      # 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.
+      if test -r /usr/include/libpng/png.h &&
+        test ! -r /usr/include/png.h; then
+       png_cflags=-I/usr/include/libpng
+      else
+       png_cflags=
+      fi
+      png_libs='-lpng'
+    }
+    SAVE_CFLAGS=$CFLAGS
+    SAVE_LIBS=$LIBS
+    CFLAGS="$CFLAGS $png_cflags"
+    LIBS="$png_libs -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 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.
+       if test -n "$LIBPNG" && test -z "$LIBZ"; then
+        LIBPNG="$LIBPNG -lz"
+       fi])
+    CFLAGS=$SAVE_CFLAGS
+    LIBS=$SAVE_LIBS
+    AC_MSG_RESULT([$HAVE_PNG])
   fi
 fi
 if test $HAVE_PNG = yes; then


reply via email to

[Prev in Thread] Current Thread [Next in Thread]