aboutsummaryrefslogtreecommitdiff
path: root/games/alephone/r5033.diff
blob: 54f7ea355aa5c2c0eb8c4618632a0d68cf6fa621 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
Index: configure.ac
===================================================================
--- configure.ac	(revision 5032)
+++ configure.ac	(revision 5033)
@@ -1,9 +1,13 @@
 dnl Process this file with autoconf to produce a configure script.
-dnl Written in 2000 by Christian Bauer <Christian.Bauer@uni-mainz.de>
+dnl Written by Christian Bauer and the Aleph One developers.
 
-AC_INIT([Aleph One/SDL], m4_esyscmd([ grep '^#define A1_DATE_VERSION' Source_Files/Misc/alephversion.h | sed -e 's/\(.*\"\)\(.*\)\(\"\)/\2/g' | tr -d '\n']), [http://sourceforge.net/bugs/?group_id=1997], [AlephOne])
+AC_INIT([Aleph One],
+        m4_esyscmd([ grep '^#define A1_DATE_VERSION' Source_Files/Misc/alephversion.h | sed -e 's/\(.*\"\)\(.*\)\(\"\)/\2/g' | tr -d '\n']),
+        [http://sourceforge.net/p/marathon/bugs/],
+        [AlephOne],
+        [http://marathon.sourceforge.net/])
 AC_CONFIG_SRCDIR([Source_Files/shell.cpp])
-AC_PREREQ(2.52)
+AC_PREREQ([2.65])
 
 dnl Detect the canonical host and target build environment.
 AC_CANONICAL_HOST
@@ -11,288 +15,212 @@
 
 dnl Init automake.
 AM_INIT_AUTOMAKE
-AM_CONFIG_HEADER(config.h)
+AM_CONFIG_HEADER([config.h])
 
 dnl Configure options.
-AC_ARG_ENABLE(opengl, 
-[  --enable-opengl         use OpenGL for rendering [default=yes]], , enable_opengl=yes)
-AC_ARG_ENABLE(mad, 
-[  --enable-mad            use libmad for mp3 playback [default=yes]], , enable_mad=yes)
-AC_ARG_ENABLE(ffmpeg,
-[  --enable-ffmpeg         use ffmpeg for audio/video playback and film export [default=yes]], , enable_ffmpeg=yes)
-AC_ARG_ENABLE(sndfile, 
-[  --enable-sndfile        use libsndfile for decoding audio files [default=yes]], , enable_sndfile=yes)
-AC_ARG_ENABLE(vorbis, 
-[  --enable-vorbis         enable ogg/vorbis music playback [default=yes]], , enable_vorbis=yes)
-AC_ARG_ENABLE(lua, 
-[  --enable-lua            use built-in Lua scripting [default=yes]], , enable_lua=yes)
-AC_ARG_ENABLE(smpeg, 
-[  --enable-smpeg          use SMPEG for movie playback [default=yes]], , enable_smpeg=yes)
-AC_ARG_ENABLE(speex, 
-[  --enable-speex          enable Speex net mic playback [default=yes]], , enable_speex=yes)
-AC_ARG_ENABLE(alsa,
-[  --enable-alsa           enable ALSA net mic transmission [default=yes]], , enable_alsa=yes)
-AC_ARG_ENABLE(zzip,
-[  --enable-zzip           enable zziplib support [default=yes]], , enable_zzip=yes)
-AC_ARG_ENABLE(png,
-[  --enable-png            enable PNG screenshot support [default=yes]], , enable_png=yes)
 
-dnl Checks for programs.
+dnl AX_ARG_ENABLE(option, desc)
+AC_DEFUN([AX_ARG_ENABLE],
+         [ desc_$1="$2"
+           AC_ARG_ENABLE([$1], AS_HELP_STRING([--disable-$1], [do not include $2])) ])
+dnl AX_ARG_WITH(option)
+AC_DEFUN([AX_ARG_WITH],
+         [ desc_$1="$2"
+           AC_ARG_WITH([$1], AS_HELP_STRING([--without-$1], [do not use $2])) ])
+
+AX_ARG_ENABLE([opengl], [OpenGL rendering])
+AX_ARG_ENABLE([lua], [built-in Lua scripting])
+
+AX_ARG_WITH([sdl_image], [SDL_image support])
+AX_ARG_WITH([ffmpeg], [FFmpeg playback and film export])
+AX_ARG_WITH([mad], [libmad MP3 playback])
+AX_ARG_WITH([sndfile], [libsndfile audio decoding])
+AX_ARG_WITH([vorbis], [libvorbis Ogg/Vorbis music playback])
+AX_ARG_WITH([smpeg], [SMPEG movie playback])
+AX_ARG_WITH([speex], [Speex net mic playback])
+AX_ARG_WITH([alsa], [ALSA net mic transmission])
+AX_ARG_WITH([zzip], [zziplib support])
+AX_ARG_WITH([png], [libpng PNG screenshot support])
+
+
+dnl Check for programs.
 AC_PROG_CC
 AC_PROG_CPP
 AC_PROG_CXX
 AC_PROG_CXXCPP
+AC_PROG_OBJCXX
 AC_PROG_INSTALL
 AC_PROG_RANLIB
 
-dnl some platform specific stuff
-case $target in
-*-*-mingw32*)
-	AC_CHECK_TOOL(WINDRES, windres, :)
-	;;
-*-*-netbsd*)
-	CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"	
-	;;
-*)
-	;;
-esac
+dnl Some platform specific stuff.
+AS_CASE([$target],
+        [*-*-mingw32*],
+        [ make_windows=true
+          AC_CHECK_TOOL([WINDRES], [windres], [:])
+          AC_DEFINE([WIN32_DISABLE_MUSIC], [1], [Win32 music disabled])
+          LIBS="$LIBS -ldsound -lwsock32" ],
+        [*-*-netbsd*],
+        [CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"])
+AM_CONDITIONAL([MAKE_WINDOWS], [test "x$make_windows" = "xtrue"])
 
-dnl Checks for headers.
-AC_CHECK_HEADERS(unistd.h)
-AC_CHECK_HEADERS(pwd.h)
+dnl Set target system name.
+AC_DEFINE_UNQUOTED([TARGET_PLATFORM], ["$target_os $target_cpu"], [Target platform name])
 
-dnl Checks for library functions.
-AC_CHECK_FUNC(snprintf, [
-  AC_DEFINE(HAVE_SNPRINTF, 1, [snprintf() is available])
-])
-AC_CHECK_FUNC(vsnprintf, [
-  AC_DEFINE(HAVE_VSNPRINTF, 1, [vsnprintf() is available])
-])
+dnl Check for headers.
+AC_CHECK_HEADERS([unistd.h pwd.h])
 
-AC_CHECK_FUNC(mkstemp, [
-  AC_DEFINE(LUA_USE_MKSTEMP, 1, [mkstemp() is available])
-])
-AC_CHECK_FUNC(sysconf, [
-  AC_DEFINE(HAVE_SYSCONF, 1, [sysconf() is available])
-])
-AC_CHECK_FUNC(sysctlbyname, [
-  AC_DEFINE(HAVE_SYSCTLBYNAME, 1, [sysctlbyname() is available])
-])
+dnl Check for boost functions.
+AC_LANG_PUSH(C++)
+AC_CHECK_HEADER([boost/bind.hpp],
+                ,
+                [AC_MSG_ERROR([You need boost/bind.hpp from the boost library to run Aleph One.])])
+AC_CHECK_HEADER([boost/function.hpp],
+                ,
+                [AC_MSG_ERROR([You need boost/function.hpp from the boost library to run Aleph One.])])
+AC_LANG_POP(C++)
 
-dnl Check for SDL.
-AM_PATH_SDL(1.2.0, , AC_MSG_ERROR([You need SDL 1.2 to run Aleph One.]))
-CPPFLAGS="$CPPFLAGS $SDL_CFLAGS -DSDL"
-LIBS="$LIBS $SDL_LIBS"
+dnl Check for library functions.
+AC_CHECK_FUNCS([snprintf vsnprintf sysconf sysctlbyname])
+AC_CHECK_FUNC([mkstemp],
+              [AC_DEFINE([LUA_USE_MKSTEMP], [1], [mkstemp() available])])
 
-dnl Check for SDL_image.
-AC_CHECK_HEADERS(SDL_image.h, [
-  AC_CHECK_LIB(SDL_image, IMG_Load, [
-    LIBS="-lSDL_image $LIBS"
-    AC_DEFINE(HAVE_SDL_IMAGE, 1, [SDL_image support is enabled])
-  ])
-])
+dnl Check for net functions.
+AC_SEARCH_LIBS([gethostbyname], [nsl])
+AC_SEARCH_LIBS([socket], [socket],
+               ,
+               [AC_CHECK_LIB([nsl], [socket],
+                             [ LIBS="$LIBS -lsocket -lnsl" ],
+                             ,
+                             [-lsocket])])
 
-AC_CHECK_HEADERS(SDL_ttf.h, [
- AC_CHECK_LIB(SDL_ttf, TTF_Init, [
-   LIBS="-lSDL_ttf $LIBS"
-   AC_DEFINE(HAVE_SDL_TTF, 1, [SDL_TTF support is enabled])
- ])],
- AC_MSG_ERROR([You need SDL_ttf to run Aleph One.])
-)
+dnl Check for libraries.
 
-dnl Check for SDL_net.
-AC_CHECK_HEADERS(SDL_net.h, [
-  AC_CHECK_LIB(SDL_net, SDLNet_Init, [
-    LIBS="-lSDL_net $LIBS"
-    AC_DEFINE(HAVE_SDL_NET, 1, [SDL_net support is enabled])
-  ])
-])
-if [[ "x$ac_cv_lib_SDL_net_SDLNet_Init" != xyes ]]; then
-  AC_MSG_ERROR([You need SDL_net to run Aleph One.])
-fi
-AM_CONDITIONAL(HAVE_SDL_NET, test x$ac_cv_lib_SDL_net_SDLNet_Init = xyes)
+dnl AX_REQUIRE_LIB(desc, define, header, lib, func)
+AC_DEFUN([AX_REQUIRE_LIB],
+         [ AC_CHECK_HEADERS([$3], [AC_CHECK_LIB([$4], [$5])])
+           AS_IF([test "x${ac_cv_lib_$4_$5}" = "xyes"],
+                 [AC_DEFINE([HAVE_$2], [1], [$1 support enabled])],
+                 [AC_MSG_ERROR([You need $1 to run Aleph One.])]) ])
 
-AC_SEARCH_LIBS(gethostbyname, nsl)
-AC_SEARCH_LIBS(socket, socket, ,
-    [AC_CHECK_LIB(nsl, socket, LIBS="$LIBS -lsocket -lnsl", , -lsocket)])
+dnl Check for required SDL dependencies.
+AM_PATH_SDL(1.2.0, , AC_MSG_ERROR([You need SDL 1.2 to run Aleph One.]))
+CPPFLAGS="$CPPFLAGS $SDL_CFLAGS -DSDL"
+LIBS="$LIBS $SDL_LIBS"
 
+AX_REQUIRE_LIB([SDL_ttf], [SDL_TTF],
+               [SDL_ttf.h], [SDL_ttf], [TTF_Init])
+AX_REQUIRE_LIB([SDL_net], [SDL_NET],
+               [SDL_net.h], [SDL_net], [SDLNet_Init])
 
-dnl Check for zlib
-AC_CHECK_HEADER(zlib.h, , AC_ERROR([Aleph One requires zlib]))
-AC_CHECK_LIB(z, zlibVersion, LIBS="-lz $LIBS", AC_ERROR([Aleph One requires zlib]))
+dnl Check for zlib.
+AX_REQUIRE_LIB([zlib], [ZLIB],
+               [zlib.h], [z], [zlibVersion])
 
-dnl Check for zziplib
-have_zzip=false
-if [[ "x$enable_zzip" = "xyes" ]]; then
-PKG_CHECK_MODULES([ZZIP], [zziplib >= 0.10.75], [
-			  CPPFLAGS="$ZZIP_CFLAGS $CPPFLAGS"
-			  LIBS="$ZZIP_LIBS $LIBS"
-			  have_zzip=true
-			  AC_DEFINE(HAVE_ZZIP, 1, [ZZIP support enabled])
-])
-fi
-AM_CONDITIONAL(BUILD_ZZIP_RWOPS, test x$have_zzip = xtrue)
+dnl Check for OpenGL.
+AS_IF([test "x$enable_opengl" != "xno"],
+      [ AC_MSG_CHECKING([for OpenGL support])
+        compiled_opengl=no
+        AS_CASE([$target],
+                [*-*-cygwin* | *-*-mingw32*],
+                [ SYS_GL_LIBS="-lGLEW -lopengl32 -lglu32"
+                  LIBS="$LIBS -lstdc++" ],
+                [*-*-darwin*],
+                [ SYS_GL_LIBS="-F/System/Library/Frameworks -framework AGL -framework OpenGL"
+                  CPPFLAGS="$CPPFLAGS -D__DARWIN__ -F/System/Library/Frameworks -I/System/Library/Frameworks/OpenGL.framework/Headers" ],
+                [*-*-linux*],
+                [ SYS_GL_LIBS="-lGL -lpthread" ],
+                [ SYS_GL_LIBS="-lGL" ])
+        AC_TRY_COMPILE([
+          #ifndef __DARWIN__
+          #include <GL/gl.h>
+          #else
+          #include <OpenGL/gl.h>
+          #endif
+          ],
+          ,
+          [ compiled_opengl=yes ])
+        AC_MSG_RESULT($compiled_opengl)
+        AS_IF([test "x$compiled_opengl" = "xyes"],
+              [ have_opengl=true
+                AC_DEFINE([HAVE_OPENGL], [1], [OpenGL support enabled])
+                AC_CHECK_LIB([GLU], [gluScaleImage],
+                             [SYS_GL_LIBS="$SYS_GL_LIBS -lGLU"],
+                             ,
+                             [$SYS_GL_LIBS])
+                LIBS="$LIBS $SYS_GL_LIBS"
+                AC_CHECK_HEADERS([GL/glext.h], [], [], [#include <GL/gl.h>]) ],
+              [ AS_IF([test "x$enable_opengl" = "xyes"],
+                      [AC_MSG_ERROR([OpenGL support requested but not available])],
+                      [AC_MSG_WARN([OpenGL not available])]) ]) ])
+AM_CONDITIONAL([MAKE_OPENGL], [test "x$have_opengl" = "xtrue" ])
 
-have_png=false
-if [[ "x$enable_png" = "xyes" ]]; then
-PKG_CHECK_MODULES([PNG], [libpng], [
-		  CPPFLAGS="$PNG_CFLAGS $CPPFLAGS"
-		  LIBS="$PNG_LIBS $LIBS"
-		  have_png=true
-		  AC_DEFINE(HAVE_PNG, 1, [PNG support enabled])]
-)
-fi
-AM_CONDITIONAL(HAVE_PNG, test x$have_png = xtrue)
+dnl Enable Lua.
+AS_IF([test "x$enable_lua" != "xno"],
+      [ have_lua=true
+        AC_DEFINE([HAVE_LUA], [1], [Lua support enabled]) ])
 
-dnl Check for boost/bind
-AC_LANG_PUSH(C++)
-AC_CHECK_HEADER([boost/bind.hpp], , [AC_MSG_ERROR([You need boost/bind.hpp from the boost library to run Aleph One])])
-AC_LANG_POP(C++)
 
-dnl Check for boost/function
-AC_LANG_PUSH(C++)
-AC_CHECK_HEADER([boost/function.hpp], , [AC_MSG_ERROR([You need boost/function.hpp from the boost library to run Aleph One])])
-AC_LANG_POP(C++)
+dnl Check optional packages.
 
-if [[ "x$enable_smpeg" = "xyes" ]]; then
-dnl Check for SMPEG
-AC_CHECK_HEADERS([smpeg/smpeg.h], [
-  AC_CHECK_LIB(smpeg, SMPEG_new, [
-    LIBS="-lsmpeg $LIBS"
-    AC_DEFINE(HAVE_SMPEG, 1, [SMPEG movie playback is enabled])
-  ])
-])
-fi	    
+dnl AX_CHECK_FEATURE_LIB(option, define, header, lib, func)
+AC_DEFUN([AX_CHECK_FEATURE_LIB],
+         [ AS_IF([test "x${with_$1}" != "xno"],
+                 [ AC_CHECK_HEADERS([$3], [AC_CHECK_LIB([$4], [$5])])
+                   AS_IF([test "x${ac_cv_lib_$4_$5}" = "xyes"],
+                         [ have_$1=true
+                           AC_DEFINE([HAVE_$2], [1], [${desc_$1} enabled]) ],
+                         [AS_IF([test "x${with_$1}" = "xyes"],
+                                [AC_MSG_ERROR([${desc_$1} requested but not found])])])
+                 ]) ])
+dnl AX_CHECK_FEATURE_PKG(option, define, package, lib)
+AC_DEFUN([AX_CHECK_FEATURE_PKG],
+         [ AS_IF([test "x${with_$1}" != "xno"],
+                 [ PKG_CHECK_MODULES([$3], [$4],
+                                     [ CPPFLAGS="${[$3]_CFLAGS} $CPPFLAGS"
+                                       LIBS="${[$3]_LIBS} $LIBS"
+                                       have_$1=true
+                                       AC_DEFINE([HAVE_$2], [1], [${desc_$1} enabled]) ],
+                                     [AS_IF([test "x${with_$1}" = "xyes"],
+                                            [AC_MSG_ERROR([${desc_$1} requested but not available])])])
+           
+                 ])
+            AM_CONDITIONAL([HAVE_$2], [test "x${have_$1}" = "xtrue"])
+          ])
 
-if [[ "x$enable_mad" = "xyes" ]]; then
-dnl Check for libmad
-AC_CHECK_HEADERS([mad.h], [
-			  AC_CHECK_LIB(mad, mad_stream_init, [
-			  LIBS="-lmad $LIBS"
-			  AC_DEFINE(HAVE_MAD, 1, [MAD mp3 playback is enabled])
-])
-])
-fi
+AX_CHECK_FEATURE_LIB([sdl_image], [SDL_IMAGE],
+                     [SDL_image.h], [SDL_image], [IMG_Load])
 
-if [[ "x$enable_sndfile" = "xyes" ]]; then
-dnl Check for libsndfile
-AC_CHECK_HEADERS([sndfile.h], [
-			      AC_CHECK_LIB(sndfile, sf_open, [
-			      LIBS="-lsndfile $LIBS"
-			      AC_DEFINE(HAVE_SNDFILE, 1, [libsndfile support is enabled])
-])
-])
-fi
+AX_CHECK_FEATURE_PKG([ffmpeg], [FFMPEG],
+                     [FFMPEG], [libavcodec >= 53.61.100 libavformat >= 53.32.100 libavutil >= 51.35.100 libswscale >= 2.1.1])
 
-if [[ "x$enable_vorbis" = "xyes" ]]; then
-dnl Check for vorbisfile
-PKG_CHECK_MODULES([VORBISFILE], [vorbisfile], [
-			  CPPFLAGS="$VORBISFILE_CFLAGS $CPPFLAGS"
-			  LIBS="$VORBISFILE_LIBS $LIBS"
-			  AC_DEFINE(HAVE_VORBISFILE, 1, [vorbis support enabled])
-])
-fi
+AX_CHECK_FEATURE_LIB([mad], [MAD],
+                     [mad.h], [mad], [mad_stream_init])
 
-if [[ "x$enable_ffmpeg" = "xyes" ]]; then
-dnl Check for libavcodec
-PKG_CHECK_MODULES([FFMPEG], [libavcodec >= 53.61.100 libavformat >= 53.32.100 libavutil >= 51.35.100 libswscale >= 2.1.100], [
-			    CPPFLAGS="$FFMPEG_CFLAGS $CPPFLAGS"
-			    LIBS="$FFMPEG_LIBS $LIBS"
-			    AC_DEFINE(HAVE_FFMPEG, 1, [ffmpeg support enabled])
-			    have_ffmpeg=true
-])
-fi
-AM_CONDITIONAL(HAVE_FFMPEG, test x$have_ffmpeg = xtrue)
+AX_CHECK_FEATURE_LIB([sndfile], [SNDFILE],
+                     [sndfile.h], [sndfile], [sf_open])
 
-if [[ "x$enable_lua" = "xyes" ]]; then
-AC_DEFINE(HAVE_LUA, 1, [Lua support is enabled])
-fi
+AX_CHECK_FEATURE_PKG([vorbis], [VORBISFILE],
+                     [VORBISFILE], [vorbisfile])
 
-if [[ "x$enable_speex" = "xyes" ]]; then
-dnl Check for Speex
-AC_CHECK_HEADERS(speex/speex.h, [
-  AC_CHECK_LIB(speex, speex_decoder_init, [
-    LIBS="-lspeex $LIBS"
-    AC_DEFINE(SPEEX, 1, [Speex support is enabled])
-  ])
-  AC_CHECK_LIB(speexdsp, speex_preprocess_state_init, [
-  LIBS="-lspeexdsp $LIBS"
-])
-])
-fi
+AX_CHECK_FEATURE_LIB([smpeg], [SMPEG],
+                     [smpeg/smpeg.h], [smpeg], [SMPEG_new])
 
-if [[ "x$enable_alsa" = "xyes" ]]; then
-dnl Check for ALSA
-AC_CHECK_HEADERS([alsa/asoundlib.h], [
-  AC_CHECK_LIB(asound, snd_pcm_open, [
-    LIBS="-lasound $LIBS"
-    AC_DEFINE(HAVE_ALSA, 1, [ALSA netmic is enabled])
-  ])
-])
-fi
+AX_CHECK_FEATURE_LIB([speex], [SPEEX],
+                     [speex/speex.h], [speex], [speex_decoder_init])
+AS_IF([test "x$have_speex" = "xyes"],
+      [AC_CHECK_LIB([speexdsp], [speex_preprocess_state_init])])
 
-dnl Figure out which OpenGL library to use
-case "$target" in
-  *-*-cygwin* | *-*-mingw32*)
-    SYS_GL_LIBS="-lGLEW -lopengl32 -lglu32"
-    LIBS="$LIBS -lstdc++"
-    ;;
-  *-*-darwin*)
-    SYS_GL_LIBS="-F/System/Library/Frameworks -framework AGL -framework OpenGL"
-    CPPFLAGS="$CPPFLAGS -D__DARWIN__ -F/System/Library/Frameworks  -I/System/Library/Frameworks/OpenGL.framework/Headers"
-    ;;
-  *-*-linux*)
-    SYS_GL_LIBS="-lGL -lpthread"	
-    ;;	
-  *)
-    SYS_GL_LIBS="-lGL"
-    ;;
-esac
+AX_CHECK_FEATURE_LIB([alsa], [ALSA],
+                     [alsa/asoundlib.h], [asound], [snd_pcm_open])
 
-dnl Check for OpenGL.
-if [[ "x$enable_opengl" = "xyes" ]]; then
-  AC_MSG_CHECKING(for OpenGL support)
-  have_opengl=no
-  AC_TRY_COMPILE([
-   #ifndef __DARWIN__
-   #include <GL/gl.h>
-   #else
-   #include <OpenGL/gl.h>
-   #endif
-  ],[
-  ],[
-  have_opengl=yes
-  ])
-  AC_MSG_RESULT($have_opengl)
-  if test x$have_opengl = xyes; then
-    AC_DEFINE(HAVE_OPENGL, 1, [OpenGL support is enabled])
-    AC_CHECK_LIB(GLU, gluScaleImage, [SYS_GL_LIBS="$SYS_GL_LIBS -lGLU"], , $SYS_GL_LIBS)
-    LIBS="$LIBS $SYS_GL_LIBS"
-    AC_CHECK_HEADERS(GL/glext.h, [], [], [#include <GL/gl.h>])
-    make_opengl=true
-  else
-    AC_MSG_WARN([Could not find OpenGL, ignoring --enable-opengl.])
-    make_opengl=false
-  fi
-fi
-AM_CONDITIONAL(MAKE_OPENGL, test x$make_opengl = xtrue)
+AX_CHECK_FEATURE_PKG([zzip], [ZZIP],
+                     [ZZIP], [zziplib >= 0.10.75])
+AM_CONDITIONAL([BUILD_ZZIP_RWOPS], [test "x$have_zzip" = "xtrue"])
 
-dnl Set target system name.
-AC_DEFINE_UNQUOTED(TARGET_PLATFORM, "$target_os $target_cpu", [Target platform name])
+AX_CHECK_FEATURE_PKG([png], [PNG],
+                     [PNG], [libpng])
 
-dnl add some windows goodies
-case $target in
-*-*-mingw32*)
-	make_windows=true
-	AC_DEFINE(WIN32_DISABLE_MUSIC, 1, [Win32 music is disabled])
-	LIBS="$LIBS -ldsound -lwsock32"
-	;;
-*)
-	make_windows=false ;;
-esac
-AM_CONDITIONAL(MAKE_WINDOWS, test x$make_windows = xtrue)
 
-
 dnl Generate Makefiles.
 AC_CONFIG_FILES([
 Makefile
@@ -321,5 +249,32 @@
 ])
 AC_OUTPUT
 
-dnl Print summary.
-echo "Configuration done. Now type \"make\"."
+dnl Print summary of enabled/disabled options.
+
+dnl AX_PRINT_SUMMARY(option)
+AC_DEFUN([AX_PRINT_SUMMARY],
+         [ AS_IF([test "x${have_$1}" = "xtrue"],
+                 [AS_ECHO(["    Enabled: ${desc_$1}"])],
+                 [test "x${enable_$1}" = "xno" ||
+                  test "x${with_$1}" = "xno"],
+                 [AS_ECHO(["   Disabled: ${desc_$1}"])],
+                 [AS_ECHO(["  Not found: ${desc_$1}"])])
+         ])
+
+AS_ECHO([""])
+AS_ECHO(["Summary of optional features:"])
+AS_ECHO([""])
+AX_PRINT_SUMMARY([opengl])
+AX_PRINT_SUMMARY([lua])
+AX_PRINT_SUMMARY([sdl_image])
+AX_PRINT_SUMMARY([ffmpeg])
+AX_PRINT_SUMMARY([mad])
+AX_PRINT_SUMMARY([sndfile])
+AX_PRINT_SUMMARY([vorbis])
+AX_PRINT_SUMMARY([smpeg])
+AX_PRINT_SUMMARY([speex])
+AX_PRINT_SUMMARY([alsa])
+AX_PRINT_SUMMARY([zzip])
+AX_PRINT_SUMMARY([png])
+AS_ECHO([""])
+AS_ECHO(["Configuration done. Now type \"make\"."])