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 -idirafter $srcdir/src/video/khronos"
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"
127 if test "x$BASE_LDFLAGS" != x; then
128 SDL_LIBS="$SDL_LIBS $BASE_LDFLAGS"
130 if test "x$EXTRA_CFLAGS" != x; then
131 CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS"
132 CFLAGS="$CFLAGS $EXTRA_CFLAGS"
134 if test "x$EXTRA_LDFLAGS" != x; then
135 LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
138 dnl set this to use on systems that use lib64 instead of lib
139 base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
141 dnl Function to find a library in the compiler search path
144 gcc_bin_path=[`$CC -print-search-dirs 2>/dev/null | fgrep programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
145 gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
146 env_lib_path=[`echo $LIBS $LDFLAGS $* | sed 's/-L[ ]*//g'`]
147 if test "$cross_compiling" = yes; then
150 host_lib_path="/usr/$base_libdir /usr/local/$base_libdir"
152 for path in $env_lib_path $gcc_bin_path $gcc_lib_path $host_lib_path; do
153 lib=[`ls -- $path/$1 2>/dev/null | sed -e '/\.so\..*\./d' -e 's,.*/,,' | sort | tail -1`]
154 if test x$lib != x; then
161 dnl Check for compiler characteristics
166 dnl See whether we want assertions for debugging/sanity checking SDL itself.
167 AC_ARG_ENABLE(assertions,
168 AC_HELP_STRING([--enable-assertions],
169 [Enable internal sanity checks (auto/disabled/release/enabled/paranoid) [[default=auto]]]),
170 , enable_assertions=auto)
171 case "$enable_assertions" in
172 auto) # Use optimization settings to determine assertion level
175 AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 0, [ ])
178 AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 1, [ ])
181 AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 2, [ ])
184 AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 3, [ ])
187 AC_MSG_ERROR([*** unknown assertion level. stop.])
191 dnl See whether we can use gcc style dependency tracking
192 AC_ARG_ENABLE(dependency-tracking,
193 AC_HELP_STRING([--enable-dependency-tracking],
194 [Use gcc -MMD -MT dependency tracking [[default=yes]]]),
195 , enable_dependency_tracking=yes)
196 if test x$enable_dependency_tracking = xyes; then
198 AC_MSG_CHECKING(for GCC -MMD -MT option)
200 #if !defined(__GNUC__) || __GNUC__ < 3
201 #error Dependency tracking requires GCC 3.0 or newer
207 AC_MSG_RESULT($have_gcc_mmd_mt)
209 if test x$have_gcc_mmd_mt = xyes; then
210 DEPENDENCY_TRACKING_OPTIONS="-MMD -MT \$@"
214 AC_MSG_CHECKING(for linker option --no-undefined)
217 dnl Skip this on platforms where it is just simply busted.
222 save_LDFLAGS="$LDFLAGS"
223 LDFLAGS="$LDFLAGS -Wl,--no-undefined"
227 have_no_undefined=yes
228 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--no-undefined"
230 LDFLAGS="$save_LDFLAGS"
233 AC_MSG_RESULT($have_no_undefined)
235 dnl See whether we are allowed to use the system C library
237 AC_HELP_STRING([--enable-libc], [Use the system C library [[default=yes]]]),
239 if test x$enable_libc = xyes; then
240 AC_DEFINE(HAVE_LIBC, 1, [ ])
242 dnl Check for C library headers
244 AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h wchar.h inttypes.h stdint.h limits.h ctype.h math.h float.h iconv.h signal.h)
246 dnl Check for typedefs, structures, etc.
249 dnl Check for defines
250 AC_CHECK_DEFINE(M_PI, math.h)
252 dnl Checks for library functions.
254 *-*-cygwin* | *-*-mingw32*)
262 if test x$ac_cv_func_memcmp_working = xyes; then
263 AC_DEFINE(HAVE_MEMCMP, 1, [ ])
266 if test x$ac_cv_func_strtod = xyes; then
267 AC_DEFINE(HAVE_STRTOD, 1, [ ])
269 AC_CHECK_FUNC(mprotect,
271 #include <sys/types.h>
272 #include <sys/mman.h>
275 AC_DEFINE(HAVE_MPROTECT, 1, [ ])
278 AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcscmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval poll)
280 AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
281 AC_CHECK_FUNCS(acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf fabs fabsf floor floorf fmod fmodf log logf log10 log10f pow powf scalbn scalbnf sin sinf sqrt sqrtf tan tanf)
283 AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"])
284 AC_CHECK_FUNCS(iconv)
286 AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE([HAVE_SA_SIGACTION], 1, [ ])], ,[#include <signal.h>])
288 dnl Check for additional non-standard headers
289 AC_CHECK_HEADERS(libunwind.h)
292 dnl AC_CHECK_SIZEOF(void*)
294 dnl See whether we can use gcc atomic operations on this architecture
295 AC_ARG_ENABLE(gcc-atomics,
296 AC_HELP_STRING([--enable-gcc-atomics],
297 [Use gcc builtin atomics [[default=yes]]]),
298 , enable_gcc_atomics=yes)
299 if test x$enable_gcc_atomics = xyes; then
301 AC_MSG_CHECKING(for GCC builtin atomic operations)
306 __sync_lock_test_and_set(&a, 4);
307 __sync_lock_test_and_set(&x, y);
308 __sync_fetch_and_add(&a, 1);
309 __sync_bool_compare_and_swap(&a, 5, 10);
310 __sync_bool_compare_and_swap(&x, y, z);
314 AC_MSG_RESULT($have_gcc_atomics)
316 if test x$have_gcc_atomics = xyes; then
317 AC_DEFINE(HAVE_GCC_ATOMICS, 1, [ ])
319 # See if we have the minimum operation needed for GCC atomics
323 __sync_lock_test_and_set(&a, 1);
324 __sync_lock_release(&a);
326 have_gcc_sync_lock_test_and_set=yes
328 if test x$have_gcc_sync_lock_test_and_set = xyes; then
329 AC_DEFINE(HAVE_GCC_SYNC_LOCK_TEST_AND_SET, 1, [ ])
335 SOURCES="$SOURCES $srcdir/src/*.c"
336 SOURCES="$SOURCES $srcdir/src/atomic/*.c"
337 SOURCES="$SOURCES $srcdir/src/audio/*.c"
338 SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c"
339 SOURCES="$SOURCES $srcdir/src/dynapi/*.c"
340 SOURCES="$SOURCES $srcdir/src/events/*.c"
341 SOURCES="$SOURCES $srcdir/src/file/*.c"
342 SOURCES="$SOURCES $srcdir/src/haptic/*.c"
343 SOURCES="$SOURCES $srcdir/src/joystick/*.c"
344 SOURCES="$SOURCES $srcdir/src/libm/*.c"
345 SOURCES="$SOURCES $srcdir/src/power/*.c"
346 #SOURCES="$SOURCES $srcdir/src/filesystem/*.c"
347 SOURCES="$SOURCES $srcdir/src/render/*.c"
348 SOURCES="$SOURCES $srcdir/src/render/*/*.c"
349 SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
350 SOURCES="$SOURCES $srcdir/src/thread/*.c"
351 SOURCES="$SOURCES $srcdir/src/timer/*.c"
352 SOURCES="$SOURCES $srcdir/src/video/*.c"
353 SOURCES="$SOURCES $srcdir/src/video/yuv2rgb/*.c"
355 dnl Enable/disable various subsystems of the SDL library
357 AC_ARG_ENABLE(atomic,
358 AC_HELP_STRING([--enable-atomic], [Enable the atomic operations subsystem [[default=yes]]]),
360 if test x$enable_atomic != xyes; then
361 AC_DEFINE(SDL_ATOMIC_DISABLED, 1, [ ])
363 SUMMARY_modules="${SUMMARY_modules} atomic"
366 AC_HELP_STRING([--enable-audio], [Enable the audio subsystem [[default=yes]]]),
368 if test x$enable_audio != xyes; then
369 AC_DEFINE(SDL_AUDIO_DISABLED, 1, [ ])
371 SUMMARY_modules="${SUMMARY_modules} audio"
374 AC_HELP_STRING([--enable-video], [Enable the video subsystem [[default=yes]]]),
376 if test x$enable_video != xyes; then
377 AC_DEFINE(SDL_VIDEO_DISABLED, 1, [ ])
379 SUMMARY_modules="${SUMMARY_modules} video"
381 AC_ARG_ENABLE(render,
382 AC_HELP_STRING([--enable-render], [Enable the render subsystem [[default=yes]]]),
384 if test x$enable_render != xyes; then
385 AC_DEFINE(SDL_RENDER_DISABLED, 1, [ ])
387 SUMMARY_modules="${SUMMARY_modules} render"
389 AC_ARG_ENABLE(events,
390 AC_HELP_STRING([--enable-events], [Enable the events subsystem [[default=yes]]]),
392 if test x$enable_events != xyes; then
393 AC_DEFINE(SDL_EVENTS_DISABLED, 1, [ ])
395 SUMMARY_modules="${SUMMARY_modules} events"
397 AC_ARG_ENABLE(joystick,
398 AC_HELP_STRING([--enable-joystick], [Enable the joystick subsystem [[default=yes]]]),
399 , enable_joystick=yes)
400 if test x$enable_joystick != xyes; then
401 AC_DEFINE(SDL_JOYSTICK_DISABLED, 1, [ ])
403 SUMMARY_modules="${SUMMARY_modules} joystick"
405 AC_ARG_ENABLE(haptic,
406 AC_HELP_STRING([--enable-haptic], [Enable the haptic (force feedback) subsystem [[default=yes]]]),
408 if test x$enable_haptic != xyes; then
409 AC_DEFINE(SDL_HAPTIC_DISABLED, 1, [ ])
411 SUMMARY_modules="${SUMMARY_modules} haptic"
414 AC_HELP_STRING([--enable-power], [Enable the power subsystem [[default=yes]]]),
416 if test x$enable_power != xyes; then
417 AC_DEFINE(SDL_POWER_DISABLED, 1, [ ])
419 SUMMARY_modules="${SUMMARY_modules} power"
421 AC_ARG_ENABLE(filesystem,
422 AC_HELP_STRING([--enable-filesystem], [Enable the filesystem subsystem [[default=yes]]]),
423 , enable_filesystem=yes)
424 if test x$enable_filesystem != xyes; then
425 AC_DEFINE(SDL_FILESYSTEM_DISABLED, 1, [ ])
427 SUMMARY_modules="${SUMMARY_modules} filesystem"
429 AC_ARG_ENABLE(threads,
430 AC_HELP_STRING([--enable-threads], [Enable the threading subsystem [[default=yes]]]),
431 , enable_threads=yes)
432 if test x$enable_threads != xyes; then
433 AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ])
435 SUMMARY_modules="${SUMMARY_modules} threads"
437 AC_ARG_ENABLE(timers,
438 AC_HELP_STRING([--enable-timers], [Enable the timer subsystem [[default=yes]]]),
440 if test x$enable_timers != xyes; then
441 AC_DEFINE(SDL_TIMERS_DISABLED, 1, [ ])
443 SUMMARY_modules="${SUMMARY_modules} timers"
446 AC_HELP_STRING([--enable-file], [Enable the file subsystem [[default=yes]]]),
448 if test x$enable_file != xyes; then
449 AC_DEFINE(SDL_FILE_DISABLED, 1, [ ])
451 SUMMARY_modules="${SUMMARY_modules} file"
453 AC_ARG_ENABLE(loadso,
454 AC_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [[default=yes]]]),
456 if test x$enable_loadso != xyes; then
457 AC_DEFINE(SDL_LOADSO_DISABLED, 1, [ ])
459 SUMMARY_modules="${SUMMARY_modules} loadso"
461 AC_ARG_ENABLE(cpuinfo,
462 AC_HELP_STRING([--enable-cpuinfo], [Enable the cpuinfo subsystem [[default=yes]]]),
463 , enable_cpuinfo=yes)
464 if test x$enable_cpuinfo != xyes; then
465 AC_DEFINE(SDL_CPUINFO_DISABLED, 1, [ ])
467 SUMMARY_modules="${SUMMARY_modules} cpuinfo"
469 AC_ARG_ENABLE(assembly,
470 AC_HELP_STRING([--enable-assembly], [Enable assembly routines [[default=yes]]]),
471 , enable_assembly=yes)
472 if test x$enable_assembly = xyes; then
473 SUMMARY_modules="${SUMMARY_modules} assembly"
475 AC_DEFINE(SDL_ASSEMBLY_ROUTINES, 1, [ ])
477 # Make sure that we don't generate floating point code that would
478 # cause illegal instruction exceptions on older processors
481 # Don't need to worry about Apple hardware, it's all SSE capable
485 # x86 64-bit architectures all have SSE instructions
492 AC_ARG_ENABLE(ssemath,
493 AC_HELP_STRING([--enable-ssemath], [Allow GCC to use SSE floating point math [[default=maybe]]]),
494 , enable_ssemath=$default_ssemath)
495 if test x$enable_ssemath = xno; then
496 if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes -o x$have_gcc_sse3 = xyes; then
497 EXTRA_CFLAGS="$EXTRA_CFLAGS -mfpmath=387"
501 dnl Check for various instruction support
503 AC_HELP_STRING([--enable-mmx], [use MMX assembly routines [[default=yes]]]),
505 if test x$enable_mmx = xyes; then
506 save_CFLAGS="$CFLAGS"
508 AC_MSG_CHECKING(for GCC -mmmx option)
510 CFLAGS="$save_CFLAGS $mmx_CFLAGS"
515 #ifdef __MINGW64_VERSION_MAJOR
518 #include <mmintrin.h>
521 #include <mmintrin.h>
524 #error Assembler CPP flag not enabled
530 AC_MSG_RESULT($have_gcc_mmx)
531 CFLAGS="$save_CFLAGS"
533 if test x$have_gcc_mmx = xyes; then
534 EXTRA_CFLAGS="$EXTRA_CFLAGS $mmx_CFLAGS"
535 SUMMARY_math="${SUMMARY_math} mmx"
540 AC_HELP_STRING([--enable-3dnow], [use 3DNow! assembly routines [[default=yes]]]),
542 if test x$enable_3dnow = xyes; then
543 save_CFLAGS="$CFLAGS"
545 AC_MSG_CHECKING(for GCC -m3dnow option)
546 amd3dnow_CFLAGS="-m3dnow"
547 CFLAGS="$save_CFLAGS $amd3dnow_CFLAGS"
552 #error Assembler CPP flag not enabled
560 AC_MSG_RESULT($have_gcc_3dnow)
561 CFLAGS="$save_CFLAGS"
563 if test x$have_gcc_3dnow = xyes; then
564 EXTRA_CFLAGS="$EXTRA_CFLAGS $amd3dnow_CFLAGS"
565 SUMMARY_math="${SUMMARY_math} 3dnow"
570 AC_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]),
572 if test x$enable_sse = xyes; then
573 save_CFLAGS="$CFLAGS"
575 AC_MSG_CHECKING(for GCC -msse option)
577 CFLAGS="$save_CFLAGS $sse_CFLAGS"
582 #ifdef __MINGW64_VERSION_MAJOR
585 #include <xmmintrin.h>
588 #include <xmmintrin.h>
591 #error Assembler CPP flag not enabled
597 AC_MSG_RESULT($have_gcc_sse)
598 CFLAGS="$save_CFLAGS"
600 if test x$have_gcc_sse = xyes; then
601 EXTRA_CFLAGS="$EXTRA_CFLAGS $sse_CFLAGS"
602 SUMMARY_math="${SUMMARY_math} sse"
607 AC_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=maybe]]]),
608 , enable_sse2=$default_ssemath)
609 if test x$enable_sse2 = xyes; then
610 save_CFLAGS="$CFLAGS"
612 AC_MSG_CHECKING(for GCC -msse2 option)
614 CFLAGS="$save_CFLAGS $sse2_CFLAGS"
619 #ifdef __MINGW64_VERSION_MAJOR
622 #include <emmintrin.h>
625 #include <emmintrin.h>
628 #error Assembler CPP flag not enabled
634 AC_MSG_RESULT($have_gcc_sse2)
635 CFLAGS="$save_CFLAGS"
637 if test x$have_gcc_sse2 = xyes; then
638 EXTRA_CFLAGS="$EXTRA_CFLAGS $sse2_CFLAGS"
639 SUMMARY_math="${SUMMARY_math} sse2"
644 AC_HELP_STRING([--enable-sse3], [use SSE3 assembly routines [[default=maybe]]]),
645 , enable_sse3=$default_ssemath)
646 if test x$enable_sse3 = xyes; then
647 save_CFLAGS="$CFLAGS"
649 AC_MSG_CHECKING(for GCC -msse3 option)
651 CFLAGS="$save_CFLAGS $sse3_CFLAGS"
656 #ifdef __MINGW64_VERSION_MAJOR
659 #include <pmmintrin.h>
662 #include <pmmintrin.h>
665 #error Assembler CPP flag not enabled
671 AC_MSG_RESULT($have_gcc_sse3)
672 CFLAGS="$save_CFLAGS"
674 if test x$have_gcc_sse3 = xyes; then
675 EXTRA_CFLAGS="$EXTRA_CFLAGS $sse3_CFLAGS"
676 SUMMARY_math="${SUMMARY_math} sse3"
680 AC_CHECK_HEADER(immintrin.h,
681 have_immintrin_h_hdr=yes,
682 have_immintrin_h_hdr=no)
683 if test x$have_immintrin_h_hdr = xyes; then
684 AC_DEFINE(HAVE_IMMINTRIN_H, 1, [ ])
687 AC_ARG_ENABLE(altivec,
688 AC_HELP_STRING([--enable-altivec], [use Altivec assembly routines [[default=yes]]]),
689 , enable_altivec=yes)
690 if test x$enable_altivec = xyes; then
691 save_CFLAGS="$CFLAGS"
693 have_altivec_h_hdr=no
694 altivec_CFLAGS="-maltivec"
695 CFLAGS="$save_CFLAGS $altivec_CFLAGS"
697 AC_MSG_CHECKING(for Altivec with GCC altivec.h and -maltivec option)
700 vector unsigned int vzero() {
701 return vec_splat_u32(0);
706 have_altivec_h_hdr=yes
708 AC_MSG_RESULT($have_gcc_altivec)
710 if test x$have_gcc_altivec = xno; then
711 AC_MSG_CHECKING(for Altivec with GCC -maltivec option)
713 vector unsigned int vzero() {
714 return vec_splat_u32(0);
720 AC_MSG_RESULT($have_gcc_altivec)
723 if test x$have_gcc_altivec = xno; then
724 AC_MSG_CHECKING(for Altivec with GCC altivec.h and -faltivec option)
725 altivec_CFLAGS="-faltivec"
726 CFLAGS="$save_CFLAGS $altivec_CFLAGS"
729 vector unsigned int vzero() {
730 return vec_splat_u32(0);
735 have_altivec_h_hdr=yes
737 AC_MSG_RESULT($have_gcc_altivec)
740 if test x$have_gcc_altivec = xno; then
741 AC_MSG_CHECKING(for Altivec with GCC -faltivec option)
743 vector unsigned int vzero() {
744 return vec_splat_u32(0);
750 AC_MSG_RESULT($have_gcc_altivec)
752 CFLAGS="$save_CFLAGS"
754 if test x$have_gcc_altivec = xyes; then
755 AC_DEFINE(SDL_ALTIVEC_BLITTERS, 1, [ ])
756 if test x$have_altivec_h_hdr = xyes; then
757 AC_DEFINE(HAVE_ALTIVEC_H, 1, [ ])
759 EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS"
760 SUMMARY_math="${SUMMARY_math} altivec"
765 dnl See if the OSS audio interface is supported
769 AC_HELP_STRING([--enable-oss], [support the OSS audio API [[default=maybe]]]),
772 # OpenBSD "has" OSS, but it's not really for app use. They want you to
773 # use sndio instead. So on there, we default to disabled. You can force
774 # it on if you really want, though.
775 if test x$enable_oss = xmaybe; then
783 if test x$enable_audio = xyes -a x$enable_oss = xyes; then
784 AC_MSG_CHECKING(for OSS audio support)
786 if test x$have_oss != xyes; then
788 #include <sys/soundcard.h>
790 int arg = SNDCTL_DSP_SETFRAGMENT;
795 if test x$have_oss != xyes; then
797 #include <soundcard.h>
799 int arg = SNDCTL_DSP_SETFRAGMENT;
802 AC_DEFINE(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H, 1, [ ])
805 AC_MSG_RESULT($have_oss)
806 if test x$have_oss = xyes; then
807 SUMMARY_audio="${SUMMARY_audio} oss"
808 AC_DEFINE(SDL_AUDIO_DRIVER_OSS, 1, [ ])
809 SOURCES="$SOURCES $srcdir/src/audio/dsp/*.c"
812 # We may need to link with ossaudio emulation library
814 *-*-openbsd*|*-*-netbsd*)
815 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";;
821 dnl See if the ALSA audio interface is supported
825 AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [[default=yes]]]),
827 if test x$enable_audio = xyes -a x$enable_alsa = xyes; then
828 AM_PATH_ALSA(1.0.11, have_alsa=yes, have_alsa=no)
829 # Restore all flags from before the ALSA detection runs
830 CFLAGS="$alsa_save_CFLAGS"
831 LDFLAGS="$alsa_save_LDFLAGS"
832 LIBS="$alsa_save_LIBS"
833 if test x$have_alsa = xyes; then
834 AC_ARG_ENABLE(alsa-shared,
835 AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [[default=yes]]]),
836 , enable_alsa_shared=yes)
837 alsa_lib=[`find_lib "libasound.so.*" "$ALSA_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
839 AC_DEFINE(SDL_AUDIO_DRIVER_ALSA, 1, [ ])
840 SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c"
841 EXTRA_CFLAGS="$EXTRA_CFLAGS $ALSA_CFLAGS"
842 if test x$have_loadso != xyes && \
843 test x$enable_alsa_shared = xyes; then
844 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ALSA loading])
846 if test x$have_loadso = xyes && \
847 test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
848 echo "-- dynamic libasound -> $alsa_lib"
849 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ALSA_DYNAMIC, "$alsa_lib", [ ])
850 SUMMARY_audio="${SUMMARY_audio} alsa(dynamic)"
852 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ALSA_LIBS"
853 SUMMARY_audio="${SUMMARY_audio} alsa"
864 AC_HELP_STRING([--enable-jack], [use JACK audio [[default=yes]]]),
866 if test x$enable_audio = xyes -a x$enable_jack = xyes; then
869 JACK_REQUIRED_VERSION=0.125
871 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
872 AC_MSG_CHECKING(for JACK $JACK_REQUIRED_VERSION support)
873 if test x$PKG_CONFIG != xno; then
874 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $JACK_REQUIRED_VERSION jack; then
875 JACK_CFLAGS=`$PKG_CONFIG --cflags jack`
876 JACK_LIBS=`$PKG_CONFIG --libs jack`
880 AC_MSG_RESULT($audio_jack)
882 if test x$audio_jack = xyes; then
883 AC_ARG_ENABLE(jack-shared,
884 AC_HELP_STRING([--enable-jack-shared], [dynamically load JACK audio support [[default=yes]]]),
885 , enable_jack_shared=yes)
886 jack_lib=[`find_lib "libjack.so.*" "$JACK_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
888 AC_DEFINE(SDL_AUDIO_DRIVER_JACK, 1, [ ])
889 SOURCES="$SOURCES $srcdir/src/audio/jack/*.c"
890 EXTRA_CFLAGS="$EXTRA_CFLAGS $JACK_CFLAGS"
891 if test x$have_loadso != xyes && \
892 test x$enable_jack_shared = xyes; then
893 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic JACK audio loading])
895 if test x$have_loadso = xyes && \
896 test x$enable_jack_shared = xyes && test x$jack_lib != x; then
897 echo "-- dynamic libjack -> $jack_lib"
898 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_JACK_DYNAMIC, "$jack_lib", [ ])
899 SUMMARY_audio="${SUMMARY_audio} jack(dynamic)"
902 # On Solaris, jack must be linked deferred explicitly
903 # to prevent undefined symbol failures.
905 JACK_LIBS=`echo $JACK_LIBS | sed 's/\-l/-Wl,-l/g'`
906 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-zdeferred $JACK_LIBS -Wl,-znodeferred"
909 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $JACK_LIBS"
910 SUMMARY_audio="${SUMMARY_audio} jack"
917 dnl Find the ESD includes and libraries
921 AC_HELP_STRING([--enable-esd], [support the Enlightened Sound Daemon [[default=yes]]]),
923 if test x$enable_audio = xyes -a x$enable_esd = xyes; then
924 AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no)
925 if test x$have_esd = xyes; then
926 AC_ARG_ENABLE(esd-shared,
927 AC_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [[default=yes]]]),
928 , enable_esd_shared=yes)
929 esd_lib=[`find_lib "libesd.so.*" "$ESD_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
931 AC_DEFINE(SDL_AUDIO_DRIVER_ESD, 1, [ ])
932 SOURCES="$SOURCES $srcdir/src/audio/esd/*.c"
933 EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS"
934 if test x$have_loadso != xyes && \
935 test x$enable_esd_shared = xyes; then
936 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ESD loading])
938 if test x$have_loadso = xyes && \
939 test x$enable_esd_shared = xyes && test x$esd_lib != x; then
940 echo "-- dynamic libesd -> $esd_lib"
941 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ESD_DYNAMIC, "$esd_lib", [ ])
942 SUMMARY_audio="${SUMMARY_audio} esd(dynamic)"
944 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ESD_LIBS"
945 SUMMARY_audio="${SUMMARY_audio} esd"
955 AC_ARG_ENABLE(pulseaudio,
956 AC_HELP_STRING([--enable-pulseaudio], [use PulseAudio [[default=yes]]]),
957 , enable_pulseaudio=yes)
958 if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then
961 PULSEAUDIO_REQUIRED_VERSION=0.9
963 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
964 AC_MSG_CHECKING(for PulseAudio $PULSEAUDIO_REQUIRED_VERSION support)
965 if test x$PKG_CONFIG != xno; then
966 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSEAUDIO_REQUIRED_VERSION libpulse-simple; then
967 PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple`
968 PULSEAUDIO_LIBS=`$PKG_CONFIG --libs libpulse-simple`
972 AC_MSG_RESULT($audio_pulseaudio)
974 if test x$audio_pulseaudio = xyes; then
975 AC_ARG_ENABLE(pulseaudio-shared,
976 AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [[default=yes]]]),
977 , enable_pulseaudio_shared=yes)
978 pulseaudio_lib=[`find_lib "libpulse-simple.so.*" "$PULSEAUDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
980 AC_DEFINE(SDL_AUDIO_DRIVER_PULSEAUDIO, 1, [ ])
981 SOURCES="$SOURCES $srcdir/src/audio/pulseaudio/*.c"
982 EXTRA_CFLAGS="$EXTRA_CFLAGS $PULSEAUDIO_CFLAGS"
983 if test x$have_loadso != xyes && \
984 test x$enable_pulseaudio_shared = xyes; then
985 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic PulseAudio loading])
987 if test x$have_loadso = xyes && \
988 test x$enable_pulseaudio_shared = xyes && test x$pulseaudio_lib != x; then
989 echo "-- dynamic libpulse-simple -> $pulseaudio_lib"
990 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC, "$pulseaudio_lib", [ ])
991 SUMMARY_audio="${SUMMARY_audio} pulse(dynamic)"
994 # On Solaris, pulseaudio must be linked deferred explicitly
995 # to prevent undefined symbol failures.
997 PULSEAUDIO_LIBS=`echo $PULSEAUDIO_LIBS | sed 's/\-l/-Wl,-l/g'`
998 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-zdeferred $PULSEAUDIO_LIBS -Wl,-znodeferred"
1001 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PULSEAUDIO_LIBS"
1002 SUMMARY_audio="${SUMMARY_audio} pulse"
1012 AC_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [[default=yes]]]),
1014 if test x$enable_audio = xyes -a x$enable_arts = xyes; then
1015 AC_PATH_PROG(ARTSCONFIG, artsc-config)
1016 if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then
1017 : # arts isn't installed
1019 ARTS_CFLAGS=`$ARTSCONFIG --cflags`
1020 ARTS_LIBS=`$ARTSCONFIG --libs`
1021 AC_MSG_CHECKING(for aRts development environment)
1023 save_CFLAGS="$CFLAGS"
1024 CFLAGS="$CFLAGS $ARTS_CFLAGS"
1028 arts_stream_t stream;
1032 CFLAGS="$save_CFLAGS"
1033 AC_MSG_RESULT($audio_arts)
1034 if test x$audio_arts = xyes; then
1035 AC_ARG_ENABLE(arts-shared,
1036 AC_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [[default=yes]]]),
1037 , enable_arts_shared=yes)
1038 arts_lib=[`find_lib "libartsc.so.*" "$ARTS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
1040 AC_DEFINE(SDL_AUDIO_DRIVER_ARTS, 1, [ ])
1041 SOURCES="$SOURCES $srcdir/src/audio/arts/*.c"
1042 EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS"
1043 if test x$have_loadso != xyes && \
1044 test x$enable_arts_shared = xyes; then
1045 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ARTS loading])
1047 if test x$have_loadso = xyes && \
1048 test x$enable_arts_shared = xyes && test x$arts_lib != x; then
1049 echo "-- dynamic libartsc -> $arts_lib"
1050 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ARTS_DYNAMIC, "$arts_lib", [ ])
1051 SUMMARY_audio="${SUMMARY_audio} arts(dynamic)"
1053 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS"
1054 SUMMARY_audio="${SUMMARY_audio} arts"
1062 dnl See if the NAS audio interface is supported
1066 AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]),
1068 if test x$enable_audio = xyes -a x$enable_nas = xyes; then
1069 AC_CHECK_HEADER(audio/audiolib.h, have_nas_hdr=yes)
1070 AC_CHECK_LIB(audio, AuOpenServer, have_nas_lib=yes)
1072 AC_MSG_CHECKING(for NAS audio support)
1075 if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then
1079 elif test -r /usr/X11R6/include/audio/audiolib.h; then
1081 NAS_CFLAGS="-I/usr/X11R6/include/"
1082 NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt"
1086 AC_MSG_RESULT($have_nas)
1088 if test x$have_nas = xyes; then
1089 AC_ARG_ENABLE(nas-shared,
1090 AC_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[default=yes]]]),
1091 , enable_nas_shared=yes)
1092 nas_lib=[`find_lib "libaudio.so.*" "$NAS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
1094 if test x$have_loadso != xyes && \
1095 test x$enable_nas_shared = xyes; then
1096 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic NAS loading])
1098 if test x$have_loadso = xyes && \
1099 test x$enable_nas_shared = xyes && test x$nas_lib != x; then
1100 echo "-- dynamic libaudio -> $nas_lib"
1101 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_NAS_DYNAMIC, "$nas_lib", [ ])
1102 SUMMARY_audio="${SUMMARY_audio} nas(dynamic)"
1104 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS"
1105 SUMMARY_audio="${SUMMARY_audio} nas"
1108 AC_DEFINE(SDL_AUDIO_DRIVER_NAS, 1, [ ])
1109 SOURCES="$SOURCES $srcdir/src/audio/nas/*.c"
1110 EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS"
1116 dnl See if the sndio audio interface is supported
1119 AC_ARG_ENABLE(sndio,
1120 AC_HELP_STRING([--enable-sndio], [support the sndio audio API [[default=yes]]]),
1122 if test x$enable_audio = xyes -a x$enable_sndio = xyes; then
1123 AC_CHECK_HEADER(sndio.h, have_sndio_hdr=yes)
1124 AC_CHECK_LIB(sndio, sio_open, have_sndio_lib=yes)
1126 AC_MSG_CHECKING(for sndio audio support)
1129 if test x$have_sndio_hdr = xyes -a x$have_sndio_lib = xyes; then
1131 SNDIO_LIBS="-lsndio"
1134 AC_MSG_RESULT($have_sndio)
1136 if test x$have_sndio = xyes; then
1137 AC_ARG_ENABLE(sndio-shared,
1138 AC_HELP_STRING([--enable-sndio-shared], [dynamically load sndio audio support [[default=yes]]]),
1139 , enable_sndio_shared=yes)
1140 sndio_lib=[`find_lib "libsndio.so.*" "$SNDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
1142 if test x$have_loadso != xyes && \
1143 test x$enable_sndio_shared = xyes; then
1144 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic sndio loading])
1146 if test x$have_loadso = xyes && \
1147 test x$enable_sndio_shared = xyes && test x$sndio_lib != x; then
1148 echo "-- dynamic libsndio -> $sndio_lib"
1149 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC, "$sndio_lib", [ ])
1150 SUMMARY_audio="${SUMMARY_audio} sndio(dynamic)"
1152 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SNDIO_LIBS"
1153 SUMMARY_audio="${SUMMARY_audio} sndio"
1156 AC_DEFINE(SDL_AUDIO_DRIVER_SNDIO, 1, [ ])
1157 SOURCES="$SOURCES $srcdir/src/audio/sndio/*.c"
1158 EXTRA_CFLAGS="$EXTRA_CFLAGS $SNDIO_CFLAGS"
1164 dnl Find FusionSound
1167 AC_ARG_ENABLE(fusionsound,
1168 AC_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]),
1169 , enable_fusionsound=no)
1170 if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then
1173 FUSIONSOUND_REQUIRED_VERSION=1.1.1
1175 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1176 AC_MSG_CHECKING(for FusionSound $FUSIONSOUND_REQUIRED_VERSION support)
1177 if test x$PKG_CONFIG != xno; then
1178 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then
1179 FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound`
1180 FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound`
1184 AC_MSG_RESULT($fusionsound)
1186 if test x$fusionsound = xyes; then
1187 AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND, 1, [ ])
1188 SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c"
1189 EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS"
1191 AC_ARG_ENABLE(fusionsound-shared,
1192 AC_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]),
1193 , enable_fusionsound_shared=yes)
1194 fusionsound_shared=no
1195 AC_MSG_CHECKING(for FusionSound dynamic loading support)
1196 if test x$have_loadso != xyes && \
1197 test x$enable_fusionsound_shared = xyes; then
1198 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading])
1200 if test x$have_loadso = xyes && \
1201 test x$enable_fusionsound_shared = xyes; then
1202 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so", [ ])
1203 fusionsound_shared=yes
1204 SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)"
1206 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS"
1207 SUMMARY_audio="${SUMMARY_audio} fusionsound"
1209 AC_MSG_RESULT($fusionsound_shared)
1216 dnl rcg07142001 See if the user wants the disk writer audio driver...
1219 AC_ARG_ENABLE(diskaudio,
1220 AC_HELP_STRING([--enable-diskaudio], [support the disk writer audio driver [[default=yes]]]),
1221 , enable_diskaudio=yes)
1222 if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
1223 AC_DEFINE(SDL_AUDIO_DRIVER_DISK, 1, [ ])
1224 SOURCES="$SOURCES $srcdir/src/audio/disk/*.c"
1225 SUMMARY_audio="${SUMMARY_audio} disk"
1229 dnl rcg03142006 See if the user wants the dummy audio driver...
1232 AC_ARG_ENABLE(dummyaudio,
1233 AC_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [[default=yes]]]),
1234 , enable_dummyaudio=yes)
1235 if test x$enable_audio = xyes -a x$enable_dummyaudio = xyes; then
1236 AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY, 1, [ ])
1237 SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c"
1238 SUMMARY_audio="${SUMMARY_audio} dummy"
1242 dnl See if libsamplerate is available
1243 CheckLibSampleRate()
1245 AC_ARG_ENABLE(libsamplerate,
1246 AC_HELP_STRING([--enable-libsamplerate], [use libsamplerate for audio rate conversion [[default=yes]]]),
1247 , enable_libsamplerate=yes)
1248 if test x$enable_libsamplerate = xyes; then
1249 AC_CHECK_HEADER(samplerate.h,
1250 have_samplerate_h_hdr=yes,
1251 have_samplerate_h_hdr=no)
1252 if test x$have_samplerate_h_hdr = xyes; then
1253 AC_DEFINE(HAVE_LIBSAMPLERATE_H, 1, [ ])
1255 AC_ARG_ENABLE(libsamplerate-shared,
1256 AC_HELP_STRING([--enable-libsamplerate-shared], [dynamically load libsamplerate [[default=yes]]]),
1257 , enable_libsamplerate_shared=yes)
1259 samplerate_lib=[`find_lib "libsamplerate.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`]
1261 if test x$have_loadso != xyes && \
1262 test x$enable_libsamplerate_shared = xyes; then
1263 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic libsamplerate loading])
1265 if test x$have_loadso = xyes && \
1266 test x$enable_libsamplerate_shared = xyes && test x$samplerate_lib != x; then
1267 echo "-- dynamic libsamplerate -> $samplerate_lib"
1268 AC_DEFINE_UNQUOTED(SDL_LIBSAMPLERATE_DYNAMIC, "$samplerate_lib", [ ])
1270 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lsamplerate"
1276 dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
1277 dnl Details of this flag are here: http://gcc.gnu.org/wiki/Visibility
1278 CheckVisibilityHidden()
1280 AC_MSG_CHECKING(for GCC -fvisibility=hidden option)
1281 have_gcc_fvisibility=no
1283 visibility_CFLAGS="-fvisibility=hidden"
1284 save_CFLAGS="$CFLAGS"
1285 CFLAGS="$save_CFLAGS $visibility_CFLAGS -Werror"
1287 #if !defined(__GNUC__) || __GNUC__ < 4
1288 #error SDL only uses visibility attributes in GCC 4 or newer
1292 have_gcc_fvisibility=yes
1294 AC_MSG_RESULT($have_gcc_fvisibility)
1295 CFLAGS="$save_CFLAGS"
1297 if test x$have_gcc_fvisibility = xyes; then
1298 EXTRA_CFLAGS="$EXTRA_CFLAGS $visibility_CFLAGS"
1302 dnl See if GCC's -mpreferred-stack-boundary is supported.
1303 dnl Reference: http://bugzilla.libsdl.org/show_bug.cgi?id=1296
1304 CheckStackBoundary()
1306 AC_MSG_CHECKING(for GCC -mpreferred-stack-boundary option)
1307 have_gcc_preferred_stack_boundary=no
1309 save_CFLAGS="$CFLAGS"
1310 CFLAGS="$save_CFLAGS -mpreferred-stack-boundary=2"
1315 have_gcc_preferred_stack_boundary=yes
1317 AC_MSG_RESULT($have_gcc_preferred_stack_boundary)
1318 CFLAGS="$save_CFLAGS"
1320 if test x$have_gcc_preferred_stack_boundary = xyes; then
1321 EXTRA_CFLAGS="$EXTRA_CFLAGS -mpreferred-stack-boundary=2"
1325 dnl See if GCC's -Wdeclaration-after-statement is supported.
1326 dnl This lets us catch things that would fail on a C89 compiler when using
1328 CheckDeclarationAfterStatement()
1330 AC_MSG_CHECKING(for GCC -Wdeclaration-after-statement option)
1331 have_gcc_declaration_after_statement=no
1333 save_CFLAGS="$CFLAGS"
1334 CFLAGS="$save_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement"
1339 have_gcc_declaration_after_statement=yes
1341 AC_MSG_RESULT($have_gcc_declaration_after_statement)
1342 CFLAGS="$save_CFLAGS"
1344 if test x$have_gcc_declaration_after_statement = xyes; then
1345 EXTRA_CFLAGS="$EXTRA_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement"
1349 dnl See if GCC's -Wall is supported.
1352 AC_MSG_CHECKING(for GCC -Wall option)
1355 save_CFLAGS="$CFLAGS"
1356 CFLAGS="$save_CFLAGS -Wall"
1363 AC_MSG_RESULT($have_gcc_Wall)
1364 CFLAGS="$save_CFLAGS"
1366 if test x$have_gcc_Wall = xyes; then
1367 EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall"
1369 dnl Haiku headers use multicharacter constants all over the place. Ignore these warnings when using -Wall.
1370 AC_MSG_CHECKING(for necessary GCC -Wno-multichar option)
1371 need_gcc_Wno_multichar=no
1374 need_gcc_Wno_multichar=yes
1377 AC_MSG_RESULT($need_gcc_Wno_multichar)
1378 if test x$need_gcc_Wno_multichar = xyes; then
1379 EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-multichar"
1384 dnl Check for Wayland
1387 AC_ARG_ENABLE(video-wayland,
1388 AC_HELP_STRING([--enable-video-wayland], [use Wayland video driver [[default=yes]]]),
1389 ,enable_video_wayland=yes)
1391 AC_ARG_ENABLE(video-wayland-qt-touch,
1392 AC_HELP_STRING([--enable-video-wayland-qt-touch], [QtWayland server support for Wayland video driver [[default=yes]]]),
1393 ,enable_video_wayland_qt_touch=yes)
1395 if test x$enable_video = xyes -a x$enable_video_wayland = xyes; then
1396 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1397 AC_MSG_CHECKING(for Wayland support)
1399 if test x$PKG_CONFIG != xno && \
1400 test x$video_opengl_egl = xyes && \
1401 test x$video_opengles_v2 = xyes; then
1402 if $PKG_CONFIG --exists wayland-client wayland-scanner wayland-protocols wayland-egl wayland-cursor egl xkbcommon ; then
1403 WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon`
1404 WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon`
1405 WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner`
1409 AC_MSG_RESULT($video_wayland)
1411 if test x$video_wayland = xyes; then
1412 AC_DEFINE(SDL_VIDEO_DRIVER_WAYLAND, 1, [ ])
1413 if test x$enable_video_wayland_qt_touch = xyes; then
1414 AC_DEFINE(SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH, 1, [ ])
1417 SOURCES="$SOURCES $srcdir/src/video/wayland/*.c"
1418 EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS -I\$(gen)"
1419 AC_ARG_ENABLE(wayland-shared,
1420 AC_HELP_STRING([--enable-wayland-shared], [dynamically load Wayland support [[default=maybe]]]),
1421 , enable_wayland_shared=maybe)
1423 dnl FIXME: Do BSD and OS X need special cases?
1426 wayland_client_lib=[`find_lib "libwayland-client.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
1427 wayland_egl_lib=[`find_lib "libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
1428 if test x$wayland_egl_lib = x; then
1429 dnl This works in Ubuntu 13.10, maybe others
1430 wayland_egl_lib=[`find_lib "mesa-egl/libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
1432 wayland_cursor_lib=[`find_lib "libwayland-cursor.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
1433 xkbcommon_lib=[`find_lib "libxkbcommon.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
1437 if test x$enable_wayland_shared = xmaybe; then
1438 enable_wayland_shared=yes
1440 if test x$have_loadso != xyes && \
1441 test x$enable_wayland_shared = xyes; then
1442 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic Wayland loading])
1443 enable_wayland_shared=no
1445 if test x$have_loadso = xyes && \
1446 test x$enable_wayland_shared = xyes && \
1447 test x$wayland_client_lib != x && \
1448 test x$wayland_egl_lib != x && \
1449 test x$wayland_cursor_lib != x && \
1450 test x$xkbcommon_lib != x; then
1451 echo "-- dynamic libwayland-client -> $wayland_client_lib"
1452 echo "-- dynamic libwayland-egl -> $wayland_egl_lib"
1453 echo "-- dynamic libwayland-cursor -> $wayland_cursor_lib"
1454 echo "-- dynamic libxkbcommon -> $xkbcommon_lib"
1455 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC, "$wayland_client_lib", [ ])
1456 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL, "$wayland_egl_lib", [ ])
1457 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR, "$wayland_cursor_lib", [ ])
1458 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON, "$xkbcommon_lib", [ ])
1459 SUMMARY_video="${SUMMARY_video} wayland(dynamic)"
1461 enable_wayland_shared=no
1462 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $WAYLAND_LIBS"
1463 SUMMARY_video="${SUMMARY_video} wayland"
1473 AC_ARG_ENABLE(video-mir,
1474 AC_HELP_STRING([--enable-video-mir], [use Mir video driver [[default=no]]]),
1475 ,enable_video_mir=no)
1477 if test x$enable_video = xyes -a x$enable_video_mir = xyes; then
1478 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1479 AC_MSG_CHECKING(for Mir support)
1481 if test x$PKG_CONFIG != xno; then
1482 if $PKG_CONFIG --exists mirclient egl xkbcommon ; then
1483 MIR_CFLAGS=`$PKG_CONFIG --cflags mirclient egl xkbcommon`
1484 MIR_LIBS=`$PKG_CONFIG --libs mirclient egl xkbcommon`
1485 save_CFLAGS="$CFLAGS"
1486 CFLAGS="$save_CFLAGS $MIR_CFLAGS"
1488 dnl This will disable Mir if >= v0.26 is not available
1490 #include <mir_toolkit/mir_client_library.h>
1492 MirWindowAttrib attrib = mir_window_attrib_state
1496 CFLAGS="$save_CFLAGS"
1499 AC_MSG_RESULT($video_mir)
1501 if test x$video_mir = xyes; then
1502 AC_DEFINE(SDL_VIDEO_DRIVER_MIR, 1, [ ])
1503 SOURCES="$SOURCES $srcdir/src/video/mir/*.c"
1504 EXTRA_CFLAGS="$EXTRA_CFLAGS $MIR_CFLAGS"
1505 AC_ARG_ENABLE(mir-shared,
1506 AC_HELP_STRING([--enable-mir-shared], [dynamically load Mir support [[default=maybe]]]),
1507 , enable_mir_shared=maybe)
1509 dnl FIXME: Do BSD and OS X need special cases?
1512 mirclient_lib=[`find_lib "libmirclient.so.*" "$MIR_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
1513 xkbcommon_lib=[`find_lib "libxkbcommon.so.*" "$MIR_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
1517 if test x$enable_mir_shared = xmaybe; then
1518 enable_mir_shared=yes
1520 if test x$have_loadso != xyes && \
1521 test x$enable_mir_shared = xyes; then
1522 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic Mir loading])
1523 enable_mir_shared=no
1525 if test x$have_loadso = xyes && \
1526 test x$enable_mir_shared = xyes && \
1527 test x$mirclient_lib != x && \
1528 test x$xkbcommon_lib != x; then
1529 echo "-- dynamic libmirclient -> $mirclient_lib"
1530 echo "-- dynamic libxkbcommon -> $xkbcommon_lib"
1531 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_MIR_DYNAMIC, "$mirclient_lib", [ ])
1532 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON, "$xkbcommon_lib", [ ])
1533 SUMMARY_video="${SUMMARY_video} mir(dynamic)"
1535 enable_mir_shared=no
1536 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MIR_LIBS"
1537 SUMMARY_video="${SUMMARY_video} mir"
1544 dnl Check for Native Client stuff
1548 #if !defined(__native_client__)
1553 AC_DEFINE(SDL_VIDEO_DRIVER_NACL, 1, [ ])
1554 AC_DEFINE(SDL_AUDIO_DRIVER_NACL, 1, [ ])
1555 AC_DEFINE(HAVE_POW, 1, [ ])
1556 AC_DEFINE(HAVE_OPENGLES2, 1, [ ])
1557 AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
1558 AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
1560 SDL_LIBS="-lppapi_simple -lppapi_gles2 $SDL_LIBS"
1562 SDLMAIN_SOURCES="$srcdir/src/main/nacl/*.c"
1563 SOURCES="$SOURCES $srcdir/src/audio/nacl/*.c"
1564 SUMMARY_audio="${SUMMARY_audio} nacl"
1565 SOURCES="$SOURCES $srcdir/src/video/nacl/*.c"
1566 SUMMARY_video="${SUMMARY_video} nacl opengles2"
1573 AC_ARG_ENABLE(video-rpi,
1574 AC_HELP_STRING([--enable-video-rpi], [use Raspberry Pi video driver [[default=yes]]]),
1575 , enable_video_rpi=yes)
1576 if test x$enable_video = xyes -a x$enable_video_rpi = xyes; then
1577 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1578 if test x$PKG_CONFIG != xno && $PKG_CONFIG --exists bcm_host; then
1579 RPI_CFLAGS=`$PKG_CONFIG --cflags bcm_host brcmegl`
1580 RPI_LDFLAGS=`$PKG_CONFIG --libs bcm_host brcmegl`
1581 elif test x$ARCH = xnetbsd; then
1582 RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux"
1583 RPI_LDFLAGS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host"
1585 RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
1586 RPI_LDFLAGS="-Wl,-rpath,/opt/vc/lib -L/opt/vc/lib -lbcm_host"
1589 # Save the original compiler flags and libraries
1590 ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
1592 # Add the Raspberry Pi compiler flags and libraries
1593 CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_LDFLAGS"
1595 AC_MSG_CHECKING(for Raspberry Pi)
1598 #include <bcm_host.h>
1605 AC_MSG_RESULT($have_video_rpi)
1607 # Restore the compiler flags and libraries
1608 CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
1610 if test x$have_video_rpi = xyes; then
1611 CFLAGS="$CFLAGS $RPI_CFLAGS"
1612 SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
1613 EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
1614 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LDFLAGS"
1615 SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
1616 AC_DEFINE(SDL_VIDEO_DRIVER_RPI, 1, [ ])
1617 SUMMARY_video="${SUMMARY_video} rpi"
1622 dnl Find the X11 include and library directories
1625 AC_ARG_ENABLE(video-x11,
1626 AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]),
1627 , enable_video_x11=yes)
1628 if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
1631 # This isn't necessary for X11, but fixes GLX detection
1632 if test "x$x_includes" = xNONE && \
1633 test "x$x_libraries" = xNONE && \
1634 test -d /usr/X11R6/include && \
1635 test -d /usr/X11R6/lib; then
1636 x_includes="/usr/X11R6/include"
1637 x_libraries="/usr/X11R6/lib"
1643 if test x$have_x = xyes; then
1644 AC_ARG_ENABLE(x11-shared,
1645 AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=maybe]]]),
1646 , enable_x11_shared=maybe)
1650 x11_lib='/usr/X11R6/lib/libX11.6.dylib'
1651 x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
1652 xcursor_lib='/usr/X11R6/lib/libXcursor.1.dylib'
1653 xinerama_lib='/usr/X11R6/lib/libXinerama.1.dylib'
1654 xinput_lib='/usr/X11R6/lib/libXi.6.dylib'
1655 xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
1656 xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
1657 xss_lib='/usr/X11R6/lib/libXss.1.dylib'
1658 xvidmode_lib='/usr/X11R6/lib/libXxf86vm.1.dylib'
1662 x11ext_lib='libXext.so'
1663 xcursor_lib='libXcursor.so'
1664 xinerama_lib='libXinerama.so'
1665 xinput_lib='libXi.so'
1666 xrandr_lib='libXrandr.so'
1667 xrender_lib='libXrender.so'
1669 xvidmode_lib='libXxf86vm.so'
1672 x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1673 x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1674 xcursor_lib=[`find_lib "libXcursor.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1675 xinerama_lib=[`find_lib "libXinerama.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1676 xinput_lib=[`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1677 xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1678 xrender_lib=[`find_lib "libXrender.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1679 xss_lib=[`find_lib "libXss.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1680 xvidmode_lib=[`find_lib "libXxf86vm.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1684 if test x$ac_cv_func_shmat != xyes; then
1685 X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY"
1687 CFLAGS="$CFLAGS $X_CFLAGS"
1688 LDFLAGS="$LDFLAGS $X_LIBS"
1690 AC_CHECK_HEADER(X11/extensions/Xext.h,
1691 have_xext_h_hdr=yes,
1693 [#include <X11/Xlib.h>
1694 #include <X11/Xproto.h>
1696 if test x$have_xext_h_hdr != xyes; then
1698 *** Missing Xext.h, maybe you need to install the libxext-dev package?
1702 AC_DEFINE(SDL_VIDEO_DRIVER_X11, 1, [ ])
1703 SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
1704 EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
1706 # Needed so SDL applications can include SDL_syswm.h
1707 SDL_CFLAGS="$SDL_CFLAGS $X_CFLAGS"
1709 if test x$enable_x11_shared = xmaybe; then
1710 enable_x11_shared=yes
1712 if test x$have_loadso != xyes && \
1713 test x$enable_x11_shared = xyes; then
1714 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic X11 loading])
1715 enable_x11_shared=no
1717 if test x$have_loadso = xyes && \
1718 test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then
1719 echo "-- dynamic libX11 -> $x11_lib"
1720 echo "-- dynamic libX11ext -> $x11ext_lib"
1721 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib", [ ])
1722 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib", [ ])
1723 SUMMARY_video="${SUMMARY_video} x11(dynamic)"
1725 enable_x11_shared=no
1726 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
1727 SUMMARY_video="${SUMMARY_video} x11"
1731 AC_MSG_CHECKING(for const parameter to XextAddDisplay)
1732 have_const_param_XextAddDisplay=no
1734 #include <X11/Xlib.h>
1735 #include <X11/Xproto.h>
1736 #include <X11/extensions/Xext.h>
1737 #include <X11/extensions/extutil.h>
1738 extern XExtDisplayInfo* XextAddDisplay(XExtensionInfo* a,Display* b,_Xconst char* c,XExtensionHooks* d,int e,XPointer f);
1741 have_const_param_XextAddDisplay=yes
1742 AC_DEFINE([SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY], 1, [ ])
1744 AC_MSG_RESULT($have_const_param_XextAddDisplay)
1746 dnl AC_CHECK_LIB(X11, XGetEventData, AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS, 1, [Have XGenericEvent]))
1747 AC_MSG_CHECKING([for XGenericEvent])
1748 have_XGenericEvent=no
1750 #include <X11/Xlib.h>
1754 XGenericEventCookie *cookie = &event.xcookie;
1755 XNextEvent(display, &event);
1756 XGetEventData(display, cookie);
1757 XFreeEventData(display, cookie);
1759 have_XGenericEvent=yes
1760 AC_DEFINE([SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS], 1, [ ])
1762 AC_MSG_RESULT($have_XGenericEvent)
1764 AC_CHECK_LIB(X11, XkbKeycodeToKeysym, AC_DEFINE(SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM, 1, [Have XkbKeycodeToKeysym]))
1766 AC_ARG_ENABLE(video-x11-xcursor,
1767 AC_HELP_STRING([--enable-video-x11-xcursor], [enable X11 Xcursor support [[default=yes]]]),
1768 , enable_video_x11_xcursor=yes)
1769 if test x$enable_video_x11_xcursor = xyes; then
1770 definitely_enable_video_x11_xcursor=no
1771 AC_CHECK_HEADER(X11/Xcursor/Xcursor.h,
1772 have_xcursor_h_hdr=yes,
1773 have_xcursor_h_hdr=no,
1774 [#include <X11/Xlib.h>
1776 if test x$have_xcursor_h_hdr = xyes; then
1777 if test x$enable_x11_shared = xyes && test x$xcursor_lib != x ; then
1778 echo "-- dynamic libXcursor -> $xcursor_lib"
1779 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR, "$xcursor_lib", [ ])
1780 definitely_enable_video_x11_xcursor=yes
1782 AC_CHECK_LIB(Xcursor, XcursorImageCreate, have_xcursor_lib=yes)
1783 if test x$have_xcursor_lib = xyes ; then
1784 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXcursor"
1785 definitely_enable_video_x11_xcursor=yes
1790 if test x$definitely_enable_video_x11_xcursor = xyes; then
1791 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XCURSOR, 1, [ ])
1792 SUMMARY_video_x11="${SUMMARY_video_x11} xcursor"
1794 AC_ARG_ENABLE(video-x11-xdbe,
1795 AC_HELP_STRING([--enable-video-x11-xdbe], [enable X11 Xdbe support [[default=yes]]]),
1796 , enable_video_x11_xdbe=yes)
1797 if test x$enable_video_x11_xdbe = xyes; then
1798 AC_CHECK_HEADER(X11/extensions/Xdbe.h,
1801 [#include <X11/Xlib.h>
1803 if test x$have_dbe_h_hdr = xyes; then
1804 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XDBE, 1, [ ])
1805 SUMMARY_video_x11="${SUMMARY_video_x11} xdbe"
1808 AC_ARG_ENABLE(video-x11-xinerama,
1809 AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]),
1810 , enable_video_x11_xinerama=yes)
1811 if test x$enable_video_x11_xinerama = xyes; then
1812 definitely_enable_video_x11_xinerama=no
1813 AC_CHECK_HEADER(X11/extensions/Xinerama.h,
1814 have_xinerama_h_hdr=yes,
1815 have_xinerama_h_hdr=no,
1816 [#include <X11/Xlib.h>
1818 if test x$have_xinerama_h_hdr = xyes; then
1819 if test x$enable_x11_shared = xyes && test x$xinerama_lib != x ; then
1820 echo "-- dynamic libXinerama -> $xinerama_lib"
1821 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA, "$xinerama_lib", [ ])
1822 definitely_enable_video_x11_xinerama=yes
1824 AC_CHECK_LIB(Xinerama, XineramaQueryExtension, have_xinerama_lib=yes)
1825 if test x$have_xinerama_lib = xyes ; then
1826 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXinerama"
1827 definitely_enable_video_x11_xinerama=yes
1832 if test x$definitely_enable_video_x11_xinerama = xyes; then
1833 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA, 1, [ ])
1834 SUMMARY_video_x11="${SUMMARY_video_x11} xinerama"
1836 AC_ARG_ENABLE(video-x11-xinput,
1837 AC_HELP_STRING([--enable-video-x11-xinput], [enable X11 XInput extension for manymouse, tablets, etc [[default=yes]]]),
1838 , enable_video_x11_xinput=yes)
1839 if test x$enable_video_x11_xinput = xyes; then
1840 definitely_enable_video_x11_xinput=no
1841 AC_CHECK_HEADER(X11/extensions/XInput2.h,
1842 have_xinput_h_hdr=yes,
1843 have_xinput_h_hdr=no,
1844 [#include <X11/Xlib.h>
1846 if test x$have_xinput_h_hdr = xyes; then
1847 if test x$enable_x11_shared = xyes && test x$xinput_lib != x ; then
1848 echo "-- dynamic libXi -> $xinput_lib"
1849 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2, "$xinput_lib", [ ])
1850 definitely_enable_video_x11_xinput=yes
1852 AC_CHECK_LIB(Xi, XOpenDevice, have_xinput_lib=yes)
1853 if test x$have_xinput_lib = xyes ; then
1854 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXi"
1855 definitely_enable_video_x11_xinput=yes
1860 if test x$definitely_enable_video_x11_xinput = xyes; then
1861 SUMMARY_video_x11="${SUMMARY_video_x11} xinput2"
1862 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT2, 1, [ ])
1863 AC_MSG_CHECKING(for xinput2 multitouch)
1864 have_xinput2_multitouch=no
1866 #include <X11/Xlib.h>
1867 #include <X11/Xproto.h>
1868 #include <X11/extensions/XInput2.h>
1870 int event_type = XI_TouchBegin;
1871 XITouchClassInfo *t;
1873 have_xinput2_multitouch=yes
1874 AC_DEFINE([SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH], 1, [])
1875 SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch"
1877 AC_MSG_RESULT($have_xinput2_multitouch)
1879 AC_ARG_ENABLE(video-x11-xrandr,
1880 AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]),
1881 , enable_video_x11_xrandr=yes)
1882 if test x$enable_video_x11_xrandr = xyes; then
1883 dnl XRRScreenResources is only present in Xrandr >= 1.2, we use that as a test.
1884 definitely_enable_video_x11_xrandr=no
1885 have_xrandr_h_hdr=no
1887 #include <X11/Xlib.h>
1888 #include <X11/extensions/Xrandr.h>
1890 XRRScreenResources *res = NULL;
1892 have_xrandr_h_hdr=yes
1894 if test x$have_xrandr_h_hdr = xyes; then
1895 if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then
1896 echo "-- dynamic libXrandr -> $xrandr_lib"
1897 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib", [ ])
1898 definitely_enable_video_x11_xrandr=yes
1900 AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes)
1901 if test x$have_xrandr_lib = xyes ; then
1902 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr"
1903 definitely_enable_video_x11_xrandr=yes
1908 if test x$definitely_enable_video_x11_xrandr = xyes; then
1909 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR, 1, [ ])
1910 SUMMARY_video_x11="${SUMMARY_video_x11} xrandr"
1912 AC_ARG_ENABLE(video-x11-scrnsaver,
1913 AC_HELP_STRING([--enable-video-x11-scrnsaver], [enable X11 screensaver extension [[default=yes]]]),
1914 , enable_video_x11_scrnsaver=yes)
1915 if test x$enable_video_x11_scrnsaver = xyes; then
1916 AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
1917 have_scrnsaver_h_hdr=yes,
1918 have_scrnsaver_h_hdr=no,
1919 [#include <X11/Xlib.h>
1921 if test x$have_scrnsaver_h_hdr = xyes; then
1922 if test x$enable_x11_shared = xyes && test x$xss_lib != x ; then
1923 echo "-- dynamic libXss -> $xss_lib"
1924 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS, "$xss_lib", [ ])
1925 definitely_enable_video_x11_scrnsaver=yes
1927 AC_CHECK_LIB(Xss, XScreenSaverSuspend, have_xss_lib=yes)
1928 if test x$have_xss_lib = xyes ; then
1929 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXss"
1930 definitely_enable_video_x11_scrnsaver=yes
1935 if test x$definitely_enable_video_x11_scrnsaver = xyes; then
1936 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSCRNSAVER, 1, [ ])
1937 SUMMARY_video_x11="${SUMMARY_video_x11} xscrnsaver"
1939 AC_ARG_ENABLE(video-x11-xshape,
1940 AC_HELP_STRING([--enable-video-x11-xshape], [enable X11 XShape support [[default=yes]]]),
1941 , enable_video_x11_xshape=yes)
1942 if test x$enable_video_x11_xshape = xyes; then
1943 AC_CHECK_HEADER(X11/extensions/shape.h,
1944 have_shape_h_hdr=yes,
1945 have_shape_h_hdr=no,
1946 [#include <X11/Xlib.h>
1948 if test x$have_shape_h_hdr = xyes; then
1949 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSHAPE, 1, [ ])
1950 SUMMARY_video_x11="${SUMMARY_video_x11} xshape"
1953 AC_ARG_ENABLE(video-x11-vm,
1954 AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[default=yes]]]),
1955 , enable_video_x11_vm=yes)
1956 if test x$enable_video_x11_vm = xyes; then
1957 definitely_enable_video_x11_vm=no
1958 AC_CHECK_HEADER(X11/extensions/xf86vmode.h,
1961 [#include <X11/Xlib.h>
1963 if test x$have_vm_h_hdr = xyes; then
1964 if test x$enable_x11_shared = xyes && test x$xvidmode_lib != x ; then
1965 echo "-- dynamic libXxf86vm -> $xvidmode_lib"
1966 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE, "$xvidmode_lib", [ ])
1967 definitely_enable_video_x11_vm=yes
1969 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryVersion, have_vm_lib=yes)
1970 if test x$have_vm_lib = xyes ; then
1971 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXxf86vm"
1972 definitely_enable_video_x11_vm=yes
1977 if test x$definitely_enable_video_x11_vm = xyes; then
1978 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XVIDMODE, 1, [ ])
1979 SUMMARY_video_x11="${SUMMARY_video_x11} xvidmode"
1985 dnl Set up the Vivante video driver if enabled
1988 AC_ARG_ENABLE(video-vivante,
1989 AC_HELP_STRING([--enable-video-vivante], [use Vivante EGL video driver [[default=yes]]]),
1990 , enable_video_vivante=yes)
1991 if test x$enable_video = xyes -a x$enable_video_vivante = xyes; then
1992 AC_MSG_CHECKING(for Vivante VDK API)
2000 have_vivante_vdk=yes
2002 AC_MSG_RESULT($have_vivante_vdk)
2004 AC_MSG_CHECKING(for Vivante FB API)
2009 #include <EGL/eglvivante.h>
2012 have_vivante_egl=yes
2014 AC_MSG_RESULT($have_vivante_egl)
2016 if test x$have_vivante_vdk = xyes -o x$have_vivante_egl = xyes; then
2017 AC_DEFINE(SDL_VIDEO_DRIVER_VIVANTE, 1, [ ])
2018 EXTRA_CFLAGS="$EXTRA_CFLAGS -DLINUX -DEGL_API_FB"
2019 if test x$have_vivante_vdk = xyes; then
2020 AC_DEFINE(SDL_VIDEO_DRIVER_VIVANTE_VDK, 1, [ ])
2021 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lVDK"
2023 SOURCES="$SOURCES $srcdir/src/video/vivante/*.c"
2024 SUMMARY_video="${SUMMARY_video} vivante"
2030 dnl Set up the Haiku video driver if enabled
2033 if test x$enable_video = xyes; then
2034 AC_DEFINE(SDL_VIDEO_DRIVER_HAIKU, 1, [ ])
2035 SOURCES="$SOURCES $srcdir/src/video/haiku/*.cc"
2037 SUMMARY_video="${SUMMARY_video} haiku"
2041 dnl Set up the Cocoa video driver for Mac OS X (but not Darwin)
2044 AC_ARG_ENABLE(video-cocoa,
2045 AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]),
2046 , enable_video_cocoa=yes)
2047 if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
2048 save_CFLAGS="$CFLAGS"
2049 dnl Work around that we don't have Objective-C support in autoconf
2050 CFLAGS="$CFLAGS -x objective-c"
2051 AC_MSG_CHECKING(for Cocoa framework)
2054 #import <Cocoa/Cocoa.h>
2059 AC_MSG_RESULT($have_cocoa)
2060 CFLAGS="$save_CFLAGS"
2061 if test x$have_cocoa = xyes; then
2062 AC_DEFINE(SDL_VIDEO_DRIVER_COCOA, 1, [ ])
2063 SOURCES="$SOURCES $srcdir/src/video/cocoa/*.m"
2064 SUMMARY_video="${SUMMARY_video} cocoa"
2072 AC_ARG_ENABLE(render-metal,
2073 AC_HELP_STRING([--enable-render-metal], [enable the Metal render driver [[default=yes]]]),
2074 , enable_render_metal=yes)
2075 if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
2076 save_CFLAGS="$CFLAGS"
2077 dnl Work around that we don't have Objective-C support in autoconf
2078 CFLAGS="$CFLAGS -x objective-c"
2079 AC_MSG_CHECKING(for Metal framework)
2082 #import <Cocoa/Cocoa.h>
2083 #import <Metal/Metal.h>
2084 #import <QuartzCore/CAMetalLayer.h>
2086 #if !TARGET_CPU_X86_64
2087 #error Metal doesn't work on this configuration
2093 CFLAGS="$save_CFLAGS"
2094 AC_MSG_RESULT($have_metal)
2095 if test x$have_metal = xyes; then
2096 AC_DEFINE(SDL_VIDEO_RENDER_METAL, 1, [ ])
2097 SOURCES="$SOURCES $srcdir/src/render/metal/*.m"
2098 SUMMARY_video="${SUMMARY_video} metal"
2100 enable_render_metal=no
2109 AC_ARG_ENABLE(video-directfb,
2110 AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=no]]]),
2111 , enable_video_directfb=no)
2112 if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
2115 DIRECTFB_REQUIRED_VERSION=1.0.0
2116 AC_PATH_PROGS(DIRECTFBCONFIG, directfb-config, no, [$prefix/bin:$PATH])
2117 if test x$DIRECTFBCONFIG = xno; then
2118 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
2119 if test x$PKG_CONFIG != xno; then
2120 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb; then
2121 DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
2122 DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
2123 DIRECTFB_PREFIX=`$PKG_CONFIG --variable=prefix directfb`
2128 set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'`
2129 NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
2130 set -- `$DIRECTFBCONFIG --version | sed 's/\./ /g'`
2131 HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
2132 if test $HAVE_VERSION -ge $NEED_VERSION; then
2133 DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags`
2134 DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs`
2135 DIRECTFB_PREFIX=`$DIRECTFBCONFIG --prefix`
2139 if test x$video_directfb = xyes; then
2140 # SuSE 11.1 installs directfb-config without directfb-devel
2141 save_CPPFLAGS="$CPPFLAGS"
2142 CPPFLAGS="$CPPFLAGS $DIRECTFB_CFLAGS"
2143 AC_CHECK_HEADER(directfb.h, have_directfb_hdr=yes, have_directfb_hdr=no)
2144 CPPFLAGS="$save_CPPFLAGS"
2145 video_directfb=$have_directfb_hdr
2147 AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support)
2148 AC_MSG_RESULT($video_directfb)
2150 if test x$video_directfb = xyes; then
2151 AC_ARG_ENABLE(directfb-shared,
2152 AC_HELP_STRING([--enable-directfb-shared], [dynamically load directfb support [[default=yes]]]),
2153 , enable_directfb_shared=yes)
2155 AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB, 1, [ ])
2156 SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
2157 EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"
2159 AC_MSG_CHECKING(for directfb dynamic loading support)
2161 directfb_lib=[`find_lib "libdirectfb*.so.*" "$DIRECTFB_LIBS"`]
2162 # | sed 's/.*\/\(.*\)/\1/; q'`]
2163 AC_MSG_WARN("directfb $directfb_lib")
2164 if test x$have_loadso != xyes && \
2165 test x$enable_directfb_shared = xyes; then
2166 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic directfb loading])
2168 if test x$have_loadso = xyes && \
2169 test x$enable_directfb_shared = xyes && test x$directfb_lib != x; then
2171 echo "-- $directfb_lib_spec -> $directfb_lib"
2172 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC, "$directfb_lib", [ ])
2173 SUMMARY_video="${SUMMARY_video} directfb(dynamic)"
2175 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
2176 SUMMARY_video="${SUMMARY_video} directfb"
2178 AC_MSG_RESULT($directfb_shared)
2179 SDL_CFLAGS="$SDL_CFLAGS $DIRECTFB_CFLAGS"
2188 AC_ARG_ENABLE(video-kmsdrm,
2189 AC_HELP_STRING([--enable-video-kmsdrm], [use KMSDRM video driver [[default=no]]]),
2190 , enable_video_kmsdrm=no)
2192 if test x$enable_video = xyes -a x$enable_video_kmsdrm = xyes; then
2197 LIBDRM_REQUIRED_VERSION=2.4.46
2198 LIBGBM_REQUIRED_VERSION=9.0.0
2200 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
2201 if test x$PKG_CONFIG != xno; then
2202 if $PKG_CONFIG --atleast-pkgconfig-version 0.7; then
2203 if $PKG_CONFIG --atleast-version $LIBDRM_REQUIRED_VERSION libdrm; then
2204 LIBDRM_CFLAGS=`$PKG_CONFIG --cflags libdrm`
2205 LIBDRM_LIBS=`$PKG_CONFIG --libs libdrm`
2206 LIBDRM_PREFIX=`$PKG_CONFIG --variable=prefix libdrm`
2209 if $PKG_CONFIG --atleast-version $LIBGBM_REQUIRED_VERSION gbm; then
2210 LIBGBM_CFLAGS=`$PKG_CONFIG --cflags gbm`
2211 LIBGBM_LIBS=`$PKG_CONFIG --libs gbm`
2212 LIBGBM_PREFIX=`$PKG_CONFIG --variable=prefix gbm`
2215 if test x$libdrm_avail = xyes -a x$libgbm_avail = xyes; then
2219 AC_MSG_CHECKING(for libdrm $LIBDRM_REQUIRED_VERSION library for kmsdrm support)
2220 AC_MSG_RESULT($libdrm_avail)
2221 AC_MSG_CHECKING(for libgbm $LIBGBM_REQUIRED_VERSION library for kmsdrm support)
2222 AC_MSG_RESULT($libgbm_avail)
2224 if test x$video_kmsdrm = xyes; then
2225 AC_ARG_ENABLE(kmsdrm-shared,
2226 AC_HELP_STRING([--enable-kmsdrm-shared], [dynamically load kmsdrm support [[default=yes]]]),
2227 , enable_kmsdrm_shared=yes)
2229 AC_DEFINE(SDL_VIDEO_DRIVER_KMSDRM, 1, [ ])
2230 SOURCES="$SOURCES $srcdir/src/video/kmsdrm/*.c"
2231 EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBDRM_CFLAGS $LIBGBM_CFLAGS"
2233 AC_MSG_CHECKING(for kmsdrm dynamic loading support)
2235 drm_lib=[`find_lib "libdrm.so.*" "$DRM_LIBS"`]
2236 gbm_lib=[`find_lib "libgbm.so.*" "$DRM_LIBS"`]
2237 if test x$have_loadso != xyes && \
2238 test x$enable_kmsdrm_shared = xyes; then
2239 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic kmsdrm loading])
2241 if test x$have_loadso = xyes && \
2242 test x$enable_kmsdrm_shared = xyes && test x$drm_lib != x && test x$gbm_lib != x; then
2244 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC, "$drm_lib", [ ])
2245 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM, "$gbm_lib", [ ])
2246 AC_DEFINE_UNQUOTED(HAVE_KMSDRM_SHARED, "TRUE", [ ])
2247 SUMMARY_video="${SUMMARY_video} kmsdrm(dynamic)"
2249 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBDRM_LIBS $LIBGBM_LIBS"
2250 SUMMARY_video="${SUMMARY_video} kmsdrm"
2252 AC_MSG_RESULT($kmsdrm_shared)
2260 dnl rcg04172001 Set up the Null video driver.
2263 AC_ARG_ENABLE(video-dummy,
2264 AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]),
2265 , enable_video_dummy=yes)
2266 if test x$enable_video_dummy = xyes; then
2267 AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY, 1, [ ])
2268 SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
2270 SUMMARY_video="${SUMMARY_video} dummy"
2274 dnl Set up the QNX video driver if enabled
2277 if test x$enable_video = xyes; then
2278 AC_DEFINE(SDL_VIDEO_DRIVER_QNX, 1, [ ])
2279 SOURCES="$SOURCES $srcdir/src/video/qnx/*.c"
2281 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lscreen -lEGL -lGLESv2"
2282 SUMMARY_video="${SUMMARY_video} qnx"
2286 dnl Set up the QNX audio driver if enabled
2289 if test x$enable_audio = xyes; then
2290 AC_DEFINE(SDL_AUDIO_DRIVER_QSA, 1, [ ])
2291 SOURCES="$SOURCES $srcdir/src/audio/qsa/*.c"
2293 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound"
2294 SUMMARY_audio="${SUMMARY_audio} qsa"
2298 dnl Check to see if OpenGL support is desired
2299 AC_ARG_ENABLE(video-opengl,
2300 AC_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]),
2301 , enable_video_opengl=yes)
2306 if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
2307 AC_MSG_CHECKING(for OpenGL (GLX) support)
2316 AC_MSG_RESULT($video_opengl)
2317 if test x$video_opengl = xyes; then
2318 AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
2319 AC_DEFINE(SDL_VIDEO_OPENGL_GLX, 1, [ ])
2320 AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
2321 SUMMARY_video="${SUMMARY_video} opengl"
2326 dnl Check to see if OpenGL ES support is desired
2327 AC_ARG_ENABLE(video-opengles,
2328 AC_HELP_STRING([--enable-video-opengles], [include OpenGL ES support [[default=yes]]]),
2329 , enable_video_opengles=yes)
2330 AC_ARG_ENABLE(video-opengles1,
2331 AC_HELP_STRING([--enable-video-opengles1], [include OpenGL ES 1.1 support [[default=yes]]]),
2332 , enable_video_opengles1=yes)
2333 AC_ARG_ENABLE(video-opengles2,
2334 AC_HELP_STRING([--enable-video-opengles2], [include OpenGL ES 2.0 support [[default=yes]]]),
2335 , enable_video_opengles2=yes)
2340 if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
2341 AC_MSG_CHECKING(for EGL support)
2346 #include <EGL/egl.h>
2347 #include <EGL/eglext.h>
2350 video_opengl_egl=yes
2352 AC_MSG_RESULT($video_opengl_egl)
2353 if test x$video_opengl_egl = xyes; then
2354 AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
2357 if test x$enable_video_opengles1 = xyes; then
2358 AC_MSG_CHECKING(for OpenGL ES v1 headers)
2359 video_opengles_v1=no
2361 #include <GLES/gl.h>
2362 #include <GLES/glext.h>
2365 video_opengles_v1=yes
2367 AC_MSG_RESULT($video_opengles_v1)
2368 if test x$video_opengles_v1 = xyes; then
2369 AC_DEFINE(SDL_VIDEO_OPENGL_ES, 1, [ ])
2370 AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES, 1, [ ])
2371 SUMMARY_video="${SUMMARY_video} opengl_es1"
2375 if test x$enable_video_opengles2 = xyes; then
2376 AC_MSG_CHECKING(for OpenGL ES v2 headers)
2377 video_opengles_v2=no
2379 #include <GLES2/gl2.h>
2380 #include <GLES2/gl2ext.h>
2383 video_opengles_v2=yes
2385 AC_MSG_RESULT($video_opengles_v2)
2386 if test x$video_opengles_v2 = xyes; then
2387 AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
2388 AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
2389 SUMMARY_video="${SUMMARY_video} opengl_es2"
2395 dnl Check for Windows OpenGL
2398 if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
2399 AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
2400 AC_DEFINE(SDL_VIDEO_OPENGL_WGL, 1, [ ])
2401 AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
2402 SUMMARY_video="${SUMMARY_video} opengl"
2406 dnl Check for Windows OpenGL
2409 if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
2411 AC_MSG_CHECKING(for EGL support)
2414 #include <EGL/egl.h>
2417 video_opengl_egl=yes
2419 AC_MSG_RESULT($video_opengl_egl)
2420 if test x$video_opengl_egl = xyes; then
2421 AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
2422 AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
2423 SUMMARY_video="${SUMMARY_video} opengl_es1"
2426 AC_MSG_CHECKING(for OpenGL ES v2 headers)
2427 video_opengles_v2=no
2429 #include <GLES2/gl2.h>
2430 #include <GLES2/gl2ext.h>
2433 video_opengles_v2=yes
2435 AC_MSG_RESULT($video_opengles_v2)
2436 if test x$video_opengles_v2 = xyes; then
2437 AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
2438 AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
2439 AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
2440 SUMMARY_video="${SUMMARY_video} opengl_es2"
2445 dnl Check for Haiku OpenGL
2448 if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
2449 AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
2450 AC_DEFINE(SDL_VIDEO_OPENGL_HAIKU, 1, [ ])
2451 AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
2452 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
2453 SUMMARY_video="${SUMMARY_video} opengl"
2457 dnl Check for MacOS OpenGL
2460 if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
2461 AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
2462 AC_DEFINE(SDL_VIDEO_OPENGL_CGL, 1, [ ])
2463 AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
2464 SUMMARY_video="${SUMMARY_video} opengl"
2468 dnl Check for MacOS OpenGLES
2471 if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
2472 video_opengl_egl=yes
2473 AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
2474 video_opengles_v2=yes
2475 AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
2476 AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
2477 SUMMARY_video="${SUMMARY_video} opengl_es2"
2481 CheckEmscriptenGLES()
2483 if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
2484 AC_MSG_CHECKING(for EGL support)
2487 #include <EGL/egl.h>
2490 video_opengl_egl=yes
2492 AC_MSG_RESULT($video_opengl_egl)
2493 if test x$video_opengl_egl = xyes; then
2494 AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
2497 AC_MSG_CHECKING(for OpenGL ES v2 headers)
2498 video_opengles_v2=no
2500 #include <GLES2/gl2.h>
2501 #include <GLES2/gl2ext.h>
2504 video_opengles_v2=yes
2506 AC_MSG_RESULT($video_opengles_v2)
2507 if test x$video_opengles_v2 = xyes; then
2508 AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
2509 AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
2510 SUMMARY_video="${SUMMARY_video} opengl_es2"
2515 dnl Check to see if Vulkan support is desired
2516 AC_ARG_ENABLE(video-vulkan,
2517 AC_HELP_STRING([--enable-video-vulkan], [include Vulkan support [[default=yes]]]),
2518 , enable_video_vulkan=yes)
2520 dnl Find Vulkan Header
2523 if test x$enable_video = xyes -a x$enable_video_vulkan = xyes; then
2527 #if defined(__ARM_ARCH) && __ARM_ARCH < 7
2528 #error Vulkan doesn't work on this configuration
2533 enable_video_vulkan=no
2537 save_CFLAGS="$CFLAGS"
2538 dnl Work around that we don't have Objective-C support in autoconf
2539 CFLAGS="$CFLAGS -x objective-c"
2541 #include <Cocoa/Cocoa.h>
2542 #include <Metal/Metal.h>
2543 #include <QuartzCore/CAMetalLayer.h>
2545 #if !TARGET_CPU_X86_64
2546 #error Vulkan doesn't work on this configuration
2551 enable_video_vulkan=no
2553 CFLAGS="$save_CFLAGS"
2558 if test x$enable_video_vulkan = xno; then
2559 # For reasons I am totally unable to see, I get an undefined macro error if
2560 # I put this in the AC_TRY_COMPILE.
2561 AC_MSG_WARN([Vulkan does not work on this configuration.])
2564 if test x$enable_video_vulkan = xyes; then
2565 AC_DEFINE(SDL_VIDEO_VULKAN, 1, [ ])
2566 SUMMARY_video="${SUMMARY_video} vulkan"
2570 dnl See if we can use the new unified event interface in Linux 2.4
2573 dnl Check for Linux 2.4 unified input event interface support
2574 AC_MSG_CHECKING(for Linux 2.4 unified input interface)
2577 #include <linux/input.h>
2580 #error EVIOCGNAME() ioctl not available
2583 use_input_events=yes
2585 AC_MSG_RESULT($use_input_events)
2586 if test x$use_input_events = xyes; then
2587 AC_DEFINE(SDL_INPUT_LINUXEV, 1, [ ])
2588 SUMMARY_input="${SUMMARY_input} linuxev"
2592 dnl See if we can use the kernel kd.h header
2596 AC_MSG_CHECKING(for Linux kd.h)
2599 #include <linux/kd.h>
2600 #include <linux/keyboard.h>
2603 kbe.kb_table = KG_CTRL;
2604 ioctl(0, KDGKBENT, &kbe);
2608 AC_MSG_RESULT($use_input_kd)
2609 if test x$use_input_kd = xyes; then
2610 AC_DEFINE(SDL_INPUT_LINUXKD, 1, [ ])
2611 SUMMARY_input="${SUMMARY_input} linuxkd"
2615 dnl See if the platform offers libudev for device enumeration and hotplugging.
2618 AC_ARG_ENABLE(libudev,
2619 AC_HELP_STRING([--enable-libudev], [enable libudev support [[default=yes]]]),
2620 , enable_libudev=yes)
2621 if test x$enable_libudev = xyes; then
2622 AC_CHECK_HEADER(libudev.h,
2623 have_libudev_h_hdr=yes,
2624 have_libudev_h_hdr=no)
2625 if test x$have_libudev_h_hdr = xyes; then
2626 AC_DEFINE(HAVE_LIBUDEV_H, 1, [ ])
2628 udev_lib=[`find_lib "libudev.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`]
2629 if test x$udev_lib != x; then
2630 echo "-- dynamic udev -> $udev_lib"
2631 AC_DEFINE_UNQUOTED(SDL_UDEV_DYNAMIC, "$udev_lib", [ ])
2637 dnl See if the platform offers libdbus for various IPC techniques.
2641 AC_HELP_STRING([--enable-dbus], [enable D-Bus support [[default=yes]]]),
2643 if test x$enable_dbus = xyes; then
2644 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
2645 if test x$PKG_CONFIG != xno; then
2646 DBUS_CFLAGS=`$PKG_CONFIG --cflags dbus-1`
2647 save_CFLAGS="$CFLAGS"
2648 CFLAGS="$save_CFLAGS $DBUS_CFLAGS"
2649 AC_CHECK_HEADER(dbus/dbus.h,
2650 have_dbus_dbus_h_hdr=yes,
2651 have_dbus_dbus_h_hdr=no)
2652 CFLAGS="$save_CFLAGS"
2653 if test x$have_dbus_dbus_h_hdr = xyes; then
2654 AC_DEFINE(HAVE_DBUS_DBUS_H, 1, [ ])
2655 EXTRA_CFLAGS="$EXTRA_CFLAGS $DBUS_CFLAGS"
2656 SOURCES="$SOURCES $srcdir/src/core/linux/SDL_dbus.c"
2662 dnl See if the platform wanna IME support.
2666 AC_HELP_STRING([--enable-ime], [enable IME support [[default=yes]]]),
2668 if test x$enable_ime = xyes; then
2669 AC_DEFINE(SDL_USE_IME, 1, [ ])
2670 SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ime.c"
2674 dnl See if the platform has libibus IME support.
2678 AC_HELP_STRING([--enable-ibus], [enable IBus support [[default=yes]]]),
2680 if test x$enable_ibus = xyes; then
2681 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
2682 if test x$PKG_CONFIG != xno; then
2683 IBUS_CFLAGS=`$PKG_CONFIG --cflags ibus-1.0`
2684 save_CFLAGS="$CFLAGS"
2685 CFLAGS="$save_CFLAGS $IBUS_CFLAGS"
2686 AC_CHECK_HEADER(ibus-1.0/ibus.h,
2687 have_ibus_ibus_h_hdr=yes,
2688 have_ibus_ibus_h_hdr=no)
2689 AC_CHECK_HEADER(sys/inotify.h,
2690 have_inotify_inotify_h_hdr=yes,
2691 have_inotify_inotify_h_hdr=no)
2692 CFLAGS="$save_CFLAGS"
2693 if test x$have_ibus_ibus_h_hdr = xyes; then
2694 if test x$enable_ime != xyes; then
2695 AC_MSG_WARN([IME support is required for IBus.])
2696 have_ibus_ibus_h_hdr=no
2697 elif test x$enable_dbus != xyes; then
2698 AC_MSG_WARN([DBus support is required for IBus.])
2699 have_ibus_ibus_h_hdr=no
2700 elif test x$have_inotify_inotify_h_hdr != xyes; then
2701 AC_MSG_WARN([INotify support is required for IBus.])
2702 have_ibus_ibus_h_hdr=no
2704 AC_DEFINE(HAVE_IBUS_IBUS_H, 1, [ ])
2705 EXTRA_CFLAGS="$EXTRA_CFLAGS $IBUS_CFLAGS"
2706 SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ibus.c"
2713 dnl See if the platform has fcitx IME support.
2716 AC_ARG_ENABLE(fcitx,
2717 AC_HELP_STRING([--enable-fcitx], [enable fcitx support [[default=yes]]]),
2719 if test x$enable_fcitx = xyes; then
2720 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
2721 if test x$PKG_CONFIG != xno; then
2722 FCITX_CFLAGS=`$PKG_CONFIG --cflags fcitx`
2723 CFLAGS="$CFLAGS $FCITX_CFLAGS"
2724 AC_CHECK_HEADER(fcitx/frontend.h,
2725 have_fcitx_frontend_h_hdr=yes,
2726 have_fcitx_frontend_h_hdr=no)
2727 CFLAGS="$save_CFLAGS"
2728 if test x$have_fcitx_frontend_h_hdr = xyes; then
2729 if test x$enable_ime != xyes; then
2730 AC_MSG_WARN([IME support is required for fcitx.])
2731 have_fcitx_frontend_h_hdr=no
2732 elif test x$enable_dbus != xyes; then
2733 AC_MSG_WARN([DBus support is required for fcitx.])
2734 have_fcitx_frontend_h_hdr=no
2736 AC_DEFINE(HAVE_FCITX_FRONTEND_H, 1, [ ])
2737 EXTRA_CFLAGS="$EXTRA_CFLAGS $FCITX_CFLAGS"
2738 SOURCES="$SOURCES $srcdir/src/core/linux/SDL_fcitx.c"
2745 dnl See if we can use the Touchscreen input library
2748 AC_ARG_ENABLE(input-tslib,
2749 AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]),
2750 , enable_input_tslib=yes)
2751 if test x$enable_input_tslib = xyes; then
2752 AC_MSG_CHECKING(for Touchscreen library support)
2753 enable_input_tslib=no
2758 enable_input_tslib=yes
2760 AC_MSG_RESULT($enable_input_tslib)
2761 if test x$enable_input_tslib = xyes; then
2762 AC_DEFINE(SDL_INPUT_TSLIB, 1, [ ])
2763 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
2764 SUMMARY_input="${SUMMARY_input} ts"
2769 dnl See what type of thread model to use on Linux and Solaris
2772 dnl Check for pthread support
2773 AC_ARG_ENABLE(pthreads,
2774 AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]),
2775 , enable_pthreads=yes)
2776 dnl This is used on Linux for glibc binary compatibility (Doh!)
2777 AC_ARG_ENABLE(pthread-sem,
2778 AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
2779 , enable_pthread_sem=yes)
2782 pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
2785 *-*-linux*|*-*-uclinux*)
2786 pthread_cflags="-D_REENTRANT"
2787 pthread_lib="-lpthread"
2790 pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
2794 pthread_cflags="-D_THREAD_SAFE"
2795 # causes Carbon.p complaints?
2796 # pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
2798 *-*-freebsd*|*-*-dragonfly*)
2799 pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
2800 pthread_lib="-pthread"
2803 pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
2804 pthread_lib="-lpthread"
2807 pthread_cflags="-D_REENTRANT"
2808 pthread_lib="-pthread"
2811 # From Solaris 9+, posix4's preferred name is rt.
2812 pthread_cflags="-D_REENTRANT"
2813 pthread_lib="-lpthread -lrt"
2816 # Solaris 10+ merged pthread into libc.
2817 pthread_cflags="-D_REENTRANT"
2821 # Solaris 11+ merged rt into libc.
2822 pthread_cflags="-D_REENTRANT"
2826 pthread_cflags="-D_REENTRANT -Kthread"
2830 pthread_cflags="-D_REENTRANT -mthreads"
2831 pthread_lib="-lpthread"
2834 pthread_cflags="-D_REENTRANT"
2835 pthread_lib="-L/usr/lib -lpthread"
2838 pthread_cflags="-D_REENTRANT"
2842 pthread_cflags="-D_REENTRANT"
2846 pthread_cflags="-D_REENTRANT"
2847 pthread_lib="-lpthread"
2850 if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
2851 # Save the original compiler flags and libraries
2852 ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
2853 # Add the pthread compiler flags and libraries
2854 CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
2855 # Check to see if we have pthread support on this system
2856 AC_MSG_CHECKING(for pthreads)
2859 #include <pthread.h>
2861 pthread_attr_t type;
2862 pthread_attr_init(&type);
2866 AC_MSG_RESULT($use_pthreads)
2867 # Restore the compiler flags and libraries
2868 CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
2870 # Do futher testing if we have pthread support...
2871 if test x$use_pthreads = xyes; then
2872 AC_DEFINE(SDL_THREAD_PTHREAD, 1, [ ])
2873 EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
2874 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
2875 SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
2877 # Save the original compiler flags and libraries
2878 ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
2879 # Add the pthread compiler flags and libraries
2880 CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
2882 # Check to see if recursive mutexes are available
2883 AC_MSG_CHECKING(for recursive mutexes)
2884 has_recursive_mutexes=no
2885 if test x$has_recursive_mutexes = xno; then
2887 #define _GNU_SOURCE 1
2888 #include <pthread.h>
2890 pthread_mutexattr_t attr;
2891 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
2893 has_recursive_mutexes=yes
2894 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX, 1, [ ])
2897 if test x$has_recursive_mutexes = xno; then
2899 #define _GNU_SOURCE 1
2900 #include <pthread.h>
2902 pthread_mutexattr_t attr;
2903 pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
2905 has_recursive_mutexes=yes
2906 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP, 1, [ ])
2909 AC_MSG_RESULT($has_recursive_mutexes)
2911 # Check to see if pthread semaphore support is missing
2912 if test x$enable_pthread_sem = xyes; then
2913 AC_MSG_CHECKING(for pthread semaphores)
2916 #include <pthread.h>
2917 #include <semaphore.h>
2920 have_pthread_sem=yes
2922 AC_MSG_RESULT($have_pthread_sem)
2924 if test x$have_pthread_sem = xyes; then
2925 AC_MSG_CHECKING(for sem_timedwait)
2926 have_sem_timedwait=no
2928 #include <pthread.h>
2929 #include <semaphore.h>
2931 sem_timedwait(NULL, NULL);
2933 have_sem_timedwait=yes
2934 AC_DEFINE([HAVE_SEM_TIMEDWAIT], 1, [ ])
2936 AC_MSG_RESULT($have_sem_timedwait)
2939 AC_CHECK_HEADER(pthread_np.h, have_pthread_np_h=yes, have_pthread_np_h=no, [ #include <pthread.h> ])
2940 if test x$have_pthread_np_h = xyes; then
2941 AC_DEFINE(HAVE_PTHREAD_NP_H, 1, [ ])
2944 # Check to see if pthread naming is available
2945 AC_MSG_CHECKING(for pthread_setname_np)
2946 AC_TRY_LINK_FUNC(pthread_setname_np, [
2947 has_pthread_setname_np=yes
2948 AC_DEFINE(HAVE_PTHREAD_SETNAME_NP, 1, [ ])
2950 has_pthread_setname_np=no
2952 AC_MSG_RESULT($has_pthread_setname_np)
2954 AC_MSG_CHECKING(for pthread_set_name_np)
2955 AC_TRY_LINK_FUNC(pthread_set_name_np, [
2956 has_pthread_set_name_np=yes
2957 AC_DEFINE(HAVE_PTHREAD_SET_NAME_NP, 1, [ ])
2959 has_pthread_set_name_np=no
2961 AC_MSG_RESULT($has_pthread_set_name_np)
2963 # Restore the compiler flags and libraries
2964 CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
2966 # Basic thread creation functions
2967 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
2970 # We can fake these with mutexes and condition variables if necessary
2971 if test x$have_pthread_sem = xyes; then
2972 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
2974 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
2978 # We can fake these with semaphores if necessary
2979 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
2981 # Condition variables
2982 # We can fake these with semaphores and mutexes if necessary
2983 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
2985 # Thread local storage
2986 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systls.c"
2993 dnl Determine whether the compiler can produce Windows executables
2996 AC_MSG_CHECKING(Windows compiler)
2999 #include <windows.h>
3004 AC_MSG_RESULT($have_win32_gcc)
3005 if test x$have_win32_gcc != xyes; then
3007 *** Your compiler ($CC) does not produce Windows executables!
3011 AC_MSG_CHECKING(Windows CE)
3014 #if !defined(_WIN32_WCE) && !defined(__MINGW32CE__)
3015 #error This is not Windows CE
3021 *** Sorry, Windows CE is no longer supported.
3024 AC_MSG_RESULT($have_wince)
3026 # This fixes Windows stack alignment with newer GCC
3030 dnl Find the DirectX includes and libraries
3033 AC_ARG_ENABLE(directx,
3034 AC_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[default=yes]]]),
3035 , enable_directx=yes)
3036 if test x$enable_directx = xyes; then
3037 AC_CHECK_HEADER(d3d9.h, have_d3d=yes)
3038 AC_CHECK_HEADER(d3d11_1.h, have_d3d11=yes)
3039 AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
3040 AC_CHECK_HEADER(dsound.h, have_dsound=yes)
3041 AC_CHECK_HEADER(dinput.h, have_dinput=yes)
3042 AC_CHECK_HEADER(dxgi.h, have_dxgi=yes)
3043 AC_CHECK_HEADER(xinput.h, have_xinput=yes)
3044 AC_CHECK_HEADER(mmdeviceapi.h, have_wasapi=yes)
3045 AC_CHECK_HEADER(audioclient.h,,have_wasapi=no)
3047 #include <windows.h>
3049 XINPUT_GAMEPAD_EX x1;
3050 ],[],[have_xinput_gamepadex=yes])
3052 #include <windows.h>
3055 ],[],[have_xinput_stateex=yes])
3057 if test x$have_ddraw = xyes; then
3058 AC_DEFINE(HAVE_DDRAW_H, 1, [ ])
3060 if test x$have_dinput = xyes; then
3061 AC_DEFINE(HAVE_DINPUT_H, 1, [ ])
3063 if test x$have_dsound = xyes; then
3064 AC_DEFINE(HAVE_DSOUND_H, 1, [ ])
3066 if test x$have_dxgi = xyes; then
3067 AC_DEFINE(HAVE_DXGI_H, 1, [ ])
3069 if test x$have_xinput = xyes; then
3070 AC_DEFINE(HAVE_XINPUT_H, 1, [ ])
3072 if test x$have_xinput_gamepadex = xyes; then
3073 AC_DEFINE(HAVE_XINPUT_GAMEPAD_EX, 1, [ ])
3075 if test x$have_xinput_stateex = xyes; then
3076 AC_DEFINE(HAVE_XINPUT_STATE_EX, 1, [ ])
3079 SUMMARY_video="${SUMMARY_video} directx"
3080 SUMMARY_audio="${SUMMARY_audio} directx"
3082 AC_ARG_ENABLE(audio-wasapi,
3083 AC_HELP_STRING([--enable-audio-wasapi], [use the Windows WASAPI audio driver [[default=yes]]]),
3084 , enable_audio_wasapi=yes)
3086 # FIXME: latest Cygwin finds dinput headers, but we die on other win32 headers.
3087 # FIXME: ...so force it off for now.
3096 dnl Check for the dlfcn.h interface for dynamically loading objects
3099 AC_ARG_ENABLE(sdl-dlopen,
3100 AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]),
3101 , enable_sdl_dlopen=yes)
3102 if test x$enable_sdl_dlopen = xyes; then
3103 AC_MSG_CHECKING(for dlopen)
3108 void *handle = dlopen("", RTLD_NOW);
3109 const char *loaderror = (char *) dlerror();
3113 AC_MSG_RESULT($have_dlopen)
3115 if test x$have_dlopen = xyes; then
3116 AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
3117 AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
3118 AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
3119 AC_DEFINE(SDL_LOADSO_DLOPEN, 1, [ ])
3120 SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
3126 dnl Check for the usbhid(3) library on *BSD
3131 if test x$enable_joystick = xyes; then
3132 AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
3133 if test x$have_libusbhid = xyes; then
3134 AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
3135 AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
3136 USB_LIBS="$USB_LIBS -lusbhid"
3138 AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
3139 AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
3140 AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
3143 save_CFLAGS="$CFLAGS"
3144 CFLAGS="$CFLAGS $USB_CFLAGS"
3146 AC_MSG_CHECKING(for usbhid)
3149 #include <sys/types.h>
3150 #if defined(HAVE_USB_H)
3153 #ifdef __DragonFly__
3154 # include <bus/usb/usb.h>
3155 # include <bus/usb/usbhid.h>
3157 # include <dev/usb/usb.h>
3158 # include <dev/usb/usbhid.h>
3160 #if defined(HAVE_USBHID_H)
3162 #elif defined(HAVE_LIBUSB_H)
3164 #elif defined(HAVE_LIBUSBHID_H)
3165 #include <libusbhid.h>
3168 struct report_desc *repdesc;
3169 struct usb_ctl_report *repbuf;
3174 AC_MSG_RESULT($have_usbhid)
3176 if test x$have_usbhid = xyes; then
3177 AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
3178 have_usbhid_ucr_data=no
3180 #include <sys/types.h>
3181 #if defined(HAVE_USB_H)
3184 #ifdef __DragonFly__
3185 # include <bus/usb/usb.h>
3186 # include <bus/usb/usbhid.h>
3188 # include <dev/usb/usb.h>
3189 # include <dev/usb/usbhid.h>
3191 #if defined(HAVE_USBHID_H)
3193 #elif defined(HAVE_LIBUSB_H)
3195 #elif defined(HAVE_LIBUSBHID_H)
3196 #include <libusbhid.h>
3199 struct usb_ctl_report buf;
3200 if (buf.ucr_data) { }
3202 have_usbhid_ucr_data=yes
3204 if test x$have_usbhid_ucr_data = xyes; then
3205 USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
3207 AC_MSG_RESULT($have_usbhid_ucr_data)
3209 AC_MSG_CHECKING(for new usbhid API)
3212 #include <sys/types.h>
3213 #if defined(HAVE_USB_H)
3216 #ifdef __DragonFly__
3217 #include <bus/usb/usb.h>
3218 #include <bus/usb/usbhid.h>
3220 #include <dev/usb/usb.h>
3221 #include <dev/usb/usbhid.h>
3223 #if defined(HAVE_USBHID_H)
3225 #elif defined(HAVE_LIBUSB_H)
3227 #elif defined(HAVE_LIBUSBHID_H)
3228 #include <libusbhid.h>
3232 hid_start_parse(d, 1, 1);
3236 if test x$have_usbhid_new = xyes; then
3237 USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
3239 AC_MSG_RESULT($have_usbhid_new)
3241 AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
3242 have_machine_joystick=no
3244 #include <machine/joystick.h>
3248 have_machine_joystick=yes
3250 if test x$have_machine_joystick = xyes; then
3251 AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H, 1, [ ])
3253 AC_MSG_RESULT($have_machine_joystick)
3255 AC_DEFINE(SDL_JOYSTICK_USBHID, 1, [ ])
3256 SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
3257 EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
3258 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
3261 CFLAGS="$save_CFLAGS"
3267 dnl Check for clock_gettime()
3270 AC_ARG_ENABLE(clock_gettime,
3271 AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=yes]]]),
3272 , enable_clock_gettime=yes)
3273 if test x$enable_clock_gettime = xyes; then
3274 AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
3275 if test x$have_clock_gettime = xyes; then
3276 AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ])
3277 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
3279 AC_CHECK_LIB(c, clock_gettime, have_clock_gettime=yes)
3280 if test x$have_clock_gettime = xyes; then
3281 AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ])
3282 EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
3288 dnl Check for a valid linux/version.h
3291 AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
3292 if test x$have_linux_version_h = xyes; then
3293 EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
3297 dnl Check if we want to use RPATH
3300 AC_ARG_ENABLE(rpath,
3301 AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]),
3305 dnl Do this on all platforms, before everything else (other things might want to override it).
3308 dnl Set up the configuration based on the host platform!
3310 *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*|*-*-nto*)
3315 ANDROID_CFLAGS="-DGL_GLEXT_PROTOTYPES"
3316 CFLAGS="$CFLAGS $ANDROID_CFLAGS"
3317 SDL_CFLAGS="$SDL_CFLAGS $ANDROID_CFLAGS"
3318 EXTRA_CFLAGS="$EXTRA_CFLAGS $ANDROID_CFLAGS"
3319 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl -lGLESv1_CM -lGLESv2 -llog -landroid"
3320 SDLMAIN_SOURCES="$srcdir/src/main/android/*.c"
3322 if test x$enable_video = xyes; then
3323 SOURCES="$SOURCES $srcdir/src/core/android/*.c $srcdir/src/video/android/*.c"
3324 # FIXME: confdefs? Not AC_DEFINE?
3325 $as_echo "#define SDL_VIDEO_DRIVER_ANDROID 1" >>confdefs.h
3326 SUMMARY_video="${SUMMARY_video} android"
3329 *-*-linux*) ARCH=linux ;;
3330 *-*-uclinux*) ARCH=linux ;;
3331 *-*-kfreebsd*-gnu) ARCH=kfreebsd-gnu ;;
3332 *-*-knetbsd*-gnu) ARCH=knetbsd-gnu ;;
3333 *-*-kopenbsd*-gnu) ARCH=kopenbsd-gnu ;;
3334 *-*-gnu*) ARCH=gnu ;; # must be last of the gnu variants
3335 *-*-bsdi*) ARCH=bsdi ;;
3336 *-*-freebsd*) ARCH=freebsd ;;
3337 *-*-dragonfly*) ARCH=freebsd ;;
3338 *-*-netbsd*) ARCH=netbsd ;;
3339 *-*-openbsd*) ARCH=openbsd ;;
3340 *-*-sysv5*) ARCH=sysv5 ;;
3341 *-*-solaris*) ARCH=solaris ;;
3342 *-*-hpux*) ARCH=hpux ;;
3343 *-*-aix*) ARCH=aix ;;
3344 *-*-minix*) ARCH=minix ;;
3349 CheckVisibilityHidden
3350 CheckDeclarationAfterStatement
3365 # Need to check for Raspberry PI first and add platform specific compiler flags, otherwise the test for GLES fails!
3394 # Set up files for the audio library
3395 if test x$enable_audio = xyes; then
3398 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO, 1, [ ])
3399 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
3400 SUMMARY_audio="${SUMMARY_audio} sun"
3403 netbsd) # Don't use this on OpenBSD, it's busted.
3404 AC_DEFINE(SDL_AUDIO_DRIVER_NETBSD, 1, [ ])
3405 SOURCES="$SOURCES $srcdir/src/audio/netbsd/*.c"
3406 SUMMARY_audio="${SUMMARY_audio} netbsd"
3410 AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO, 1, [ ])
3411 SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
3412 SUMMARY_audio="${SUMMARY_audio} paudio"
3416 AC_DEFINE(SDL_AUDIO_DRIVER_ANDROID, 1, [ ])
3417 SOURCES="$SOURCES $srcdir/src/audio/android/*.c"
3418 SUMMARY_audio="${SUMMARY_audio} android"
3426 # Set up files for the joystick library
3427 if test x$enable_joystick = xyes; then
3430 AC_DEFINE(SDL_JOYSTICK_LINUX, 1, [ ])
3431 SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
3432 SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c"
3436 AC_DEFINE(SDL_JOYSTICK_ANDROID, 1, [ ])
3437 SOURCES="$SOURCES $srcdir/src/joystick/android/*.c"
3438 SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c"
3443 # Set up files for the haptic library
3444 if test x$enable_haptic = xyes; then
3447 if test x$use_input_events = xyes; then
3448 AC_DEFINE(SDL_HAPTIC_LINUX, 1, [ ])
3449 SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c"
3454 AC_DEFINE(SDL_HAPTIC_ANDROID, 1, [ ])
3455 SOURCES="$SOURCES $srcdir/src/haptic/android/*.c"
3460 # Set up files for the power library
3461 if test x$enable_power = xyes; then
3464 AC_DEFINE(SDL_POWER_LINUX, 1, [ ])
3465 SOURCES="$SOURCES $srcdir/src/power/linux/*.c"
3469 AC_DEFINE(SDL_POWER_ANDROID, 1, [ ])
3470 SOURCES="$SOURCES $srcdir/src/power/android/*.c"
3475 # Set up files for the filesystem library
3476 if test x$enable_filesystem = xyes; then
3479 AC_DEFINE(SDL_FILESYSTEM_ANDROID, 1, [ ])
3480 SOURCES="$SOURCES $srcdir/src/filesystem/android/*.c"
3484 AC_DEFINE(SDL_FILESYSTEM_UNIX, 1, [ ])
3485 SOURCES="$SOURCES $srcdir/src/filesystem/unix/*.c"
3490 # Set up files for the timer library
3491 if test x$enable_timers = xyes; then
3492 AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
3493 SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
3496 # Set up files for udev hotplugging support
3497 if test x$enable_libudev = xyes && test x$have_libudev_h_hdr = xyes; then
3498 SOURCES="$SOURCES $srcdir/src/core/linux/SDL_udev.c"
3500 # Set up files for evdev input
3501 if test x$use_input_events = xyes; then
3502 SOURCES="$SOURCES $srcdir/src/core/linux/SDL_evdev*.c"
3504 # Set up other core UNIX files
3505 SOURCES="$SOURCES $srcdir/src/core/unix/*.c"
3507 *-*-cygwin* | *-*-mingw32*)
3509 if test "$build" != "$host"; then # cross-compiling
3510 # Default cross-compile location
3511 ac_default_prefix=/usr/local/cross-tools/$host
3513 # Look for the location of the tools and install there
3514 if test "$BUILD_PREFIX" != ""; then
3515 ac_default_prefix=$BUILD_PREFIX
3518 CheckDeclarationAfterStatement
3528 # Set up the core platform files
3529 SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
3531 # Set up files for the video library
3532 if test x$enable_video = xyes; then
3533 AC_DEFINE(SDL_VIDEO_DRIVER_WINDOWS, 1, [ ])
3534 SOURCES="$SOURCES $srcdir/src/video/windows/*.c"
3536 AC_ARG_ENABLE(render-d3d,
3537 AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
3538 , enable_render_d3d=yes)
3539 if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
3540 AC_DEFINE(SDL_VIDEO_RENDER_D3D, 1, [ ])
3542 if test x$enable_render_d3d = xyes -a x$have_d3d11 = xyes; then
3543 AC_DEFINE(SDL_VIDEO_RENDER_D3D11, 1, [ ])
3546 # Set up files for the audio library
3547 if test x$enable_audio = xyes; then
3548 AC_DEFINE(SDL_AUDIO_DRIVER_WINMM, 1, [ ])
3549 SOURCES="$SOURCES $srcdir/src/audio/winmm/*.c"
3550 if test x$have_dsound = xyes; then
3551 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND, 1, [ ])
3552 SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c"
3554 if test x$have_wasapi = xyes -a x$enable_audio_wasapi = xyes; then
3555 AC_DEFINE(SDL_AUDIO_DRIVER_WASAPI, 1, [ ])
3556 SUMMARY_audio="${SUMMARY_audio} wasapi"
3557 SOURCES="$SOURCES $srcdir/src/audio/wasapi/*.c"
3561 # Set up files for the joystick library
3562 if test x$enable_joystick = xyes; then
3563 if test x$have_dinput = xyes -o x$have_xinput = xyes; then
3564 if test x$have_xinput = xyes; then
3565 AC_DEFINE(SDL_JOYSTICK_XINPUT, 1, [ ])
3567 if test x$have_dinput = xyes; then
3568 AC_DEFINE(SDL_JOYSTICK_DINPUT, 1, [ ])
3569 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8"
3572 AC_DEFINE(SDL_JOYSTICK_WINMM, 1, [ ])
3574 SOURCES="$SOURCES $srcdir/src/joystick/windows/*.c"
3577 if test x$enable_haptic = xyes; then
3578 if test x$have_dinput = xyes -o x$have_xinput = xyes; then
3579 if test x$have_xinput = xyes; then
3580 AC_DEFINE(SDL_HAPTIC_XINPUT, 1, [ ])
3582 if test x$have_dinput = xyes; then
3583 AC_DEFINE(SDL_HAPTIC_DINPUT, 1, [ ])
3585 SOURCES="$SOURCES $srcdir/src/haptic/windows/*.c"
3589 if test x$enable_power = xyes; then
3590 AC_DEFINE(SDL_POWER_WINDOWS, 1, [ ])
3591 SOURCES="$SOURCES $srcdir/src/power/windows/SDL_syspower.c"
3594 if test x$enable_filesystem = xyes; then
3595 AC_DEFINE(SDL_FILESYSTEM_WINDOWS, 1, [ ])
3596 SOURCES="$SOURCES $srcdir/src/filesystem/windows/SDL_sysfilesystem.c"
3599 # Set up files for the thread library
3600 if test x$enable_threads = xyes; then
3601 AC_DEFINE(SDL_THREAD_WINDOWS, 1, [ ])
3602 SOURCES="$SOURCES $srcdir/src/thread/windows/*.c"
3603 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
3606 # Set up files for the timer library
3607 if test x$enable_timers = xyes; then
3608 AC_DEFINE(SDL_TIMER_WINDOWS, 1, [ ])
3609 SOURCES="$SOURCES $srcdir/src/timer/windows/*.c"
3612 # Set up files for the shared object loading library
3613 if test x$enable_loadso = xyes; then
3614 AC_DEFINE(SDL_LOADSO_WINDOWS, 1, [ ])
3615 SOURCES="$SOURCES $srcdir/src/loadso/windows/*.c"
3618 # Set up the system libraries we need
3619 if test -f /lib/w32api/libuuid.a; then
3620 LIBUUID=/lib/w32api/libuuid.a
3624 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion $LIBUUID -static-libgcc"
3625 # The Windows platform requires special setup
3626 VERSION_SOURCES="$srcdir/src/main/windows/*.rc"
3627 SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c"
3628 SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
3629 SDL_LIBS="-lSDL2main $SDL_LIBS -mwindows"
3631 # Check to see if this is a mingw or cygwin build
3633 AC_CHECK_LIB(mingw32, main, [have_mingw32=yes])
3634 if test x$have_mingw32 = xyes; then
3635 SDL_LIBS="-lmingw32 $SDL_LIBS"
3637 SDL_LIBS="-lcygwin $SDL_LIBS"
3641 dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan.
3644 *** BeOS support has been removed as of SDL 2.0.2.
3650 ac_default_prefix=/boot/system
3659 # Set up files for the audio library
3660 if test x$enable_audio = xyes; then
3661 AC_DEFINE(SDL_AUDIO_DRIVER_HAIKU, 1, [ ])
3662 SOURCES="$SOURCES $srcdir/src/audio/haiku/*.cc"
3663 SUMMARY_audio="${SUMMARY_audio} haiku"
3666 # Set up files for the joystick library
3667 if test x$enable_joystick = xyes; then
3668 AC_DEFINE(SDL_JOYSTICK_HAIKU, 1, [ ])
3669 SOURCES="$SOURCES $srcdir/src/joystick/haiku/*.cc"
3672 # Set up files for the timer library
3673 if test x$enable_timers = xyes; then
3674 AC_DEFINE(SDL_TIMER_HAIKU, 1, [ ])
3675 SOURCES="$SOURCES $srcdir/src/timer/haiku/*.c"
3678 # Set up files for the system power library
3679 if test x$enable_power = xyes; then
3680 AC_DEFINE(SDL_POWER_HAIKU, 1, [ ])
3681 SOURCES="$SOURCES $srcdir/src/power/haiku/*.c"
3684 # Set up files for the system filesystem library
3685 if test x$enable_filesystem = xyes; then
3686 AC_DEFINE(SDL_FILESYSTEM_HAIKU, 1, [ ])
3687 SOURCES="$SOURCES $srcdir/src/filesystem/haiku/*.cc"
3690 # The Haiku platform requires special setup.
3691 SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES"
3692 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
3693 # Haiku's x86 spins use libstdc++.r4.so (for binary compat?), but
3694 # other spins, like x86-64, use a more standard "libstdc++.so.*"
3695 AC_CHECK_FILE("/boot/system/lib/libstdc++.r4.so", EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lstdc++.r4", EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lstdc++")
3697 arm*-apple-darwin*|*-ios-*)
3700 CheckVisibilityHidden
3701 CheckDeclarationAfterStatement
3710 # Set up files for the audio library
3711 if test x$enable_audio = xyes; then
3712 AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ])
3713 SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m"
3714 SUMMARY_audio="${SUMMARY_audio} coreaudio"
3717 # Set up files for the joystick library
3718 if test x$enable_joystick = xyes; then
3719 AC_DEFINE(SDL_JOYSTICK_MFI, 1, [ ])
3720 SOURCES="$SOURCES $srcdir/src/joystick/iphoneos/*.m"
3721 SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c"
3724 # Set up files for the haptic library
3725 #if test x$enable_haptic = xyes; then
3726 # SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
3728 # EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
3730 # Set up files for the power library
3731 if test x$enable_power = xyes; then
3732 AC_DEFINE(SDL_POWER_UIKIT, 1, [ ])
3733 SOURCES="$SOURCES $srcdir/src/power/uikit/*.m"
3736 # Set up files for the filesystem library
3737 if test x$enable_filesystem = xyes; then
3738 SOURCES="$SOURCES $srcdir/src/filesystem/cocoa/*.m"
3741 # Set up additional files for the file library
3742 if test x$enable_file = xyes; then
3743 AC_DEFINE(SDL_FILESYSTEM_COCOA, 1, [ ])
3744 SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
3746 # Set up files for the timer library
3747 if test x$enable_timers = xyes; then
3748 AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
3749 SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
3752 # Set up other core UNIX files
3753 SOURCES="$SOURCES $srcdir/src/core/unix/*.c"
3754 # The iOS platform requires special setup.
3755 AC_DEFINE(SDL_VIDEO_DRIVER_UIKIT, 1, [ ])
3756 AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
3757 AC_DEFINE(SDL_VIDEO_OPENGL_ES, 1, [ ])
3758 AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES, 1, [ ])
3759 AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
3760 SOURCES="$SOURCES $srcdir/src/video/uikit/*.m"
3761 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc"
3762 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AVFoundation"
3763 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox"
3764 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio"
3765 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreGraphics"
3766 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreMotion"
3767 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Foundation"
3768 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,GameController"
3769 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGLES"
3770 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore"
3771 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit"
3773 if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
3774 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Metal"
3778 # This could be either full "Mac OS X", or plain "Darwin" which is
3779 # just the OS X kernel sans upper layers like Carbon and Cocoa.
3780 # Next line is broken, and a few files below require Mac OS X (full)
3783 # Mac OS X builds with both the Carbon and OSX APIs at the moment
3784 EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
3785 EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
3787 CheckVisibilityHidden
3788 CheckDeclarationAfterStatement
3802 # Set up files for the audio library
3803 if test x$enable_audio = xyes; then
3804 AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ])
3805 SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m"
3806 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox"
3807 SUMMARY_audio="${SUMMARY_audio} coreaudio"
3810 # Set up files for the joystick library
3811 if test x$enable_joystick = xyes; then
3812 AC_DEFINE(SDL_JOYSTICK_IOKIT, 1, [ ])
3813 SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
3816 # Set up files for the haptic library
3817 if test x$enable_haptic = xyes; then
3818 AC_DEFINE(SDL_HAPTIC_IOKIT, 1, [ ])
3819 SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
3820 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
3823 # Set up files for the power library
3824 if test x$enable_power = xyes; then
3825 AC_DEFINE(SDL_POWER_MACOSX, 1, [ ])
3826 SOURCES="$SOURCES $srcdir/src/power/macosx/*.c"
3829 # Set up files for the filesystem library
3830 if test x$enable_filesystem = xyes; then
3831 AC_DEFINE(SDL_FILESYSTEM_COCOA, 1, [ ])
3832 SOURCES="$SOURCES $srcdir/src/filesystem/cocoa/*.m"
3835 # Set up files for the timer library
3836 if test x$enable_timers = xyes; then
3837 AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
3838 SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
3841 # Set up additional files for the file library
3842 if test x$enable_file = xyes; then
3843 SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
3845 # Set up other core UNIX files
3846 SOURCES="$SOURCES $srcdir/src/core/unix/*.c"
3847 # The Mac OS X platform requires special setup.
3848 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc"
3849 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreVideo"
3850 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
3851 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
3852 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
3854 if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
3855 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-weak_framework,QuartzCore -Wl,-weak_framework,Metal"
3866 # Set up files for the timer library
3867 if test x$enable_timers = xyes; then
3868 AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
3869 SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
3873 if test x$enable_filesystem = xyes; then
3874 AC_DEFINE(SDL_FILESYSTEM_NACL, 1, [ ])
3875 SOURCES="$SOURCES $srcdir/src/filesystem/nacl/*.c"
3880 if test x$enable_video = xyes; then
3881 AC_DEFINE(SDL_VIDEO_DRIVER_EMSCRIPTEN, 1, [ ])
3882 SOURCES="$SOURCES $srcdir/src/video/emscripten/*.c"
3884 SUMMARY_video="${SUMMARY_video} emscripten"
3887 if test x$enable_audio = xyes; then
3888 AC_DEFINE(SDL_AUDIO_DRIVER_EMSCRIPTEN, 1, [ ])
3889 SOURCES="$SOURCES $srcdir/src/audio/emscripten/*.c"
3891 SUMMARY_audio="${SUMMARY_audio} emscripten"
3894 CheckVisibilityHidden
3895 CheckDeclarationAfterStatement
3903 # Set up files for the power library
3904 if test x$enable_power = xyes; then
3905 AC_DEFINE(SDL_POWER_EMSCRIPTEN, 1, [ ])
3906 SOURCES="$SOURCES $srcdir/src/power/emscripten/*.c"
3910 # Set up files for the power library
3911 if test x$enable_joystick = xyes; then
3912 AC_DEFINE(SDL_JOYSTICK_EMSCRIPTEN, 1, [ ])
3913 SOURCES="$SOURCES $srcdir/src/joystick/emscripten/*.c"
3917 # Set up files for the filesystem library
3918 if test x$enable_filesystem = xyes; then
3919 AC_DEFINE(SDL_FILESYSTEM_EMSCRIPTEN, 1, [ ])
3920 SOURCES="$SOURCES $srcdir/src/filesystem/emscripten/*.c"
3923 # Set up files for the timer library
3924 if test x$enable_timers = xyes; then
3925 AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
3926 SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
3932 *** Unsupported host: Please add to configure.in
3937 # Verify that we have all the platform specific files we need
3939 if test x$have_joystick != xyes; then
3940 if test x$enable_joystick = xyes; then
3941 AC_DEFINE(SDL_JOYSTICK_DISABLED, 1, [ ])
3943 SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
3945 if test x$have_haptic != xyes; then
3946 if test x$enable_haptic = xyes; then
3947 AC_DEFINE(SDL_HAPTIC_DISABLED, 1, [ ])
3949 SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
3951 if test x$have_threads != xyes; then
3952 if test x$enable_threads = xyes; then
3953 AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ])
3955 SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
3957 if test x$have_timers != xyes; then
3958 if test x$enable_timers = xyes; then
3959 AC_DEFINE(SDL_TIMERS_DISABLED, 1, [ ])
3961 SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
3963 if test x$have_filesystem != xyes; then
3964 if test x$enable_filesystem = xyes; then
3965 AC_DEFINE(SDL_FILESYSTEM_DISABLED, 1, [ ])
3967 SOURCES="$SOURCES $srcdir/src/filesystem/dummy/*.c"
3969 if test x$have_loadso != xyes; then
3970 if test x$enable_loadso = xyes; then
3971 AC_DEFINE(SDL_LOADSO_DISABLED, 1, [ ])
3973 SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
3975 if test x$SDLMAIN_SOURCES = x; then
3976 SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
3978 SDLTEST_SOURCES="$srcdir/src/test/*.c"
3980 if test x$video_wayland = xyes; then
3981 WAYLAND_PROTOCOLS=`cd $srcdir/wayland-protocols ; for p in *.xml ; do echo -n "\$p" |sed 's,\\.xml\$, ,g' ; done`
3982 WAYLAND_PROTOCOLS_SOURCES=`for p in $WAYLAND_PROTOCOLS ; do echo -n "\\$(gen)/\$p-protocol.c " ; done`
3983 WAYLAND_PROTOCOLS_HEADERS=`for p in $WAYLAND_PROTOCOLS ; do echo -n "\\$(gen)/\$p-client-protocol.h " ; done`
3984 GEN_SOURCES="$GEN_SOURCES $WAYLAND_PROTOCOLS_SOURCES"
3985 GEN_HEADERS="$GEN_HEADERS $WAYLAND_PROTOCOLS_HEADERS"
3987 WAYLAND_PROTOCOLS_DEPENDS=`for p in $WAYLAND_PROTOCOLS ; do\
3989 echo "\\$(gen)/\$p-client-protocol.h: \\$(srcdir)/wayland-protocols/\$p.xml" ;\
3990 echo " @\\$(SHELL) \\$(auxdir)/mkinstalldirs \\$(gen)" ;\
3991 echo " \\$(RUN_CMD_GEN)\\$(WAYLAND_SCANNER) client-header \\$< \\$@" ;\
3993 echo "\\$(gen)/\$p-protocol.c: \\$(srcdir)/wayland-protocols/\$p.xml" ;\
3994 echo " @\\$(SHELL) \\$(auxdir)/mkinstalldirs \\$(gen)" ;\
3995 echo " \\$(RUN_CMD_GEN)\\$(WAYLAND_SCANNER) code \\$< \\$@" ;\
3997 echo "\\$(objects)/\$p-protocol.lo: \\$(gen)/\$p-protocol.c \\$(gen)/\$p-client-protocol.h" ;\
3998 echo " \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@" ;\
4002 OBJECTS=`echo $SOURCES`
4003 DEPENDS=`echo $SOURCES | tr ' ' '\n'`
4004 for EXT in asm cc m c S; do
4005 OBJECTS=`echo "$OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.'$EXT',$(objects)/\1.lo,g'`
4006 DEPENDS=`echo "$DEPENDS" | sed "s,^\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.$EXT\\$,\\\\
4007 \\$(objects)/\\2.lo: \\1/\\2.$EXT\\\\
4008 \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
4011 GEN_OBJECTS=`echo "$GEN_SOURCES" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
4013 VERSION_OBJECTS=`echo $VERSION_SOURCES`
4014 VERSION_DEPENDS=`echo $VERSION_SOURCES`
4015 VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
4016 VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.rc,\\\\
4017 \\$(objects)/\\2.o: \\1/\\2.rc\\\\
4018 \\$(WINDRES) \\$< \\$@,g"`
4020 SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES`
4021 SDLMAIN_DEPENDS=`echo $SDLMAIN_SOURCES`
4022 SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
4023 SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
4024 \\$(objects)/\\2.lo: \\1/\\2.c\\\\
4025 \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
4027 SDLTEST_OBJECTS=`echo $SDLTEST_SOURCES`
4028 SDLTEST_DEPENDS=`echo $SDLTEST_SOURCES`
4029 SDLTEST_OBJECTS=`echo "$SDLTEST_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
4030 SDLTEST_DEPENDS=`echo "$SDLTEST_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
4031 \\$(objects)/\\2.lo: \\1/\\2.c\\\\
4032 \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
4034 # Set runtime shared library paths as needed
4036 if test "x$enable_rpath" = "xyes"; then
4037 if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then
4038 SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
4040 AC_MSG_CHECKING(for linker option --enable-new-dtags)
4041 have_enable_new_dtags=no
4042 save_LDFLAGS="$LDFLAGS"
4043 LDFLAGS="$LDFLAGS -Wl,--enable-new-dtags"
4047 have_enable_new_dtags=yes
4048 SDL_RLD_FLAGS="$SDL_RLD_FLAGS -Wl,--enable-new-dtags"
4050 LDFLAGS="$save_LDFLAGS"
4051 AC_MSG_RESULT($have_enable_new_dtags)
4053 if test $ARCH = solaris; then
4054 SDL_RLD_FLAGS="-R\${libdir}"
4060 SDL_STATIC_LIBS="$SDL_LIBS $EXTRA_LDFLAGS"
4062 dnl Expand the cflags and libraries needed by apps using SDL
4063 AC_SUBST(SDL_CFLAGS)
4065 AC_SUBST(SDL_STATIC_LIBS)
4066 AC_SUBST(SDL_RLD_FLAGS)
4067 if test x$enable_shared = xyes; then
4069 ENABLE_SHARED_FALSE="#"
4071 ENABLE_SHARED_TRUE="#"
4072 ENABLE_SHARED_FALSE=
4074 if test x$enable_static = xyes; then
4076 ENABLE_STATIC_FALSE="#"
4078 ENABLE_STATIC_TRUE="#"
4079 ENABLE_STATIC_FALSE=
4081 AC_SUBST(ENABLE_SHARED_TRUE)
4082 AC_SUBST(ENABLE_SHARED_FALSE)
4083 AC_SUBST(ENABLE_STATIC_TRUE)
4084 AC_SUBST(ENABLE_STATIC_FALSE)
4086 dnl Expand the sources and objects needed to build the library
4087 AC_SUBST(ac_aux_dir)
4090 AC_SUBST(GEN_HEADERS)
4091 AC_SUBST(GEN_OBJECTS)
4092 AC_SUBST(VERSION_OBJECTS)
4093 AC_SUBST(SDLMAIN_OBJECTS)
4094 AC_SUBST(SDLTEST_OBJECTS)
4095 AC_SUBST(BUILD_CFLAGS)
4096 AC_SUBST(EXTRA_CFLAGS)
4097 AC_SUBST(BUILD_LDFLAGS)
4098 AC_SUBST(EXTRA_LDFLAGS)
4100 AC_SUBST(WAYLAND_SCANNER)
4102 cat >Makefile.rules <<__EOF__
4104 # Build rules for objects
4105 -include \$(OBJECTS:.lo=.d)
4107 # Special dependency for SDL.c, since it depends on SDL_revision.h
4108 $srcdir/src/SDL.c: update-revision
4113 $WAYLAND_PROTOCOLS_DEPENDS
4117 Makefile:Makefile.in:Makefile.rules sdl2-config sdl2-config.cmake SDL2.spec sdl2.pc
4119 AC_CONFIG_COMMANDS([sdl2_config],[chmod a+x sdl2-config])
4121 SUMMARY="SDL2 Configure Summary:\n"
4122 if test x$enable_shared = xyes; then
4123 SUMMARY="${SUMMARY}Building Shared Libraries\n"
4125 if test x$enable_static = xyes; then
4126 SUMMARY="${SUMMARY}Building Static Libraries\n"
4128 SUMMARY="${SUMMARY}Enabled modules :${SUMMARY_modules}\n"
4129 SUMMARY="${SUMMARY}Assembly Math :${SUMMARY_math}\n"
4130 SUMMARY="${SUMMARY}Audio drivers :${SUMMARY_audio}\n"
4131 SUMMARY="${SUMMARY}Video drivers :${SUMMARY_video}\n"
4132 if test x$have_x = xyes; then
4133 SUMMARY="${SUMMARY}X11 libraries :${SUMMARY_video_x11}\n"
4135 SUMMARY="${SUMMARY}Input drivers :${SUMMARY_input}\n"
4136 if test x$have_samplerate_h_hdr = xyes; then
4137 SUMMARY="${SUMMARY}Using libsamplerate : YES\n"
4139 SUMMARY="${SUMMARY}Using libsamplerate : NO\n"
4141 if test x$have_libudev_h_hdr = xyes; then
4142 SUMMARY="${SUMMARY}Using libudev : YES\n"
4144 SUMMARY="${SUMMARY}Using libudev : NO\n"
4146 if test x$have_dbus_dbus_h_hdr = xyes; then
4147 SUMMARY="${SUMMARY}Using dbus : YES\n"
4149 SUMMARY="${SUMMARY}Using dbus : NO\n"
4151 if test x$enable_ime = xyes; then
4152 SUMMARY="${SUMMARY}Using ime : YES\n"
4154 SUMMARY="${SUMMARY}Using ime : NO\n"
4156 if test x$have_ibus_ibus_h_hdr = xyes; then
4157 SUMMARY="${SUMMARY}Using ibus : YES\n"
4159 SUMMARY="${SUMMARY}Using ibus : NO\n"
4161 if test x$have_fcitx_frontend_h_hdr = xyes; then
4162 SUMMARY="${SUMMARY}Using fcitx : YES\n"
4164 SUMMARY="${SUMMARY}Using fcitx : NO\n"
4166 AC_CONFIG_COMMANDS([summary], [echo -en "$SUMMARY"], [SUMMARY="$SUMMARY"])