diff --git a/configure.ac b/configure.ac index 93d290940..ff39723a9 100644 --- a/configure.ac +++ b/configure.ac @@ -543,6 +543,22 @@ if test "x$enable_zlib" != "xno"; then fi fi +AC_ARG_ENABLE(png, +[ --disable-png disaple png support], +) +HAVE_PNG=no +PNG_LIBS="" +if test "x$enable_zlib" != "xno"; then + AC_CHECK_LIB(png, png_set_read_fn, HAVE_PNG=yes, HAVE_PNG=no, [$LIBS]) + if test "x$HAVE_PNG" = "xyes"; then + AC_CHECK_HEADER(png.h, HAVE_PNG=yes, HAVE_PNG=no) + if test "x$HAVE_PNG" = "xyes"; then + PNG_LIBS="-lpng" + AC_DEFINE(HAVE_PNG, 1, [Define if you have libpng]) + fi + fi +fi +AC_SUBST(PNG_LIBS) AC_ARG_WITH(ipv6, [ --with-ipv6=DIR enable IPv6 support. Optional argument specifies @@ -2185,7 +2201,7 @@ AC_MSG_RESULT([ Sound support :${SOUND_TYPES- no} CD Audio system :${CDTYPE- no} IPv6 networking : $NETTYPE_IPV6 - Compression support: gz=$HAVE_ZLIB ogg=$HAVE_VORBIS + Compression support: gz=$HAVE_ZLIB ogg=$HAVE_VORBIS png=$HAVE_PNG Compiler version : $CCVER Compiler flags : $CFLAGS qfcc cpp invocation: $CPP_NAME diff --git a/libs/image/Makefile.am b/libs/image/Makefile.am index 4f650e4cc..903928029 100644 --- a/libs/image/Makefile.am +++ b/libs/image/Makefile.am @@ -5,7 +5,7 @@ INCLUDES= -I$(top_srcdir)/include lib_LTLIBRARIES= libQFimage.la libQFimage_la_LDFLAGS= -version-info 1:0:0 -libQFimage_la_LIBADD= -lpng +libQFimage_la_LIBADD= $(PNG_LIBS) libQFimage_la_DEPENDENCIES= libQFimage_la_SOURCES= \ image.c pcx.c png.c tga.c diff --git a/libs/image/png.c b/libs/image/png.c index 37ef5c232..cb2d25b4e 100644 --- a/libs/image/png.c +++ b/libs/image/png.c @@ -31,6 +31,8 @@ static __attribute__ ((unused)) const char rcsid[] = "$Id$"; +#ifdef HAVE_PNG + #ifdef HAVE_STRING_H # include #endif @@ -176,3 +178,15 @@ LoadPNG (QFile *infile) return (tex); } + +#else + +#include "QF/image.h" + +tex_t * +LoadPNG (QFile *infile) +{ + return 0; +} + +#endif