Assert code's stdio interface was reading from the wrong variable.
Thanks to Frank Zago for the catch.
1 dnl Process this file with autoconf to produce a configure script.
3 AC_CONFIG_HEADER(include/SDL_config.h)
5 AC_CONFIG_AUX_DIRS($srcdir/build-scripts)
7 dnl Save the CFLAGS to see whether they were passed in or generated
10 dnl Set various version strings - taken gratefully from the GTk sources
13 # Edit include/SDL/SDL_version.h and change the version, then:
14 # SDL_MICRO_VERSION += 1;
15 # SDL_INTERFACE_AGE += 1;
16 # SDL_BINARY_AGE += 1;
17 # if any functions have been added, set SDL_INTERFACE_AGE to 0.
18 # if backwards compatibility has been broken,
19 # set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0.
26 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
28 AC_SUBST(SDL_MAJOR_VERSION)
29 AC_SUBST(SDL_MINOR_VERSION)
30 AC_SUBST(SDL_MICRO_VERSION)
31 AC_SUBST(SDL_INTERFACE_AGE)
32 AC_SUBST(SDL_BINARY_AGE)
38 LT_RELEASE=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION
39 LT_CURRENT=`expr $SDL_MICRO_VERSION - $SDL_INTERFACE_AGE`
40 LT_REVISION=$SDL_INTERFACE_AGE
41 LT_AGE=`expr $SDL_BINARY_AGE - $SDL_INTERFACE_AGE`
42 m4_pattern_allow([^LT_])
49 dnl Detect the canonical build and host environments
58 if test -z "$host_alias"; then
61 hostaliaswindres="$host_alias-windres"
63 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 # Remove SDL_config.h from the source directory, since it's the
69 # default one, and we want to include the one that we generate.
70 if test -f $srcdir/include/SDL_config.h; then
71 rm $srcdir/include/SDL_config.h
73 INCLUDE="-Iinclude $INCLUDE"
77 # We build SDL on cygwin without the UNIX emulation layer
78 BASE_CFLAGS="-I/usr/include/mingw -mno-cygwin"
79 BASE_LDFLAGS="-mno-cygwin"
86 # Uncomment the following line if you want to force SDL and applications
87 # built with it to be compiled for a particular architecture.
88 #AX_GCC_ARCHFLAG([no], [BASE_CFLAGS="$BASE_CFLAGS $ax_cv_gcc_archflag]")
89 BUILD_CFLAGS="$CFLAGS $CPPFLAGS"
90 # The default optimization for SDL 1.3 is -O3 (Bug #31)
91 if test x$orig_CFLAGS = x; then
92 BUILD_CFLAGS=`echo $BUILD_CFLAGS | sed 's/-O2/-O3/'`
94 EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS"
95 BUILD_LDFLAGS="$LDFLAGS"
96 EXTRA_LDFLAGS="$BASE_LDFLAGS"
97 ## These are common directories to find software packages
98 #for path in /usr/freeware /usr/pkg /usr/X11R6 /usr/local; do
99 # if test -d $path/include; then
100 # EXTRA_CFLAGS="$EXTRA_CFLAGS -I$path/include"
102 # if test -d $path/lib; then
103 # EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$path/lib"
106 SDL_CFLAGS="$BASE_CFLAGS"
107 SDL_LIBS="-lSDL $BASE_LDFLAGS"
108 CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS"
109 CFLAGS="$CFLAGS $EXTRA_CFLAGS"
110 LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
112 dnl set this to use on systems that use lib64 instead of lib
113 base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
115 dnl Function to find a library in the compiler search path
118 gcc_bin_path=[`$CC -print-search-dirs 2>/dev/null | fgrep programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
119 gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
120 env_lib_path=[`echo $LIBS $LDFLAGS $* | sed 's/-L[ ]*//g'`]
121 if test "$cross_compiling" = yes; then
124 host_lib_path="/usr/$base_libdir /usr/local/$base_libdir"
126 for path in $gcc_bin_path $gcc_lib_path $env_lib_path $host_lib_path; do
127 lib=[`ls -- $path/$1 2>/dev/null | sort | sed 's/.*\/\(.*\)/\1/; q'`]
128 if test x$lib != x; then
135 dnl Check for compiler characteristics
140 dnl See whether we want assertions for debugging/sanity checking SDL itself.
141 AC_ARG_ENABLE(assertions,
142 AC_HELP_STRING([--enable-assertions],
143 [Enable internal sanity checks (auto/disabled/release/enabled/paranoid) [[default=auto]]]),
144 , enable_assertions=auto)
145 case "$enable_assertions" in
146 auto) # Use optimization settings to determine assertion level
149 AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 0)
152 AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 1)
155 AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 2)
158 AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 3)
161 AC_MSG_ERROR([*** unknown assertion level. stop.])
165 dnl See whether we can use gcc style dependency tracking
166 AC_ARG_ENABLE(dependency-tracking,
167 AC_HELP_STRING([--enable-dependency-tracking],
168 [Use gcc -MMD -MT dependency tracking [[default=yes]]]),
169 , enable_dependency_tracking=yes)
170 if test x$enable_dependency_tracking = xyes; then
172 AC_MSG_CHECKING(for GCC -MMD -MT option)
174 #if !defined(__GNUC__) || __GNUC__ < 3
175 #error Dependency tracking requires GCC 3.0 or newer
181 AC_MSG_RESULT($have_gcc_mmd_mt)
183 if test x$have_gcc_mmd_mt = xyes; then
184 DEPENDENCY_TRACKING_OPTIONS="-MMD -MT \$@"
188 dnl See whether we are allowed to use the system C library
190 AC_HELP_STRING([--enable-libc], [Use the system C library [[default=yes]]]),
192 if test x$enable_libc = xyes; then
195 dnl Check for C library headers
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)
199 dnl Check for typedefs, structures, etc.
202 dnl Check for defines
203 AC_CHECK_DEFINE(M_PI, math.h)
205 dnl Checks for library functions.
207 *-*-cygwin* | *-*-mingw32*)
215 if test x$ac_cv_func_memcmp_working = xyes; then
216 AC_DEFINE(HAVE_MEMCMP)
219 if test x$ac_cv_func_strtod = xyes; then
220 AC_DEFINE(HAVE_STRTOD)
222 AC_CHECK_FUNC(mprotect,
224 #include <sys/types.h>
225 #include <sys/mman.h>
228 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)
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)
236 AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"])
237 AC_CHECK_FUNCS(iconv)
240 AC_CHECK_SIZEOF(void*)
242 dnl See whether we can use gcc atomic operations on this architecture
243 AC_ARG_ENABLE(gcc-atomics,
244 AC_HELP_STRING([--enable-gcc-atomics],
245 [Use gcc builtin atomics [[default=yes]]]),
246 , enable_gcc_atomics=yes)
247 if test x$enable_gcc_atomics = xyes; then
249 AC_MSG_CHECKING(for GCC builtin atomic operations)
254 __sync_lock_test_and_set(&a, 4);
255 __sync_lock_test_and_set(&x, y);
256 __sync_fetch_and_add(&a, 1);
257 __sync_bool_compare_and_swap(&a, 5, 10);
258 __sync_bool_compare_and_swap(&x, y, z);
262 AC_MSG_RESULT($have_gcc_atomics)
264 if test x$have_gcc_atomics = xyes; then
265 AC_DEFINE(HAVE_GCC_ATOMICS)
267 # See if we have the minimum operation needed for GCC atomics
271 __sync_lock_test_and_set(&a, 1);
272 __sync_lock_release(&a);
274 have_gcc_sync_lock_test_and_set=yes
276 if test x$have_gcc_sync_lock_test_and_set = xyes; then
277 AC_DEFINE(HAVE_GCC_SYNC_LOCK_TEST_AND_SET)
283 SOURCES="$SOURCES $srcdir/src/*.c"
284 SOURCES="$SOURCES $srcdir/src/atomic/*.c"
285 SOURCES="$SOURCES $srcdir/src/audio/*.c"
286 SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c"
287 SOURCES="$SOURCES $srcdir/src/events/*.c"
288 SOURCES="$SOURCES $srcdir/src/file/*.c"
289 SOURCES="$SOURCES $srcdir/src/render/*.c"
290 SOURCES="$SOURCES $srcdir/src/render/*/*.c"
291 SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
292 SOURCES="$SOURCES $srcdir/src/thread/*.c"
293 SOURCES="$SOURCES $srcdir/src/timer/*.c"
294 SOURCES="$SOURCES $srcdir/src/video/*.c"
296 dnl Enable/disable various subsystems of the SDL library
298 AC_ARG_ENABLE(atomic,
299 AC_HELP_STRING([--enable-atomic], [Enable the atomic operations subsystem [[default=yes]]]),
301 if test x$enable_atomic != xyes; then
302 AC_DEFINE(SDL_ATOMIC_DISABLED)
305 AC_HELP_STRING([--enable-audio], [Enable the audio subsystem [[default=yes]]]),
307 if test x$enable_audio != xyes; then
308 AC_DEFINE(SDL_AUDIO_DISABLED)
311 AC_HELP_STRING([--enable-video], [Enable the video subsystem [[default=yes]]]),
313 if test x$enable_video != xyes; then
314 AC_DEFINE(SDL_VIDEO_DISABLED)
316 AC_ARG_ENABLE(render,
317 AC_HELP_STRING([--enable-render], [Enable the render subsystem [[default=yes]]]),
319 if test x$enable_render != xyes; then
320 AC_DEFINE(SDL_RENDER_DISABLED)
322 AC_ARG_ENABLE(events,
323 AC_HELP_STRING([--enable-events], [Enable the events subsystem [[default=yes]]]),
325 if test x$enable_events != xyes; then
326 AC_DEFINE(SDL_EVENTS_DISABLED)
328 AC_ARG_ENABLE(joystick,
329 AC_HELP_STRING([--enable-joystick], [Enable the joystick subsystem [[default=yes]]]),
330 , enable_joystick=yes)
331 if test x$enable_joystick != xyes; then
332 AC_DEFINE(SDL_JOYSTICK_DISABLED)
334 SOURCES="$SOURCES $srcdir/src/joystick/*.c"
336 AC_ARG_ENABLE(haptic,
337 AC_HELP_STRING([--enable-haptic], [Enable the haptic (force feedback) subsystem [[default=yes]]]),
339 if test x$enable_haptic != xyes; then
340 AC_DEFINE(SDL_HAPTIC_DISABLED)
342 SOURCES="$SOURCES $srcdir/src/haptic/*.c"
345 AC_HELP_STRING([--enable-power], [Enable the power subsystem [[default=yes]]]),
347 if test x$enable_power != xyes; then
348 AC_DEFINE(SDL_POWER_DISABLED)
350 SOURCES="$SOURCES $srcdir/src/power/*.c"
352 AC_ARG_ENABLE(threads,
353 AC_HELP_STRING([--enable-threads], [Enable the threading subsystem [[default=yes]]]),
354 , enable_threads=yes)
355 if test x$enable_threads != xyes; then
356 AC_DEFINE(SDL_THREADS_DISABLED)
358 AC_ARG_ENABLE(timers,
359 AC_HELP_STRING([--enable-timers], [Enable the timer subsystem [[default=yes]]]),
361 if test x$enable_timers != xyes; then
362 AC_DEFINE(SDL_TIMERS_DISABLED)
365 AC_HELP_STRING([--enable-file], [Enable the file subsystem [[default=yes]]]),
367 if test x$enable_file != xyes; then
368 AC_DEFINE(SDL_FILE_DISABLED)
370 AC_ARG_ENABLE(loadso,
371 AC_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [[default=yes]]]),
373 if test x$enable_loadso != xyes; then
374 AC_DEFINE(SDL_LOADSO_DISABLED)
376 AC_ARG_ENABLE(cpuinfo,
377 AC_HELP_STRING([--enable-cpuinfo], [Enable the cpuinfo subsystem [[default=yes]]]),
378 , enable_cpuinfo=yes)
379 if test x$enable_cpuinfo != xyes; then
380 AC_DEFINE(SDL_CPUINFO_DISABLED)
382 AC_ARG_ENABLE(atomic,
383 AC_HELP_STRING([--enable-atomic], [Enable the atomic operations [[default=yes]]]),
385 if test x$enable_atomic != xyes; then
386 AC_DEFINE(SDL_ATOMIC_DISABLED)
388 AC_ARG_ENABLE(assembly,
389 AC_HELP_STRING([--enable-assembly], [Enable assembly routines [[default=yes]]]),
390 , enable_assembly=yes)
391 if test x$enable_assembly = xyes; then
392 AC_DEFINE(SDL_ASSEMBLY_ROUTINES)
394 # Make sure that we don't generate floating point code that would
395 # cause illegal instruction exceptions on older processors
398 # Don't need to worry about Apple hardware, it's all SSE capable
402 # x86 64-bit architectures all have SSE instructions
409 AC_ARG_ENABLE(ssemath,
410 AC_HELP_STRING([--enable-ssemath], [Allow GCC to use SSE floating point math [[default=no]]]),
411 , enable_ssemath=$default_ssemath)
412 if test x$enable_ssemath = xno; then
413 if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes; then
414 EXTRA_CFLAGS="$EXTRA_CFLAGS -mfpmath=387"
418 dnl Check for various instruction support
420 AC_HELP_STRING([--enable-mmx], [use MMX assembly routines [[default=yes]]]),
422 if test x$enable_mmx = xyes; then
423 save_CFLAGS="$CFLAGS"
425 AC_MSG_CHECKING(for GCC -mmmx option)
427 CFLAGS="$save_CFLAGS $mmx_CFLAGS"
432 #ifdef __MINGW64_VERSION_MAJOR
435 #include <mmintrin.h>
438 #include <mmintrin.h>
441 #error Assembler CPP flag not enabled
447 AC_MSG_RESULT($have_gcc_mmx)
448 CFLAGS="$save_CFLAGS"
450 if test x$have_gcc_mmx = xyes; then
451 EXTRA_CFLAGS="$EXTRA_CFLAGS $mmx_CFLAGS"
456 AC_HELP_STRING([--enable-3dnow], [use MMX assembly routines [[default=yes]]]),
458 if test x$enable_3dnow = xyes; then
459 save_CFLAGS="$CFLAGS"
461 AC_MSG_CHECKING(for GCC -m3dnow option)
462 amd3dnow_CFLAGS="-m3dnow"
463 CFLAGS="$save_CFLAGS $amd3dnow_CFLAGS"
468 #error Assembler CPP flag not enabled
474 AC_MSG_RESULT($have_gcc_3dnow)
475 CFLAGS="$save_CFLAGS"
477 if test x$have_gcc_3dnow = xyes; then
478 EXTRA_CFLAGS="$EXTRA_CFLAGS $amd3dnow_CFLAGS"
483 AC_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]),
485 if test x$enable_sse = xyes; then
486 save_CFLAGS="$CFLAGS"
488 AC_MSG_CHECKING(for GCC -msse option)
490 CFLAGS="$save_CFLAGS $sse_CFLAGS"
495 #ifdef __MINGW64_VERSION_MAJOR
498 #include <xmmintrin.h>
501 #include <xmmintrin.h>
504 #error Assembler CPP flag not enabled
510 AC_MSG_RESULT($have_gcc_sse)
511 CFLAGS="$save_CFLAGS"
513 if test x$have_gcc_sse = xyes; then
514 EXTRA_CFLAGS="$EXTRA_CFLAGS $sse_CFLAGS"
519 AC_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=no]]]),
520 , enable_sse2=$default_ssemath)
521 if test x$enable_sse2 = xyes; then
522 save_CFLAGS="$CFLAGS"
524 AC_MSG_CHECKING(for GCC -msse2 option)
526 CFLAGS="$save_CFLAGS $sse2_CFLAGS"
531 #ifdef __MINGW64_VERSION_MAJOR
534 #include <emmintrin.h>
537 #include <emmintrin.h>
540 #error Assembler CPP flag not enabled
546 AC_MSG_RESULT($have_gcc_sse2)
547 CFLAGS="$save_CFLAGS"
549 if test x$have_gcc_sse2 = xyes; then
550 EXTRA_CFLAGS="$EXTRA_CFLAGS $sse2_CFLAGS"
554 AC_ARG_ENABLE(altivec,
555 AC_HELP_STRING([--enable-altivec], [use Altivec assembly routines [[default=yes]]]),
556 , enable_altivec=yes)
557 if test x$enable_altivec = xyes; then
558 save_CFLAGS="$CFLAGS"
560 have_altivec_h_hdr=no
561 altivec_CFLAGS="-maltivec"
562 CFLAGS="$save_CFLAGS $altivec_CFLAGS"
564 AC_MSG_CHECKING(for Altivec with GCC altivec.h and -maltivec option)
567 vector unsigned int vzero() {
568 return vec_splat_u32(0);
573 have_altivec_h_hdr=yes
575 AC_MSG_RESULT($have_gcc_altivec)
577 if test x$have_gcc_altivec = xno; then
578 AC_MSG_CHECKING(for Altivec with GCC -maltivec option)
580 vector unsigned int vzero() {
581 return vec_splat_u32(0);
587 AC_MSG_RESULT($have_gcc_altivec)
590 if test x$have_gcc_altivec = xno; then
591 AC_MSG_CHECKING(for Altivec with GCC altivec.h and -faltivec option)
592 altivec_CFLAGS="-faltivec"
593 CFLAGS="$save_CFLAGS $altivec_CFLAGS"
596 vector unsigned int vzero() {
597 return vec_splat_u32(0);
602 have_altivec_h_hdr=yes
604 AC_MSG_RESULT($have_gcc_altivec)
607 if test x$have_gcc_altivec = xno; then
608 AC_MSG_CHECKING(for Altivec with GCC -faltivec option)
610 vector unsigned int vzero() {
611 return vec_splat_u32(0);
617 AC_MSG_RESULT($have_gcc_altivec)
619 CFLAGS="$save_CFLAGS"
621 if test x$have_gcc_altivec = xyes; then
622 AC_DEFINE(SDL_ALTIVEC_BLITTERS)
623 if test x$have_altivec_h_hdr = xyes; then
624 AC_DEFINE(HAVE_ALTIVEC_H)
626 EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS"
631 dnl See if the OSS audio interface is supported
635 AC_HELP_STRING([--enable-oss], [support the OSS audio API [[default=yes]]]),
637 if test x$enable_audio = xyes -a x$enable_oss = xyes; then
638 AC_MSG_CHECKING(for OSS audio support)
640 if test x$have_oss != xyes; then
642 #include <sys/soundcard.h>
644 int arg = SNDCTL_DSP_SETFRAGMENT;
649 if test x$have_oss != xyes; then
651 #include <soundcard.h>
653 int arg = SNDCTL_DSP_SETFRAGMENT;
656 AC_DEFINE(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H)
659 AC_MSG_RESULT($have_oss)
660 if test x$have_oss = xyes; then
661 AC_DEFINE(SDL_AUDIO_DRIVER_OSS)
662 SOURCES="$SOURCES $srcdir/src/audio/dsp/*.c"
663 SOURCES="$SOURCES $srcdir/src/audio/dma/*.c"
666 # We may need to link with ossaudio emulation library
668 *-*-openbsd*|*-*-netbsd*)
669 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";;
675 dnl See if the ALSA audio interface is supported
679 AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [[default=yes]]]),
681 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 # Restore all flags from before the ALSA detection runs
684 CFLAGS="$alsa_save_CFLAGS"
685 LDFLAGS="$alsa_save_LDFLAGS"
686 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'`]
693 AC_DEFINE(SDL_AUDIO_DRIVER_ALSA)
694 SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c"
695 EXTRA_CFLAGS="$EXTRA_CFLAGS $ALSA_CFLAGS"
696 if test x$have_loadso != xyes && \
697 test x$enable_alsa_shared = xyes; then
698 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ALSA loading])
700 if test x$have_loadso = xyes && \
701 test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
702 echo "-- dynamic libasound -> $alsa_lib"
703 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ALSA_DYNAMIC, "$alsa_lib")
705 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ALSA_LIBS"
712 dnl Find the ESD includes and libraries
716 AC_HELP_STRING([--enable-esd], [support the Enlightened Sound Daemon [[default=yes]]]),
718 if test x$enable_audio = xyes -a x$enable_esd = xyes; then
719 AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no)
720 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'`]
726 AC_DEFINE(SDL_AUDIO_DRIVER_ESD)
727 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])
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")
738 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ESD_LIBS"
748 AC_ARG_ENABLE(pulseaudio,
749 AC_HELP_STRING([--enable-pulseaudio], [use PulseAudio [[default=yes]]]),
750 , enable_pulseaudio=yes)
751 if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then
754 PULSEAUDIO_REQUIRED_VERSION=0.9
756 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
757 AC_MSG_CHECKING(for PulseAudio $PULSEAUDIO_REQUIRED_VERSION support)
758 if test x$PKG_CONFIG != xno; then
759 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSEAUDIO_REQUIRED_VERSION libpulse-simple; then
760 PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple`
761 PULSEAUDIO_LIBS=`$PKG_CONFIG --libs libpulse-simple`
765 AC_MSG_RESULT($audio_pulseaudio)
767 if test x$audio_pulseaudio = xyes; then
768 AC_ARG_ENABLE(pulseaudio-shared,
769 AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [[default=yes]]]),
770 , enable_pulseaudio_shared=yes)
771 pulseaudio_lib=[`find_lib "libpulse-simple.so.*" "$PULSEAUDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
773 AC_DEFINE(SDL_AUDIO_DRIVER_PULSEAUDIO)
774 SOURCES="$SOURCES $srcdir/src/audio/pulseaudio/*.c"
775 EXTRA_CFLAGS="$EXTRA_CFLAGS $PULSEAUDIO_CFLAGS"
776 if test x$have_loadso != xyes && \
777 test x$enable_pulseaudio_shared = xyes; then
778 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic PulseAudio loading])
780 if test x$have_loadso = xyes && \
781 test x$enable_pulseaudio_shared = xyes && test x$pulseaudio_lib != x; then
782 echo "-- dynamic libpulse-simple -> $pulseaudio_lib"
783 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC, "$pulseaudio_lib")
785 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PULSEAUDIO_LIBS"
795 AC_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [[default=yes]]]),
797 if test x$enable_audio = xyes -a x$enable_arts = xyes; then
798 AC_PATH_PROG(ARTSCONFIG, artsc-config)
799 if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then
800 : # arts isn't installed
802 ARTS_CFLAGS=`$ARTSCONFIG --cflags`
803 ARTS_LIBS=`$ARTSCONFIG --libs`
804 AC_MSG_CHECKING(for aRts development environment)
806 save_CFLAGS="$CFLAGS"
807 CFLAGS="$CFLAGS $ARTS_CFLAGS"
811 arts_stream_t stream;
815 CFLAGS="$save_CFLAGS"
816 AC_MSG_RESULT($audio_arts)
817 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'`]
823 AC_DEFINE(SDL_AUDIO_DRIVER_ARTS)
824 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])
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")
835 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS"
843 dnl See if the NAS audio interface is supported
847 AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]),
849 if test x$enable_audio = xyes -a x$enable_nas = xyes; then
850 AC_CHECK_HEADER(audio/audiolib.h, have_nas_hdr=yes)
851 AC_CHECK_LIB(audio, AuOpenServer, have_nas_lib=yes)
853 AC_MSG_CHECKING(for NAS audio support)
856 if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then
860 elif test -r /usr/X11R6/include/audio/audiolib.h; then
862 NAS_CFLAGS="-I/usr/X11R6/include/"
863 NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt"
867 AC_MSG_RESULT($have_nas)
869 if test x$have_nas = xyes; then
870 AC_ARG_ENABLE(nas-shared,
871 AC_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[default=yes]]]),
872 , enable_nas_shared=yes)
873 nas_lib=[`find_lib "libaudio.so.*" "$NAS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
875 if test x$have_loadso != xyes && \
876 test x$enable_nas_shared = xyes; then
877 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic NAS loading])
879 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 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_NAS_DYNAMIC, "$nas_lib")
884 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS"
887 AC_DEFINE(SDL_AUDIO_DRIVER_NAS)
888 SOURCES="$SOURCES $srcdir/src/audio/nas/*.c"
889 EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS"
895 dnl rcg07142001 See if the user wants the disk writer audio driver...
898 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 AC_DEFINE(SDL_AUDIO_DRIVER_DISK)
903 SOURCES="$SOURCES $srcdir/src/audio/disk/*.c"
907 dnl rcg03142006 See if the user wants the dummy audio driver...
910 AC_ARG_ENABLE(dummyaudio,
911 AC_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [[default=yes]]]),
912 , enable_dummyaudio=yes)
913 if test x$enable_audio = xyes -a x$enable_dummyaudio = xyes; then
914 AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY)
915 SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c"
919 dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
920 dnl Details of this flag are here: http://gcc.gnu.org/wiki/Visibility
921 CheckVisibilityHidden()
923 AC_MSG_CHECKING(for GCC -fvisibility=hidden option)
924 have_gcc_fvisibility=no
926 visibility_CFLAGS="-fvisibility=hidden"
927 save_CFLAGS="$CFLAGS"
928 CFLAGS="$save_CFLAGS $visibility_CFLAGS -Werror"
930 #if !defined(__GNUC__) || __GNUC__ < 4
931 #error SDL only uses visibility attributes in GCC 4 or newer
935 have_gcc_fvisibility=yes
937 AC_MSG_RESULT($have_gcc_fvisibility)
938 CFLAGS="$save_CFLAGS"
940 if test x$have_gcc_fvisibility = xyes; then
941 EXTRA_CFLAGS="$EXTRA_CFLAGS $visibility_CFLAGS"
946 dnl Find the X11 include and library directories
951 AC_ARG_ENABLE(video-x11,
952 AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]),
953 , enable_video_x11=yes)
954 if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
957 # This isn't necessary for X11, but fixes GLX detection
958 if test "x$x_includes" = xNONE && test "x$x_libraries" = xNONE; then
959 x_includes="/usr/X11R6/include"
960 x_libraries="/usr/X11R6/lib"
966 if test x$have_x = xyes; then
967 # Only allow dynamically loaded X11 if the X11 function pointers
968 # will not end up in the global namespace, which causes problems
969 # with other libraries calling X11 functions.
970 x11_symbols_private=$have_gcc_fvisibility
972 AC_ARG_ENABLE(x11-shared,
973 AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=maybe]]]),
974 , enable_x11_shared=maybe)
978 x11_symbols_private=yes
979 x11_lib='/usr/X11R6/lib/libX11.6.dylib'
980 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 xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
985 xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
986 xss_lib='/usr/X11R6/lib/libXss.1.dylib'
987 xvidmode_lib='/usr/X11R6/lib/libXxf86vm.1.dylib'
990 x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
991 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 xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
996 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'`]
1002 if test x$ac_cv_func_shmat != xyes; then
1003 X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY"
1005 CFLAGS="$CFLAGS $X_CFLAGS"
1006 LDFLAGS="$LDFLAGS $X_LIBS"
1008 AC_DEFINE(SDL_VIDEO_DRIVER_X11)
1009 SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
1010 EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
1012 if test x$enable_x11_shared = xmaybe; then
1013 enable_x11_shared=$x11_symbols_private
1015 if test x$have_loadso != xyes && \
1016 test x$enable_x11_shared = xyes; then
1017 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic X11 loading])
1018 enable_x11_shared=no
1020 if test x$x11_symbols_private != xyes && \
1021 test x$enable_x11_shared = xyes; then
1022 AC_MSG_WARN([You must have gcc4 (-fvisibility=hidden) for dynamic X11 loading])
1023 enable_x11_shared=no
1026 if test x$have_loadso = xyes && \
1027 test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then
1028 echo "-- dynamic libX11 -> $x11_lib"
1029 echo "-- dynamic libX11ext -> $x11ext_lib"
1030 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib")
1031 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib")
1033 enable_x11_shared=no
1034 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
1038 AC_ARG_ENABLE(video-x11-xcursor,
1039 AC_HELP_STRING([--enable-video-x11-xcursor], [enable X11 Xcursor support [[default=yes]]]),
1040 , enable_video_x11_xcursor=yes)
1041 if test x$enable_video_x11_xcursor = xyes; then
1042 definitely_enable_video_x11_xcursor=no
1043 AC_CHECK_HEADER(X11/Xcursor/Xcursor.h,
1044 have_xcursor_h_hdr=yes,
1045 have_xcursor_h_hdr=no,
1046 [#include <X11/Xlib.h>
1048 if test x$have_xcursor_h_hdr = xyes; then
1049 if test x$enable_x11_shared = xyes && test x$xcursor_lib != x ; then
1050 echo "-- dynamic libXcursor -> $xcursor_lib"
1051 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR, "$xcursor_lib")
1052 definitely_enable_video_x11_xcursor=yes
1054 AC_CHECK_LIB(Xcursor, XcursorImageCreate, have_xcursor_lib=yes)
1055 if test x$have_xcursor_lib = xyes ; then
1056 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXcursor"
1057 definitely_enable_video_x11_xcursor=yes
1062 if test x$definitely_enable_video_x11_xcursor = xyes; then
1063 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XCURSOR)
1065 AC_ARG_ENABLE(video-x11-xinerama,
1066 AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]),
1067 , enable_video_x11_xinerama=yes)
1068 if test x$enable_video_x11_xinerama = xyes; then
1069 definitely_enable_video_x11_xinerama=no
1070 AC_CHECK_HEADER(X11/extensions/Xinerama.h,
1071 have_xinerama_h_hdr=yes,
1072 have_xinerama_h_hdr=no,
1073 [#include <X11/Xlib.h>
1075 if test x$have_xinerama_h_hdr = xyes; then
1076 if test x$enable_x11_shared = xyes && test x$xinerama_lib != x ; then
1077 echo "-- dynamic libXinerama -> $xinerama_lib"
1078 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA, "$xinerama_lib")
1079 definitely_enable_video_x11_xinerama=yes
1081 AC_CHECK_LIB(Xinerama, XineramaQueryExtension, have_xinerama_lib=yes)
1082 if test x$have_xinerama_lib = xyes ; then
1083 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXinerama"
1084 definitely_enable_video_x11_xinerama=yes
1089 if test x$definitely_enable_video_x11_xinerama = xyes; then
1090 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA)
1092 AC_ARG_ENABLE(video-x11-xinput,
1093 AC_HELP_STRING([--enable-video-x11-xinput], [enable X11 XInput extension for manymouse, tablets, etc [[default=yes]]]),
1094 , enable_video_x11_xinput=yes)
1095 if test x$enable_video_x11_xinput = xyes; then
1096 definitely_enable_video_x11_xinput=no
1097 AC_CHECK_HEADER(X11/extensions/XInput.h,
1098 have_xinput_h_hdr=yes,
1099 have_xinput_h_hdr=no,
1100 [#include <X11/Xlib.h>
1102 if test x$have_xinput_h_hdr = xyes; then
1103 if test x$enable_x11_shared = xyes && test x$xinput_lib != x ; then
1104 echo "-- dynamic libXi -> $xinput_lib"
1105 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT, "$xinput_lib")
1106 definitely_enable_video_x11_xinput=yes
1108 AC_CHECK_LIB(Xi, XOpenDevice, have_xinput_lib=yes)
1109 if test x$have_xinput_lib = xyes ; then
1110 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXi"
1111 definitely_enable_video_x11_xinput=yes
1116 if test x$definitely_enable_video_x11_xinput = xyes; then
1117 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT)
1119 AC_ARG_ENABLE(video-x11-xrandr,
1120 AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]),
1121 , enable_video_x11_xrandr=yes)
1122 if test x$enable_video_x11_xrandr = xyes; then
1123 definitely_enable_video_x11_xrandr=no
1124 AC_CHECK_HEADER(X11/extensions/Xrandr.h,
1125 have_xrandr_h_hdr=yes,
1126 have_xrandr_h_hdr=no,
1127 [#include <X11/Xlib.h>
1129 if test x$have_xrandr_h_hdr = xyes; then
1130 if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then
1131 echo "-- dynamic libXrandr -> $xrandr_lib"
1132 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib")
1133 definitely_enable_video_x11_xrandr=yes
1135 AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes)
1136 if test x$have_xrandr_lib = xyes ; then
1137 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr"
1138 definitely_enable_video_x11_xrandr=yes
1143 if test x$definitely_enable_video_x11_xrandr = xyes; then
1144 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR)
1146 AC_ARG_ENABLE(video-x11-scrnsaver,
1147 AC_HELP_STRING([--enable-video-x11-scrnsaver], [enable X11 screensaver extension [[default=yes]]]),
1148 , enable_video_x11_scrnsaver=yes)
1149 if test x$enable_video_x11_scrnsaver = xyes; then
1150 AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
1151 have_scrnsaver_h_hdr=yes,
1152 have_scrnsaver_h_hdr=no,
1153 [#include <X11/Xlib.h>
1155 if test x$have_scrnsaver_h_hdr = xyes; then
1156 if test x$enable_x11_shared = xyes && test x$xss_lib != x ; then
1157 echo "-- dynamic libXss -> $xss_lib"
1158 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS, "$xss_lib")
1159 definitely_enable_video_x11_scrnsaver=yes
1161 AC_CHECK_LIB(Xss, XScreenSaverSuspend, have_xss_lib=yes)
1162 if test x$have_xss_lib = xyes ; then
1163 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXss"
1164 definitely_enable_video_x11_scrnsaver=yes
1169 if test x$definitely_enable_video_x11_scrnsaver = xyes; then
1170 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSCRNSAVER)
1172 AC_ARG_ENABLE(video-x11-xshape,
1173 AC_HELP_STRING([--enable-video-x11-xshape], [enable X11 XShape support [[default=yes]]]),
1174 , enable_video_x11_xshape=yes)
1175 if test x$enable_video_x11_xshape = xyes; then
1176 AC_CHECK_HEADER(X11/extensions/shape.h,
1177 have_shape_h_hdr=yes,
1178 have_shape_h_hdr=no,
1179 [#include <X11/Xlib.h>
1181 if test x$have_shape_h_hdr = xyes; then
1182 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSHAPE)
1185 AC_ARG_ENABLE(video-x11-vm,
1186 AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[default=yes]]]),
1187 , enable_video_x11_vm=yes)
1188 if test x$enable_video_x11_vm = xyes; then
1189 definitely_enable_video_x11_vm=no
1190 AC_CHECK_HEADER(X11/extensions/xf86vmode.h,
1193 [#include <X11/Xlib.h>
1195 if test x$have_vm_h_hdr = xyes; then
1196 if test x$enable_x11_shared = xyes && test x$xvidmode_lib != x ; then
1197 echo "-- dynamic libXxf86vm -> $xvidmode_lib"
1198 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE, "$xvidmode_lib")
1199 definitely_enable_video_x11_vm=yes
1201 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryVersion, have_vm_lib=yes)
1202 if test x$have_vm_lib = xyes ; then
1203 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXxf86vm"
1204 definitely_enable_video_x11_vm=yes
1209 if test x$definitely_enable_video_x11_vm = xyes; then
1210 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XVIDMODE)
1216 dnl Set up the BWindow video driver if enabled
1219 if test x$enable_video = xyes; then
1220 AC_DEFINE(SDL_VIDEO_DRIVER_BWINDOW)
1221 SOURCES="$SOURCES $srcdir/src/video/bwindow/*.cc"
1226 dnl Set up the Cocoa video driver for Mac OS X (but not Darwin)
1229 AC_ARG_ENABLE(video-cocoa,
1230 AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]),
1231 , enable_video_cocoa=yes)
1232 if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
1233 save_CFLAGS="$CFLAGS"
1234 dnl work around that we don't have Objective-C support in autoconf
1235 CFLAGS="$CFLAGS -x objective-c"
1236 AC_MSG_CHECKING(for Cocoa framework)
1239 #import <Cocoa/Cocoa.h>
1244 AC_MSG_RESULT($have_cocoa)
1245 CFLAGS="$save_CFLAGS"
1246 if test x$have_cocoa = xyes; then
1247 AC_DEFINE(SDL_VIDEO_DRIVER_COCOA)
1248 SOURCES="$SOURCES $srcdir/src/video/cocoa/*.m"
1257 AC_ARG_ENABLE(video-directfb,
1258 AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=no]]]),
1259 , enable_video_directfb=no)
1260 if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
1263 DIRECTFB_REQUIRED_VERSION=1.0.0
1264 AC_PATH_PROGS(DIRECTFBCONFIG, directfb-config, no, [$prefix/bin:$PATH])
1265 if test x$DIRECTFBCONFIG = xno; then
1266 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1267 if test x$PKG_CONFIG != xno; then
1268 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb; then
1269 DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
1270 DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
1271 DIRECTFB_PREFIX=`$PKG_CONFIG --variable=prefix directfb`
1276 set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'`
1277 NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
1278 set -- `directfb-config --version | sed 's/\./ /g'`
1279 HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
1280 if test $HAVE_VERSION -ge $NEED_VERSION; then
1281 DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags`
1282 DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs`
1283 DIRECTFB_PREFIX=`$DIRECTFBCONFIG --prefix`
1287 if test x$video_directfb = xyes; then
1288 # SuSE 11.1 installs directfb-config without directfb-devel
1289 save_CPPFLAGS="$CPPFLAGS"
1290 CPPFLAGS="$CPPFLAGS $DIRECTFB_CFLAGS"
1291 AC_CHECK_HEADER(directfb.h, have_directfb_hdr=yes, have_directfb_hdr=no)
1292 CPPFLAGS="$save_CPPFLAGS"
1293 video_directfb=$have_directfb_hdr
1295 AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support)
1296 AC_MSG_RESULT($video_directfb)
1298 if test x$video_directfb = xyes; then
1299 AC_ARG_ENABLE(directfb-shared,
1300 AC_HELP_STRING([--enable-directfb-shared], [dynamically load directfb support [[default=yes]]]),
1301 , enable_directfb_shared=yes)
1303 AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB)
1304 AC_DEFINE(SDL_VIDEO_RENDER_DIRECTFB)
1305 SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
1306 EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"
1308 AC_MSG_CHECKING(for directfb dynamic loading support)
1310 directfb_lib=[`find_lib "libdirectfb.so.*" "$DIRECTFB_LIBS"`]
1311 # | sed 's/.*\/\(.*\)/\1/; q'`]
1312 AC_MSG_WARN("directfb $directfb_lib")
1313 if test x$have_loadso != xyes && \
1314 test x$enable_directfb_shared = xyes; then
1315 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic directfb loading])
1317 if test x$have_loadso = xyes && \
1318 test x$enable_directfb_shared = xyes && test x$directfb_lib != x; then
1320 echo "-- $directfb_lib_spec -> $directfb_lib"
1321 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC, "$directfb_lib")
1323 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
1325 AC_MSG_RESULT($directfb_shared)
1331 dnl Find FusionSound
1334 AC_ARG_ENABLE(fusionsound,
1335 AC_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]),
1336 , enable_fusionsound=no)
1337 if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then
1340 FUSIONSOUND_REQUIRED_VERSION=1.1.1
1342 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1343 AC_MSG_CHECKING(for FusionSound $FUSIONSOUND_REQUIRED_VERSION support)
1344 if test x$PKG_CONFIG != xno; then
1345 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then
1346 FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound`
1347 FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound`
1351 AC_MSG_RESULT($fusionsound)
1353 if test x$fusionsound = xyes; then
1354 AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND)
1355 SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c"
1356 EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS"
1358 AC_ARG_ENABLE(fusionsound-shared,
1359 AC_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]),
1360 , enable_fusionsound_shared=yes)
1361 fusionsound_shared=no
1362 AC_MSG_CHECKING(for FusionSound dynamic loading support)
1363 if test x$have_loadso != xyes && \
1364 test x$enable_fusionsound_shared = xyes; then
1365 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading])
1367 if test x$have_loadso = xyes && \
1368 test x$enable_fusionsound_shared = xyes; then
1369 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so")
1370 fusionsound_shared=yes
1372 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS"
1374 AC_MSG_RESULT($fusionsound_shared)
1381 dnl rcg04172001 Set up the Null video driver.
1384 AC_ARG_ENABLE(video-dummy,
1385 AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]),
1386 , enable_video_dummy=yes)
1387 if test x$enable_video_dummy = xyes; then
1388 AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY)
1389 SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
1394 dnl Check to see if OpenGL support is desired
1395 AC_ARG_ENABLE(video-opengl,
1396 AC_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]),
1397 , enable_video_opengl=yes)
1402 if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
1403 AC_MSG_CHECKING(for OpenGL (GLX) support)
1412 AC_MSG_RESULT($video_opengl)
1413 if test x$video_opengl = xyes; then
1414 AC_DEFINE(SDL_VIDEO_OPENGL)
1415 AC_DEFINE(SDL_VIDEO_OPENGL_GLX)
1416 AC_DEFINE(SDL_VIDEO_RENDER_OGL)
1421 dnl Check for Windows OpenGL
1424 if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
1425 AC_DEFINE(SDL_VIDEO_OPENGL)
1426 AC_DEFINE(SDL_VIDEO_OPENGL_WGL)
1427 AC_DEFINE(SDL_VIDEO_RENDER_OGL)
1431 dnl Check for BeOS OpenGL
1434 if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
1435 AC_DEFINE(SDL_VIDEO_OPENGL)
1436 AC_DEFINE(SDL_VIDEO_OPENGL_BGL)
1437 AC_DEFINE(SDL_VIDEO_RENDER_OGL)
1438 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
1442 dnl Check for MacOS OpenGL
1445 if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
1446 AC_DEFINE(SDL_VIDEO_OPENGL)
1447 AC_DEFINE(SDL_VIDEO_OPENGL_CGL)
1448 AC_DEFINE(SDL_VIDEO_RENDER_OGL)
1451 if test x$enable_video_cocoa = xyes; then
1452 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGL"
1458 dnl See if we can use the new unified event interface in Linux 2.4
1461 dnl Check for Linux 2.4 unified input event interface support
1462 AC_ARG_ENABLE(input-events,
1463 AC_HELP_STRING([--enable-input-events], [use Linux 2.4 unified input interface [[default=yes]]]),
1464 , enable_input_events=yes)
1465 if test x$enable_input_events = xyes; then
1466 AC_MSG_CHECKING(for Linux 2.4 unified input interface)
1469 #include <linux/input.h>
1472 #error EVIOCGNAME() ioctl not available
1475 use_input_events=yes
1477 AC_MSG_RESULT($use_input_events)
1478 if test x$use_input_events = xyes; then
1479 AC_DEFINE(SDL_INPUT_LINUXEV)
1484 dnl See if we can use the Touchscreen input library
1487 AC_ARG_ENABLE(input-tslib,
1488 AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]),
1489 , enable_input_tslib=yes)
1490 if test x$enable_input_tslib = xyes; then
1491 AC_MSG_CHECKING(for Touchscreen library support)
1492 enable_input_tslib=no
1497 enable_input_tslib=yes
1499 AC_MSG_RESULT($enable_input_tslib)
1500 if test x$enable_input_tslib = xyes; then
1501 AC_DEFINE(SDL_INPUT_TSLIB)
1502 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
1507 dnl See what type of thread model to use on Linux and Solaris
1510 dnl Check for pthread support
1511 AC_ARG_ENABLE(pthreads,
1512 AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]),
1513 , enable_pthreads=yes)
1514 dnl This is used on Linux for glibc binary compatibility (Doh!)
1515 AC_ARG_ENABLE(pthread-sem,
1516 AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
1517 , enable_pthread_sem=yes)
1519 *-*-linux*|*-*-uclinux*)
1520 pthread_cflags="-D_REENTRANT"
1521 pthread_lib="-lpthread"
1524 pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
1528 pthread_cflags="-D_THREAD_SAFE"
1529 # causes Carbon.p complaints?
1530 # pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
1532 *-*-freebsd*|*-*-dragonfly*)
1533 pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
1534 pthread_lib="-pthread"
1537 pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
1538 pthread_lib="-lpthread"
1541 pthread_cflags="-D_REENTRANT"
1542 pthread_lib="-pthread"
1545 pthread_cflags="-D_REENTRANT"
1546 pthread_lib="-lpthread -lposix4"
1549 pthread_cflags="-D_REENTRANT -Kthread"
1553 pthread_cflags="-D_REENTRANT -mthreads"
1554 pthread_lib="-lpthread"
1557 pthread_cflags="-D_REENTRANT"
1558 pthread_lib="-L/usr/lib -lpthread"
1561 pthread_cflags="-D_REENTRANT"
1562 pthread_lib="-lpthread"
1565 if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
1566 # Save the original compiler flags and libraries
1567 ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
1568 # Add the pthread compiler flags and libraries
1569 CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
1570 # Check to see if we have pthread support on this system
1571 AC_MSG_CHECKING(for pthreads)
1574 #include <pthread.h>
1576 pthread_attr_t type;
1577 pthread_attr_init(&type);
1581 AC_MSG_RESULT($use_pthreads)
1582 # Restore the compiler flags and libraries
1583 CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
1585 # Do futher testing if we have pthread support...
1586 if test x$use_pthreads = xyes; then
1587 AC_DEFINE(SDL_THREAD_PTHREAD)
1588 EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
1589 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
1590 SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
1591 SDL_LIBS="$SDL_LIBS $pthread_lib"
1593 # Save the original compiler flags and libraries
1594 ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
1595 # Add the pthread compiler flags and libraries
1596 CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
1598 # Check to see if recursive mutexes are available
1599 AC_MSG_CHECKING(for recursive mutexes)
1600 has_recursive_mutexes=no
1601 if test x$has_recursive_mutexes = xno; then
1603 #include <pthread.h>
1605 pthread_mutexattr_t attr;
1606 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
1608 has_recursive_mutexes=yes
1609 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX)
1612 if test x$has_recursive_mutexes = xno; then
1614 #include <pthread.h>
1616 pthread_mutexattr_t attr;
1617 pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
1619 has_recursive_mutexes=yes
1620 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP)
1623 AC_MSG_RESULT($has_recursive_mutexes)
1625 # Check to see if pthread semaphore support is missing
1626 if test x$enable_pthread_sem = xyes; then
1627 AC_MSG_CHECKING(for pthread semaphores)
1630 #include <pthread.h>
1631 #include <semaphore.h>
1634 have_pthread_sem=yes
1636 AC_MSG_RESULT($have_pthread_sem)
1639 # Restore the compiler flags and libraries
1640 CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
1642 # Basic thread creation functions
1643 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
1646 # We can fake these with mutexes and condition variables if necessary
1647 if test x$have_pthread_sem = xyes; then
1648 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
1650 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
1654 # We can fake these with semaphores if necessary
1655 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
1657 # Condition variables
1658 # We can fake these with semaphores and mutexes if necessary
1659 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
1666 dnl Determine whether the compiler can produce Windows executables
1669 AC_MSG_CHECKING(Windows compiler)
1672 #include <windows.h>
1677 AC_MSG_RESULT($have_win32_gcc)
1678 if test x$have_win32_gcc != xyes; then
1680 *** Your compiler ($CC) does not produce Windows executables!
1684 AC_MSG_CHECKING(Windows CE)
1687 #if !defined(_WIN32_WCE) && !defined(__MINGW32CE__)
1688 #error This is not Windows CE
1694 AC_MSG_RESULT($have_wince)
1697 dnl Find the DirectX includes and libraries
1700 AC_ARG_ENABLE(directx,
1701 AC_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[default=yes]]]),
1702 , enable_directx=yes)
1703 if test x$enable_directx = xyes; then
1704 AC_CHECK_HEADER(d3d9.h, have_d3d=yes)
1705 AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
1706 AC_CHECK_HEADER(dsound.h, have_dsound=yes)
1707 AC_CHECK_HEADER(dinput.h, have_dinput=yes)
1711 dnl Check for the dlfcn.h interface for dynamically loading objects
1714 AC_ARG_ENABLE(sdl-dlopen,
1715 AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]),
1716 , enable_sdl_dlopen=yes)
1717 if test x$enable_sdl_dlopen = xyes; then
1718 AC_MSG_CHECKING(for dlopen)
1723 #if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED <= 1020
1724 #error Use dlcompat for Mac OS X 10.2 compatibility
1729 AC_MSG_RESULT($have_dlopen)
1731 if test x$have_dlopen = xyes; then
1732 AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
1733 AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
1734 AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
1735 AC_DEFINE(SDL_LOADSO_DLOPEN)
1736 SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
1742 dnl Check for the usbhid(3) library on *BSD
1745 if test x$enable_joystick = xyes; then
1746 AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
1747 if test x$have_libusbhid = xyes; then
1748 AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
1749 AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
1750 USB_LIBS="$USB_LIBS -lusbhid"
1752 AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
1753 AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
1754 AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
1757 save_CFLAGS="$CFLAGS"
1758 CFLAGS="$CFLAGS $USB_CFLAGS"
1760 AC_MSG_CHECKING(for usbhid)
1763 #include <sys/types.h>
1764 #if defined(HAVE_USB_H)
1767 #ifdef __DragonFly__
1768 # include <bus/usb/usb.h>
1769 # include <bus/usb/usbhid.h>
1771 # include <dev/usb/usb.h>
1772 # include <dev/usb/usbhid.h>
1774 #if defined(HAVE_USBHID_H)
1776 #elif defined(HAVE_LIBUSB_H)
1778 #elif defined(HAVE_LIBUSBHID_H)
1779 #include <libusbhid.h>
1782 struct report_desc *repdesc;
1783 struct usb_ctl_report *repbuf;
1788 AC_MSG_RESULT($have_usbhid)
1790 if test x$have_usbhid = xyes; then
1791 AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
1792 have_usbhid_ucr_data=no
1794 #include <sys/types.h>
1795 #if defined(HAVE_USB_H)
1798 #ifdef __DragonFly__
1799 # include <bus/usb/usb.h>
1800 # include <bus/usb/usbhid.h>
1802 # include <dev/usb/usb.h>
1803 # include <dev/usb/usbhid.h>
1805 #if defined(HAVE_USBHID_H)
1807 #elif defined(HAVE_LIBUSB_H)
1809 #elif defined(HAVE_LIBUSBHID_H)
1810 #include <libusbhid.h>
1813 struct usb_ctl_report buf;
1814 if (buf.ucr_data) { }
1816 have_usbhid_ucr_data=yes
1818 if test x$have_usbhid_ucr_data = xyes; then
1819 USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
1821 AC_MSG_RESULT($have_usbhid_ucr_data)
1823 AC_MSG_CHECKING(for new usbhid API)
1826 #include <sys/types.h>
1827 #if defined(HAVE_USB_H)
1830 #ifdef __DragonFly__
1831 #include <bus/usb/usb.h>
1832 #include <bus/usb/usbhid.h>
1834 #include <dev/usb/usb.h>
1835 #include <dev/usb/usbhid.h>
1837 #if defined(HAVE_USBHID_H)
1839 #elif defined(HAVE_LIBUSB_H)
1841 #elif defined(HAVE_LIBUSBHID_H)
1842 #include <libusbhid.h>
1846 hid_start_parse(d, 1, 1);
1850 if test x$have_usbhid_new = xyes; then
1851 USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
1853 AC_MSG_RESULT($have_usbhid_new)
1855 AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
1856 have_machine_joystick=no
1858 #include <machine/joystick.h>
1862 have_machine_joystick=yes
1864 if test x$have_machine_joystick = xyes; then
1865 AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H)
1867 AC_MSG_RESULT($have_machine_joystick)
1869 AC_DEFINE(SDL_JOYSTICK_USBHID)
1870 SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
1871 EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
1872 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
1875 CFLAGS="$save_CFLAGS"
1879 dnl Check for clock_gettime()
1882 AC_ARG_ENABLE(clock_gettime,
1883 AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=no]]]),
1884 , enable_clock_gettime=no)
1885 if test x$enable_clock_gettime = xyes; then
1886 AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
1887 if test x$have_clock_gettime = xyes; then
1888 AC_DEFINE(HAVE_CLOCK_GETTIME)
1889 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
1891 AC_CHECK_LIB(c, clock_gettime, have_clock_gettime=yes)
1892 if test x$have_clock_gettime = xyes; then
1893 AC_DEFINE(HAVE_CLOCK_GETTIME)
1894 EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
1900 dnl Check for a valid linux/version.h
1903 AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
1904 if test x$have_linux_version_h = xyes; then
1905 EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
1909 dnl Check if we want to use RPATH
1912 AC_ARG_ENABLE(rpath,
1913 AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]),
1917 dnl Set up the configuration based on the host platform!
1919 *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*)
1921 *-*-linux*) ARCH=linux ;;
1922 *-*-uclinux*) ARCH=linux ;;
1923 *-*-kfreebsd*-gnu) ARCH=kfreebsd-gnu ;;
1924 *-*-knetbsd*-gnu) ARCH=knetbsd-gnu ;;
1925 *-*-kopenbsd*-gnu) ARCH=kopenbsd-gnu ;;
1926 *-*-gnu*) ARCH=gnu ;; # must be last of the gnu variants
1927 *-*-bsdi*) ARCH=bsdi ;;
1928 *-*-freebsd*) ARCH=freebsd ;;
1929 *-*-dragonfly*) ARCH=freebsd ;;
1930 *-*-netbsd*) ARCH=netbsd ;;
1931 *-*-openbsd*) ARCH=openbsd ;;
1932 *-*-sysv5*) ARCH=sysv5 ;;
1933 *-*-solaris*) ARCH=solaris ;;
1934 *-*-hpux*) ARCH=hpux ;;
1935 *-*-aix*) ARCH=aix ;;
1936 *-*-minix*) ARCH=minix ;;
1938 CheckVisibilityHidden
1960 # Set up files for the audio library
1961 if test x$enable_audio = xyes; then
1964 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
1965 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
1969 AC_DEFINE(SDL_AUDIO_DRIVER_BSD)
1970 SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c"
1974 AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO)
1975 SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
1980 # Set up files for the joystick library
1981 if test x$enable_joystick = xyes; then
1984 AC_DEFINE(SDL_JOYSTICK_LINUX)
1985 SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
1990 # Set up files for the haptic library
1991 if test x$enable_haptic = xyes; then
1992 if test x$use_input_events = xyes; then
1995 AC_DEFINE(SDL_HAPTIC_LINUX)
1996 SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c"
2002 # Set up files for the power library
2003 if test x$enable_power = xyes; then
2006 AC_DEFINE(SDL_POWER_LINUX)
2007 SOURCES="$SOURCES $srcdir/src/power/linux/*.c"
2012 # Set up files for the timer library
2013 if test x$enable_timers = xyes; then
2014 AC_DEFINE(SDL_TIMER_UNIX)
2015 SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
2019 *-wince* | *-mingw32ce)
2025 if test x$enable_video = xyes; then
2026 AC_DEFINE(SDL_VIDEO_DRIVER_WINDOWS)
2027 SOURCES="$SOURCES $srcdir/src/video/windows/*.c"
2029 AC_ARG_ENABLE(render-d3d,
2030 AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
2031 , enable_render_d3d=yes)
2032 enable_render_d3d=no
2033 if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
2034 AC_DEFINE(SDL_VIDEO_RENDER_D3D)
2037 # Set up files for the audio library
2038 if test x$enable_audio = xyes; then
2039 AC_DEFINE(SDL_AUDIO_DRIVER_WINWAVEOUT)
2040 SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
2041 if test x$have_dsound = xyes; then
2042 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
2043 SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
2047 # Set up dummy files for the joystick for now
2048 if test x$enable_joystick = xyes; then
2049 AC_DEFINE(SDL_JOYSTICK_DUMMY)
2050 SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
2053 # Set up files for the thread library
2054 if test x$enable_threads = xyes; then
2055 AC_DEFINE(SDL_THREAD_WINDOWS)
2056 SOURCES="$SOURCES $srcdir/src/thread/windows/SDL_sysmutex.c"
2057 SOURCES="$SOURCES $srcdir/src/thread/windows/SDL_syssem.c"
2058 SOURCES="$SOURCES $srcdir/src/thread/windows/SDL_systhread.c"
2059 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
2062 # Set up files for the timer library
2063 if test x$enable_timers = xyes; then
2064 AC_DEFINE(SDL_TIMER_WINCE)
2065 SOURCES="$SOURCES $srcdir/src/timer/wince/*.c"
2068 # Set up files for the shared object loading library
2069 if test x$enable_loadso = xyes; then
2070 AC_DEFINE(SDL_LOADSO_WINDOWS)
2071 SOURCES="$SOURCES $srcdir/src/loadso/windows/*.c"
2074 # Set up the system libraries we need
2075 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lcoredll -lcommctrl -lmmtimer"
2080 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmingwex"
2086 # The Windows platform requires special setup
2087 SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c"
2088 EXTRA_CFLAGS="$EXTRA_CFLAGS -Dmain=SDL_main -D_WIN32_WCE=0x420"
2089 EXTRA_LDFLAGS="-lSDLmain $EXTRA_LDFLAGS"
2091 *-*-cygwin* | *-*-mingw32*)
2093 if test "$build" != "$host"; then # cross-compiling
2094 # Default cross-compile location
2095 ac_default_prefix=/usr/local/cross-tools/$host
2097 # Look for the location of the tools and install there
2098 if test "$BUILD_PREFIX" != ""; then
2099 ac_default_prefix=$BUILD_PREFIX
2109 # Set up the core platform files
2110 SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
2112 # Set up files for the video library
2113 if test x$enable_video = xyes; then
2114 AC_DEFINE(SDL_VIDEO_DRIVER_WINDOWS)
2115 SOURCES="$SOURCES $srcdir/src/video/windows/*.c"
2117 AC_ARG_ENABLE(render-d3d,
2118 AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
2119 , enable_render_d3d=yes)
2120 if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
2121 AC_DEFINE(SDL_VIDEO_RENDER_D3D)
2124 # Set up files for the audio library
2125 if test x$enable_audio = xyes; then
2126 AC_DEFINE(SDL_AUDIO_DRIVER_WINWAVEOUT)
2127 SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
2128 if test x$have_dsound = xyes; then
2129 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
2130 SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
2134 # Set up files for the joystick library
2135 if test x$enable_joystick = xyes; then
2136 if test x$have_dinput = xyes; then
2137 AC_DEFINE(SDL_JOYSTICK_DINPUT)
2138 SOURCES="$SOURCES $srcdir/src/joystick/windows/SDL_dxjoystick.c"
2139 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8"
2141 AC_DEFINE(SDL_JOYSTICK_WINMM)
2142 SOURCES="$SOURCES $srcdir/src/joystick/windows/SDL_mmjoystick.c"
2146 if test x$enable_haptic = xyes; then
2147 if test x$have_dinput = xyes; then
2148 AC_DEFINE(SDL_HAPTIC_DINPUT)
2149 SOURCES="$SOURCES $srcdir/src/haptic/windows/SDL_syshaptic.c"
2153 if test x$enable_power = xyes; then
2154 AC_DEFINE(SDL_POWER_WINDOWS)
2155 SOURCES="$SOURCES $srcdir/src/power/windows/SDL_syspower.c"
2158 # Set up files for the thread library
2159 if test x$enable_threads = xyes; then
2160 AC_DEFINE(SDL_THREAD_WINDOWS)
2161 SOURCES="$SOURCES $srcdir/src/thread/windows/SDL_sysmutex.c"
2162 SOURCES="$SOURCES $srcdir/src/thread/windows/SDL_syssem.c"
2163 SOURCES="$SOURCES $srcdir/src/thread/windows/SDL_systhread.c"
2164 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
2167 # Set up files for the timer library
2168 if test x$enable_timers = xyes; then
2169 AC_DEFINE(SDL_TIMER_WINDOWS)
2170 SOURCES="$SOURCES $srcdir/src/timer/windows/*.c"
2173 # Set up files for the shared object loading library
2174 if test x$enable_loadso = xyes; then
2175 AC_DEFINE(SDL_LOADSO_WINDOWS)
2176 SOURCES="$SOURCES $srcdir/src/loadso/windows/*.c"
2179 # Set up the system libraries we need
2180 # SDL 1.3 is unicode, and unicows emulates this on Windows 98/ME
2181 # You can get this here: http://libunicows.sourceforge.net/
2182 #EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lunicows"
2183 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lversion -luuid"
2184 # The Windows platform requires special setup
2185 VERSION_SOURCES="$srcdir/src/main/windows/*.rc"
2186 SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c"
2187 SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
2188 SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
2190 *-*-beos* | *-*-haiku*)
2192 ac_default_prefix=/boot/develop/tools/gnupro
2198 # Set up files for the audio library
2199 if test x$enable_audio = xyes; then
2200 AC_DEFINE(SDL_AUDIO_DRIVER_BEOSAUDIO)
2201 SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc"
2204 # Set up files for the joystick library
2205 if test x$enable_joystick = xyes; then
2206 AC_DEFINE(SDL_JOYSTICK_BEOS)
2207 SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc"
2210 # Set up files for the thread library
2211 if test x$enable_threads = xyes; then
2212 AC_DEFINE(SDL_THREAD_BEOS)
2213 SOURCES="$SOURCES $srcdir/src/thread/beos/*.c"
2214 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
2215 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
2218 # Set up files for the timer library
2219 if test x$enable_timers = xyes; then
2220 AC_DEFINE(SDL_TIMER_BEOS)
2221 SOURCES="$SOURCES $srcdir/src/timer/beos/*.c"
2224 # Set up files for the shared object loading library
2225 if test x$enable_loadso = xyes; then
2226 AC_DEFINE(SDL_LOADSO_BEOS)
2227 SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
2230 # Set up files for the system power library
2231 if test x$enable_power = xyes; then
2232 AC_DEFINE(SDL_POWER_BEOS)
2233 SOURCES="$SOURCES $srcdir/src/power/beos/*.c"
2236 # The BeOS platform requires special setup.
2237 SOURCES="$srcdir/src/main/beos/*.cc $SOURCES"
2238 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
2241 # This could be either full "Mac OS X", or plain "Darwin" which is
2242 # just the OS X kernel sans upper layers like Carbon and Cocoa.
2243 # Next line is broken, and a few files below require Mac OS X (full)
2246 # Mac OS X builds with both the Carbon and OSX APIs at the moment
2247 EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
2248 EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
2250 CheckVisibilityHidden
2256 # Set up files for the shared object loading library
2257 # (this needs to be done before the dynamic X11 check)
2258 if test x$enable_loadso = xyes -a x$have_dlopen != xyes; then
2259 AC_DEFINE(SDL_LOADSO_DLCOMPAT)
2260 SOURCES="$SOURCES $srcdir/src/loadso/macosx/*.c"
2270 # Good optimization on Mac OS X, yes...
2271 EXTRA_CFLAGS="$EXTRA_CFLAGS -falign-loops=16"
2273 # Need this or things might misbuild on a G3.
2274 EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"
2276 # Set up files for the audio library
2277 if test x$enable_audio = xyes; then
2278 AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO)
2279 SOURCES="$SOURCES $srcdir/src/audio/macosx/*.c"
2282 # Set up files for the joystick library
2283 if test x$enable_joystick = xyes; then
2284 AC_DEFINE(SDL_JOYSTICK_IOKIT)
2285 SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
2288 # Set up files for the haptic library
2289 if test x$enable_haptic = xyes; then
2290 AC_DEFINE(SDL_HAPTIC_IOKIT)
2291 SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
2293 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
2295 # Set up files for the power library
2296 if test x$enable_power = xyes; then
2297 AC_DEFINE(SDL_POWER_MACOSX)
2298 SOURCES="$SOURCES $srcdir/src/power/macosx/*.c"
2301 # Set up files for the timer library
2302 if test x$enable_timers = xyes; then
2303 AC_DEFINE(SDL_TIMER_UNIX)
2304 SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
2307 # Set up additional files for the file library
2308 if test x$enable_file = xyes; then
2309 SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
2311 # The Mac OS X platform requires special setup.
2312 EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
2313 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc"
2314 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
2315 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
2316 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
2317 # If audio is used, add the AudioUnit framework
2318 if test x$enable_audio = xyes; then
2319 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit"
2324 *** Unsupported host: Please add to configure.in
2329 # Verify that we have all the platform specific files we need
2331 if test x$have_joystick != xyes; then
2332 if test x$enable_joystick = xyes; then
2333 AC_DEFINE(SDL_JOYSTICK_DISABLED)
2335 SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
2337 if test x$have_haptic != xyes; then
2338 if test x$enable_haptic = xyes; then
2339 AC_DEFINE(SDL_HAPTIC_DISABLED)
2341 SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
2343 if test x$have_threads != xyes; then
2344 if test x$enable_threads = xyes; then
2345 AC_DEFINE(SDL_THREADS_DISABLED)
2347 SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
2349 if test x$have_timers != xyes; then
2350 if test x$enable_timers = xyes; then
2351 AC_DEFINE(SDL_TIMERS_DISABLED)
2353 SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
2355 if test x$have_loadso != xyes; then
2356 if test x$enable_loadso = xyes; then
2357 AC_DEFINE(SDL_LOADSO_DISABLED)
2359 SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
2361 if test x$SDLMAIN_SOURCES = x; then
2362 SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
2365 OBJECTS=`echo $SOURCES`
2366 DEPENDS=`echo $SOURCES | tr ' ' '\n'`
2367 for EXT in asm cc m c S; do
2368 OBJECTS=`echo "$OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.'$EXT',$(objects)/\1.lo,g'`
2369 DEPENDS=`echo "$DEPENDS" | sed "s,^\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.$EXT\\$,\\\\
2370 \\$(objects)/\\2.lo: \\1/\\2.$EXT\\\\
2371 \\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
2374 VERSION_OBJECTS=`echo $VERSION_SOURCES`
2375 VERSION_DEPENDS=`echo $VERSION_SOURCES`
2376 VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
2377 VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.rc,\\\\
2378 \\$(objects)/\\2.o: \\1/\\2.rc\\\\
2379 \\$(WINDRES) \\$< \\$@,g"`
2381 SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES`
2382 SDLMAIN_DEPENDS=`echo $SDLMAIN_SOURCES`
2383 SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
2384 SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
2385 \\$(objects)/\\2.o: \\1/\\2.c\\\\
2386 \\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
2388 # Set runtime shared library paths as needed
2390 if test "x$enable_rpath" = "xyes"; then
2391 if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then
2392 SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
2394 if test $ARCH = solaris; then
2395 SDL_RLD_FLAGS="-R\${libdir}"
2403 # Evil hack to allow static linking on Mac OS X
2404 SDL_STATIC_LIBS="\${libdir}/libSDL.a $EXTRA_LDFLAGS"
2407 SDL_STATIC_LIBS="$SDL_LIBS $EXTRA_LDFLAGS"
2411 dnl Expand the cflags and libraries needed by apps using SDL
2412 AC_SUBST(SDL_CFLAGS)
2414 AC_SUBST(SDL_STATIC_LIBS)
2415 AC_SUBST(SDL_RLD_FLAGS)
2416 if test x$enable_shared = xyes; then
2418 ENABLE_SHARED_FALSE="#"
2420 ENABLE_SHARED_TRUE="#"
2421 ENABLE_SHARED_FALSE=
2423 if test x$enable_static = xyes; then
2425 ENABLE_STATIC_FALSE="#"
2427 ENABLE_STATIC_TRUE="#"
2428 ENABLE_STATIC_FALSE=
2430 AC_SUBST(ENABLE_SHARED_TRUE)
2431 AC_SUBST(ENABLE_SHARED_FALSE)
2432 AC_SUBST(ENABLE_STATIC_TRUE)
2433 AC_SUBST(ENABLE_STATIC_FALSE)
2435 dnl Expand the sources and objects needed to build the library
2436 AC_SUBST(ac_aux_dir)
2439 AC_SUBST(VERSION_OBJECTS)
2440 AC_SUBST(SDLMAIN_OBJECTS)
2441 AC_SUBST(BUILD_CFLAGS)
2442 AC_SUBST(EXTRA_CFLAGS)
2443 AC_SUBST(BUILD_LDFLAGS)
2444 AC_SUBST(EXTRA_LDFLAGS)
2447 cat >Makefile.rules <<__EOF__
2449 # Build rules for objects
2450 -include \$(OBJECTS:.lo=.d)
2452 # Special dependency for SDL.c, since it depends on SDL_revision.h
2453 $srcdir/src/SDL.c: update-revision
2460 Makefile:Makefile.in:Makefile.rules sdl-config SDL.spec sdl.pc