Corrected indentation of license.
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 Set up the compiler and linker flags
61 INCLUDE="-I$srcdir/include"
62 if test x$srcdir != x.; then
63 INCLUDE="-Iinclude $INCLUDE"
64 elif test -d .hg; then
66 *** When building from Mercurial you should configure and build in a
67 separate directory so you don't clobber SDL_config.h, SDL_revision.h
72 # We build SDL on cygwin without the UNIX emulation layer
73 BASE_CFLAGS="-I/usr/include/mingw -mno-cygwin"
74 BASE_LDFLAGS="-mno-cygwin"
81 # Uncomment the following line if you want to force SDL and applications
82 # built with it to be compiled for a particular architecture.
83 #AX_GCC_ARCHFLAG([no], [BASE_CFLAGS="$BASE_CFLAGS $ax_cv_gcc_archflag]")
84 BUILD_CFLAGS="$CFLAGS $CPPFLAGS -DUSING_GENERATED_CONFIG_H"
85 # The default optimization for SDL is -O3 (Bug #31)
86 if test "x$orig_CFLAGS" = x; then
87 BUILD_CFLAGS=`echo $BUILD_CFLAGS | sed 's/-O2/-O3/'`
89 EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS"
90 BUILD_LDFLAGS="$LDFLAGS"
91 EXTRA_LDFLAGS="$BASE_LDFLAGS"
92 ## These are common directories to find software packages
93 #for path in /usr/freeware /usr/pkg /usr/X11R6 /usr/local; do
94 # if test -d $path/include; then
95 # EXTRA_CFLAGS="$EXTRA_CFLAGS -I$path/include"
97 # if test -d $path/lib; then
98 # EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$path/lib"
101 SDL_CFLAGS="$BASE_CFLAGS"
102 SDL_LIBS="-lSDL2 $BASE_LDFLAGS"
103 CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS"
104 CFLAGS="$CFLAGS $EXTRA_CFLAGS"
105 LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
107 dnl set this to use on systems that use lib64 instead of lib
108 base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
110 dnl Function to find a library in the compiler search path
113 gcc_bin_path=[`$CC -print-search-dirs 2>/dev/null | fgrep programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
114 gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
115 env_lib_path=[`echo $LIBS $LDFLAGS $* | sed 's/-L[ ]*//g'`]
116 if test "$cross_compiling" = yes; then
119 host_lib_path="/usr/$base_libdir /usr/local/$base_libdir"
121 for path in $gcc_bin_path $gcc_lib_path $env_lib_path $host_lib_path; do
122 lib=[`ls -- $path/$1 2>/dev/null | sort | sed 's/.*\/\(.*\)/\1/; q'`]
123 if test x$lib != x; then
130 dnl Check for compiler characteristics
135 dnl See whether we want assertions for debugging/sanity checking SDL itself.
136 AC_ARG_ENABLE(assertions,
137 AC_HELP_STRING([--enable-assertions],
138 [Enable internal sanity checks (auto/disabled/release/enabled/paranoid) [[default=auto]]]),
139 , enable_assertions=auto)
140 case "$enable_assertions" in
141 auto) # Use optimization settings to determine assertion level
144 AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 0, [ ])
147 AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 1, [ ])
150 AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 2, [ ])
153 AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 3, [ ])
156 AC_MSG_ERROR([*** unknown assertion level. stop.])
160 dnl See whether we can use gcc style dependency tracking
161 AC_ARG_ENABLE(dependency-tracking,
162 AC_HELP_STRING([--enable-dependency-tracking],
163 [Use gcc -MMD -MT dependency tracking [[default=yes]]]),
164 , enable_dependency_tracking=yes)
165 if test x$enable_dependency_tracking = xyes; then
167 AC_MSG_CHECKING(for GCC -MMD -MT option)
169 #if !defined(__GNUC__) || __GNUC__ < 3
170 #error Dependency tracking requires GCC 3.0 or newer
176 AC_MSG_RESULT($have_gcc_mmd_mt)
178 if test x$have_gcc_mmd_mt = xyes; then
179 DEPENDENCY_TRACKING_OPTIONS="-MMD -MT \$@"
183 # Actually this doesn't work on OpenBSD and BeOS
184 #AC_MSG_CHECKING(for linker option --no-undefined)
185 #have_no_undefined=no
186 #save_LDFLAGS="$LDFLAGS"
187 #LDFLAGS="$LDFLAGS -Wl,--no-undefined"
191 #have_no_undefined=yes
192 #EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--no-undefined"
194 #LDFLAGS="$save_LDFLAGS"
195 #AC_MSG_RESULT($have_no_undefined)
197 dnl See whether we are allowed to use the system C library
199 AC_HELP_STRING([--enable-libc], [Use the system C library [[default=yes]]]),
201 if test x$enable_libc = xyes; then
202 AC_DEFINE(HAVE_LIBC, 1, [ ])
204 dnl Check for C library headers
206 AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h)
208 dnl Check for typedefs, structures, etc.
211 dnl Check for defines
212 AC_CHECK_DEFINE(M_PI, math.h)
214 dnl Checks for library functions.
216 *-*-cygwin* | *-*-mingw32*)
224 if test x$ac_cv_func_memcmp_working = xyes; then
225 AC_DEFINE(HAVE_MEMCMP, 1, [ ])
228 if test x$ac_cv_func_strtod = xyes; then
229 AC_DEFINE(HAVE_STRTOD, 1, [ ])
231 AC_CHECK_FUNC(mprotect,
233 #include <sys/types.h>
234 #include <sys/mman.h>
237 AC_DEFINE(HAVE_MPROTECT, 1, [ ])
240 AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp sscanf snprintf vsnprintf fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname)
242 AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
243 AC_CHECK_FUNCS(atan atan2 ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt)
245 AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"])
246 AC_CHECK_FUNCS(iconv)
248 AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE(HAVE_SA_SIGACTION)], ,[#include <signal.h>])
251 AC_CHECK_SIZEOF(void*)
253 dnl See whether we can use gcc atomic operations on this architecture
254 AC_ARG_ENABLE(gcc-atomics,
255 AC_HELP_STRING([--enable-gcc-atomics],
256 [Use gcc builtin atomics [[default=yes]]]),
257 , enable_gcc_atomics=yes)
258 if test x$enable_gcc_atomics = xyes; then
260 AC_MSG_CHECKING(for GCC builtin atomic operations)
265 __sync_lock_test_and_set(&a, 4);
266 __sync_lock_test_and_set(&x, y);
267 __sync_fetch_and_add(&a, 1);
268 __sync_bool_compare_and_swap(&a, 5, 10);
269 __sync_bool_compare_and_swap(&x, y, z);
273 AC_MSG_RESULT($have_gcc_atomics)
275 if test x$have_gcc_atomics = xyes; then
276 AC_DEFINE(HAVE_GCC_ATOMICS, 1, [ ])
278 # See if we have the minimum operation needed for GCC atomics
282 __sync_lock_test_and_set(&a, 1);
283 __sync_lock_release(&a);
285 have_gcc_sync_lock_test_and_set=yes
287 if test x$have_gcc_sync_lock_test_and_set = xyes; then
288 AC_DEFINE(HAVE_GCC_SYNC_LOCK_TEST_AND_SET, 1, [ ])
294 SOURCES="$SOURCES $srcdir/src/*.c"
295 SOURCES="$SOURCES $srcdir/src/atomic/*.c"
296 SOURCES="$SOURCES $srcdir/src/audio/*.c"
297 SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c"
298 SOURCES="$SOURCES $srcdir/src/events/*.c"
299 SOURCES="$SOURCES $srcdir/src/file/*.c"
300 SOURCES="$SOURCES $srcdir/src/libm/*.c"
301 SOURCES="$SOURCES $srcdir/src/render/*.c"
302 SOURCES="$SOURCES $srcdir/src/render/*/*.c"
303 SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
304 SOURCES="$SOURCES $srcdir/src/thread/*.c"
305 SOURCES="$SOURCES $srcdir/src/timer/*.c"
306 SOURCES="$SOURCES $srcdir/src/video/*.c"
308 dnl Enable/disable various subsystems of the SDL library
310 AC_ARG_ENABLE(atomic,
311 AC_HELP_STRING([--enable-atomic], [Enable the atomic operations subsystem [[default=yes]]]),
313 if test x$enable_atomic != xyes; then
314 AC_DEFINE(SDL_ATOMIC_DISABLED, 1, [ ])
317 AC_HELP_STRING([--enable-audio], [Enable the audio subsystem [[default=yes]]]),
319 if test x$enable_audio != xyes; then
320 AC_DEFINE(SDL_AUDIO_DISABLED, 1, [ ])
323 AC_HELP_STRING([--enable-video], [Enable the video subsystem [[default=yes]]]),
325 if test x$enable_video != xyes; then
326 AC_DEFINE(SDL_VIDEO_DISABLED, 1, [ ])
328 AC_ARG_ENABLE(render,
329 AC_HELP_STRING([--enable-render], [Enable the render subsystem [[default=yes]]]),
331 if test x$enable_render != xyes; then
332 AC_DEFINE(SDL_RENDER_DISABLED, 1, [ ])
334 AC_ARG_ENABLE(events,
335 AC_HELP_STRING([--enable-events], [Enable the events subsystem [[default=yes]]]),
337 if test x$enable_events != xyes; then
338 AC_DEFINE(SDL_EVENTS_DISABLED, 1, [ ])
340 AC_ARG_ENABLE(joystick,
341 AC_HELP_STRING([--enable-joystick], [Enable the joystick subsystem [[default=yes]]]),
342 , enable_joystick=yes)
343 if test x$enable_joystick != xyes; then
344 AC_DEFINE(SDL_JOYSTICK_DISABLED, 1, [ ])
346 SOURCES="$SOURCES $srcdir/src/joystick/*.c"
348 AC_ARG_ENABLE(haptic,
349 AC_HELP_STRING([--enable-haptic], [Enable the haptic (force feedback) subsystem [[default=yes]]]),
351 if test x$enable_haptic != xyes; then
352 AC_DEFINE(SDL_HAPTIC_DISABLED, 1, [ ])
354 SOURCES="$SOURCES $srcdir/src/haptic/*.c"
357 AC_HELP_STRING([--enable-power], [Enable the power subsystem [[default=yes]]]),
359 if test x$enable_power != xyes; then
360 AC_DEFINE(SDL_POWER_DISABLED, 1, [ ])
362 SOURCES="$SOURCES $srcdir/src/power/*.c"
364 AC_ARG_ENABLE(threads,
365 AC_HELP_STRING([--enable-threads], [Enable the threading subsystem [[default=yes]]]),
366 , enable_threads=yes)
367 if test x$enable_threads != xyes; then
368 AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ])
370 AC_ARG_ENABLE(timers,
371 AC_HELP_STRING([--enable-timers], [Enable the timer subsystem [[default=yes]]]),
373 if test x$enable_timers != xyes; then
374 AC_DEFINE(SDL_TIMERS_DISABLED, 1, [ ])
377 AC_HELP_STRING([--enable-file], [Enable the file subsystem [[default=yes]]]),
379 if test x$enable_file != xyes; then
380 AC_DEFINE(SDL_FILE_DISABLED, 1, [ ])
382 AC_ARG_ENABLE(loadso,
383 AC_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [[default=yes]]]),
385 if test x$enable_loadso != xyes; then
386 AC_DEFINE(SDL_LOADSO_DISABLED, 1, [ ])
388 AC_ARG_ENABLE(cpuinfo,
389 AC_HELP_STRING([--enable-cpuinfo], [Enable the cpuinfo subsystem [[default=yes]]]),
390 , enable_cpuinfo=yes)
391 if test x$enable_cpuinfo != xyes; then
392 AC_DEFINE(SDL_CPUINFO_DISABLED, 1, [ ])
394 AC_ARG_ENABLE(atomic,
395 AC_HELP_STRING([--enable-atomic], [Enable the atomic operations [[default=yes]]]),
397 if test x$enable_atomic != xyes; then
398 AC_DEFINE(SDL_ATOMIC_DISABLED, 1, [ ])
400 AC_ARG_ENABLE(assembly,
401 AC_HELP_STRING([--enable-assembly], [Enable assembly routines [[default=yes]]]),
402 , enable_assembly=yes)
403 if test x$enable_assembly = xyes; then
404 AC_DEFINE(SDL_ASSEMBLY_ROUTINES, 1, [ ])
406 # Make sure that we don't generate floating point code that would
407 # cause illegal instruction exceptions on older processors
410 # Don't need to worry about Apple hardware, it's all SSE capable
414 # x86 64-bit architectures all have SSE instructions
421 AC_ARG_ENABLE(ssemath,
422 AC_HELP_STRING([--enable-ssemath], [Allow GCC to use SSE floating point math [[default=no]]]),
423 , enable_ssemath=$default_ssemath)
424 if test x$enable_ssemath = xno; then
425 if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes; then
426 EXTRA_CFLAGS="$EXTRA_CFLAGS -mfpmath=387"
430 dnl Check for various instruction support
432 AC_HELP_STRING([--enable-mmx], [use MMX assembly routines [[default=yes]]]),
434 if test x$enable_mmx = xyes; then
435 save_CFLAGS="$CFLAGS"
437 AC_MSG_CHECKING(for GCC -mmmx option)
439 CFLAGS="$save_CFLAGS $mmx_CFLAGS"
444 #ifdef __MINGW64_VERSION_MAJOR
447 #include <mmintrin.h>
450 #include <mmintrin.h>
453 #error Assembler CPP flag not enabled
459 AC_MSG_RESULT($have_gcc_mmx)
460 CFLAGS="$save_CFLAGS"
462 if test x$have_gcc_mmx = xyes; then
463 EXTRA_CFLAGS="$EXTRA_CFLAGS $mmx_CFLAGS"
468 AC_HELP_STRING([--enable-3dnow], [use 3DNow! assembly routines [[default=yes]]]),
470 if test x$enable_3dnow = xyes; then
471 save_CFLAGS="$CFLAGS"
473 AC_MSG_CHECKING(for GCC -m3dnow option)
474 amd3dnow_CFLAGS="-m3dnow"
475 CFLAGS="$save_CFLAGS $amd3dnow_CFLAGS"
480 #error Assembler CPP flag not enabled
488 AC_MSG_RESULT($have_gcc_3dnow)
489 CFLAGS="$save_CFLAGS"
491 if test x$have_gcc_3dnow = xyes; then
492 EXTRA_CFLAGS="$EXTRA_CFLAGS $amd3dnow_CFLAGS"
497 AC_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]),
499 if test x$enable_sse = xyes; then
500 save_CFLAGS="$CFLAGS"
502 AC_MSG_CHECKING(for GCC -msse option)
504 CFLAGS="$save_CFLAGS $sse_CFLAGS"
509 #ifdef __MINGW64_VERSION_MAJOR
512 #include <xmmintrin.h>
515 #include <xmmintrin.h>
518 #error Assembler CPP flag not enabled
524 AC_MSG_RESULT($have_gcc_sse)
525 CFLAGS="$save_CFLAGS"
527 if test x$have_gcc_sse = xyes; then
528 EXTRA_CFLAGS="$EXTRA_CFLAGS $sse_CFLAGS"
533 AC_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=no]]]),
534 , enable_sse2=$default_ssemath)
535 if test x$enable_sse2 = xyes; then
536 save_CFLAGS="$CFLAGS"
538 AC_MSG_CHECKING(for GCC -msse2 option)
540 CFLAGS="$save_CFLAGS $sse2_CFLAGS"
545 #ifdef __MINGW64_VERSION_MAJOR
548 #include <emmintrin.h>
551 #include <emmintrin.h>
554 #error Assembler CPP flag not enabled
560 AC_MSG_RESULT($have_gcc_sse2)
561 CFLAGS="$save_CFLAGS"
563 if test x$have_gcc_sse2 = xyes; then
564 EXTRA_CFLAGS="$EXTRA_CFLAGS $sse2_CFLAGS"
568 AC_ARG_ENABLE(altivec,
569 AC_HELP_STRING([--enable-altivec], [use Altivec assembly routines [[default=yes]]]),
570 , enable_altivec=yes)
571 if test x$enable_altivec = xyes; then
572 save_CFLAGS="$CFLAGS"
574 have_altivec_h_hdr=no
575 altivec_CFLAGS="-maltivec"
576 CFLAGS="$save_CFLAGS $altivec_CFLAGS"
578 AC_MSG_CHECKING(for Altivec with GCC altivec.h and -maltivec option)
581 vector unsigned int vzero() {
582 return vec_splat_u32(0);
587 have_altivec_h_hdr=yes
589 AC_MSG_RESULT($have_gcc_altivec)
591 if test x$have_gcc_altivec = xno; then
592 AC_MSG_CHECKING(for Altivec with GCC -maltivec option)
594 vector unsigned int vzero() {
595 return vec_splat_u32(0);
601 AC_MSG_RESULT($have_gcc_altivec)
604 if test x$have_gcc_altivec = xno; then
605 AC_MSG_CHECKING(for Altivec with GCC altivec.h and -faltivec option)
606 altivec_CFLAGS="-faltivec"
607 CFLAGS="$save_CFLAGS $altivec_CFLAGS"
610 vector unsigned int vzero() {
611 return vec_splat_u32(0);
616 have_altivec_h_hdr=yes
618 AC_MSG_RESULT($have_gcc_altivec)
621 if test x$have_gcc_altivec = xno; then
622 AC_MSG_CHECKING(for Altivec with GCC -faltivec option)
624 vector unsigned int vzero() {
625 return vec_splat_u32(0);
631 AC_MSG_RESULT($have_gcc_altivec)
633 CFLAGS="$save_CFLAGS"
635 if test x$have_gcc_altivec = xyes; then
636 AC_DEFINE(SDL_ALTIVEC_BLITTERS, 1, [ ])
637 if test x$have_altivec_h_hdr = xyes; then
638 AC_DEFINE(HAVE_ALTIVEC_H, 1, [ ])
640 EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS"
645 dnl See if the OSS audio interface is supported
649 AC_HELP_STRING([--enable-oss], [support the OSS audio API [[default=yes]]]),
651 if test x$enable_audio = xyes -a x$enable_oss = xyes; then
652 AC_MSG_CHECKING(for OSS audio support)
654 if test x$have_oss != xyes; then
656 #include <sys/soundcard.h>
658 int arg = SNDCTL_DSP_SETFRAGMENT;
663 if test x$have_oss != xyes; then
665 #include <soundcard.h>
667 int arg = SNDCTL_DSP_SETFRAGMENT;
670 AC_DEFINE(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H, 1, [ ])
673 AC_MSG_RESULT($have_oss)
674 if test x$have_oss = xyes; then
675 AC_DEFINE(SDL_AUDIO_DRIVER_OSS, 1, [ ])
676 SOURCES="$SOURCES $srcdir/src/audio/dsp/*.c"
679 # We may need to link with ossaudio emulation library
681 *-*-openbsd*|*-*-netbsd*)
682 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";;
688 dnl See if the ALSA audio interface is supported
692 AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [[default=yes]]]),
694 if test x$enable_audio = xyes -a x$enable_alsa = xyes; then
695 AM_PATH_ALSA(0.9.0, have_alsa=yes, have_alsa=no)
696 # Restore all flags from before the ALSA detection runs
697 CFLAGS="$alsa_save_CFLAGS"
698 LDFLAGS="$alsa_save_LDFLAGS"
699 LIBS="$alsa_save_LIBS"
700 if test x$have_alsa = xyes; then
701 AC_ARG_ENABLE(alsa-shared,
702 AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [[default=yes]]]),
703 , enable_alsa_shared=yes)
704 alsa_lib=[`find_lib "libasound.so.*" "$ALSA_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
706 AC_DEFINE(SDL_AUDIO_DRIVER_ALSA, 1, [ ])
707 SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c"
708 EXTRA_CFLAGS="$EXTRA_CFLAGS $ALSA_CFLAGS"
709 if test x$have_loadso != xyes && \
710 test x$enable_alsa_shared = xyes; then
711 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ALSA loading])
713 if test x$have_loadso = xyes && \
714 test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
715 echo "-- dynamic libasound -> $alsa_lib"
716 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ALSA_DYNAMIC, "$alsa_lib", [ ])
718 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ALSA_LIBS"
725 dnl Find the ESD includes and libraries
729 AC_HELP_STRING([--enable-esd], [support the Enlightened Sound Daemon [[default=yes]]]),
731 if test x$enable_audio = xyes -a x$enable_esd = xyes; then
732 AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no)
733 if test x$have_esd = xyes; then
734 AC_ARG_ENABLE(esd-shared,
735 AC_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [[default=yes]]]),
736 , enable_esd_shared=yes)
737 esd_lib=[`find_lib "libesd.so.*" "$ESD_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
739 AC_DEFINE(SDL_AUDIO_DRIVER_ESD, 1, [ ])
740 SOURCES="$SOURCES $srcdir/src/audio/esd/*.c"
741 EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS"
742 if test x$have_loadso != xyes && \
743 test x$enable_esd_shared = xyes; then
744 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ESD loading])
746 if test x$have_loadso = xyes && \
747 test x$enable_esd_shared = xyes && test x$esd_lib != x; then
748 echo "-- dynamic libesd -> $esd_lib"
749 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ESD_DYNAMIC, "$esd_lib", [ ])
751 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ESD_LIBS"
761 AC_ARG_ENABLE(pulseaudio,
762 AC_HELP_STRING([--enable-pulseaudio], [use PulseAudio [[default=yes]]]),
763 , enable_pulseaudio=yes)
764 if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then
767 PULSEAUDIO_REQUIRED_VERSION=0.9
769 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
770 AC_MSG_CHECKING(for PulseAudio $PULSEAUDIO_REQUIRED_VERSION support)
771 if test x$PKG_CONFIG != xno; then
772 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSEAUDIO_REQUIRED_VERSION libpulse-simple; then
773 PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple`
774 PULSEAUDIO_LIBS=`$PKG_CONFIG --libs libpulse-simple`
778 AC_MSG_RESULT($audio_pulseaudio)
780 if test x$audio_pulseaudio = xyes; then
781 AC_ARG_ENABLE(pulseaudio-shared,
782 AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [[default=yes]]]),
783 , enable_pulseaudio_shared=yes)
784 pulseaudio_lib=[`find_lib "libpulse-simple.so.*" "$PULSEAUDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
786 AC_DEFINE(SDL_AUDIO_DRIVER_PULSEAUDIO, 1, [ ])
787 SOURCES="$SOURCES $srcdir/src/audio/pulseaudio/*.c"
788 EXTRA_CFLAGS="$EXTRA_CFLAGS $PULSEAUDIO_CFLAGS"
789 if test x$have_loadso != xyes && \
790 test x$enable_pulseaudio_shared = xyes; then
791 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic PulseAudio loading])
793 if test x$have_loadso = xyes && \
794 test x$enable_pulseaudio_shared = xyes && test x$pulseaudio_lib != x; then
795 echo "-- dynamic libpulse-simple -> $pulseaudio_lib"
796 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC, "$pulseaudio_lib", [ ])
799 # On Solaris, pulseaudio must be linked deferred explicitly
800 # to prevent undefined symbol failures.
802 PULSEAUDIO_LIBS=`echo $PULSEAUDIO_LIBS | sed 's/\-l/-Wl,-l/g'`
803 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-zdeferred $PULSEAUDIO_LIBS -Wl,-znodeferred"
806 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PULSEAUDIO_LIBS"
816 AC_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [[default=yes]]]),
818 if test x$enable_audio = xyes -a x$enable_arts = xyes; then
819 AC_PATH_PROG(ARTSCONFIG, artsc-config)
820 if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then
821 : # arts isn't installed
823 ARTS_CFLAGS=`$ARTSCONFIG --cflags`
824 ARTS_LIBS=`$ARTSCONFIG --libs`
825 AC_MSG_CHECKING(for aRts development environment)
827 save_CFLAGS="$CFLAGS"
828 CFLAGS="$CFLAGS $ARTS_CFLAGS"
832 arts_stream_t stream;
836 CFLAGS="$save_CFLAGS"
837 AC_MSG_RESULT($audio_arts)
838 if test x$audio_arts = xyes; then
839 AC_ARG_ENABLE(arts-shared,
840 AC_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [[default=yes]]]),
841 , enable_arts_shared=yes)
842 arts_lib=[`find_lib "libartsc.so.*" "$ARTS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
844 AC_DEFINE(SDL_AUDIO_DRIVER_ARTS, 1, [ ])
845 SOURCES="$SOURCES $srcdir/src/audio/arts/*.c"
846 EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS"
847 if test x$have_loadso != xyes && \
848 test x$enable_arts_shared = xyes; then
849 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ARTS loading])
851 if test x$have_loadso = xyes && \
852 test x$enable_arts_shared = xyes && test x$arts_lib != x; then
853 echo "-- dynamic libartsc -> $arts_lib"
854 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ARTS_DYNAMIC, "$arts_lib", [ ])
856 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS"
864 dnl See if the NAS audio interface is supported
868 AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]),
870 if test x$enable_audio = xyes -a x$enable_nas = xyes; then
871 AC_CHECK_HEADER(audio/audiolib.h, have_nas_hdr=yes)
872 AC_CHECK_LIB(audio, AuOpenServer, have_nas_lib=yes)
874 AC_MSG_CHECKING(for NAS audio support)
877 if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then
881 elif test -r /usr/X11R6/include/audio/audiolib.h; then
883 NAS_CFLAGS="-I/usr/X11R6/include/"
884 NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt"
888 AC_MSG_RESULT($have_nas)
890 if test x$have_nas = xyes; then
891 AC_ARG_ENABLE(nas-shared,
892 AC_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[default=yes]]]),
893 , enable_nas_shared=yes)
894 nas_lib=[`find_lib "libaudio.so.*" "$NAS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
896 if test x$have_loadso != xyes && \
897 test x$enable_nas_shared = xyes; then
898 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic NAS loading])
900 if test x$have_loadso = xyes && \
901 test x$enable_nas_shared = xyes && test x$nas_lib != x; then
902 echo "-- dynamic libaudio -> $nas_lib"
903 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_NAS_DYNAMIC, "$nas_lib", [ ])
905 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS"
908 AC_DEFINE(SDL_AUDIO_DRIVER_NAS, 1, [ ])
909 SOURCES="$SOURCES $srcdir/src/audio/nas/*.c"
910 EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS"
916 dnl rcg07142001 See if the user wants the disk writer audio driver...
919 AC_ARG_ENABLE(diskaudio,
920 AC_HELP_STRING([--enable-diskaudio], [support the disk writer audio driver [[default=yes]]]),
921 , enable_diskaudio=yes)
922 if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
923 AC_DEFINE(SDL_AUDIO_DRIVER_DISK, 1, [ ])
924 SOURCES="$SOURCES $srcdir/src/audio/disk/*.c"
928 dnl rcg03142006 See if the user wants the dummy audio driver...
931 AC_ARG_ENABLE(dummyaudio,
932 AC_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [[default=yes]]]),
933 , enable_dummyaudio=yes)
934 if test x$enable_audio = xyes -a x$enable_dummyaudio = xyes; then
935 AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY, 1, [ ])
936 SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c"
940 dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
941 dnl Details of this flag are here: http://gcc.gnu.org/wiki/Visibility
942 CheckVisibilityHidden()
944 AC_MSG_CHECKING(for GCC -fvisibility=hidden option)
945 have_gcc_fvisibility=no
947 visibility_CFLAGS="-fvisibility=hidden"
948 save_CFLAGS="$CFLAGS"
949 CFLAGS="$save_CFLAGS $visibility_CFLAGS -Werror"
951 #if !defined(__GNUC__) || __GNUC__ < 4
952 #error SDL only uses visibility attributes in GCC 4 or newer
956 have_gcc_fvisibility=yes
958 AC_MSG_RESULT($have_gcc_fvisibility)
959 CFLAGS="$save_CFLAGS"
961 if test x$have_gcc_fvisibility = xyes; then
962 EXTRA_CFLAGS="$EXTRA_CFLAGS $visibility_CFLAGS"
966 dnl See if GCC's -mpreferred-stack-boundary is supported.
967 dnl Reference: http://bugzilla.libsdl.org/show_bug.cgi?id=1296
970 AC_MSG_CHECKING(for GCC -mpreferred-stack-boundary option)
971 have_gcc_preferred_stack_boundary=no
973 save_CFLAGS="$CFLAGS"
974 CFLAGS="$save_CFLAGS -mpreferred-stack-boundary=2"
979 have_gcc_preferred_stack_boundary=yes
981 AC_MSG_RESULT($have_gcc_preferred_stack_boundary)
982 CFLAGS="$save_CFLAGS"
984 if test x$have_gcc_preferred_stack_boundary = xyes; then
985 EXTRA_CFLAGS="$EXTRA_CFLAGS -mpreferred-stack-boundary=2"
990 dnl See if GCC's -Wall is supported.
993 AC_MSG_CHECKING(for GCC -Wall option)
996 save_CFLAGS="$CFLAGS"
997 CFLAGS="$save_CFLAGS -Wall"
1004 AC_MSG_RESULT($have_gcc_Wall)
1005 CFLAGS="$save_CFLAGS"
1007 if test x$have_gcc_Wall = xyes; then
1008 EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall"
1010 dnl Haiku headers use multicharacter constants all over the place. Ignore these warnings when using -Wall.
1011 AC_MSG_CHECKING(for necessary GCC -Wno-multichar option)
1012 need_gcc_Wno_multichar=no
1014 *-*-beos* | *-*-haiku*)
1015 need_gcc_Wno_multichar=yes
1018 AC_MSG_RESULT($need_gcc_Wno_multichar)
1019 if test x$need_gcc_Wno_multichar = xyes; then
1020 EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-multichar"
1026 dnl Find the X11 include and library directories
1031 AC_ARG_ENABLE(video-x11,
1032 AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]),
1033 , enable_video_x11=yes)
1034 if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
1037 # This isn't necessary for X11, but fixes GLX detection
1038 if test "x$x_includes" = xNONE && \
1039 test "x$x_libraries" = xNONE && \
1040 test -d /usr/X11R6/include && \
1041 test -d /usr/X11R6/lib; then
1042 x_includes="/usr/X11R6/include"
1043 x_libraries="/usr/X11R6/lib"
1049 if test x$have_x = xyes; then
1050 # Only allow dynamically loaded X11 if the X11 function pointers
1051 # will not end up in the global namespace, which causes problems
1052 # with other libraries calling X11 functions.
1053 x11_symbols_private=$have_gcc_fvisibility
1055 AC_ARG_ENABLE(x11-shared,
1056 AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=maybe]]]),
1057 , enable_x11_shared=maybe)
1061 x11_symbols_private=yes
1062 x11_lib='/usr/X11R6/lib/libX11.6.dylib'
1063 x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
1064 xcursor_lib='/usr/X11R6/lib/libXcursor.1.dylib'
1065 xinerama_lib='/usr/X11R6/lib/libXinerama.1.dylib'
1066 xinput_lib='/usr/X11R6/lib/libXi.6.dylib'
1067 xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
1068 xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
1069 xss_lib='/usr/X11R6/lib/libXss.1.dylib'
1070 xvidmode_lib='/usr/X11R6/lib/libXxf86vm.1.dylib'
1074 x11ext_lib='libXext.so'
1075 xcursor_lib='libXcursor.so'
1076 xinerama_lib='libXinerama.so'
1077 xinput_lib='libXi.so'
1078 xrandr_lib='libXrandr.so'
1079 xrender_lib='libXrender.so'
1081 xvidmode_lib='libXxf86vm.so'
1084 x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1085 x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1086 xcursor_lib=[`find_lib "libXcursor.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1087 xinerama_lib=[`find_lib "libXinerama.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1088 xinput_lib=[`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1089 xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1090 xrender_lib=[`find_lib "libXrender.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1091 xss_lib=[`find_lib "libXss.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1092 xvidmode_lib=[`find_lib "libXxf86vm.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1096 if test x$ac_cv_func_shmat != xyes; then
1097 X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY"
1099 CFLAGS="$CFLAGS $X_CFLAGS"
1100 LDFLAGS="$LDFLAGS $X_LIBS"
1102 AC_DEFINE(SDL_VIDEO_DRIVER_X11, 1, [ ])
1103 SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
1104 EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
1106 if test x$enable_x11_shared = xmaybe; then
1107 enable_x11_shared=$x11_symbols_private
1109 if test x$have_loadso != xyes && \
1110 test x$enable_x11_shared = xyes; then
1111 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic X11 loading])
1112 enable_x11_shared=no
1114 if test x$x11_symbols_private != xyes && \
1115 test x$enable_x11_shared = xyes; then
1116 AC_MSG_WARN([You must have gcc4 (-fvisibility=hidden) for dynamic X11 loading])
1117 enable_x11_shared=no
1120 if test x$have_loadso = xyes && \
1121 test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then
1122 echo "-- dynamic libX11 -> $x11_lib"
1123 echo "-- dynamic libX11ext -> $x11ext_lib"
1124 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib", [ ])
1125 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib", [ ])
1127 enable_x11_shared=no
1128 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
1132 AC_MSG_CHECKING(for const parameter to XextAddDisplay)
1133 have_const_param_XextAddDisplay=no
1135 #include <X11/Xlib.h>
1136 #include <X11/Xproto.h>
1137 #include <X11/extensions/Xext.h>
1138 #include <X11/extensions/extutil.h>
1139 extern XExtDisplayInfo* XextAddDisplay(XExtensionInfo* a,Display* b,_Xconst char* c,XExtensionHooks* d,int e,XPointer f);
1142 have_const_param_XextAddDisplay=yes
1143 AC_DEFINE(SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY)
1145 AC_MSG_RESULT($have_const_param_XextAddDisplay)
1147 dnl AC_CHECK_LIB(X11, XGetEventData, AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS, 1, [Have XGenericEvent]))
1148 AC_MSG_CHECKING([for XGenericEvent])
1149 have_XGenericEvent=no
1151 #include <X11/Xlib.h>
1155 XGenericEventCookie *cookie = &event.xcookie;
1156 XNextEvent(display, &event);
1157 XGetEventData(display, cookie);
1158 XFreeEventData(display, cookie);
1160 have_XGenericEvent=yes
1161 AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS)
1163 AC_MSG_RESULT($have_XGenericEvent)
1165 AC_CHECK_LIB(X11, XkbKeycodeToKeysym, AC_DEFINE(SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM, 1, [Have XkbKeycodeToKeysym]))
1167 AC_ARG_ENABLE(video-x11-xcursor,
1168 AC_HELP_STRING([--enable-video-x11-xcursor], [enable X11 Xcursor support [[default=yes]]]),
1169 , enable_video_x11_xcursor=yes)
1170 if test x$enable_video_x11_xcursor = xyes; then
1171 definitely_enable_video_x11_xcursor=no
1172 AC_CHECK_HEADER(X11/Xcursor/Xcursor.h,
1173 have_xcursor_h_hdr=yes,
1174 have_xcursor_h_hdr=no,
1175 [#include <X11/Xlib.h>
1177 if test x$have_xcursor_h_hdr = xyes; then
1178 if test x$enable_x11_shared = xyes && test x$xcursor_lib != x ; then
1179 echo "-- dynamic libXcursor -> $xcursor_lib"
1180 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR, "$xcursor_lib", [ ])
1181 definitely_enable_video_x11_xcursor=yes
1183 AC_CHECK_LIB(Xcursor, XcursorImageCreate, have_xcursor_lib=yes)
1184 if test x$have_xcursor_lib = xyes ; then
1185 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXcursor"
1186 definitely_enable_video_x11_xcursor=yes
1191 if test x$definitely_enable_video_x11_xcursor = xyes; then
1192 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XCURSOR, 1, [ ])
1194 AC_ARG_ENABLE(video-x11-xinerama,
1195 AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]),
1196 , enable_video_x11_xinerama=yes)
1197 if test x$enable_video_x11_xinerama = xyes; then
1198 definitely_enable_video_x11_xinerama=no
1199 AC_CHECK_HEADER(X11/extensions/Xinerama.h,
1200 have_xinerama_h_hdr=yes,
1201 have_xinerama_h_hdr=no,
1202 [#include <X11/Xlib.h>
1204 if test x$have_xinerama_h_hdr = xyes; then
1205 if test x$enable_x11_shared = xyes && test x$xinerama_lib != x ; then
1206 echo "-- dynamic libXinerama -> $xinerama_lib"
1207 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA, "$xinerama_lib", [ ])
1208 definitely_enable_video_x11_xinerama=yes
1210 AC_CHECK_LIB(Xinerama, XineramaQueryExtension, have_xinerama_lib=yes)
1211 if test x$have_xinerama_lib = xyes ; then
1212 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXinerama"
1213 definitely_enable_video_x11_xinerama=yes
1218 if test x$definitely_enable_video_x11_xinerama = xyes; then
1219 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA, 1, [ ])
1221 AC_ARG_ENABLE(video-x11-xinput,
1222 AC_HELP_STRING([--enable-video-x11-xinput], [enable X11 XInput extension for manymouse, tablets, etc [[default=yes]]]),
1223 , enable_video_x11_xinput=yes)
1224 if test x$enable_video_x11_xinput = xyes; then
1225 definitely_enable_video_x11_xinput=no
1226 AC_CHECK_HEADER(X11/extensions/XInput2.h,
1227 have_xinput_h_hdr=yes,
1228 have_xinput_h_hdr=no,
1229 [#include <X11/Xlib.h>
1231 if test x$have_xinput_h_hdr = xyes; then
1232 if test x$enable_x11_shared = xyes && test x$xinput_lib != x ; then
1233 echo "-- dynamic libXi -> $xinput_lib"
1234 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2, "$xinput_lib", [ ])
1235 definitely_enable_video_x11_xinput=yes
1237 AC_CHECK_LIB(Xi, XOpenDevice, have_xinput_lib=yes)
1238 if test x$have_xinput_lib = xyes ; then
1239 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXi"
1240 definitely_enable_video_x11_xinput=yes
1245 if test x$definitely_enable_video_x11_xinput = xyes; then
1246 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT2, 1, [ ])
1247 AC_MSG_CHECKING(for xinput2 multitouch)
1248 have_xinput2_multitouch=no
1250 #include <X11/Xlib.h>
1251 #include <X11/Xproto.h>
1252 #include <X11/extensions/XInput2.h>
1254 int event_type = XI_TouchBegin;
1255 XITouchClassInfo *t;
1257 XIAllowTouchEvents(Display *a,int b,unsigned int c,Window d,int f)
1262 have_xinput2_multitouch=yes
1263 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH)
1265 AC_MSG_RESULT($have_xinput2_multitouch)
1267 AC_ARG_ENABLE(video-x11-xrandr,
1268 AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]),
1269 , enable_video_x11_xrandr=yes)
1270 if test x$enable_video_x11_xrandr = xyes; then
1271 definitely_enable_video_x11_xrandr=no
1272 AC_CHECK_HEADER(X11/extensions/Xrandr.h,
1273 have_xrandr_h_hdr=yes,
1274 have_xrandr_h_hdr=no,
1275 [#include <X11/Xlib.h>
1277 if test x$have_xrandr_h_hdr = xyes; then
1278 if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then
1279 echo "-- dynamic libXrandr -> $xrandr_lib"
1280 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib", [ ])
1281 definitely_enable_video_x11_xrandr=yes
1283 AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes)
1284 if test x$have_xrandr_lib = xyes ; then
1285 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr"
1286 definitely_enable_video_x11_xrandr=yes
1291 if test x$definitely_enable_video_x11_xrandr = xyes; then
1292 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR, 1, [ ])
1294 AC_ARG_ENABLE(video-x11-scrnsaver,
1295 AC_HELP_STRING([--enable-video-x11-scrnsaver], [enable X11 screensaver extension [[default=yes]]]),
1296 , enable_video_x11_scrnsaver=yes)
1297 if test x$enable_video_x11_scrnsaver = xyes; then
1298 AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
1299 have_scrnsaver_h_hdr=yes,
1300 have_scrnsaver_h_hdr=no,
1301 [#include <X11/Xlib.h>
1303 if test x$have_scrnsaver_h_hdr = xyes; then
1304 if test x$enable_x11_shared = xyes && test x$xss_lib != x ; then
1305 echo "-- dynamic libXss -> $xss_lib"
1306 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS, "$xss_lib", [ ])
1307 definitely_enable_video_x11_scrnsaver=yes
1309 AC_CHECK_LIB(Xss, XScreenSaverSuspend, have_xss_lib=yes)
1310 if test x$have_xss_lib = xyes ; then
1311 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXss"
1312 definitely_enable_video_x11_scrnsaver=yes
1317 if test x$definitely_enable_video_x11_scrnsaver = xyes; then
1318 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSCRNSAVER, 1, [ ])
1320 AC_ARG_ENABLE(video-x11-xshape,
1321 AC_HELP_STRING([--enable-video-x11-xshape], [enable X11 XShape support [[default=yes]]]),
1322 , enable_video_x11_xshape=yes)
1323 if test x$enable_video_x11_xshape = xyes; then
1324 AC_CHECK_HEADER(X11/extensions/shape.h,
1325 have_shape_h_hdr=yes,
1326 have_shape_h_hdr=no,
1327 [#include <X11/Xlib.h>
1329 if test x$have_shape_h_hdr = xyes; then
1330 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSHAPE, 1, [ ])
1333 AC_ARG_ENABLE(video-x11-vm,
1334 AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[default=yes]]]),
1335 , enable_video_x11_vm=yes)
1336 if test x$enable_video_x11_vm = xyes; then
1337 definitely_enable_video_x11_vm=no
1338 AC_CHECK_HEADER(X11/extensions/xf86vmode.h,
1341 [#include <X11/Xlib.h>
1343 if test x$have_vm_h_hdr = xyes; then
1344 if test x$enable_x11_shared = xyes && test x$xvidmode_lib != x ; then
1345 echo "-- dynamic libXxf86vm -> $xvidmode_lib"
1346 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE, "$xvidmode_lib", [ ])
1347 definitely_enable_video_x11_vm=yes
1349 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryVersion, have_vm_lib=yes)
1350 if test x$have_vm_lib = xyes ; then
1351 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXxf86vm"
1352 definitely_enable_video_x11_vm=yes
1357 if test x$definitely_enable_video_x11_vm = xyes; then
1358 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XVIDMODE, 1, [ ])
1364 dnl Set up the BWindow video driver if enabled
1367 if test x$enable_video = xyes; then
1368 AC_DEFINE(SDL_VIDEO_DRIVER_BWINDOW, 1, [ ])
1369 SOURCES="$SOURCES $srcdir/src/video/bwindow/*.cc"
1374 dnl Set up the Cocoa video driver for Mac OS X (but not Darwin)
1377 AC_ARG_ENABLE(video-cocoa,
1378 AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]),
1379 , enable_video_cocoa=yes)
1380 if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
1381 save_CFLAGS="$CFLAGS"
1382 dnl work around that we don't have Objective-C support in autoconf
1383 CFLAGS="$CFLAGS -x objective-c"
1384 AC_MSG_CHECKING(for Cocoa framework)
1387 #import <Cocoa/Cocoa.h>
1392 AC_MSG_RESULT($have_cocoa)
1393 CFLAGS="$save_CFLAGS"
1394 if test x$have_cocoa = xyes; then
1395 AC_DEFINE(SDL_VIDEO_DRIVER_COCOA, 1, [ ])
1396 SOURCES="$SOURCES $srcdir/src/video/cocoa/*.m"
1405 AC_ARG_ENABLE(video-directfb,
1406 AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=no]]]),
1407 , enable_video_directfb=no)
1408 if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
1411 DIRECTFB_REQUIRED_VERSION=1.0.0
1412 AC_PATH_PROGS(DIRECTFBCONFIG, directfb-config, no, [$prefix/bin:$PATH])
1413 if test x$DIRECTFBCONFIG = xno; then
1414 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1415 if test x$PKG_CONFIG != xno; then
1416 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb; then
1417 DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
1418 DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
1419 DIRECTFB_PREFIX=`$PKG_CONFIG --variable=prefix directfb`
1424 set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'`
1425 NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
1426 set -- `$DIRECTFBCONFIG --version | sed 's/\./ /g'`
1427 HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
1428 if test $HAVE_VERSION -ge $NEED_VERSION; then
1429 DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags`
1430 DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs`
1431 DIRECTFB_PREFIX=`$DIRECTFBCONFIG --prefix`
1435 if test x$video_directfb = xyes; then
1436 # SuSE 11.1 installs directfb-config without directfb-devel
1437 save_CPPFLAGS="$CPPFLAGS"
1438 CPPFLAGS="$CPPFLAGS $DIRECTFB_CFLAGS"
1439 AC_CHECK_HEADER(directfb.h, have_directfb_hdr=yes, have_directfb_hdr=no)
1440 CPPFLAGS="$save_CPPFLAGS"
1441 video_directfb=$have_directfb_hdr
1443 AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support)
1444 AC_MSG_RESULT($video_directfb)
1446 if test x$video_directfb = xyes; then
1447 AC_ARG_ENABLE(directfb-shared,
1448 AC_HELP_STRING([--enable-directfb-shared], [dynamically load directfb support [[default=yes]]]),
1449 , enable_directfb_shared=yes)
1451 AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB, 1, [ ])
1452 AC_DEFINE(SDL_VIDEO_RENDER_DIRECTFB, 1, [ ])
1453 SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
1454 EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"
1456 AC_MSG_CHECKING(for directfb dynamic loading support)
1458 directfb_lib=[`find_lib "libdirectfb.so.*" "$DIRECTFB_LIBS"`]
1459 # | sed 's/.*\/\(.*\)/\1/; q'`]
1460 AC_MSG_WARN("directfb $directfb_lib")
1461 if test x$have_loadso != xyes && \
1462 test x$enable_directfb_shared = xyes; then
1463 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic directfb loading])
1465 if test x$have_loadso = xyes && \
1466 test x$enable_directfb_shared = xyes && test x$directfb_lib != x; then
1468 echo "-- $directfb_lib_spec -> $directfb_lib"
1469 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC, "$directfb_lib", [ ])
1471 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
1473 AC_MSG_RESULT($directfb_shared)
1479 dnl Find FusionSound
1482 AC_ARG_ENABLE(fusionsound,
1483 AC_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]),
1484 , enable_fusionsound=no)
1485 if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then
1488 FUSIONSOUND_REQUIRED_VERSION=1.1.1
1490 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1491 AC_MSG_CHECKING(for FusionSound $FUSIONSOUND_REQUIRED_VERSION support)
1492 if test x$PKG_CONFIG != xno; then
1493 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then
1494 FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound`
1495 FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound`
1499 AC_MSG_RESULT($fusionsound)
1501 if test x$fusionsound = xyes; then
1502 AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND, 1, [ ])
1503 SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c"
1504 EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS"
1506 AC_ARG_ENABLE(fusionsound-shared,
1507 AC_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]),
1508 , enable_fusionsound_shared=yes)
1509 fusionsound_shared=no
1510 AC_MSG_CHECKING(for FusionSound dynamic loading support)
1511 if test x$have_loadso != xyes && \
1512 test x$enable_fusionsound_shared = xyes; then
1513 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading])
1515 if test x$have_loadso = xyes && \
1516 test x$enable_fusionsound_shared = xyes; then
1517 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so", [ ])
1518 fusionsound_shared=yes
1520 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS"
1522 AC_MSG_RESULT($fusionsound_shared)
1529 dnl rcg04172001 Set up the Null video driver.
1532 AC_ARG_ENABLE(video-dummy,
1533 AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]),
1534 , enable_video_dummy=yes)
1535 if test x$enable_video_dummy = xyes; then
1536 AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY, 1, [ ])
1537 SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
1542 dnl Check to see if OpenGL support is desired
1543 AC_ARG_ENABLE(video-opengl,
1544 AC_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]),
1545 , enable_video_opengl=yes)
1550 if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
1551 AC_MSG_CHECKING(for OpenGL (GLX) support)
1560 AC_MSG_RESULT($video_opengl)
1561 if test x$video_opengl = xyes; then
1562 AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
1563 AC_DEFINE(SDL_VIDEO_OPENGL_GLX, 1, [ ])
1564 AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
1569 dnl Check to see if OpenGL ES support is desired
1570 AC_ARG_ENABLE(video-opengles,
1571 AC_HELP_STRING([--enable-video-opengles], [include OpenGL ES support [[default=yes]]]),
1572 , enable_video_opengles=yes)
1577 if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
1578 AC_MSG_CHECKING(for OpenGL ES (EGL) support)
1581 #include <EGL/egl.h>
1586 AC_MSG_RESULT($video_opengles)
1587 if test x$video_opengles = xyes; then
1588 AC_MSG_CHECKING(for OpenGL ES v1 headers)
1589 video_opengles_v1=no
1591 #include <GLES/gl.h>
1592 #include <GLES/glext.h>
1595 video_opengles_v1=yes
1597 AC_MSG_RESULT($video_opengles_v1)
1598 if test x$video_opengles_v1 = xyes; then
1599 AC_DEFINE(SDL_VIDEO_OPENGL_ES, 1, [ ])
1600 AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES, 1, [ ])
1602 AC_MSG_CHECKING(for OpenGL ES v2 headers)
1603 video_opengles_v2=no
1605 #include <GLES2/gl2.h>
1606 #include <GLES2/gl2ext.h>
1609 video_opengles_v2=yes
1611 AC_MSG_RESULT($video_opengles_v2)
1612 if test x$video_opengles_v2 = xyes; then
1613 AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
1614 AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
1620 dnl Check for Windows OpenGL
1623 if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
1624 AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
1625 AC_DEFINE(SDL_VIDEO_OPENGL_WGL, 1, [ ])
1626 AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
1630 dnl Check for BeOS OpenGL
1633 if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
1634 AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
1635 AC_DEFINE(SDL_VIDEO_OPENGL_BGL, 1, [ ])
1636 AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
1637 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
1641 dnl Check for MacOS OpenGL
1644 if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
1645 AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
1646 AC_DEFINE(SDL_VIDEO_OPENGL_CGL, 1, [ ])
1647 AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
1650 if test x$enable_video_cocoa = xyes; then
1651 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGL"
1657 dnl See if we can use the new unified event interface in Linux 2.4
1660 dnl Check for Linux 2.4 unified input event interface support
1661 AC_MSG_CHECKING(for Linux 2.4 unified input interface)
1664 #include <linux/input.h>
1667 #error EVIOCGNAME() ioctl not available
1670 use_input_events=yes
1672 AC_MSG_RESULT($use_input_events)
1673 if test x$use_input_events = xyes; then
1674 AC_DEFINE(SDL_INPUT_LINUXEV, 1, [ ])
1678 dnl See if the platform offers libudev for device enumeration and hotplugging.
1681 AC_ARG_ENABLE(libudev,
1682 AC_HELP_STRING([--enable-libudev], [enable libudev support [[default=yes]]]),
1683 , enable_libudev=yes)
1684 if test x$enable_libudev = xyes; then
1685 AC_CHECK_HEADER(libudev.h,
1686 have_libudev_h_hdr=yes,
1687 have_libudev_h_hdr=no)
1688 if test x$have_libudev_h_hdr = xyes; then
1689 AC_DEFINE(HAVE_LIBUDEV_H, 1, [ ])
1694 dnl See if the platform offers libdbus for various IPC techniques.
1698 AC_HELP_STRING([--enable-dbus], [enable D-Bus support [[default=yes]]]),
1700 if test x$enable_dbus = xyes; then
1701 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1702 if test x$PKG_CONFIG != xno; then
1703 DBUS_CFLAGS=`$PKG_CONFIG --cflags dbus-1`
1704 save_CFLAGS="$CFLAGS"
1705 CFLAGS="$save_CFLAGS $DBUS_CFLAGS"
1706 AC_CHECK_HEADER(dbus/dbus.h,
1707 have_dbus_dbus_h_hdr=yes,
1708 have_dbus_dbus_h_hdr=no)
1709 CFLAGS="$save_CFLAGS"
1710 if test x$have_dbus_dbus_h_hdr = xyes; then
1711 AC_DEFINE(HAVE_DBUS_DBUS_H, 1, [ ])
1712 EXTRA_CFLAGS="$EXTRA_CFLAGS $DBUS_CFLAGS"
1718 dnl See if we can use the Touchscreen input library
1721 AC_ARG_ENABLE(input-tslib,
1722 AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]),
1723 , enable_input_tslib=yes)
1724 if test x$enable_input_tslib = xyes; then
1725 AC_MSG_CHECKING(for Touchscreen library support)
1726 enable_input_tslib=no
1731 enable_input_tslib=yes
1733 AC_MSG_RESULT($enable_input_tslib)
1734 if test x$enable_input_tslib = xyes; then
1735 AC_DEFINE(SDL_INPUT_TSLIB, 1, [ ])
1736 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
1741 dnl See what type of thread model to use on Linux and Solaris
1744 dnl Check for pthread support
1745 AC_ARG_ENABLE(pthreads,
1746 AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]),
1747 , enable_pthreads=yes)
1748 dnl This is used on Linux for glibc binary compatibility (Doh!)
1749 AC_ARG_ENABLE(pthread-sem,
1750 AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
1751 , enable_pthread_sem=yes)
1753 *-*-linux*|*-*-uclinux*)
1754 pthread_cflags="-D_REENTRANT"
1755 pthread_lib="-lpthread"
1758 pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
1762 pthread_cflags="-D_THREAD_SAFE"
1763 # causes Carbon.p complaints?
1764 # pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
1766 *-*-freebsd*|*-*-dragonfly*)
1767 pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
1768 pthread_lib="-pthread"
1771 pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
1772 pthread_lib="-lpthread"
1775 pthread_cflags="-D_REENTRANT"
1776 pthread_lib="-pthread"
1779 # From Solaris 9+, posix4's preferred name is rt.
1780 pthread_cflags="-D_REENTRANT"
1781 pthread_lib="-lpthread -lrt"
1784 # Solaris 10+ merged pthread into libc.
1785 pthread_cflags="-D_REENTRANT"
1789 # Solaris 11+ merged rt into libc.
1790 pthread_cflags="-D_REENTRANT"
1794 pthread_cflags="-D_REENTRANT -Kthread"
1798 pthread_cflags="-D_REENTRANT -mthreads"
1799 pthread_lib="-lpthread"
1802 pthread_cflags="-D_REENTRANT"
1803 pthread_lib="-L/usr/lib -lpthread"
1806 pthread_cflags="-D_REENTRANT"
1807 pthread_lib="-lpthread"
1810 if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
1811 # Save the original compiler flags and libraries
1812 ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
1813 # Add the pthread compiler flags and libraries
1814 CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
1815 # Check to see if we have pthread support on this system
1816 AC_MSG_CHECKING(for pthreads)
1819 #include <pthread.h>
1821 pthread_attr_t type;
1822 pthread_attr_init(&type);
1826 AC_MSG_RESULT($use_pthreads)
1827 # Restore the compiler flags and libraries
1828 CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
1830 # Do futher testing if we have pthread support...
1831 if test x$use_pthreads = xyes; then
1832 AC_DEFINE(SDL_THREAD_PTHREAD, 1, [ ])
1833 EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
1834 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
1835 SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
1836 SDL_LIBS="$SDL_LIBS $pthread_lib"
1838 # Save the original compiler flags and libraries
1839 ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
1840 # Add the pthread compiler flags and libraries
1841 CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
1843 # Check to see if recursive mutexes are available
1844 AC_MSG_CHECKING(for recursive mutexes)
1845 has_recursive_mutexes=no
1846 if test x$has_recursive_mutexes = xno; then
1848 #include <pthread.h>
1850 pthread_mutexattr_t attr;
1851 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
1853 has_recursive_mutexes=yes
1854 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX, 1, [ ])
1857 if test x$has_recursive_mutexes = xno; then
1859 #include <pthread.h>
1861 pthread_mutexattr_t attr;
1862 pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
1864 has_recursive_mutexes=yes
1865 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP, 1, [ ])
1868 AC_MSG_RESULT($has_recursive_mutexes)
1870 # Check to see if pthread semaphore support is missing
1871 if test x$enable_pthread_sem = xyes; then
1872 AC_MSG_CHECKING(for pthread semaphores)
1875 #include <pthread.h>
1876 #include <semaphore.h>
1879 have_pthread_sem=yes
1881 AC_MSG_RESULT($have_pthread_sem)
1883 if test x$have_pthread_sem = xyes; then
1884 AC_MSG_CHECKING(for sem_timedwait)
1885 have_sem_timedwait=no
1887 #include <pthread.h>
1888 #include <semaphore.h>
1890 sem_timedwait(NULL, NULL);
1892 have_sem_timedwait=yes
1893 AC_DEFINE(HAVE_SEM_TIMEDWAIT)
1895 AC_MSG_RESULT($have_sem_timedwait)
1898 AC_MSG_CHECKING(for pthread_spin_trylock)
1899 AC_TRY_LINK_FUNC(pthread_spin_trylock, [
1900 has_pthread_spin_trylock=yes
1901 AC_DEFINE(HAVE_PTHREAD_SPINLOCK, 1, [ ])
1903 has_pthread_spin_trylock=no
1905 AC_MSG_RESULT($has_pthread_spin_trylock)
1907 AC_CHECK_HEADER(pthread_np.h, have_pthread_np_h=yes, have_pthread_np_h=no, [ #include <pthread.h> ])
1908 if test x$have_pthread_np_h = xyes; then
1909 AC_DEFINE(HAVE_PTHREAD_NP_H, 1, [ ])
1912 # Check to see if pthread naming is available
1913 AC_MSG_CHECKING(for pthread_setname_np)
1914 AC_TRY_LINK_FUNC(pthread_setname_np, [
1915 has_pthread_setname_np=yes
1916 AC_DEFINE(HAVE_PTHREAD_SETNAME_NP, 1, [ ])
1918 has_pthread_setname_np=no
1920 AC_MSG_RESULT($has_pthread_setname_np)
1922 AC_MSG_CHECKING(for pthread_set_name_np)
1923 AC_TRY_LINK_FUNC(pthread_set_name_np, [
1924 has_pthread_set_name_np=yes
1925 AC_DEFINE(HAVE_PTHREAD_SET_NAME_NP, 1, [ ])
1927 has_pthread_set_name_np=no
1929 AC_MSG_RESULT($has_pthread_set_name_np)
1931 # Restore the compiler flags and libraries
1932 CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
1934 # Basic thread creation functions
1935 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
1938 # We can fake these with mutexes and condition variables if necessary
1939 if test x$have_pthread_sem = xyes; then
1940 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
1942 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
1946 # We can fake these with semaphores if necessary
1947 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
1949 # Condition variables
1950 # We can fake these with semaphores and mutexes if necessary
1951 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
1958 dnl Determine whether the compiler can produce Windows executables
1961 AC_MSG_CHECKING(Windows compiler)
1964 #include <windows.h>
1969 AC_MSG_RESULT($have_win32_gcc)
1970 if test x$have_win32_gcc != xyes; then
1972 *** Your compiler ($CC) does not produce Windows executables!
1976 AC_MSG_CHECKING(Windows CE)
1979 #if !defined(_WIN32_WCE) && !defined(__MINGW32CE__)
1980 #error This is not Windows CE
1986 *** Sorry, Windows CE is no longer supported.
1989 AC_MSG_RESULT($have_wince)
1991 # This fixes Windows stack alignment with newer GCC
1995 dnl Find the DirectX includes and libraries
1998 AC_ARG_ENABLE(directx,
1999 AC_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[default=yes]]]),
2000 , enable_directx=yes)
2001 if test x$enable_directx = xyes; then
2002 AC_CHECK_HEADER(d3d9.h, have_d3d=yes)
2003 AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
2004 AC_CHECK_HEADER(dsound.h, have_dsound=yes)
2005 AC_CHECK_HEADER(dinput.h, have_dinput=yes)
2006 AC_CHECK_HEADER(xaudio2.h, have_xaudio2=yes)
2010 dnl Check for the dlfcn.h interface for dynamically loading objects
2013 AC_ARG_ENABLE(sdl-dlopen,
2014 AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]),
2015 , enable_sdl_dlopen=yes)
2016 if test x$enable_sdl_dlopen = xyes; then
2017 AC_MSG_CHECKING(for dlopen)
2022 #if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED <= 1020
2023 #error Use dlcompat for Mac OS X 10.2 compatibility
2028 AC_MSG_RESULT($have_dlopen)
2030 if test x$have_dlopen = xyes; then
2031 AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
2032 AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
2033 AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
2034 AC_DEFINE(SDL_LOADSO_DLOPEN, 1, [ ])
2035 SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
2041 dnl Check for the usbhid(3) library on *BSD
2044 if test x$enable_joystick = xyes; then
2045 AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
2046 if test x$have_libusbhid = xyes; then
2047 AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
2048 AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
2049 USB_LIBS="$USB_LIBS -lusbhid"
2051 AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
2052 AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
2053 AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
2056 save_CFLAGS="$CFLAGS"
2057 CFLAGS="$CFLAGS $USB_CFLAGS"
2059 AC_MSG_CHECKING(for usbhid)
2062 #include <sys/types.h>
2063 #if defined(HAVE_USB_H)
2066 #ifdef __DragonFly__
2067 # include <bus/usb/usb.h>
2068 # include <bus/usb/usbhid.h>
2070 # include <dev/usb/usb.h>
2071 # include <dev/usb/usbhid.h>
2073 #if defined(HAVE_USBHID_H)
2075 #elif defined(HAVE_LIBUSB_H)
2077 #elif defined(HAVE_LIBUSBHID_H)
2078 #include <libusbhid.h>
2081 struct report_desc *repdesc;
2082 struct usb_ctl_report *repbuf;
2087 AC_MSG_RESULT($have_usbhid)
2089 if test x$have_usbhid = xyes; then
2090 AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
2091 have_usbhid_ucr_data=no
2093 #include <sys/types.h>
2094 #if defined(HAVE_USB_H)
2097 #ifdef __DragonFly__
2098 # include <bus/usb/usb.h>
2099 # include <bus/usb/usbhid.h>
2101 # include <dev/usb/usb.h>
2102 # include <dev/usb/usbhid.h>
2104 #if defined(HAVE_USBHID_H)
2106 #elif defined(HAVE_LIBUSB_H)
2108 #elif defined(HAVE_LIBUSBHID_H)
2109 #include <libusbhid.h>
2112 struct usb_ctl_report buf;
2113 if (buf.ucr_data) { }
2115 have_usbhid_ucr_data=yes
2117 if test x$have_usbhid_ucr_data = xyes; then
2118 USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
2120 AC_MSG_RESULT($have_usbhid_ucr_data)
2122 AC_MSG_CHECKING(for new usbhid API)
2125 #include <sys/types.h>
2126 #if defined(HAVE_USB_H)
2129 #ifdef __DragonFly__
2130 #include <bus/usb/usb.h>
2131 #include <bus/usb/usbhid.h>
2133 #include <dev/usb/usb.h>
2134 #include <dev/usb/usbhid.h>
2136 #if defined(HAVE_USBHID_H)
2138 #elif defined(HAVE_LIBUSB_H)
2140 #elif defined(HAVE_LIBUSBHID_H)
2141 #include <libusbhid.h>
2145 hid_start_parse(d, 1, 1);
2149 if test x$have_usbhid_new = xyes; then
2150 USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
2152 AC_MSG_RESULT($have_usbhid_new)
2154 AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
2155 have_machine_joystick=no
2157 #include <machine/joystick.h>
2161 have_machine_joystick=yes
2163 if test x$have_machine_joystick = xyes; then
2164 AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H, 1, [ ])
2166 AC_MSG_RESULT($have_machine_joystick)
2168 AC_DEFINE(SDL_JOYSTICK_USBHID, 1, [ ])
2169 SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
2170 EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
2171 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
2174 CFLAGS="$save_CFLAGS"
2178 dnl Check for clock_gettime()
2181 AC_ARG_ENABLE(clock_gettime,
2182 AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=yes]]]),
2183 , enable_clock_gettime=yes)
2184 if test x$enable_clock_gettime = xyes; then
2185 AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
2186 if test x$have_clock_gettime = xyes; then
2187 AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ])
2188 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
2190 AC_CHECK_LIB(c, clock_gettime, have_clock_gettime=yes)
2191 if test x$have_clock_gettime = xyes; then
2192 AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ])
2193 EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
2199 dnl Check for a valid linux/version.h
2202 AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
2203 if test x$have_linux_version_h = xyes; then
2204 EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
2208 dnl Check if we want to use RPATH
2211 AC_ARG_ENABLE(rpath,
2212 AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]),
2216 dnl Set up the configuration based on the host platform!
2218 *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*)
2220 *-*-linux*) ARCH=linux ;;
2221 *-*-uclinux*) ARCH=linux ;;
2222 *-*-kfreebsd*-gnu) ARCH=kfreebsd-gnu ;;
2223 *-*-knetbsd*-gnu) ARCH=knetbsd-gnu ;;
2224 *-*-kopenbsd*-gnu) ARCH=kopenbsd-gnu ;;
2225 *-*-gnu*) ARCH=gnu ;; # must be last of the gnu variants
2226 *-*-bsdi*) ARCH=bsdi ;;
2227 *-*-freebsd*) ARCH=freebsd ;;
2228 *-*-dragonfly*) ARCH=freebsd ;;
2229 *-*-netbsd*) ARCH=netbsd ;;
2230 *-*-openbsd*) ARCH=openbsd ;;
2231 *-*-sysv5*) ARCH=sysv5 ;;
2232 *-*-solaris*) ARCH=solaris ;;
2233 *-*-hpux*) ARCH=hpux ;;
2234 *-*-aix*) ARCH=aix ;;
2235 *-*-minix*) ARCH=minix ;;
2237 CheckVisibilityHidden
2262 # Set up files for the audio library
2263 if test x$enable_audio = xyes; then
2266 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO, 1, [ ])
2267 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
2271 AC_DEFINE(SDL_AUDIO_DRIVER_BSD, 1, [ ])
2272 SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c"
2276 AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO, 1, [ ])
2277 SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
2282 # Set up files for the joystick library
2283 if test x$enable_joystick = xyes; then
2286 AC_DEFINE(SDL_JOYSTICK_LINUX, 1, [ ])
2287 SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
2292 # Set up files for the haptic library
2293 if test x$enable_haptic = xyes; then
2294 if test x$use_input_events = xyes; then
2297 AC_DEFINE(SDL_HAPTIC_LINUX, 1, [ ])
2298 SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c"
2304 # Set up files for the power library
2305 if test x$enable_power = xyes; then
2308 AC_DEFINE(SDL_POWER_LINUX, 1, [ ])
2309 SOURCES="$SOURCES $srcdir/src/power/linux/*.c"
2314 # Set up files for the timer library
2315 if test x$enable_timers = xyes; then
2316 AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
2317 SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
2321 *-*-cygwin* | *-*-mingw32*)
2323 if test "$build" != "$host"; then # cross-compiling
2324 # Default cross-compile location
2325 ac_default_prefix=/usr/local/cross-tools/$host
2327 # Look for the location of the tools and install there
2328 if test "$BUILD_PREFIX" != ""; then
2329 ac_default_prefix=$BUILD_PREFIX
2339 # Set up the core platform files
2340 SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
2342 # Set up files for the video library
2343 if test x$enable_video = xyes; then
2344 AC_DEFINE(SDL_VIDEO_DRIVER_WINDOWS, 1, [ ])
2345 SOURCES="$SOURCES $srcdir/src/video/windows/*.c"
2347 AC_ARG_ENABLE(render-d3d,
2348 AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
2349 , enable_render_d3d=yes)
2350 if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
2351 AC_DEFINE(SDL_VIDEO_RENDER_D3D, 1, [ ])
2354 # Set up files for the audio library
2355 if test x$enable_audio = xyes; then
2356 AC_DEFINE(SDL_AUDIO_DRIVER_WINMM, 1, [ ])
2357 SOURCES="$SOURCES $srcdir/src/audio/winmm/*.c"
2358 if test x$have_dsound = xyes; then
2359 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND, 1, [ ])
2360 SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c"
2362 if test x$have_xaudio2 = xyes; then
2363 AC_DEFINE(SDL_AUDIO_DRIVER_XAUDIO2, 1, [ ])
2364 SOURCES="$SOURCES $srcdir/src/audio/xaudio2/*.c"
2368 # Set up files for the joystick library
2369 if test x$enable_joystick = xyes; then
2370 if test x$have_dinput = xyes; then
2371 AC_DEFINE(SDL_JOYSTICK_DINPUT, 1, [ ])
2372 SOURCES="$SOURCES $srcdir/src/joystick/windows/SDL_dxjoystick.c"
2373 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8"
2375 AC_DEFINE(SDL_JOYSTICK_WINMM, 1, [ ])
2376 SOURCES="$SOURCES $srcdir/src/joystick/windows/SDL_mmjoystick.c"
2380 if test x$enable_haptic = xyes; then
2381 if test x$have_dinput = xyes; then
2382 AC_DEFINE(SDL_HAPTIC_DINPUT, 1, [ ])
2383 SOURCES="$SOURCES $srcdir/src/haptic/windows/SDL_syshaptic.c"
2387 if test x$enable_power = xyes; then
2388 AC_DEFINE(SDL_POWER_WINDOWS, 1, [ ])
2389 SOURCES="$SOURCES $srcdir/src/power/windows/SDL_syspower.c"
2392 # Set up files for the thread library
2393 if test x$enable_threads = xyes; then
2394 AC_DEFINE(SDL_THREAD_WINDOWS, 1, [ ])
2395 SOURCES="$SOURCES $srcdir/src/thread/windows/SDL_sysmutex.c"
2396 SOURCES="$SOURCES $srcdir/src/thread/windows/SDL_syssem.c"
2397 SOURCES="$SOURCES $srcdir/src/thread/windows/SDL_systhread.c"
2398 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
2401 # Set up files for the timer library
2402 if test x$enable_timers = xyes; then
2403 AC_DEFINE(SDL_TIMER_WINDOWS, 1, [ ])
2404 SOURCES="$SOURCES $srcdir/src/timer/windows/*.c"
2407 # Set up files for the shared object loading library
2408 if test x$enable_loadso = xyes; then
2409 AC_DEFINE(SDL_LOADSO_WINDOWS, 1, [ ])
2410 SOURCES="$SOURCES $srcdir/src/loadso/windows/*.c"
2413 # Set up the system libraries we need
2414 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -XCClinker -static-libgcc"
2415 # The Windows platform requires special setup
2416 VERSION_SOURCES="$srcdir/src/main/windows/*.rc"
2417 SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c"
2418 SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
2419 SDL_LIBS="-lmingw32 -lSDL2main $SDL_LIBS -mwindows"
2421 *-*-beos* | *-*-haiku*)
2423 ac_default_prefix=/boot/common
2429 # Set up files for the audio library
2430 if test x$enable_audio = xyes; then
2431 AC_DEFINE(SDL_AUDIO_DRIVER_BEOSAUDIO, 1, [ ])
2432 SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc"
2435 # Set up files for the joystick library
2436 if test x$enable_joystick = xyes; then
2437 AC_DEFINE(SDL_JOYSTICK_BEOS, 1, [ ])
2438 SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc"
2441 # Set up files for the thread library
2442 if test x$enable_threads = xyes; then
2443 AC_DEFINE(SDL_THREAD_BEOS, 1, [ ])
2444 SOURCES="$SOURCES $srcdir/src/thread/beos/*.c"
2445 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
2446 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
2449 # Set up files for the timer library
2450 if test x$enable_timers = xyes; then
2451 AC_DEFINE(SDL_TIMER_BEOS, 1, [ ])
2452 SOURCES="$SOURCES $srcdir/src/timer/beos/*.c"
2455 # Set up files for the shared object loading library
2456 if test x$enable_loadso = xyes; then
2457 AC_DEFINE(SDL_LOADSO_BEOS, 1, [ ])
2458 SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
2461 # Set up files for the system power library
2462 if test x$enable_power = xyes; then
2463 AC_DEFINE(SDL_POWER_BEOS, 1, [ ])
2464 SOURCES="$SOURCES $srcdir/src/power/beos/*.c"
2467 # The BeOS platform requires special setup.
2468 SOURCES="$srcdir/src/main/beos/*.cc $SOURCES"
2469 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
2472 # iOS - We are not writing anything to confdefs.h because you have to replace
2473 # SDL_config.h for SDL_config_iphoneos.h anyway
2476 CheckVisibilityHidden
2485 # Set up files for the audio library
2486 if test x$enable_audio = xyes; then
2487 SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.c"
2490 # Set up files for the joystick library
2491 if test x$enable_joystick = xyes; then
2492 SOURCES="$SOURCES $srcdir/src/joystick/iphoneos/*.m"
2495 # Set up files for the haptic library
2496 #if test x$enable_haptic = xyes; then
2497 # SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
2499 # EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
2501 # Set up files for the power library
2502 if test x$enable_power = xyes; then
2503 SOURCES="$SOURCES $srcdir/src/power/uikit/*.m"
2506 # Set up files for the timer library
2507 if test x$enable_timers = xyes; then
2508 SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
2511 # Set up additional files for the file library
2512 if test x$enable_file = xyes; then
2513 SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
2515 # The iOS platform requires special setup.
2516 SOURCES="$SOURCES $srcdir/src/video/uikit/*.m"
2517 SOURCES="$SOURCES $srcdir/src/video/uikit/*.c"
2518 EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
2519 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc"
2520 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Foundation"
2521 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit"
2522 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGLES"
2523 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore"
2524 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio"
2525 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox"
2526 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreGraphics"
2529 # This could be either full "Mac OS X", or plain "Darwin" which is
2530 # just the OS X kernel sans upper layers like Carbon and Cocoa.
2531 # Next line is broken, and a few files below require Mac OS X (full)
2534 # Mac OS X builds with both the Carbon and OSX APIs at the moment
2535 EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
2536 EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
2538 CheckVisibilityHidden
2549 # Good optimization on Mac OS X, yes...
2550 EXTRA_CFLAGS="$EXTRA_CFLAGS -falign-loops=16"
2552 # Need this or things might misbuild on a G3.
2553 EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"
2555 # Set up files for the audio library
2556 if test x$enable_audio = xyes; then
2557 AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ])
2558 SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.c"
2561 # Set up files for the joystick library
2562 if test x$enable_joystick = xyes; then
2563 AC_DEFINE(SDL_JOYSTICK_IOKIT, 1, [ ])
2564 SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
2567 # Set up files for the haptic library
2568 if test x$enable_haptic = xyes; then
2569 AC_DEFINE(SDL_HAPTIC_IOKIT, 1, [ ])
2570 SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
2572 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
2574 # Set up files for the power library
2575 if test x$enable_power = xyes; then
2576 AC_DEFINE(SDL_POWER_MACOSX, 1, [ ])
2577 SOURCES="$SOURCES $srcdir/src/power/macosx/*.c"
2580 # Set up files for the timer library
2581 if test x$enable_timers = xyes; then
2582 AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
2583 SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
2586 # Set up additional files for the file library
2587 if test x$enable_file = xyes; then
2588 SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
2590 # The Mac OS X platform requires special setup.
2591 EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
2592 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc"
2593 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
2594 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
2595 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
2596 # If audio is used, add the AudioUnit framework
2597 if test x$enable_audio = xyes; then
2598 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit"
2603 *** Unsupported host: Please add to configure.in
2608 dnl Do this on all platforms, after everything else.
2611 # Verify that we have all the platform specific files we need
2613 if test x$have_joystick != xyes; then
2614 if test x$enable_joystick = xyes; then
2615 AC_DEFINE(SDL_JOYSTICK_DISABLED, 1, [ ])
2617 SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
2619 if test x$have_haptic != xyes; then
2620 if test x$enable_haptic = xyes; then
2621 AC_DEFINE(SDL_HAPTIC_DISABLED, 1, [ ])
2623 SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
2625 if test x$have_threads != xyes; then
2626 if test x$enable_threads = xyes; then
2627 AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ])
2629 SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
2631 if test x$have_timers != xyes; then
2632 if test x$enable_timers = xyes; then
2633 AC_DEFINE(SDL_TIMERS_DISABLED, 1, [ ])
2635 SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
2637 if test x$have_loadso != xyes; then
2638 if test x$enable_loadso = xyes; then
2639 AC_DEFINE(SDL_LOADSO_DISABLED, 1, [ ])
2641 SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
2643 if test x$SDLMAIN_SOURCES = x; then
2644 SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
2646 SDLTEST_SOURCES="$srcdir/src/test/*.c"
2648 OBJECTS=`echo $SOURCES`
2649 DEPENDS=`echo $SOURCES | tr ' ' '\n'`
2650 for EXT in asm cc m c S; do
2651 OBJECTS=`echo "$OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.'$EXT',$(objects)/\1.lo,g'`
2652 DEPENDS=`echo "$DEPENDS" | sed "s,^\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.$EXT\\$,\\\\
2653 \\$(objects)/\\2.lo: \\1/\\2.$EXT\\\\
2654 \\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
2657 VERSION_OBJECTS=`echo $VERSION_SOURCES`
2658 VERSION_DEPENDS=`echo $VERSION_SOURCES`
2659 VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
2660 VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.rc,\\\\
2661 \\$(objects)/\\2.o: \\1/\\2.rc\\\\
2662 \\$(WINDRES) \\$< \\$@,g"`
2664 SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES`
2665 SDLMAIN_DEPENDS=`echo $SDLMAIN_SOURCES`
2666 SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
2667 SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
2668 \\$(objects)/\\2.o: \\1/\\2.c\\\\
2669 \\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
2671 SDLTEST_OBJECTS=`echo $SDLTEST_SOURCES`
2672 SDLTEST_DEPENDS=`echo $SDLTEST_SOURCES`
2673 SDLTEST_OBJECTS=`echo "$SDLTEST_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
2674 SDLTEST_DEPENDS=`echo "$SDLTEST_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
2675 \\$(objects)/\\2.o: \\1/\\2.c\\\\
2676 \\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
2678 # Set runtime shared library paths as needed
2680 if test "x$enable_rpath" = "xyes"; then
2681 if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then
2682 SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
2684 if test $ARCH = solaris; then
2685 SDL_RLD_FLAGS="-R\${libdir}"
2691 SDL_STATIC_LIBS="$SDL_LIBS $EXTRA_LDFLAGS"
2693 dnl Expand the cflags and libraries needed by apps using SDL
2694 AC_SUBST(SDL_CFLAGS)
2696 AC_SUBST(SDL_STATIC_LIBS)
2697 AC_SUBST(SDL_RLD_FLAGS)
2698 if test x$enable_shared = xyes; then
2700 ENABLE_SHARED_FALSE="#"
2702 ENABLE_SHARED_TRUE="#"
2703 ENABLE_SHARED_FALSE=
2705 if test x$enable_static = xyes; then
2707 ENABLE_STATIC_FALSE="#"
2709 ENABLE_STATIC_TRUE="#"
2710 ENABLE_STATIC_FALSE=
2712 AC_SUBST(ENABLE_SHARED_TRUE)
2713 AC_SUBST(ENABLE_SHARED_FALSE)
2714 AC_SUBST(ENABLE_STATIC_TRUE)
2715 AC_SUBST(ENABLE_STATIC_FALSE)
2717 dnl Expand the sources and objects needed to build the library
2718 AC_SUBST(ac_aux_dir)
2721 AC_SUBST(VERSION_OBJECTS)
2722 AC_SUBST(SDLMAIN_OBJECTS)
2723 AC_SUBST(SDLTEST_OBJECTS)
2724 AC_SUBST(BUILD_CFLAGS)
2725 AC_SUBST(EXTRA_CFLAGS)
2726 AC_SUBST(BUILD_LDFLAGS)
2727 AC_SUBST(EXTRA_LDFLAGS)
2730 cat >Makefile.rules <<__EOF__
2732 # Build rules for objects
2733 -include \$(OBJECTS:.lo=.d)
2735 # Special dependency for SDL.c, since it depends on SDL_revision.h
2736 $srcdir/src/SDL.c: update-revision
2744 Makefile:Makefile.in:Makefile.rules sdl2-config SDL2.spec sdl2.pc
2747 chmod a+x sdl2-config