make libpng optional

This commit is contained in:
Bradley Bell 2004-05-23 00:21:06 +00:00
parent ded6d98b13
commit 47600f2f1f
4 changed files with 21 additions and 2 deletions

View file

@ -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>

View 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));
}

View 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 ],,)

View 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