/
configure.in
763 lines (707 loc) · 27.8 KB
1
dnl Process this file with autoconf to produce a configure script.
2
AC_INIT(README.txt)
3
AC_CONFIG_AUX_DIR(build-scripts)
4
5
6
7
8
9
10
11
12
13
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.
14
#
15
16
MAJOR_VERSION=2
MINOR_VERSION=0
17
18
19
MICRO_VERSION=2
INTERFACE_AGE=0
BINARY_AGE=2
20
21
22
23
24
25
26
27
28
29
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
30
31
LT_INIT([win32-dll])
32
33
34
35
LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION
LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE`
LT_REVISION=$INTERFACE_AGE
LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE`
36
m4_pattern_allow([^LT_])
37
38
39
40
41
42
AC_SUBST(LT_RELEASE)
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)
43
dnl Detect the canonical build and host environments
44
AC_CONFIG_AUX_DIRS($srcdir/build-scripts)
45
dnl AC_CANONICAL_HOST
46
47
48
49
50
51
52
53
54
55
56
57
58
dnl Check for tools
AC_PROG_LIBTOOL
AC_PROG_CC
AC_PROG_INSTALL
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])
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
dnl Set up the compiler and linker flags
case "$host" in
*-*-cygwin*)
# We build SDL on cygwin without the UNIX emulation layer
BASE_CFLAGS="-I/usr/include/mingw -mno-cygwin"
BASE_LDFLAGS="-mno-cygwin"
;;
*)
BASE_CFLAGS="-D_GNU_SOURCE=1"
BASE_LDFLAGS=""
;;
esac
BUILD_CFLAGS="$CFLAGS $CPPFLAGS"
EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS"
BUILD_LDFLAGS="$LDFLAGS"
EXTRA_LDFLAGS="$BASE_LDFLAGS"
75
76
77
78
79
80
81
82
83
## These are common directories to find software packages
#for path in /usr/freeware /usr/pkg /usr/local; do
# if test -d $path/include; then
# EXTRA_CFLAGS="$EXTRA_CFLAGS -I$path/include"
# fi
# if test -d $path/lib; then
# EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$path/lib"
# fi
#done
84
85
86
CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS"
CFLAGS="$CFLAGS $EXTRA_CFLAGS"
LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
87
88
89
dnl Check for compiler characteristics
AC_C_CONST
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
dnl See whether we can use gcc style dependency tracking
AC_ARG_ENABLE(dependency-tracking,
AC_HELP_STRING([--enable-dependency-tracking],
[Use gcc -MMD -MT dependency tracking [[default=yes]]]),
, enable_dependency_tracking=yes)
if test x$enable_dependency_tracking = xyes; then
have_gcc_mmd_mt=no
AC_MSG_CHECKING(for GCC -MMD -MT option)
AC_TRY_COMPILE([
#if !defined(__GNUC__) || __GNUC__ < 3
#error Dependency tracking requires GCC 3.0 or newer
#endif
],[
],[
have_gcc_mmd_mt=yes
])
AC_MSG_RESULT($have_gcc_mmd_mt)
if test x$have_gcc_mmd_mt = xyes; then
DEPENDENCY_TRACKING_OPTIONS="-MMD -MT \$@"
fi
fi
114
case "$host" in
115
116
117
*mingw32ce*)
#VERSION_SOURCES="$srcdir/version.rc"
EXE=".exe"
118
;;
119
*-*-cygwin* | *-*-mingw32*)
120
VERSION_SOURCES="$srcdir/version.rc"
121
EXE=".exe"
122
123
if test "$build" != "$host"; then # cross-compiling
# Default cross-compile location
124
ac_default_prefix=/usr/local/cross-tools/$host
125
126
127
128
129
130
else
# Look for the location of the tools and install there
if test "$BUILD_PREFIX" != ""; then
ac_default_prefix=$BUILD_PREFIX
fi
fi
131
;;
132
133
*)
EXE=""
134
;;
135
136
esac
137
# Standard C sources
138
SOURCES=`ls $srcdir/*.c | fgrep -v playwave.c | fgrep -v playmus.c`
139
140
141
142
dnl set this to use on systems that use lib64 instead of lib
base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
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
dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
dnl Details of this flag are here: http://gcc.gnu.org/wiki/Visibility
CheckVisibilityHidden()
{
AC_MSG_CHECKING(for GCC -fvisibility=hidden option)
have_gcc_fvisibility=no
visibility_CFLAGS="-fvisibility=hidden"
save_CFLAGS="$CFLAGS"
CFLAGS="$save_CFLAGS $visibility_CFLAGS -Werror"
AC_TRY_COMPILE([
#if !defined(__GNUC__) || __GNUC__ < 4
#error SDL only uses visibility attributes in GCC 4 or newer
#endif
],[
],[
have_gcc_fvisibility=yes
])
AC_MSG_RESULT($have_gcc_fvisibility)
CFLAGS="$save_CFLAGS"
if test x$have_gcc_fvisibility = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS $visibility_CFLAGS"
fi
}
170
dnl Function to find a library in the compiler search path
171
172
find_lib()
{
173
174
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'`]
175
env_lib_path=[`echo $LIBS $LDFLAGS $* | sed 's/-L[ ]*//g'`]
176
177
178
if test "$cross_compiling" = yes; then
host_lib_path=""
else
179
host_lib_path="/usr/$base_libdir /usr/local/$base_libdir"
180
fi
181
for path in $env_lib_path $gcc_bin_path $gcc_lib_path $host_lib_path; do
182
lib=[`ls -- $path/$1 2>/dev/null | sed -e '/\.so\..*\./d' -e 's,.*/,,' | sort | tail -1`]
183
184
185
186
187
188
189
if test x$lib != x; then
echo $lib
return
fi
done
}
190
dnl Check for SDL
191
SDL_VERSION=2.0.7
192
AM_PATH_SDL2($SDL_VERSION,
193
:,
194
AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
195
)
196
197
EXTRA_CFLAGS="$EXTRA_CFLAGS $SDL_CFLAGS"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SDL_LIBS"
198
199
200
201
dnl Check for math library
AC_CHECK_LIB(m, pow, [LIBM="-lm"])
202
203
204
AC_CHECK_HEADERS([signal.h], [EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_SIGNAL_H"])
AC_CHECK_FUNCS(setbuf, [EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_SETBUF"])
205
dnl Check command-line options
206
207
208
CheckVisibilityHidden
209
210
AC_ARG_ENABLE([music-cmd],
AC_HELP_STRING([--enable-music-cmd], [support an external music player [[default=yes]]]),
211
212
213
214
215
216
217
218
219
220
221
222
223
[], [enable_music_cmd=detect])
if test "x$enable_music_cmd" != xno; then
AC_CHECK_FUNCS([fork vfork])
if test "x$ac_cv_func_fork" = "xyes"; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_FORK"
elif test "x$ac_cv_func_vfork" = "xyes"; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_VFORK"
elif test "x$enable_music_cmd" = "xyes"; then
AC_MSG_ERROR([external music player not available on your platform])
else
enable_music_cmd=no
fi
if test "x$enable_music_cmd" != xno; then
224
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_CMD"
225
fi
226
fi
227
228
229
230
AC_ARG_ENABLE([music-wave],
AC_HELP_STRING([--enable-music-wave], [enable streaming WAVE music [[default=yes]]]),
[], [enable_music_wave=yes])
231
if test x$enable_music_wave = xyes; then
232
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_WAV"
233
fi
234
235
AC_ARG_ENABLE([music-mod],
236
AC_HELP_STRING([--enable-music-mod], [enable MOD music [[default=yes]]]),
237
[], [enable_music_mod=yes])
238
239
240
241
242
243
244
245
246
247
248
249
AC_ARG_ENABLE([music-mod-modplug],
AC_HELP_STRING([--enable-music-mod-modplug], [enable MOD music via modplug [[default=yes]]]),
[], [enable_music_mod_modplug=yes])
AC_ARG_ENABLE([music-mod-modplug-shared],
AC_HELP_STRING([--enable-music-mod-modplug-shared], [dynamically load modplug library [[default=yes]]]),
[], [enable_music_mod_modplug_shared=yes])
if test x$enable_music_mod = xyes -a x$enable_music_mod_modplug = xyes; then
PKG_CHECK_MODULES([MODPLUG], [libmodplug >= 0.8.8], [dnl
have_libmodplug_hdr=yes
have_libmodplug_lib=yes
], [dnl
250
AC_CHECK_HEADER([libmodplug/modplug.h], [have_libmodplug_hdr=yes])
251
AC_CHECK_LIB([modplug], [ModPlug_Load], [have_libmodplug_lib=yes])
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
])
if test x$have_libmodplug_hdr = xyes -a x$have_libmodplug_lib = xyes; then
have_libmodplug=yes
case "$host" in
*-*-darwin*)
modplug_lib=[`find_lib libmodplug.dylib`]
;;
*-*-cygwin* | *-*-mingw32*)
modplug_lib=[`find_lib "libmodplug*.dll"`]
;;
*)
modplug_lib=[`find_lib "libmodplug[0-9]*.so.*"`]
if test x$modplug_lib = x; then
modplug_lib=[`find_lib "libmodplug.so.*"`]
fi
;;
esac
270
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MOD_MODPLUG $MODPLUG_CFLAGS"
271
272
273
274
if test x$enable_music_mod_modplug_shared = xyes && test x$modplug_lib != x; then
echo "-- dynamic libmodplug -> $modplug_lib"
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMODPLUG_DYNAMIC=\\\"$modplug_lib\\\""
else
275
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MODPLUG_LIBS"
276
277
278
279
280
281
282
283
284
285
286
287
288
fi
else
AC_MSG_WARN([*** Unable to find ModPlug library (http://modplug-xmms.sourceforge.net/)])
fi
fi
AC_ARG_ENABLE([music-mod-mikmod],
AC_HELP_STRING([--enable-music-mod-mikmod], [enable MOD music via mikmod [[default=no]]]),
[], [enable_music_mod_mikmod=no])
AC_ARG_ENABLE([music-mod-mikmod-shared],
AC_HELP_STRING([--enable-music-mod-mikmod-shared], [dynamically load mikmod library [[default=yes]]]),
[], [enable_music_mod_mikmod_shared=yes])
if test x$enable_music_mod = xyes -a x$enable_music_mod_mikmod = xyes; then
289
290
291
292
293
have_libmikmod=no
libmikmod_maj=3
libmikmod_min=1
libmikmod_rev=10
libmikmod_ver="$libmikmod_maj.$libmikmod_min.$libmikmod_rev"
294
295
AC_PATH_PROG(LIBMIKMOD_CONFIG, libmikmod-config, no, [$PATH])
if test "$LIBMIKMOD_CONFIG" != "no" ; then
296
297
298
CFLAGS_SAVED="$CFLAGS"
LIBS_SAVED="$LIBS"
299
CFLAGS="$CFLAGS `$LIBMIKMOD_CONFIG --cflags`"
300
LIBS="$LIBS `$LIBMIKMOD_CONFIG --libs`"
301
have_libmikmod=yes
302
303
AC_MSG_CHECKING([for libmikmod - version >= $libmikmod_ver])
AC_TRY_RUN([
304
305
306
307
308
#include "mikmod.h"
#include "stdio.h"
int main(int argc, char **argv)
{
309
310
311
312
313
314
315
316
long maj=$libmikmod_maj,min=$libmikmod_min,rev=$libmikmod_rev,ver=MikMod_GetVersion();
/*printf("(%d.%d.%d) ",ver>>16,(ver>>8)&0xff,ver&0xff);*/
if(ver>=((maj<<16)|(min<<8)|(rev))) {
printf("yes\n");
return 0;
}
printf("no\n*** libmikmod is older than %d.%d.%d, not using.\n",maj,min,rev);
return 1;
317
}
318
319
], [], have_libmikmod=no; CFLAGS="$CFLAGS_SAVED"; LIBS="$LIBS_SAVED",
[echo $ac_n "cross compiling; assumed OK... $ac_c"])
320
fi
321
322
323
324
if test x$have_libmikmod = xyes; then
case "$host" in
*-*-darwin*)
325
mikmod_lib=[`find_lib libmikmod.dylib`]
326
327
;;
*-*-cygwin* | *-*-mingw32*)
328
mikmod_lib=[`find_lib "libmikmod*.dll"`]
329
330
;;
*)
331
mikmod_lib=[`find_lib "libmikmod[0-9]*.so.*"`]
332
if test x$mikmod_lib = x; then
333
mikmod_lib=[`find_lib "libmikmod.so.*"`]
334
335
336
fi
;;
esac
337
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MOD_MIKMOD `$LIBMIKMOD_CONFIG --cflags`"
338
if test x$enable_music_mod_mikmod_shared = xyes && test x$mikmod_lib != x; then
339
echo "-- dynamic libmikmod -> $mikmod_lib"
340
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMIKMOD_DYNAMIC=\\\"$mikmod_lib\\\""
341
342
343
else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$LIBMIKMOD_CONFIG --libs`"
fi
344
else
345
AC_MSG_WARN([*** Unable to find MikMod library (http://mikmod.raphnet.net/)])
346
fi
347
fi
348
349
if test x$have_libmodplug != xyes -a x$have_libmikmod != xyes ; then
350
AC_MSG_WARN([MOD support disabled])
351
352
fi
353
AC_ARG_ENABLE([music-midi],
354
AC_HELP_STRING([--enable-music-midi], [enable MIDI music [[default=yes]]]),
355
[], [enable_music_midi=yes])
356
if test x$enable_music_midi = xyes; then
357
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MID"
358
359
360
361
AC_ARG_ENABLE([music-midi-timidity],
AC_HELP_STRING([--enable-music-midi-timidity], [enable timidity MIDI output [[default=yes]]]),
[], [enable_music_midi_timidity=yes])
if test x$enable_music_midi_timidity = xyes; then
362
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MID_TIMIDITY -I\$(srcdir)/timidity"
363
SOURCES="$SOURCES $srcdir/timidity/*.c"
364
fi
365
366
367
368
369
AC_ARG_ENABLE([music-midi-native],
AC_HELP_STRING([--enable-music-midi-native], [enable native MIDI music output [[default=yes]]]),
[], [enable_music_midi_native=yes])
if test x$enable_music_midi_native = xyes; then
use_music_midi_native=no
370
case "$host" in
371
*mingw32ce*)
372
use_music_midi_native=no
373
;;
374
*-*-cygwin* | *-*-mingw32*)
375
use_music_midi_native=yes
376
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lwinmm"
377
;;
378
*-*-darwin*)
379
use_music_midi_native=yes
380
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit -Wl,-framework,CoreServices"
381
;;
382
*-*-haiku*)
383
use_music_midi_native=yes_cpp
384
385
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmidi"
;;
386
esac
387
if test x$use_music_midi_native = xyes; then
388
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MID_NATIVE -I\$(srcdir)/native_midi"
389
SOURCES="$SOURCES $srcdir/native_midi/*.c"
390
elif test x$use_music_midi_native = xyes_cpp; then
391
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MID_NATIVE -I\$(srcdir)/native_midi"
392
393
SOURCES="$SOURCES $srcdir/native_midi/*.c"
SOURCES_CXX="$SOURCES_CXX $srcdir/native_midi/*.cpp"
394
395
fi
fi
396
397
398
AC_ARG_ENABLE([music-midi-fluidsynth],
AC_HELP_STRING([--enable-music-midi-fluidsynth], [enable FluidSynth MIDI output [[default=yes]]]),
[], [enable_music_midi_fluidsynth=yes])
399
AC_ARG_ENABLE([music-midi-fluidsynth-shared],
400
401
402
AC_HELP_STRING([--enable-music-midi-fluidsynth-shared], [dynamically load FluidSynth library [[default=yes]]]),
[], [enable_music_midi_fluidsynth_shared=yes])
if test x$enable_music_midi_fluidsynth = xyes; then
403
404
405
AC_CHECK_HEADER([fluidsynth.h], [have_fluidsynth_hdr=yes])
AC_CHECK_LIB([fluidsynth], [fluid_player_add_mem], [have_fluidsynth_lib=yes])
if test x$have_fluidsynth_hdr = xyes -a x$have_fluidsynth_lib = xyes; then
406
have_fluidsynth=yes
407
408
409
410
411
412
413
414
case "$host" in
*-*-darwin*)
fluidsynth_lib=[`find_lib libfluidsynth.dylib`]
;;
*-*-cygwin* | *-*-mingw32*)
fluidsynth_lib=[`find_lib "fluidsynth*.dll"`]
;;
*)
415
fluidsynth_lib=[`find_lib "libfluidsynth[0-9]*.so.*"`]
416
if test x$fluidsynth_lib = x; then
417
fluidsynth_lib=[`find_lib "libfluidsynth.so.*"`]
418
419
420
fi
;;
esac
421
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MID_FLUIDSYNTH"
422
if test x$enable_music_midi_fluidsynth_shared = xyes && test x$fluidsynth_lib != x; then
423
echo "-- dynamic libfluidsynth -> $fluidsynth_lib"
424
425
426
427
428
429
430
431
432
EXTRA_CFLAGS="$EXTRA_CFLAGS -DFLUIDSYNTH_DYNAMIC=\\\"$fluidsynth_lib\\\""
else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lfluidsynth"
fi
else
AC_MSG_WARN([*** Unable to find FluidSynth library (http://www.fluidsynth.org/)])
AC_MSG_WARN([FluidSynth support disabled])
fi
fi
433
fi
434
435
436
437
if test x$enable_music_midi_timidity != xyes -a \
x$use_music_midi_native != xyes -a x$use_music_midi_native != xyes_cpp -a \
x$have_fluidsynth != xyes; then
438
AC_MSG_WARN([MIDI support disabled])
439
440
fi
441
442
443
AC_ARG_ENABLE([music-ogg],
AC_HELP_STRING([--enable-music-ogg], [enable Ogg Vorbis music [[default=yes]]]),
[], [enable_music_ogg=yes])
444
AC_ARG_ENABLE(music-ogg-tremor,
445
AC_HELP_STRING([--enable-music-ogg-tremor], [enable OGG Vorbis music via libtremor [[default=no]]]),
446
447
[], enable_music_ogg_tremor=no)
AC_ARG_ENABLE([music-ogg-shared],
448
AC_HELP_STRING([--enable-music-ogg-shared], [dynamically load Ogg Vorbis library [[default=yes]]]),
449
450
451
452
[], [enable_music_ogg_shared=yes])
if test x$enable_music_ogg = xyes; then
if test x$enable_music_ogg_tremor = xyes; then
AC_CHECK_HEADER([tremor/ivorbisfile.h], [have_tremor_hdr=yes])
453
AC_CHECK_LIB([vorbisidec -logg], [ov_open_callbacks], [have_tremor_lib=yes])
454
455
456
if test x$have_tremor_hdr = xyes -a x$have_tremor_lib = xyes; then
case "$host" in
*-*-darwin*)
457
ogg_lib=[`find_lib libvorbisidec.dylib`]
458
459
;;
*-*-cygwin* | *-*-mingw32*)
460
ogg_lib=[`find_lib "vorbisidec*.dll"`]
461
462
;;
*)
463
ogg_lib=[`find_lib "libvorbisidec[0-9]*.so.*"`]
464
if test x$ogg_lib = x; then
465
ogg_lib=[`find_lib "libvorbisidec.so.*"`]
466
467
468
fi
;;
esac
469
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_OGG -DOGG_USE_TREMOR"
470
471
472
473
if test x$enable_music_ogg_shared = xyes && test x$ogg_lib != x; then
echo "-- dynamic libvorbisidec -> $ogg_lib"
EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_DYNAMIC=\\\"$ogg_lib\\\""
else
474
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisidec -lvorbis"
475
fi
476
477
478
else
AC_MSG_WARN([*** Unable to find Ogg Vorbis Tremor library (http://www.xiph.org/)])
AC_MSG_WARN([Ogg Vorbis support disabled])
479
480
481
fi
else
AC_CHECK_HEADER([vorbis/vorbisfile.h], [have_ogg_hdr=yes])
482
AC_CHECK_LIB([vorbisfile -lvorbis -logg -lm], [ov_open_callbacks], [have_ogg_lib=yes])
483
484
485
if test x$have_ogg_hdr = xyes -a x$have_ogg_lib = xyes; then
case "$host" in
*-*-darwin*)
486
ogg_lib=[`find_lib libvorbisfile.dylib`]
487
488
;;
*-*-cygwin* | *-*-mingw32*)
489
ogg_lib=[`find_lib "libvorbisfile*.dll"`]
490
491
;;
*)
492
ogg_lib=[`find_lib "libvorbisfile[0-9]*.so.*"`]
493
if test x$ogg_lib = x; then
494
ogg_lib=[`find_lib "libvorbisfile.so.*"`]
495
496
497
fi
;;
esac
498
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_OGG"
499
500
501
502
if test x$enable_music_ogg_shared = xyes && test x$ogg_lib != x; then
echo "-- dynamic libvorbisfile -> $ogg_lib"
EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_DYNAMIC=\\\"$ogg_lib\\\""
else
503
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisfile -lvorbis"
504
fi
505
506
507
else
AC_MSG_WARN([*** Unable to find Ogg Vorbis library (http://www.xiph.org/)])
AC_MSG_WARN([Ogg Vorbis support disabled])
508
fi
509
510
fi
fi
511
512
libflac_ver=8
513
514
515
516
517
AC_ARG_ENABLE([music-flac],
AC_HELP_STRING([--enable-music-flac], [enable FLAC music [[default=yes]]]),
[], [enable_music_flac=yes])
AC_ARG_ENABLE([music-flac-shared],
AC_HELP_STRING([--enable-music-flac-shared],
518
[dynamically load FLAC library [[default=yes]]]),
519
520
[], [enable_music_flac_shared=yes])
if test x$enable_music_flac = xyes; then
521
522
523
524
525
AC_CHECK_HEADER([FLAC/export.h], [have_flac_export=yes])
if test x$have_flac_export = xyes; then
LIBS_SAVED="$LIBS"
LIBS="-lFLAC"
AC_MSG_CHECKING([for libflac so-name version >= $libflac_ver])
526
AC_TRY_COMPILE([
527
528
#include "FLAC/export.h"
#include "stdio.h"
529
],[
530
531
#if defined(FLAC_API_VERSION_CURRENT) && (FLAC_API_VERSION_CURRENT >= $libflac_ver)
#else
532
#error "old-flac"
533
534
#endif
], have_flac_ver=yes, have_flac_ver=no)
535
536
537
538
539
540
541
542
543
544
LIBS="$LIBS_SAVED"
AC_MSG_RESULT($have_flac_ver)
fi
if test x$have_flac_ver = xyes; then
AC_CHECK_HEADER([FLAC/stream_decoder.h], [have_flac_hdr=yes])
AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_new], [have_flac_lib=yes])
if test x$have_flac_hdr = xyes -a x$have_flac_lib = xyes; then
case "$host" in
*-*-darwin*)
545
flac_lib=[`find_lib libFLAC.dylib`]
546
547
;;
*-*-cygwin* | *-*-mingw32*)
548
flac_lib=[`find_lib "libFLAC-*.dll"`]
549
550
;;
*)
551
flac_lib=[`find_lib "libFLAC[0-9]*.so.*"`]
552
if test x$flac_lib = x; then
553
flac_lib=[`find_lib "libFLAC.so.*"`]
554
555
556
fi
;;
esac
557
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_FLAC"
558
559
560
561
562
563
564
565
566
567
568
if test x$enable_music_flac_shared = xyes && test x$flac_lib != x; then
echo "-- dynamic libFLAC -> $flac_lib"
EXTRA_CFLAGS="$EXTRA_CFLAGS -DFLAC_DYNAMIC=\\\"$flac_lib\\\""
else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lFLAC"
fi
fi
else
AC_MSG_WARN([*** Unable to find FLAC library (http://flac.sourceforge.net/)])
AC_MSG_WARN([FLAC support disabled])
fi
569
fi
570
571
AC_ARG_ENABLE(music-mp3,
572
AC_HELP_STRING([--enable-music-mp3], [enable MP3 music [[default=yes]]]),
573
[], enable_music_mp3=yes)
574
575
AC_ARG_ENABLE(music-mp3-smpeg,
576
577
AC_HELP_STRING([--enable-music-mp3-smpeg], [enable MP3 music via smpeg [[default=no]]]),
[], enable_music_mp3_smpeg=no)
578
579
580
581
AC_ARG_ENABLE([music-mp3-smpeg-shared],
AC_HELP_STRING([--enable-music-mp3-smpeg-shared], [dynamically load smpeg library [[default=yes]]]),
[], [enable_music_mp3_smpeg_shared=yes])
if test x$enable_music_mp3 = xyes -a x$enable_music_mp3_smpeg = xyes; then
582
583
SMPEG_VERSION=2.0.0
AM_PATH_SMPEG2($SMPEG_VERSION, have_smpeg=yes, have_smpeg=no)
584
if test x$have_smpeg = xyes; then
585
586
case "$host" in
*-*-darwin*)
587
smpeg_lib=[`find_lib libsmpeg2.dylib`]
588
589
;;
*-*-cygwin* | *-*-mingw32*)
590
smpeg_lib=[`find_lib "smpeg2*.dll"`]
591
592
;;
*)
593
smpeg_lib=[`find_lib "libsmpeg2*.so.*"`]
594
595
;;
esac
596
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_SMPEG $SMPEG_CFLAGS"
597
if test x$enable_music_mp3_smpeg_shared = xyes && test x$smpeg_lib != x; then
598
echo "-- dynamic libsmpeg -> $smpeg_lib"
599
EXTRA_CFLAGS="$EXTRA_CFLAGS -DSMPEG_DYNAMIC=\\\"$smpeg_lib\\\""
600
601
602
else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SMPEG_LIBS"
fi
603
604
else
AC_MSG_WARN([*** Unable to find SMPEG library (http://icculus.org/smpeg/)])
605
606
fi
fi
607
608
609
610
AC_ARG_ENABLE(music-mp3-mad-gpl,
AC_HELP_STRING([--enable-music-mp3-mad-gpl], [enable MP3 music via libmad GPL code [[default=no]]]),
[], [enable_music_mp3_mad_gpl=no])
611
612
613
AC_ARG_ENABLE(music-mp3-mad-gpl-dithering,
AC_HELP_STRING([--enable-music-mp3-mad-gpl-dithering], [enable MP3 music via libmad GPL code [[default=yes]]]),
[], [enable_music_mp3_mad_gpl_dithering=yes])
614
if test x$enable_music_mp3 = xyes -a x$enable_music_mp3_mad_gpl = xyes; then
615
616
617
618
619
620
621
622
623
624
AC_MSG_CHECKING(for libmad headers)
have_libmad=no
AC_TRY_COMPILE([
#include "mad.h"
],[
],[
have_libmad=yes
])
AC_MSG_RESULT($have_libmad)
if test x$have_libmad = xyes; then
625
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_MAD"
626
627
628
629
if test x$enable_music_mp3_mad_gpl_dithering = xyes; then
AC_MSG_WARN([*** Using GPL libmad and MP3 dithering routines, this build of SDL_mixer is now under the GPL])
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_MAD_GPL_DITHERING"
fi
630
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmad"
631
632
else
AC_MSG_WARN([*** Unable to find MAD library (http://www.underbit.com/products/mad/)])
633
634
fi
fi
635
636
AC_ARG_ENABLE(music-mp3-mpg123,
637
638
639
640
641
642
643
AC_HELP_STRING([--enable-music-mp3-mpg123], [enable MP3 music via libmpg123 [[default=yes]]]),
[], [enable_music_mp3_mpg123=yes])
AC_ARG_ENABLE([music-mp3-mpg123-shared],
AC_HELP_STRING([--enable-music-mp3-mpg123-shared], [dynamically load libmpg123 library [[default=yes]]]),
[], [enable_music_mp3_mpg123_shared=yes])
if test x$enable_music_mp3_mpg123 = xyes; then
AC_CHECK_HEADER([mpg123.h], [have_mpg123_hdr=yes])
644
AC_CHECK_LIB([mpg123], [mpg123_replace_reader_handle], [have_mpg123_lib=yes])
645
646
647
648
649
650
651
652
653
654
655
656
657
if test x$have_mpg123_hdr = xyes -a x$have_mpg123_lib = xyes; then
have_mpg123=yes
case "$host" in
*-*-darwin*)
mpg123_lib=[`find_lib libmpg123.dylib`]
;;
*-*-cygwin* | *-*-mingw32*)
mpg123_lib=[`find_lib "libmpg123*.dll"`]
;;
*)
mpg123_lib=[`find_lib "libmpg123.so.*"`]
;;
esac
658
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_MPG123"
659
660
661
662
663
664
if test x$enable_music_mp3_mpg123_shared = xyes && test x$mpg123_lib != x; then
echo "-- dynamic libmpg123 -> $mpg123_lib"
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMPG123_DYNAMIC=\\\"$mpg123_lib\\\""
else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmpg123"
fi
665
666
else
AC_MSG_WARN([*** Unable to find mpg123 library (https://www.mpg123.de)])
667
AC_MSG_WARN([mpg123 support disabled])
668
669
670
671
fi
fi
if test x$have_smpeg = xyes -o x$have_libmad = xyes -o x$have_libmpg123; then
672
:
673
else
674
675
676
AC_MSG_WARN([MP3 support disabled])
fi
677
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBM"
678
679
680
681
682
683
OBJECTS=`echo $SOURCES`
DEPENDS=`echo $SOURCES`
OBJECTS=`echo "$OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
DEPENDS=`echo "$DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.c,\\
$(objects)/\2.lo: \1/\2.c\\
684
\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) '"$DEPENDENCY_TRACKING_OPTIONS"' -c \$< -o \$@,g'`
685
686
687
688
689
690
691
692
693
OBJECTS_CXX=`echo $SOURCES_CXX`
DEPENDS_CXX=`echo $SOURCES_CXX`
OBJECTS_CXX=`echo "$OBJECTS_CXX" | sed 's,[[^ ]]*/\([[^ ]]*\)\.cpp,$(objects)/\1.lo,g'`
DEPENDS_CXX=`echo "$DEPENDS_CXX" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.cpp,\\
$(objects)/\2.lo: \1/\2.cpp\\
\$(LIBTOOL) --mode=compile \$(CXX) \$(CFLAGS) \$(EXTRA_CFLAGS) '"$DEPENDENCY_TRACKING_OPTIONS"' -c \$< -o \$@,g'`
OBJECTS="$OBJECTS $OBJECTS_CXX"
DEPENDS="$DEPENDS $DEPENDS_CXX"
694
DEPENDS=`echo "$DEPENDS" | sed 's,\\$,\\\\$,g'`
695
696
697
698
699
700
701
VERSION_OBJECTS=`echo $VERSION_SOURCES`
VERSION_DEPENDS=`echo $VERSION_SOURCES`
VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.rc,\\
$(objects)/\2.o: \1/\2.rc\\
\$(WINDRES) \$< \$@,g'`
702
VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed 's,\\$,\\\\$,g'`
703
704
705
706
707
708
709
PLAYWAVE_SOURCES="$srcdir/playwave.c"
PLAYWAVE_OBJECTS=`echo $PLAYWAVE_SOURCES`
PLAYWAVE_DEPENDS=`echo $PLAYWAVE_SOURCES`
PLAYWAVE_OBJECTS=`echo "$PLAYWAVE_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
PLAYWAVE_DEPENDS=`echo "$PLAYWAVE_DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.c,\\
$(objects)/\2.lo: \1/\2.c\\
710
\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) '"$DEPENDENCY_TRACKING_OPTIONS"' -c \$< -o \$@,g'`
711
PLAYWAVE_DEPENDS=`echo "$PLAYWAVE_DEPENDS" | sed 's,\\$,\\\\$,g'`
712
713
714
715
716
717
718
PLAYMUS_SOURCES="$srcdir/playmus.c"
PLAYMUS_OBJECTS=`echo $PLAYMUS_SOURCES`
PLAYMUS_DEPENDS=`echo $PLAYMUS_SOURCES`
PLAYMUS_OBJECTS=`echo "$PLAYMUS_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
PLAYMUS_DEPENDS=`echo "$PLAYMUS_DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.c,\\
$(objects)/\2.lo: \1/\2.c\\
719
\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) '"$DEPENDENCY_TRACKING_OPTIONS"' -c \$< -o \$@,g'`
720
PLAYMUS_DEPENDS=`echo "$PLAYMUS_DEPENDS" | sed 's,\\$,\\\\$,g'`
721
722
723
724
dnl Expand the sources and objects needed to build the library
AC_SUBST(ac_aux_dir)
AC_SUBST(OBJECTS)
725
726
727
AC_SUBST(VERSION_OBJECTS)
AC_SUBST(PLAYWAVE_OBJECTS)
AC_SUBST(PLAYMUS_OBJECTS)
728
729
730
731
732
AC_SUBST(BUILD_CFLAGS)
AC_SUBST(EXTRA_CFLAGS)
AC_SUBST(BUILD_LDFLAGS)
AC_SUBST(EXTRA_LDFLAGS)
AC_SUBST(EXE)
733
AC_SUBST(WINDRES)
734
AC_SUBST(SDL_VERSION)
735
736
AC_SUBST(SDL_CFLAGS)
AC_SUBST(SDL_LIBS)
737
738
AC_OUTPUT([
739
740
])
AC_CONFIG_FILES([
741
Makefile SDL2_mixer.spec SDL2_mixer.pc
742
])
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
AC_CONFIG_COMMANDS([default],
[cat >>Makefile <<__EOF__
# Build rules for objects
-include \$(OBJECTS:.lo=.d)
$DEPENDS
$VERSION_DEPENDS
-include \$(PLAYWAVE_OBJECTS:.lo=.d)
$PLAYWAVE_DEPENDS
-include \$(PLAYMUS_OBJECTS:.lo=.d)
$PLAYMUS_DEPENDS
__EOF__
], [
DEPENDS="$DEPENDS"
VERSION_DEPENDS="$VERSION_DEPENDS"
PLAYWAVE_DEPENDS="$PLAYWAVE_DEPENDS"
PLAYMUS_DEPENDS="$PLAYMUS_DEPENDS"
])
AC_OUTPUT