/
configure.in
297 lines (263 loc) · 9.02 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=6
INTERFACE_AGE=5
BINARY_AGE=6
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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
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)
39
40
dnl Detect the canonical build and host environments
AC_CANONICAL_HOST
41
42
43
44
dnl Setup for automake
AM_INIT_AUTOMAKE(SDL_image, $VERSION)
45
46
dnl Check for tools
47
48
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL
49
AC_PROG_CC
50
AC_PROG_CXX
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
esac
80
AM_CONDITIONAL(USE_VERSION_RC, test x$use_version_rc = xtrue)
81
82
dnl Check for SDL
84
85
AM_PATH_SDL($SDL_VERSION,
:,
86
AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
87
88
)
CFLAGS="$CFLAGS $SDL_CFLAGS"
89
LIBS="$LIBS $SDL_LIBS"
90
saved_LIBS="$LIBS"
91
92
dnl Check command-line options
93
94
95
96
97
98
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])
99
100
AC_ARG_ENABLE([jpg-shared], AC_HELP_STRING([--enable-jpg-shared], [dynamically load JPG support [[default=yes]]]),
[], [enable_jpg_shared=yes])
101
102
103
104
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])
105
AC_ARG_ENABLE([png], [AC_HELP_STRING([--enable-png], [support loading PNG images [default=yes]])],
106
[], [enable_png=yes])
107
108
AC_ARG_ENABLE([png-shared], AC_HELP_STRING([--enable-png-shared], [dynamically load PNG support [[default=yes]]]),
[], [enable_png_shared=yes])
109
110
111
112
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])
113
114
115
116
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])
117
118
119
120
121
122
123
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])
124
if test x$enable_png = xyes || test x$enable_tif = xyes; then
125
CHECK_ZLIB()
126
fi
127
128
129
130
131
132
133
134
135
136
137
138
139
140
find_lib()
{
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'`]
for path in $gcc_lib_path $env_lib_path /usr/lib /usr/local/lib; do
lib=[`ls -- $path/$1 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
if test x$lib != x; then
echo $lib
return
fi
done
}
141
if test x$enable_jpg = xyes || test x$enable_tif = xyes; then
142
143
144
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
145
if test x$enable_jpg = xyes; then
146
AC_DEFINE([LOAD_JPG])
147
148
fi
LIBS="-ljpeg $LIBS"
149
150
case "$host" in
151
*-*-darwin*)
152
jpg_lib=[`find_lib libjpeg*.dylib`]
153
154
;;
*-*-cygwin* | *-*-mingw32*)
155
jpg_lib=[`find_lib "jpeg*dll"`]
156
157
;;
*)
158
159
160
161
jpg_lib=[`find_lib "libjpeg.so.[0-9]"`]
if test x$jpg_lib = x; then
jpg_lib=[`find_lib "libjpeg.so.[0-9]*"`]
fi
162
163
;;
esac
164
165
elif test x$enable_jpg = xyes; then
AC_MSG_WARN([*** Unable to find JPEG library (http://www.ijg.org/)])
166
167
168
AC_MSG_WARN([JPG image loading disabled])
fi
fi
169
170
if test x$enable_png = xyes; then
171
172
173
AC_CHECK_HEADER([png.h], [have_png_hdr=yes])
AC_CHECK_LIB([png], [png_create_read_struct], [have_png_lib=yes])
if test x$have_png_hdr = xyes -a x$have_png_lib = xyes; then
174
AC_DEFINE([LOAD_PNG])
175
176
case "$host" in
177
*-*-darwin*)
178
png_lib=[`find_lib libpng*.dylib`]
179
180
;;
*-*-cygwin* | *-*-mingw32*)
181
png_lib=[`find_lib "png*dll"`]
182
183
;;
*)
184
185
186
187
png_lib=[`find_lib "libpng.so.[0-9]"`]
if test x$png_lib = x; then
png_lib=[`find_lib "libpng.so.[0-9]*"`]
fi
188
189
;;
esac
190
else
191
AC_MSG_WARN([*** Unable to find PNG library (http://www.libpng.org/pub/png/libpng.html)])
192
193
194
AC_MSG_WARN([PNG image loading disabled])
fi
fi
195
196
if test x$enable_tif = xyes; then
197
198
199
AC_CHECK_HEADER([tiffio.h], [have_tif_hdr=yes])
AC_CHECK_LIB([tiff], [TIFFClientOpen], [have_tif_lib=yes])
if test x$have_tif_hdr = xyes -a x$have_tif_lib = xyes; then
200
AC_DEFINE([LOAD_TIF])
201
202
case "$host" in
203
*-*-darwin*)
204
tif_lib=[`find_lib libtiff*.dylib`]
205
206
;;
*-*-cygwin* | *-*-mingw32*)
207
tif_lib=[`find_lib "tiff*dll"`]
208
209
;;
*)
210
211
212
213
tif_lib=[`find_lib "libtiff.so.[0-9]"`]
if test x$tif_lib = x; then
tif_lib=[`find_lib "libtiff.so.[0-9]*"`]
fi
214
215
;;
esac
216
else
217
AC_MSG_WARN([*** Unable to find Tiff library (http://www.remotesensing.org/libtiff/)])
218
219
220
AC_MSG_WARN([TIF image loading disabled])
fi
fi
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
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
246
if test x$enable_xcf = xyes; then
247
AC_DEFINE([LOAD_XCF])
248
fi
249
250
if test x$enable_xpm = xyes; then
251
AC_DEFINE([LOAD_XPM])
252
fi
253
254
if test x$enable_xv = xyes; then
255
AC_DEFINE([LOAD_XV])
256
fi
257
258
if test x$enable_tif = xyes -a x$have_tif_hdr = xyes -a x$have_tif_lib = xyes; then
259
260
261
262
263
264
265
266
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
267
IMG_LIBS="-ltiff -lz $IMG_LIBS"
268
269
fi
fi
270
if test x$enable_jpg = xyes -a x$have_jpg_hdr = xyes -a x$have_jpg_lib = xyes; then
271
272
273
274
275
276
277
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
278
if test x$enable_png = xyes -a x$have_png_hdr = xyes -a x$have_png_lib = xyes; then
279
280
281
282
283
284
285
286
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
IMG_LIBS="-lpng -lz $IMG_LIBS"
fi
fi
287
288
LIBS="$saved_LIBS"
289
290
AC_SUBST([WINDRES])
AC_SUBST([IMG_LIBS])
291
292
293
294
295
# Finally create all the generated files
AC_OUTPUT([
Makefile
SDL_image.spec
296
SDL_image.qpg
297
])