This repository has been archived by the owner on Feb 11, 2021. It is now read-only.
/
configure.in
2462 lines (2303 loc) · 87.7 KB
1
2
dnl Process this file with autoconf to produce a configure script.
AC_INIT(README)
3
AC_CONFIG_HEADER(include/SDL_config.h)
4
AC_GNU_SOURCE
5
AC_CONFIG_AUX_DIRS($srcdir/build-scripts)
6
7
8
9
dnl Save the CFLAGS to see whether they were passed in or generated
orig_CFLAGS="$CFLAGS"
10
11
12
13
14
15
16
17
18
19
20
21
dnl Set various version strings - taken gratefully from the GTk sources
#
# Making releases:
# Edit include/SDL/SDL_version.h and change the version, then:
# SDL_MICRO_VERSION += 1;
# SDL_INTERFACE_AGE += 1;
# SDL_BINARY_AGE += 1;
# if any functions have been added, set SDL_INTERFACE_AGE to 0.
# if backwards compatibility has been broken,
# set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0.
#
SDL_MAJOR_VERSION=1
22
23
SDL_MINOR_VERSION=3
SDL_MICRO_VERSION=0
24
SDL_INTERFACE_AGE=0
25
SDL_BINARY_AGE=0
26
27
28
29
30
31
32
33
34
35
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
AC_SUBST(SDL_MAJOR_VERSION)
AC_SUBST(SDL_MINOR_VERSION)
AC_SUBST(SDL_MICRO_VERSION)
AC_SUBST(SDL_INTERFACE_AGE)
AC_SUBST(SDL_BINARY_AGE)
AC_SUBST(SDL_VERSION)
# libtool versioning
36
37
LT_INIT([win32-dll])
38
39
40
41
LT_RELEASE=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION
LT_CURRENT=`expr $SDL_MICRO_VERSION - $SDL_INTERFACE_AGE`
LT_REVISION=$SDL_INTERFACE_AGE
LT_AGE=`expr $SDL_BINARY_AGE - $SDL_INTERFACE_AGE`
42
m4_pattern_allow([^LT_])
43
44
45
46
47
48
AC_SUBST(LT_RELEASE)
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)
49
dnl Detect the canonical build and host environments
50
dnl AC_CANONICAL_HOST
51
52
53
54
55
56
57
58
59
60
61
62
63
64
dnl Check for tools
AC_PROG_LIBTOOL
AC_PROG_CC
AC_PROG_CXX
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])
65
dnl Set up the compiler and linker flags
66
INCLUDE="-I$srcdir/include"
67
if test x$srcdir != x.; then
68
69
70
71
72
# Remove SDL_config.h from the source directory, since it's the
# default one, and we want to include the one that we generate.
if test -f $srcdir/include/SDL_config.h; then
rm $srcdir/include/SDL_config.h
fi
73
INCLUDE="-Iinclude $INCLUDE"
74
fi
75
case "$host" in
76
77
*-*-cygwin*)
# We build SDL on cygwin without the UNIX emulation layer
78
79
BASE_CFLAGS="-I/usr/include/mingw -mno-cygwin"
BASE_LDFLAGS="-mno-cygwin"
80
81
;;
*)
82
BASE_CFLAGS=""
83
BASE_LDFLAGS=""
84
85
;;
esac
86
87
88
# Uncomment the following line if you want to force SDL and applications
# built with it to be compiled for a particular architecture.
#AX_GCC_ARCHFLAG([no], [BASE_CFLAGS="$BASE_CFLAGS $ax_cv_gcc_archflag]")
89
BUILD_CFLAGS="$CFLAGS $CPPFLAGS"
90
91
92
93
# The default optimization for SDL 1.3 is -O3 (Bug #31)
if test x$orig_CFLAGS = x; then
BUILD_CFLAGS=`echo $BUILD_CFLAGS | sed 's/-O2/-O3/'`
fi
94
95
96
EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS"
BUILD_LDFLAGS="$LDFLAGS"
EXTRA_LDFLAGS="$BASE_LDFLAGS"
97
98
## These are common directories to find software packages
#for path in /usr/freeware /usr/pkg /usr/X11R6 /usr/local; do
99
100
101
102
103
104
105
# 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
106
107
108
109
110
SDL_CFLAGS="$BASE_CFLAGS"
SDL_LIBS="-lSDL $BASE_LDFLAGS"
CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS"
CFLAGS="$CFLAGS $EXTRA_CFLAGS"
LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
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
for path in $gcc_bin_path $gcc_lib_path $env_lib_path $host_lib_path; do
lib=[`ls -- $path/$1 2>/dev/null | sort | sed 's/.*\/\(.*\)/\1/; q'`]
if test x$lib != x; then
echo $lib
return
fi
done
}
135
dnl Check for compiler characteristics
136
137
AC_C_CONST
AC_C_INLINE
138
139
AC_C_VOLATILE
140
141
142
dnl See whether we want assertions for debugging/sanity checking SDL itself.
AC_ARG_ENABLE(assertions,
AC_HELP_STRING([--enable-assertions],
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
[Enable internal sanity checks (auto/disabled/release/enabled/paranoid) [[default=auto]]]),
, enable_assertions=auto)
case "$enable_assertions" in
auto) # Use optimization settings to determine assertion level
;;
disabled)
AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 0)
;;
release)
AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 1)
;;
enabled)
AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 2)
;;
paranoid)
AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 3)
;;
*)
AC_MSG_ERROR([*** unknown assertion level. stop.])
;;
esac
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
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
187
188
189
dnl See whether we are allowed to use the system C library
AC_ARG_ENABLE(libc,
190
AC_HELP_STRING([--enable-libc], [Use the system C library [[default=yes]]]),
191
192
193
194
195
196
, enable_libc=yes)
if test x$enable_libc = xyes; then
AC_DEFINE(HAVE_LIBC)
dnl Check for C library headers
AC_HEADER_STDC
197
AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h)
198
199
200
dnl Check for typedefs, structures, etc.
AC_TYPE_SIZE_T
201
202
203
204
dnl Check for defines
AC_CHECK_DEFINE(M_PI, math.h)
205
dnl Checks for library functions.
206
207
208
209
210
211
212
213
case "$host" in
*-*-cygwin* | *-*-mingw32*)
;;
*)
AC_FUNC_ALLOCA
;;
esac
214
215
216
AC_FUNC_MEMCMP
if test x$ac_cv_func_memcmp_working = xyes; then
AC_DEFINE(HAVE_MEMCMP)
217
fi
218
219
220
221
AC_FUNC_STRTOD
if test x$ac_cv_func_strtod = xyes; then
AC_DEFINE(HAVE_STRTOD)
fi
222
223
224
225
226
227
228
229
230
AC_CHECK_FUNC(mprotect,
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/mman.h>
],[
],[
AC_DEFINE(HAVE_MPROTECT)
]),
)
231
AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp sscanf snprintf vsnprintf sigaction setjmp nanosleep sysconf sysctlbyname)
232
233
AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
234
AC_CHECK_FUNCS(atan atan2 ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt)
235
236
AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"])
237
AC_CHECK_FUNCS(iconv)
238
239
fi
240
AC_CHECK_SIZEOF(void*)
241
242
243
244
245
246
247
248
249
250
251
252
253
254
dnl See whether we can use gcc atomic operations on this architecture
AC_ARG_ENABLE(gcc-atomics,
AC_HELP_STRING([--enable-gcc-atomics],
[Use gcc builtin atomics [[default=yes]]]),
, enable_gcc_atomics=yes)
if test x$enable_gcc_atomics = xyes; then
have_gcc_atomics=no
AC_MSG_CHECKING(for GCC builtin atomic operations)
AC_TRY_LINK([
],[
int a;
void *x, *y, *z;
__sync_lock_test_and_set(&a, 4);
255
__sync_lock_test_and_set(&x, y);
256
257
258
259
260
261
262
263
__sync_fetch_and_add(&a, 1);
__sync_bool_compare_and_swap(&a, 5, 10);
__sync_bool_compare_and_swap(&x, y, z);
],[
have_gcc_atomics=yes
])
AC_MSG_RESULT($have_gcc_atomics)
264
if test x$have_gcc_atomics = xyes; then
265
AC_DEFINE(HAVE_GCC_ATOMICS)
266
267
268
269
270
271
else
# See if we have the minimum operation needed for GCC atomics
AC_TRY_LINK([
],[
int a;
__sync_lock_test_and_set(&a, 1);
272
__sync_lock_release(&a);
273
274
275
276
277
278
],[
have_gcc_sync_lock_test_and_set=yes
])
if test x$have_gcc_sync_lock_test_and_set = xyes; then
AC_DEFINE(HAVE_GCC_SYNC_LOCK_TEST_AND_SET)
fi
279
fi
280
281
fi
282
283
# Standard C sources
SOURCES="$SOURCES $srcdir/src/*.c"
284
SOURCES="$SOURCES $srcdir/src/atomic/*.c"
285
SOURCES="$SOURCES $srcdir/src/audio/*.c"
286
287
288
SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c"
SOURCES="$SOURCES $srcdir/src/events/*.c"
SOURCES="$SOURCES $srcdir/src/file/*.c"
289
290
SOURCES="$SOURCES $srcdir/src/render/*.c"
SOURCES="$SOURCES $srcdir/src/render/*/*.c"
291
292
293
294
295
SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
SOURCES="$SOURCES $srcdir/src/thread/*.c"
SOURCES="$SOURCES $srcdir/src/timer/*.c"
SOURCES="$SOURCES $srcdir/src/video/*.c"
296
297
dnl Enable/disable various subsystems of the SDL library
298
299
300
301
302
303
AC_ARG_ENABLE(atomic,
AC_HELP_STRING([--enable-atomic], [Enable the atomic operations subsystem [[default=yes]]]),
, enable_atomic=yes)
if test x$enable_atomic != xyes; then
AC_DEFINE(SDL_ATOMIC_DISABLED)
fi
304
AC_ARG_ENABLE(audio,
305
AC_HELP_STRING([--enable-audio], [Enable the audio subsystem [[default=yes]]]),
306
, enable_audio=yes)
307
308
if test x$enable_audio != xyes; then
AC_DEFINE(SDL_AUDIO_DISABLED)
309
310
fi
AC_ARG_ENABLE(video,
311
AC_HELP_STRING([--enable-video], [Enable the video subsystem [[default=yes]]]),
312
, enable_video=yes)
313
314
if test x$enable_video != xyes; then
AC_DEFINE(SDL_VIDEO_DISABLED)
315
fi
316
317
318
319
320
321
AC_ARG_ENABLE(render,
AC_HELP_STRING([--enable-render], [Enable the render subsystem [[default=yes]]]),
, enable_render=yes)
if test x$enable_render != xyes; then
AC_DEFINE(SDL_RENDER_DISABLED)
fi
322
AC_ARG_ENABLE(events,
323
AC_HELP_STRING([--enable-events], [Enable the events subsystem [[default=yes]]]),
324
, enable_events=yes)
325
326
if test x$enable_events != xyes; then
AC_DEFINE(SDL_EVENTS_DISABLED)
327
328
fi
AC_ARG_ENABLE(joystick,
329
AC_HELP_STRING([--enable-joystick], [Enable the joystick subsystem [[default=yes]]]),
330
, enable_joystick=yes)
331
332
if test x$enable_joystick != xyes; then
AC_DEFINE(SDL_JOYSTICK_DISABLED)
333
334
else
SOURCES="$SOURCES $srcdir/src/joystick/*.c"
335
fi
336
337
338
339
340
341
342
343
AC_ARG_ENABLE(haptic,
AC_HELP_STRING([--enable-haptic], [Enable the haptic (force feedback) subsystem [[default=yes]]]),
, enable_haptic=yes)
if test x$enable_haptic != xyes; then
AC_DEFINE(SDL_HAPTIC_DISABLED)
else
SOURCES="$SOURCES $srcdir/src/haptic/*.c"
fi
344
345
346
347
348
349
350
351
AC_ARG_ENABLE(power,
AC_HELP_STRING([--enable-power], [Enable the power subsystem [[default=yes]]]),
, enable_power=yes)
if test x$enable_power != xyes; then
AC_DEFINE(SDL_POWER_DISABLED)
else
SOURCES="$SOURCES $srcdir/src/power/*.c"
fi
352
AC_ARG_ENABLE(threads,
353
AC_HELP_STRING([--enable-threads], [Enable the threading subsystem [[default=yes]]]),
354
355
, enable_threads=yes)
if test x$enable_threads != xyes; then
356
AC_DEFINE(SDL_THREADS_DISABLED)
357
358
fi
AC_ARG_ENABLE(timers,
359
AC_HELP_STRING([--enable-timers], [Enable the timer subsystem [[default=yes]]]),
360
, enable_timers=yes)
361
362
if test x$enable_timers != xyes; then
AC_DEFINE(SDL_TIMERS_DISABLED)
363
364
fi
AC_ARG_ENABLE(file,
365
AC_HELP_STRING([--enable-file], [Enable the file subsystem [[default=yes]]]),
366
, enable_file=yes)
367
368
369
370
if test x$enable_file != xyes; then
AC_DEFINE(SDL_FILE_DISABLED)
fi
AC_ARG_ENABLE(loadso,
371
AC_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [[default=yes]]]),
372
373
374
, enable_loadso=yes)
if test x$enable_loadso != xyes; then
AC_DEFINE(SDL_LOADSO_DISABLED)
375
fi
376
AC_ARG_ENABLE(cpuinfo,
377
AC_HELP_STRING([--enable-cpuinfo], [Enable the cpuinfo subsystem [[default=yes]]]),
378
, enable_cpuinfo=yes)
379
380
381
if test x$enable_cpuinfo != xyes; then
AC_DEFINE(SDL_CPUINFO_DISABLED)
fi
382
383
384
385
386
387
AC_ARG_ENABLE(atomic,
AC_HELP_STRING([--enable-atomic], [Enable the atomic operations [[default=yes]]]),
, enable_atomic=yes)
if test x$enable_atomic != xyes; then
AC_DEFINE(SDL_ATOMIC_DISABLED)
fi
388
AC_ARG_ENABLE(assembly,
389
AC_HELP_STRING([--enable-assembly], [Enable assembly routines [[default=yes]]]),
390
391
392
, enable_assembly=yes)
if test x$enable_assembly = xyes; then
AC_DEFINE(SDL_ASSEMBLY_ROUTINES)
393
394
395
396
397
398
399
400
401
402
403
404
# Make sure that we don't generate floating point code that would
# cause illegal instruction exceptions on older processors
case "$host" in
*-*-darwin*)
# Don't need to worry about Apple hardware, it's all SSE capable
default_ssemath=yes
;;
*64-*-*)
# x86 64-bit architectures all have SSE instructions
default_ssemath=yes
;;
405
*)
406
407
408
409
410
411
412
413
414
415
416
417
default_ssemath=no
;;
esac
AC_ARG_ENABLE(ssemath,
AC_HELP_STRING([--enable-ssemath], [Allow GCC to use SSE floating point math [[default=no]]]),
, enable_ssemath=$default_ssemath)
if test x$enable_ssemath = xno; then
if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -mfpmath=387"
fi
fi
418
419
420
421
422
423
424
425
426
427
428
429
dnl Check for various instruction support
AC_ARG_ENABLE(mmx,
AC_HELP_STRING([--enable-mmx], [use MMX assembly routines [[default=yes]]]),
, enable_mmx=yes)
if test x$enable_mmx = xyes; then
save_CFLAGS="$CFLAGS"
have_gcc_mmx=no
AC_MSG_CHECKING(for GCC -mmmx option)
mmx_CFLAGS="-mmmx"
CFLAGS="$save_CFLAGS $mmx_CFLAGS"
AC_TRY_COMPILE([
430
431
432
433
434
#ifdef __MINGW32__
#include <_mingw.h>
#ifdef __MINGW64_VERSION_MAJOR
#include <intrin.h>
#else
435
#include <mmintrin.h>
436
437
438
439
#endif
#else
#include <mmintrin.h>
#endif
440
441
442
#ifndef __MMX__
#error Assembler CPP flag not enabled
#endif
443
444
445
446
447
],[
],[
have_gcc_mmx=yes
])
AC_MSG_RESULT($have_gcc_mmx)
448
CFLAGS="$save_CFLAGS"
449
450
451
452
453
454
if test x$have_gcc_mmx = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS $mmx_CFLAGS"
fi
fi
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
AC_ARG_ENABLE(3dnow,
AC_HELP_STRING([--enable-3dnow], [use MMX assembly routines [[default=yes]]]),
, enable_3dnow=yes)
if test x$enable_3dnow = xyes; then
save_CFLAGS="$CFLAGS"
have_gcc_3dnow=no
AC_MSG_CHECKING(for GCC -m3dnow option)
amd3dnow_CFLAGS="-m3dnow"
CFLAGS="$save_CFLAGS $amd3dnow_CFLAGS"
AC_TRY_COMPILE([
#include <mm3dnow.h>
#ifndef __3dNOW__
#error Assembler CPP flag not enabled
#endif
],[
],[
have_gcc_3dnow=yes
])
AC_MSG_RESULT($have_gcc_3dnow)
CFLAGS="$save_CFLAGS"
if test x$have_gcc_3dnow = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS $amd3dnow_CFLAGS"
fi
fi
482
483
484
485
486
487
488
489
490
491
492
AC_ARG_ENABLE(sse,
AC_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]),
, enable_sse=yes)
if test x$enable_sse = xyes; then
save_CFLAGS="$CFLAGS"
have_gcc_sse=no
AC_MSG_CHECKING(for GCC -msse option)
sse_CFLAGS="-msse"
CFLAGS="$save_CFLAGS $sse_CFLAGS"
AC_TRY_COMPILE([
493
494
495
496
497
498
499
500
#ifdef __MINGW32__
#include <_mingw.h>
#ifdef __MINGW64_VERSION_MAJOR
#include <intrin.h>
#else
#include <xmmintrin.h>
#endif
#else
501
#include <xmmintrin.h>
502
#endif
503
504
505
#ifndef __SSE__
#error Assembler CPP flag not enabled
#endif
506
507
508
509
510
],[
],[
have_gcc_sse=yes
])
AC_MSG_RESULT($have_gcc_sse)
511
CFLAGS="$save_CFLAGS"
512
513
514
515
516
517
if test x$have_gcc_sse = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS $sse_CFLAGS"
fi
fi
518
AC_ARG_ENABLE(sse2,
519
520
AC_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=no]]]),
, enable_sse2=$default_ssemath)
521
522
523
524
525
526
527
528
if test x$enable_sse2 = xyes; then
save_CFLAGS="$CFLAGS"
have_gcc_sse2=no
AC_MSG_CHECKING(for GCC -msse2 option)
sse2_CFLAGS="-msse2"
CFLAGS="$save_CFLAGS $sse2_CFLAGS"
AC_TRY_COMPILE([
529
530
531
532
533
534
535
536
#ifdef __MINGW32__
#include <_mingw.h>
#ifdef __MINGW64_VERSION_MAJOR
#include <intrin.h>
#else
#include <emmintrin.h>
#endif
#else
537
#include <emmintrin.h>
538
#endif
539
540
541
542
543
544
545
546
#ifndef __SSE2__
#error Assembler CPP flag not enabled
#endif
],[
],[
have_gcc_sse2=yes
])
AC_MSG_RESULT($have_gcc_sse2)
547
CFLAGS="$save_CFLAGS"
548
549
550
551
552
if test x$have_gcc_sse2 = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS $sse2_CFLAGS"
fi
fi
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
AC_ARG_ENABLE(altivec,
AC_HELP_STRING([--enable-altivec], [use Altivec assembly routines [[default=yes]]]),
, enable_altivec=yes)
if test x$enable_altivec = xyes; then
save_CFLAGS="$CFLAGS"
have_gcc_altivec=no
have_altivec_h_hdr=no
altivec_CFLAGS="-maltivec"
CFLAGS="$save_CFLAGS $altivec_CFLAGS"
AC_MSG_CHECKING(for Altivec with GCC altivec.h and -maltivec option)
AC_TRY_COMPILE([
#include <altivec.h>
vector unsigned int vzero() {
return vec_splat_u32(0);
}
],[
],[
have_gcc_altivec=yes
have_altivec_h_hdr=yes
])
AC_MSG_RESULT($have_gcc_altivec)
if test x$have_gcc_altivec = xno; then
AC_MSG_CHECKING(for Altivec with GCC -maltivec option)
AC_TRY_COMPILE([
vector unsigned int vzero() {
return vec_splat_u32(0);
}
],[
],[
have_gcc_altivec=yes
])
AC_MSG_RESULT($have_gcc_altivec)
fi
if test x$have_gcc_altivec = xno; then
AC_MSG_CHECKING(for Altivec with GCC altivec.h and -faltivec option)
altivec_CFLAGS="-faltivec"
CFLAGS="$save_CFLAGS $altivec_CFLAGS"
AC_TRY_COMPILE([
#include <altivec.h>
vector unsigned int vzero() {
return vec_splat_u32(0);
}
],[
],[
have_gcc_altivec=yes
have_altivec_h_hdr=yes
])
AC_MSG_RESULT($have_gcc_altivec)
fi
if test x$have_gcc_altivec = xno; then
AC_MSG_CHECKING(for Altivec with GCC -faltivec option)
AC_TRY_COMPILE([
vector unsigned int vzero() {
return vec_splat_u32(0);
}
],[
],[
have_gcc_altivec=yes
])
AC_MSG_RESULT($have_gcc_altivec)
fi
CFLAGS="$save_CFLAGS"
if test x$have_gcc_altivec = xyes; then
AC_DEFINE(SDL_ALTIVEC_BLITTERS)
if test x$have_altivec_h_hdr = xyes; then
AC_DEFINE(HAVE_ALTIVEC_H)
fi
EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS"
fi
fi
629
fi
630
631
632
633
634
dnl See if the OSS audio interface is supported
CheckOSS()
{
AC_ARG_ENABLE(oss,
635
AC_HELP_STRING([--enable-oss], [support the OSS audio API [[default=yes]]]),
636
637
638
639
, enable_oss=yes)
if test x$enable_audio = xyes -a x$enable_oss = xyes; then
AC_MSG_CHECKING(for OSS audio support)
have_oss=no
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
if test x$have_oss != xyes; then
AC_TRY_COMPILE([
#include <sys/soundcard.h>
],[
int arg = SNDCTL_DSP_SETFRAGMENT;
],[
have_oss=yes
])
fi
if test x$have_oss != xyes; then
AC_TRY_COMPILE([
#include <soundcard.h>
],[
int arg = SNDCTL_DSP_SETFRAGMENT;
],[
have_oss=yes
656
AC_DEFINE(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H)
657
658
])
fi
659
660
AC_MSG_RESULT($have_oss)
if test x$have_oss = xyes; then
661
662
663
664
665
AC_DEFINE(SDL_AUDIO_DRIVER_OSS)
SOURCES="$SOURCES $srcdir/src/audio/dsp/*.c"
SOURCES="$SOURCES $srcdir/src/audio/dma/*.c"
have_audio=yes
666
# We may need to link with ossaudio emulation library
667
case "$host" in
668
*-*-openbsd*|*-*-netbsd*)
669
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";;
670
esac
671
672
673
674
675
676
677
678
fi
fi
}
dnl See if the ALSA audio interface is supported
CheckALSA()
{
AC_ARG_ENABLE(alsa,
679
AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [[default=yes]]]),
680
681
, enable_alsa=yes)
if test x$enable_audio = xyes -a x$enable_alsa = xyes; then
682
AM_PATH_ALSA(0.9.0, have_alsa=yes, have_alsa=no)
683
684
685
686
# Restore all flags from before the ALSA detection runs
CFLAGS="$alsa_save_CFLAGS"
LDFLAGS="$alsa_save_LDFLAGS"
LIBS="$alsa_save_LIBS"
687
if test x$have_alsa = xyes; then
688
AC_ARG_ENABLE(alsa-shared,
689
AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [[default=yes]]]),
690
, enable_alsa_shared=yes)
691
alsa_lib=[`find_lib "libasound.so.*" "$ALSA_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
692
693
694
AC_DEFINE(SDL_AUDIO_DRIVER_ALSA)
SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c"
695
EXTRA_CFLAGS="$EXTRA_CFLAGS $ALSA_CFLAGS"
696
697
if test x$have_loadso != xyes && \
test x$enable_alsa_shared = xyes; then
698
AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ALSA loading])
699
700
701
fi
if test x$have_loadso = xyes && \
test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
702
echo "-- dynamic libasound -> $alsa_lib"
703
704
AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ALSA_DYNAMIC, "$alsa_lib")
else
705
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ALSA_LIBS"
706
707
708
709
fi
have_audio=yes
fi
fi
710
711
712
713
714
715
}
dnl Find the ESD includes and libraries
CheckESD()
{
AC_ARG_ENABLE(esd,
716
AC_HELP_STRING([--enable-esd], [support the Enlightened Sound Daemon [[default=yes]]]),
717
718
, enable_esd=yes)
if test x$enable_audio = xyes -a x$enable_esd = xyes; then
719
720
AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no)
if test x$have_esd = xyes; then
721
AC_ARG_ENABLE(esd-shared,
722
AC_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [[default=yes]]]),
723
, enable_esd_shared=yes)
724
esd_lib=[`find_lib "libesd.so.*" "$ESD_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
725
726
727
AC_DEFINE(SDL_AUDIO_DRIVER_ESD)
SOURCES="$SOURCES $srcdir/src/audio/esd/*.c"
728
EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS"
729
if test x$have_loadso != xyes && \
730
test x$enable_esd_shared = xyes; then
731
AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ESD loading])
732
fi
733
if test x$have_loadso = xyes && \
734
test x$enable_esd_shared = xyes && test x$esd_lib != x; then
735
echo "-- dynamic libesd -> $esd_lib"
736
AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ESD_DYNAMIC, "$esd_lib")
737
else
738
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ESD_LIBS"
739
fi
740
have_audio=yes
741
fi
742
743
744
fi
}
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
dnl Find PulseAudio
CheckPulseAudio()
{
AC_ARG_ENABLE(pulseaudio,
AC_HELP_STRING([--enable-pulseaudio], [use PulseAudio [[default=yes]]]),
, enable_pulseaudio=yes)
if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then
audio_pulseaudio=no
PULSEAUDIO_REQUIRED_VERSION=0.9
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
AC_MSG_CHECKING(for PulseAudio $PULSEAUDIO_REQUIRED_VERSION support)
if test x$PKG_CONFIG != xno; then
if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSEAUDIO_REQUIRED_VERSION libpulse-simple; then
PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple`
PULSEAUDIO_LIBS=`$PKG_CONFIG --libs libpulse-simple`
audio_pulseaudio=yes
763
fi
764
765
766
767
768
769
770
fi
AC_MSG_RESULT($audio_pulseaudio)
if test x$audio_pulseaudio = xyes; then
AC_ARG_ENABLE(pulseaudio-shared,
AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [[default=yes]]]),
, enable_pulseaudio_shared=yes)
771
pulseaudio_lib=[`find_lib "libpulse-simple.so.*" "$PULSEAUDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
772
773
774
775
776
777
778
779
780
781
AC_DEFINE(SDL_AUDIO_DRIVER_PULSEAUDIO)
SOURCES="$SOURCES $srcdir/src/audio/pulseaudio/*.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS $PULSEAUDIO_CFLAGS"
if test x$have_loadso != xyes && \
test x$enable_pulseaudio_shared = xyes; then
AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic PulseAudio loading])
fi
if test x$have_loadso = xyes && \
test x$enable_pulseaudio_shared = xyes && test x$pulseaudio_lib != x; then
782
echo "-- dynamic libpulse-simple -> $pulseaudio_lib"
783
784
785
786
787
788
789
790
791
AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC, "$pulseaudio_lib")
else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PULSEAUDIO_LIBS"
fi
have_audio=yes
fi
fi
}
792
793
794
CheckARTSC()
{
AC_ARG_ENABLE(arts,
795
AC_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [[default=yes]]]),
796
797
, enable_arts=yes)
if test x$enable_audio = xyes -a x$enable_arts = xyes; then
798
799
AC_PATH_PROG(ARTSCONFIG, artsc-config)
if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then
800
801
: # arts isn't installed
else
802
803
ARTS_CFLAGS=`$ARTSCONFIG --cflags`
ARTS_LIBS=`$ARTSCONFIG --libs`
804
805
806
AC_MSG_CHECKING(for aRts development environment)
audio_arts=no
save_CFLAGS="$CFLAGS"
807
CFLAGS="$CFLAGS $ARTS_CFLAGS"
808
809
810
811
812
813
814
815
816
817
AC_TRY_COMPILE([
#include <artsc.h>
],[
arts_stream_t stream;
],[
audio_arts=yes
])
CFLAGS="$save_CFLAGS"
AC_MSG_RESULT($audio_arts)
if test x$audio_arts = xyes; then
818
AC_ARG_ENABLE(arts-shared,
819
AC_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [[default=yes]]]),
820
, enable_arts_shared=yes)
821
arts_lib=[`find_lib "libartsc.so.*" "$ARTS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
822
823
824
AC_DEFINE(SDL_AUDIO_DRIVER_ARTS)
SOURCES="$SOURCES $srcdir/src/audio/arts/*.c"
825
EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS"
826
if test x$have_loadso != xyes && \
827
test x$enable_arts_shared = xyes; then
828
AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ARTS loading])
829
fi
830
if test x$have_loadso = xyes && \
831
test x$enable_arts_shared = xyes && test x$arts_lib != x; then
832
echo "-- dynamic libartsc -> $arts_lib"
833
AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ARTS_DYNAMIC, "$arts_lib")
834
else
835
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS"
836
fi
837
have_audio=yes
838
839
840
841
842
843
844
845
846
fi
fi
fi
}
dnl See if the NAS audio interface is supported
CheckNAS()
{
AC_ARG_ENABLE(nas,
847
AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]),
848
, enable_nas=yes)
849
if test x$enable_audio = xyes -a x$enable_nas = xyes; then
850
851
852
AC_CHECK_HEADER(audio/audiolib.h, have_nas_hdr=yes)
AC_CHECK_LIB(audio, AuOpenServer, have_nas_lib=yes)
853
854
AC_MSG_CHECKING(for NAS audio support)
have_nas=no
855
856
857
858
859
860
if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then
have_nas=yes
NAS_LIBS="-laudio"
elif test -r /usr/X11R6/include/audio/audiolib.h; then
861
have_nas=yes
862
NAS_CFLAGS="-I/usr/X11R6/include/"
863
NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt"
864
865
fi
866
867
AC_MSG_RESULT($have_nas)
868
869
if test x$have_nas = xyes; then
870
871
872
AC_ARG_ENABLE(nas-shared,
AC_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[default=yes]]]),
, enable_nas_shared=yes)
873
nas_lib=[`find_lib "libaudio.so.*" "$NAS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
874
875
876
877
878
879
if test x$have_loadso != xyes && \
test x$enable_nas_shared = xyes; then
AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic NAS loading])
fi
if test x$have_loadso = xyes && \
880
test x$enable_nas_shared = xyes && test x$nas_lib != x; then
881
echo "-- dynamic libaudio -> $nas_lib"
882
883
884
885
886
AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_NAS_DYNAMIC, "$nas_lib")
else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS"
fi
887
888
AC_DEFINE(SDL_AUDIO_DRIVER_NAS)
SOURCES="$SOURCES $srcdir/src/audio/nas/*.c"
889
EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS"
890
891
have_audio=yes
fi
892
893
894
fi
}
895
896
897
898
dnl rcg07142001 See if the user wants the disk writer audio driver...
CheckDiskAudio()
{
AC_ARG_ENABLE(diskaudio,
899
AC_HELP_STRING([--enable-diskaudio], [support the disk writer audio driver [[default=yes]]]),
900
, enable_diskaudio=yes)
901
if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
902
903
AC_DEFINE(SDL_AUDIO_DRIVER_DISK)
SOURCES="$SOURCES $srcdir/src/audio/disk/*.c"
904
905
906
fi
}
907
908
909
910
dnl rcg03142006 See if the user wants the dummy audio driver...
CheckDummyAudio()
{
AC_ARG_ENABLE(dummyaudio,
911
AC_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [[default=yes]]]),
912
913
914
915
916
917
918
, enable_dummyaudio=yes)
if test x$enable_audio = xyes -a x$enable_dummyaudio = xyes; then
AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY)
SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c"
fi
}
919
920
921
922
923
924
925
926
927
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"
928
CFLAGS="$save_CFLAGS $visibility_CFLAGS -Werror"
929
AC_TRY_COMPILE([
930
931
932
#if !defined(__GNUC__) || __GNUC__ < 4
#error SDL only uses visibility attributes in GCC 4 or newer
#endif
933
934
935
936
937
938
939
940
],[
],[
have_gcc_fvisibility=yes
])
AC_MSG_RESULT($have_gcc_fvisibility)
CFLAGS="$save_CFLAGS"
if test x$have_gcc_fvisibility = xyes; then
941
EXTRA_CFLAGS="$EXTRA_CFLAGS $visibility_CFLAGS"
942
943
944
945
fi
}
946
947
948
dnl Find the X11 include and library directories
CheckX11()
{
949
950
951
AC_ARG_ENABLE(video-x11,
952
AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]),
953
954
, enable_video_x11=yes)
if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
955
case "$host" in
956
957
*-*-darwin*)
# This isn't necessary for X11, but fixes GLX detection
958
if test "x$x_includes" = xNONE && test "x$x_libraries" = xNONE; then
959
960
961
962
963
x_includes="/usr/X11R6/include"
x_libraries="/usr/X11R6/lib"
fi
;;
esac
964
965
966
AC_PATH_X
AC_PATH_XTRA
if test x$have_x = xyes; then
967
968
969
970
971
# Only allow dynamically loaded X11 if the X11 function pointers
# will not end up in the global namespace, which causes problems
# with other libraries calling X11 functions.
x11_symbols_private=$have_gcc_fvisibility
972
AC_ARG_ENABLE(x11-shared,
973
974
AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=maybe]]]),
, enable_x11_shared=maybe)
975
976
case "$host" in
977
*-*-darwin*)
978
x11_symbols_private=yes
979
980
x11_lib='/usr/X11R6/lib/libX11.6.dylib'
x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
981
xcursor_lib='/usr/X11R6/lib/libXcursor.1.dylib'
982
xinerama_lib='/usr/X11R6/lib/libXinerama.1.dylib'
983
xinput_lib='/usr/X11R6/lib/libXi.6.dylib'
984
985
986
987
xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
xss_lib='/usr/X11R6/lib/libXss.1.dylib'
xvidmode_lib='/usr/X11R6/lib/libXxf86vm.1.dylib'
988
989
;;
*)
990
991
x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
992
xcursor_lib=[`find_lib "libXcursor.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
993
xinerama_lib=[`find_lib "libXinerama.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
994
xinput_lib=[`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
995
996
xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
xrender_lib=[`find_lib "libXrender.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
997
xss_lib=[`find_lib "libXss.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
998
xvidmode_lib=[`find_lib "libXxf86vm.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
999
1000
;;
esac