aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2014-05-04 14:28:08 -0700
committerPaul Eggert2014-05-04 14:28:08 -0700
commitf8c2cef5e60d31f48c44fc883bc72d2f6090834b (patch)
treec31f7cd29921efb107390227ee727147f0c63561
parent4a05c50a46dee2a75b06a2e4e3bc7732c267d7bb (diff)
downloademacs-f8c2cef5e60d31f48c44fc883bc72d2f6090834b.tar.gz
emacs-f8c2cef5e60d31f48c44fc883bc72d2f6090834b.zip
Consult libpng-config more consistently.
This is mainly for simplicity, but it should also avoid some future problems like the ones we recently had with NetBSD. * configure.ac (LIBPNG): Configure after LIBZ. Use libpng-config for cflags, too. Append -lz if we're not already doing that with LIBZ. Do not bother appending -lm, since we always append that. Coalesce some duplicate code. * src/Makefile.in (PNG_CFLAGS): New var. (ALL_CFLAGS): Use it. * src/image.c [HAVE_PNG]: Don't worry about <libpng/png.h>, as CFLAGS now handles this. Fixes: debbugs:17339
-rw-r--r--ChangeLog8
-rw-r--r--configure.ac113
-rw-r--r--src/ChangeLog16
-rw-r--r--src/Makefile.in2
-rw-r--r--src/image.c4
5 files changed, 67 insertions, 76 deletions
diff --git a/ChangeLog b/ChangeLog
index 3d6cc362b67..d9837bc3c12 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
12014-05-04 Paul Eggert <eggert@cs.ucla.edu> 12014-05-04 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 Consult libpng-config more consistently (Bug#17339).
4 This is mainly for simplicity, but it should also avoid
5 some future problems like the ones we recently had with NetBSD.
6 * configure.ac (LIBPNG): Configure after LIBZ. Use libpng-config
7 for cflags, too. Append -lz if we're not already doing that with
8 LIBZ. Do not bother appending -lm, since we always append that.
9 Coalesce some duplicate code.
10
3 * autogen.sh: Use ‘"’ to quote a message that often contains ‘'’. 11 * autogen.sh: Use ‘"’ to quote a message that often contains ‘'’.
4 12
5 Require ImageMagick >= 6.3.5, due to PixelSetMagickColor (Bug#17339). 13 Require ImageMagick >= 6.3.5, due to PixelSetMagickColor (Bug#17339).
diff --git a/configure.ac b/configure.ac
index 47bb458a767..1381f3669dd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3014,67 +3014,6 @@ elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then
3014fi 3014fi
3015AC_SUBST(LIBJPEG) 3015AC_SUBST(LIBJPEG)
3016 3016
3017### Use -lpng if available, unless `--with-png=no'.
3018### mingw32 doesn't use -lpng, since it loads the library dynamically.
3019HAVE_PNG=no
3020LIBPNG=
3021if test "${opsys}" = "mingw32"; then
3022 if test "${with_png}" != "no"; then
3023 AC_CHECK_HEADER(png.h, HAVE_PNG=yes, HAVE_PNG=no)
3024 fi
3025 if test "${HAVE_PNG}" = "yes"; then
3026 AC_DEFINE(HAVE_PNG, 1, [Define to 1 if you have the png library (-lpng).])
3027
3028 AC_CHECK_DECL(png_longjmp,
3029 [],
3030 [AC_DEFINE(PNG_DEPSTRUCT, [],
3031 [Define to empty to suppress deprecation warnings when building
3032 with --enable-gcc-warnings and with libpng versions before 1.5,
3033 which lack png_longjmp.])],
3034 [[#ifdef HAVE_LIBPNG_PNG_H
3035 # include <libpng/png.h>
3036 #else
3037 # include <png.h>
3038 #endif
3039 ]])
3040 fi
3041elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then
3042 if test "${with_png}" != "no"; then
3043 # Debian unstable as of July 2003 has multiple libpngs, and puts png.h
3044 # in /usr/include/libpng.
3045 AC_CHECK_HEADERS(png.h libpng/png.h, break)
3046 if test "$ac_cv_header_png_h" = yes || test "$ac_cv_header_libpng_png_h" = yes ; then
3047 AC_CHECK_LIB(png, png_get_channels, HAVE_PNG=yes, , -lz -lm)
3048 fi
3049 fi
3050
3051 if test "${HAVE_PNG}" = "yes"; then
3052 AC_DEFINE(HAVE_PNG, 1, [Define to 1 if you have the png library.])
3053
3054 dnl Some systems, eg NetBSD 6, only provide eg "libpng16", not "libpng".
3055 lpng=`libpng-config --libs 2> /dev/null`
3056 case $lpng in
3057 -l*) : ;;
3058 *) lpng="-lpng" ;;
3059 esac
3060 LIBPNG="$lpng -lz -lm"
3061
3062 AC_CHECK_DECL(png_longjmp,
3063 [],
3064 [AC_DEFINE(PNG_DEPSTRUCT, [],
3065 [Define to empty to suppress deprecation warnings when building
3066 with --enable-gcc-warnings and with libpng versions before 1.5,
3067 which lack png_longjmp.])],
3068 [[#ifdef HAVE_LIBPNG_PNG_H
3069 # include <libpng/png.h>
3070 #else
3071 # include <png.h>
3072 #endif
3073 ]])
3074 fi
3075fi
3076AC_SUBST(LIBPNG)
3077
3078HAVE_ZLIB=no 3017HAVE_ZLIB=no
3079LIBZ= 3018LIBZ=
3080if test "${with_zlib}" != "no"; then 3019if test "${with_zlib}" != "no"; then
@@ -3094,6 +3033,58 @@ if test "${HAVE_ZLIB}" = "yes"; then
3094fi 3033fi
3095AC_SUBST(LIBZ) 3034AC_SUBST(LIBZ)
3096 3035
3036### Use -lpng if available, unless `--with-png=no'.
3037HAVE_PNG=no
3038LIBPNG=
3039PNG_CFLAGS=
3040if test "${with_png}" != no; then
3041 # mingw32 loads the library dynamically.
3042 if test "$opsys" = mingw32; then
3043 AC_CHECK_HEADER([png.h], [HAVE_PNG=yes])
3044 elif png_cflags=`(libpng-config --cflags) 2>&AS_MESSAGE_LOG_FD` &&
3045 png_libs=`(libpng-config --libs) 2>&AS_MESSAGE_LOG_FD`
3046 then
3047 HAVE_PNG=yes
3048 PNG_CFLAGS=`AS_ECHO(["$png_cflags"]) | sed -e "$edit_cflags"`
3049 LIBPNG=$png_libs
3050 else
3051 # libpng-config does not work; configure by hand.
3052 # Debian unstable as of July 2003 has multiple libpngs, and puts png.h
3053 # in /usr/include/libpng.
3054 AC_CHECK_HEADERS([png.h libpng/png.h],
3055 [AC_CHECK_LIB([png], [png_get_channels],
3056 [HAVE_PNG=yes
3057 LIBPNG='-lpng'
3058 if test "$ac_cv_header_png_h" != yes; then
3059 PNG_CFLAGS=-I/usr/include/libpng
3060 fi
3061 break],
3062 [], [-lz -lm])])
3063 fi
3064 # $LIBPNG requires explicit -lz in some cases.
3065 # We don't know what those cases are, exactly, so play it safe and
3066 # append -lz to any nonempty $LIBPNG, unless we're already using LIBZ.
3067 if test -n "$LIBPNG" && test -z "$LIBZ"; then
3068 LIBPNG="$LIBPNG -lz"
3069 fi
3070fi
3071if test $HAVE_PNG = yes; then
3072 AC_DEFINE([HAVE_PNG], [1], [Define to 1 if you have the png library.])
3073
3074 SAVE_CFLAGS=$CFLAGS
3075 CFLAGS="$CFLAGS $PNG_CFLAGS"
3076 AC_CHECK_DECL([png_longjmp],
3077 [],
3078 [AC_DEFINE([PNG_DEPSTRUCT], [],
3079 [Define to empty to suppress deprecation warnings when building
3080 with --enable-gcc-warnings and with libpng versions before 1.5,
3081 which lack png_longjmp.])],
3082 [[#include <png.h>
3083 ]])
3084 CFLAGS=$SAVE_CFLAGS
3085fi
3086AC_SUBST(LIBPNG)
3087AC_SUBST(PNG_CFLAGS)
3097 3088
3098### Use -ltiff if available, unless `--with-tiff=no'. 3089### Use -ltiff if available, unless `--with-tiff=no'.
3099### mingw32 doesn't use -ltiff, since it loads the library dynamically. 3090### mingw32 doesn't use -ltiff, since it loads the library dynamically.
diff --git a/src/ChangeLog b/src/ChangeLog
index e06163c32ce..01569db30e6 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,8 +1,10 @@
12014-05-04 Paul Eggert <eggert@cs.ucla.edu> 12014-05-04 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 Revert recent libpng changes (Bug#17339). 3 Consult libpng-config more consistently (Bug#17339).
4 * Makefile.in (PNG_CFLAGS): Remove; all uses removed. 4 * Makefile.in (PNG_CFLAGS): New var.
5 * image.c [HAVE_LIBPNG_PNG_H]: Include <libpng/png.h>, not <png.h>. 5 (ALL_CFLAGS): Use it.
6 * image.c [HAVE_PNG]: Don't worry about <libpng/png.h>, as
7 CFLAGS now handles this.
6 8
72014-05-03 Paul Eggert <eggert@cs.ucla.edu> 92014-05-03 Paul Eggert <eggert@cs.ucla.edu>
8 10
@@ -15,14 +17,6 @@
15 17
16 * buffer.c (overlay_strings): Fix the wording of the commentary. 18 * buffer.c (overlay_strings): Fix the wording of the commentary.
17 19
182014-05-02 Paul Eggert <eggert@cs.ucla.edu>
19
20 Consult libpng-config more consistently (Bug#17339).
21 * Makefile.in (PNG_CFLAGS): New var.
22 (ALL_CFLAGS): Use it.
23 * image.c [HAVE_PNG]: Don't worry about <libpng/png.h>, as
24 CFLAGS now handles this.
25
262014-05-01 Glenn Morris <rgm@gnu.org> 202014-05-01 Glenn Morris <rgm@gnu.org>
27 21
28 * floatfns.c (Fisnan): 22 * floatfns.c (Fisnan):
diff --git a/src/Makefile.in b/src/Makefile.in
index 388923596c9..c35e38bb290 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -77,6 +77,7 @@ C_SWITCH_MACHINE=@C_SWITCH_MACHINE@
77C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@ 77C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@
78 78
79GNUSTEP_CFLAGS=@GNUSTEP_CFLAGS@ 79GNUSTEP_CFLAGS=@GNUSTEP_CFLAGS@
80PNG_CFLAGS=@PNG_CFLAGS@
80 81
81## Define C_SWITCH_X_SITE to contain any special flags your compiler 82## Define C_SWITCH_X_SITE to contain any special flags your compiler
82## may need to deal with X Windows. For instance, if you've defined 83## may need to deal with X Windows. For instance, if you've defined
@@ -325,6 +326,7 @@ ALL_CFLAGS=-Demacs $(MYCPPFLAGS) -I. -I$(srcdir) \
325 -I$(lib) -I$(srcdir)/../lib \ 326 -I$(lib) -I$(srcdir)/../lib \
326 $(C_SWITCH_MACHINE) $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \ 327 $(C_SWITCH_MACHINE) $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \
327 $(GNUSTEP_CFLAGS) $(CFLAGS_SOUND) $(RSVG_CFLAGS) $(IMAGEMAGICK_CFLAGS) \ 328 $(GNUSTEP_CFLAGS) $(CFLAGS_SOUND) $(RSVG_CFLAGS) $(IMAGEMAGICK_CFLAGS) \
329 $(PNG_CFLAGS) \
328 $(LIBXML2_CFLAGS) $(DBUS_CFLAGS) $(XRANDR_CFLAGS) $(XINERAMA_CFLAGS) \ 330 $(LIBXML2_CFLAGS) $(DBUS_CFLAGS) $(XRANDR_CFLAGS) $(XINERAMA_CFLAGS) \
329 $(SETTINGS_CFLAGS) $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS) \ 331 $(SETTINGS_CFLAGS) $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS) \
330 $(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) \ 332 $(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) \
diff --git a/src/image.c b/src/image.c
index d558540c6e7..c26c0db2b4f 100644
--- a/src/image.c
+++ b/src/image.c
@@ -22,12 +22,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
22#include <unistd.h> 22#include <unistd.h>
23 23
24#ifdef HAVE_PNG 24#ifdef HAVE_PNG
25#if defined HAVE_LIBPNG_PNG_H
26# include <libpng/png.h>
27#else
28# include <png.h> 25# include <png.h>
29#endif 26#endif
30#endif
31 27
32#include <setjmp.h> 28#include <setjmp.h>
33#include <c-ctype.h> 29#include <c-ctype.h>