Makefile.am | 12 +++++++++--- configure.ac | 3 ++- pngconf.h | 26 ++++++++++++++++++++++++-- scripts/libpng-config.in | 10 +++++----- 4 files changed, 40 insertions(+), 11 deletions(-) diff --git a/Makefile.am b/Makefile.am index 892521b..02fbc59 100644 --- a/Makefile.am +++ b/Makefile.am @@ -49,8 +49,8 @@ libpng_la_LDFLAGS = -rpath '$(libdir)' -no-undefined -export-dynamic \ if HAVE_LD_VERSION_SCRIPT # Versioned symbols and restricted exports - libpng12_la_LDFLAGS += -Wl,--version-script=libpng.vers - libpng12_la_DEPENDENCIES = libpng.vers + libpng12_la_LDFLAGS += -Wl,--version-script=libpng.vers -Wl,libpng.lds + libpng12_la_DEPENDENCIES = libpng.vers libpng.lds else # Only restricted exports when possible libpng12_la_LDFLAGS += -export-symbols libpng.sym @@ -114,9 +114,15 @@ libpng.sym: png.h pngconf.h libpng.vers: libpng.sym rm -f $@ $@.new - echo PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0 '{global:' > $@.new + echo PNG_@PNGLIB_MAJOR@@PNGLIB_MINOR@ '{global:' > $@.new $(SED) s/$$/\;/ libpng.sym >> $@.new echo 'local: *; };' >> $@.new + echo 'PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0 {} PNG_@PNGLIB_MAJOR@@PNGLIB_MINOR@;' >> $@.new + mv $@.new $@ + +libpng.lds: libpng.sym + rm -f $@ $@.new + $(SED) 's/^.*$$/"&@PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0" = &;/' libpng.sym >> $@.new mv $@.new $@ test: check diff --git a/configure.ac b/configure.ac index 8dc8e1f..de9cc8a 100644 --- a/configure.ac +++ b/configure.ac @@ -68,7 +68,8 @@ esac AC_MSG_CHECKING( [if assembler code in pnggccrd.c can be compiled without PNG_NO_MMX_CODE]) AC_TRY_COMPILE( - [#include "$srcdir/pnggccrd.c"], + [#define PNG_CONFIGURE_LIBPNG + #include "$srcdir/pnggccrd.c"], [return 0;], AC_MSG_RESULT(yes) LIBPNG_NO_MMX="", diff --git a/pngconf.h b/pngconf.h index 3ae7a28..c65517d 100644 --- a/pngconf.h +++ b/pngconf.h @@ -38,6 +38,25 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif +#else +/* pngconf.h is part of the exported API. When a libpng-using application + includes us, PNG_CONFIGURE_LIBPNG is of course not defined as we do not have + libpng's config.h available in this case. This means that we do not have the + defines added to config.h and the commandline by libpng's ./configure . + + For all defines from config.h not having them set is not a problem, however + ./configure also adds -DPNG_NO_ASSEMBLER_CODE to the CFLAGS when compiling + on a platform on which the MMX and SSE asm code in libpng is not supported. + + We do need this define as this define is used to determine whether or not + to define PNG_ASSEMBLER_CODE_SUPPORTED and other assembler related defines + and prototypes. PNG_ASSEMBLER_CODE_SUPPORTED in turn is used by applications + (ImageMagick for example) to determine whether or not they can use the asm + functions. Thus we need to define PNG_NO_ASSEMBLER_CODE here on platforms + on which the MMX and SSE asm code in libpng is not supported: */ +#ifndef __i386__ /* change this if MMX/SSE become supported on x86_64! */ +#define PNG_NO_ASSEMBLER_CODE +#endif #endif /* @@ -377,8 +396,11 @@ # undef _BSD_SOURCE # endif # ifdef _SETJMP_H - /* If you encounter a compiler error here, see the explanation - * near the end of INSTALL. + /* If you encounter a compiler error here, this means you have + * compiled another module that includes setjmp.h, which is + * hazardous because the two modules might not include exactly + * the same setjmp.h. Use the cexcept interface instead, as + * demonstrated in contrib/visupng of the libpng distribution. */ __pngconf.h__ in libpng already includes setjmp.h; __dont__ include it again.; diff --git a/scripts/libpng-config.in b/scripts/libpng-config.in index 7ae7d50..1c7eda3 100755 --- a/scripts/libpng-config.in +++ b/scripts/libpng-config.in @@ -11,11 +11,11 @@ # Modeled after libxml-config. -version="@PNGLIB_VERSION@" -prefix="@prefix@" -exec_prefix="@exec_prefix@" -libdir="@libdir@" -includedir="@includedir@/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@" +version=`pkg-config --modversion libpng` +prefix=`pkg-config --variable prefix libpng` +exec_prefix=`pkg-config --variable exec_prefix libpng` +libdir=`pkg-config --variable libdir libpng` +includedir=`pkg-config --variable includedir libpng` libs="-lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@" all_libs="-lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ @LIBS@" I_opts="-I${includedir}"