diff options
| author | Paul Eggert | 2014-05-17 22:50:17 -0700 |
|---|---|---|
| committer | Paul Eggert | 2014-05-17 22:50:17 -0700 |
| commit | 0d1b87f90e06199963af1704a07f950c0184c0bd (patch) | |
| tree | ec5f78d51080d5d7c27d57f3416987bd88b171ca | |
| parent | 8208d2bf95f924ed810dc06e84fc4c7d5ac004a5 (diff) | |
| download | emacs-0d1b87f90e06199963af1704a07f950c0184c0bd.tar.gz emacs-0d1b87f90e06199963af1704a07f950c0184c0bd.zip | |
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.
| -rw-r--r-- | ChangeLog | 8 | ||||
| -rw-r--r-- | configure.ac | 57 |
2 files changed, 41 insertions, 24 deletions
| @@ -1,3 +1,11 @@ | |||
| 1 | 2014-05-18 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Port recent libpng changes to hosts with missing png.h. | ||
| 4 | * configure.ac (HAVE_PNG): Port to platforms where libpng-config | ||
| 5 | succeeds but png.h is absent, by testing libpng-config's output | ||
| 6 | rather than trusting it. I ran into this problem when building | ||
| 7 | Emacs trunk on a Solaris 10 host. | ||
| 8 | |||
| 1 | 2014-05-17 Paul Eggert <eggert@cs.ucla.edu> | 9 | 2014-05-17 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 10 | ||
| 3 | Assume C99 or later (Bug#17487). | 11 | Assume C99 or later (Bug#17487). |
diff --git a/configure.ac b/configure.ac index 0119685394b..09500be9935 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -3064,31 +3064,40 @@ elif test "${with_png}" != no; then | |||
| 3064 | # mingw32 loads the library dynamically. | 3064 | # mingw32 loads the library dynamically. |
| 3065 | if test "$opsys" = mingw32; then | 3065 | if test "$opsys" = mingw32; then |
| 3066 | AC_CHECK_HEADER([png.h], [HAVE_PNG=yes]) | 3066 | AC_CHECK_HEADER([png.h], [HAVE_PNG=yes]) |
| 3067 | elif png_cflags=`(libpng-config --cflags) 2>&AS_MESSAGE_LOG_FD` && | ||
| 3068 | png_libs=`(libpng-config --libs) 2>&AS_MESSAGE_LOG_FD` | ||
| 3069 | then | ||
| 3070 | HAVE_PNG=yes | ||
| 3071 | PNG_CFLAGS=`AS_ECHO(["$png_cflags"]) | sed -e "$edit_cflags"` | ||
| 3072 | LIBPNG=$png_libs | ||
| 3073 | else | 3067 | else |
| 3074 | # libpng-config does not work; configure by hand. | 3068 | AC_MSG_CHECKING([for png]) |
| 3075 | # Debian unstable as of July 2003 has multiple libpngs, and puts png.h | 3069 | png_cflags=`(libpng-config --cflags) 2>&AS_MESSAGE_LOG_FD` && |
| 3076 | # in /usr/include/libpng. | 3070 | png_libs=`(libpng-config --libs) 2>&AS_MESSAGE_LOG_FD` || { |
| 3077 | AC_CHECK_HEADERS([png.h libpng/png.h], | 3071 | # libpng-config does not work; configure by hand. |
| 3078 | [AC_CHECK_LIB([png], [png_get_channels], | 3072 | # Debian unstable as of July 2003 has multiple libpngs, and puts png.h |
| 3079 | [HAVE_PNG=yes | 3073 | # in /usr/include/libpng. |
| 3080 | LIBPNG='-lpng' | 3074 | if test -r /usr/include/libpng/png.h && |
| 3081 | if test "$ac_cv_header_png_h" != yes; then | 3075 | test ! -r /usr/include/png.h; then |
| 3082 | PNG_CFLAGS=-I/usr/include/libpng | 3076 | png_cflags=-I/usr/include/libpng |
| 3083 | fi | 3077 | else |
| 3084 | break], | 3078 | png_cflags= |
| 3085 | [], [-lz -lm])]) | 3079 | fi |
| 3086 | fi | 3080 | png_libs='-lpng' |
| 3087 | # $LIBPNG requires explicit -lz in some cases. | 3081 | } |
| 3088 | # We don't know what those cases are, exactly, so play it safe and | 3082 | SAVE_CFLAGS=$CFLAGS |
| 3089 | # append -lz to any nonempty $LIBPNG, unless we're already using LIBZ. | 3083 | SAVE_LIBS=$LIBS |
| 3090 | if test -n "$LIBPNG" && test -z "$LIBZ"; then | 3084 | CFLAGS="$CFLAGS $png_cflags" |
| 3091 | LIBPNG="$LIBPNG -lz" | 3085 | LIBS="$png_libs -lz -lm $LIBS" |
| 3086 | AC_LINK_IFELSE( | ||
| 3087 | [AC_LANG_PROGRAM([[#include <png.h>]], | ||
| 3088 | [[return !png_get_channels (0, 0);]])], | ||
| 3089 | [HAVE_PNG=yes | ||
| 3090 | PNG_CFLAGS=`AS_ECHO(["$png_cflags"]) | sed -e "$edit_cflags"` | ||
| 3091 | LIBPNG=$png_libs | ||
| 3092 | # $LIBPNG requires explicit -lz in some cases. | ||
| 3093 | # We don't know what those cases are, exactly, so play it safe and | ||
| 3094 | # append -lz to any nonempty $LIBPNG, unless we're already using LIBZ. | ||
| 3095 | if test -n "$LIBPNG" && test -z "$LIBZ"; then | ||
| 3096 | LIBPNG="$LIBPNG -lz" | ||
| 3097 | fi]) | ||
| 3098 | CFLAGS=$SAVE_CFLAGS | ||
| 3099 | LIBS=$SAVE_LIBS | ||
| 3100 | AC_MSG_RESULT([$HAVE_PNG]) | ||
| 3092 | fi | 3101 | fi |
| 3093 | fi | 3102 | fi |
| 3094 | if test $HAVE_PNG = yes; then | 3103 | if test $HAVE_PNG = yes; then |