Skip to content

Commit

Permalink
Date: Wed, 26 Apr 2006 17:02:52 +0200
Browse files Browse the repository at this point in the history
From: Julien Lecomte
Subject: Re: [SDL] SDL_image & libtiff

On 26/04/2006 13:43, I wrote:
> When configuring SDL_image with libtiff, libtiff wasn't found in my ca
se.
> I solved the problem by adding: 'LIBS="$LIBS $IMG_LIBS"' after line 16
3
> of configure.in ('if test x$enable_tif = xyes; then').
> I guess the problem is that my libtiff is a static lib, I didn't bothe
r
> to create the shared one, and that libtiff depends on libjpeg and libz
.
>
> I also guess that other static libraries (like possibly libpng) might
> share (sic) this problem.
>
> If I have a time, I'll review the configure.in and post a patch (don't

> use my solution above, it's ugly !)
>

Attached is a patch that modifies configure.in and makefile.am for
SDL_image.
*Changes are:*

- Checks for dependency libs before checking for other libraries (z is
checked before png, z and jpeg are checked before tiff) which was the
fix I was targetting (at the start)
  • Loading branch information
slouken committed May 1, 2006
1 parent d03ce67 commit 994b4b0
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 89 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Expand Up @@ -37,7 +37,7 @@ libSDL_image_la_LDFLAGS = \
-no-undefined \
-release $(LT_RELEASE) \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
libSDL_image_la_LIBADD = @IMG_LIBS@
libSDL_image_la_LIBADD = $(IMG_LIBS)

noinst_PROGRAMS = showimage

Expand Down
175 changes: 87 additions & 88 deletions configure.in
Expand Up @@ -41,7 +41,6 @@ AC_CANONICAL_HOST

dnl Setup for automake
AM_INIT_AUTOMAKE(SDL_image, $VERSION)
AM_MAINTAINER_MODE

dnl Check for tools

Expand Down Expand Up @@ -77,120 +76,120 @@ dnl Check for SDL
SDL_VERSION=1.2.4
AM_PATH_SDL($SDL_VERSION,
:,
AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
)
CFLAGS="$CFLAGS $SDL_CFLAGS"
LIBS="$LIBS $SDL_LIBS"
saved_LIBS="$LIBS"

dnl Check command-line options
AC_ARG_ENABLE(bmp,
[ --enable-bmp support loading BMP images [default=yes]],
, enable_bmp=yes)
if test x$enable_bmp = xyes; then
CFLAGS="$CFLAGS -DLOAD_BMP"
fi
AC_ARG_ENABLE(gif,
[ --enable-gif support loading GIF images [default=yes]],
, enable_gif=yes)
if test x$enable_gif = xyes; then
CFLAGS="$CFLAGS -DLOAD_GIF"
AC_ARG_ENABLE([bmp], [AC_HELP_STRING([--enable-bmp], [support loading BMP images [default=yes]])],
[], [enable_bmp=yes])
AC_ARG_ENABLE([gif], [AC_HELP_STRING([--enable-gif], [support loading GIF images [default=yes]])],
[], [enable_gif=yes])
AC_ARG_ENABLE([jpg], [AC_HELP_STRING([--enable-jpg], [support loading JPG images [default=yes]])],
[], [enable_jpg=yes])
AC_ARG_ENABLE([lbm], [AC_HELP_STRING([--enable-lbm], [support loading LBM images [default=yes]])],
[], [enable_lbm=yes])
AC_ARG_ENABLE([pcx], [AC_HELP_STRING([--enable-pcx], [support loading PCX images [default=yes]])],
[], [enable_pcx=yes])
AC_ARG_ENABLE([png], [AC_HELP_STRING([--enable-bmp], [support loading PNG images [default=yes]])],
[], [enable_png=yes])
AC_ARG_ENABLE([pnm], [AC_HELP_STRING([--enable-pnm], [support loading PNM images [default=yes]])],
[], [enable_pnm=yes])
AC_ARG_ENABLE([tga], [AC_HELP_STRING([--enable-tga], [support loading TGA images [default=yes]])],
[], [enable_tga=yes])
AC_ARG_ENABLE([tif], [AC_HELP_STRING([--enable-tif], [support loading TIFF images [default=no]])],
[], [enable_tif=no])
AC_ARG_ENABLE([xcf], [AC_HELP_STRING([--enable-xcf], [support loading XCF images [default=yes]])],
[], [enable_xcf=yes])
AC_ARG_ENABLE([xpm], [AC_HELP_STRING([--enable-xpm], [support loading XPM images [default=yes]])],
[], [enable_xpm=yes])
AC_ARG_ENABLE([xv], [AC_HELP_STRING([--enable-xv], [support loading XV images [default=yes]])],
[], [enable_xv=yes])

if test x$enable_png = xyes || x$enable_tif = xyes; then
AC_CHECK_LIB([z], [uncompress], [
LIBS="-lz $LIBS"
IMG_LIBS="-lz $IMG_LIBS"
])
fi
AC_ARG_ENABLE(jpg,
[ --enable-jpg support loading JPG images [default=yes]],
, enable_jpg=yes)
if test x$enable_jpg = xyes; then
AC_CHECK_LIB(jpeg, jpeg_CreateDecompress, have_libjpeg=yes)

if test x$enable_jpg = xyes || x$enable_tif = xyes; then
AC_CHECK_LIB([jpeg], [jpeg_CreateDecompress], [have_libjpeg=yes])
if test x$have_libjpeg = xyes; then
CFLAGS="$CFLAGS -DLOAD_JPG"
IMG_LIBS="$IMG_LIBS -ljpeg"
else
AC_MSG_WARN([
*** Unable to find JPEG library (http://www.ijg.org/)
])
if test x$enable_jpg = xyes; then
AC_DEFINE(LOAD_JPG)
fi
LIBS="-ljpeg $LIBS"
IMG_LIBS="-ljpeg $IMG_LIBS"
elif test x$enable_jpg = xyes; then
AC_MSG_WARN([*** Unable to find JPEG library (http://www.ijg.org/)])
AC_MSG_WARN([JPG image loading disabled])
fi
fi
AC_ARG_ENABLE(lbm,
[ --enable-lbm support loading LBM images [default=yes]],
, enable_lbm=yes)
if test x$enable_lbm = xyes; then
CFLAGS="$CFLAGS -DLOAD_LBM"
fi
AC_ARG_ENABLE(pcx,
[ --enable-pcx support loading PCX images [default=yes]],
, enable_pcx=yes)
if test x$enable_pcx = xyes; then
CFLAGS="$CFLAGS -DLOAD_PCX"
fi
AC_ARG_ENABLE(png,
[ --enable-png support loading PNG images [default=yes]],
, enable_png=yes)

if test x$enable_png = xyes; then
AC_CHECK_LIB(png, png_create_read_struct, have_libpng=yes, , -lz)
if test x$have_libpng != xyes; then
AC_MSG_WARN([
*** Unable to find PNG library (http://www.libpng.org/pub/png/libpng.html)
])
fi
AC_CHECK_LIB(z, uncompress, have_libz=yes)
if test x$have_libz != xyes; then
AC_MSG_WARN([
*** Unable to find Zlib library (http://www.gzip.org/zlib/)
])
fi
if test x$have_libpng = xyes -a x$have_libz = xyes; then
CFLAGS="$CFLAGS -DLOAD_PNG"
IMG_LIBS="$IMG_LIBS -lpng -lz"
AC_CHECK_LIB([png], [png_create_read_struct], [have_libpng=yes])
if test x$have_libpng = xyes; then
AC_DEFINE([LOAD_PNG])
IMG_LIBS="-lpng $IMG_LIBS"
else
AC_MSG_WARN([*** Unable to find PNG library (http://www.libpng.org/pub/png/libpng.html)])
AC_MSG_WARN([PNG image loading disabled])
fi
fi
AC_ARG_ENABLE(pnm,
[ --enable-pnm support loading PNM images [default=yes]],
, enable_pnm=yes)
if test x$enable_pnm = xyes; then
CFLAGS="$CFLAGS -DLOAD_PNM"
fi
AC_ARG_ENABLE(tga,
[ --enable-tga support loading TGA images [default=yes]],
, enable_tga=yes)
if test x$enable_tga = xyes; then
CFLAGS="$CFLAGS -DLOAD_TGA"
fi
AC_ARG_ENABLE(tif,
[ --enable-tif support loading TIFF images [default=no]],
, enable_tif=no)

if test x$enable_tif = xyes; then
AC_CHECK_LIB(tiff, TIFFClientOpen, have_libtiff=yes)
AC_CHECK_LIB([tiff], [TIFFClientOpen], [have_libtiff=yes])
if test x$have_libtiff = xyes; then
CFLAGS="$CFLAGS -DLOAD_TIF"
IMG_LIBS="$IMG_LIBS -ltiff"
AC_DEFINE([LOAD_TIF])
IMG_LIBS="-ltiff $IMG_LIBS"
else
AC_MSG_WARN([
*** Unable to find Tiff library (ftp://ftp.sgi.com/graphics/tiff/)
])
AC_MSG_WARN([*** Unable to find Tiff library (ftp://ftp.sgi.com/graphics/tiff/)])
AC_MSG_WARN([TIF image loading disabled])
fi
fi
AC_ARG_ENABLE(xcf,
[ --enable-xcf support loading XCF images [default=yes]],
, enable_xcf=yes)

if test x$enable_bmp = xyes; then
AC_DEFINE([LOAD_BMP])
fi

if test x$enable_gif = xyes; then
AC_DEFINE([LOAD_GIF])
fi

if test x$enable_lbm = xyes; then
AC_DEFINE([LOAD_LBM])
fi

if test x$enable_pcx = xyes; then
AC_DEFINE([LOAD_PCX])
fi

if test x$enable_pnm = xyes; then
AC_DEFINE([LOAD_PNM])
fi

if test x$enable_tga = xyes; then
AC_DEFINE([LOAD_TGA])
fi

if test x$enable_xcf = xyes; then
CFLAGS="$CFLAGS -DLOAD_XCF"
AC_DEFINE([LOAD_XCF])
fi
AC_ARG_ENABLE(xpm,
[ --enable-xpm support loading XPM images [default=yes]],
, enable_xpm=yes)

if test x$enable_xpm = xyes; then
CFLAGS="$CFLAGS -DLOAD_XPM"
AC_DEFINE([LOAD_XPM])
fi
AC_ARG_ENABLE(xv,
[ --enable-xv support loading XV thumbnail images [default=yes]],
, enable_xv=yes)

if test x$enable_xv = xyes; then
CFLAGS="$CFLAGS -DLOAD_XV"
AC_DEFINE([LOAD_XV])
fi
AC_SUBST(IMG_LIBS)

LIBS="$saved_LIBS"

AC_SUBST([IMG_LIBS])

# Finally create all the generated files
AC_OUTPUT([
Expand Down

0 comments on commit 994b4b0

Please sign in to comment.