1 dnl Process this file with autoconf to produce a configure script.
3 AC_CONFIG_HEADER(include/SDL_config.h)
4 AC_CONFIG_AUX_DIR(build-scripts)
5 AC_CONFIG_MACRO_DIR([acinclude])
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_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 AC_CHECK_TOOL(WINDRES, [windres], [:])
60 dnl Make sure that srcdir is a full pathname
63 # Except on msys, where make can't handle full pathnames (bug 1972)
66 srcdir=`cd $srcdir && pwd`
70 dnl Set up the compiler and linker flags
71 INCLUDE="-I$srcdir/include"
72 if test x$srcdir != x.; then
73 INCLUDE="-Iinclude $INCLUDE"
74 elif test -d .hg; then
76 *** When building from Mercurial you should configure and build in a
77 separate directory so you don't clobber SDL_config.h, SDL_revision.h
84 # We build SDL on cygwin without the UNIX emulation layer
87 AC_MSG_CHECKING(for GCC -mno-cygwin option)
88 CFLAGS="$save_CFLAGS -mno-cygwin"
95 AC_MSG_RESULT($have_no_cygwin)
98 if test x$have_no_cygwin = xyes; then
99 BASE_CFLAGS="-mno-cygwin"
100 BASE_LDFLAGS="-mno-cygwin"
102 BASE_CFLAGS="$BASE_CFLAGS -I/usr/include/mingw"
105 # Uncomment the following line if you want to force SDL and applications
106 # built with it to be compiled for a particular architecture.
107 #AX_GCC_ARCHFLAG([no], [BASE_CFLAGS="$BASE_CFLAGS $ax_cv_gcc_archflag]")
108 BUILD_CFLAGS="$CFLAGS $CPPFLAGS -DUSING_GENERATED_CONFIG_H"
109 # The default optimization for SDL is -O3 (Bug #31)
110 if test "x$orig_CFLAGS" = x; then
111 BUILD_CFLAGS=`echo $BUILD_CFLAGS | sed 's/-O2/-O3/'`
113 EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS"
114 BUILD_LDFLAGS="$LDFLAGS"
115 EXTRA_LDFLAGS="$BASE_LDFLAGS"
116 ## These are common directories to find software packages
117 #for path in /usr/freeware /usr/pkg /usr/X11R6 /usr/local; do
118 # if test -d $path/include; then
119 # EXTRA_CFLAGS="$EXTRA_CFLAGS -I$path/include"
121 # if test -d $path/lib; then
122 # EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$path/lib"
125 SDL_CFLAGS="$BASE_CFLAGS"
126 SDL_LIBS="-lSDL2 $BASE_LDFLAGS"
127 CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS"
128 CFLAGS="$CFLAGS $EXTRA_CFLAGS"
129 LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
131 dnl set this to use on systems that use lib64 instead of lib
132 base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
134 dnl Function to find a library in the compiler search path
137 gcc_bin_path=[`$CC -print-search-dirs 2>/dev/null | fgrep programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
138 gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
139 env_lib_path=[`echo $LIBS $LDFLAGS $* | sed 's/-L[ ]*//g'`]
140 if test "$cross_compiling" = yes; then
143 host_lib_path="/usr/$base_libdir /usr/local/$base_libdir"
145 for path in $gcc_bin_path $gcc_lib_path $env_lib_path $host_lib_path; do
146 lib=[`ls -- $path/$1 2>/dev/null | sed -e '/\.so\..*\./d' -e 's,.*/,,' | sort | tail -1`]
147 if test x$lib != x; then
154 dnl Check for compiler characteristics
159 dnl See whether we want assertions for debugging/sanity checking SDL itself.
160 AC_ARG_ENABLE(assertions,
161 AC_HELP_STRING([--enable-assertions],
162 [Enable internal sanity checks (auto/disabled/release/enabled/paranoid) [[default=auto]]]),
163 , enable_assertions=auto)
164 case "$enable_assertions" in
165 auto) # Use optimization settings to determine assertion level
168 AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 0, [ ])
171 AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 1, [ ])
174 AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 2, [ ])
177 AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 3, [ ])
180 AC_MSG_ERROR([*** unknown assertion level. stop.])
184 dnl See whether we can use gcc style dependency tracking
185 AC_ARG_ENABLE(dependency-tracking,
186 AC_HELP_STRING([--enable-dependency-tracking],
187 [Use gcc -MMD -MT dependency tracking [[default=yes]]]),
188 , enable_dependency_tracking=yes)
189 if test x$enable_dependency_tracking = xyes; then
191 AC_MSG_CHECKING(for GCC -MMD -MT option)
193 #if !defined(__GNUC__) || __GNUC__ < 3
194 #error Dependency tracking requires GCC 3.0 or newer
200 AC_MSG_RESULT($have_gcc_mmd_mt)
202 if test x$have_gcc_mmd_mt = xyes; then
203 DEPENDENCY_TRACKING_OPTIONS="-MMD -MT \$@"
207 # Actually this doesn't work on OpenBSD and BeOS
208 #AC_MSG_CHECKING(for linker option --no-undefined)
209 #have_no_undefined=no
210 #save_LDFLAGS="$LDFLAGS"
211 #LDFLAGS="$LDFLAGS -Wl,--no-undefined"
215 #have_no_undefined=yes
216 #EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--no-undefined"
218 #LDFLAGS="$save_LDFLAGS"
219 #AC_MSG_RESULT($have_no_undefined)
221 dnl See whether we are allowed to use the system C library
223 AC_HELP_STRING([--enable-libc], [Use the system C library [[default=yes]]]),
225 if test x$enable_libc = xyes; then
226 AC_DEFINE(HAVE_LIBC, 1, [ ])
228 dnl Check for C library headers
230 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)
232 dnl Check for typedefs, structures, etc.
235 dnl Check for defines
236 AC_CHECK_DEFINE(M_PI, math.h)
238 dnl Checks for library functions.
240 *-*-cygwin* | *-*-mingw32*)
248 if test x$ac_cv_func_memcmp_working = xyes; then
249 AC_DEFINE(HAVE_MEMCMP, 1, [ ])
252 if test x$ac_cv_func_strtod = xyes; then
253 AC_DEFINE(HAVE_STRTOD, 1, [ ])
255 AC_CHECK_FUNC(mprotect,
257 #include <sys/types.h>
258 #include <sys/mman.h>
261 AC_DEFINE(HAVE_MPROTECT, 1, [ ])
264 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 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname)
266 AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
267 AC_CHECK_FUNCS(atan atan2 ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt)
269 AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"])
270 AC_CHECK_FUNCS(iconv)
272 AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE(HAVE_SA_SIGACTION)], ,[#include <signal.h>])
275 dnl AC_CHECK_SIZEOF(void*)
277 dnl See whether we can use gcc atomic operations on this architecture
278 AC_ARG_ENABLE(gcc-atomics,
279 AC_HELP_STRING([--enable-gcc-atomics],
280 [Use gcc builtin atomics [[default=yes]]]),
281 , enable_gcc_atomics=yes)
282 if test x$enable_gcc_atomics = xyes; then
284 AC_MSG_CHECKING(for GCC builtin atomic operations)
289 __sync_lock_test_and_set(&a, 4);
290 __sync_lock_test_and_set(&x, y);
291 __sync_fetch_and_add(&a, 1);
292 __sync_bool_compare_and_swap(&a, 5, 10);
293 __sync_bool_compare_and_swap(&x, y, z);
297 AC_MSG_RESULT($have_gcc_atomics)
299 if test x$have_gcc_atomics = xyes; then
300 AC_DEFINE(HAVE_GCC_ATOMICS, 1, [ ])
302 # See if we have the minimum operation needed for GCC atomics
306 __sync_lock_test_and_set(&a, 1);
307 __sync_lock_release(&a);
309 have_gcc_sync_lock_test_and_set=yes
311 if test x$have_gcc_sync_lock_test_and_set = xyes; then
312 AC_DEFINE(HAVE_GCC_SYNC_LOCK_TEST_AND_SET, 1, [ ])
318 SOURCES="$SOURCES $srcdir/src/*.c"
319 SOURCES="$SOURCES $srcdir/src/atomic/*.c"
320 SOURCES="$SOURCES $srcdir/src/audio/*.c"
321 SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c"
322 SOURCES="$SOURCES $srcdir/src/events/*.c"
323 SOURCES="$SOURCES $srcdir/src/file/*.c"
324 SOURCES="$SOURCES $srcdir/src/haptic/*.c"
325 SOURCES="$SOURCES $srcdir/src/joystick/*.c"
326 SOURCES="$SOURCES $srcdir/src/libm/*.c"
327 SOURCES="$SOURCES $srcdir/src/power/*.c"
328 #SOURCES="$SOURCES $srcdir/src/filesystem/*.c"
329 SOURCES="$SOURCES $srcdir/src/render/*.c"
330 SOURCES="$SOURCES $srcdir/src/render/*/*.c"
331 SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
332 SOURCES="$SOURCES $srcdir/src/thread/*.c"
333 SOURCES="$SOURCES $srcdir/src/timer/*.c"
334 SOURCES="$SOURCES $srcdir/src/video/*.c"
336 dnl Enable/disable various subsystems of the SDL library
338 AC_ARG_ENABLE(atomic,
339 AC_HELP_STRING([--enable-atomic], [Enable the atomic operations subsystem [[default=yes]]]),
341 if test x$enable_atomic != xyes; then
342 AC_DEFINE(SDL_ATOMIC_DISABLED, 1, [ ])
345 AC_HELP_STRING([--enable-audio], [Enable the audio subsystem [[default=yes]]]),
347 if test x$enable_audio != xyes; then
348 AC_DEFINE(SDL_AUDIO_DISABLED, 1, [ ])
351 AC_HELP_STRING([--enable-video], [Enable the video subsystem [[default=yes]]]),
353 if test x$enable_video != xyes; then
354 AC_DEFINE(SDL_VIDEO_DISABLED, 1, [ ])
356 AC_ARG_ENABLE(render,
357 AC_HELP_STRING([--enable-render], [Enable the render subsystem [[default=yes]]]),
359 if test x$enable_render != xyes; then
360 AC_DEFINE(SDL_RENDER_DISABLED, 1, [ ])
362 AC_ARG_ENABLE(events,
363 AC_HELP_STRING([--enable-events], [Enable the events subsystem [[default=yes]]]),
365 if test x$enable_events != xyes; then
366 AC_DEFINE(SDL_EVENTS_DISABLED, 1, [ ])
368 AC_ARG_ENABLE(joystick,
369 AC_HELP_STRING([--enable-joystick], [Enable the joystick subsystem [[default=yes]]]),
370 , enable_joystick=yes)
371 if test x$enable_joystick != xyes; then
372 AC_DEFINE(SDL_JOYSTICK_DISABLED, 1, [ ])
374 AC_ARG_ENABLE(haptic,
375 AC_HELP_STRING([--enable-haptic], [Enable the haptic (force feedback) subsystem [[default=yes]]]),
377 if test x$enable_haptic != xyes; then
378 AC_DEFINE(SDL_HAPTIC_DISABLED, 1, [ ])
381 AC_HELP_STRING([--enable-power], [Enable the power subsystem [[default=yes]]]),
383 if test x$enable_power != xyes; then
384 AC_DEFINE(SDL_POWER_DISABLED, 1, [ ])
386 AC_ARG_ENABLE(filesystem,
387 AC_HELP_STRING([--enable-filesystem], [Enable the filesystem subsystem [[default=yes]]]),
388 , enable_filesystem=yes)
389 if test x$enable_filesystem != xyes; then
390 AC_DEFINE(SDL_FILESYSTEM_DISABLED, 1, [ ])
392 AC_ARG_ENABLE(threads,
393 AC_HELP_STRING([--enable-threads], [Enable the threading subsystem [[default=yes]]]),
394 , enable_threads=yes)
395 if test x$enable_threads != xyes; then
396 AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ])
398 AC_ARG_ENABLE(timers,
399 AC_HELP_STRING([--enable-timers], [Enable the timer subsystem [[default=yes]]]),
401 if test x$enable_timers != xyes; then
402 AC_DEFINE(SDL_TIMERS_DISABLED, 1, [ ])
405 AC_HELP_STRING([--enable-file], [Enable the file subsystem [[default=yes]]]),
407 if test x$enable_file != xyes; then
408 AC_DEFINE(SDL_FILE_DISABLED, 1, [ ])
410 AC_ARG_ENABLE(loadso,
411 AC_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [[default=yes]]]),
413 if test x$enable_loadso != xyes; then
414 AC_DEFINE(SDL_LOADSO_DISABLED, 1, [ ])
416 AC_ARG_ENABLE(cpuinfo,
417 AC_HELP_STRING([--enable-cpuinfo], [Enable the cpuinfo subsystem [[default=yes]]]),
418 , enable_cpuinfo=yes)
419 if test x$enable_cpuinfo != xyes; then
420 AC_DEFINE(SDL_CPUINFO_DISABLED, 1, [ ])
422 AC_ARG_ENABLE(atomic,
423 AC_HELP_STRING([--enable-atomic], [Enable the atomic operations [[default=yes]]]),
425 if test x$enable_atomic != xyes; then
426 AC_DEFINE(SDL_ATOMIC_DISABLED, 1, [ ])
428 AC_ARG_ENABLE(assembly,
429 AC_HELP_STRING([--enable-assembly], [Enable assembly routines [[default=yes]]]),
430 , enable_assembly=yes)
431 if test x$enable_assembly = xyes; then
432 AC_DEFINE(SDL_ASSEMBLY_ROUTINES, 1, [ ])
434 # Make sure that we don't generate floating point code that would
435 # cause illegal instruction exceptions on older processors
438 # Don't need to worry about Apple hardware, it's all SSE capable
442 # x86 64-bit architectures all have SSE instructions
449 AC_ARG_ENABLE(ssemath,
450 AC_HELP_STRING([--enable-ssemath], [Allow GCC to use SSE floating point math [[default=no]]]),
451 , enable_ssemath=$default_ssemath)
452 if test x$enable_ssemath = xno; then
453 if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes; then
454 EXTRA_CFLAGS="$EXTRA_CFLAGS -mfpmath=387"
458 dnl Check for various instruction support
460 AC_HELP_STRING([--enable-mmx], [use MMX assembly routines [[default=yes]]]),
462 if test x$enable_mmx = xyes; then
463 save_CFLAGS="$CFLAGS"
465 AC_MSG_CHECKING(for GCC -mmmx option)
467 CFLAGS="$save_CFLAGS $mmx_CFLAGS"
472 #ifdef __MINGW64_VERSION_MAJOR
475 #include <mmintrin.h>
478 #include <mmintrin.h>
481 #error Assembler CPP flag not enabled
487 AC_MSG_RESULT($have_gcc_mmx)
488 CFLAGS="$save_CFLAGS"
490 if test x$have_gcc_mmx = xyes; then
491 EXTRA_CFLAGS="$EXTRA_CFLAGS $mmx_CFLAGS"
496 AC_HELP_STRING([--enable-3dnow], [use 3DNow! assembly routines [[default=yes]]]),
498 if test x$enable_3dnow = xyes; then
499 save_CFLAGS="$CFLAGS"
501 AC_MSG_CHECKING(for GCC -m3dnow option)
502 amd3dnow_CFLAGS="-m3dnow"
503 CFLAGS="$save_CFLAGS $amd3dnow_CFLAGS"
508 #error Assembler CPP flag not enabled
516 AC_MSG_RESULT($have_gcc_3dnow)
517 CFLAGS="$save_CFLAGS"
519 if test x$have_gcc_3dnow = xyes; then
520 EXTRA_CFLAGS="$EXTRA_CFLAGS $amd3dnow_CFLAGS"
525 AC_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]),
527 if test x$enable_sse = xyes; then
528 save_CFLAGS="$CFLAGS"
530 AC_MSG_CHECKING(for GCC -msse option)
532 CFLAGS="$save_CFLAGS $sse_CFLAGS"
537 #ifdef __MINGW64_VERSION_MAJOR
540 #include <xmmintrin.h>
543 #include <xmmintrin.h>
546 #error Assembler CPP flag not enabled
552 AC_MSG_RESULT($have_gcc_sse)
553 CFLAGS="$save_CFLAGS"
555 if test x$have_gcc_sse = xyes; then
556 EXTRA_CFLAGS="$EXTRA_CFLAGS $sse_CFLAGS"
561 AC_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=no]]]),
562 , enable_sse2=$default_ssemath)
563 if test x$enable_sse2 = xyes; then
564 save_CFLAGS="$CFLAGS"
566 AC_MSG_CHECKING(for GCC -msse2 option)
568 CFLAGS="$save_CFLAGS $sse2_CFLAGS"
573 #ifdef __MINGW64_VERSION_MAJOR
576 #include <emmintrin.h>
579 #include <emmintrin.h>
582 #error Assembler CPP flag not enabled
588 AC_MSG_RESULT($have_gcc_sse2)
589 CFLAGS="$save_CFLAGS"
591 if test x$have_gcc_sse2 = xyes; then
592 EXTRA_CFLAGS="$EXTRA_CFLAGS $sse2_CFLAGS"
596 AC_ARG_ENABLE(altivec,
597 AC_HELP_STRING([--enable-altivec], [use Altivec assembly routines [[default=yes]]]),
598 , enable_altivec=yes)
599 if test x$enable_altivec = xyes; then
600 save_CFLAGS="$CFLAGS"
602 have_altivec_h_hdr=no
603 altivec_CFLAGS="-maltivec"
604 CFLAGS="$save_CFLAGS $altivec_CFLAGS"
606 AC_MSG_CHECKING(for Altivec with GCC altivec.h and -maltivec option)
609 vector unsigned int vzero() {
610 return vec_splat_u32(0);
615 have_altivec_h_hdr=yes
617 AC_MSG_RESULT($have_gcc_altivec)
619 if test x$have_gcc_altivec = xno; then
620 AC_MSG_CHECKING(for Altivec with GCC -maltivec option)
622 vector unsigned int vzero() {
623 return vec_splat_u32(0);
629 AC_MSG_RESULT($have_gcc_altivec)
632 if test x$have_gcc_altivec = xno; then
633 AC_MSG_CHECKING(for Altivec with GCC altivec.h and -faltivec option)
634 altivec_CFLAGS="-faltivec"
635 CFLAGS="$save_CFLAGS $altivec_CFLAGS"
638 vector unsigned int vzero() {
639 return vec_splat_u32(0);
644 have_altivec_h_hdr=yes
646 AC_MSG_RESULT($have_gcc_altivec)
649 if test x$have_gcc_altivec = xno; then
650 AC_MSG_CHECKING(for Altivec with GCC -faltivec option)
652 vector unsigned int vzero() {
653 return vec_splat_u32(0);
659 AC_MSG_RESULT($have_gcc_altivec)
661 CFLAGS="$save_CFLAGS"
663 if test x$have_gcc_altivec = xyes; then
664 AC_DEFINE(SDL_ALTIVEC_BLITTERS, 1, [ ])
665 if test x$have_altivec_h_hdr = xyes; then
666 AC_DEFINE(HAVE_ALTIVEC_H, 1, [ ])
668 EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS"
673 dnl See if the OSS audio interface is supported
677 AC_HELP_STRING([--enable-oss], [support the OSS audio API [[default=maybe]]]),
680 # OpenBSD "has" OSS, but it's not really for app use. They want you to
681 # use sndio instead. So on there, we default to disabled. You can force
682 # it on if you really want, though.
683 if test x$enable_oss = xmaybe; then
691 if test x$enable_audio = xyes -a x$enable_oss = xyes; then
692 AC_MSG_CHECKING(for OSS audio support)
694 if test x$have_oss != xyes; then
696 #include <sys/soundcard.h>
698 int arg = SNDCTL_DSP_SETFRAGMENT;
703 if test x$have_oss != xyes; then
705 #include <soundcard.h>
707 int arg = SNDCTL_DSP_SETFRAGMENT;
710 AC_DEFINE(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H, 1, [ ])
713 AC_MSG_RESULT($have_oss)
714 if test x$have_oss = xyes; then
715 AC_DEFINE(SDL_AUDIO_DRIVER_OSS, 1, [ ])
716 SOURCES="$SOURCES $srcdir/src/audio/dsp/*.c"
719 # We may need to link with ossaudio emulation library
721 *-*-openbsd*|*-*-netbsd*)
722 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";;
728 dnl See if the ALSA audio interface is supported
732 AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [[default=yes]]]),
734 if test x$enable_audio = xyes -a x$enable_alsa = xyes; then
735 AM_PATH_ALSA(0.9.0, have_alsa=yes, have_alsa=no)
736 # Restore all flags from before the ALSA detection runs
737 CFLAGS="$alsa_save_CFLAGS"
738 LDFLAGS="$alsa_save_LDFLAGS"
739 LIBS="$alsa_save_LIBS"
740 if test x$have_alsa = xyes; then
741 AC_ARG_ENABLE(alsa-shared,
742 AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [[default=yes]]]),
743 , enable_alsa_shared=yes)
744 alsa_lib=[`find_lib "libasound.so.*" "$ALSA_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
746 AC_DEFINE(SDL_AUDIO_DRIVER_ALSA, 1, [ ])
747 SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c"
748 EXTRA_CFLAGS="$EXTRA_CFLAGS $ALSA_CFLAGS"
749 if test x$have_loadso != xyes && \
750 test x$enable_alsa_shared = xyes; then
751 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ALSA loading])
753 if test x$have_loadso = xyes && \
754 test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
755 echo "-- dynamic libasound -> $alsa_lib"
756 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ALSA_DYNAMIC, "$alsa_lib", [ ])
758 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ALSA_LIBS"
765 dnl Find the ESD includes and libraries
769 AC_HELP_STRING([--enable-esd], [support the Enlightened Sound Daemon [[default=yes]]]),
771 if test x$enable_audio = xyes -a x$enable_esd = xyes; then
772 AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no)
773 if test x$have_esd = xyes; then
774 AC_ARG_ENABLE(esd-shared,
775 AC_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [[default=yes]]]),
776 , enable_esd_shared=yes)
777 esd_lib=[`find_lib "libesd.so.*" "$ESD_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
779 AC_DEFINE(SDL_AUDIO_DRIVER_ESD, 1, [ ])
780 SOURCES="$SOURCES $srcdir/src/audio/esd/*.c"
781 EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS"
782 if test x$have_loadso != xyes && \
783 test x$enable_esd_shared = xyes; then
784 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ESD loading])
786 if test x$have_loadso = xyes && \
787 test x$enable_esd_shared = xyes && test x$esd_lib != x; then
788 echo "-- dynamic libesd -> $esd_lib"
789 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ESD_DYNAMIC, "$esd_lib", [ ])
791 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ESD_LIBS"
801 AC_ARG_ENABLE(pulseaudio,
802 AC_HELP_STRING([--enable-pulseaudio], [use PulseAudio [[default=yes]]]),
803 , enable_pulseaudio=yes)
804 if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then
807 PULSEAUDIO_REQUIRED_VERSION=0.9
809 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
810 AC_MSG_CHECKING(for PulseAudio $PULSEAUDIO_REQUIRED_VERSION support)
811 if test x$PKG_CONFIG != xno; then
812 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSEAUDIO_REQUIRED_VERSION libpulse-simple; then
813 PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple`
814 PULSEAUDIO_LIBS=`$PKG_CONFIG --libs libpulse-simple`
818 AC_MSG_RESULT($audio_pulseaudio)
820 if test x$audio_pulseaudio = xyes; then
821 AC_ARG_ENABLE(pulseaudio-shared,
822 AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [[default=yes]]]),
823 , enable_pulseaudio_shared=yes)
824 pulseaudio_lib=[`find_lib "libpulse-simple.so.*" "$PULSEAUDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
826 AC_DEFINE(SDL_AUDIO_DRIVER_PULSEAUDIO, 1, [ ])
827 SOURCES="$SOURCES $srcdir/src/audio/pulseaudio/*.c"
828 EXTRA_CFLAGS="$EXTRA_CFLAGS $PULSEAUDIO_CFLAGS"
829 if test x$have_loadso != xyes && \
830 test x$enable_pulseaudio_shared = xyes; then
831 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic PulseAudio loading])
833 if test x$have_loadso = xyes && \
834 test x$enable_pulseaudio_shared = xyes && test x$pulseaudio_lib != x; then
835 echo "-- dynamic libpulse-simple -> $pulseaudio_lib"
836 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC, "$pulseaudio_lib", [ ])
839 # On Solaris, pulseaudio must be linked deferred explicitly
840 # to prevent undefined symbol failures.
842 PULSEAUDIO_LIBS=`echo $PULSEAUDIO_LIBS | sed 's/\-l/-Wl,-l/g'`
843 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-zdeferred $PULSEAUDIO_LIBS -Wl,-znodeferred"
846 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PULSEAUDIO_LIBS"
856 AC_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [[default=yes]]]),
858 if test x$enable_audio = xyes -a x$enable_arts = xyes; then
859 AC_PATH_PROG(ARTSCONFIG, artsc-config)
860 if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then
861 : # arts isn't installed
863 ARTS_CFLAGS=`$ARTSCONFIG --cflags`
864 ARTS_LIBS=`$ARTSCONFIG --libs`
865 AC_MSG_CHECKING(for aRts development environment)
867 save_CFLAGS="$CFLAGS"
868 CFLAGS="$CFLAGS $ARTS_CFLAGS"
872 arts_stream_t stream;
876 CFLAGS="$save_CFLAGS"
877 AC_MSG_RESULT($audio_arts)
878 if test x$audio_arts = xyes; then
879 AC_ARG_ENABLE(arts-shared,
880 AC_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [[default=yes]]]),
881 , enable_arts_shared=yes)
882 arts_lib=[`find_lib "libartsc.so.*" "$ARTS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
884 AC_DEFINE(SDL_AUDIO_DRIVER_ARTS, 1, [ ])
885 SOURCES="$SOURCES $srcdir/src/audio/arts/*.c"
886 EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS"
887 if test x$have_loadso != xyes && \
888 test x$enable_arts_shared = xyes; then
889 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ARTS loading])
891 if test x$have_loadso = xyes && \
892 test x$enable_arts_shared = xyes && test x$arts_lib != x; then
893 echo "-- dynamic libartsc -> $arts_lib"
894 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ARTS_DYNAMIC, "$arts_lib", [ ])
896 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS"
904 dnl See if the NAS audio interface is supported
908 AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]),
910 if test x$enable_audio = xyes -a x$enable_nas = xyes; then
911 AC_CHECK_HEADER(audio/audiolib.h, have_nas_hdr=yes)
912 AC_CHECK_LIB(audio, AuOpenServer, have_nas_lib=yes)
914 AC_MSG_CHECKING(for NAS audio support)
917 if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then
921 elif test -r /usr/X11R6/include/audio/audiolib.h; then
923 NAS_CFLAGS="-I/usr/X11R6/include/"
924 NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt"
928 AC_MSG_RESULT($have_nas)
930 if test x$have_nas = xyes; then
931 AC_ARG_ENABLE(nas-shared,
932 AC_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[default=yes]]]),
933 , enable_nas_shared=yes)
934 nas_lib=[`find_lib "libaudio.so.*" "$NAS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
936 if test x$have_loadso != xyes && \
937 test x$enable_nas_shared = xyes; then
938 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic NAS loading])
940 if test x$have_loadso = xyes && \
941 test x$enable_nas_shared = xyes && test x$nas_lib != x; then
942 echo "-- dynamic libaudio -> $nas_lib"
943 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_NAS_DYNAMIC, "$nas_lib", [ ])
945 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS"
948 AC_DEFINE(SDL_AUDIO_DRIVER_NAS, 1, [ ])
949 SOURCES="$SOURCES $srcdir/src/audio/nas/*.c"
950 EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS"
956 dnl See if the sndio audio interface is supported
960 AC_HELP_STRING([--enable-sndio], [support the sndio audio API [[default=yes]]]),
962 if test x$enable_audio = xyes -a x$enable_sndio = xyes; then
963 AC_CHECK_HEADER(sndio.h, have_sndio_hdr=yes)
964 AC_CHECK_LIB(sndio, sio_open, have_sndio_lib=yes)
966 AC_MSG_CHECKING(for sndio audio support)
969 if test x$have_sndio_hdr = xyes -a x$have_sndio_lib = xyes; then
974 AC_MSG_RESULT($have_sndio)
976 if test x$have_sndio = xyes; then
977 AC_ARG_ENABLE(sndio-shared,
978 AC_HELP_STRING([--enable-sndio-shared], [dynamically load sndio audio support [[default=yes]]]),
979 , enable_sndio_shared=yes)
980 sndio_lib=[`find_lib "libsndio.so.*" "$SNDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
982 if test x$have_loadso != xyes && \
983 test x$enable_sndio_shared = xyes; then
984 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic sndio loading])
986 if test x$have_loadso = xyes && \
987 test x$enable_sndio_shared = xyes && test x$sndio_lib != x; then
988 echo "-- dynamic libsndio -> $sndio_lib"
989 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC, "$sndio_lib", [ ])
991 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SNDIO_LIBS"
994 AC_DEFINE(SDL_AUDIO_DRIVER_SNDIO, 1, [ ])
995 SOURCES="$SOURCES $srcdir/src/audio/sndio/*.c"
996 EXTRA_CFLAGS="$EXTRA_CFLAGS $SNDIO_CFLAGS"
1002 dnl rcg07142001 See if the user wants the disk writer audio driver...
1005 AC_ARG_ENABLE(diskaudio,
1006 AC_HELP_STRING([--enable-diskaudio], [support the disk writer audio driver [[default=yes]]]),
1007 , enable_diskaudio=yes)
1008 if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
1009 AC_DEFINE(SDL_AUDIO_DRIVER_DISK, 1, [ ])
1010 SOURCES="$SOURCES $srcdir/src/audio/disk/*.c"
1014 dnl rcg03142006 See if the user wants the dummy audio driver...
1017 AC_ARG_ENABLE(dummyaudio,
1018 AC_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [[default=yes]]]),
1019 , enable_dummyaudio=yes)
1020 if test x$enable_audio = xyes -a x$enable_dummyaudio = xyes; then
1021 AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY, 1, [ ])
1022 SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c"
1026 dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
1027 dnl Details of this flag are here: http://gcc.gnu.org/wiki/Visibility
1028 CheckVisibilityHidden()
1030 AC_MSG_CHECKING(for GCC -fvisibility=hidden option)
1031 have_gcc_fvisibility=no
1033 visibility_CFLAGS="-fvisibility=hidden"
1034 save_CFLAGS="$CFLAGS"
1035 CFLAGS="$save_CFLAGS $visibility_CFLAGS -Werror"
1037 #if !defined(__GNUC__) || __GNUC__ < 4
1038 #error SDL only uses visibility attributes in GCC 4 or newer
1042 have_gcc_fvisibility=yes
1044 AC_MSG_RESULT($have_gcc_fvisibility)
1045 CFLAGS="$save_CFLAGS"
1047 if test x$have_gcc_fvisibility = xyes; then
1048 EXTRA_CFLAGS="$EXTRA_CFLAGS $visibility_CFLAGS"
1052 dnl See if GCC's -mpreferred-stack-boundary is supported.
1053 dnl Reference: http://bugzilla.libsdl.org/show_bug.cgi?id=1296
1054 CheckStackBoundary()
1056 AC_MSG_CHECKING(for GCC -mpreferred-stack-boundary option)
1057 have_gcc_preferred_stack_boundary=no
1059 save_CFLAGS="$CFLAGS"
1060 CFLAGS="$save_CFLAGS -mpreferred-stack-boundary=2"
1065 have_gcc_preferred_stack_boundary=yes
1067 AC_MSG_RESULT($have_gcc_preferred_stack_boundary)
1068 CFLAGS="$save_CFLAGS"
1070 if test x$have_gcc_preferred_stack_boundary = xyes; then
1071 EXTRA_CFLAGS="$EXTRA_CFLAGS -mpreferred-stack-boundary=2"
1076 dnl See if GCC's -Wall is supported.
1079 AC_MSG_CHECKING(for GCC -Wall option)
1082 save_CFLAGS="$CFLAGS"
1083 CFLAGS="$save_CFLAGS -Wall"
1090 AC_MSG_RESULT($have_gcc_Wall)
1091 CFLAGS="$save_CFLAGS"
1093 if test x$have_gcc_Wall = xyes; then
1094 EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall"
1096 dnl Haiku headers use multicharacter constants all over the place. Ignore these warnings when using -Wall.
1097 AC_MSG_CHECKING(for necessary GCC -Wno-multichar option)
1098 need_gcc_Wno_multichar=no
1100 *-*-beos* | *-*-haiku*)
1101 need_gcc_Wno_multichar=yes
1104 AC_MSG_RESULT($need_gcc_Wno_multichar)
1105 if test x$need_gcc_Wno_multichar = xyes; then
1106 EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-multichar"
1112 dnl Find the X11 include and library directories
1117 AC_ARG_ENABLE(video-x11,
1118 AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]),
1119 , enable_video_x11=yes)
1120 if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
1123 # This isn't necessary for X11, but fixes GLX detection
1124 if test "x$x_includes" = xNONE && \
1125 test "x$x_libraries" = xNONE && \
1126 test -d /usr/X11R6/include && \
1127 test -d /usr/X11R6/lib; then
1128 x_includes="/usr/X11R6/include"
1129 x_libraries="/usr/X11R6/lib"
1135 if test x$have_x = xyes; then
1136 # Only allow dynamically loaded X11 if the X11 function pointers
1137 # will not end up in the global namespace, which causes problems
1138 # with other libraries calling X11 functions.
1139 x11_symbols_private=$have_gcc_fvisibility
1141 AC_ARG_ENABLE(x11-shared,
1142 AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=maybe]]]),
1143 , enable_x11_shared=maybe)
1147 x11_symbols_private=yes
1148 x11_lib='/usr/X11R6/lib/libX11.6.dylib'
1149 x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
1150 xcursor_lib='/usr/X11R6/lib/libXcursor.1.dylib'
1151 xinerama_lib='/usr/X11R6/lib/libXinerama.1.dylib'
1152 xinput_lib='/usr/X11R6/lib/libXi.6.dylib'
1153 xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
1154 xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
1155 xss_lib='/usr/X11R6/lib/libXss.1.dylib'
1156 xvidmode_lib='/usr/X11R6/lib/libXxf86vm.1.dylib'
1160 x11ext_lib='libXext.so'
1161 xcursor_lib='libXcursor.so'
1162 xinerama_lib='libXinerama.so'
1163 xinput_lib='libXi.so'
1164 xrandr_lib='libXrandr.so'
1165 xrender_lib='libXrender.so'
1167 xvidmode_lib='libXxf86vm.so'
1170 x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1171 x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1172 xcursor_lib=[`find_lib "libXcursor.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1173 xinerama_lib=[`find_lib "libXinerama.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1174 xinput_lib=[`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1175 xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1176 xrender_lib=[`find_lib "libXrender.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1177 xss_lib=[`find_lib "libXss.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1178 xvidmode_lib=[`find_lib "libXxf86vm.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1182 if test x$ac_cv_func_shmat != xyes; then
1183 X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY"
1185 CFLAGS="$CFLAGS $X_CFLAGS"
1186 LDFLAGS="$LDFLAGS $X_LIBS"
1188 AC_CHECK_HEADER(X11/extensions/Xext.h,
1189 have_xext_h_hdr=yes,
1191 [#include <X11/Xlib.h>
1192 #include <X11/Xproto.h>
1194 if test x$have_xext_h_hdr != xyes; then
1196 *** Missing Xext.h, maybe you need to install the libxext-dev package?
1200 AC_DEFINE(SDL_VIDEO_DRIVER_X11, 1, [ ])
1201 SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
1202 EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
1204 # Needed so SDL applications can include SDL_syswm.h
1205 SDL_CFLAGS="$SDL_CFLAGS $X_CFLAGS"
1207 if test x$enable_x11_shared = xmaybe; then
1208 enable_x11_shared=$x11_symbols_private
1210 if test x$have_loadso != xyes && \
1211 test x$enable_x11_shared = xyes; then
1212 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic X11 loading])
1213 enable_x11_shared=no
1215 if test x$x11_symbols_private != xyes && \
1216 test x$enable_x11_shared = xyes; then
1217 AC_MSG_WARN([You must have gcc4 (-fvisibility=hidden) for dynamic X11 loading])
1218 enable_x11_shared=no
1221 if test x$have_loadso = xyes && \
1222 test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then
1223 echo "-- dynamic libX11 -> $x11_lib"
1224 echo "-- dynamic libX11ext -> $x11ext_lib"
1225 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib", [ ])
1226 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib", [ ])
1228 enable_x11_shared=no
1229 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
1233 AC_MSG_CHECKING(for const parameter to XextAddDisplay)
1234 have_const_param_XextAddDisplay=no
1236 #include <X11/Xlib.h>
1237 #include <X11/Xproto.h>
1238 #include <X11/extensions/Xext.h>
1239 #include <X11/extensions/extutil.h>
1240 extern XExtDisplayInfo* XextAddDisplay(XExtensionInfo* a,Display* b,_Xconst char* c,XExtensionHooks* d,int e,XPointer f);
1243 have_const_param_XextAddDisplay=yes
1244 AC_DEFINE(SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY)
1246 AC_MSG_RESULT($have_const_param_XextAddDisplay)
1248 AC_MSG_CHECKING(for const parameter to _XData32)
1249 have_const_param_xdata32=no
1251 #include <X11/Xlibint.h>
1252 extern int _XData32(Display *dpy,register _Xconst long *data,unsigned len);
1255 have_const_param_xdata32=yes
1256 AC_DEFINE(SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32)
1258 AC_MSG_RESULT($have_const_param_xdata32)
1260 dnl AC_CHECK_LIB(X11, XGetEventData, AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS, 1, [Have XGenericEvent]))
1261 AC_MSG_CHECKING([for XGenericEvent])
1262 have_XGenericEvent=no
1264 #include <X11/Xlib.h>
1268 XGenericEventCookie *cookie = &event.xcookie;
1269 XNextEvent(display, &event);
1270 XGetEventData(display, cookie);
1271 XFreeEventData(display, cookie);
1273 have_XGenericEvent=yes
1274 AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS)
1276 AC_MSG_RESULT($have_XGenericEvent)
1278 AC_CHECK_LIB(X11, XkbKeycodeToKeysym, AC_DEFINE(SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM, 1, [Have XkbKeycodeToKeysym]))
1280 AC_ARG_ENABLE(video-x11-xcursor,
1281 AC_HELP_STRING([--enable-video-x11-xcursor], [enable X11 Xcursor support [[default=yes]]]),
1282 , enable_video_x11_xcursor=yes)
1283 if test x$enable_video_x11_xcursor = xyes; then
1284 definitely_enable_video_x11_xcursor=no
1285 AC_CHECK_HEADER(X11/Xcursor/Xcursor.h,
1286 have_xcursor_h_hdr=yes,
1287 have_xcursor_h_hdr=no,
1288 [#include <X11/Xlib.h>
1290 if test x$have_xcursor_h_hdr = xyes; then
1291 if test x$enable_x11_shared = xyes && test x$xcursor_lib != x ; then
1292 echo "-- dynamic libXcursor -> $xcursor_lib"
1293 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR, "$xcursor_lib", [ ])
1294 definitely_enable_video_x11_xcursor=yes
1296 AC_CHECK_LIB(Xcursor, XcursorImageCreate, have_xcursor_lib=yes)
1297 if test x$have_xcursor_lib = xyes ; then
1298 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXcursor"
1299 definitely_enable_video_x11_xcursor=yes
1304 if test x$definitely_enable_video_x11_xcursor = xyes; then
1305 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XCURSOR, 1, [ ])
1307 AC_ARG_ENABLE(video-x11-xinerama,
1308 AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]),
1309 , enable_video_x11_xinerama=yes)
1310 if test x$enable_video_x11_xinerama = xyes; then
1311 definitely_enable_video_x11_xinerama=no
1312 AC_CHECK_HEADER(X11/extensions/Xinerama.h,
1313 have_xinerama_h_hdr=yes,
1314 have_xinerama_h_hdr=no,
1315 [#include <X11/Xlib.h>
1317 if test x$have_xinerama_h_hdr = xyes; then
1318 if test x$enable_x11_shared = xyes && test x$xinerama_lib != x ; then
1319 echo "-- dynamic libXinerama -> $xinerama_lib"
1320 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA, "$xinerama_lib", [ ])
1321 definitely_enable_video_x11_xinerama=yes
1323 AC_CHECK_LIB(Xinerama, XineramaQueryExtension, have_xinerama_lib=yes)
1324 if test x$have_xinerama_lib = xyes ; then
1325 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXinerama"
1326 definitely_enable_video_x11_xinerama=yes
1331 if test x$definitely_enable_video_x11_xinerama = xyes; then
1332 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA, 1, [ ])
1334 AC_ARG_ENABLE(video-x11-xinput,
1335 AC_HELP_STRING([--enable-video-x11-xinput], [enable X11 XInput extension for manymouse, tablets, etc [[default=yes]]]),
1336 , enable_video_x11_xinput=yes)
1337 if test x$enable_video_x11_xinput = xyes; then
1338 definitely_enable_video_x11_xinput=no
1339 AC_CHECK_HEADER(X11/extensions/XInput2.h,
1340 have_xinput_h_hdr=yes,
1341 have_xinput_h_hdr=no,
1342 [#include <X11/Xlib.h>
1344 if test x$have_xinput_h_hdr = xyes; then
1345 if test x$enable_x11_shared = xyes && test x$xinput_lib != x ; then
1346 echo "-- dynamic libXi -> $xinput_lib"
1347 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2, "$xinput_lib", [ ])
1348 definitely_enable_video_x11_xinput=yes
1350 AC_CHECK_LIB(Xi, XOpenDevice, have_xinput_lib=yes)
1351 if test x$have_xinput_lib = xyes ; then
1352 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXi"
1353 definitely_enable_video_x11_xinput=yes
1358 if test x$definitely_enable_video_x11_xinput = xyes; then
1359 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT2, 1, [ ])
1360 AC_MSG_CHECKING(for xinput2 multitouch)
1361 have_xinput2_multitouch=no
1363 #include <X11/Xlib.h>
1364 #include <X11/Xproto.h>
1365 #include <X11/extensions/XInput2.h>
1367 int event_type = XI_TouchBegin;
1368 XITouchClassInfo *t;
1370 XIAllowTouchEvents(Display *a,int b,unsigned int c,Window d,int f)
1375 have_xinput2_multitouch=yes
1376 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH)
1378 AC_MSG_RESULT($have_xinput2_multitouch)
1380 AC_ARG_ENABLE(video-x11-xrandr,
1381 AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]),
1382 , enable_video_x11_xrandr=yes)
1383 if test x$enable_video_x11_xrandr = xyes; then
1384 definitely_enable_video_x11_xrandr=no
1385 AC_CHECK_HEADER(X11/extensions/Xrandr.h,
1386 have_xrandr_h_hdr=yes,
1387 have_xrandr_h_hdr=no,
1388 [#include <X11/Xlib.h>
1390 if test x$have_xrandr_h_hdr = xyes; then
1391 if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then
1392 echo "-- dynamic libXrandr -> $xrandr_lib"
1393 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib", [ ])
1394 definitely_enable_video_x11_xrandr=yes
1396 AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes)
1397 if test x$have_xrandr_lib = xyes ; then
1398 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr"
1399 definitely_enable_video_x11_xrandr=yes
1404 if test x$definitely_enable_video_x11_xrandr = xyes; then
1405 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR, 1, [ ])
1407 AC_ARG_ENABLE(video-x11-scrnsaver,
1408 AC_HELP_STRING([--enable-video-x11-scrnsaver], [enable X11 screensaver extension [[default=yes]]]),
1409 , enable_video_x11_scrnsaver=yes)
1410 if test x$enable_video_x11_scrnsaver = xyes; then
1411 AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
1412 have_scrnsaver_h_hdr=yes,
1413 have_scrnsaver_h_hdr=no,
1414 [#include <X11/Xlib.h>
1416 if test x$have_scrnsaver_h_hdr = xyes; then
1417 if test x$enable_x11_shared = xyes && test x$xss_lib != x ; then
1418 echo "-- dynamic libXss -> $xss_lib"
1419 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS, "$xss_lib", [ ])
1420 definitely_enable_video_x11_scrnsaver=yes
1422 AC_CHECK_LIB(Xss, XScreenSaverSuspend, have_xss_lib=yes)
1423 if test x$have_xss_lib = xyes ; then
1424 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXss"
1425 definitely_enable_video_x11_scrnsaver=yes
1430 if test x$definitely_enable_video_x11_scrnsaver = xyes; then
1431 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSCRNSAVER, 1, [ ])
1433 AC_ARG_ENABLE(video-x11-xshape,
1434 AC_HELP_STRING([--enable-video-x11-xshape], [enable X11 XShape support [[default=yes]]]),
1435 , enable_video_x11_xshape=yes)
1436 if test x$enable_video_x11_xshape = xyes; then
1437 AC_CHECK_HEADER(X11/extensions/shape.h,
1438 have_shape_h_hdr=yes,
1439 have_shape_h_hdr=no,
1440 [#include <X11/Xlib.h>
1442 if test x$have_shape_h_hdr = xyes; then
1443 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSHAPE, 1, [ ])
1446 AC_ARG_ENABLE(video-x11-vm,
1447 AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[default=yes]]]),
1448 , enable_video_x11_vm=yes)
1449 if test x$enable_video_x11_vm = xyes; then
1450 definitely_enable_video_x11_vm=no
1451 AC_CHECK_HEADER(X11/extensions/xf86vmode.h,
1454 [#include <X11/Xlib.h>
1456 if test x$have_vm_h_hdr = xyes; then
1457 if test x$enable_x11_shared = xyes && test x$xvidmode_lib != x ; then
1458 echo "-- dynamic libXxf86vm -> $xvidmode_lib"
1459 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE, "$xvidmode_lib", [ ])
1460 definitely_enable_video_x11_vm=yes
1462 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryVersion, have_vm_lib=yes)
1463 if test x$have_vm_lib = xyes ; then
1464 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXxf86vm"
1465 definitely_enable_video_x11_vm=yes
1470 if test x$definitely_enable_video_x11_vm = xyes; then
1471 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XVIDMODE, 1, [ ])
1477 dnl Set up the BWindow video driver if enabled
1480 if test x$enable_video = xyes; then
1481 AC_DEFINE(SDL_VIDEO_DRIVER_BWINDOW, 1, [ ])
1482 SOURCES="$SOURCES $srcdir/src/video/bwindow/*.cc"
1487 dnl Set up the Cocoa video driver for Mac OS X (but not Darwin)
1490 AC_ARG_ENABLE(video-cocoa,
1491 AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]),
1492 , enable_video_cocoa=yes)
1493 if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
1494 save_CFLAGS="$CFLAGS"
1495 dnl work around that we don't have Objective-C support in autoconf
1496 CFLAGS="$CFLAGS -x objective-c"
1497 AC_MSG_CHECKING(for Cocoa framework)
1500 #import <Cocoa/Cocoa.h>
1505 AC_MSG_RESULT($have_cocoa)
1506 CFLAGS="$save_CFLAGS"
1507 if test x$have_cocoa = xyes; then
1508 AC_DEFINE(SDL_VIDEO_DRIVER_COCOA, 1, [ ])
1509 SOURCES="$SOURCES $srcdir/src/video/cocoa/*.m"
1518 AC_ARG_ENABLE(video-directfb,
1519 AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=no]]]),
1520 , enable_video_directfb=no)
1521 if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
1524 DIRECTFB_REQUIRED_VERSION=1.0.0
1525 AC_PATH_PROGS(DIRECTFBCONFIG, directfb-config, no, [$prefix/bin:$PATH])
1526 if test x$DIRECTFBCONFIG = xno; then
1527 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1528 if test x$PKG_CONFIG != xno; then
1529 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb; then
1530 DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
1531 DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
1532 DIRECTFB_PREFIX=`$PKG_CONFIG --variable=prefix directfb`
1537 set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'`
1538 NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
1539 set -- `$DIRECTFBCONFIG --version | sed 's/\./ /g'`
1540 HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
1541 if test $HAVE_VERSION -ge $NEED_VERSION; then
1542 DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags`
1543 DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs`
1544 DIRECTFB_PREFIX=`$DIRECTFBCONFIG --prefix`
1548 if test x$video_directfb = xyes; then
1549 # SuSE 11.1 installs directfb-config without directfb-devel
1550 save_CPPFLAGS="$CPPFLAGS"
1551 CPPFLAGS="$CPPFLAGS $DIRECTFB_CFLAGS"
1552 AC_CHECK_HEADER(directfb.h, have_directfb_hdr=yes, have_directfb_hdr=no)
1553 CPPFLAGS="$save_CPPFLAGS"
1554 video_directfb=$have_directfb_hdr
1556 AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support)
1557 AC_MSG_RESULT($video_directfb)
1559 if test x$video_directfb = xyes; then
1560 AC_ARG_ENABLE(directfb-shared,
1561 AC_HELP_STRING([--enable-directfb-shared], [dynamically load directfb support [[default=yes]]]),
1562 , enable_directfb_shared=yes)
1564 AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB, 1, [ ])
1565 AC_DEFINE(SDL_VIDEO_RENDER_DIRECTFB, 1, [ ])
1566 SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
1567 EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"
1569 AC_MSG_CHECKING(for directfb dynamic loading support)
1571 directfb_lib=[`find_lib "libdirectfb.so.*" "$DIRECTFB_LIBS"`]
1572 # | sed 's/.*\/\(.*\)/\1/; q'`]
1573 AC_MSG_WARN("directfb $directfb_lib")
1574 if test x$have_loadso != xyes && \
1575 test x$enable_directfb_shared = xyes; then
1576 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic directfb loading])
1578 if test x$have_loadso = xyes && \
1579 test x$enable_directfb_shared = xyes && test x$directfb_lib != x; then
1581 echo "-- $directfb_lib_spec -> $directfb_lib"
1582 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC, "$directfb_lib", [ ])
1584 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
1586 AC_MSG_RESULT($directfb_shared)
1592 dnl Find FusionSound
1595 AC_ARG_ENABLE(fusionsound,
1596 AC_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]),
1597 , enable_fusionsound=no)
1598 if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then
1601 FUSIONSOUND_REQUIRED_VERSION=1.1.1
1603 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1604 AC_MSG_CHECKING(for FusionSound $FUSIONSOUND_REQUIRED_VERSION support)
1605 if test x$PKG_CONFIG != xno; then
1606 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then
1607 FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound`
1608 FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound`
1612 AC_MSG_RESULT($fusionsound)
1614 if test x$fusionsound = xyes; then
1615 AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND, 1, [ ])
1616 SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c"
1617 EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS"
1619 AC_ARG_ENABLE(fusionsound-shared,
1620 AC_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]),
1621 , enable_fusionsound_shared=yes)
1622 fusionsound_shared=no
1623 AC_MSG_CHECKING(for FusionSound dynamic loading support)
1624 if test x$have_loadso != xyes && \
1625 test x$enable_fusionsound_shared = xyes; then
1626 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading])
1628 if test x$have_loadso = xyes && \
1629 test x$enable_fusionsound_shared = xyes; then
1630 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so", [ ])
1631 fusionsound_shared=yes
1633 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS"
1635 AC_MSG_RESULT($fusionsound_shared)
1642 dnl rcg04172001 Set up the Null video driver.
1645 AC_ARG_ENABLE(video-dummy,
1646 AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]),
1647 , enable_video_dummy=yes)
1648 if test x$enable_video_dummy = xyes; then
1649 AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY, 1, [ ])
1650 SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
1655 dnl Check to see if OpenGL support is desired
1656 AC_ARG_ENABLE(video-opengl,
1657 AC_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]),
1658 , enable_video_opengl=yes)
1663 if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
1664 AC_MSG_CHECKING(for OpenGL (GLX) support)
1673 AC_MSG_RESULT($video_opengl)
1674 if test x$video_opengl = xyes; then
1675 AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
1676 AC_DEFINE(SDL_VIDEO_OPENGL_GLX, 1, [ ])
1677 AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
1682 dnl Check to see if OpenGL ES support is desired
1683 AC_ARG_ENABLE(video-opengles,
1684 AC_HELP_STRING([--enable-video-opengles], [include OpenGL ES support [[default=yes]]]),
1685 , enable_video_opengles=yes)
1690 if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
1691 AC_MSG_CHECKING(for EGL support)
1694 #include <EGL/egl.h>
1697 video_opengl_egl=yes
1699 AC_MSG_RESULT($video_opengl_egl)
1700 if test x$video_opengl_egl = xyes; then
1701 AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
1704 AC_MSG_CHECKING(for OpenGL ES v1 headers)
1705 video_opengles_v1=no
1707 #include <GLES/gl.h>
1708 #include <GLES/glext.h>
1711 video_opengles_v1=yes
1713 AC_MSG_RESULT($video_opengles_v1)
1714 if test x$video_opengles_v1 = xyes; then
1715 AC_DEFINE(SDL_VIDEO_OPENGL_ES, 1, [ ])
1716 AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES, 1, [ ])
1719 AC_MSG_CHECKING(for OpenGL ES v2 headers)
1720 video_opengles_v2=no
1722 #include <GLES2/gl2.h>
1723 #include <GLES2/gl2ext.h>
1726 video_opengles_v2=yes
1728 AC_MSG_RESULT($video_opengles_v2)
1729 if test x$video_opengles_v2 = xyes; then
1730 AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
1731 AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
1736 dnl Check for Windows OpenGL
1739 if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
1740 AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
1741 AC_DEFINE(SDL_VIDEO_OPENGL_WGL, 1, [ ])
1742 AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
1746 dnl Check for BeOS OpenGL
1749 if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
1750 AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
1751 AC_DEFINE(SDL_VIDEO_OPENGL_BGL, 1, [ ])
1752 AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
1753 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
1757 dnl Check for MacOS OpenGL
1760 if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
1761 AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
1762 AC_DEFINE(SDL_VIDEO_OPENGL_CGL, 1, [ ])
1763 AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
1766 if test x$enable_video_cocoa = xyes; then
1767 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGL"
1773 dnl See if we can use the new unified event interface in Linux 2.4
1776 dnl Check for Linux 2.4 unified input event interface support
1777 AC_MSG_CHECKING(for Linux 2.4 unified input interface)
1780 #include <linux/input.h>
1783 #error EVIOCGNAME() ioctl not available
1786 use_input_events=yes
1788 AC_MSG_RESULT($use_input_events)
1789 if test x$use_input_events = xyes; then
1790 AC_DEFINE(SDL_INPUT_LINUXEV, 1, [ ])
1794 dnl See if we can use the kernel kd.h header
1798 AC_MSG_CHECKING(for Linux kd.h)
1801 #include <linux/kd.h>
1802 #include <linux/keyboard.h>
1805 kbe.kb_table = KG_CTRL;
1806 ioctl(0, KDGKBENT, &kbe);
1810 AC_MSG_RESULT($use_input_kd)
1811 if test x$use_input_kd = xyes; then
1812 AC_DEFINE(SDL_INPUT_LINUXKD, 1, [ ])
1816 dnl See if the platform offers libudev for device enumeration and hotplugging.
1819 AC_ARG_ENABLE(libudev,
1820 AC_HELP_STRING([--enable-libudev], [enable libudev support [[default=yes]]]),
1821 , enable_libudev=yes)
1822 if test x$enable_libudev = xyes; then
1823 AC_CHECK_HEADER(libudev.h,
1824 have_libudev_h_hdr=yes,
1825 have_libudev_h_hdr=no)
1826 if test x$have_libudev_h_hdr = xyes; then
1827 AC_DEFINE(HAVE_LIBUDEV_H, 1, [ ])
1832 dnl See if the platform offers libdbus for various IPC techniques.
1836 AC_HELP_STRING([--enable-dbus], [enable D-Bus support [[default=yes]]]),
1838 if test x$enable_dbus = xyes; then
1839 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1840 if test x$PKG_CONFIG != xno; then
1841 DBUS_CFLAGS=`$PKG_CONFIG --cflags dbus-1`
1842 save_CFLAGS="$CFLAGS"
1843 CFLAGS="$save_CFLAGS $DBUS_CFLAGS"
1844 AC_CHECK_HEADER(dbus/dbus.h,
1845 have_dbus_dbus_h_hdr=yes,
1846 have_dbus_dbus_h_hdr=no)
1847 CFLAGS="$save_CFLAGS"
1848 if test x$have_dbus_dbus_h_hdr = xyes; then
1849 AC_DEFINE(HAVE_DBUS_DBUS_H, 1, [ ])
1850 EXTRA_CFLAGS="$EXTRA_CFLAGS $DBUS_CFLAGS"
1856 dnl See if we can use the Touchscreen input library
1859 AC_ARG_ENABLE(input-tslib,
1860 AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]),
1861 , enable_input_tslib=yes)
1862 if test x$enable_input_tslib = xyes; then
1863 AC_MSG_CHECKING(for Touchscreen library support)
1864 enable_input_tslib=no
1869 enable_input_tslib=yes
1871 AC_MSG_RESULT($enable_input_tslib)
1872 if test x$enable_input_tslib = xyes; then
1873 AC_DEFINE(SDL_INPUT_TSLIB, 1, [ ])
1874 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
1879 dnl See what type of thread model to use on Linux and Solaris
1882 dnl Check for pthread support
1883 AC_ARG_ENABLE(pthreads,
1884 AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]),
1885 , enable_pthreads=yes)
1886 dnl This is used on Linux for glibc binary compatibility (Doh!)
1887 AC_ARG_ENABLE(pthread-sem,
1888 AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
1889 , enable_pthread_sem=yes)
1891 *-*-linux*|*-*-uclinux*)
1892 pthread_cflags="-D_REENTRANT"
1893 pthread_lib="-lpthread"
1896 pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
1900 pthread_cflags="-D_THREAD_SAFE"
1901 # causes Carbon.p complaints?
1902 # pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
1904 *-*-freebsd*|*-*-dragonfly*)
1905 pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
1906 pthread_lib="-pthread"
1909 pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
1910 pthread_lib="-lpthread"
1913 pthread_cflags="-D_REENTRANT"
1914 pthread_lib="-pthread"
1917 # From Solaris 9+, posix4's preferred name is rt.
1918 pthread_cflags="-D_REENTRANT"
1919 pthread_lib="-lpthread -lrt"
1922 # Solaris 10+ merged pthread into libc.
1923 pthread_cflags="-D_REENTRANT"
1927 # Solaris 11+ merged rt into libc.
1928 pthread_cflags="-D_REENTRANT"
1932 pthread_cflags="-D_REENTRANT -Kthread"
1936 pthread_cflags="-D_REENTRANT -mthreads"
1937 pthread_lib="-lpthread"
1940 pthread_cflags="-D_REENTRANT"
1941 pthread_lib="-L/usr/lib -lpthread"
1944 pthread_cflags="-D_REENTRANT"
1945 pthread_lib="-lpthread"
1948 if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
1949 # Save the original compiler flags and libraries
1950 ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
1951 # Add the pthread compiler flags and libraries
1952 CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
1953 # Check to see if we have pthread support on this system
1954 AC_MSG_CHECKING(for pthreads)
1957 #include <pthread.h>
1959 pthread_attr_t type;
1960 pthread_attr_init(&type);
1964 AC_MSG_RESULT($use_pthreads)
1965 # Restore the compiler flags and libraries
1966 CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
1968 # Do futher testing if we have pthread support...
1969 if test x$use_pthreads = xyes; then
1970 AC_DEFINE(SDL_THREAD_PTHREAD, 1, [ ])
1971 EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
1972 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
1973 SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
1974 SDL_LIBS="$SDL_LIBS $pthread_lib"
1976 # Save the original compiler flags and libraries
1977 ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
1978 # Add the pthread compiler flags and libraries
1979 CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
1981 # Check to see if recursive mutexes are available
1982 AC_MSG_CHECKING(for recursive mutexes)
1983 has_recursive_mutexes=no
1984 if test x$has_recursive_mutexes = xno; then
1986 #include <pthread.h>
1988 pthread_mutexattr_t attr;
1989 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
1991 has_recursive_mutexes=yes
1992 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX, 1, [ ])
1995 if test x$has_recursive_mutexes = xno; then
1997 #include <pthread.h>
1999 pthread_mutexattr_t attr;
2000 pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
2002 has_recursive_mutexes=yes
2003 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP, 1, [ ])
2006 AC_MSG_RESULT($has_recursive_mutexes)
2008 # Check to see if pthread semaphore support is missing
2009 if test x$enable_pthread_sem = xyes; then
2010 AC_MSG_CHECKING(for pthread semaphores)
2013 #include <pthread.h>
2014 #include <semaphore.h>
2017 have_pthread_sem=yes
2019 AC_MSG_RESULT($have_pthread_sem)
2021 if test x$have_pthread_sem = xyes; then
2022 AC_MSG_CHECKING(for sem_timedwait)
2023 have_sem_timedwait=no
2025 #include <pthread.h>
2026 #include <semaphore.h>
2028 sem_timedwait(NULL, NULL);
2030 have_sem_timedwait=yes
2031 AC_DEFINE(HAVE_SEM_TIMEDWAIT)
2033 AC_MSG_RESULT($have_sem_timedwait)
2036 AC_MSG_CHECKING(for pthread_spin_trylock)
2037 AC_TRY_LINK_FUNC(pthread_spin_trylock, [
2038 has_pthread_spin_trylock=yes
2039 AC_DEFINE(HAVE_PTHREAD_SPINLOCK, 1, [ ])
2041 has_pthread_spin_trylock=no
2043 AC_MSG_RESULT($has_pthread_spin_trylock)
2045 AC_CHECK_HEADER(pthread_np.h, have_pthread_np_h=yes, have_pthread_np_h=no, [ #include <pthread.h> ])
2046 if test x$have_pthread_np_h = xyes; then
2047 AC_DEFINE(HAVE_PTHREAD_NP_H, 1, [ ])
2050 # Check to see if pthread naming is available
2051 AC_MSG_CHECKING(for pthread_setname_np)
2052 AC_TRY_LINK_FUNC(pthread_setname_np, [
2053 has_pthread_setname_np=yes
2054 AC_DEFINE(HAVE_PTHREAD_SETNAME_NP, 1, [ ])
2056 has_pthread_setname_np=no
2058 AC_MSG_RESULT($has_pthread_setname_np)
2060 AC_MSG_CHECKING(for pthread_set_name_np)
2061 AC_TRY_LINK_FUNC(pthread_set_name_np, [
2062 has_pthread_set_name_np=yes
2063 AC_DEFINE(HAVE_PTHREAD_SET_NAME_NP, 1, [ ])
2065 has_pthread_set_name_np=no
2067 AC_MSG_RESULT($has_pthread_set_name_np)
2069 # Restore the compiler flags and libraries
2070 CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
2072 # Basic thread creation functions
2073 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
2076 # We can fake these with mutexes and condition variables if necessary
2077 if test x$have_pthread_sem = xyes; then
2078 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
2080 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
2084 # We can fake these with semaphores if necessary
2085 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
2087 # Condition variables
2088 # We can fake these with semaphores and mutexes if necessary
2089 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
2091 # Thread local storage
2092 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systls.c"
2099 dnl Determine whether the compiler can produce Windows executables
2102 AC_MSG_CHECKING(Windows compiler)
2105 #include <windows.h>
2110 AC_MSG_RESULT($have_win32_gcc)
2111 if test x$have_win32_gcc != xyes; then
2113 *** Your compiler ($CC) does not produce Windows executables!
2117 AC_MSG_CHECKING(Windows CE)
2120 #if !defined(_WIN32_WCE) && !defined(__MINGW32CE__)
2121 #error This is not Windows CE
2127 *** Sorry, Windows CE is no longer supported.
2130 AC_MSG_RESULT($have_wince)
2132 # This fixes Windows stack alignment with newer GCC
2136 dnl Find the DirectX includes and libraries
2139 AC_ARG_ENABLE(directx,
2140 AC_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[default=yes]]]),
2141 , enable_directx=yes)
2142 if test x$enable_directx = xyes; then
2143 AC_CHECK_HEADER(d3d9.h, have_d3d=yes)
2144 AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
2145 AC_CHECK_HEADER(dsound.h, have_dsound=yes)
2146 AC_CHECK_HEADER(dinput.h, have_dinput=yes)
2147 AC_CHECK_HEADER(xaudio2.h, have_xaudio2=yes)
2149 # FIXME: latest Cygwin finds dinput headers, but we die on other win32 headers.
2150 # FIXME: ...so force it off for now.
2159 dnl Check for the dlfcn.h interface for dynamically loading objects
2162 AC_ARG_ENABLE(sdl-dlopen,
2163 AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]),
2164 , enable_sdl_dlopen=yes)
2165 if test x$enable_sdl_dlopen = xyes; then
2166 AC_MSG_CHECKING(for dlopen)
2171 void *handle = dlopen("", RTLD_NOW);
2172 const char *loaderror = (char *) dlerror();
2176 AC_MSG_RESULT($have_dlopen)
2178 if test x$have_dlopen = xyes; then
2179 AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
2180 AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
2181 AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
2182 AC_DEFINE(SDL_LOADSO_DLOPEN, 1, [ ])
2183 SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
2189 dnl Check for the usbhid(3) library on *BSD
2194 if test x$enable_joystick = xyes; then
2195 AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
2196 if test x$have_libusbhid = xyes; then
2197 AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
2198 AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
2199 USB_LIBS="$USB_LIBS -lusbhid"
2201 AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
2202 AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
2203 AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
2206 save_CFLAGS="$CFLAGS"
2207 CFLAGS="$CFLAGS $USB_CFLAGS"
2209 AC_MSG_CHECKING(for usbhid)
2212 #include <sys/types.h>
2213 #if defined(HAVE_USB_H)
2216 #ifdef __DragonFly__
2217 # include <bus/usb/usb.h>
2218 # include <bus/usb/usbhid.h>
2220 # include <dev/usb/usb.h>
2221 # include <dev/usb/usbhid.h>
2223 #if defined(HAVE_USBHID_H)
2225 #elif defined(HAVE_LIBUSB_H)
2227 #elif defined(HAVE_LIBUSBHID_H)
2228 #include <libusbhid.h>
2231 struct report_desc *repdesc;
2232 struct usb_ctl_report *repbuf;
2237 AC_MSG_RESULT($have_usbhid)
2239 if test x$have_usbhid = xyes; then
2240 AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
2241 have_usbhid_ucr_data=no
2243 #include <sys/types.h>
2244 #if defined(HAVE_USB_H)
2247 #ifdef __DragonFly__
2248 # include <bus/usb/usb.h>
2249 # include <bus/usb/usbhid.h>
2251 # include <dev/usb/usb.h>
2252 # include <dev/usb/usbhid.h>
2254 #if defined(HAVE_USBHID_H)
2256 #elif defined(HAVE_LIBUSB_H)
2258 #elif defined(HAVE_LIBUSBHID_H)
2259 #include <libusbhid.h>
2262 struct usb_ctl_report buf;
2263 if (buf.ucr_data) { }
2265 have_usbhid_ucr_data=yes
2267 if test x$have_usbhid_ucr_data = xyes; then
2268 USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
2270 AC_MSG_RESULT($have_usbhid_ucr_data)
2272 AC_MSG_CHECKING(for new usbhid API)
2275 #include <sys/types.h>
2276 #if defined(HAVE_USB_H)
2279 #ifdef __DragonFly__
2280 #include <bus/usb/usb.h>
2281 #include <bus/usb/usbhid.h>
2283 #include <dev/usb/usb.h>
2284 #include <dev/usb/usbhid.h>
2286 #if defined(HAVE_USBHID_H)
2288 #elif defined(HAVE_LIBUSB_H)
2290 #elif defined(HAVE_LIBUSBHID_H)
2291 #include <libusbhid.h>
2295 hid_start_parse(d, 1, 1);
2299 if test x$have_usbhid_new = xyes; then
2300 USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
2302 AC_MSG_RESULT($have_usbhid_new)
2304 AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
2305 have_machine_joystick=no
2307 #include <machine/joystick.h>
2311 have_machine_joystick=yes
2313 if test x$have_machine_joystick = xyes; then
2314 AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H, 1, [ ])
2316 AC_MSG_RESULT($have_machine_joystick)
2318 AC_DEFINE(SDL_JOYSTICK_USBHID, 1, [ ])
2319 SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
2320 EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
2321 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
2324 CFLAGS="$save_CFLAGS"
2330 dnl Check for clock_gettime()
2333 AC_ARG_ENABLE(clock_gettime,
2334 AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=yes]]]),
2335 , enable_clock_gettime=yes)
2336 if test x$enable_clock_gettime = xyes; then
2337 AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
2338 if test x$have_clock_gettime = xyes; then
2339 AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ])
2340 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
2342 AC_CHECK_LIB(c, clock_gettime, have_clock_gettime=yes)
2343 if test x$have_clock_gettime = xyes; then
2344 AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ])
2345 EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
2351 dnl Check for a valid linux/version.h
2354 AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
2355 if test x$have_linux_version_h = xyes; then
2356 EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
2360 dnl Check if we want to use RPATH
2363 AC_ARG_ENABLE(rpath,
2364 AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]),
2368 dnl Set up the configuration based on the host platform!
2370 *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*)
2375 RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
2376 RPI_LDFLAGS="-L/opt/vc/lib -lbcm_host"
2377 CFLAGS="$CFLAGS $RPI_CFLAGS"
2378 SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
2379 EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
2380 SDL_LIBS="$SDL_LIBS $RPI_LDFLAGS"
2382 if test x$enable_video = xyes; then
2383 SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
2384 $as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h
2387 *-*-linux*) ARCH=linux ;;
2388 *-*-uclinux*) ARCH=linux ;;
2389 *-*-kfreebsd*-gnu) ARCH=kfreebsd-gnu ;;
2390 *-*-knetbsd*-gnu) ARCH=knetbsd-gnu ;;
2391 *-*-kopenbsd*-gnu) ARCH=kopenbsd-gnu ;;
2392 *-*-gnu*) ARCH=gnu ;; # must be last of the gnu variants
2393 *-*-bsdi*) ARCH=bsdi ;;
2394 *-*-freebsd*) ARCH=freebsd ;;
2395 *-*-dragonfly*) ARCH=freebsd ;;
2396 *-*-netbsd*) ARCH=netbsd ;;
2397 *-*-openbsd*) ARCH=openbsd ;;
2398 *-*-sysv5*) ARCH=sysv5 ;;
2399 *-*-solaris*) ARCH=solaris ;;
2400 *-*-hpux*) ARCH=hpux ;;
2401 *-*-aix*) ARCH=aix ;;
2402 *-*-minix*) ARCH=minix ;;
2404 CheckVisibilityHidden
2431 # Set up files for the audio library
2432 if test x$enable_audio = xyes; then
2435 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO, 1, [ ])
2436 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
2439 netbsd) # Don't use this on OpenBSD, it's busted.
2440 AC_DEFINE(SDL_AUDIO_DRIVER_BSD, 1, [ ])
2441 SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c"
2445 AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO, 1, [ ])
2446 SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
2451 # Set up files for the joystick library
2452 if test x$enable_joystick = xyes; then
2455 AC_DEFINE(SDL_JOYSTICK_LINUX, 1, [ ])
2456 SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
2461 # Set up files for the haptic library
2462 if test x$enable_haptic = xyes; then
2463 if test x$use_input_events = xyes; then
2466 AC_DEFINE(SDL_HAPTIC_LINUX, 1, [ ])
2467 SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c"
2473 # Set up files for the power library
2474 if test x$enable_power = xyes; then
2477 AC_DEFINE(SDL_POWER_LINUX, 1, [ ])
2478 SOURCES="$SOURCES $srcdir/src/power/linux/*.c"
2483 # Set up files for the filesystem library
2484 if test x$enable_filesystem = xyes; then
2485 AC_DEFINE(SDL_FILESYSTEM_UNIX, 1, [ ])
2486 SOURCES="$SOURCES $srcdir/src/filesystem/unix/*.c"
2489 # Set up files for the timer library
2490 if test x$enable_timers = xyes; then
2491 AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
2492 SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
2495 # Set up files for udev hotplugging support
2496 if test x$enable_libudev = xyes && test x$have_libudev_h_hdr = xyes; then
2497 SOURCES="$SOURCES $srcdir/src/core/linux/SDL_udev.c"
2499 # Set up files for evdev input
2500 if test x$use_input_events = xyes; then
2501 SOURCES="$SOURCES $srcdir/src/input/evdev/*.c"
2504 *-*-cygwin* | *-*-mingw32*)
2506 if test "$build" != "$host"; then # cross-compiling
2507 # Default cross-compile location
2508 ac_default_prefix=/usr/local/cross-tools/$host
2510 # Look for the location of the tools and install there
2511 if test "$BUILD_PREFIX" != ""; then
2512 ac_default_prefix=$BUILD_PREFIX
2522 # Set up the core platform files
2523 SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
2525 # Set up files for the video library
2526 if test x$enable_video = xyes; then
2527 AC_DEFINE(SDL_VIDEO_DRIVER_WINDOWS, 1, [ ])
2528 SOURCES="$SOURCES $srcdir/src/video/windows/*.c"
2530 AC_ARG_ENABLE(render-d3d,
2531 AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
2532 , enable_render_d3d=yes)
2533 if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
2534 AC_DEFINE(SDL_VIDEO_RENDER_D3D, 1, [ ])
2537 # Set up files for the audio library
2538 if test x$enable_audio = xyes; then
2539 AC_DEFINE(SDL_AUDIO_DRIVER_WINMM, 1, [ ])
2540 SOURCES="$SOURCES $srcdir/src/audio/winmm/*.c"
2541 if test x$have_dsound = xyes; then
2542 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND, 1, [ ])
2543 SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c"
2545 if test x$have_xaudio2 = xyes; then
2546 AC_DEFINE(SDL_AUDIO_DRIVER_XAUDIO2, 1, [ ])
2547 SOURCES="$SOURCES $srcdir/src/audio/xaudio2/*.c"
2551 # Set up files for the joystick library
2552 if test x$enable_joystick = xyes; then
2553 if test x$have_dinput = xyes; then
2554 AC_DEFINE(SDL_JOYSTICK_DINPUT, 1, [ ])
2555 SOURCES="$SOURCES $srcdir/src/joystick/windows/SDL_dxjoystick.c"
2556 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8"
2558 AC_DEFINE(SDL_JOYSTICK_WINMM, 1, [ ])
2559 SOURCES="$SOURCES $srcdir/src/joystick/windows/SDL_mmjoystick.c"
2563 if test x$enable_haptic = xyes; then
2564 if test x$have_dinput = xyes; then
2565 AC_DEFINE(SDL_HAPTIC_DINPUT, 1, [ ])
2566 SOURCES="$SOURCES $srcdir/src/haptic/windows/SDL_syshaptic.c"
2570 if test x$enable_power = xyes; then
2571 AC_DEFINE(SDL_POWER_WINDOWS, 1, [ ])
2572 SOURCES="$SOURCES $srcdir/src/power/windows/SDL_syspower.c"
2575 if test x$enable_filesystem = xyes; then
2576 AC_DEFINE(SDL_FILESYSTEM_WINDOWS, 1, [ ])
2577 SOURCES="$SOURCES $srcdir/src/filesystem/windows/SDL_sysfilesystem.c"
2580 # Set up files for the thread library
2581 if test x$enable_threads = xyes; then
2582 AC_DEFINE(SDL_THREAD_WINDOWS, 1, [ ])
2583 SOURCES="$SOURCES $srcdir/src/thread/windows/*.c"
2584 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
2587 # Set up files for the timer library
2588 if test x$enable_timers = xyes; then
2589 AC_DEFINE(SDL_TIMER_WINDOWS, 1, [ ])
2590 SOURCES="$SOURCES $srcdir/src/timer/windows/*.c"
2593 # Set up files for the shared object loading library
2594 if test x$enable_loadso = xyes; then
2595 AC_DEFINE(SDL_LOADSO_WINDOWS, 1, [ ])
2596 SOURCES="$SOURCES $srcdir/src/loadso/windows/*.c"
2599 # Set up the system libraries we need
2600 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -XCClinker -static-libgcc"
2601 # The Windows platform requires special setup
2602 VERSION_SOURCES="$srcdir/src/main/windows/*.rc"
2603 SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c"
2604 SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
2605 SDL_LIBS="-lSDL2main $SDL_LIBS -mwindows"
2607 # Check to see if this is a mingw or cygwin build
2609 AC_CHECK_LIB(mingw32, main, [have_mingw32=yes])
2610 if test x$have_mingw32 = xyes; then
2611 SDL_LIBS="-lmingw32 $SDL_LIBS"
2613 SDL_LIBS="-lcygwin $SDL_LIBS"
2616 *-*-beos* | *-*-haiku*)
2618 ac_default_prefix=/boot/common
2624 # Set up files for the audio library
2625 if test x$enable_audio = xyes; then
2626 AC_DEFINE(SDL_AUDIO_DRIVER_BEOSAUDIO, 1, [ ])
2627 SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc"
2630 # Set up files for the joystick library
2631 if test x$enable_joystick = xyes; then
2632 AC_DEFINE(SDL_JOYSTICK_BEOS, 1, [ ])
2633 SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc"
2636 # Set up files for the thread library
2637 if test x$enable_threads = xyes; then
2638 AC_DEFINE(SDL_THREAD_BEOS, 1, [ ])
2639 SOURCES="$SOURCES $srcdir/src/thread/beos/*.c"
2640 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
2641 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
2644 # Set up files for the timer library
2645 if test x$enable_timers = xyes; then
2646 AC_DEFINE(SDL_TIMER_BEOS, 1, [ ])
2647 SOURCES="$SOURCES $srcdir/src/timer/beos/*.c"
2650 # Set up files for the shared object loading library
2651 if test x$enable_loadso = xyes; then
2652 AC_DEFINE(SDL_LOADSO_BEOS, 1, [ ])
2653 SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
2656 # Set up files for the system power library
2657 if test x$enable_power = xyes; then
2658 AC_DEFINE(SDL_POWER_BEOS, 1, [ ])
2659 SOURCES="$SOURCES $srcdir/src/power/beos/*.c"
2662 # Set up files for the system filesystem library
2663 if test x$enable_filesystem = xyes; then
2664 AC_DEFINE(SDL_FILESYSTEM_BEOS, 1, [ ])
2665 SOURCES="$SOURCES $srcdir/src/filesystem/beos/*.cc"
2668 # The BeOS platform requires special setup.
2669 SOURCES="$srcdir/src/main/beos/*.cc $SOURCES"
2670 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
2673 # iOS - We are not writing anything to confdefs.h because you have to replace
2674 # SDL_config.h for SDL_config_iphoneos.h anyway
2677 CheckVisibilityHidden
2686 # Set up files for the audio library
2687 if test x$enable_audio = xyes; then
2688 SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.c"
2691 # Set up files for the joystick library
2692 if test x$enable_joystick = xyes; then
2693 SOURCES="$SOURCES $srcdir/src/joystick/iphoneos/*.m"
2696 # Set up files for the haptic library
2697 #if test x$enable_haptic = xyes; then
2698 # SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
2700 # EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
2702 # Set up files for the power library
2703 if test x$enable_power = xyes; then
2704 SOURCES="$SOURCES $srcdir/src/power/uikit/*.m"
2707 # Set up files for the filesystem library
2708 if test x$enable_filesystem = xyes; then
2709 SOURCES="$SOURCES $srcdir/src/filesystem/cocoa/*.m"
2712 # Set up files for the timer library
2713 if test x$enable_timers = xyes; then
2714 SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
2717 # Set up additional files for the file library
2718 if test x$enable_file = xyes; then
2719 SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
2721 # The iOS platform requires special setup.
2722 SOURCES="$SOURCES $srcdir/src/video/uikit/*.m"
2723 EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
2724 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc"
2725 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Foundation"
2726 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit"
2727 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGLES"
2728 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore"
2729 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio"
2730 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox"
2731 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreGraphics"
2734 # This could be either full "Mac OS X", or plain "Darwin" which is
2735 # just the OS X kernel sans upper layers like Carbon and Cocoa.
2736 # Next line is broken, and a few files below require Mac OS X (full)
2739 # Mac OS X builds with both the Carbon and OSX APIs at the moment
2740 EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
2741 EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
2743 CheckVisibilityHidden
2754 # Good optimization on Mac OS X, yes...
2755 EXTRA_CFLAGS="$EXTRA_CFLAGS -falign-loops=16"
2757 # Need this or things might misbuild on a G3.
2758 EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"
2760 # Set up files for the audio library
2761 if test x$enable_audio = xyes; then
2762 AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ])
2763 SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.c"
2766 # Set up files for the joystick library
2767 if test x$enable_joystick = xyes; then
2768 AC_DEFINE(SDL_JOYSTICK_IOKIT, 1, [ ])
2769 SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
2772 # Set up files for the haptic library
2773 if test x$enable_haptic = xyes; then
2774 AC_DEFINE(SDL_HAPTIC_IOKIT, 1, [ ])
2775 SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
2777 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
2779 # Set up files for the power library
2780 if test x$enable_power = xyes; then
2781 AC_DEFINE(SDL_POWER_MACOSX, 1, [ ])
2782 SOURCES="$SOURCES $srcdir/src/power/macosx/*.c"
2785 # Set up files for the filesystem library
2786 if test x$enable_filesystem = xyes; then
2787 AC_DEFINE(SDL_FILESYSTEM_COCOA, 1, [ ])
2788 SOURCES="$SOURCES $srcdir/src/filesystem/cocoa/*.m"
2791 # Set up files for the timer library
2792 if test x$enable_timers = xyes; then
2793 AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
2794 SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
2797 # Set up additional files for the file library
2798 if test x$enable_file = xyes; then
2799 SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
2801 # The Mac OS X platform requires special setup.
2802 EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
2803 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc"
2804 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
2805 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
2806 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
2807 # If audio is used, add the AudioUnit framework
2808 if test x$enable_audio = xyes; then
2809 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit"
2814 *** Unsupported host: Please add to configure.in
2819 dnl Do this on all platforms, after everything else.
2822 # Verify that we have all the platform specific files we need
2824 if test x$have_joystick != xyes; then
2825 if test x$enable_joystick = xyes; then
2826 AC_DEFINE(SDL_JOYSTICK_DISABLED, 1, [ ])
2828 SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
2830 if test x$have_haptic != xyes; then
2831 if test x$enable_haptic = xyes; then
2832 AC_DEFINE(SDL_HAPTIC_DISABLED, 1, [ ])
2834 SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
2836 if test x$have_threads != xyes; then
2837 if test x$enable_threads = xyes; then
2838 AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ])
2840 SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
2842 if test x$have_timers != xyes; then
2843 if test x$enable_timers = xyes; then
2844 AC_DEFINE(SDL_TIMERS_DISABLED, 1, [ ])
2846 SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
2848 if test x$have_filesystem != xyes; then
2849 if test x$enable_filesystem = xyes; then
2850 AC_DEFINE(SDL_FILESYSTEM_DISABLED, 1, [ ])
2852 SOURCES="$SOURCES $srcdir/src/filesystem/dummy/*.c"
2854 if test x$have_loadso != xyes; then
2855 if test x$enable_loadso = xyes; then
2856 AC_DEFINE(SDL_LOADSO_DISABLED, 1, [ ])
2858 SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
2860 if test x$SDLMAIN_SOURCES = x; then
2861 SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
2863 SDLTEST_SOURCES="$srcdir/src/test/*.c"
2865 OBJECTS=`echo $SOURCES`
2866 DEPENDS=`echo $SOURCES | tr ' ' '\n'`
2867 for EXT in asm cc m c S; do
2868 OBJECTS=`echo "$OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.'$EXT',$(objects)/\1.lo,g'`
2869 DEPENDS=`echo "$DEPENDS" | sed "s,^\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.$EXT\\$,\\\\
2870 \\$(objects)/\\2.lo: \\1/\\2.$EXT\\\\
2871 \\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
2874 VERSION_OBJECTS=`echo $VERSION_SOURCES`
2875 VERSION_DEPENDS=`echo $VERSION_SOURCES`
2876 VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
2877 VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.rc,\\\\
2878 \\$(objects)/\\2.o: \\1/\\2.rc\\\\
2879 \\$(WINDRES) \\$< \\$@,g"`
2881 SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES`
2882 SDLMAIN_DEPENDS=`echo $SDLMAIN_SOURCES`
2883 SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
2884 SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
2885 \\$(objects)/\\2.o: \\1/\\2.c\\\\
2886 \\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
2888 SDLTEST_OBJECTS=`echo $SDLTEST_SOURCES`
2889 SDLTEST_DEPENDS=`echo $SDLTEST_SOURCES`
2890 SDLTEST_OBJECTS=`echo "$SDLTEST_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
2891 SDLTEST_DEPENDS=`echo "$SDLTEST_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
2892 \\$(objects)/\\2.o: \\1/\\2.c\\\\
2893 \\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
2895 # Set runtime shared library paths as needed
2897 if test "x$enable_rpath" = "xyes"; then
2898 if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then
2899 SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
2901 if test $ARCH = solaris; then
2902 SDL_RLD_FLAGS="-R\${libdir}"
2908 SDL_STATIC_LIBS="$SDL_LIBS $EXTRA_LDFLAGS"
2910 dnl Expand the cflags and libraries needed by apps using SDL
2911 AC_SUBST(SDL_CFLAGS)
2913 AC_SUBST(SDL_STATIC_LIBS)
2914 AC_SUBST(SDL_RLD_FLAGS)
2915 if test x$enable_shared = xyes; then
2917 ENABLE_SHARED_FALSE="#"
2919 ENABLE_SHARED_TRUE="#"
2920 ENABLE_SHARED_FALSE=
2922 if test x$enable_static = xyes; then
2924 ENABLE_STATIC_FALSE="#"
2926 ENABLE_STATIC_TRUE="#"
2927 ENABLE_STATIC_FALSE=
2929 AC_SUBST(ENABLE_SHARED_TRUE)
2930 AC_SUBST(ENABLE_SHARED_FALSE)
2931 AC_SUBST(ENABLE_STATIC_TRUE)
2932 AC_SUBST(ENABLE_STATIC_FALSE)
2934 dnl Expand the sources and objects needed to build the library
2935 AC_SUBST(ac_aux_dir)
2938 AC_SUBST(VERSION_OBJECTS)
2939 AC_SUBST(SDLMAIN_OBJECTS)
2940 AC_SUBST(SDLTEST_OBJECTS)
2941 AC_SUBST(BUILD_CFLAGS)
2942 AC_SUBST(EXTRA_CFLAGS)
2943 AC_SUBST(BUILD_LDFLAGS)
2944 AC_SUBST(EXTRA_LDFLAGS)
2947 cat >Makefile.rules <<__EOF__
2949 # Build rules for objects
2950 -include \$(OBJECTS:.lo=.d)
2952 # Special dependency for SDL.c, since it depends on SDL_revision.h
2953 $srcdir/src/SDL.c: update-revision
2961 Makefile:Makefile.in:Makefile.rules sdl2-config SDL2.spec sdl2.pc
2964 chmod a+x sdl2-config