Date: Wed, 26 Apr 2006 17:02:52 +0200
authorSam Lantinga <slouken@libsdl.org>
Mon, 01 May 2006 09:09:45 +0000
changeset 137b42b657ab1ac
parent 136 35d4f2737971
child 138 f7dbbbee889b
Date: Wed, 26 Apr 2006 17:02:52 +0200
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)
Makefile.am
configure.in
     1.1 --- a/Makefile.am	Mon May 01 08:00:49 2006 +0000
     1.2 +++ b/Makefile.am	Mon May 01 09:09:45 2006 +0000
     1.3 @@ -37,7 +37,7 @@
     1.4  	-no-undefined		\
     1.5  	-release $(LT_RELEASE)	\
     1.6  	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
     1.7 -libSDL_image_la_LIBADD = @IMG_LIBS@
     1.8 +libSDL_image_la_LIBADD = $(IMG_LIBS)
     1.9  
    1.10  noinst_PROGRAMS = showimage
    1.11  
     2.1 --- a/configure.in	Mon May 01 08:00:49 2006 +0000
     2.2 +++ b/configure.in	Mon May 01 09:09:45 2006 +0000
     2.3 @@ -41,7 +41,6 @@
     2.4  
     2.5  dnl Setup for automake
     2.6  AM_INIT_AUTOMAKE(SDL_image, $VERSION)
     2.7 -AM_MAINTAINER_MODE
     2.8  
     2.9  dnl Check for tools
    2.10  
    2.11 @@ -77,120 +76,120 @@
    2.12  SDL_VERSION=1.2.4
    2.13  AM_PATH_SDL($SDL_VERSION,
    2.14              :,
    2.15 -	    AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
    2.16 +           AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
    2.17  )
    2.18  CFLAGS="$CFLAGS $SDL_CFLAGS"
    2.19  LIBS="$LIBS $SDL_LIBS"
    2.20 +saved_LIBS="$LIBS"
    2.21  
    2.22  dnl Check command-line options
    2.23 -AC_ARG_ENABLE(bmp,
    2.24 -[  --enable-bmp            support loading BMP images [default=yes]],
    2.25 -              , enable_bmp=yes)
    2.26 -if test x$enable_bmp = xyes; then
    2.27 -    CFLAGS="$CFLAGS -DLOAD_BMP"
    2.28 +AC_ARG_ENABLE([bmp], [AC_HELP_STRING([--enable-bmp], [support loading BMP images [default=yes]])],
    2.29 + [], [enable_bmp=yes])
    2.30 +AC_ARG_ENABLE([gif], [AC_HELP_STRING([--enable-gif], [support loading GIF images [default=yes]])],
    2.31 + [], [enable_gif=yes])
    2.32 +AC_ARG_ENABLE([jpg], [AC_HELP_STRING([--enable-jpg], [support loading JPG images [default=yes]])],
    2.33 + [], [enable_jpg=yes])
    2.34 +AC_ARG_ENABLE([lbm], [AC_HELP_STRING([--enable-lbm], [support loading LBM images [default=yes]])],
    2.35 + [], [enable_lbm=yes])
    2.36 +AC_ARG_ENABLE([pcx], [AC_HELP_STRING([--enable-pcx], [support loading PCX images [default=yes]])],
    2.37 + [], [enable_pcx=yes])
    2.38 +AC_ARG_ENABLE([png], [AC_HELP_STRING([--enable-bmp], [support loading PNG images [default=yes]])],
    2.39 + [], [enable_png=yes])
    2.40 +AC_ARG_ENABLE([pnm], [AC_HELP_STRING([--enable-pnm], [support loading PNM images [default=yes]])],
    2.41 + [], [enable_pnm=yes])
    2.42 +AC_ARG_ENABLE([tga], [AC_HELP_STRING([--enable-tga], [support loading TGA images [default=yes]])],
    2.43 + [], [enable_tga=yes])
    2.44 +AC_ARG_ENABLE([tif], [AC_HELP_STRING([--enable-tif], [support loading TIFF images [default=no]])],
    2.45 + [], [enable_tif=no])
    2.46 +AC_ARG_ENABLE([xcf], [AC_HELP_STRING([--enable-xcf], [support loading XCF images [default=yes]])],
    2.47 + [], [enable_xcf=yes])
    2.48 +AC_ARG_ENABLE([xpm], [AC_HELP_STRING([--enable-xpm], [support loading XPM images [default=yes]])],
    2.49 + [], [enable_xpm=yes])
    2.50 +AC_ARG_ENABLE([xv], [AC_HELP_STRING([--enable-xv], [support loading XV images [default=yes]])],
    2.51 + [], [enable_xv=yes])
    2.52 +
    2.53 +if test x$enable_png = xyes || x$enable_tif = xyes; then
    2.54 +    AC_CHECK_LIB([z], [uncompress], [
    2.55 +        LIBS="-lz $LIBS"
    2.56 +        IMG_LIBS="-lz $IMG_LIBS"
    2.57 +    ])
    2.58  fi
    2.59 -AC_ARG_ENABLE(gif,
    2.60 -[  --enable-gif            support loading GIF images [default=yes]],
    2.61 -              , enable_gif=yes)
    2.62 -if test x$enable_gif = xyes; then
    2.63 -    CFLAGS="$CFLAGS -DLOAD_GIF"
    2.64 -fi
    2.65 -AC_ARG_ENABLE(jpg,
    2.66 -[  --enable-jpg            support loading JPG images [default=yes]],
    2.67 -              , enable_jpg=yes)
    2.68 -if test x$enable_jpg = xyes; then
    2.69 -    AC_CHECK_LIB(jpeg, jpeg_CreateDecompress, have_libjpeg=yes)
    2.70 +
    2.71 +if test x$enable_jpg = xyes || x$enable_tif = xyes; then
    2.72 +    AC_CHECK_LIB([jpeg], [jpeg_CreateDecompress], [have_libjpeg=yes])
    2.73      if test x$have_libjpeg = xyes; then
    2.74 -        CFLAGS="$CFLAGS -DLOAD_JPG"
    2.75 -        IMG_LIBS="$IMG_LIBS -ljpeg"
    2.76 -    else
    2.77 -        AC_MSG_WARN([
    2.78 -*** Unable to find JPEG library (http://www.ijg.org/)
    2.79 -])
    2.80 +        if test x$enable_jpg = xyes; then
    2.81 +            AC_DEFINE(LOAD_JPG)
    2.82 +        fi
    2.83 +        LIBS="-ljpeg $LIBS"
    2.84 +        IMG_LIBS="-ljpeg $IMG_LIBS"
    2.85 +    elif test x$enable_jpg = xyes; then
    2.86 +        AC_MSG_WARN([*** Unable to find JPEG library (http://www.ijg.org/)])
    2.87          AC_MSG_WARN([JPG image loading disabled])
    2.88      fi
    2.89  fi
    2.90 -AC_ARG_ENABLE(lbm,
    2.91 -[  --enable-lbm            support loading LBM images [default=yes]],
    2.92 -              , enable_lbm=yes)
    2.93 -if test x$enable_lbm = xyes; then
    2.94 -    CFLAGS="$CFLAGS -DLOAD_LBM"
    2.95 -fi
    2.96 -AC_ARG_ENABLE(pcx,
    2.97 -[  --enable-pcx            support loading PCX images [default=yes]],
    2.98 -              , enable_pcx=yes)
    2.99 -if test x$enable_pcx = xyes; then
   2.100 -    CFLAGS="$CFLAGS -DLOAD_PCX"
   2.101 -fi
   2.102 -AC_ARG_ENABLE(png,
   2.103 -[  --enable-png            support loading PNG images [default=yes]],
   2.104 -              , enable_png=yes)
   2.105 +
   2.106  if test x$enable_png = xyes; then
   2.107 -    AC_CHECK_LIB(png, png_create_read_struct, have_libpng=yes, , -lz)
   2.108 -    if test x$have_libpng != xyes; then
   2.109 -        AC_MSG_WARN([
   2.110 -*** Unable to find PNG library (http://www.libpng.org/pub/png/libpng.html)
   2.111 -])
   2.112 -    fi
   2.113 -    AC_CHECK_LIB(z, uncompress, have_libz=yes)
   2.114 -    if test x$have_libz != xyes; then
   2.115 -        AC_MSG_WARN([
   2.116 -*** Unable to find Zlib library (http://www.gzip.org/zlib/)
   2.117 -])
   2.118 -    fi
   2.119 -    if test x$have_libpng = xyes -a x$have_libz = xyes; then
   2.120 -        CFLAGS="$CFLAGS -DLOAD_PNG"
   2.121 -        IMG_LIBS="$IMG_LIBS -lpng -lz"
   2.122 +    AC_CHECK_LIB([png], [png_create_read_struct], [have_libpng=yes])
   2.123 +    if test x$have_libpng = xyes; then
   2.124 +        AC_DEFINE([LOAD_PNG])
   2.125 +        IMG_LIBS="-lpng $IMG_LIBS"
   2.126      else
   2.127 +        AC_MSG_WARN([*** Unable to find PNG library (http://www.libpng.org/pub/png/libpng.html)])
   2.128          AC_MSG_WARN([PNG image loading disabled])
   2.129      fi
   2.130  fi
   2.131 -AC_ARG_ENABLE(pnm,
   2.132 -[  --enable-pnm            support loading PNM images [default=yes]],
   2.133 -              , enable_pnm=yes)
   2.134 -if test x$enable_pnm = xyes; then
   2.135 -    CFLAGS="$CFLAGS -DLOAD_PNM"
   2.136 -fi
   2.137 -AC_ARG_ENABLE(tga,
   2.138 -[  --enable-tga            support loading TGA images [default=yes]],
   2.139 -              , enable_tga=yes)
   2.140 -if test x$enable_tga = xyes; then
   2.141 -    CFLAGS="$CFLAGS -DLOAD_TGA"
   2.142 -fi
   2.143 -AC_ARG_ENABLE(tif,
   2.144 -[  --enable-tif            support loading TIFF images [default=no]],
   2.145 -              , enable_tif=no)
   2.146 +
   2.147  if test x$enable_tif = xyes; then
   2.148 -    AC_CHECK_LIB(tiff, TIFFClientOpen, have_libtiff=yes)
   2.149 +    AC_CHECK_LIB([tiff], [TIFFClientOpen], [have_libtiff=yes])
   2.150      if test x$have_libtiff = xyes; then
   2.151 -        CFLAGS="$CFLAGS -DLOAD_TIF"
   2.152 -        IMG_LIBS="$IMG_LIBS -ltiff"
   2.153 +        AC_DEFINE([LOAD_TIF])
   2.154 +        IMG_LIBS="-ltiff $IMG_LIBS"
   2.155      else
   2.156 -        AC_MSG_WARN([
   2.157 -*** Unable to find Tiff library (ftp://ftp.sgi.com/graphics/tiff/)
   2.158 -])
   2.159 +        AC_MSG_WARN([*** Unable to find Tiff library (ftp://ftp.sgi.com/graphics/tiff/)])
   2.160          AC_MSG_WARN([TIF image loading disabled])
   2.161      fi
   2.162  fi
   2.163 -AC_ARG_ENABLE(xcf,
   2.164 -[  --enable-xcf            support loading XCF images [default=yes]],
   2.165 -              , enable_xcf=yes)
   2.166 +
   2.167 +if test x$enable_bmp = xyes; then
   2.168 +    AC_DEFINE([LOAD_BMP])
   2.169 +fi
   2.170 +
   2.171 +if test x$enable_gif = xyes; then
   2.172 +    AC_DEFINE([LOAD_GIF])
   2.173 +fi
   2.174 +
   2.175 +if test x$enable_lbm = xyes; then
   2.176 +    AC_DEFINE([LOAD_LBM])
   2.177 +fi
   2.178 +
   2.179 +if test x$enable_pcx = xyes; then
   2.180 +    AC_DEFINE([LOAD_PCX])
   2.181 +fi
   2.182 +
   2.183 +if test x$enable_pnm = xyes; then
   2.184 +    AC_DEFINE([LOAD_PNM])
   2.185 +fi
   2.186 +
   2.187 +if test x$enable_tga = xyes; then
   2.188 +    AC_DEFINE([LOAD_TGA])
   2.189 +fi
   2.190 +
   2.191  if test x$enable_xcf = xyes; then
   2.192 -    CFLAGS="$CFLAGS -DLOAD_XCF"
   2.193 +    AC_DEFINE([LOAD_XCF])
   2.194  fi
   2.195 -AC_ARG_ENABLE(xpm,
   2.196 -[  --enable-xpm            support loading XPM images [default=yes]],
   2.197 -              , enable_xpm=yes)
   2.198 +
   2.199  if test x$enable_xpm = xyes; then
   2.200 -    CFLAGS="$CFLAGS -DLOAD_XPM"
   2.201 +    AC_DEFINE([LOAD_XPM])
   2.202  fi
   2.203 -AC_ARG_ENABLE(xv,
   2.204 -[  --enable-xv             support loading XV thumbnail images [default=yes]],
   2.205 -              , enable_xv=yes)
   2.206 +
   2.207  if test x$enable_xv = xyes; then
   2.208 -    CFLAGS="$CFLAGS -DLOAD_XV"
   2.209 +    AC_DEFINE([LOAD_XV])
   2.210  fi
   2.211 -AC_SUBST(IMG_LIBS)
   2.212 +
   2.213 +LIBS="$saved_LIBS"
   2.214 +
   2.215 +AC_SUBST([IMG_LIBS])
   2.216  
   2.217  # Finally create all the generated files
   2.218  AC_OUTPUT([