/
configure.in
382 lines (344 loc) · 12.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
dnl Process this file with autoconf to produce a configure script.
AC_INIT(README)
dnl Set various version strings - taken gratefully from the GTk sources
# Making releases:
# MICRO_VERSION += 1;
# INTERFACE_AGE += 1;
# BINARY_AGE += 1;
# if any functions have been added, set INTERFACE_AGE to 0.
# if backwards compatibility has been broken,
# set BINARY_AGE and INTERFACE_AGE to 0.
MAJOR_VERSION=1
15
MINOR_VERSION=2
16
17
18
MICRO_VERSION=13
INTERFACE_AGE=5
BINARY_AGE=13
19
20
21
22
23
24
25
26
27
28
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
AC_SUBST(MAJOR_VERSION)
AC_SUBST(MINOR_VERSION)
AC_SUBST(MICRO_VERSION)
AC_SUBST(INTERFACE_AGE)
AC_SUBST(BINARY_AGE)
AC_SUBST(VERSION)
# libtool versioning
29
30
LT_INIT([win32-dll])
31
32
33
34
35
36
37
38
39
40
LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION
LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE`
LT_REVISION=$INTERFACE_AGE
LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE`
AC_SUBST(LT_RELEASE)
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)
41
42
dnl Detect the canonical build and host environments
AC_CANONICAL_HOST
43
44
45
46
dnl Setup for automake
AM_INIT_AUTOMAKE(SDL_image, $VERSION)
47
dnl Check for tools
48
AC_PROG_LIBTOOL
49
AC_PROG_CC
50
AC_PROG_OBJC
51
AC_C_INLINE
52
AC_PROG_INSTALL
53
54
55
56
57
58
59
AC_PROG_MAKE_SET
if test -z "$host_alias"; then
hostaliaswindres=
else
hostaliaswindres="$host_alias-windres"
fi
AC_CHECK_PROGS(WINDRES, [windres $hostaliaswindres $host_os-windres])
60
61
case "$host" in
62
63
64
*-*-beos*)
ac_default_prefix=/boot/develop/tools/gnupro
;;
65
*-*-cygwin* | *-*-mingw32*)
66
if test "$build" != "$host"; then # cross-compiling
67
# Default cross-compile location
68
ac_default_prefix=/usr/local/cross-tools/i386-mingw32
69
70
else
# Look for the location of the tools and install there
71
if test "$BUILD_PREFIX" != ""; then
72
73
ac_default_prefix=$BUILD_PREFIX
fi
74
fi
75
76
77
if test x$WINDRES != x; then
use_version_rc=true
fi
78
;;
79
80
81
*-*-darwin*)
AC_ARG_ENABLE([imageio], [AC_HELP_STRING([--enable-imageio], [use native Mac OS X frameworks for loading images [default=yes]])],
[], [enable_imageio=yes])
82
83
84
dnl Show a message when we use ImageIO support so it's not a surprise
AC_MSG_CHECKING([for ImageIO support])
AC_MSG_RESULT($enable_imageio)
85
if test x$enable_imageio = xyes; then
86
IMG_LIBS="-Wl,-framework,ApplicationServices -lobjc $IMG_LIBS"
87
88
89
90
else
CFLAGS="$CFLAGS -DSDL_IMAGE_USE_COMMON_BACKEND"
fi
;;
91
esac
92
AM_CONDITIONAL(USE_IMAGEIO, test x$enable_imageio = xyes)
93
AM_CONDITIONAL(USE_VERSION_RC, test x$use_version_rc = xtrue)
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
dnl set this to use on systems that use lib64 instead of lib
base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
dnl Function to find a library in the compiler search path
find_lib()
{
gcc_bin_path=[`$CC -print-search-dirs 2>/dev/null | fgrep programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
env_lib_path=[`echo $LIBS $LDFLAGS $* | sed 's/-L[ ]*//g'`]
if test "$cross_compiling" = yes; then
host_lib_path=""
else
host_lib_path="/usr/$base_libdir /usr/local/$base_libdir"
fi
109
for path in $env_lib_path $gcc_bin_path $gcc_lib_path $host_lib_path; do
110
lib=[`ls -- $path/$1 2>/dev/null | sed -e '/\.so\..*\./d' -e 's,.*/,,' | sort | tail -1`]
111
112
113
114
115
116
117
if test x$lib != x; then
echo $lib
return
fi
done
}
118
dnl Check for SDL
120
AC_SUBST(SDL_VERSION)
121
122
AM_PATH_SDL($SDL_VERSION,
:,
123
AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
124
)
125
CFLAGS="$CFLAGS $SDL_CFLAGS"
126
LIBS="$LIBS $SDL_LIBS"
127
saved_LIBS="$LIBS"
128
129
dnl Check command-line options
130
AC_ARG_ENABLE([bmp], [AC_HELP_STRING([--enable-bmp], [support loading BMP/ICO/CUR images [default=yes]])],
131
132
133
134
135
[], [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])
136
137
AC_ARG_ENABLE([jpg-shared], AC_HELP_STRING([--enable-jpg-shared], [dynamically load JPG support [[default=yes]]]),
[], [enable_jpg_shared=yes])
138
139
140
141
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])
142
AC_ARG_ENABLE([png], [AC_HELP_STRING([--enable-png], [support loading PNG images [default=yes]])],
143
[], [enable_png=yes])
144
145
AC_ARG_ENABLE([png-shared], AC_HELP_STRING([--enable-png-shared], [dynamically load PNG support [[default=yes]]]),
[], [enable_png_shared=yes])
146
147
148
149
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])
150
151
152
153
AC_ARG_ENABLE([tif], [AC_HELP_STRING([--enable-tif], [support loading TIFF images [default=yes]])],
[], [enable_tif=yes])
AC_ARG_ENABLE([tif-shared], AC_HELP_STRING([--enable-tif-shared], [dynamically load TIFF support [[default=yes]]]),
[], [enable_tif_shared=yes])
154
155
156
157
158
159
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])
160
161
162
163
AC_ARG_ENABLE([webp], [AC_HELP_STRING([--enable-webp], [support loading WEBP images [default=yes]])],
[], [enable_webp=yes])
AC_ARG_ENABLE([webp-shared], AC_HELP_STRING([--enable-webp-shared], [dynamically load WEBP support [[default=yes]]]),
[], [enable_webp_shared=yes])
164
165
if (test x$enable_jpg = xyes || test x$enable_tif = xyes) && test x$enable_imageio != xyes; then
166
167
168
AC_CHECK_HEADER([jpeglib.h], [have_jpg_hdr=yes])
AC_CHECK_LIB([jpeg], [jpeg_CreateDecompress], [have_jpg_lib=yes])
if test x$have_jpg_hdr = xyes -a x$have_jpg_lib = xyes; then
169
if test x$enable_jpg = xyes; then
170
AC_DEFINE([LOAD_JPG])
171
172
fi
LIBS="-ljpeg $LIBS"
173
174
case "$host" in
175
*-*-darwin*)
176
jpg_lib=[`find_lib libjpeg.dylib`]
177
178
;;
*-*-cygwin* | *-*-mingw32*)
179
jpg_lib=[`find_lib "libjpeg*.dll"`]
180
181
;;
*)
182
jpg_lib=[`find_lib "libjpeg[0-9]*.so.*"`]
183
if test x$jpg_lib = x; then
184
jpg_lib=[`find_lib "libjpeg.so.*"`]
185
fi
186
187
;;
esac
188
189
elif test x$enable_jpg = xyes; then
AC_MSG_WARN([*** Unable to find JPEG library (http://www.ijg.org/)])
190
191
192
AC_MSG_WARN([JPG image loading disabled])
fi
fi
193
194
if test x$enable_png = xyes -a x$enable_imageio != xyes; then
195
196
197
198
PKG_CHECK_MODULES([LIBPNG], [libpng], [dnl
have_png_hdr=yes
have_png_lib=yes
], [dnl
199
200
201
202
203
204
205
206
AC_CHECK_HEADER([png.h], [
have_png_hdr=yes
LIBPNG_CFLAGS=""
])
AC_CHECK_LIB([png], [png_create_read_struct], [
have_png_lib=yes
LIBPNG_LIBS="-lpng -lz"
], [], [-lz])
207
])
208
if test x$have_png_hdr = xyes -a x$have_png_lib = xyes; then
209
AC_DEFINE([LOAD_PNG])
210
211
case "$host" in
212
*-*-darwin*)
213
png_lib=[`find_lib libpng.dylib`]
214
215
;;
*-*-cygwin* | *-*-mingw32*)
216
png_lib=[`find_lib "libpng*.dll"`]
217
218
;;
*)
219
png_lib=[`find_lib "libpng[0-9]*.so.*"`]
220
if test x$png_lib = x; then
221
png_lib=[`find_lib "libpng.so.*"`]
222
fi
223
224
;;
esac
225
else
226
AC_MSG_WARN([*** Unable to find PNG library (http://www.libpng.org/pub/png/libpng.html)])
227
228
229
AC_MSG_WARN([PNG image loading disabled])
fi
fi
230
231
if test x$enable_tif = xyes -a x$enable_imageio != xyes; then
232
AC_CHECK_HEADER([tiffio.h], [have_tif_hdr=yes])
233
AC_CHECK_LIB([tiff], [TIFFClientOpen], [have_tif_lib=yes], [], [-lz])
234
if test x$have_tif_hdr = xyes -a x$have_tif_lib = xyes; then
235
AC_DEFINE([LOAD_TIF])
236
237
case "$host" in
238
*-*-darwin*)
239
tif_lib=[`find_lib libtiff.dylib`]
240
241
;;
*-*-cygwin* | *-*-mingw32*)
242
tif_lib=[`find_lib "libtiff-*.dll"`]
243
244
;;
*)
245
tif_lib=[`find_lib "libtiff[0-9]*.so.*"`]
246
if test x$tif_lib = x; then
247
tif_lib=[`find_lib "libtiff.so.*"`]
248
fi
249
250
;;
esac
251
else
252
AC_MSG_WARN([*** Unable to find Tiff library (http://www.remotesensing.org/libtiff/)])
253
254
255
AC_MSG_WARN([TIF image loading disabled])
fi
fi
256
257
258
259
260
261
if test x$enable_webp = xyes; then
PKG_CHECK_MODULES([LIBWEBP], [libwebp], [dnl
have_webp_hdr=yes
have_webp_lib=yes
], [dnl
262
263
264
265
266
267
268
269
AC_CHECK_HEADER([webp/decode.h], [
have_webp_hdr=yes
LIBWEBP_CFLAGS=""
])
AC_CHECK_LIB([webp], [WebPGetDecoderVersion], [
have_webp_lib=yes
LIBWEBP_LIBS="-lwebp"
], [], [-lm])
270
271
272
273
274
275
276
277
278
279
280
281
])
if test x$have_webp_hdr = xyes -a x$have_webp_lib = xyes; then
AC_DEFINE([LOAD_WEBP])
case "$host" in
*-*-darwin*)
webp_lib=[`find_lib libwebp.dylib`]
;;
*-*-cygwin* | *-*-mingw32*)
webp_lib=[`find_lib "libwebp*.dll"`]
;;
*)
282
webp_lib=[`find_lib "libwebp[0-9]*.so.*"`]
283
if test x$webp_lib = x; then
284
webp_lib=[`find_lib "libwebp.so.*"`]
285
286
287
288
289
290
291
292
293
fi
;;
esac
else
AC_MSG_WARN([*** Unable to find WEBP library (http://code.google.com/intl/en-US/speed/webp/index.html)])
AC_MSG_WARN([WEBP Pimage loading disabled])
fi
fi
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
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
318
if test x$enable_xcf = xyes; then
319
AC_DEFINE([LOAD_XCF])
320
fi
321
322
if test x$enable_xpm = xyes; then
323
AC_DEFINE([LOAD_XPM])
324
fi
325
326
if test x$enable_xv = xyes; then
327
AC_DEFINE([LOAD_XV])
328
fi
329
330
if test x$enable_webp = xyes -a x$have_webp_hdr = xyes -a x$have_webp_lib = xyes; then
331
CFLAGS="$LIBWEBP_CFLAGS $CFLAGS"
332
333
334
335
if test x$enable_webp_shared = xyes && test x$webp_lib != x; then
echo "-- dynamic libwebp -> $webp_lib"
AC_DEFINE_UNQUOTED(LOAD_WEBP_DYNAMIC, "$webp_lib")
else
336
IMG_LIBS="$LIBWEBP_LIBS $IMG_LIBS"
337
338
339
fi
fi
340
if test x$enable_tif = xyes -a x$have_tif_hdr = xyes -a x$have_tif_lib = xyes; then
341
342
343
344
345
346
347
348
if test x$enable_tif_shared = xyes && test x$tif_lib != x; then
echo "-- dynamic libtiff -> $tif_lib"
AC_DEFINE_UNQUOTED(LOAD_TIF_DYNAMIC, "$tif_lib")
else
if test x$have_libjpeg = xyes; then
# Disable dynamic jpeg since we're linking it explicitly
jpg_lib=''
fi
349
IMG_LIBS="-ltiff -lz $IMG_LIBS"
350
351
fi
fi
352
if test x$enable_jpg = xyes -a x$have_jpg_hdr = xyes -a x$have_jpg_lib = xyes; then
353
354
355
356
357
358
359
if test x$enable_jpg_shared = xyes && test x$jpg_lib != x; then
echo "-- dynamic libjpeg -> $jpg_lib"
AC_DEFINE_UNQUOTED(LOAD_JPG_DYNAMIC, "$jpg_lib")
else
IMG_LIBS="-ljpeg $IMG_LIBS"
fi
fi
360
if test x$enable_png = xyes -a x$have_png_hdr = xyes -a x$have_png_lib = xyes; then
361
CFLAGS="$LIBPNG_CFLAGS $CFLAGS"
362
363
364
365
if test x$enable_png_shared = xyes && test x$png_lib != x; then
echo "-- dynamic libpng -> $png_lib"
AC_DEFINE_UNQUOTED(LOAD_PNG_DYNAMIC, "$png_lib")
else
366
IMG_LIBS="$LIBPNG_LIBS $IMG_LIBS"
367
368
369
fi
fi
370
371
LIBS="$saved_LIBS"
372
373
AC_SUBST([WINDRES])
AC_SUBST([IMG_LIBS])
374
375
376
OBJCFLAGS=$CFLAGS
377
378
379
380
# Finally create all the generated files
AC_OUTPUT([
Makefile
SDL_image.spec
381
SDL_image.pc
382
])