1 dnl Process this file with autoconf to produce a configure script.
4 dnl Set various version strings - taken gratefully from the GTk sources
10 # if any functions have been added, set INTERFACE_AGE to 0.
11 # if backwards compatibility has been broken,
12 # set BINARY_AGE and INTERFACE_AGE to 0.
19 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
21 AC_SUBST(MAJOR_VERSION)
22 AC_SUBST(MINOR_VERSION)
23 AC_SUBST(MICRO_VERSION)
24 AC_SUBST(INTERFACE_AGE)
31 LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION
32 LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE`
33 LT_REVISION=$INTERFACE_AGE
34 LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE`
41 dnl Detect the canonical build and host environments
44 dnl Setup for automake
45 AM_INIT_AUTOMAKE(SDL_image, $VERSION)
53 if test -z "$host_alias"; then
56 hostaliaswindres="$host_alias-windres"
58 AC_CHECK_PROGS(WINDRES, [windres $hostaliaswindres $host_os-windres])
62 ac_default_prefix=/boot/develop/tools/gnupro
64 *-*-cygwin* | *-*-mingw32*)
65 if test "$build" != "$host"; then # cross-compiling
66 # Default cross-compile location
67 ac_default_prefix=/usr/local/cross-tools/i386-mingw32
69 # Look for the location of the tools and install there
70 if test "$BUILD_PREFIX" != ""; then
71 ac_default_prefix=$BUILD_PREFIX
74 if test x$WINDRES != x; then
79 AC_ARG_ENABLE([imageio], [AC_HELP_STRING([--enable-imageio], [use native Mac OS X frameworks for loading images [default=yes]])],
80 [], [enable_imageio=yes])
81 if test x$enable_imageio = xyes; then
82 IMG_LIBS="-Wl,-framework,ApplicationServices $IMG_LIBS"
84 CFLAGS="$CFLAGS -DSDL_IMAGE_USE_COMMON_BACKEND"
88 AM_CONDITIONAL(USE_VERSION_RC, test x$use_version_rc = xtrue)
90 dnl set this to use on systems that use lib64 instead of lib
91 base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
93 dnl Function to find a library in the compiler search path
96 gcc_bin_path=[`$CC -print-search-dirs 2>/dev/null | fgrep programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
97 gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
98 env_lib_path=[`echo $LIBS $LDFLAGS $* | sed 's/-L[ ]*//g'`]
99 if test "$cross_compiling" = yes; then
102 host_lib_path="/usr/$base_libdir /usr/local/$base_libdir"
104 for path in $gcc_bin_path $gcc_lib_path $env_lib_path $host_lib_path; do
105 lib=[`ls -- $path/$1 2>/dev/null | sort | sed 's/.*\/\(.*\)/\1/; q'`]
106 if test x$lib != x; then
115 AC_SUBST(SDL_VERSION)
116 AM_PATH_SDL($SDL_VERSION,
118 AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
120 CFLAGS="$CFLAGS $SDL_CFLAGS"
121 LIBS="$LIBS $SDL_LIBS"
124 dnl Check command-line options
125 AC_ARG_ENABLE([bmp], [AC_HELP_STRING([--enable-bmp], [support loading BMP/ICO/CUR images [default=yes]])],
126 [], [enable_bmp=yes])
127 AC_ARG_ENABLE([gif], [AC_HELP_STRING([--enable-gif], [support loading GIF images [default=yes]])],
128 [], [enable_gif=yes])
129 AC_ARG_ENABLE([jpg], [AC_HELP_STRING([--enable-jpg], [support loading JPG images [default=yes]])],
130 [], [enable_jpg=yes])
131 AC_ARG_ENABLE([jpg-shared], AC_HELP_STRING([--enable-jpg-shared], [dynamically load JPG support [[default=yes]]]),
132 [], [enable_jpg_shared=yes])
133 AC_ARG_ENABLE([lbm], [AC_HELP_STRING([--enable-lbm], [support loading LBM images [default=yes]])],
134 [], [enable_lbm=yes])
135 AC_ARG_ENABLE([pcx], [AC_HELP_STRING([--enable-pcx], [support loading PCX images [default=yes]])],
136 [], [enable_pcx=yes])
137 AC_ARG_ENABLE([png], [AC_HELP_STRING([--enable-png], [support loading PNG images [default=yes]])],
138 [], [enable_png=yes])
139 AC_ARG_ENABLE([png-shared], AC_HELP_STRING([--enable-png-shared], [dynamically load PNG support [[default=yes]]]),
140 [], [enable_png_shared=yes])
141 AC_ARG_ENABLE([pnm], [AC_HELP_STRING([--enable-pnm], [support loading PNM images [default=yes]])],
142 [], [enable_pnm=yes])
143 AC_ARG_ENABLE([tga], [AC_HELP_STRING([--enable-tga], [support loading TGA images [default=yes]])],
144 [], [enable_tga=yes])
145 AC_ARG_ENABLE([tif], [AC_HELP_STRING([--enable-tif], [support loading TIFF images [default=yes]])],
146 [], [enable_tif=yes])
147 AC_ARG_ENABLE([tif-shared], AC_HELP_STRING([--enable-tif-shared], [dynamically load TIFF support [[default=yes]]]),
148 [], [enable_tif_shared=yes])
149 AC_ARG_ENABLE([xcf], [AC_HELP_STRING([--enable-xcf], [support loading XCF images [default=yes]])],
150 [], [enable_xcf=yes])
151 AC_ARG_ENABLE([xpm], [AC_HELP_STRING([--enable-xpm], [support loading XPM images [default=yes]])],
152 [], [enable_xpm=yes])
153 AC_ARG_ENABLE([xv], [AC_HELP_STRING([--enable-xv], [support loading XV images [default=yes]])],
156 if test x$enable_jpg = xyes || test x$enable_tif = xyes; then
157 AC_CHECK_HEADER([jpeglib.h], [have_jpg_hdr=yes])
158 AC_CHECK_LIB([jpeg], [jpeg_CreateDecompress], [have_jpg_lib=yes])
159 if test x$have_jpg_hdr = xyes -a x$have_jpg_lib = xyes; then
160 if test x$enable_jpg = xyes; then
161 AC_DEFINE([LOAD_JPG])
167 jpg_lib=[`find_lib libjpeg.dylib`]
169 *-*-cygwin* | *-*-mingw32*)
170 jpg_lib=[`find_lib "jpeg.dll"`]
173 jpg_lib=[`find_lib "libjpeg.so.[0-9]"`]
174 if test x$jpg_lib = x; then
175 jpg_lib=[`find_lib "libjpeg.so.[0-9][0-9]"`]
177 if test x$jpg_lib = x; then
178 jpg_lib=[`find_lib "libjpeg.so.[0-9]*"`]
182 elif test x$enable_jpg = xyes; then
183 AC_MSG_WARN([*** Unable to find JPEG library (http://www.ijg.org/)])
184 AC_MSG_WARN([JPG image loading disabled])
188 if test "x$enable_png" = xyes; then
189 PKG_CHECK_MODULES([LIBPNG], [libpng], [dnl
191 CFLAGS="$LIBPNG_CFLAGS $CFLAGS"
194 AC_CHECK_HEADER([png.h], [have_png_hdr=yes])
195 AC_CHECK_LIB([png], [png_create_read_struct], [have_png_lib=yes], [], [-lz])
197 if test x$have_png_hdr = xyes -a x$have_png_lib = xyes; then
198 AC_DEFINE([LOAD_PNG])
202 png_lib=[`find_lib libpng.dylib`]
204 *-*-cygwin* | *-*-mingw32*)
205 png_lib=[`find_lib "libpng*.dll"`]
208 png_lib=[`find_lib "libpng.so.[0-9]"`]
209 if test x$png_lib = x; then
210 png_lib=[`find_lib "libpng.so.[0-9]*"`]
212 if test x$png_lib = x; then
213 png_lib=[`find_lib "libpng*.so.[0-9]"`]
215 if test x$png_lib = x; then
216 png_lib=[`find_lib "libpng*.so.[0-9]*"`]
221 AC_MSG_WARN([*** Unable to find PNG library (http://www.libpng.org/pub/png/libpng.html)])
222 AC_MSG_WARN([PNG image loading disabled])
226 if test x$enable_tif = xyes; then
227 AC_CHECK_HEADER([tiffio.h], [have_tif_hdr=yes])
228 AC_CHECK_LIB([tiff], [TIFFClientOpen], [have_tif_lib=yes], [], [-lz])
229 if test x$have_tif_hdr = xyes -a x$have_tif_lib = xyes; then
230 AC_DEFINE([LOAD_TIF])
234 tif_lib=[`find_lib libtiff.dylib`]
236 *-*-cygwin* | *-*-mingw32*)
237 tif_lib=[`find_lib "libtiff-*.dll"`]
240 tif_lib=[`find_lib "libtiff.so.[0-9]"`]
241 if test x$tif_lib = x; then
242 tif_lib=[`find_lib "libtiff.so.[0-9]*"`]
247 AC_MSG_WARN([*** Unable to find Tiff library (http://www.remotesensing.org/libtiff/)])
248 AC_MSG_WARN([TIF image loading disabled])
252 if test x$enable_bmp = xyes; then
253 AC_DEFINE([LOAD_BMP])
256 if test x$enable_gif = xyes; then
257 AC_DEFINE([LOAD_GIF])
260 if test x$enable_lbm = xyes; then
261 AC_DEFINE([LOAD_LBM])
264 if test x$enable_pcx = xyes; then
265 AC_DEFINE([LOAD_PCX])
268 if test x$enable_pnm = xyes; then
269 AC_DEFINE([LOAD_PNM])
272 if test x$enable_tga = xyes; then
273 AC_DEFINE([LOAD_TGA])
276 if test x$enable_xcf = xyes; then
277 AC_DEFINE([LOAD_XCF])
280 if test x$enable_xpm = xyes; then
281 AC_DEFINE([LOAD_XPM])
284 if test x$enable_xv = xyes; then
288 if test x$enable_tif = xyes -a x$have_tif_hdr = xyes -a x$have_tif_lib = xyes; then
289 if test x$enable_tif_shared = xyes && test x$tif_lib != x; then
290 echo "-- dynamic libtiff -> $tif_lib"
291 AC_DEFINE_UNQUOTED(LOAD_TIF_DYNAMIC, "$tif_lib")
293 if test x$have_libjpeg = xyes; then
294 # Disable dynamic jpeg since we're linking it explicitly
297 IMG_LIBS="-ltiff -lz $IMG_LIBS"
300 if test x$enable_jpg = xyes -a x$have_jpg_hdr = xyes -a x$have_jpg_lib = xyes; then
301 if test x$enable_jpg_shared = xyes && test x$jpg_lib != x; then
302 echo "-- dynamic libjpeg -> $jpg_lib"
303 AC_DEFINE_UNQUOTED(LOAD_JPG_DYNAMIC, "$jpg_lib")
305 IMG_LIBS="-ljpeg $IMG_LIBS"
308 if test x$enable_png = xyes -a x$have_png_hdr = xyes -a x$have_png_lib = xyes; then
309 if test x$enable_png_shared = xyes && test x$png_lib != x; then
310 echo "-- dynamic libpng -> $png_lib"
311 AC_DEFINE_UNQUOTED(LOAD_PNG_DYNAMIC, "$png_lib")
313 IMG_LIBS="-lpng -lz $IMG_LIBS"
322 # Finally create all the generated files