make libpng optional
authorBradley Bell <btb@icculus.org>
Sun, 23 May 2004 00:21:06 +0000 (00:21 +0000)
committerBradley Bell <btb@icculus.org>
Sun, 23 May 2004 00:21:06 +0000 (00:21 +0000)
ChangeLog
arch/ogl/ogl.c
configure.ac
misc/Makefile.am

index 309e09f..3eecf44 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2004-05-22  Bradley Bell  <btb@icculus.org>
 
+       * configure.ac, arch/ogl/ogl.c, misc/Makefile.am: make libpng
+       optional
+
        * rpm/d2x.spec.in: Changed descriptions
 
 2004-05-22  Matthew Mueller  <donut@dakotacom.net>
index edf774d..1ed0540 100644 (file)
@@ -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));
        }
index 6bee3e9..fadff96 100644 (file)
@@ -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 ],,)
index 4bda6d5..05c7a56 100644 (file)
@@ -1,7 +1,7 @@
 noinst_LIBRARIES = libmisc.a
 INCLUDES = -I $(top_srcdir)/include
 
-if USE_OPENGL
+if USE_LIBPNG
 PNG_SRCS = pngfile.c
 endif