1 dnl Process this file with autoconf to produce a configure script.
3 AC_CONFIG_HEADER(include/SDL_config.h)
5 AC_CONFIG_AUX_DIRS($srcdir/build-scripts)
7 dnl Save the CFLAGS to see whether they were passed in or generated
10 dnl Set various version strings - taken gratefully from the GTk sources
13 # Edit include/SDL/SDL_version.h and change the version, then:
14 # SDL_MICRO_VERSION += 1;
15 # SDL_INTERFACE_AGE += 1;
16 # SDL_BINARY_AGE += 1;
17 # if any functions have been added, set SDL_INTERFACE_AGE to 0.
18 # if backwards compatibility has been broken,
19 # set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0.
26 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
28 AC_SUBST(SDL_MAJOR_VERSION)
29 AC_SUBST(SDL_MINOR_VERSION)
30 AC_SUBST(SDL_MICRO_VERSION)
31 AC_SUBST(SDL_INTERFACE_AGE)
32 AC_SUBST(SDL_BINARY_AGE)
38 LT_RELEASE=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION
39 LT_CURRENT=`expr $SDL_MICRO_VERSION - $SDL_INTERFACE_AGE`
40 LT_REVISION=$SDL_INTERFACE_AGE
41 LT_AGE=`expr $SDL_BINARY_AGE - $SDL_INTERFACE_AGE`
42 m4_pattern_allow([^LT_])
49 dnl Detect the canonical build and host environments
58 if test -z "$host_alias"; then
61 hostaliaswindres="$host_alias-windres"
63 AC_CHECK_PROGS(WINDRES, [windres $hostaliaswindres $host_os-windres])
65 dnl Set up the compiler and linker flags
66 INCLUDE="-I$srcdir/include"
67 if test x$srcdir != x.; then
68 # Remove SDL_config.h from the source directory, since it's the
69 # default one, and we want to include the one that we generate.
70 if test -f $srcdir/include/SDL_config.h; then
71 rm $srcdir/include/SDL_config.h
73 INCLUDE="-Iinclude $INCLUDE"
77 # We build SDL on cygwin without the UNIX emulation layer
78 BASE_CFLAGS="-I/usr/include/mingw -mno-cygwin"
79 BASE_LDFLAGS="-mno-cygwin"
86 BUILD_CFLAGS="$CFLAGS $CPPFLAGS"
87 # The default optimization for SDL 1.3 is -O3 (Bug #31)
88 if test x$orig_CFLAGS = x; then
89 BUILD_CFLAGS=`echo $BUILD_CFLAGS | sed 's/-O2/-O3/'`
91 EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS"
92 BUILD_LDFLAGS="$LDFLAGS"
93 EXTRA_LDFLAGS="$BASE_LDFLAGS"
94 ## These are common directories to find software packages
95 #for path in /usr/freeware /usr/pkg /usr/X11R6 /usr/local; do
96 # if test -d $path/include; then
97 # EXTRA_CFLAGS="$EXTRA_CFLAGS -I$path/include"
99 # if test -d $path/lib; then
100 # EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$path/lib"
103 SDL_CFLAGS="$BASE_CFLAGS"
104 SDL_LIBS="-lSDL $BASE_LDFLAGS"
105 CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS"
106 CFLAGS="$CFLAGS $EXTRA_CFLAGS"
107 LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
109 dnl set this to use on systems that use lib64 instead of lib
110 base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
112 dnl Function to find a library in the compiler search path
115 gcc_bin_path=[`$CC -print-search-dirs 2>/dev/null | fgrep programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
116 gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
117 env_lib_path=[`echo $LIBS $LDFLAGS $* | sed 's/-L[ ]*//g'`]
118 if test "$cross_compiling" = yes; then
121 host_lib_path="/usr/$base_libdir /usr/local/$base_libdir"
123 for path in $gcc_bin_path $gcc_lib_path $env_lib_path $host_lib_path; do
124 lib=[`ls -- $path/$1 2>/dev/null | sort | sed 's/.*\/\(.*\)/\1/; q'`]
125 if test x$lib != x; then
132 dnl Check for compiler characteristics
137 dnl See whether we want assertions for debugging/sanity checking SDL itself.
138 AC_ARG_ENABLE(assertions,
139 AC_HELP_STRING([--enable-assertions],
140 [Enable internal sanity checks (auto/disabled/release/enabled/paranoid) [[default=auto]]]),
141 , enable_assertions=auto)
142 case "$enable_assertions" in
143 auto) # Use optimization settings to determine assertion level
146 AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 0)
149 AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 1)
152 AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 2)
155 AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 3)
158 AC_MSG_ERROR([*** unknown assertion level. stop.])
162 dnl See whether we can use gcc style dependency tracking
163 AC_ARG_ENABLE(dependency-tracking,
164 AC_HELP_STRING([--enable-dependency-tracking],
165 [Use gcc -MMD -MT dependency tracking [[default=yes]]]),
166 , enable_dependency_tracking=yes)
167 if test x$enable_dependency_tracking = xyes; then
169 AC_MSG_CHECKING(for GCC -MMD -MT option)
171 #if !defined(__GNUC__) || __GNUC__ < 3
172 #error Dependency tracking requires GCC 3.0 or newer
178 AC_MSG_RESULT($have_gcc_mmd_mt)
180 if test x$have_gcc_mmd_mt = xyes; then
181 DEPENDENCY_TRACKING_OPTIONS="-MMD -MT \$@"
185 dnl See whether we are allowed to use the system C library
187 AC_HELP_STRING([--enable-libc], [Use the system C library [[default=yes]]]),
189 if test x$enable_libc = xyes; then
192 dnl Check for C library headers
194 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)
196 dnl Check for typedefs, structures, etc.
198 if test x$ac_cv_header_inttypes_h = xyes -o x$ac_cv_header_stdint_h = xyes; then
199 AC_CHECK_TYPE(int64_t)
200 if test x$ac_cv_type_int64_t = xyes; then
201 AC_DEFINE(SDL_HAS_64BIT_TYPE)
206 dnl Check for defines
207 AC_CHECK_DEFINE(M_PI, math.h)
209 dnl Checks for library functions.
211 *-*-cygwin* | *-*-mingw32*)
219 if test x$ac_cv_func_memcmp_working = xyes; then
220 AC_DEFINE(HAVE_MEMCMP)
223 if test x$ac_cv_func_strtod = xyes; then
224 AC_DEFINE(HAVE_STRTOD)
226 AC_CHECK_FUNC(mprotect,
228 #include <sys/types.h>
229 #include <sys/mman.h>
232 AC_DEFINE(HAVE_MPROTECT)
235 AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp sscanf snprintf vsnprintf sigaction setjmp nanosleep sysconf sysctlbyname)
237 AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
238 AC_CHECK_FUNCS(atan atan2 ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt)
240 AC_CHECK_LIB(iconv, libiconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"])
241 AC_CHECK_FUNCS(iconv)
244 AC_CHECK_SIZEOF(void*)
245 if test x$have_inttypes != xyes; then
246 AC_CHECK_SIZEOF(char, 1)
247 AC_CHECK_SIZEOF(short, 2)
248 AC_CHECK_SIZEOF(int, 4)
249 AC_CHECK_SIZEOF(long, 4)
250 AC_CHECK_SIZEOF(long long, 8)
251 if test x$ac_cv_sizeof_char = x1; then
252 AC_DEFINE(int8_t, signed char)
253 AC_DEFINE(uint8_t, unsigned char)
255 if test x$ac_cv_sizeof_short = x2; then
256 AC_DEFINE(int16_t, signed short)
257 AC_DEFINE(uint16_t, unsigned short)
259 if test x$ac_cv_sizeof_int = x2; then
260 AC_DEFINE(int16_t, signed int)
261 AC_DEFINE(uint16_t, unsigned int)
264 if test x$ac_cv_sizeof_int = x4; then
265 AC_DEFINE(int32_t, signed int)
266 AC_DEFINE(uint32_t, unsigned int)
268 if test x$ac_cv_sizeof_long = x4; then
269 AC_DEFINE(int32_t, signed long)
270 AC_DEFINE(uint32_t, unsigned long)
273 if test x$ac_cv_sizeof_long = x8; then
274 AC_DEFINE(int64_t, signed long)
275 AC_DEFINE(uint64_t, unsigned long)
276 AC_DEFINE(SDL_HAS_64BIT_TYPE)
278 if test x$ac_cv_sizeof_long_long = x8; then
279 AC_DEFINE(int64_t, signed long long)
280 AC_DEFINE(uint64_t, unsigned long long)
281 AC_DEFINE(SDL_HAS_64BIT_TYPE)
284 AC_DEFINE(size_t, unsigned int)
285 AC_DEFINE(uintptr_t, unsigned long)
289 SOURCES="$SOURCES $srcdir/src/*.c"
290 SOURCES="$SOURCES $srcdir/src/audio/*.c"
291 SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c"
292 SOURCES="$SOURCES $srcdir/src/events/*.c"
293 SOURCES="$SOURCES $srcdir/src/file/*.c"
294 SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
295 SOURCES="$SOURCES $srcdir/src/thread/*.c"
296 SOURCES="$SOURCES $srcdir/src/timer/*.c"
297 SOURCES="$SOURCES $srcdir/src/video/*.c"
299 dnl Enable/disable various subsystems of the SDL library
301 AC_ARG_ENABLE(atomic,
302 AC_HELP_STRING([--enable-atomic], [Enable the atomic operations subsystem [[default=yes]]]),
304 if test x$enable_atomic != xyes; then
305 AC_DEFINE(SDL_ATOMIC_DISABLED)
308 AC_HELP_STRING([--enable-audio], [Enable the audio subsystem [[default=yes]]]),
310 if test x$enable_audio != xyes; then
311 AC_DEFINE(SDL_AUDIO_DISABLED)
314 AC_HELP_STRING([--enable-video], [Enable the video subsystem [[default=yes]]]),
316 if test x$enable_video != xyes; then
317 AC_DEFINE(SDL_VIDEO_DISABLED)
319 AC_ARG_ENABLE(events,
320 AC_HELP_STRING([--enable-events], [Enable the events subsystem [[default=yes]]]),
322 if test x$enable_events != xyes; then
323 AC_DEFINE(SDL_EVENTS_DISABLED)
325 AC_ARG_ENABLE(joystick,
326 AC_HELP_STRING([--enable-joystick], [Enable the joystick subsystem [[default=yes]]]),
327 , enable_joystick=yes)
328 if test x$enable_joystick != xyes; then
329 AC_DEFINE(SDL_JOYSTICK_DISABLED)
331 SOURCES="$SOURCES $srcdir/src/joystick/*.c"
333 AC_ARG_ENABLE(haptic,
334 AC_HELP_STRING([--enable-haptic], [Enable the haptic (force feedback) subsystem [[default=yes]]]),
336 if test x$enable_haptic != xyes; then
337 AC_DEFINE(SDL_HAPTIC_DISABLED)
339 SOURCES="$SOURCES $srcdir/src/haptic/*.c"
342 AC_HELP_STRING([--enable-power], [Enable the power subsystem [[default=yes]]]),
344 if test x$enable_power != xyes; then
345 AC_DEFINE(SDL_POWER_DISABLED)
347 SOURCES="$SOURCES $srcdir/src/power/*.c"
349 AC_ARG_ENABLE(threads,
350 AC_HELP_STRING([--enable-threads], [Enable the threading subsystem [[default=yes]]]),
351 , enable_threads=yes)
352 if test x$enable_threads != xyes; then
353 AC_DEFINE(SDL_THREADS_DISABLED)
355 AC_ARG_ENABLE(timers,
356 AC_HELP_STRING([--enable-timers], [Enable the timer subsystem [[default=yes]]]),
358 if test x$enable_timers != xyes; then
359 AC_DEFINE(SDL_TIMERS_DISABLED)
362 AC_HELP_STRING([--enable-file], [Enable the file subsystem [[default=yes]]]),
364 if test x$enable_file != xyes; then
365 AC_DEFINE(SDL_FILE_DISABLED)
367 AC_ARG_ENABLE(loadso,
368 AC_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [[default=yes]]]),
370 if test x$enable_loadso != xyes; then
371 AC_DEFINE(SDL_LOADSO_DISABLED)
373 AC_ARG_ENABLE(cpuinfo,
374 AC_HELP_STRING([--enable-cpuinfo], [Enable the cpuinfo subsystem [[default=yes]]]),
375 , enable_cpuinfo=yes)
376 if test x$enable_cpuinfo != xyes; then
377 AC_DEFINE(SDL_CPUINFO_DISABLED)
379 AC_ARG_ENABLE(assembly,
380 AC_HELP_STRING([--enable-assembly], [Enable assembly routines [[default=yes]]]),
381 , enable_assembly=yes)
382 if test x$enable_assembly = xyes; then
383 AC_DEFINE(SDL_ASSEMBLY_ROUTINES)
385 # Make sure that we don't generate floating point code that would
386 # cause illegal instruction exceptions on older processors
389 # Don't need to worry about Apple hardware, it's all SSE capable
393 # x86 64-bit architectures all have SSE instructions
400 AC_ARG_ENABLE(ssemath,
401 AC_HELP_STRING([--enable-ssemath], [Allow GCC to use SSE floating point math [[default=no]]]),
402 , enable_ssemath=$default_ssemath)
403 if test x$enable_ssemath = xno; then
404 if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes; then
405 EXTRA_CFLAGS="$EXTRA_CFLAGS -mfpmath=387"
409 dnl Check for various instruction support
411 AC_HELP_STRING([--enable-mmx], [use MMX assembly routines [[default=yes]]]),
413 if test x$enable_mmx = xyes; then
414 save_CFLAGS="$CFLAGS"
416 AC_MSG_CHECKING(for GCC -mmmx option)
418 CFLAGS="$save_CFLAGS $mmx_CFLAGS"
423 #ifdef __MINGW64_VERSION_MAJOR
426 #include <mmintrin.h>
429 #include <mmintrin.h>
432 #error Assembler CPP flag not enabled
438 AC_MSG_RESULT($have_gcc_mmx)
439 CFLAGS="$save_CFLAGS"
441 if test x$have_gcc_mmx = xyes; then
442 EXTRA_CFLAGS="$EXTRA_CFLAGS $mmx_CFLAGS"
447 AC_HELP_STRING([--enable-3dnow], [use MMX assembly routines [[default=yes]]]),
449 if test x$enable_3dnow = xyes; then
450 save_CFLAGS="$CFLAGS"
452 AC_MSG_CHECKING(for GCC -m3dnow option)
453 amd3dnow_CFLAGS="-m3dnow"
454 CFLAGS="$save_CFLAGS $amd3dnow_CFLAGS"
459 #error Assembler CPP flag not enabled
465 AC_MSG_RESULT($have_gcc_3dnow)
466 CFLAGS="$save_CFLAGS"
468 if test x$have_gcc_3dnow = xyes; then
469 EXTRA_CFLAGS="$EXTRA_CFLAGS $amd3dnow_CFLAGS"
474 AC_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]),
476 if test x$enable_sse = xyes; then
477 save_CFLAGS="$CFLAGS"
479 AC_MSG_CHECKING(for GCC -msse option)
481 CFLAGS="$save_CFLAGS $sse_CFLAGS"
486 #ifdef __MINGW64_VERSION_MAJOR
489 #include <xmmintrin.h>
492 #include <xmmintrin.h>
495 #error Assembler CPP flag not enabled
501 AC_MSG_RESULT($have_gcc_sse)
502 CFLAGS="$save_CFLAGS"
504 if test x$have_gcc_sse = xyes; then
505 EXTRA_CFLAGS="$EXTRA_CFLAGS $sse_CFLAGS"
510 AC_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=no]]]),
511 , enable_sse2=$default_ssemath)
512 if test x$enable_sse2 = xyes; then
513 save_CFLAGS="$CFLAGS"
515 AC_MSG_CHECKING(for GCC -msse2 option)
517 CFLAGS="$save_CFLAGS $sse2_CFLAGS"
522 #ifdef __MINGW64_VERSION_MAJOR
525 #include <emmintrin.h>
528 #include <emmintrin.h>
531 #error Assembler CPP flag not enabled
537 AC_MSG_RESULT($have_gcc_sse2)
538 CFLAGS="$save_CFLAGS"
540 if test x$have_gcc_sse2 = xyes; then
541 EXTRA_CFLAGS="$EXTRA_CFLAGS $sse2_CFLAGS"
545 AC_ARG_ENABLE(altivec,
546 AC_HELP_STRING([--enable-altivec], [use Altivec assembly routines [[default=yes]]]),
547 , enable_altivec=yes)
548 if test x$enable_altivec = xyes; then
549 save_CFLAGS="$CFLAGS"
551 have_altivec_h_hdr=no
552 altivec_CFLAGS="-maltivec"
553 CFLAGS="$save_CFLAGS $altivec_CFLAGS"
555 AC_MSG_CHECKING(for Altivec with GCC altivec.h and -maltivec option)
558 vector unsigned int vzero() {
559 return vec_splat_u32(0);
564 have_altivec_h_hdr=yes
566 AC_MSG_RESULT($have_gcc_altivec)
568 if test x$have_gcc_altivec = xno; then
569 AC_MSG_CHECKING(for Altivec with GCC -maltivec option)
571 vector unsigned int vzero() {
572 return vec_splat_u32(0);
578 AC_MSG_RESULT($have_gcc_altivec)
581 if test x$have_gcc_altivec = xno; then
582 AC_MSG_CHECKING(for Altivec with GCC altivec.h and -faltivec option)
583 altivec_CFLAGS="-faltivec"
584 CFLAGS="$save_CFLAGS $altivec_CFLAGS"
587 vector unsigned int vzero() {
588 return vec_splat_u32(0);
593 have_altivec_h_hdr=yes
595 AC_MSG_RESULT($have_gcc_altivec)
598 if test x$have_gcc_altivec = xno; then
599 AC_MSG_CHECKING(for Altivec with GCC -faltivec option)
601 vector unsigned int vzero() {
602 return vec_splat_u32(0);
608 AC_MSG_RESULT($have_gcc_altivec)
610 CFLAGS="$save_CFLAGS"
612 if test x$have_gcc_altivec = xyes; then
613 AC_DEFINE(SDL_ALTIVEC_BLITTERS)
614 if test x$have_altivec_h_hdr = xyes; then
615 AC_DEFINE(HAVE_ALTIVEC_H)
617 EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS"
622 dnl See if the OSS audio interface is supported
626 AC_HELP_STRING([--enable-oss], [support the OSS audio API [[default=yes]]]),
628 if test x$enable_audio = xyes -a x$enable_oss = xyes; then
629 AC_MSG_CHECKING(for OSS audio support)
631 if test x$have_oss != xyes; then
633 #include <sys/soundcard.h>
635 int arg = SNDCTL_DSP_SETFRAGMENT;
640 if test x$have_oss != xyes; then
642 #include <soundcard.h>
644 int arg = SNDCTL_DSP_SETFRAGMENT;
647 AC_DEFINE(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H)
650 AC_MSG_RESULT($have_oss)
651 if test x$have_oss = xyes; then
652 AC_DEFINE(SDL_AUDIO_DRIVER_OSS)
653 SOURCES="$SOURCES $srcdir/src/audio/dsp/*.c"
654 SOURCES="$SOURCES $srcdir/src/audio/dma/*.c"
657 # We may need to link with ossaudio emulation library
659 *-*-openbsd*|*-*-netbsd*)
660 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";;
666 dnl See if the ALSA audio interface is supported
670 AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [[default=yes]]]),
672 if test x$enable_audio = xyes -a x$enable_alsa = xyes; then
673 AM_PATH_ALSA(0.9.0, have_alsa=yes, have_alsa=no)
674 # Restore all flags from before the ALSA detection runs
675 CFLAGS="$alsa_save_CFLAGS"
676 LDFLAGS="$alsa_save_LDFLAGS"
677 LIBS="$alsa_save_LIBS"
678 if test x$have_alsa = xyes; then
679 AC_ARG_ENABLE(alsa-shared,
680 AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [[default=yes]]]),
681 , enable_alsa_shared=yes)
682 alsa_lib=[`find_lib "libasound.so.*" "$ALSA_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
684 AC_DEFINE(SDL_AUDIO_DRIVER_ALSA)
685 SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c"
686 EXTRA_CFLAGS="$EXTRA_CFLAGS $ALSA_CFLAGS"
687 if test x$have_loadso != xyes && \
688 test x$enable_alsa_shared = xyes; then
689 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ALSA loading])
691 if test x$have_loadso = xyes && \
692 test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
693 echo "-- dynamic libasound -> $alsa_lib"
694 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ALSA_DYNAMIC, "$alsa_lib")
696 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ALSA_LIBS"
703 dnl Check whether we want to use IRIX 6.5+ native audio or not
706 if test x$enable_audio = xyes; then
707 AC_MSG_CHECKING(for dmedia audio support)
710 #include <dmedia/audio.h>
716 AC_MSG_RESULT($have_dmedia)
717 # Set up files for the audio library
718 if test x$have_dmedia = xyes; then
719 AC_DEFINE(SDL_AUDIO_DRIVER_DMEDIA)
720 SOURCES="$SOURCES $srcdir/src/audio/dmedia/*.c"
721 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -laudio"
727 dnl Check whether we want to use Tru64 UNIX native audio or not
730 dnl Make sure we are running on an Tru64 UNIX
738 if test x$enable_audio = xyes; then
739 AC_MSG_CHECKING(for MME audio support)
740 MME_CFLAGS="-I/usr/include/mme"
743 save_CFLAGS="$CFLAGS"
744 CFLAGS="$CFLAGS $MME_CFLAGS"
752 CFLAGS="$save_CFLAGS"
753 AC_MSG_RESULT($have_mme)
754 # Set up files for the audio library
755 if test x$have_mme = xyes; then
756 AC_DEFINE(SDL_AUDIO_DRIVER_MMEAUDIO)
757 SOURCES="$SOURCES $srcdir/src/audio/mme/*.c"
758 EXTRA_CFLAGS="$EXTRA_CFLAGS $MME_CFLAGS"
759 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MME_LIBS"
765 dnl Find the ESD includes and libraries
769 AC_HELP_STRING([--enable-esd], [support the Enlightened Sound Daemon [[default=yes]]]),
771 if test x$enable_audio = xyes -a x$enable_esd = xyes; then
772 AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no)
773 if test x$have_esd = xyes; then
774 AC_ARG_ENABLE(esd-shared,
775 AC_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [[default=yes]]]),
776 , enable_esd_shared=yes)
777 esd_lib=[`find_lib "libesd.so.*" "$ESD_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
779 AC_DEFINE(SDL_AUDIO_DRIVER_ESD)
780 SOURCES="$SOURCES $srcdir/src/audio/esd/*.c"
781 EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS"
782 if test x$have_loadso != xyes && \
783 test x$enable_esd_shared = xyes; then
784 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ESD loading])
786 if test x$have_loadso = xyes && \
787 test x$enable_esd_shared = xyes && test x$esd_lib != x; then
788 echo "-- dynamic libesd -> $esd_lib"
789 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ESD_DYNAMIC, "$esd_lib")
791 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ESD_LIBS"
801 AC_ARG_ENABLE(pulseaudio,
802 AC_HELP_STRING([--enable-pulseaudio], [use PulseAudio [[default=yes]]]),
803 , enable_pulseaudio=yes)
804 if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then
807 PULSEAUDIO_REQUIRED_VERSION=0.9
809 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
810 AC_MSG_CHECKING(for PulseAudio $PULSEAUDIO_REQUIRED_VERSION support)
811 if test x$PKG_CONFIG != xno; then
812 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSEAUDIO_REQUIRED_VERSION libpulse-simple; then
813 PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple`
814 PULSEAUDIO_LIBS=`$PKG_CONFIG --libs libpulse-simple`
818 AC_MSG_RESULT($audio_pulseaudio)
820 if test x$audio_pulseaudio = xyes; then
821 AC_ARG_ENABLE(pulseaudio-shared,
822 AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [[default=yes]]]),
823 , enable_pulseaudio_shared=yes)
824 pulseaudio_lib=[`find_lib "libpulse-simple.so.*" "$PULSEAUDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
826 AC_DEFINE(SDL_AUDIO_DRIVER_PULSEAUDIO)
827 SOURCES="$SOURCES $srcdir/src/audio/pulseaudio/*.c"
828 EXTRA_CFLAGS="$EXTRA_CFLAGS $PULSEAUDIO_CFLAGS"
829 if test x$have_loadso != xyes && \
830 test x$enable_pulseaudio_shared = xyes; then
831 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic PulseAudio loading])
833 if test x$have_loadso = xyes && \
834 test x$enable_pulseaudio_shared = xyes && test x$pulseaudio_lib != x; then
835 echo "-- dynamic libpulse-simple -> $pulseaudio_lib"
836 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC, "$pulseaudio_lib")
838 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PULSEAUDIO_LIBS"
848 AC_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [[default=yes]]]),
850 if test x$enable_audio = xyes -a x$enable_arts = xyes; then
851 AC_PATH_PROG(ARTSCONFIG, artsc-config)
852 if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then
853 : # arts isn't installed
855 ARTS_CFLAGS=`$ARTSCONFIG --cflags`
856 ARTS_LIBS=`$ARTSCONFIG --libs`
857 AC_MSG_CHECKING(for aRts development environment)
859 save_CFLAGS="$CFLAGS"
860 CFLAGS="$CFLAGS $ARTS_CFLAGS"
864 arts_stream_t stream;
868 CFLAGS="$save_CFLAGS"
869 AC_MSG_RESULT($audio_arts)
870 if test x$audio_arts = xyes; then
871 AC_ARG_ENABLE(arts-shared,
872 AC_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [[default=yes]]]),
873 , enable_arts_shared=yes)
874 arts_lib=[`find_lib "libartsc.so.*" "$ARTS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
876 AC_DEFINE(SDL_AUDIO_DRIVER_ARTS)
877 SOURCES="$SOURCES $srcdir/src/audio/arts/*.c"
878 EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS"
879 if test x$have_loadso != xyes && \
880 test x$enable_arts_shared = xyes; then
881 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ARTS loading])
883 if test x$have_loadso = xyes && \
884 test x$enable_arts_shared = xyes && test x$arts_lib != x; then
885 echo "-- dynamic libartsc -> $arts_lib"
886 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ARTS_DYNAMIC, "$arts_lib")
888 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS"
896 dnl See if the NAS audio interface is supported
900 AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]),
902 if test x$enable_audio = xyes -a x$enable_nas = xyes; then
903 AC_CHECK_HEADER(audio/audiolib.h, have_nas_hdr=yes)
904 AC_CHECK_LIB(audio, AuOpenServer, have_nas_lib=yes)
906 AC_MSG_CHECKING(for NAS audio support)
909 if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then
913 elif test -r /usr/X11R6/include/audio/audiolib.h; then
915 NAS_CFLAGS="-I/usr/X11R6/include/"
916 NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt"
918 dnl On IRIX, the NAS includes are in a different directory,
919 dnl and libnas must be explicitly linked in
921 elif test -r /usr/freeware/include/nas/audiolib.h; then
923 NAS_LIBS="-lnas -lXt"
926 AC_MSG_RESULT($have_nas)
928 if test x$have_nas = xyes; then
929 AC_ARG_ENABLE(nas-shared,
930 AC_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[default=yes]]]),
931 , enable_nas_shared=yes)
932 nas_lib=[`find_lib "libaudio.so.*" "$NAS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
934 if test x$have_loadso != xyes && \
935 test x$enable_nas_shared = xyes; then
936 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic NAS loading])
938 if test x$have_loadso = xyes && \
939 test x$enable_nas_shared = xyes && test x$nas_lib != x; then
940 echo "-- dynamic libaudio -> $nas_lib"
941 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_NAS_DYNAMIC, "$nas_lib")
943 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS"
946 AC_DEFINE(SDL_AUDIO_DRIVER_NAS)
947 SOURCES="$SOURCES $srcdir/src/audio/nas/*.c"
948 EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS"
954 dnl rcg07142001 See if the user wants the disk writer audio driver...
957 AC_ARG_ENABLE(diskaudio,
958 AC_HELP_STRING([--enable-diskaudio], [support the disk writer audio driver [[default=yes]]]),
959 , enable_diskaudio=yes)
960 if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
961 AC_DEFINE(SDL_AUDIO_DRIVER_DISK)
962 SOURCES="$SOURCES $srcdir/src/audio/disk/*.c"
966 dnl rcg03142006 See if the user wants the dummy audio driver...
969 AC_ARG_ENABLE(dummyaudio,
970 AC_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [[default=yes]]]),
971 , enable_dummyaudio=yes)
972 if test x$enable_audio = xyes -a x$enable_dummyaudio = xyes; then
973 AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY)
974 SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c"
978 dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
979 dnl Details of this flag are here: http://gcc.gnu.org/wiki/Visibility
980 CheckVisibilityHidden()
982 AC_MSG_CHECKING(for GCC -fvisibility=hidden option)
983 have_gcc_fvisibility=no
985 visibility_CFLAGS="-fvisibility=hidden"
986 save_CFLAGS="$CFLAGS"
987 CFLAGS="$save_CFLAGS $visibility_CFLAGS -Werror"
989 #if !defined(__GNUC__) || __GNUC__ < 4
990 #error SDL only uses visibility attributes in GCC 4 or newer
994 have_gcc_fvisibility=yes
996 AC_MSG_RESULT($have_gcc_fvisibility)
997 CFLAGS="$save_CFLAGS"
999 if test x$have_gcc_fvisibility = xyes; then
1000 EXTRA_CFLAGS="$EXTRA_CFLAGS $visibility_CFLAGS"
1005 dnl Find the X11 include and library directories
1010 AC_ARG_ENABLE(video-x11,
1011 AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]),
1012 , enable_video_x11=yes)
1013 if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
1016 # This isn't necessary for X11, but fixes GLX detection
1017 if test "x$x_includes" = xNONE && test "x$x_libraries" = xNONE; then
1018 x_includes="/usr/X11R6/include"
1019 x_libraries="/usr/X11R6/lib"
1025 if test x$have_x = xyes; then
1026 # Only allow dynamically loaded X11 if the X11 function pointers
1027 # will not end up in the global namespace, which causes problems
1028 # with other libraries calling X11 functions.
1029 x11_symbols_private=$have_gcc_fvisibility
1031 AC_ARG_ENABLE(x11-shared,
1032 AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=maybe]]]),
1033 , enable_x11_shared=maybe)
1036 *-*-darwin*) # Latest Mac OS X actually ships with Xrandr/Xrender libs...
1037 x11_symbols_private=yes
1038 x11_lib='/usr/X11R6/lib/libX11.6.dylib'
1039 x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
1040 xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
1041 xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
1042 xinput_lib='/usr/X11R6/lib/libXi.6.dylib'
1043 xss_lib='/usr/X11R6/lib/libXss.6.dylib'
1044 xdamage_lib='/usr/X11R6/lib/libXdamage.1.dylib'
1045 xfixes_lib='/usr/X11R6/lib/libXfixes.3.dylib'
1049 x11ext_lib='libXext.so'
1051 *-*-irix*) # IRIX 6.5 requires that we use /usr/lib32
1053 x11ext_lib='libXext.so'
1056 x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1057 x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1058 xrender_lib=[`find_lib "libXrender.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1059 xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1060 xinput_lib=[`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1061 xss_lib=[`find_lib "libXss.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1062 xdamage_lib=[`find_lib "libXdamage.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1063 xfixes_lib=[`find_lib "libXfixes.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
1067 if test x$ac_cv_func_shmat != xyes; then
1068 X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY"
1070 CFLAGS="$CFLAGS $X_CFLAGS"
1071 LDFLAGS="$LDFLAGS $X_LIBS"
1073 AC_DEFINE(SDL_VIDEO_DRIVER_X11)
1074 SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
1075 SOURCES="$SOURCES $srcdir/src/video/Xext/XmuStdCmap/*.c"
1076 EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
1078 if test x$enable_x11_shared = xmaybe; then
1079 enable_x11_shared=$x11_symbols_private
1081 if test x$have_loadso != xyes && \
1082 test x$enable_x11_shared = xyes; then
1083 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic X11 loading])
1084 enable_x11_shared=no
1086 if test x$x11_symbols_private != xyes && \
1087 test x$enable_x11_shared = xyes; then
1088 AC_MSG_WARN([You must have gcc4 (-fvisibility=hidden) for dynamic X11 loading])
1089 enable_x11_shared=no
1092 if test x$have_loadso = xyes && \
1093 test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then
1094 echo "-- dynamic libX11 -> $x11_lib"
1095 echo "-- dynamic libX11ext -> $x11ext_lib"
1096 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib")
1097 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib")
1099 enable_x11_shared=no
1100 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
1104 AC_ARG_ENABLE(video-x11-vm,
1105 AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[default=yes]]]),
1106 , enable_video_x11_vm=yes)
1107 if test x$enable_video_x11_vm = xyes; then
1108 AC_DEFINE(SDL_VIDEO_DRIVER_X11_VIDMODE)
1109 SOURCES="$SOURCES $srcdir/src/video/Xext/Xxf86vm/*.c"
1111 AC_ARG_ENABLE(video-x11-xv,
1112 AC_HELP_STRING([--enable-video-x11-xv], [use X11 XvImage extension for video [[default=yes]]]),
1113 , enable_video_x11_xv=yes)
1114 if test x$enable_video_x11_xv = xyes; then
1115 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XV)
1116 SOURCES="$SOURCES $srcdir/src/video/Xext/Xv/*.c"
1118 AC_ARG_ENABLE(video-x11-xinerama,
1119 AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]),
1120 , enable_video_x11_xinerama=yes)
1121 if test x$enable_video_x11_xinerama = xyes; then
1122 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA)
1123 SOURCES="$SOURCES $srcdir/src/video/Xext/Xinerama/*.c"
1125 AC_ARG_ENABLE(video-x11-xshape,
1126 AC_HELP_STRING([--enable-video-x11-xshape], [enable X11 XShape support [[default=yes]]]),
1127 , enable_video_x11_xshape=yes)
1128 if test x$enable_video_x11_xshape = xyes; then
1129 AC_CHECK_HEADER(X11/extensions/shape.h,
1130 have_shape_h_hdr=yes,
1131 have_shape_h_hdr=no,
1132 [#include <X11/Xlib.h>
1134 if test x$have_shape_h_hdr = xyes; then
1135 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSHAPE)
1138 AC_ARG_ENABLE(video-x11-xrandr,
1139 AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]),
1140 , enable_video_x11_xrandr=yes)
1141 if test x$enable_video_x11_xrandr = xyes; then
1142 definitely_enable_video_x11_xrandr=no
1143 AC_CHECK_HEADER(X11/extensions/Xrandr.h,
1144 have_xrandr_h_hdr=yes,
1145 have_xrandr_h_hdr=no,
1146 [#include <X11/Xlib.h>
1148 if test x$have_xrandr_h_hdr = xyes; then
1149 if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then
1150 echo "-- dynamic libXrandr -> $xrandr_lib"
1151 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib")
1152 definitely_enable_video_x11_xrandr=yes
1154 AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes)
1155 if test x$have_xrandr_lib = xyes ; then
1156 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr"
1157 definitely_enable_video_x11_xrandr=yes
1162 if test x$definitely_enable_video_x11_xrandr = xyes; then
1163 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR)
1165 AC_ARG_ENABLE(video-x11-xinput,
1166 AC_HELP_STRING([--enable-video-x11-xinput], [enable X11 XInput extension for manymouse, tablets, etc [[default=yes]]]),
1167 , enable_video_x11_xinput=yes)
1168 if test x$enable_video_x11_xinput = xyes; then
1169 definitely_enable_video_x11_xinput=no
1170 AC_CHECK_HEADER(X11/extensions/XInput.h,
1171 have_xinput_h_hdr=yes,
1172 have_xinput_h_hdr=no,
1173 [#include <X11/Xlib.h>
1175 if test x$have_xinput_h_hdr = xyes; then
1176 if test x$enable_x11_shared = xyes && test x$xinput_lib != x ; then
1177 echo "-- dynamic libXi -> $xinput_lib"
1178 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT, "$xinput_lib")
1179 definitely_enable_video_x11_xinput=yes
1181 AC_CHECK_LIB(Xi, XOpenDevice, have_xinput_lib=yes)
1182 if test x$have_xinput_lib = xyes ; then
1183 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXi"
1184 definitely_enable_video_x11_xinput=yes
1189 if test x$definitely_enable_video_x11_xinput = xyes; then
1190 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT)
1192 AC_ARG_ENABLE(video-x11-scrnsaver,
1193 AC_HELP_STRING([--enable-video-x11-scrnsaver], [enable X11 screensaver extension [[default=yes]]]),
1194 , enable_video_x11_scrnsaver=yes)
1195 if test x$enable_video_x11_scrnsaver = xyes; then
1196 AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
1197 have_scrnsaver_h_hdr=yes,
1198 have_scrnsaver_h_hdr=no,
1199 [#include <X11/Xlib.h>
1201 if test x$have_scrnsaver_h_hdr = xyes; then
1202 if test x$enable_x11_shared = xyes && test x$xss_lib != x ; then
1203 echo "-- dynamic libXss -> $xss_lib"
1204 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS, "$xss_lib")
1205 definitely_enable_video_x11_scrnsaver=yes
1207 AC_CHECK_LIB(Xss, XScreenSaverSuspend, have_xss_lib=yes)
1208 if test x$have_xss_lib = xyes ; then
1209 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXss"
1210 definitely_enable_video_x11_scrnsaver=yes
1215 if test x$definitely_enable_video_x11_scrnsaver = xyes; then
1216 AC_DEFINE(SDL_VIDEO_DRIVER_X11_SCRNSAVER)
1218 AC_ARG_ENABLE(video-x11-xrender,
1219 AC_HELP_STRING([--enable-video-x11-xrender], [enable X11 Xrender extension [[default=yes]]]),
1220 , enable_video_x11_xrender=yes)
1221 if test x$enable_video_x11_xrender = xyes; then
1222 AC_CHECK_HEADER(X11/extensions/Xrender.h,
1223 have_xrender_h_hdr=yes,
1224 have_xrender_h_hdr=no,
1225 [#include <X11/Xlib.h>
1227 if test x$have_xrender_h_hdr = xyes; then
1228 if test x$enable_x11_shared = xyes && test x$xrender_lib != x ; then
1229 echo "-- dynamic libXrender -> $xrender_lib"
1230 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER, "$xrender_lib")
1231 definitely_enable_video_x11_xrender=yes
1233 AC_CHECK_LIB(Xrender, XRenderQueryExtension, have_xrender_lib=yes)
1234 if test x$have_xrender_lib = xyes ; then
1235 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrender"
1236 definitely_enable_video_x11_xrender=yes
1241 if test x$definitely_enable_video_x11_xrender = xyes; then
1242 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRENDER)
1244 AC_ARG_ENABLE(video-x11-xdamage-xfixes,
1245 AC_HELP_STRING([--enable-video-x11-xdamage-xfixes], [enable X11 Xdamage and Xfixes extensions [[default=yes]]]),
1246 , enable_video_x11_xdamage=yes)
1247 if test x$enable_video_x11_xdamage = xyes && test x$definitely_enable_video_x11_xrender = xyes ; then
1248 AC_CHECK_HEADER(X11/extensions/Xdamage.h,
1249 have_xdamage_h_hdr=yes,
1250 have_xdamage_h_hdr=no,
1251 [#include <X11/Xlib.h>
1253 AC_CHECK_HEADER(X11/extensions/Xfixes.h,
1254 have_xfixes_h_hdr=yes,
1255 have_xfixes_h_hdr=no,
1256 [#include <X11/Xlib.h>
1258 if test x$have_xdamage_h_hdr = xyes && test x$have_xfixes_h_hdr = xyes ; then
1259 if test x$enable_x11_shared = xyes && test x$xdamage_lib != x && test x$xfixes_lib != x ; then
1260 echo "-- dynamic libXdamage -> $xdamage_lib"
1261 echo "-- dynamic libXfixes -> $xfixes_lib"
1262 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XDAMAGE, "$xdamage_lib")
1263 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES, "$xfixes_lib")
1264 definitely_enable_video_x11_xdamage=yes
1265 definitely_enable_video_x11_xfixes=yes
1267 AC_CHECK_LIB(Xdamage, XDamageQueryExtension, have_xdamage_lib=yes)
1268 AC_CHECK_LIB(Xfixes, XFixesQueryExtension, have_xfixes_lib=yes)
1269 if test x$have_xdamage_lib = xyes && test x$have_xfixes_lib = xyes ; then
1270 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXdamage -lXfixes"
1271 definitely_enable_video_x11_xdamage=yes
1272 definitely_enable_video_x11_xfixes=yes
1277 if test x$definitely_enable_video_x11_xdamage = xyes && test x$definitely_enable_video_x11_xfixes = xyes ; then
1278 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XDAMAGE)
1279 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XFIXES)
1281 AC_ARG_ENABLE(render-x11,
1282 AC_HELP_STRING([--enable-render-x11], [enable the X11 render driver [[default=yes]]]),
1283 , enable_render_x11=yes)
1284 if test x$enable_render_x11 = xyes; then
1285 AC_DEFINE(SDL_VIDEO_RENDER_X11)
1291 dnl Check for QNX photon video driver
1294 AC_ARG_ENABLE(video-photon,
1295 AC_HELP_STRING([--enable-video-photon], [use QNX Photon video driver [[default=yes]]]),
1296 , enable_video_photon=yes)
1297 if test x$enable_video = xyes -a x$enable_video_photon = xyes; then
1298 AC_MSG_CHECKING(for QNX Photon support)
1303 #include <photon/Pg.h>
1304 #include <photon/PdDirect.h>
1306 PgDisplaySettings_t *visual;
1310 AC_MSG_RESULT($video_photon)
1311 if test x$video_photon = xyes; then
1312 AC_DEFINE(SDL_VIDEO_DRIVER_PHOTON)
1313 SOURCES="$SOURCES $srcdir/src/video/photon/*.c"
1314 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lph -lphrender"
1322 dnl Check for QNX photon video driver
1325 AC_ARG_ENABLE(video-qnxgf,
1326 AC_HELP_STRING([--enable-video-qnxgf], [use QNX GF video driver [[default=yes]]]),
1327 , enable_video_qnxgf=yes)
1328 if test x$enable_video = xyes -a x$enable_video_qnxgf = xyes; then
1329 AC_MSG_CHECKING(for QNX GF support)
1333 #include <gf/gf3d.h>
1335 gf_3d_config_info_t* gfinfo;
1339 AC_MSG_RESULT($video_qnxgf)
1340 if test x$video_qnxgf = xyes; then
1341 AC_DEFINE(SDL_VIDEO_DRIVER_QNXGF)
1342 SOURCES="$SOURCES $srcdir/src/video/qnxgf/*.c"
1343 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lgf"
1345 # Add HIDDI library for HID support using GF
1346 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lhiddi"
1355 dnl Set up the BWindow video driver if enabled
1358 if test x$enable_video = xyes; then
1359 AC_DEFINE(SDL_VIDEO_DRIVER_BWINDOW)
1360 SOURCES="$SOURCES $srcdir/src/video/bwindow/*.cc"
1365 dnl Set up the Cocoa video driver for Mac OS X (but not Darwin)
1368 AC_ARG_ENABLE(video-cocoa,
1369 AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]),
1370 , enable_video_cocoa=yes)
1371 if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
1372 save_CFLAGS="$CFLAGS"
1373 dnl work around that we don't have Objective-C support in autoconf
1374 CFLAGS="$CFLAGS -x objective-c"
1375 AC_MSG_CHECKING(for Cocoa framework)
1378 #import <Cocoa/Cocoa.h>
1383 AC_MSG_RESULT($have_cocoa)
1384 CFLAGS="$save_CFLAGS"
1385 if test x$have_cocoa = xyes; then
1386 AC_DEFINE(SDL_VIDEO_DRIVER_COCOA)
1387 SOURCES="$SOURCES $srcdir/src/video/cocoa/*.m"
1393 dnl Find the framebuffer console includes
1396 AC_ARG_ENABLE(video-fbcon,
1397 AC_HELP_STRING([--enable-video-fbcon], [use framebuffer console video driver [[default=no]]]),
1398 , enable_video_fbcon=no)
1399 if test x$enable_video = xyes -a x$enable_video_fbcon = xyes; then
1400 AC_MSG_CHECKING(for framebuffer console support)
1403 #include <linux/fb.h>
1404 #include <linux/kd.h>
1405 #include <linux/keyboard.h>
1410 AC_MSG_RESULT($video_fbcon)
1411 if test x$video_fbcon = xyes; then
1412 AC_CHECK_FUNCS(getpagesize)
1413 AC_DEFINE(SDL_VIDEO_DRIVER_FBCON)
1414 SOURCES="$SOURCES $srcdir/src/video/fbcon/*.c"
1423 AC_ARG_ENABLE(video-directfb,
1424 AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=no]]]),
1425 , enable_video_directfb=no)
1426 if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
1429 DIRECTFB_REQUIRED_VERSION=1.0.0
1431 AC_PATH_PROG(DIRECTFBCONFIG, directfb-config, no)
1432 if test x$DIRECTFBCONFIG = xno; then
1433 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1434 if test x$PKG_CONFIG != xno; then
1435 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb; then
1436 DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
1437 DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
1438 DIRECTFB_PREFIX=`$PKG_CONFIG --variable=prefix directfb`
1443 set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'`
1444 NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
1445 set -- `directfb-config --version | sed 's/\./ /g'`
1446 HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
1447 if test $HAVE_VERSION -ge $NEED_VERSION; then
1448 DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags`
1449 DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs`
1450 DIRECTFB_PREFIX=`$DIRECTFBCONFIG --prefix`
1454 if test x$video_directfb = xyes; then
1455 # SuSE 11.1 installs directfb-config without directfb-devel
1456 save_CPPFLAGS="$CPPFLAGS"
1457 CPPFLAGS="$CPPFLAGS $DIRECTFB_CFLAGS"
1458 AC_CHECK_HEADER(directfb.h, have_directfb_hdr=yes, have_directfb_hdr=no)
1459 CPPFLAGS="$save_CPPFLAGS"
1460 video_directfb=$have_directfb_hdr
1462 AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support)
1463 AC_MSG_RESULT($video_directfb)
1465 if test x$video_directfb = xyes; then
1466 AC_ARG_ENABLE(directfb-shared,
1467 AC_HELP_STRING([--enable-directfb-shared], [dynamically load directfb support [[default=yes]]]),
1468 , enable_directfb_shared=yes)
1470 AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB)
1471 SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
1472 EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"
1474 AC_MSG_CHECKING(for directfb dynamic loading support)
1476 directfb_lib=[`find_lib "libdirectfb.so.*" "$DIRECTFB_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
1478 if test x$have_loadso != xyes && \
1479 test x$enable_directfb_shared = xyes; then
1480 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic directfb loading])
1482 if test x$have_loadso = xyes && \
1483 test x$enable_directfb_shared = xyes && test x$directfb_lib != x; then
1485 echo "-- $directfb_lib_spec -> $directfb_lib"
1486 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC, "$directfb_lib")
1488 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
1490 AC_MSG_RESULT($directfb_shared)
1496 dnl Find FusionSound
1499 AC_ARG_ENABLE(fusionsound,
1500 AC_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]),
1501 , enable_fusionsound=no)
1502 if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then
1505 FUSIONSOUND_REQUIRED_VERSION=1.1.1
1507 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1508 AC_MSG_CHECKING(for FusionSound $FUSIONSOUND_REQUIRED_VERSION support)
1509 if test x$PKG_CONFIG != xno; then
1510 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then
1511 FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound`
1512 FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound`
1516 AC_MSG_RESULT($fusionsound)
1518 if test x$fusionsound = xyes; then
1519 AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND)
1520 SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c"
1521 EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS"
1523 AC_ARG_ENABLE(fusionsound-shared,
1524 AC_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]),
1525 , enable_fusionsound_shared=yes)
1526 fusionsound_shared=no
1527 AC_MSG_CHECKING(for FusionSound dynamic loading support)
1528 if test x$have_loadso != xyes && \
1529 test x$enable_fusionsound_shared = xyes; then
1530 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading])
1532 if test x$have_loadso = xyes && \
1533 test x$enable_fusionsound_shared = xyes; then
1534 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so")
1535 fusionsound_shared=yes
1537 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS"
1539 AC_MSG_RESULT($fusionsound_shared)
1546 dnl See if we're running on PlayStation 3 Cell hardware
1549 AC_ARG_ENABLE(video-ps3,
1550 AC_HELP_STRING([--enable-video-ps3], [use PlayStation 3 Cell driver [[default=yes]]]),
1551 , enable_video_ps3=yes)
1552 if test x$enable_video = xyes -a x$enable_video_ps3 = xyes; then
1554 AC_CHECK_HEADER([linux/fb.h])
1555 AC_CHECK_HEADER([asm/ps3fb.h], [have_ps3fb_hdr=yes], [],
1556 [#ifndef _LINUX_TYPES_H
1557 #include <linux/types.h>
1559 AC_CHECK_HEADER([libspe2.h], have_libspe2_hdr=yes)
1560 AC_CHECK_LIB([spe2], spe_context_create, have_spe2_lib=yes)
1562 AC_CHECK_PROGS(SPU_GCC, [spu-gcc])
1563 AC_CHECK_PROGS(EMBEDSPU, [embedspu])
1566 AC_CHECK_LIB([fb_writer_spu], [main], [], [have_spu_libs=no])
1567 AC_CHECK_LIB([yuv2rgb_spu], [main], [], [have_spu_libs=no])
1568 AC_CHECK_LIB([bilin_scaler_spu], [main], [], [have_spu_libs=no])
1569 if test x$have_ps3fb_hdr = xyes -a x$have_libspe2_hdr = xyes -a x$have_spe2_lib = xyes -a "$SPU_GCC" -a "$EMBEDSPU"; then
1570 AC_DEFINE(SDL_VIDEO_DRIVER_PS3)
1573 SOURCES="$SOURCES $srcdir/src/video/ps3/*.c"
1574 EXTRA_CFLAGS="$EXTRA_CFLAGS -I/opt/cell/sdk/usr/include"
1575 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L/opt/cell/sdk/usr/lib -lspe2 -lfb_writer_spu -lyuv2rgb_spu -lbilin_scaler_spu"
1577 if test x$have_spu_libs = xno; then
1578 AC_MSG_WARN([ps3libs missing, please run make ps3libs])
1581 AC_MSG_CHECKING([for PlayStation 3 Cell support])
1582 AC_MSG_RESULT([$video_ps3])
1586 dnl Find the SVGAlib includes and libraries
1589 AC_ARG_ENABLE(video-svga,
1590 AC_HELP_STRING([--enable-video-svga], [use SVGAlib video driver [[default=no]]]),
1591 , enable_video_svga=no)
1592 if test x$enable_video = xyes -a x$enable_video_svga = xyes; then
1593 AC_MSG_CHECKING(for SVGAlib (1.4.0+) support)
1597 #include <vgamouse.h>
1598 #include <vgakeyboard.h>
1600 if ( SCANCODE_RIGHTWIN && SCANCODE_LEFTWIN ) {
1606 AC_MSG_RESULT($video_svga)
1607 if test x$video_svga = xyes; then
1608 AC_DEFINE(SDL_VIDEO_DRIVER_SVGALIB)
1609 SOURCES="$SOURCES $srcdir/src/video/svga/*.c"
1610 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvga"
1616 dnl rcg04172001 Set up the Null video driver.
1619 AC_ARG_ENABLE(video-dummy,
1620 AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]),
1621 , enable_video_dummy=yes)
1622 if test x$enable_video_dummy = xyes; then
1623 AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY)
1624 SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
1629 dnl Check to see if OpenGL support is desired
1630 AC_ARG_ENABLE(video-opengl,
1631 AC_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]),
1632 , enable_video_opengl=yes)
1637 if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
1638 AC_MSG_CHECKING(for OpenGL (GLX) support)
1648 AC_MSG_RESULT($video_opengl)
1649 if test x$video_opengl = xyes; then
1650 AC_DEFINE(SDL_VIDEO_OPENGL)
1651 AC_DEFINE(SDL_VIDEO_OPENGL_GLX)
1652 AC_DEFINE(SDL_VIDEO_RENDER_OGL)
1657 dnl Find QNX 6.x Software OpenGL
1660 if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
1661 AC_MSG_CHECKING(for QNX 6.x Photon OpenGL support)
1669 AC_MSG_RESULT($video_opengl)
1670 if test x$video_opengl = xyes; then
1671 AC_DEFINE(SDL_VIDEO_OPENGL)
1672 AC_DEFINE(SDL_VIDEO_RENDER_OGL)
1673 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
1678 dnl Find QNX 6.3 and above OpenGL ES implementation
1681 if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
1682 AC_MSG_CHECKING(for QNX OpenGL ES (CM) support)
1685 #include <GLES/egl.h>
1690 AC_MSG_RESULT($video_opengl)
1691 if test x$video_opengl = xyes; then
1692 AC_DEFINE(SDL_VIDEO_OPENGL_ES)
1693 AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES)
1694 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGLES_CM"
1696 AC_MSG_CHECKING(for QNX OpenGL ES (CL) support)
1700 #include <GLES/egl.h>
1705 AC_MSG_RESULT($video_opengl)
1706 if test x$video_opengl = xyes; then
1707 AC_DEFINE(SDL_VIDEO_OPENGL_ES)
1708 AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES)
1709 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGLES_CLS"
1716 dnl Check for Win32 OpenGL
1719 if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
1720 AC_DEFINE(SDL_VIDEO_OPENGL)
1721 AC_DEFINE(SDL_VIDEO_OPENGL_WGL)
1722 AC_DEFINE(SDL_VIDEO_RENDER_OGL)
1726 dnl Check for BeOS OpenGL
1729 if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
1730 AC_DEFINE(SDL_VIDEO_OPENGL)
1731 AC_DEFINE(SDL_VIDEO_OPENGL_BGL)
1732 AC_DEFINE(SDL_VIDEO_RENDER_OGL)
1733 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
1737 dnl Check for MacOS OpenGL
1740 if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
1741 AC_DEFINE(SDL_VIDEO_OPENGL)
1742 AC_DEFINE(SDL_VIDEO_OPENGL_CGL)
1743 AC_DEFINE(SDL_VIDEO_RENDER_OGL)
1746 if test x$enable_video_cocoa = xyes; then
1747 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGL"
1753 dnl See if we can use the new unified event interface in Linux 2.4
1756 dnl Check for Linux 2.4 unified input event interface support
1757 AC_ARG_ENABLE(input-events,
1758 AC_HELP_STRING([--enable-input-events], [use Linux 2.4 unified input interface [[default=yes]]]),
1759 , enable_input_events=yes)
1760 if test x$enable_input_events = xyes; then
1761 AC_MSG_CHECKING(for Linux 2.4 unified input interface)
1764 #include <linux/input.h>
1767 #error EVIOCGNAME() ioctl not available
1770 use_input_events=yes
1772 AC_MSG_RESULT($use_input_events)
1773 if test x$use_input_events = xyes; then
1774 AC_DEFINE(SDL_INPUT_LINUXEV)
1779 dnl See if we can use the Touchscreen input library
1782 AC_ARG_ENABLE(input-tslib,
1783 AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]),
1784 , enable_input_tslib=yes)
1785 if test x$enable_input_tslib = xyes; then
1786 AC_MSG_CHECKING(for Touchscreen library support)
1787 enable_input_tslib=no
1792 enable_input_tslib=yes
1794 AC_MSG_RESULT($enable_input_tslib)
1795 if test x$enable_input_tslib = xyes; then
1796 AC_DEFINE(SDL_INPUT_TSLIB)
1797 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
1802 dnl See what type of thread model to use on Linux and Solaris
1805 dnl Check for pthread support
1806 AC_ARG_ENABLE(pthreads,
1807 AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]),
1808 , enable_pthreads=yes)
1809 dnl This is used on Linux for glibc binary compatibility (Doh!)
1810 AC_ARG_ENABLE(pthread-sem,
1811 AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
1812 , enable_pthread_sem=yes)
1814 *-*-linux*|*-*-uclinux*)
1815 pthread_cflags="-D_REENTRANT"
1816 pthread_lib="-lpthread"
1819 pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
1823 pthread_cflags="-D_THREAD_SAFE"
1824 # causes Carbon.p complaints?
1825 # pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
1827 *-*-freebsd*|*-*-dragonfly*)
1828 pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
1829 pthread_lib="-pthread"
1832 pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
1833 pthread_lib="-lpthread"
1836 pthread_cflags="-D_REENTRANT"
1837 pthread_lib="-pthread"
1840 pthread_cflags="-D_REENTRANT"
1841 pthread_lib="-lpthread -lposix4"
1844 pthread_cflags="-D_REENTRANT -Kthread"
1848 pthread_cflags="-D_SGI_MP_SOURCE"
1849 pthread_lib="-lpthread"
1852 pthread_cflags="-D_REENTRANT -mthreads"
1853 pthread_lib="-lpthread"
1856 pthread_cflags="-D_REENTRANT"
1857 pthread_lib="-L/usr/lib -lpthread"
1864 pthread_cflags="-D_REENTRANT"
1865 if test x$ac_cv_prog_gcc = xyes; then
1866 pthread_lib="-lpthread -lrt"
1868 pthread_lib="-lpthread -lexc -lrt"
1872 pthread_cflags="-D_REENTRANT"
1873 pthread_lib="-lpthread"
1876 if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
1877 # Save the original compiler flags and libraries
1878 ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
1879 # Add the pthread compiler flags and libraries
1880 CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
1881 # Check to see if we have pthread support on this system
1882 AC_MSG_CHECKING(for pthreads)
1885 #include <pthread.h>
1887 pthread_attr_t type;
1888 pthread_attr_init(&type);
1892 AC_MSG_RESULT($use_pthreads)
1893 # Restore the compiler flags and libraries
1894 CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
1896 # Do futher testing if we have pthread support...
1897 if test x$use_pthreads = xyes; then
1898 AC_DEFINE(SDL_THREAD_PTHREAD)
1899 EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
1900 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
1901 SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
1902 SDL_LIBS="$SDL_LIBS $pthread_lib"
1904 # Save the original compiler flags and libraries
1905 ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
1906 # Add the pthread compiler flags and libraries
1907 CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
1909 # Check to see if recursive mutexes are available
1910 AC_MSG_CHECKING(for recursive mutexes)
1911 has_recursive_mutexes=no
1912 if test x$has_recursive_mutexes = xno; then
1914 #include <pthread.h>
1916 pthread_mutexattr_t attr;
1917 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
1919 has_recursive_mutexes=yes
1920 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX)
1923 if test x$has_recursive_mutexes = xno; then
1925 #include <pthread.h>
1927 pthread_mutexattr_t attr;
1928 pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
1930 has_recursive_mutexes=yes
1931 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP)
1934 AC_MSG_RESULT($has_recursive_mutexes)
1936 # Check to see if pthread semaphore support is missing
1937 if test x$enable_pthread_sem = xyes; then
1938 AC_MSG_CHECKING(for pthread semaphores)
1941 #include <pthread.h>
1942 #include <semaphore.h>
1945 have_pthread_sem=yes
1947 AC_MSG_RESULT($have_pthread_sem)
1950 # Restore the compiler flags and libraries
1951 CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
1953 # Basic thread creation functions
1954 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
1957 # We can fake these with mutexes and condition variables if necessary
1958 if test x$have_pthread_sem = xyes; then
1959 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
1961 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
1965 # We can fake these with semaphores if necessary
1966 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
1968 # Condition variables
1969 # We can fake these with semaphores and mutexes if necessary
1970 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
1977 dnl Determine whether the compiler can produce Win32 executables
1980 AC_MSG_CHECKING(Win32 compiler)
1983 #include <windows.h>
1988 AC_MSG_RESULT($have_win32_gcc)
1989 if test x$have_win32_gcc != xyes; then
1991 *** Your compiler ($CC) does not produce Win32 executables!
1995 AC_MSG_CHECKING(Windows CE)
1998 #if !defined(_WIN32_WCE) && !defined(__MINGW32CE__)
1999 #error This is not Windows CE
2005 AC_MSG_RESULT($have_wince)
2007 dnl See if the user wants to redirect standard output to files
2008 AC_ARG_ENABLE(stdio-redirect,
2009 AC_HELP_STRING([--enable-stdio-redirect], [Redirect STDIO to files on Win32 [[default=yes]]]),
2010 , enable_stdio_redirect=yes)
2011 if test x$enable_stdio_redirect != xyes; then
2012 EXTRA_CFLAGS="$EXTRA_CFLAGS -DNO_STDIO_REDIRECT"
2016 dnl Find the DirectX includes and libraries
2019 AC_ARG_ENABLE(directx,
2020 AC_HELP_STRING([--enable-directx], [use DirectX for Win32 audio/video [[default=yes]]]),
2021 , enable_directx=yes)
2022 if test x$enable_directx = xyes; then
2023 AC_CHECK_HEADER(d3d9.h, have_d3d=yes)
2024 AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
2025 AC_CHECK_HEADER(dsound.h, have_dsound=yes)
2026 AC_CHECK_HEADER(dinput.h, have_dinput=yes)
2030 dnl Check for the dlfcn.h interface for dynamically loading objects
2033 AC_ARG_ENABLE(sdl-dlopen,
2034 AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]),
2035 , enable_sdl_dlopen=yes)
2036 if test x$enable_sdl_dlopen = xyes; then
2037 AC_MSG_CHECKING(for dlopen)
2042 #if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED <= 1020
2043 #error Use dlcompat for Mac OS X 10.2 compatibility
2048 AC_MSG_RESULT($have_dlopen)
2050 if test x$have_dlopen = xyes; then
2051 AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
2052 AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
2053 AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
2054 AC_DEFINE(SDL_LOADSO_DLOPEN)
2055 SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
2061 dnl Check for the usbhid(3) library on *BSD
2064 if test x$enable_joystick = xyes; then
2065 AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
2066 if test x$have_libusbhid = xyes; then
2067 AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
2068 AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
2069 USB_LIBS="$USB_LIBS -lusbhid"
2071 AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
2072 AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
2073 AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
2076 save_CFLAGS="$CFLAGS"
2077 CFLAGS="$CFLAGS $USB_CFLAGS"
2079 AC_MSG_CHECKING(for usbhid)
2082 #include <sys/types.h>
2083 #if defined(HAVE_USB_H)
2086 #ifdef __DragonFly__
2087 # include <bus/usb/usb.h>
2088 # include <bus/usb/usbhid.h>
2090 # include <dev/usb/usb.h>
2091 # include <dev/usb/usbhid.h>
2093 #if defined(HAVE_USBHID_H)
2095 #elif defined(HAVE_LIBUSB_H)
2097 #elif defined(HAVE_LIBUSBHID_H)
2098 #include <libusbhid.h>
2101 struct report_desc *repdesc;
2102 struct usb_ctl_report *repbuf;
2107 AC_MSG_RESULT($have_usbhid)
2109 if test x$have_usbhid = xyes; then
2110 AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
2111 have_usbhid_ucr_data=no
2113 #include <sys/types.h>
2114 #if defined(HAVE_USB_H)
2117 #ifdef __DragonFly__
2118 # include <bus/usb/usb.h>
2119 # include <bus/usb/usbhid.h>
2121 # include <dev/usb/usb.h>
2122 # include <dev/usb/usbhid.h>
2124 #if defined(HAVE_USBHID_H)
2126 #elif defined(HAVE_LIBUSB_H)
2128 #elif defined(HAVE_LIBUSBHID_H)
2129 #include <libusbhid.h>
2132 struct usb_ctl_report buf;
2133 if (buf.ucr_data) { }
2135 have_usbhid_ucr_data=yes
2137 if test x$have_usbhid_ucr_data = xyes; then
2138 USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
2140 AC_MSG_RESULT($have_usbhid_ucr_data)
2142 AC_MSG_CHECKING(for new usbhid API)
2145 #include <sys/types.h>
2146 #if defined(HAVE_USB_H)
2149 #ifdef __DragonFly__
2150 #include <bus/usb/usb.h>
2151 #include <bus/usb/usbhid.h>
2153 #include <dev/usb/usb.h>
2154 #include <dev/usb/usbhid.h>
2156 #if defined(HAVE_USBHID_H)
2158 #elif defined(HAVE_LIBUSB_H)
2160 #elif defined(HAVE_LIBUSBHID_H)
2161 #include <libusbhid.h>
2165 hid_start_parse(d, 1, 1);
2169 if test x$have_usbhid_new = xyes; then
2170 USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
2172 AC_MSG_RESULT($have_usbhid_new)
2174 AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
2175 have_machine_joystick=no
2177 #include <machine/joystick.h>
2181 have_machine_joystick=yes
2183 if test x$have_machine_joystick = xyes; then
2184 AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H)
2186 AC_MSG_RESULT($have_machine_joystick)
2188 AC_DEFINE(SDL_JOYSTICK_USBHID)
2189 SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
2190 EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
2191 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
2194 CFLAGS="$save_CFLAGS"
2198 dnl Check for clock_gettime()
2201 AC_ARG_ENABLE(clock_gettime,
2202 AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=no]]]),
2203 , enable_clock_gettime=no)
2204 if test x$enable_clock_gettime = xyes; then
2205 AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
2206 if test x$have_clock_gettime = xyes; then
2207 AC_DEFINE(HAVE_CLOCK_GETTIME)
2208 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
2210 AC_CHECK_LIB(c, clock_gettime, have_clock_gettime=yes)
2211 if test x$have_clock_gettime = xyes; then
2212 AC_DEFINE(HAVE_CLOCK_GETTIME)
2213 EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
2219 dnl Check for a valid linux/version.h
2222 AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
2223 if test x$have_linux_version_h = xyes; then
2224 EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
2228 dnl Check if we want to use RPATH
2231 AC_ARG_ENABLE(rpath,
2232 AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]),
2236 dnl Set up the configuration based on the host platform!
2238 *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-irix*|*-*-aix*|*-*-osf*|*-*-minix*)
2240 *-*-linux*) ARCH=linux ;;
2241 *-*-uclinux*) ARCH=linux ;;
2242 *-*-kfreebsd*-gnu) ARCH=kfreebsd-gnu ;;
2243 *-*-knetbsd*-gnu) ARCH=knetbsd-gnu ;;
2244 *-*-kopenbsd*-gnu) ARCH=kopenbsd-gnu ;;
2245 *-*-gnu*) ARCH=gnu ;; # must be last of the gnu variants
2246 *-*-bsdi*) ARCH=bsdi ;;
2247 *-*-freebsd*) ARCH=freebsd ;;
2248 *-*-dragonfly*) ARCH=freebsd ;;
2249 *-*-netbsd*) ARCH=netbsd ;;
2250 *-*-openbsd*) ARCH=openbsd ;;
2251 *-*-sysv5*) ARCH=sysv5 ;;
2252 *-*-solaris*) ARCH=solaris ;;
2253 *-*-hpux*) ARCH=hpux ;;
2254 *-*-irix*) ARCH=irix ;;
2255 *-*-aix*) ARCH=aix ;;
2256 *-*-osf*) ARCH=osf ;;
2257 *-*-minix*) ARCH=minix ;;
2259 CheckVisibilityHidden
2286 # Set up files for the audio library
2287 if test x$enable_audio = xyes; then
2290 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
2291 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
2295 AC_DEFINE(SDL_AUDIO_DRIVER_BSD)
2296 SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c"
2300 AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO)
2301 SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
2306 # Set up files for the atomic operations library
2307 if test x$enable_atomic = xyes; then
2310 AC_DEFINE(SDL_ATOMIC_LINUX)
2311 SOURCES="$SOURCES $srcdir/src/atomic/linux/*.c"
2316 # Set up files for the joystick library
2317 if test x$enable_joystick = xyes; then
2320 AC_DEFINE(SDL_JOYSTICK_LINUX)
2321 SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
2326 # Set up files for the haptic library
2327 if test x$enable_haptic = xyes; then
2328 if test x$use_input_events = xyes; then
2331 AC_DEFINE(SDL_HAPTIC_LINUX)
2332 SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c"
2338 # Set up files for the power library
2339 if test x$enable_power = xyes; then
2342 AC_DEFINE(SDL_POWER_LINUX)
2343 SOURCES="$SOURCES $srcdir/src/power/linux/*.c"
2348 # Set up files for the thread library
2349 if test x$enable_threads = xyes -a x$use_pthreads != xyes -a x$use_pth != xyes -a x$ARCH = xirix; then
2350 AC_DEFINE(SDL_THREAD_SPROC)
2351 SOURCES="$SOURCES $srcdir/src/thread/irix/*.c"
2352 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
2353 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
2356 # Set up files for the timer library
2357 if test x$enable_timers = xyes; then
2358 AC_DEFINE(SDL_TIMER_UNIX)
2359 SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
2365 EXTRA_CFLAGS="-I/usr/include $CFLAGS"
2366 EXTRA_LDLAGS="-L/usr/lib $LDFLAGS"
2369 CheckVisibilityHidden
2385 # Set up files for the audio library
2386 if test x$enable_audio = xyes; then
2387 AC_DEFINE(SDL_AUDIO_DRIVER_QSA)
2388 SOURCES="$SOURCES $srcdir/src/audio/qsa/*.c"
2389 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound"
2392 # Set up files for the timer library
2393 if test x$enable_timers = xyes; then
2394 AC_DEFINE(SDL_TIMER_UNIX)
2395 SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
2398 # Setup files for the atomic operations
2399 if test x$enable_atomic = xyes; then
2400 AC_DEFINE(SDL_ATOMIC_QNX)
2401 SOURCES="$SOURCES $srcdir/src/atomic/qnx/*.c"
2404 # Set up dummy files for the joystick for now
2405 if test x$enable_joystick = xyes; then
2406 AC_DEFINE(SDL_JOYSTICK_DUMMY)
2407 SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
2410 # Set up dummy files for the haptic for now
2411 if test x$enable_haptic = xyes; then
2412 AC_DEFINE(SDL_HAPTIC_DUMMY)
2413 SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
2417 *-wince* | *-mingw32ce)
2423 if test x$enable_video = xyes; then
2424 AC_DEFINE(SDL_VIDEO_DRIVER_WIN32)
2425 SOURCES="$SOURCES $srcdir/src/video/win32/*.c"
2427 AC_ARG_ENABLE(render-gdi,
2428 AC_HELP_STRING([--enable-render-gdi], [enable the GDI render driver [[default=yes]]]),
2429 , enable_render_gdi=yes)
2430 if test x$enable_render_gdi = xyes; then
2431 AC_DEFINE(SDL_VIDEO_RENDER_GDI)
2433 AC_ARG_ENABLE(render-gapi,
2434 AC_HELP_STRING([--enable-render-gapi], [enable the GAPI/RAWFRAMEBUFFER render driver [[default=yes]]]),
2435 , enable_render_gapi=yes)
2436 if test x$enable_render_gapi = xyes -a x$have_wince = xyes; then
2437 AC_DEFINE(SDL_VIDEO_RENDER_GAPI)
2439 AC_ARG_ENABLE(render-ddraw,
2440 AC_HELP_STRING([--enable-render-ddraw], [enable the Mobile DirectDraw render driver [[default=yes]]]),
2441 , enable_render_ddraw=yes)
2442 if test x$enable_render_ddraw = xyes -a x$have_wince = xyes -a x$have_ddraw = xyes; then
2443 AC_DEFINE(SDL_VIDEO_RENDER_DDRAW)
2445 AC_ARG_ENABLE(render-d3d,
2446 AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
2447 , enable_render_d3d=yes)
2448 enable_render_d3d=no
2449 if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
2450 AC_DEFINE(SDL_VIDEO_RENDER_D3D)
2453 # Set up files for the audio library
2454 if test x$enable_audio = xyes; then
2455 AC_DEFINE(SDL_AUDIO_DRIVER_WINWAVEOUT)
2456 SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
2457 if test x$have_dsound = xyes; then
2458 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
2459 SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
2463 # Set up files for the atomic operations library
2464 if test x$enable_atomic = xyes; then
2465 AC_DEFINE(SDL_ATOMIC_WIN32)
2466 SOURCES="$SOURCES $srcdir/src/atomic/win32/*.c"
2469 # Set up dummy files for the joystick for now
2470 if test x$enable_joystick = xyes; then
2471 AC_DEFINE(SDL_JOYSTICK_DUMMY)
2472 SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
2475 # Set up files for the thread library
2476 if test x$enable_threads = xyes; then
2477 AC_DEFINE(SDL_THREAD_WIN32)
2478 SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
2479 SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
2480 SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
2481 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
2484 # Set up files for the timer library
2485 if test x$enable_timers = xyes; then
2486 AC_DEFINE(SDL_TIMER_WINCE)
2487 SOURCES="$SOURCES $srcdir/src/timer/wince/*.c"
2490 # Set up files for the shared object loading library
2491 if test x$enable_loadso = xyes; then
2492 AC_DEFINE(SDL_LOADSO_WIN32)
2493 SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
2496 # Set up the system libraries we need
2497 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lcoredll -lcommctrl -lmmtimer"
2502 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmingwex"
2508 # The Win32 platform requires special setup
2509 SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
2510 EXTRA_CFLAGS="$EXTRA_CFLAGS -Dmain=SDL_main -D_WIN32_WCE=0x420"
2511 EXTRA_LDFLAGS="-lSDLmain $EXTRA_LDFLAGS"
2513 *-*-cygwin* | *-*-mingw32*)
2515 if test "$build" != "$host"; then # cross-compiling
2516 # Default cross-compile location
2517 ac_default_prefix=/usr/local/cross-tools/$host
2519 # Look for the location of the tools and install there
2520 if test "$BUILD_PREFIX" != ""; then
2521 ac_default_prefix=$BUILD_PREFIX
2530 # Set up files for the video library
2531 if test x$enable_video = xyes; then
2532 AC_DEFINE(SDL_VIDEO_DRIVER_WIN32)
2533 SOURCES="$SOURCES $srcdir/src/video/win32/*.c"
2535 AC_ARG_ENABLE(render-gdi,
2536 AC_HELP_STRING([--enable-render-gdi], [enable the GDI render driver [[default=yes]]]),
2537 , enable_render_gdi=yes)
2538 if test x$enable_render_gdi = xyes; then
2539 AC_DEFINE(SDL_VIDEO_RENDER_GDI)
2541 AC_ARG_ENABLE(render-d3d,
2542 AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
2543 , enable_render_d3d=yes)
2544 if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
2545 AC_DEFINE(SDL_VIDEO_RENDER_D3D)
2548 # Set up files for the audio library
2549 if test x$enable_audio = xyes; then
2550 AC_DEFINE(SDL_AUDIO_DRIVER_WINWAVEOUT)
2551 SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
2552 if test x$have_dsound = xyes; then
2553 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
2554 SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
2558 # Set up files for the atomic operations library
2559 if test x$enable_atomic = xyes; then
2560 AC_DEFINE(SDL_ATOMIC_WIN32)
2561 SOURCES="$SOURCES $srcdir/src/atomic/win32/*.c"
2564 # Set up files for the joystick library
2565 if test x$enable_joystick = xyes; then
2566 if test x$have_dinput = xyes; then
2567 AC_DEFINE(SDL_JOYSTICK_DINPUT)
2568 SOURCES="$SOURCES $srcdir/src/joystick/win32/SDL_dxjoystick.c"
2569 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8"
2571 AC_DEFINE(SDL_JOYSTICK_WINMM)
2572 SOURCES="$SOURCES $srcdir/src/joystick/win32/SDL_mmjoystick.c"
2576 if test x$enable_haptic = xyes; then
2577 if test x$have_dinput = xyes; then
2578 AC_DEFINE(SDL_HAPTIC_DINPUT)
2579 SOURCES="$SOURCES $srcdir/src/haptic/win32/SDL_syshaptic.c"
2583 if test x$enable_power = xyes; then
2584 AC_DEFINE(SDL_POWER_WINDOWS)
2585 SOURCES="$SOURCES $srcdir/src/power/windows/SDL_syspower.c"
2588 # Set up files for the thread library
2589 if test x$enable_threads = xyes; then
2590 AC_DEFINE(SDL_THREAD_WIN32)
2591 SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
2592 SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
2593 SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
2594 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
2597 # Set up files for the timer library
2598 if test x$enable_timers = xyes; then
2599 AC_DEFINE(SDL_TIMER_WIN32)
2600 SOURCES="$SOURCES $srcdir/src/timer/win32/*.c"
2603 # Set up files for the shared object loading library
2604 if test x$enable_loadso = xyes; then
2605 AC_DEFINE(SDL_LOADSO_WIN32)
2606 SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
2609 # Set up the system libraries we need
2610 # SDL 1.3 is unicode, and unicows emulates this on Windows 98/ME
2611 # You can get this here: http://libunicows.sourceforge.net/
2612 #EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lunicows"
2613 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lmsimg32 -lwinmm -limm32 -lole32 -loleaut32 -lversion -luuid"
2614 # The Win32 platform requires special setup
2615 VERSION_SOURCES="$srcdir/src/main/win32/*.rc"
2616 SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
2617 SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
2618 SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
2620 *-*-beos* | *-*-haiku*)
2622 ac_default_prefix=/boot/develop/tools/gnupro
2628 # Set up files for the audio library
2629 if test x$enable_audio = xyes; then
2630 AC_DEFINE(SDL_AUDIO_DRIVER_BEOSAUDIO)
2631 SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc"
2634 # Set up files for the joystick library
2635 if test x$enable_joystick = xyes; then
2636 AC_DEFINE(SDL_JOYSTICK_BEOS)
2637 SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc"
2640 # Set up files for the thread library
2641 if test x$enable_threads = xyes; then
2642 AC_DEFINE(SDL_THREAD_BEOS)
2643 SOURCES="$SOURCES $srcdir/src/thread/beos/*.c"
2644 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
2645 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
2648 # Set up files for the timer library
2649 if test x$enable_timers = xyes; then
2650 AC_DEFINE(SDL_TIMER_BEOS)
2651 SOURCES="$SOURCES $srcdir/src/timer/beos/*.c"
2654 # Set up files for the shared object loading library
2655 if test x$enable_loadso = xyes; then
2656 AC_DEFINE(SDL_LOADSO_BEOS)
2657 SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
2660 # Set up files for the system power library
2661 if test x$enable_power = xyes; then
2662 AC_DEFINE(SDL_POWER_BEOS)
2663 SOURCES="$SOURCES $srcdir/src/power/beos/*.c"
2666 # The BeOS platform requires special setup.
2667 SOURCES="$srcdir/src/main/beos/*.cc $SOURCES"
2668 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
2671 # This could be either full "Mac OS X", or plain "Darwin" which is
2672 # just the OS X kernel sans upper layers like Carbon and Cocoa.
2673 # Next line is broken, and a few files below require Mac OS X (full)
2676 # Mac OS X builds with both the Carbon and OSX APIs at the moment
2677 EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
2678 EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
2680 # HACK: Reset EXTRA_LDFLAGS; the only thing it contains at this point
2681 # is -lm which is not needed under Mac OS X. But for some reasons it
2682 # also tends to contain spurious -L switches, which we don't want to
2683 # use here or in sdl-config. Hence we reset it.
2686 CheckVisibilityHidden
2692 # Set up files for the shared object loading library
2693 # (this needs to be done before the dynamic X11 check)
2694 if test x$enable_loadso = xyes -a x$have_dlopen != xyes; then
2695 AC_DEFINE(SDL_LOADSO_DLCOMPAT)
2696 SOURCES="$SOURCES $srcdir/src/loadso/macosx/*.c"
2706 # Good optimization on Mac OS X, yes...
2707 EXTRA_CFLAGS="$EXTRA_CFLAGS -falign-loops=16"
2709 # Need this or things might misbuild on a G3.
2710 EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"
2712 # Set up files for the audio library
2713 if test x$enable_audio = xyes; then
2714 AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO)
2715 SOURCES="$SOURCES $srcdir/src/audio/macosx/*.c"
2718 # Set up files for the atomic operations library
2719 if test x$enable_atomic = xyes; then
2720 AC_DEFINE(SDL_ATOMIC_MACOSX)
2721 SOURCES="$SOURCES $srcdir/src/atomic/macosx/*.c"
2724 # Set up files for the joystick library
2725 if test x$enable_joystick = xyes; then
2726 AC_DEFINE(SDL_JOYSTICK_IOKIT)
2727 SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
2730 # Set up files for the haptic library
2731 if test x$enable_haptic = xyes; then
2732 AC_DEFINE(SDL_HAPTIC_IOKIT)
2733 SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
2735 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
2737 # Set up files for the power library
2738 if test x$enable_power = xyes; then
2739 AC_DEFINE(SDL_POWER_MACOSX)
2740 SOURCES="$SOURCES $srcdir/src/power/macosx/*.c"
2743 # Set up files for the timer library
2744 if test x$enable_timers = xyes; then
2745 AC_DEFINE(SDL_TIMER_UNIX)
2746 SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
2749 # Set up additional files for the file library
2750 if test x$enable_file = xyes; then
2751 SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
2753 # The Mac OS X platform requires special setup.
2754 EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
2755 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc"
2756 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
2757 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
2758 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
2759 # If audio is used, add the AudioUnit framework
2760 if test x$enable_audio = xyes; then
2761 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit"
2768 # Set up files for the video library
2769 if test x$enable_video = xyes; then
2770 AC_DEFINE(SDL_VIDEO_DRIVER_RISCOS)
2771 SOURCES="$SOURCES $srcdir/src/video/riscos/*.c"
2772 SOURCES="$SOURCES $srcdir/src/video/riscos/*.S"
2775 # Set up files for the joystick library
2776 if test x$enable_joystick = xyes; then
2777 AC_DEFINE(SDL_JOYSTICK_RISCOS)
2778 SOURCES="$SOURCES $srcdir/src/joystick/riscos/*.c"
2781 # Set up files for the timer library
2782 if test x$enable_timers = xyes; then
2783 AC_DEFINE(SDL_TIMER_RISCOS)
2784 SOURCES="$SOURCES $srcdir/src/timer/riscos/*.c"
2787 # The RISC OS platform requires special setup.
2788 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ljpeg -ltiff -lpng -lz"
2792 *** Unsupported host: Please add to configure.in
2797 # Verify that we have all the platform specific files we need
2799 if test x$have_joystick != xyes; then
2800 if test x$enable_joystick = xyes; then
2801 AC_DEFINE(SDL_JOYSTICK_DISABLED)
2803 SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
2805 if test x$have_haptic != xyes; then
2806 if test x$enable_haptic = xyes; then
2807 AC_DEFINE(SDL_HAPTIC_DISABLED)
2809 SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
2811 if test x$have_threads != xyes; then
2812 if test x$enable_threads = xyes; then
2813 AC_DEFINE(SDL_THREADS_DISABLED)
2815 SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
2817 if test x$have_timers != xyes; then
2818 if test x$enable_timers = xyes; then
2819 AC_DEFINE(SDL_TIMERS_DISABLED)
2821 SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
2823 if test x$have_loadso != xyes; then
2824 if test x$enable_loadso = xyes; then
2825 AC_DEFINE(SDL_LOADSO_DISABLED)
2827 SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
2829 if test x$SDLMAIN_SOURCES = x; then
2830 SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
2833 OBJECTS=`echo $SOURCES`
2834 DEPENDS=`echo $SOURCES`
2835 for EXT in asm cc m c S; do
2836 OBJECTS=`echo "$OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.'$EXT',$(objects)/\1.lo,g'`
2837 DEPENDS=`echo "$DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.$EXT,\\\\
2838 \\$(objects)/\\2.lo: \\1/\\2.$EXT\\\\
2839 \\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
2842 VERSION_OBJECTS=`echo $VERSION_SOURCES`
2843 VERSION_DEPENDS=`echo $VERSION_SOURCES`
2844 VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
2845 VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.rc,\\\\
2846 \\$(objects)/\\2.o: \\1/\\2.rc\\\\
2847 \\$(WINDRES) \\$< \\$@,g"`
2849 SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES`
2850 SDLMAIN_DEPENDS=`echo $SDLMAIN_SOURCES`
2851 SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
2852 SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
2853 \\$(objects)/\\2.o: \\1/\\2.c\\\\
2854 \\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
2856 # Set runtime shared library paths as needed
2858 if test "x$enable_rpath" = "xyes"; then
2859 if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = irix -o $ARCH = linux -o $ARCH = netbsd; then
2860 SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
2862 if test $ARCH = solaris; then
2863 SDL_RLD_FLAGS="-R\${libdir}"
2871 # Evil hack to allow static linking on Mac OS X
2872 SDL_STATIC_LIBS="\${libdir}/libSDL.a $EXTRA_LDFLAGS"
2875 SDL_STATIC_LIBS="$SDL_LIBS $EXTRA_LDFLAGS"
2879 dnl Expand the cflags and libraries needed by apps using SDL
2880 AC_SUBST(SDL_CFLAGS)
2882 AC_SUBST(SDL_STATIC_LIBS)
2883 AC_SUBST(SDL_RLD_FLAGS)
2884 if test x$enable_shared = xyes; then
2886 ENABLE_SHARED_FALSE="#"
2888 ENABLE_SHARED_TRUE="#"
2889 ENABLE_SHARED_FALSE=
2891 if test x$enable_static = xyes; then
2893 ENABLE_STATIC_FALSE="#"
2895 ENABLE_STATIC_TRUE="#"
2896 ENABLE_STATIC_FALSE=
2898 AC_SUBST(ENABLE_SHARED_TRUE)
2899 AC_SUBST(ENABLE_SHARED_FALSE)
2900 AC_SUBST(ENABLE_STATIC_TRUE)
2901 AC_SUBST(ENABLE_STATIC_FALSE)
2903 dnl Expand the sources and objects needed to build the library
2904 AC_SUBST(ac_aux_dir)
2908 AC_SUBST(VERSION_OBJECTS)
2909 AC_SUBST(VERSION_DEPENDS)
2910 AC_SUBST(SDLMAIN_OBJECTS)
2911 AC_SUBST(SDLMAIN_DEPENDS)
2912 AC_SUBST(BUILD_CFLAGS)
2913 AC_SUBST(EXTRA_CFLAGS)
2914 AC_SUBST(BUILD_LDFLAGS)
2915 AC_SUBST(EXTRA_LDFLAGS)
2919 Makefile sdl-config SDL.spec sdl.pc