diff --git a/ChangeLog b/ChangeLog index 309e09f41..3eecf4475 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2004-05-22 Bradley Bell + * configure.ac, arch/ogl/ogl.c, misc/Makefile.am: make libpng + optional + * rpm/d2x.spec.in: Changed descriptions 2004-05-22 Matthew Mueller diff --git a/arch/ogl/ogl.c b/arch/ogl/ogl.c index edf774dbb..1ed054043 100644 --- a/arch/ogl/ogl.c +++ b/arch/ogl/ogl.c @@ -1,4 +1,4 @@ -/* $Id: ogl.c,v 1.31 2004-05-22 22:29:20 btb Exp $ */ +/* $Id: ogl.c,v 1.32 2004-05-23 00:21:03 btb Exp $ */ /* * * Graphics support functions for OpenGL. @@ -35,7 +35,9 @@ #include "palette.h" #include "rle.h" #include "mono.h" +#ifdef HAVE_LIBPNG #include "pngfile.h" +#endif #include "segment.h" #include "textures.h" @@ -1872,13 +1874,16 @@ unsigned char decodebuf[512*512]; void ogl_loadbmtexture_f(grs_bitmap *bm, int flags) { unsigned char *buf; +#ifdef HAVE_LIBPNG char *bitmapname; +#endif while (bm->bm_parent) bm=bm->bm_parent; if (bm->gltexture && bm->gltexture->handle > 0) return; buf=bm->bm_data; +#ifdef HAVE_LIBPNG if ((bitmapname = piggy_game_bitmap_name(bm))) { char filename[64]; @@ -1907,6 +1912,7 @@ void ogl_loadbmtexture_f(grs_bitmap *bm, int flags) } } } +#endif if (bm->gltexture == NULL){ ogl_init_texture(bm->gltexture = ogl_get_free_texture(), bm->bm_w, bm->bm_h, flags | ((bm->bm_flags & BM_FLAG_TRANSPARENT) ? OGL_FLAG_ALPHA : 0)); } diff --git a/configure.ac b/configure.ac index 6bee3e9e6..fadff96a4 100644 --- a/configure.ac +++ b/configure.ac @@ -204,6 +204,16 @@ else LIBS="-lSDL_image $LIBS" AC_DEFINE(SDL_IMAGE,,[Define if you have the SDL_image library])) + # Check for libpng + have_libpng=no + PKG_CHECK_MODULES(LIBPNG, libpng, + AC_DEFINE(HAVE_LIBPNG,,[Define if you have libpng]) + have_libpng=yes + LIBS="$LIBPNG_LIBS $LIBS", + AC_MSG_WARN([libpng not found. disabling png replacement texture support]) +) + AM_CONDITIONAL(USE_LIBPNG, test x$have_libpng = xyes) + # Check for OpenGL AC_ARG_WITH(opengl, [ --with-opengl Build OpenGL support ],,) diff --git a/misc/Makefile.am b/misc/Makefile.am index 4bda6d544..05c7a56a1 100644 --- a/misc/Makefile.am +++ b/misc/Makefile.am @@ -1,7 +1,7 @@ noinst_LIBRARIES = libmisc.a INCLUDES = -I $(top_srcdir)/include -if USE_OPENGL +if USE_LIBPNG PNG_SRCS = pngfile.c endif