configure.in
author Sam Lantinga <slouken@libsdl.org>
Tue, 18 Jan 2011 22:40:45 -0800
changeset 5029 5d7d48157be7
parent 5004 0c72ae7b7cb2
child 5030 6a0803e47c7b
permissions -rw-r--r--
Greg Jandl to SDL

I did some digging, and I think I've found a better solution. By
including some additional .m4 macros in the acinclude directory
(http://www.gnu.org/software/autoconf-archive/ax_check_compiler_flags.html,
http://www.gnu.org/software/autoconf-archive/ax_gcc_archflag.html and
http://www.gnu.org/software/autoconf-archive/ax_gcc_x86_cpuid.html)
then using the patch below (same as previous patch + one line change
to configure.in), SDL will build correctly out of the box.

The arch can then be overridden by --with-gcc-arch=<arch> (most will
probably want to build with i686 there for general distribution) or
--without-gcc-arch, to disable setting the arch all together.

On my Atom netbook, I get -march=PentiumPro by default, which works
great, as does --with-gcc-arch=i686.
     1 dnl Process this file with autoconf to produce a configure script.
     2 AC_INIT(README)
     3 AC_CONFIG_HEADER(include/SDL_config.h)
     4 AC_GNU_SOURCE
     5 AC_CONFIG_AUX_DIRS($srcdir/build-scripts)
     6 
     7 dnl Save the CFLAGS to see whether they were passed in or generated
     8 orig_CFLAGS="$CFLAGS"
     9 
    10 dnl Set various version strings - taken gratefully from the GTk sources
    11 #
    12 # Making releases:
    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.
    20 #
    21 SDL_MAJOR_VERSION=1
    22 SDL_MINOR_VERSION=3
    23 SDL_MICRO_VERSION=0
    24 SDL_INTERFACE_AGE=0
    25 SDL_BINARY_AGE=0
    26 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
    27 
    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)
    33 AC_SUBST(SDL_VERSION)
    34 
    35 # libtool versioning
    36 LT_INIT([win32-dll])
    37 
    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_])
    43 
    44 AC_SUBST(LT_RELEASE)
    45 AC_SUBST(LT_CURRENT)
    46 AC_SUBST(LT_REVISION)
    47 AC_SUBST(LT_AGE)
    48 
    49 dnl Detect the canonical build and host environments
    50 dnl AC_CANONICAL_HOST
    51 AX_GCC_ARCHFLAG([no])
    52 
    53 dnl Check for tools
    54 AC_PROG_LIBTOOL
    55 AC_PROG_CC
    56 AC_PROG_CXX
    57 AC_PROG_INSTALL
    58 AC_PROG_MAKE_SET
    59 if test -z "$host_alias"; then
    60     hostaliaswindres=
    61 else
    62     hostaliaswindres="$host_alias-windres"
    63 fi
    64 AC_CHECK_PROGS(WINDRES, [windres $hostaliaswindres $host_os-windres])
    65 
    66 dnl Set up the compiler and linker flags
    67 INCLUDE="-I$srcdir/include"
    68 if test x$srcdir != x.; then
    69     # Remove SDL_config.h from the source directory, since it's the
    70     # default one, and we want to include the one that we generate.
    71     if test -f $srcdir/include/SDL_config.h; then
    72         rm $srcdir/include/SDL_config.h
    73     fi
    74     INCLUDE="-Iinclude $INCLUDE"
    75 fi
    76 case "$host" in
    77     *-*-cygwin*)
    78         # We build SDL on cygwin without the UNIX emulation layer
    79         BASE_CFLAGS="-I/usr/include/mingw -mno-cygwin"
    80         BASE_LDFLAGS="-mno-cygwin"
    81         ;;
    82     *)
    83         BASE_CFLAGS=""
    84         BASE_LDFLAGS=""
    85         ;;
    86 esac
    87 BUILD_CFLAGS="$CFLAGS $CPPFLAGS"
    88 # The default optimization for SDL 1.3 is -O3 (Bug #31)
    89 if test x$orig_CFLAGS = x; then
    90     BUILD_CFLAGS=`echo $BUILD_CFLAGS | sed 's/-O2/-O3/'`
    91 fi
    92 EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS"
    93 BUILD_LDFLAGS="$LDFLAGS"
    94 EXTRA_LDFLAGS="$BASE_LDFLAGS"
    95 ## These are common directories to find software packages
    96 #for path in /usr/freeware /usr/pkg /usr/X11R6 /usr/local; do
    97 #    if test -d $path/include; then
    98 #        EXTRA_CFLAGS="$EXTRA_CFLAGS -I$path/include"
    99 #    fi
   100 #    if test -d $path/lib; then
   101 #        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$path/lib"
   102 #    fi
   103 #done
   104 SDL_CFLAGS="$BASE_CFLAGS"
   105 SDL_LIBS="-lSDL $BASE_LDFLAGS"
   106 CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS"
   107 CFLAGS="$CFLAGS $EXTRA_CFLAGS"
   108 LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
   109 
   110 dnl set this to use on systems that use lib64 instead of lib
   111 base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
   112 
   113 dnl Function to find a library in the compiler search path
   114 find_lib()
   115 {
   116     gcc_bin_path=[`$CC -print-search-dirs 2>/dev/null | fgrep programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
   117     gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
   118     env_lib_path=[`echo $LIBS $LDFLAGS $* | sed 's/-L[ ]*//g'`]
   119     if test "$cross_compiling" = yes; then
   120         host_lib_path=""
   121     else
   122         host_lib_path="/usr/$base_libdir /usr/local/$base_libdir"
   123     fi
   124     for path in $gcc_bin_path $gcc_lib_path $env_lib_path $host_lib_path; do
   125         lib=[`ls -- $path/$1 2>/dev/null | sort | sed 's/.*\/\(.*\)/\1/; q'`]
   126         if test x$lib != x; then
   127             echo $lib
   128             return
   129         fi
   130     done
   131 }
   132 
   133 dnl Check for compiler characteristics
   134 AC_C_CONST
   135 AC_C_INLINE
   136 AC_C_VOLATILE
   137 
   138 dnl See whether we want assertions for debugging/sanity checking SDL itself.
   139 AC_ARG_ENABLE(assertions,
   140 AC_HELP_STRING([--enable-assertions],
   141                [Enable internal sanity checks (auto/disabled/release/enabled/paranoid) [[default=auto]]]),
   142               , enable_assertions=auto)
   143 case "$enable_assertions" in
   144     auto) # Use optimization settings to determine assertion level
   145         ;;
   146     disabled)
   147         AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 0)
   148         ;;
   149     release)
   150         AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 1)
   151         ;;
   152     enabled)
   153         AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 2)
   154         ;;
   155     paranoid)
   156         AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 3)
   157         ;;
   158     *)
   159         AC_MSG_ERROR([*** unknown assertion level. stop.])
   160         ;;
   161 esac
   162 
   163 dnl See whether we can use gcc style dependency tracking
   164 AC_ARG_ENABLE(dependency-tracking,
   165 AC_HELP_STRING([--enable-dependency-tracking],
   166                [Use gcc -MMD -MT dependency tracking [[default=yes]]]),
   167               , enable_dependency_tracking=yes)
   168 if test x$enable_dependency_tracking = xyes; then
   169     have_gcc_mmd_mt=no
   170     AC_MSG_CHECKING(for GCC -MMD -MT option)
   171     AC_TRY_COMPILE([
   172     #if !defined(__GNUC__) || __GNUC__ < 3
   173     #error Dependency tracking requires GCC 3.0 or newer
   174     #endif
   175     ],[
   176     ],[
   177     have_gcc_mmd_mt=yes
   178     ])
   179     AC_MSG_RESULT($have_gcc_mmd_mt)
   180 
   181     if test x$have_gcc_mmd_mt = xyes; then
   182         DEPENDENCY_TRACKING_OPTIONS="-MMD -MT \$@"
   183     fi
   184 fi
   185 
   186 dnl See whether we are allowed to use the system C library
   187 AC_ARG_ENABLE(libc,
   188 AC_HELP_STRING([--enable-libc], [Use the system C library [[default=yes]]]),
   189               , enable_libc=yes)
   190 if test x$enable_libc = xyes; then
   191     AC_DEFINE(HAVE_LIBC)
   192 
   193     dnl Check for C library headers
   194     AC_HEADER_STDC
   195     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 
   197     dnl Check for typedefs, structures, etc.
   198     AC_TYPE_SIZE_T
   199     if test x$ac_cv_header_inttypes_h = xyes -o x$ac_cv_header_stdint_h = xyes; then
   200         AC_CHECK_TYPE(int64_t)
   201         if test x$ac_cv_type_int64_t = xyes; then
   202             AC_DEFINE(SDL_HAS_64BIT_TYPE)
   203         fi
   204         have_inttypes=yes
   205     fi
   206 
   207     dnl Check for defines
   208     AC_CHECK_DEFINE(M_PI, math.h)
   209 
   210     dnl Checks for library functions.
   211     case "$host" in
   212     *-*-cygwin* | *-*-mingw32*)
   213         ;;
   214     *)
   215         AC_FUNC_ALLOCA
   216         ;;
   217     esac
   218 
   219     AC_FUNC_MEMCMP
   220     if test x$ac_cv_func_memcmp_working = xyes; then
   221         AC_DEFINE(HAVE_MEMCMP)
   222     fi
   223     AC_FUNC_STRTOD
   224     if test x$ac_cv_func_strtod = xyes; then
   225         AC_DEFINE(HAVE_STRTOD)
   226     fi
   227     AC_CHECK_FUNC(mprotect,
   228         AC_TRY_COMPILE([
   229           #include <sys/types.h>
   230           #include <sys/mman.h>
   231         ],[
   232         ],[
   233         AC_DEFINE(HAVE_MPROTECT)
   234         ]),
   235     )
   236     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 
   238     AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
   239     AC_CHECK_FUNCS(atan atan2 ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt)
   240 
   241     AC_CHECK_LIB(iconv, libiconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"])
   242     AC_CHECK_FUNCS(iconv)
   243 fi
   244 
   245 AC_CHECK_SIZEOF(void*)
   246 if test x$have_inttypes != xyes; then
   247     AC_CHECK_SIZEOF(char, 1)
   248     AC_CHECK_SIZEOF(short, 2)
   249     AC_CHECK_SIZEOF(int, 4)
   250     AC_CHECK_SIZEOF(long, 4)
   251     AC_CHECK_SIZEOF(long long, 8)
   252     if test x$ac_cv_sizeof_char = x1; then
   253         AC_DEFINE(int8_t, signed char)
   254         AC_DEFINE(uint8_t, unsigned char)
   255     fi
   256     if test x$ac_cv_sizeof_short = x2; then
   257         AC_DEFINE(int16_t, signed short)
   258         AC_DEFINE(uint16_t, unsigned short)
   259     else
   260         if test x$ac_cv_sizeof_int = x2; then
   261             AC_DEFINE(int16_t, signed int)
   262             AC_DEFINE(uint16_t, unsigned int)
   263         fi
   264     fi
   265     if test x$ac_cv_sizeof_int = x4; then
   266         AC_DEFINE(int32_t, signed int)
   267         AC_DEFINE(uint32_t, unsigned int)
   268     else
   269         if test x$ac_cv_sizeof_long = x4; then
   270             AC_DEFINE(int32_t, signed long)
   271             AC_DEFINE(uint32_t, unsigned long)
   272         fi
   273     fi
   274     if test x$ac_cv_sizeof_long = x8; then
   275         AC_DEFINE(int64_t, signed long)
   276         AC_DEFINE(uint64_t, unsigned long)
   277         AC_DEFINE(SDL_HAS_64BIT_TYPE)
   278     else
   279         if test x$ac_cv_sizeof_long_long = x8; then
   280             AC_DEFINE(int64_t, signed long long)
   281             AC_DEFINE(uint64_t, unsigned long long)
   282             AC_DEFINE(SDL_HAS_64BIT_TYPE)
   283         fi
   284     fi
   285     AC_DEFINE(size_t, unsigned int)
   286     AC_DEFINE(uintptr_t, unsigned long)
   287 fi
   288 
   289 dnl See whether we can use gcc atomic operations on this architecture
   290 AC_ARG_ENABLE(gcc-atomics,
   291 AC_HELP_STRING([--enable-gcc-atomics],
   292                [Use gcc builtin atomics [[default=yes]]]),
   293               , enable_gcc_atomics=yes)
   294 if test x$enable_gcc_atomics = xyes; then
   295     have_gcc_atomics=no
   296     AC_MSG_CHECKING(for GCC builtin atomic operations)
   297     AC_TRY_LINK([
   298     ],[
   299     int a;
   300     void *x, *y, *z;
   301     __sync_lock_test_and_set(&a, 4);
   302     __sync_fetch_and_add(&a, 1);
   303     __sync_bool_compare_and_swap(&a, 5, 10);
   304     __sync_bool_compare_and_swap(&x, y, z);
   305     ],[
   306     have_gcc_atomics=yes
   307     ])
   308     AC_MSG_RESULT($have_gcc_atomics)
   309 
   310     if test x$have_gcc_mmd_mt = xyes; then
   311         AC_DEFINE(HAVE_GCC_ATOMICS)
   312     fi
   313 fi
   314 
   315 # Standard C sources
   316 SOURCES="$SOURCES $srcdir/src/*.c"
   317 SOURCES="$SOURCES $srcdir/src/audio/*.c"
   318 SOURCES="$SOURCES $srcdir/src/atomic/*.c"
   319 SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c"
   320 SOURCES="$SOURCES $srcdir/src/events/*.c"
   321 SOURCES="$SOURCES $srcdir/src/file/*.c"
   322 SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
   323 SOURCES="$SOURCES $srcdir/src/thread/*.c"
   324 SOURCES="$SOURCES $srcdir/src/timer/*.c"
   325 SOURCES="$SOURCES $srcdir/src/video/*.c"
   326 
   327 dnl Enable/disable various subsystems of the SDL library
   328 
   329 AC_ARG_ENABLE(atomic,
   330 AC_HELP_STRING([--enable-atomic], [Enable the atomic operations subsystem [[default=yes]]]),
   331               , enable_atomic=yes)
   332 if test x$enable_atomic != xyes; then
   333     AC_DEFINE(SDL_ATOMIC_DISABLED)
   334 fi
   335 AC_ARG_ENABLE(audio,
   336 AC_HELP_STRING([--enable-audio], [Enable the audio subsystem [[default=yes]]]),
   337               , enable_audio=yes)
   338 if test x$enable_audio != xyes; then
   339     AC_DEFINE(SDL_AUDIO_DISABLED)
   340 fi
   341 AC_ARG_ENABLE(video,
   342 AC_HELP_STRING([--enable-video], [Enable the video subsystem [[default=yes]]]),
   343               , enable_video=yes)
   344 if test x$enable_video != xyes; then
   345     AC_DEFINE(SDL_VIDEO_DISABLED)
   346 fi
   347 AC_ARG_ENABLE(events,
   348 AC_HELP_STRING([--enable-events], [Enable the events subsystem [[default=yes]]]),
   349               , enable_events=yes)
   350 if test x$enable_events != xyes; then
   351     AC_DEFINE(SDL_EVENTS_DISABLED)
   352 fi
   353 AC_ARG_ENABLE(joystick,
   354 AC_HELP_STRING([--enable-joystick], [Enable the joystick subsystem [[default=yes]]]),
   355               , enable_joystick=yes)
   356 if test x$enable_joystick != xyes; then
   357     AC_DEFINE(SDL_JOYSTICK_DISABLED)
   358 else
   359     SOURCES="$SOURCES $srcdir/src/joystick/*.c"
   360 fi
   361 AC_ARG_ENABLE(haptic,
   362 AC_HELP_STRING([--enable-haptic], [Enable the haptic (force feedback) subsystem [[default=yes]]]),
   363               , enable_haptic=yes)
   364 if test x$enable_haptic != xyes; then
   365     AC_DEFINE(SDL_HAPTIC_DISABLED)
   366 else
   367     SOURCES="$SOURCES $srcdir/src/haptic/*.c"
   368 fi
   369 AC_ARG_ENABLE(power,
   370 AC_HELP_STRING([--enable-power], [Enable the power subsystem [[default=yes]]]),
   371               , enable_power=yes)
   372 if test x$enable_power != xyes; then
   373     AC_DEFINE(SDL_POWER_DISABLED)
   374 else
   375     SOURCES="$SOURCES $srcdir/src/power/*.c"
   376 fi
   377 AC_ARG_ENABLE(threads,
   378 AC_HELP_STRING([--enable-threads], [Enable the threading subsystem [[default=yes]]]),
   379               , enable_threads=yes)
   380 if test x$enable_threads != xyes; then
   381     AC_DEFINE(SDL_THREADS_DISABLED)
   382 fi
   383 AC_ARG_ENABLE(timers,
   384 AC_HELP_STRING([--enable-timers], [Enable the timer subsystem [[default=yes]]]),
   385               , enable_timers=yes)
   386 if test x$enable_timers != xyes; then
   387     AC_DEFINE(SDL_TIMERS_DISABLED)
   388 fi
   389 AC_ARG_ENABLE(file,
   390 AC_HELP_STRING([--enable-file], [Enable the file subsystem [[default=yes]]]),
   391               , enable_file=yes)
   392 if test x$enable_file != xyes; then
   393     AC_DEFINE(SDL_FILE_DISABLED)
   394 fi
   395 AC_ARG_ENABLE(loadso,
   396 AC_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [[default=yes]]]),
   397               , enable_loadso=yes)
   398 if test x$enable_loadso != xyes; then
   399     AC_DEFINE(SDL_LOADSO_DISABLED)
   400 fi
   401 AC_ARG_ENABLE(cpuinfo,
   402 AC_HELP_STRING([--enable-cpuinfo], [Enable the cpuinfo subsystem [[default=yes]]]),
   403               , enable_cpuinfo=yes)
   404 if test x$enable_cpuinfo != xyes; then
   405     AC_DEFINE(SDL_CPUINFO_DISABLED)
   406 fi
   407 AC_ARG_ENABLE(assembly,
   408 AC_HELP_STRING([--enable-assembly], [Enable assembly routines [[default=yes]]]),
   409               , enable_assembly=yes)
   410 if test x$enable_assembly = xyes; then
   411     AC_DEFINE(SDL_ASSEMBLY_ROUTINES)
   412 
   413     # Make sure that we don't generate floating point code that would
   414     # cause illegal instruction exceptions on older processors
   415     case "$host" in
   416         *-*-darwin*)
   417             # Don't need to worry about Apple hardware, it's all SSE capable
   418             default_ssemath=yes
   419             ;;
   420         *64-*-*)
   421             # x86 64-bit architectures all have SSE instructions
   422             default_ssemath=yes
   423             ;;
   424         *)
   425             default_ssemath=no
   426             ;;
   427     esac
   428     AC_ARG_ENABLE(ssemath,
   429 AC_HELP_STRING([--enable-ssemath], [Allow GCC to use SSE floating point math [[default=no]]]),
   430                   , enable_ssemath=$default_ssemath)
   431     if test x$enable_ssemath = xno; then
   432         if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes; then
   433             EXTRA_CFLAGS="$EXTRA_CFLAGS -mfpmath=387"
   434         fi
   435     fi
   436 
   437     dnl Check for various instruction support
   438     AC_ARG_ENABLE(mmx,
   439 AC_HELP_STRING([--enable-mmx], [use MMX assembly routines [[default=yes]]]),
   440                   , enable_mmx=yes)
   441     if test x$enable_mmx = xyes; then
   442         save_CFLAGS="$CFLAGS"
   443         have_gcc_mmx=no
   444         AC_MSG_CHECKING(for GCC -mmmx option)
   445         mmx_CFLAGS="-mmmx"
   446         CFLAGS="$save_CFLAGS $mmx_CFLAGS"
   447 
   448         AC_TRY_COMPILE([
   449         #ifdef __MINGW32__
   450         #include <_mingw.h>
   451         #ifdef __MINGW64_VERSION_MAJOR
   452         #include <intrin.h>
   453         #else
   454         #include <mmintrin.h>
   455         #endif
   456         #else
   457         #include <mmintrin.h>
   458         #endif
   459         #ifndef __MMX__
   460         #error Assembler CPP flag not enabled
   461         #endif
   462         ],[
   463         ],[
   464         have_gcc_mmx=yes
   465         ])
   466         AC_MSG_RESULT($have_gcc_mmx)
   467         CFLAGS="$save_CFLAGS"
   468 
   469         if test x$have_gcc_mmx = xyes; then
   470             EXTRA_CFLAGS="$EXTRA_CFLAGS $mmx_CFLAGS"
   471         fi
   472     fi
   473 
   474     AC_ARG_ENABLE(3dnow,
   475 AC_HELP_STRING([--enable-3dnow], [use MMX assembly routines [[default=yes]]]),
   476                   , enable_3dnow=yes)
   477     if test x$enable_3dnow = xyes; then
   478         save_CFLAGS="$CFLAGS"
   479         have_gcc_3dnow=no
   480         AC_MSG_CHECKING(for GCC -m3dnow option)
   481         amd3dnow_CFLAGS="-m3dnow"
   482         CFLAGS="$save_CFLAGS $amd3dnow_CFLAGS"
   483 
   484         AC_TRY_COMPILE([
   485         #include <mm3dnow.h>
   486         #ifndef __3dNOW__
   487         #error Assembler CPP flag not enabled
   488         #endif
   489         ],[
   490         ],[
   491         have_gcc_3dnow=yes
   492         ])
   493         AC_MSG_RESULT($have_gcc_3dnow)
   494         CFLAGS="$save_CFLAGS"
   495 
   496         if test x$have_gcc_3dnow = xyes; then
   497             EXTRA_CFLAGS="$EXTRA_CFLAGS $amd3dnow_CFLAGS"
   498         fi
   499     fi
   500 
   501     AC_ARG_ENABLE(sse,
   502 AC_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]),
   503                   , enable_sse=yes)
   504     if test x$enable_sse = xyes; then
   505         save_CFLAGS="$CFLAGS"
   506         have_gcc_sse=no
   507         AC_MSG_CHECKING(for GCC -msse option)
   508         sse_CFLAGS="-msse"
   509         CFLAGS="$save_CFLAGS $sse_CFLAGS"
   510 
   511         AC_TRY_COMPILE([
   512         #ifdef __MINGW32__
   513         #include <_mingw.h>
   514         #ifdef __MINGW64_VERSION_MAJOR
   515         #include <intrin.h>
   516         #else
   517         #include <xmmintrin.h>
   518         #endif
   519         #else
   520         #include <xmmintrin.h>
   521         #endif
   522         #ifndef __SSE__
   523         #error Assembler CPP flag not enabled
   524         #endif
   525         ],[
   526         ],[
   527         have_gcc_sse=yes
   528         ])
   529         AC_MSG_RESULT($have_gcc_sse)
   530         CFLAGS="$save_CFLAGS"
   531 
   532         if test x$have_gcc_sse = xyes; then
   533             EXTRA_CFLAGS="$EXTRA_CFLAGS $sse_CFLAGS"
   534         fi
   535     fi
   536 
   537     AC_ARG_ENABLE(sse2,
   538 AC_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=no]]]),
   539                   , enable_sse2=$default_ssemath)
   540     if test x$enable_sse2 = xyes; then
   541         save_CFLAGS="$CFLAGS"
   542         have_gcc_sse2=no
   543         AC_MSG_CHECKING(for GCC -msse2 option)
   544         sse2_CFLAGS="-msse2"
   545         CFLAGS="$save_CFLAGS $sse2_CFLAGS"
   546 
   547         AC_TRY_COMPILE([
   548         #ifdef __MINGW32__
   549         #include <_mingw.h>
   550         #ifdef __MINGW64_VERSION_MAJOR
   551         #include <intrin.h>
   552         #else
   553         #include <emmintrin.h>
   554         #endif
   555         #else
   556         #include <emmintrin.h>
   557         #endif
   558         #ifndef __SSE2__
   559         #error Assembler CPP flag not enabled
   560         #endif
   561         ],[
   562         ],[
   563         have_gcc_sse2=yes
   564         ])
   565         AC_MSG_RESULT($have_gcc_sse2)
   566         CFLAGS="$save_CFLAGS"
   567 
   568         if test x$have_gcc_sse2 = xyes; then
   569             EXTRA_CFLAGS="$EXTRA_CFLAGS $sse2_CFLAGS"
   570         fi
   571     fi
   572 
   573     AC_ARG_ENABLE(altivec,
   574 AC_HELP_STRING([--enable-altivec], [use Altivec assembly routines [[default=yes]]]),
   575                   , enable_altivec=yes)
   576     if test x$enable_altivec = xyes; then
   577         save_CFLAGS="$CFLAGS"
   578         have_gcc_altivec=no
   579         have_altivec_h_hdr=no
   580         altivec_CFLAGS="-maltivec"
   581         CFLAGS="$save_CFLAGS $altivec_CFLAGS"
   582 
   583         AC_MSG_CHECKING(for Altivec with GCC altivec.h and -maltivec option)
   584         AC_TRY_COMPILE([
   585         #include <altivec.h>
   586         vector unsigned int vzero() {
   587             return vec_splat_u32(0);
   588         }
   589         ],[
   590         ],[
   591         have_gcc_altivec=yes
   592         have_altivec_h_hdr=yes
   593         ])
   594         AC_MSG_RESULT($have_gcc_altivec)
   595 
   596         if test x$have_gcc_altivec = xno; then
   597             AC_MSG_CHECKING(for Altivec with GCC -maltivec option)
   598             AC_TRY_COMPILE([
   599             vector unsigned int vzero() {
   600                 return vec_splat_u32(0);
   601             }
   602             ],[
   603             ],[
   604             have_gcc_altivec=yes
   605             ])
   606             AC_MSG_RESULT($have_gcc_altivec)
   607         fi
   608 
   609         if test x$have_gcc_altivec = xno; then
   610             AC_MSG_CHECKING(for Altivec with GCC altivec.h and -faltivec option)
   611             altivec_CFLAGS="-faltivec"
   612             CFLAGS="$save_CFLAGS $altivec_CFLAGS"
   613             AC_TRY_COMPILE([
   614             #include <altivec.h>
   615             vector unsigned int vzero() {
   616                 return vec_splat_u32(0);
   617             }
   618             ],[
   619             ],[
   620             have_gcc_altivec=yes
   621             have_altivec_h_hdr=yes
   622             ])
   623             AC_MSG_RESULT($have_gcc_altivec)
   624         fi
   625 
   626         if test x$have_gcc_altivec = xno; then
   627             AC_MSG_CHECKING(for Altivec with GCC -faltivec option)
   628             AC_TRY_COMPILE([
   629             vector unsigned int vzero() {
   630                 return vec_splat_u32(0);
   631             }
   632             ],[
   633             ],[
   634             have_gcc_altivec=yes
   635             ])
   636             AC_MSG_RESULT($have_gcc_altivec)
   637         fi
   638         CFLAGS="$save_CFLAGS"
   639 
   640         if test x$have_gcc_altivec = xyes; then
   641             AC_DEFINE(SDL_ALTIVEC_BLITTERS)
   642             if test x$have_altivec_h_hdr = xyes; then
   643               AC_DEFINE(HAVE_ALTIVEC_H)
   644             fi
   645             EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS"
   646         fi
   647     fi
   648 fi
   649 
   650 dnl See if the OSS audio interface is supported
   651 CheckOSS()
   652 {
   653     AC_ARG_ENABLE(oss,
   654 AC_HELP_STRING([--enable-oss], [support the OSS audio API [[default=yes]]]),
   655                   , enable_oss=yes)
   656     if test x$enable_audio = xyes -a x$enable_oss = xyes; then
   657         AC_MSG_CHECKING(for OSS audio support)
   658         have_oss=no
   659         if test x$have_oss != xyes; then
   660             AC_TRY_COMPILE([
   661               #include <sys/soundcard.h>
   662             ],[
   663               int arg = SNDCTL_DSP_SETFRAGMENT;
   664             ],[
   665             have_oss=yes
   666             ])
   667         fi
   668         if test x$have_oss != xyes; then
   669             AC_TRY_COMPILE([
   670               #include <soundcard.h>
   671             ],[
   672               int arg = SNDCTL_DSP_SETFRAGMENT;
   673             ],[
   674             have_oss=yes
   675             AC_DEFINE(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H)
   676             ])
   677         fi
   678         AC_MSG_RESULT($have_oss)
   679         if test x$have_oss = xyes; then
   680             AC_DEFINE(SDL_AUDIO_DRIVER_OSS)
   681             SOURCES="$SOURCES $srcdir/src/audio/dsp/*.c"
   682             SOURCES="$SOURCES $srcdir/src/audio/dma/*.c"
   683             have_audio=yes
   684 
   685             # We may need to link with ossaudio emulation library
   686             case "$host" in
   687                 *-*-openbsd*|*-*-netbsd*)
   688                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";;
   689             esac
   690         fi
   691     fi
   692 }
   693 
   694 dnl See if the ALSA audio interface is supported
   695 CheckALSA()
   696 {
   697     AC_ARG_ENABLE(alsa,
   698 AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [[default=yes]]]),
   699                   , enable_alsa=yes)
   700     if test x$enable_audio = xyes -a x$enable_alsa = xyes; then
   701         AM_PATH_ALSA(0.9.0, have_alsa=yes, have_alsa=no)
   702         # Restore all flags from before the ALSA detection runs
   703         CFLAGS="$alsa_save_CFLAGS"
   704         LDFLAGS="$alsa_save_LDFLAGS"
   705         LIBS="$alsa_save_LIBS"
   706         if test x$have_alsa = xyes; then
   707             AC_ARG_ENABLE(alsa-shared,
   708 AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [[default=yes]]]),
   709                           , enable_alsa_shared=yes)
   710             alsa_lib=[`find_lib "libasound.so.*" "$ALSA_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   711 
   712             AC_DEFINE(SDL_AUDIO_DRIVER_ALSA)
   713             SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c"
   714             EXTRA_CFLAGS="$EXTRA_CFLAGS $ALSA_CFLAGS"
   715             if test x$have_loadso != xyes && \
   716                test x$enable_alsa_shared = xyes; then
   717                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ALSA loading])
   718             fi
   719             if test x$have_loadso = xyes && \
   720                test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
   721                 echo "-- dynamic libasound -> $alsa_lib"
   722                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ALSA_DYNAMIC, "$alsa_lib")
   723             else
   724                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ALSA_LIBS"
   725             fi
   726             have_audio=yes
   727         fi
   728     fi
   729 }
   730 
   731 dnl Check whether we want to use IRIX 6.5+ native audio or not
   732 CheckDMEDIA()
   733 {
   734     if test x$enable_audio = xyes; then
   735         AC_MSG_CHECKING(for dmedia audio support)
   736         have_dmedia=no
   737         AC_TRY_COMPILE([
   738           #include <dmedia/audio.h>
   739         ],[
   740           ALport audio_port;
   741         ],[
   742         have_dmedia=yes
   743         ])
   744         AC_MSG_RESULT($have_dmedia)
   745         # Set up files for the audio library
   746         if test x$have_dmedia = xyes; then
   747             AC_DEFINE(SDL_AUDIO_DRIVER_DMEDIA)
   748             SOURCES="$SOURCES $srcdir/src/audio/dmedia/*.c"
   749             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -laudio"
   750             have_audio=yes
   751         fi
   752     fi
   753 }
   754 
   755 dnl Check whether we want to use Tru64 UNIX native audio or not
   756 CheckMME()
   757 {
   758     dnl Make sure we are running on an Tru64 UNIX
   759     case $ARCH in
   760         osf)
   761             ;;
   762         *)
   763             return
   764             ;;
   765     esac
   766     if test x$enable_audio = xyes; then
   767         AC_MSG_CHECKING(for MME audio support)
   768         MME_CFLAGS="-I/usr/include/mme"
   769         MME_LIBS="-lmme"
   770         have_mme=no
   771         save_CFLAGS="$CFLAGS"
   772         CFLAGS="$CFLAGS $MME_CFLAGS"
   773         AC_TRY_COMPILE([
   774           #include <mme_api.h>
   775         ],[
   776           HWAVEOUT sound;
   777         ],[
   778         have_mme=yes
   779         ])
   780         CFLAGS="$save_CFLAGS"
   781         AC_MSG_RESULT($have_mme)
   782         # Set up files for the audio library
   783         if test x$have_mme = xyes; then
   784             AC_DEFINE(SDL_AUDIO_DRIVER_MMEAUDIO)
   785             SOURCES="$SOURCES $srcdir/src/audio/mme/*.c"
   786             EXTRA_CFLAGS="$EXTRA_CFLAGS $MME_CFLAGS"
   787             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MME_LIBS"
   788             have_audio=yes
   789         fi
   790     fi
   791 }
   792 
   793 dnl Find the ESD includes and libraries
   794 CheckESD()
   795 {
   796     AC_ARG_ENABLE(esd,
   797 AC_HELP_STRING([--enable-esd], [support the Enlightened Sound Daemon [[default=yes]]]),
   798                   , enable_esd=yes)
   799     if test x$enable_audio = xyes -a x$enable_esd = xyes; then
   800         AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no)
   801         if test x$have_esd = xyes; then
   802             AC_ARG_ENABLE(esd-shared,
   803 AC_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [[default=yes]]]),
   804                           , enable_esd_shared=yes)
   805             esd_lib=[`find_lib "libesd.so.*" "$ESD_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   806 
   807             AC_DEFINE(SDL_AUDIO_DRIVER_ESD)
   808             SOURCES="$SOURCES $srcdir/src/audio/esd/*.c"
   809             EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS"
   810             if test x$have_loadso != xyes && \
   811                test x$enable_esd_shared = xyes; then
   812                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ESD loading])
   813             fi
   814             if test x$have_loadso = xyes && \
   815                test x$enable_esd_shared = xyes && test x$esd_lib != x; then
   816                 echo "-- dynamic libesd -> $esd_lib"
   817                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ESD_DYNAMIC, "$esd_lib")
   818             else
   819                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ESD_LIBS"
   820             fi
   821             have_audio=yes
   822         fi
   823     fi
   824 }
   825 
   826 dnl Find PulseAudio
   827 CheckPulseAudio()
   828 {
   829     AC_ARG_ENABLE(pulseaudio,
   830 AC_HELP_STRING([--enable-pulseaudio], [use PulseAudio [[default=yes]]]),
   831                   , enable_pulseaudio=yes)
   832     if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then
   833         audio_pulseaudio=no
   834 
   835         PULSEAUDIO_REQUIRED_VERSION=0.9
   836 
   837         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
   838         AC_MSG_CHECKING(for PulseAudio $PULSEAUDIO_REQUIRED_VERSION support)
   839         if test x$PKG_CONFIG != xno; then
   840         if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSEAUDIO_REQUIRED_VERSION libpulse-simple; then
   841                 PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple`
   842                 PULSEAUDIO_LIBS=`$PKG_CONFIG --libs libpulse-simple`
   843                 audio_pulseaudio=yes
   844             fi
   845         fi
   846         AC_MSG_RESULT($audio_pulseaudio)
   847 
   848         if test x$audio_pulseaudio = xyes; then
   849             AC_ARG_ENABLE(pulseaudio-shared,
   850 AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [[default=yes]]]),
   851                           , enable_pulseaudio_shared=yes)
   852             pulseaudio_lib=[`find_lib "libpulse-simple.so.*" "$PULSEAUDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   853 
   854             AC_DEFINE(SDL_AUDIO_DRIVER_PULSEAUDIO)
   855             SOURCES="$SOURCES $srcdir/src/audio/pulseaudio/*.c"
   856             EXTRA_CFLAGS="$EXTRA_CFLAGS $PULSEAUDIO_CFLAGS"
   857             if test x$have_loadso != xyes && \
   858                test x$enable_pulseaudio_shared = xyes; then
   859                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic PulseAudio loading])
   860             fi
   861             if test x$have_loadso = xyes && \
   862                test x$enable_pulseaudio_shared = xyes && test x$pulseaudio_lib != x; then
   863                 echo "-- dynamic libpulse-simple -> $pulseaudio_lib"
   864                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC, "$pulseaudio_lib")
   865             else
   866                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PULSEAUDIO_LIBS"
   867             fi
   868             have_audio=yes
   869         fi
   870     fi
   871 }
   872 
   873 CheckARTSC()
   874 {
   875     AC_ARG_ENABLE(arts,
   876 AC_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [[default=yes]]]),
   877                   , enable_arts=yes)
   878     if test x$enable_audio = xyes -a x$enable_arts = xyes; then
   879         AC_PATH_PROG(ARTSCONFIG, artsc-config)
   880         if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then
   881             : # arts isn't installed
   882         else
   883             ARTS_CFLAGS=`$ARTSCONFIG --cflags`
   884             ARTS_LIBS=`$ARTSCONFIG --libs`
   885             AC_MSG_CHECKING(for aRts development environment)
   886             audio_arts=no
   887             save_CFLAGS="$CFLAGS"
   888             CFLAGS="$CFLAGS $ARTS_CFLAGS"
   889             AC_TRY_COMPILE([
   890              #include <artsc.h>
   891             ],[
   892              arts_stream_t stream;
   893             ],[
   894             audio_arts=yes
   895             ])
   896             CFLAGS="$save_CFLAGS"
   897             AC_MSG_RESULT($audio_arts)
   898             if test x$audio_arts = xyes; then
   899                 AC_ARG_ENABLE(arts-shared,
   900 AC_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [[default=yes]]]),
   901                               , enable_arts_shared=yes)
   902                 arts_lib=[`find_lib "libartsc.so.*" "$ARTS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   903 
   904                 AC_DEFINE(SDL_AUDIO_DRIVER_ARTS)
   905                 SOURCES="$SOURCES $srcdir/src/audio/arts/*.c"
   906                 EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS"
   907                 if test x$have_loadso != xyes && \
   908                    test x$enable_arts_shared = xyes; then
   909                     AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ARTS loading])
   910                 fi
   911                 if test x$have_loadso = xyes && \
   912                    test x$enable_arts_shared = xyes && test x$arts_lib != x; then
   913                     echo "-- dynamic libartsc -> $arts_lib"
   914                     AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ARTS_DYNAMIC, "$arts_lib")
   915                 else
   916                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS"
   917                 fi
   918                 have_audio=yes
   919             fi
   920         fi
   921     fi
   922 }
   923 
   924 dnl See if the NAS audio interface is supported
   925 CheckNAS()
   926 {
   927     AC_ARG_ENABLE(nas,
   928 AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]),
   929                   , enable_nas=yes)
   930     if test x$enable_audio = xyes -a x$enable_nas = xyes; then
   931         AC_CHECK_HEADER(audio/audiolib.h, have_nas_hdr=yes)
   932         AC_CHECK_LIB(audio, AuOpenServer, have_nas_lib=yes)
   933 
   934         AC_MSG_CHECKING(for NAS audio support)
   935         have_nas=no
   936 
   937         if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then
   938             have_nas=yes
   939             NAS_LIBS="-laudio"
   940 
   941         elif test -r /usr/X11R6/include/audio/audiolib.h; then
   942             have_nas=yes
   943             NAS_CFLAGS="-I/usr/X11R6/include/"
   944             NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt"
   945 
   946         dnl On IRIX, the NAS includes are in a different directory,
   947         dnl and libnas must be explicitly linked in
   948 
   949         elif test -r /usr/freeware/include/nas/audiolib.h; then
   950             have_nas=yes
   951             NAS_LIBS="-lnas -lXt"
   952         fi
   953 
   954         AC_MSG_RESULT($have_nas)
   955 
   956         if test x$have_nas = xyes; then
   957             AC_ARG_ENABLE(nas-shared,
   958 AC_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[default=yes]]]),
   959                           , enable_nas_shared=yes)
   960             nas_lib=[`find_lib "libaudio.so.*" "$NAS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
   961 
   962             if test x$have_loadso != xyes && \
   963                test x$enable_nas_shared = xyes; then
   964                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic NAS loading])
   965             fi
   966             if test x$have_loadso = xyes && \
   967                test x$enable_nas_shared = xyes && test x$nas_lib != x; then
   968                 echo "-- dynamic libaudio -> $nas_lib"
   969                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_NAS_DYNAMIC, "$nas_lib")
   970             else
   971                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS"
   972             fi
   973 
   974             AC_DEFINE(SDL_AUDIO_DRIVER_NAS)
   975             SOURCES="$SOURCES $srcdir/src/audio/nas/*.c"
   976             EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS"
   977             have_audio=yes
   978         fi
   979     fi
   980 }
   981 
   982 dnl rcg07142001 See if the user wants the disk writer audio driver...
   983 CheckDiskAudio()
   984 {
   985     AC_ARG_ENABLE(diskaudio,
   986 AC_HELP_STRING([--enable-diskaudio], [support the disk writer audio driver [[default=yes]]]),
   987                   , enable_diskaudio=yes)
   988     if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
   989         AC_DEFINE(SDL_AUDIO_DRIVER_DISK)
   990         SOURCES="$SOURCES $srcdir/src/audio/disk/*.c"
   991     fi
   992 }
   993 
   994 dnl rcg03142006 See if the user wants the dummy audio driver...
   995 CheckDummyAudio()
   996 {
   997     AC_ARG_ENABLE(dummyaudio,
   998 AC_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [[default=yes]]]),
   999                   , enable_dummyaudio=yes)
  1000     if test x$enable_audio = xyes -a x$enable_dummyaudio = xyes; then
  1001         AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY)
  1002         SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c"
  1003     fi
  1004 }
  1005 
  1006 dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
  1007 dnl  Details of this flag are here: http://gcc.gnu.org/wiki/Visibility
  1008 CheckVisibilityHidden()
  1009 {
  1010     AC_MSG_CHECKING(for GCC -fvisibility=hidden option)
  1011     have_gcc_fvisibility=no
  1012 
  1013     visibility_CFLAGS="-fvisibility=hidden"
  1014     save_CFLAGS="$CFLAGS"
  1015     CFLAGS="$save_CFLAGS $visibility_CFLAGS -Werror"
  1016     AC_TRY_COMPILE([
  1017     #if !defined(__GNUC__) || __GNUC__ < 4
  1018     #error SDL only uses visibility attributes in GCC 4 or newer
  1019     #endif
  1020     ],[
  1021     ],[
  1022     have_gcc_fvisibility=yes
  1023     ])
  1024     AC_MSG_RESULT($have_gcc_fvisibility)
  1025     CFLAGS="$save_CFLAGS"
  1026 
  1027     if test x$have_gcc_fvisibility = xyes; then
  1028         EXTRA_CFLAGS="$EXTRA_CFLAGS $visibility_CFLAGS"
  1029     fi
  1030 }
  1031 
  1032 
  1033 dnl Find the X11 include and library directories
  1034 CheckX11()
  1035 {
  1036 
  1037 
  1038     AC_ARG_ENABLE(video-x11,
  1039 AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]),
  1040                   , enable_video_x11=yes)
  1041     if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
  1042         case "$host" in
  1043             *-*-darwin*)
  1044                 # This isn't necessary for X11, but fixes GLX detection
  1045                 if test "x$x_includes" = xNONE && test "x$x_libraries" = xNONE; then
  1046                     x_includes="/usr/X11R6/include"
  1047                     x_libraries="/usr/X11R6/lib"
  1048                 fi
  1049                 ;;
  1050         esac
  1051         AC_PATH_X
  1052         AC_PATH_XTRA
  1053         if test x$have_x = xyes; then
  1054             # Only allow dynamically loaded X11 if the X11 function pointers
  1055             # will not end up in the global namespace, which causes problems
  1056             # with other libraries calling X11 functions.
  1057             x11_symbols_private=$have_gcc_fvisibility
  1058 
  1059             AC_ARG_ENABLE(x11-shared,
  1060 AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=maybe]]]),
  1061                           , enable_x11_shared=maybe)
  1062 
  1063             case "$host" in
  1064                 *-*-darwin*) # Latest Mac OS X actually ships with Xrandr/Xrender libs...
  1065                     x11_symbols_private=yes
  1066                     x11_lib='/usr/X11R6/lib/libX11.6.dylib'
  1067                     x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
  1068                     xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
  1069                     xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
  1070                     xinput_lib='/usr/X11R6/lib/libXi.6.dylib'
  1071                     xss_lib='/usr/X11R6/lib/libXss.6.dylib'
  1072                     xdamage_lib='/usr/X11R6/lib/libXdamage.1.dylib'
  1073                     xfixes_lib='/usr/X11R6/lib/libXfixes.3.dylib'
  1074                     ;;
  1075                 *-*-osf*)
  1076                     x11_lib='libX11.so'
  1077                     x11ext_lib='libXext.so'
  1078                     ;;
  1079                 *-*-irix*) # IRIX 6.5 requires that we use /usr/lib32
  1080                     x11_lib='libX11.so'
  1081                     x11ext_lib='libXext.so'
  1082                     ;;
  1083                 *)
  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                     xrender_lib=[`find_lib "libXrender.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1087                     xrandr_lib=[`find_lib "libXrandr.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                     xss_lib=[`find_lib "libXss.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1090                     xdamage_lib=[`find_lib "libXdamage.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1091                     xfixes_lib=[`find_lib "libXfixes.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1092                     ;;
  1093             esac
  1094 
  1095             if test x$ac_cv_func_shmat != xyes; then
  1096                 X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY"
  1097             fi
  1098             CFLAGS="$CFLAGS $X_CFLAGS"
  1099             LDFLAGS="$LDFLAGS $X_LIBS"
  1100 
  1101             AC_DEFINE(SDL_VIDEO_DRIVER_X11)
  1102             SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
  1103             SOURCES="$SOURCES $srcdir/src/video/Xext/XmuStdCmap/*.c"
  1104             EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
  1105 
  1106             if test x$enable_x11_shared = xmaybe; then
  1107                 enable_x11_shared=$x11_symbols_private
  1108             fi
  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
  1113             fi
  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
  1118             fi
  1119 
  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")
  1126             else
  1127                 enable_x11_shared=no
  1128                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
  1129             fi
  1130             have_video=yes
  1131 
  1132             AC_ARG_ENABLE(video-x11-vm,
  1133 AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[default=yes]]]),
  1134                           , enable_video_x11_vm=yes)
  1135             if test x$enable_video_x11_vm = xyes; then
  1136                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_VIDMODE)
  1137                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xxf86vm/*.c"
  1138             fi
  1139             AC_ARG_ENABLE(video-x11-xv,
  1140 AC_HELP_STRING([--enable-video-x11-xv], [use X11 XvImage extension for video [[default=yes]]]),
  1141                           , enable_video_x11_xv=yes)
  1142             if test x$enable_video_x11_xv = xyes; then
  1143                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XV)
  1144                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xv/*.c"
  1145             fi
  1146             AC_ARG_ENABLE(video-x11-xinerama,
  1147 AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]),
  1148                             , enable_video_x11_xinerama=yes)
  1149             if test x$enable_video_x11_xinerama = xyes; then
  1150                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA)
  1151                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xinerama/*.c"
  1152             fi
  1153             AC_ARG_ENABLE(video-x11-xshape,
  1154 AC_HELP_STRING([--enable-video-x11-xshape], [enable X11 XShape support [[default=yes]]]),
  1155                             , enable_video_x11_xshape=yes)
  1156             if test x$enable_video_x11_xshape = xyes; then
  1157                 AC_CHECK_HEADER(X11/extensions/shape.h,
  1158                                 have_shape_h_hdr=yes,
  1159                                 have_shape_h_hdr=no,
  1160                                 [#include <X11/Xlib.h>
  1161                                 ])
  1162                 if test x$have_shape_h_hdr = xyes; then
  1163                     AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSHAPE)
  1164                 fi
  1165             fi
  1166             AC_ARG_ENABLE(video-x11-xrandr,
  1167 AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]),
  1168                             , enable_video_x11_xrandr=yes)
  1169             if test x$enable_video_x11_xrandr = xyes; then
  1170                 definitely_enable_video_x11_xrandr=no
  1171                 AC_CHECK_HEADER(X11/extensions/Xrandr.h,
  1172                                 have_xrandr_h_hdr=yes,
  1173                                 have_xrandr_h_hdr=no,
  1174                                 [#include <X11/Xlib.h>
  1175                                 ])
  1176                 if test x$have_xrandr_h_hdr = xyes; then
  1177                     if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then
  1178                         echo "-- dynamic libXrandr -> $xrandr_lib"
  1179                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib")
  1180                         definitely_enable_video_x11_xrandr=yes
  1181                     else
  1182                         AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes)
  1183                         if test x$have_xrandr_lib = xyes ; then
  1184                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr"
  1185                             definitely_enable_video_x11_xrandr=yes
  1186                         fi
  1187                     fi
  1188                 fi
  1189             fi
  1190             if test x$definitely_enable_video_x11_xrandr = xyes; then
  1191                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR)
  1192             fi
  1193             AC_ARG_ENABLE(video-x11-xinput,
  1194 AC_HELP_STRING([--enable-video-x11-xinput], [enable X11 XInput extension for manymouse, tablets, etc [[default=yes]]]),
  1195                             , enable_video_x11_xinput=yes)
  1196             if test x$enable_video_x11_xinput = xyes; then
  1197                 definitely_enable_video_x11_xinput=no
  1198                 AC_CHECK_HEADER(X11/extensions/XInput.h,
  1199                                 have_xinput_h_hdr=yes,
  1200                                 have_xinput_h_hdr=no,
  1201                                 [#include <X11/Xlib.h>
  1202                                 ])
  1203                 if test x$have_xinput_h_hdr = xyes; then
  1204                     if test x$enable_x11_shared = xyes && test x$xinput_lib != x ; then
  1205                         echo "-- dynamic libXi -> $xinput_lib"
  1206                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT, "$xinput_lib")
  1207                         definitely_enable_video_x11_xinput=yes
  1208                     else
  1209                         AC_CHECK_LIB(Xi, XOpenDevice, have_xinput_lib=yes)
  1210                         if test x$have_xinput_lib = xyes ; then
  1211                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXi"
  1212                             definitely_enable_video_x11_xinput=yes
  1213                         fi
  1214                     fi
  1215                 fi
  1216             fi
  1217             if test x$definitely_enable_video_x11_xinput = xyes; then
  1218                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT)
  1219             fi
  1220             AC_ARG_ENABLE(video-x11-scrnsaver,
  1221 AC_HELP_STRING([--enable-video-x11-scrnsaver], [enable X11 screensaver extension [[default=yes]]]),
  1222                             , enable_video_x11_scrnsaver=yes)
  1223             if test x$enable_video_x11_scrnsaver = xyes; then
  1224                 AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
  1225                                 have_scrnsaver_h_hdr=yes,
  1226                                 have_scrnsaver_h_hdr=no,
  1227                                 [#include <X11/Xlib.h>
  1228                                 ])
  1229                 if test x$have_scrnsaver_h_hdr = xyes; then
  1230                     if test x$enable_x11_shared = xyes && test x$xss_lib != x ; then
  1231                         echo "-- dynamic libXss -> $xss_lib"
  1232                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS, "$xss_lib")
  1233                         definitely_enable_video_x11_scrnsaver=yes
  1234                     else
  1235                         AC_CHECK_LIB(Xss, XScreenSaverSuspend, have_xss_lib=yes)
  1236                         if test x$have_xss_lib = xyes ; then
  1237                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXss"
  1238                             definitely_enable_video_x11_scrnsaver=yes
  1239                         fi
  1240                     fi
  1241                 fi
  1242             fi
  1243             if test x$definitely_enable_video_x11_scrnsaver = xyes; then
  1244                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_SCRNSAVER)
  1245             fi
  1246             AC_ARG_ENABLE(video-x11-xrender,
  1247 AC_HELP_STRING([--enable-video-x11-xrender], [enable X11 Xrender extension [[default=yes]]]),
  1248                             , enable_video_x11_xrender=yes)
  1249             if test x$enable_video_x11_xrender = xyes; then
  1250                 AC_CHECK_HEADER(X11/extensions/Xrender.h,
  1251                                 have_xrender_h_hdr=yes,
  1252                                 have_xrender_h_hdr=no,
  1253                                 [#include <X11/Xlib.h>
  1254                                 ])
  1255                 if test x$have_xrender_h_hdr = xyes; then
  1256                     if test x$enable_x11_shared = xyes && test x$xrender_lib != x ; then
  1257                         echo "-- dynamic libXrender -> $xrender_lib"
  1258                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER, "$xrender_lib")
  1259                         definitely_enable_video_x11_xrender=yes
  1260                     else
  1261                         AC_CHECK_LIB(Xrender, XRenderQueryExtension, have_xrender_lib=yes)
  1262                         if test x$have_xrender_lib = xyes ; then
  1263                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrender"
  1264                             definitely_enable_video_x11_xrender=yes
  1265                         fi
  1266                     fi
  1267                 fi
  1268             fi
  1269             if test x$definitely_enable_video_x11_xrender = xyes; then
  1270                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRENDER)
  1271             fi
  1272             AC_ARG_ENABLE(video-x11-xdamage-xfixes,
  1273 AC_HELP_STRING([--enable-video-x11-xdamage-xfixes], [enable X11 Xdamage and Xfixes extensions [[default=yes]]]),
  1274                             , enable_video_x11_xdamage=yes)
  1275             if test x$enable_video_x11_xdamage = xyes && test x$definitely_enable_video_x11_xrender = xyes ; then
  1276                 AC_CHECK_HEADER(X11/extensions/Xdamage.h,
  1277                                 have_xdamage_h_hdr=yes,
  1278                                 have_xdamage_h_hdr=no,
  1279                                 [#include <X11/Xlib.h>
  1280                                 ])
  1281                 AC_CHECK_HEADER(X11/extensions/Xfixes.h,
  1282                                 have_xfixes_h_hdr=yes,
  1283                                 have_xfixes_h_hdr=no,
  1284                                 [#include <X11/Xlib.h>
  1285                                 ])
  1286                 if test x$have_xdamage_h_hdr = xyes && test x$have_xfixes_h_hdr = xyes ; then
  1287                     if test x$enable_x11_shared = xyes && test x$xdamage_lib != x && test x$xfixes_lib != x ; then
  1288                         echo "-- dynamic libXdamage -> $xdamage_lib"
  1289                         echo "-- dynamic libXfixes -> $xfixes_lib"
  1290                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XDAMAGE, "$xdamage_lib")
  1291                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES, "$xfixes_lib")
  1292                         definitely_enable_video_x11_xdamage=yes
  1293                         definitely_enable_video_x11_xfixes=yes
  1294                     else
  1295                         AC_CHECK_LIB(Xdamage, XDamageQueryExtension, have_xdamage_lib=yes)
  1296                         AC_CHECK_LIB(Xfixes, XFixesQueryExtension, have_xfixes_lib=yes)
  1297                         if test x$have_xdamage_lib = xyes && test x$have_xfixes_lib = xyes ; then
  1298                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXdamage -lXfixes"
  1299                             definitely_enable_video_x11_xdamage=yes
  1300                             definitely_enable_video_x11_xfixes=yes
  1301                         fi
  1302                     fi
  1303                 fi
  1304             fi
  1305             if test x$definitely_enable_video_x11_xdamage = xyes && test x$definitely_enable_video_x11_xfixes = xyes ; then
  1306                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XDAMAGE)
  1307                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XFIXES)
  1308             fi
  1309             AC_ARG_ENABLE(render-x11,
  1310 AC_HELP_STRING([--enable-render-x11], [enable the X11 render driver [[default=yes]]]),
  1311                                 , enable_render_x11=yes)
  1312             if test x$enable_render_x11 = xyes; then
  1313                 AC_DEFINE(SDL_VIDEO_RENDER_X11)
  1314             fi
  1315         fi
  1316     fi
  1317 }
  1318 
  1319 dnl Check for QNX photon video driver
  1320 CheckPHOTON()
  1321 {
  1322     AC_ARG_ENABLE(video-photon,
  1323 AC_HELP_STRING([--enable-video-photon], [use QNX Photon video driver [[default=yes]]]),
  1324                   , enable_video_photon=yes)
  1325     if test x$enable_video = xyes -a x$enable_video_photon = xyes; then
  1326         AC_MSG_CHECKING(for QNX Photon support)
  1327         video_photon=no
  1328         AC_TRY_COMPILE([
  1329           #include <Ph.h>
  1330           #include <Pt.h>
  1331           #include <photon/Pg.h>
  1332           #include <photon/PdDirect.h>
  1333         ],[
  1334          PgDisplaySettings_t *visual;
  1335         ],[
  1336         video_photon=yes
  1337         ])
  1338         AC_MSG_RESULT($video_photon)
  1339         if test x$video_photon = xyes; then
  1340             AC_DEFINE(SDL_VIDEO_DRIVER_PHOTON)
  1341             SOURCES="$SOURCES $srcdir/src/video/photon/*.c"
  1342             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lph -lphrender"
  1343             have_video=yes
  1344 
  1345             CheckOpenGLQNX
  1346         fi
  1347     fi
  1348 }
  1349 
  1350 dnl Check for QNX photon video driver
  1351 CheckQNXGF()
  1352 {
  1353     AC_ARG_ENABLE(video-qnxgf,
  1354                   AC_HELP_STRING([--enable-video-qnxgf], [use QNX GF video driver [[default=yes]]]),
  1355                   , enable_video_qnxgf=yes)
  1356     if test x$enable_video = xyes -a x$enable_video_qnxgf = xyes; then
  1357         AC_MSG_CHECKING(for QNX GF support)
  1358         video_qnxgf=no
  1359         AC_TRY_COMPILE([
  1360           #include <gf/gf.h>
  1361           #include <gf/gf3d.h>
  1362         ],[
  1363          gf_3d_config_info_t* gfinfo;
  1364         ],[
  1365         video_qnxgf=yes
  1366         ])
  1367         AC_MSG_RESULT($video_qnxgf)
  1368         if test x$video_qnxgf = xyes; then
  1369             AC_DEFINE(SDL_VIDEO_DRIVER_QNXGF)
  1370             SOURCES="$SOURCES $srcdir/src/video/qnxgf/*.c"
  1371             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lgf"
  1372 
  1373             # Add HIDDI library for HID support using GF
  1374             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lhiddi"
  1375 
  1376             have_video=yes
  1377 
  1378             CheckOpenGLESQNX
  1379         fi
  1380     fi
  1381 }
  1382 
  1383 dnl Set up the BWindow video driver if enabled
  1384 CheckBWINDOW()
  1385 {
  1386     if test x$enable_video = xyes; then
  1387         AC_DEFINE(SDL_VIDEO_DRIVER_BWINDOW)
  1388         SOURCES="$SOURCES $srcdir/src/video/bwindow/*.cc"
  1389         have_video=yes
  1390     fi
  1391 }
  1392 
  1393 dnl Set up the Cocoa video driver for Mac OS X (but not Darwin)
  1394 CheckCOCOA()
  1395 {
  1396     AC_ARG_ENABLE(video-cocoa,
  1397 AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]),
  1398                   , enable_video_cocoa=yes)
  1399     if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
  1400         save_CFLAGS="$CFLAGS"
  1401         dnl work around that we don't have Objective-C support in autoconf
  1402         CFLAGS="$CFLAGS -x objective-c"
  1403         AC_MSG_CHECKING(for Cocoa framework)
  1404         have_cocoa=no
  1405         AC_TRY_COMPILE([
  1406           #import <Cocoa/Cocoa.h>
  1407         ],[
  1408         ],[
  1409         have_cocoa=yes
  1410         ])
  1411         AC_MSG_RESULT($have_cocoa)
  1412         CFLAGS="$save_CFLAGS"
  1413         if test x$have_cocoa = xyes; then
  1414             AC_DEFINE(SDL_VIDEO_DRIVER_COCOA)
  1415             SOURCES="$SOURCES $srcdir/src/video/cocoa/*.m"
  1416             have_video=yes
  1417         fi
  1418     fi
  1419 }
  1420 
  1421 dnl Find the framebuffer console includes
  1422 CheckFBCON()
  1423 {
  1424     AC_ARG_ENABLE(video-fbcon,
  1425 AC_HELP_STRING([--enable-video-fbcon], [use framebuffer console video driver [[default=no]]]),
  1426                   , enable_video_fbcon=no)
  1427     if test x$enable_video = xyes -a x$enable_video_fbcon = xyes; then
  1428         AC_MSG_CHECKING(for framebuffer console support)
  1429         video_fbcon=no
  1430         AC_TRY_COMPILE([
  1431          #include <linux/fb.h>
  1432          #include <linux/kd.h>
  1433          #include <linux/keyboard.h>
  1434         ],[
  1435         ],[
  1436         video_fbcon=yes
  1437         ])
  1438         AC_MSG_RESULT($video_fbcon)
  1439         if test x$video_fbcon = xyes; then
  1440             AC_CHECK_FUNCS(getpagesize)
  1441             AC_DEFINE(SDL_VIDEO_DRIVER_FBCON)
  1442             SOURCES="$SOURCES $srcdir/src/video/fbcon/*.c"
  1443             have_video=yes
  1444         fi
  1445     fi
  1446 }
  1447 
  1448 dnl Find DirectFB
  1449 CheckDirectFB()
  1450 {
  1451     AC_ARG_ENABLE(video-directfb,
  1452 AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=no]]]),
  1453                   , enable_video_directfb=no)
  1454     if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
  1455         video_directfb=no
  1456 
  1457         DIRECTFB_REQUIRED_VERSION=1.0.0
  1458 
  1459         AC_PATH_PROG(DIRECTFBCONFIG, directfb-config, no)
  1460         if test x$DIRECTFBCONFIG = xno; then
  1461             AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1462             if test x$PKG_CONFIG != xno; then
  1463                 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb; then
  1464                     DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
  1465                     DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
  1466                     DIRECTFB_PREFIX=`$PKG_CONFIG --variable=prefix directfb`
  1467                     video_directfb=yes
  1468                 fi
  1469             fi
  1470         else
  1471             set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'`
  1472             NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
  1473             set -- `directfb-config --version | sed 's/\./ /g'`
  1474             HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
  1475             if test $HAVE_VERSION -ge $NEED_VERSION; then
  1476                 DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags`
  1477                 DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs`
  1478                 DIRECTFB_PREFIX=`$DIRECTFBCONFIG --prefix`
  1479                 video_directfb=yes
  1480             fi
  1481         fi
  1482         if test x$video_directfb = xyes; then
  1483             # SuSE 11.1 installs directfb-config without directfb-devel
  1484             save_CPPFLAGS="$CPPFLAGS"
  1485             CPPFLAGS="$CPPFLAGS $DIRECTFB_CFLAGS"
  1486             AC_CHECK_HEADER(directfb.h, have_directfb_hdr=yes, have_directfb_hdr=no)
  1487             CPPFLAGS="$save_CPPFLAGS"
  1488             video_directfb=$have_directfb_hdr
  1489         fi
  1490         AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support)
  1491         AC_MSG_RESULT($video_directfb)
  1492 
  1493         if test x$video_directfb = xyes; then
  1494             AC_ARG_ENABLE(directfb-shared,
  1495 AC_HELP_STRING([--enable-directfb-shared], [dynamically load directfb support [[default=yes]]]),
  1496                               , enable_directfb_shared=yes)
  1497 
  1498             AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB)
  1499             SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
  1500             EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"
  1501 
  1502             AC_MSG_CHECKING(for directfb dynamic loading support)
  1503             directfb_shared=no
  1504             directfb_lib=[`find_lib "libdirectfb.so.*" "$DIRECTFB_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  1505 
  1506             if test x$have_loadso != xyes && \
  1507                test x$enable_directfb_shared = xyes; then
  1508                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic directfb loading])
  1509             fi
  1510             if test x$have_loadso = xyes && \
  1511                test x$enable_directfb_shared = xyes && test x$directfb_lib != x; then
  1512                 directfb_shared=yes
  1513                 echo "-- $directfb_lib_spec -> $directfb_lib"
  1514                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC, "$directfb_lib")
  1515             else
  1516                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
  1517             fi
  1518             AC_MSG_RESULT($directfb_shared)
  1519             have_video=yes
  1520         fi
  1521     fi
  1522 }
  1523 
  1524 dnl Find FusionSound
  1525 CheckFusionSound()
  1526 {
  1527     AC_ARG_ENABLE(fusionsound,
  1528 AC_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]),
  1529                   , enable_fusionsound=no)
  1530     if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then
  1531         fusionsound=no
  1532 
  1533         FUSIONSOUND_REQUIRED_VERSION=1.1.1
  1534 
  1535         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1536         AC_MSG_CHECKING(for FusionSound $FUSIONSOUND_REQUIRED_VERSION support)
  1537         if test x$PKG_CONFIG != xno; then
  1538             if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then
  1539                 FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound`
  1540                 FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound`
  1541                 fusionsound=yes
  1542             fi
  1543         fi
  1544         AC_MSG_RESULT($fusionsound)
  1545 
  1546         if test x$fusionsound = xyes; then
  1547             AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND)
  1548             SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c"
  1549             EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS"
  1550             
  1551             AC_ARG_ENABLE(fusionsound-shared,
  1552 AC_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]),
  1553                           , enable_fusionsound_shared=yes)
  1554             fusionsound_shared=no
  1555             AC_MSG_CHECKING(for FusionSound dynamic loading support)
  1556             if test x$have_loadso != xyes && \
  1557                test x$enable_fusionsound_shared = xyes; then
  1558                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading])
  1559             fi
  1560             if test x$have_loadso = xyes && \
  1561                test x$enable_fusionsound_shared = xyes; then
  1562                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so")
  1563                 fusionsound_shared=yes
  1564             else
  1565                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS"
  1566             fi
  1567             AC_MSG_RESULT($fusionsound_shared)
  1568             
  1569             have_audio=yes
  1570         fi
  1571     fi
  1572 }
  1573 
  1574 dnl See if we're running on PlayStation 3 Cell hardware
  1575 CheckPS3()
  1576 {
  1577   AC_ARG_ENABLE(video-ps3,
  1578                 AC_HELP_STRING([--enable-video-ps3], [use PlayStation 3 Cell driver [[default=yes]]]),
  1579                 , enable_video_ps3=yes)
  1580   if test x$enable_video = xyes -a x$enable_video_ps3 = xyes; then 
  1581     video_ps3=no
  1582     AC_CHECK_HEADER([linux/fb.h])
  1583     AC_CHECK_HEADER([asm/ps3fb.h], [have_ps3fb_hdr=yes], [],
  1584             [#ifndef _LINUX_TYPES_H
  1585                 #include <linux/types.h>
  1586             #endif])
  1587     AC_CHECK_HEADER([libspe2.h], have_libspe2_hdr=yes)
  1588     AC_CHECK_LIB([spe2], spe_context_create, have_spe2_lib=yes)
  1589 
  1590     AC_CHECK_PROGS(SPU_GCC, [spu-gcc])
  1591     AC_CHECK_PROGS(EMBEDSPU, [embedspu])
  1592 
  1593     have_spu_libs=yes
  1594     AC_CHECK_LIB([fb_writer_spu], [main], [], [have_spu_libs=no])
  1595     AC_CHECK_LIB([yuv2rgb_spu], [main], [], [have_spu_libs=no])
  1596     AC_CHECK_LIB([bilin_scaler_spu], [main], [], [have_spu_libs=no])
  1597     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
  1598         AC_DEFINE(SDL_VIDEO_DRIVER_PS3)
  1599         video_ps3=yes
  1600         have_video=yes
  1601         SOURCES="$SOURCES $srcdir/src/video/ps3/*.c"
  1602         EXTRA_CFLAGS="$EXTRA_CFLAGS -I/opt/cell/sdk/usr/include"
  1603         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L/opt/cell/sdk/usr/lib -lspe2 -lfb_writer_spu -lyuv2rgb_spu -lbilin_scaler_spu"
  1604 
  1605         if test x$have_spu_libs = xno; then 
  1606               AC_MSG_WARN([ps3libs missing, please run make ps3libs])
  1607         fi
  1608     fi
  1609     AC_MSG_CHECKING([for PlayStation 3 Cell support])
  1610     AC_MSG_RESULT([$video_ps3])
  1611   fi
  1612 }
  1613 
  1614 dnl Find the SVGAlib includes and libraries
  1615 CheckSVGA()
  1616 {
  1617     AC_ARG_ENABLE(video-svga,
  1618 AC_HELP_STRING([--enable-video-svga], [use SVGAlib video driver [[default=no]]]),
  1619                   , enable_video_svga=no)
  1620     if test x$enable_video = xyes -a x$enable_video_svga = xyes; then
  1621         AC_MSG_CHECKING(for SVGAlib (1.4.0+) support)
  1622         video_svga=no
  1623         AC_TRY_COMPILE([
  1624          #include <vga.h>
  1625          #include <vgamouse.h>
  1626          #include <vgakeyboard.h>
  1627         ],[
  1628          if ( SCANCODE_RIGHTWIN && SCANCODE_LEFTWIN ) {
  1629              exit(0);
  1630          }
  1631         ],[
  1632         video_svga=yes
  1633         ])
  1634         AC_MSG_RESULT($video_svga)
  1635         if test x$video_svga = xyes; then
  1636             AC_DEFINE(SDL_VIDEO_DRIVER_SVGALIB)
  1637             SOURCES="$SOURCES $srcdir/src/video/svga/*.c"
  1638             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvga"
  1639             have_video=yes
  1640         fi
  1641     fi
  1642 }
  1643 
  1644 dnl rcg04172001 Set up the Null video driver.
  1645 CheckDummyVideo()
  1646 {
  1647     AC_ARG_ENABLE(video-dummy,
  1648 AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]),
  1649                   , enable_video_dummy=yes)
  1650     if test x$enable_video_dummy = xyes; then
  1651         AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY)
  1652         SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
  1653         have_video=yes
  1654     fi
  1655 }
  1656 
  1657 dnl Check to see if OpenGL support is desired
  1658 AC_ARG_ENABLE(video-opengl,
  1659 AC_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]),
  1660               , enable_video_opengl=yes)
  1661 
  1662 dnl Find OpenGL
  1663 CheckOpenGLX11()
  1664 {
  1665     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1666         AC_MSG_CHECKING(for OpenGL (GLX) support)
  1667         video_opengl=no
  1668         AC_TRY_COMPILE([
  1669          #include <GL/gl.h>
  1670          #include <GL/glx.h>
  1671          #include <GL/glu.h>
  1672         ],[
  1673         ],[
  1674         video_opengl=yes
  1675         ])
  1676         AC_MSG_RESULT($video_opengl)
  1677         if test x$video_opengl = xyes; then
  1678             AC_DEFINE(SDL_VIDEO_OPENGL)
  1679             AC_DEFINE(SDL_VIDEO_OPENGL_GLX)
  1680             AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1681         fi
  1682     fi
  1683 }
  1684 
  1685 dnl Find QNX 6.x Software OpenGL
  1686 CheckOpenGLQNX()
  1687 {
  1688     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1689         AC_MSG_CHECKING(for QNX 6.x Photon OpenGL support)
  1690         video_opengl=no
  1691         AC_TRY_COMPILE([
  1692          #include <GL/gl.h>
  1693         ],[
  1694         ],[
  1695         video_opengl=yes
  1696         ])
  1697         AC_MSG_RESULT($video_opengl)
  1698         if test x$video_opengl = xyes; then
  1699             AC_DEFINE(SDL_VIDEO_OPENGL)
  1700             AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1701             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
  1702         fi
  1703     fi
  1704 }
  1705 
  1706 dnl Find QNX 6.3 and above OpenGL ES implementation
  1707 CheckOpenGLESQNX()
  1708 {
  1709     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1710         AC_MSG_CHECKING(for QNX OpenGL ES (CM) support)
  1711         video_opengl=no
  1712         AC_TRY_COMPILE([
  1713          #include <GLES/egl.h>
  1714         ],[
  1715         ],[
  1716         video_opengl=yes
  1717         ])
  1718         AC_MSG_RESULT($video_opengl)
  1719         if test x$video_opengl = xyes; then
  1720             AC_DEFINE(SDL_VIDEO_OPENGL_ES)
  1721             AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES)
  1722             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGLES_CM"
  1723         else
  1724             AC_MSG_CHECKING(for QNX OpenGL ES (CL) support)
  1725             video_opengl=no
  1726             AC_TRY_COMPILE([
  1727              #define COMMON_LITE
  1728              #include <GLES/egl.h>
  1729             ],[
  1730             ],[
  1731             video_opengl=yes
  1732             ])
  1733             AC_MSG_RESULT($video_opengl)
  1734             if test x$video_opengl = xyes; then
  1735                 AC_DEFINE(SDL_VIDEO_OPENGL_ES)
  1736                 AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES)
  1737                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGLES_CLS"
  1738             fi
  1739         fi
  1740     fi
  1741 }
  1742 
  1743 
  1744 dnl Check for Win32 OpenGL
  1745 CheckWIN32GL()
  1746 {
  1747     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1748         AC_DEFINE(SDL_VIDEO_OPENGL)
  1749         AC_DEFINE(SDL_VIDEO_OPENGL_WGL)
  1750         AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1751     fi
  1752 }
  1753 
  1754 dnl Check for BeOS OpenGL
  1755 CheckBeGL()
  1756 {
  1757     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1758         AC_DEFINE(SDL_VIDEO_OPENGL)
  1759         AC_DEFINE(SDL_VIDEO_OPENGL_BGL)
  1760         AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1761         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
  1762     fi
  1763 }
  1764 
  1765 dnl Check for MacOS OpenGL
  1766 CheckMacGL()
  1767 {
  1768     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1769         AC_DEFINE(SDL_VIDEO_OPENGL)
  1770         AC_DEFINE(SDL_VIDEO_OPENGL_CGL)
  1771         AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1772         case "$host" in
  1773             *-*-darwin*)
  1774                 if test x$enable_video_cocoa = xyes; then
  1775                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGL"
  1776                 fi
  1777         esac
  1778     fi
  1779 }
  1780 
  1781 dnl See if we can use the new unified event interface in Linux 2.4
  1782 CheckInputEvents()
  1783 {
  1784     dnl Check for Linux 2.4 unified input event interface support
  1785     AC_ARG_ENABLE(input-events,
  1786 AC_HELP_STRING([--enable-input-events], [use Linux 2.4 unified input interface [[default=yes]]]),
  1787                   , enable_input_events=yes)
  1788     if test x$enable_input_events = xyes; then
  1789         AC_MSG_CHECKING(for Linux 2.4 unified input interface)
  1790         use_input_events=no
  1791         AC_TRY_COMPILE([
  1792           #include <linux/input.h>
  1793         ],[
  1794           #ifndef EVIOCGNAME
  1795           #error EVIOCGNAME() ioctl not available
  1796           #endif
  1797         ],[
  1798         use_input_events=yes
  1799         ])
  1800         AC_MSG_RESULT($use_input_events)
  1801         if test x$use_input_events = xyes; then
  1802             AC_DEFINE(SDL_INPUT_LINUXEV)
  1803         fi
  1804     fi
  1805 }
  1806 
  1807 dnl See if we can use the Touchscreen input library
  1808 CheckTslib()
  1809 {
  1810     AC_ARG_ENABLE(input-tslib,
  1811 AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]),
  1812                   , enable_input_tslib=yes)
  1813     if test x$enable_input_tslib = xyes; then
  1814         AC_MSG_CHECKING(for Touchscreen library support)
  1815         enable_input_tslib=no
  1816         AC_TRY_COMPILE([
  1817           #include "tslib.h"
  1818         ],[
  1819         ],[
  1820         enable_input_tslib=yes
  1821         ])
  1822         AC_MSG_RESULT($enable_input_tslib)
  1823         if test x$enable_input_tslib = xyes; then
  1824             AC_DEFINE(SDL_INPUT_TSLIB)
  1825             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
  1826         fi
  1827     fi
  1828 }
  1829 
  1830 dnl See what type of thread model to use on Linux and Solaris
  1831 CheckPTHREAD()
  1832 {
  1833     dnl Check for pthread support
  1834     AC_ARG_ENABLE(pthreads,
  1835 AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]),
  1836                   , enable_pthreads=yes)
  1837     dnl This is used on Linux for glibc binary compatibility (Doh!)
  1838     AC_ARG_ENABLE(pthread-sem,
  1839 AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
  1840                   , enable_pthread_sem=yes)
  1841     case "$host" in
  1842         *-*-linux*|*-*-uclinux*)
  1843             pthread_cflags="-D_REENTRANT"
  1844             pthread_lib="-lpthread"
  1845             ;;
  1846         *-*-bsdi*)
  1847             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1848             pthread_lib=""
  1849             ;;
  1850         *-*-darwin*)
  1851             pthread_cflags="-D_THREAD_SAFE"
  1852 # causes Carbon.p complaints?
  1853 #            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1854             ;;
  1855         *-*-freebsd*|*-*-dragonfly*)
  1856             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1857             pthread_lib="-pthread"
  1858             ;;
  1859         *-*-netbsd*)
  1860             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1861             pthread_lib="-lpthread"
  1862             ;;
  1863         *-*-openbsd*)
  1864             pthread_cflags="-D_REENTRANT"
  1865             pthread_lib="-pthread"
  1866             ;;
  1867         *-*-solaris*)
  1868             pthread_cflags="-D_REENTRANT"
  1869             pthread_lib="-lpthread -lposix4"
  1870             ;;
  1871         *-*-sysv5*)
  1872             pthread_cflags="-D_REENTRANT -Kthread"
  1873             pthread_lib=""
  1874             ;;
  1875         *-*-irix*)
  1876             pthread_cflags="-D_SGI_MP_SOURCE"
  1877             pthread_lib="-lpthread"
  1878             ;;
  1879         *-*-aix*)
  1880             pthread_cflags="-D_REENTRANT -mthreads"
  1881             pthread_lib="-lpthread"
  1882             ;;
  1883         *-*-hpux11*)
  1884             pthread_cflags="-D_REENTRANT"
  1885             pthread_lib="-L/usr/lib -lpthread"
  1886             ;;
  1887         *-*-qnx*)
  1888             pthread_cflags=""
  1889             pthread_lib=""
  1890             ;;
  1891         *-*-osf*)
  1892             pthread_cflags="-D_REENTRANT"
  1893             if test x$ac_cv_prog_gcc = xyes; then
  1894                 pthread_lib="-lpthread -lrt"
  1895             else
  1896                 pthread_lib="-lpthread -lexc -lrt"
  1897             fi
  1898             ;;
  1899         *)
  1900             pthread_cflags="-D_REENTRANT"
  1901             pthread_lib="-lpthread"
  1902             ;;
  1903     esac
  1904     if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
  1905         # Save the original compiler flags and libraries
  1906         ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1907         # Add the pthread compiler flags and libraries
  1908         CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1909         # Check to see if we have pthread support on this system
  1910         AC_MSG_CHECKING(for pthreads)
  1911         use_pthreads=no
  1912         AC_TRY_LINK([
  1913          #include <pthread.h>
  1914         ],[
  1915          pthread_attr_t type;
  1916          pthread_attr_init(&type);
  1917         ],[
  1918         use_pthreads=yes
  1919         ])
  1920         AC_MSG_RESULT($use_pthreads)
  1921         # Restore the compiler flags and libraries
  1922         CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1923 
  1924         # Do futher testing if we have pthread support...
  1925         if test x$use_pthreads = xyes; then
  1926             AC_DEFINE(SDL_THREAD_PTHREAD)
  1927             EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
  1928             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
  1929             SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
  1930             SDL_LIBS="$SDL_LIBS $pthread_lib"
  1931 
  1932             # Save the original compiler flags and libraries
  1933             ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1934             # Add the pthread compiler flags and libraries
  1935             CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1936 
  1937             # Check to see if recursive mutexes are available
  1938             AC_MSG_CHECKING(for recursive mutexes)
  1939             has_recursive_mutexes=no
  1940             if test x$has_recursive_mutexes = xno; then
  1941                 AC_TRY_COMPILE([
  1942                   #include <pthread.h>
  1943                 ],[
  1944                   pthread_mutexattr_t attr;
  1945                   pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
  1946                 ],[
  1947                 has_recursive_mutexes=yes
  1948                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX)
  1949                 ])
  1950             fi
  1951             if test x$has_recursive_mutexes = xno; then
  1952                 AC_TRY_COMPILE([
  1953                   #include <pthread.h>
  1954                 ],[
  1955                   pthread_mutexattr_t attr;
  1956                   pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
  1957                 ],[
  1958                 has_recursive_mutexes=yes
  1959                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP)
  1960                 ])
  1961             fi
  1962             AC_MSG_RESULT($has_recursive_mutexes)
  1963 
  1964             # Check to see if pthread semaphore support is missing
  1965             if test x$enable_pthread_sem = xyes; then
  1966                 AC_MSG_CHECKING(for pthread semaphores)
  1967                 have_pthread_sem=no
  1968                 AC_TRY_COMPILE([
  1969                   #include <pthread.h>
  1970                   #include <semaphore.h>
  1971                 ],[
  1972                 ],[
  1973                 have_pthread_sem=yes
  1974                 ])
  1975                 AC_MSG_RESULT($have_pthread_sem)
  1976             fi
  1977 
  1978             # Restore the compiler flags and libraries
  1979             CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1980 
  1981             # Basic thread creation functions
  1982             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
  1983 
  1984             # Semaphores
  1985             # We can fake these with mutexes and condition variables if necessary
  1986             if test x$have_pthread_sem = xyes; then
  1987                 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
  1988             else
  1989                 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  1990             fi
  1991 
  1992             # Mutexes
  1993             # We can fake these with semaphores if necessary
  1994             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
  1995 
  1996             # Condition variables
  1997             # We can fake these with semaphores and mutexes if necessary
  1998             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
  1999 
  2000             have_threads=yes
  2001         fi
  2002     fi
  2003 }
  2004 
  2005 dnl Determine whether the compiler can produce Win32 executables
  2006 CheckWIN32()
  2007 {
  2008     AC_MSG_CHECKING(Win32 compiler)
  2009     have_win32_gcc=no
  2010     AC_TRY_COMPILE([
  2011      #include <windows.h>
  2012     ],[
  2013     ],[
  2014     have_win32_gcc=yes
  2015     ])
  2016     AC_MSG_RESULT($have_win32_gcc)
  2017     if test x$have_win32_gcc != xyes; then
  2018        AC_MSG_ERROR([
  2019 *** Your compiler ($CC) does not produce Win32 executables!
  2020        ])
  2021     fi
  2022 
  2023     AC_MSG_CHECKING(Windows CE)
  2024     have_wince=no
  2025     AC_TRY_COMPILE([
  2026 #if !defined(_WIN32_WCE) && !defined(__MINGW32CE__)
  2027 #error This is not Windows CE
  2028 #endif
  2029     ],[
  2030     ],[
  2031     have_wince=yes
  2032     ])
  2033     AC_MSG_RESULT($have_wince)
  2034 
  2035     dnl See if the user wants to redirect standard output to files
  2036     AC_ARG_ENABLE(stdio-redirect,
  2037 AC_HELP_STRING([--enable-stdio-redirect], [Redirect STDIO to files on Win32 [[default=yes]]]),
  2038                   , enable_stdio_redirect=yes)
  2039     if test x$enable_stdio_redirect != xyes; then
  2040         EXTRA_CFLAGS="$EXTRA_CFLAGS -DNO_STDIO_REDIRECT"
  2041     fi
  2042 }
  2043 
  2044 dnl Find the DirectX includes and libraries
  2045 CheckDIRECTX()
  2046 {
  2047     AC_ARG_ENABLE(directx,
  2048 AC_HELP_STRING([--enable-directx], [use DirectX for Win32 audio/video [[default=yes]]]),
  2049                   , enable_directx=yes)
  2050     if test x$enable_directx = xyes; then
  2051         AC_CHECK_HEADER(d3d9.h, have_d3d=yes)
  2052         AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
  2053         AC_CHECK_HEADER(dsound.h, have_dsound=yes)
  2054         AC_CHECK_HEADER(dinput.h, have_dinput=yes)
  2055     fi
  2056 }
  2057 
  2058 dnl Check for the dlfcn.h interface for dynamically loading objects
  2059 CheckDLOPEN()
  2060 {
  2061     AC_ARG_ENABLE(sdl-dlopen,
  2062 AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]),
  2063                   , enable_sdl_dlopen=yes)
  2064     if test x$enable_sdl_dlopen = xyes; then
  2065         AC_MSG_CHECKING(for dlopen)
  2066         have_dlopen=no
  2067         AC_TRY_COMPILE([
  2068          #include <dlfcn.h>
  2069         ],[
  2070          #if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED <= 1020
  2071          #error Use dlcompat for Mac OS X 10.2 compatibility
  2072          #endif
  2073         ],[
  2074         have_dlopen=yes
  2075         ])
  2076         AC_MSG_RESULT($have_dlopen)
  2077 
  2078         if test x$have_dlopen = xyes; then
  2079             AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
  2080                AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
  2081                   AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
  2082             AC_DEFINE(SDL_LOADSO_DLOPEN)
  2083             SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
  2084             have_loadso=yes
  2085         fi
  2086     fi
  2087 }
  2088 
  2089 dnl Check for the usbhid(3) library on *BSD
  2090 CheckUSBHID()
  2091 {
  2092     if test x$enable_joystick = xyes; then
  2093         AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
  2094         if test x$have_libusbhid = xyes; then
  2095             AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
  2096             AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
  2097             USB_LIBS="$USB_LIBS -lusbhid"
  2098         else
  2099             AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
  2100             AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
  2101             AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
  2102         fi
  2103             
  2104         save_CFLAGS="$CFLAGS"
  2105         CFLAGS="$CFLAGS $USB_CFLAGS"
  2106 
  2107         AC_MSG_CHECKING(for usbhid)
  2108         have_usbhid=no
  2109         AC_TRY_COMPILE([
  2110           #include <sys/types.h>
  2111           #if defined(HAVE_USB_H)
  2112           #include <usb.h>
  2113           #endif
  2114           #ifdef __DragonFly__
  2115           # include <bus/usb/usb.h>
  2116           # include <bus/usb/usbhid.h>
  2117           #else
  2118           # include <dev/usb/usb.h>
  2119           # include <dev/usb/usbhid.h>
  2120           #endif
  2121           #if defined(HAVE_USBHID_H)
  2122           #include <usbhid.h>
  2123           #elif defined(HAVE_LIBUSB_H)
  2124           #include <libusb.h>
  2125           #elif defined(HAVE_LIBUSBHID_H)
  2126           #include <libusbhid.h>
  2127           #endif
  2128         ],[
  2129           struct report_desc *repdesc;
  2130           struct usb_ctl_report *repbuf;
  2131           hid_kind_t hidkind;
  2132         ],[
  2133         have_usbhid=yes
  2134         ])
  2135         AC_MSG_RESULT($have_usbhid)
  2136 
  2137         if test x$have_usbhid = xyes; then
  2138             AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
  2139             have_usbhid_ucr_data=no
  2140             AC_TRY_COMPILE([
  2141               #include <sys/types.h>
  2142               #if defined(HAVE_USB_H)
  2143               #include <usb.h>
  2144               #endif
  2145               #ifdef __DragonFly__
  2146               # include <bus/usb/usb.h>
  2147               # include <bus/usb/usbhid.h>
  2148               #else
  2149               # include <dev/usb/usb.h>
  2150               # include <dev/usb/usbhid.h>
  2151               #endif
  2152               #if defined(HAVE_USBHID_H)
  2153               #include <usbhid.h>
  2154               #elif defined(HAVE_LIBUSB_H)
  2155               #include <libusb.h>
  2156               #elif defined(HAVE_LIBUSBHID_H)
  2157               #include <libusbhid.h>
  2158               #endif
  2159             ],[
  2160               struct usb_ctl_report buf;
  2161               if (buf.ucr_data) { }
  2162             ],[
  2163             have_usbhid_ucr_data=yes
  2164             ])
  2165             if test x$have_usbhid_ucr_data = xyes; then
  2166                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
  2167             fi
  2168             AC_MSG_RESULT($have_usbhid_ucr_data)
  2169             
  2170             AC_MSG_CHECKING(for new usbhid API)
  2171             have_usbhid_new=no
  2172             AC_TRY_COMPILE([
  2173               #include <sys/types.h>
  2174               #if defined(HAVE_USB_H)
  2175               #include <usb.h>
  2176               #endif
  2177               #ifdef __DragonFly__
  2178               #include <bus/usb/usb.h>
  2179               #include <bus/usb/usbhid.h>
  2180               #else
  2181               #include <dev/usb/usb.h>
  2182               #include <dev/usb/usbhid.h>
  2183               #endif
  2184               #if defined(HAVE_USBHID_H)
  2185               #include <usbhid.h>
  2186               #elif defined(HAVE_LIBUSB_H)
  2187               #include <libusb.h>
  2188               #elif defined(HAVE_LIBUSBHID_H)
  2189               #include <libusbhid.h>
  2190               #endif
  2191             ],[
  2192               report_desc_t d;
  2193               hid_start_parse(d, 1, 1);
  2194             ],[
  2195             have_usbhid_new=yes
  2196             ])
  2197             if test x$have_usbhid_new = xyes; then
  2198                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
  2199             fi
  2200             AC_MSG_RESULT($have_usbhid_new)
  2201 
  2202             AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
  2203             have_machine_joystick=no
  2204             AC_TRY_COMPILE([
  2205               #include <machine/joystick.h>
  2206             ],[
  2207               struct joystick t;
  2208             ],[
  2209             have_machine_joystick=yes
  2210             ])
  2211             if test x$have_machine_joystick = xyes; then
  2212                 AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H)
  2213             fi
  2214             AC_MSG_RESULT($have_machine_joystick)
  2215 
  2216             AC_DEFINE(SDL_JOYSTICK_USBHID)
  2217             SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
  2218             EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
  2219             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
  2220             have_joystick=yes
  2221         fi
  2222         CFLAGS="$save_CFLAGS"
  2223     fi
  2224 }
  2225 
  2226 dnl Check for clock_gettime()
  2227 CheckClockGettime()
  2228 {
  2229     AC_ARG_ENABLE(clock_gettime,
  2230 AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=no]]]),
  2231                   , enable_clock_gettime=no)
  2232     if test x$enable_clock_gettime = xyes; then
  2233         AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
  2234         if test x$have_clock_gettime = xyes; then
  2235             AC_DEFINE(HAVE_CLOCK_GETTIME)
  2236             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
  2237         else
  2238             AC_CHECK_LIB(c, clock_gettime, have_clock_gettime=yes)
  2239             if test x$have_clock_gettime = xyes; then
  2240                AC_DEFINE(HAVE_CLOCK_GETTIME)
  2241                EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
  2242             fi
  2243         fi
  2244     fi
  2245 }
  2246 
  2247 dnl Check for a valid linux/version.h
  2248 CheckLinuxVersion()
  2249 {
  2250     AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
  2251     if test x$have_linux_version_h = xyes; then
  2252         EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
  2253     fi
  2254 }
  2255 
  2256 dnl Check if we want to use RPATH
  2257 CheckRPATH()
  2258 {
  2259     AC_ARG_ENABLE(rpath,
  2260 AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]),
  2261                   , enable_rpath=yes)
  2262 }
  2263 
  2264 dnl Set up the configuration based on the host platform!
  2265 case "$host" in
  2266     *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-irix*|*-*-aix*|*-*-osf*|*-*-minix*)
  2267         case "$host" in
  2268             *-*-linux*)         ARCH=linux ;;
  2269             *-*-uclinux*)       ARCH=linux ;;
  2270             *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
  2271             *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
  2272             *-*-kopenbsd*-gnu)  ARCH=kopenbsd-gnu ;;
  2273             *-*-gnu*)           ARCH=gnu ;; # must be last of the gnu variants
  2274             *-*-bsdi*)          ARCH=bsdi ;;
  2275             *-*-freebsd*)       ARCH=freebsd ;;
  2276             *-*-dragonfly*)     ARCH=freebsd ;;
  2277             *-*-netbsd*)        ARCH=netbsd ;;
  2278             *-*-openbsd*)       ARCH=openbsd ;;
  2279             *-*-sysv5*)         ARCH=sysv5 ;;
  2280             *-*-solaris*)       ARCH=solaris ;;
  2281             *-*-hpux*)          ARCH=hpux ;;
  2282             *-*-irix*)          ARCH=irix ;;
  2283             *-*-aix*)           ARCH=aix ;;
  2284             *-*-osf*)           ARCH=osf ;;
  2285             *-*-minix*)         ARCH=minix ;;
  2286         esac
  2287         CheckVisibilityHidden
  2288         CheckDummyVideo
  2289         CheckDiskAudio
  2290         CheckDummyAudio
  2291         CheckDLOPEN
  2292         CheckOSS
  2293         CheckDMEDIA
  2294         CheckMME
  2295         CheckALSA
  2296         CheckPulseAudio
  2297         CheckARTSC
  2298         CheckESD
  2299         CheckNAS
  2300         CheckX11
  2301         CheckFBCON
  2302         CheckDirectFB
  2303         CheckFusionSound
  2304         CheckPS3
  2305         CheckSVGA
  2306         CheckOpenGLX11
  2307         CheckInputEvents
  2308         CheckTslib
  2309         CheckUSBHID
  2310         CheckPTHREAD
  2311         CheckClockGettime
  2312         CheckLinuxVersion
  2313         CheckRPATH
  2314         # Set up files for the audio library
  2315         if test x$enable_audio = xyes; then
  2316           case $ARCH in
  2317             sysv5|solaris|hpux)
  2318                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
  2319                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  2320                 have_audio=yes
  2321             ;;
  2322             netbsd|openbsd)
  2323                 AC_DEFINE(SDL_AUDIO_DRIVER_BSD)
  2324                 SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c"
  2325                 have_audio=yes
  2326             ;;
  2327             aix)
  2328                 AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO)
  2329                 SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
  2330                 have_audio=yes
  2331             ;;
  2332           esac
  2333         fi
  2334         # Set up files for the joystick library
  2335         if test x$enable_joystick = xyes; then
  2336           case $ARCH in
  2337             linux)
  2338                 AC_DEFINE(SDL_JOYSTICK_LINUX)
  2339                 SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
  2340                 have_joystick=yes
  2341             ;;
  2342           esac
  2343         fi
  2344         # Set up files for the haptic library
  2345         if test x$enable_haptic = xyes; then
  2346            if test x$use_input_events = xyes; then
  2347              case $ARCH in
  2348                linux)
  2349                    AC_DEFINE(SDL_HAPTIC_LINUX)
  2350                    SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c"
  2351                    have_haptic=yes
  2352                ;;
  2353              esac
  2354            fi
  2355         fi
  2356         # Set up files for the power library
  2357         if test x$enable_power = xyes; then
  2358              case $ARCH in
  2359                linux)
  2360                    AC_DEFINE(SDL_POWER_LINUX)
  2361                    SOURCES="$SOURCES $srcdir/src/power/linux/*.c"
  2362                    have_power=yes
  2363                ;;
  2364              esac
  2365         fi
  2366         # Set up files for the thread library
  2367         if test x$enable_threads = xyes -a x$use_pthreads != xyes -a x$use_pth != xyes -a x$ARCH = xirix; then
  2368             AC_DEFINE(SDL_THREAD_SPROC)
  2369             SOURCES="$SOURCES $srcdir/src/thread/irix/*.c"
  2370             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2371             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2372             have_threads=yes
  2373         fi
  2374         # Set up files for the timer library
  2375         if test x$enable_timers = xyes; then
  2376             AC_DEFINE(SDL_TIMER_UNIX)
  2377             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2378             have_timers=yes
  2379         fi
  2380         ;;
  2381     *-*-qnx*)
  2382 
  2383         EXTRA_CFLAGS="-I/usr/include $CFLAGS"
  2384         EXTRA_LDLAGS="-L/usr/lib $LDFLAGS"
  2385 
  2386         ARCH=qnx
  2387         CheckVisibilityHidden
  2388         CheckDummyVideo
  2389         CheckDiskAudio
  2390         CheckDummyAudio
  2391         CheckDLOPEN
  2392         CheckPulseAudio
  2393         CheckESD
  2394         CheckNAS
  2395         CheckPHOTON
  2396         CheckQNXGF
  2397         CheckX11
  2398         CheckOpenGLX11
  2399         CheckPTHREAD
  2400         CheckClockGettime
  2401 
  2402 
  2403         # Set up files for the audio library
  2404         if test x$enable_audio = xyes; then
  2405             AC_DEFINE(SDL_AUDIO_DRIVER_QSA)
  2406             SOURCES="$SOURCES $srcdir/src/audio/qsa/*.c"
  2407             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound"
  2408             have_audio=yes
  2409         fi
  2410         # Set up files for the timer library
  2411         if test x$enable_timers = xyes; then
  2412             AC_DEFINE(SDL_TIMER_UNIX)
  2413             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2414             have_timers=yes
  2415         fi
  2416         # Set up dummy files for the joystick for now
  2417         if test x$enable_joystick = xyes; then
  2418             AC_DEFINE(SDL_JOYSTICK_DUMMY)
  2419             SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  2420             have_joystick=yes
  2421         fi
  2422         # Set up dummy files for the haptic for now
  2423         if test x$enable_haptic = xyes; then
  2424             AC_DEFINE(SDL_HAPTIC_DUMMY)
  2425             SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
  2426             have_haptic=yes
  2427         fi
  2428         ;;
  2429     *-wince* | *-mingw32ce)
  2430         ARCH=win32
  2431         CheckDummyVideo
  2432         CheckDiskAudio
  2433         CheckDummyAudio
  2434         CheckWIN32
  2435         if test x$enable_video = xyes; then
  2436             AC_DEFINE(SDL_VIDEO_DRIVER_WIN32)
  2437             SOURCES="$SOURCES $srcdir/src/video/win32/*.c"
  2438             have_video=yes
  2439             AC_ARG_ENABLE(render-gdi,
  2440 AC_HELP_STRING([--enable-render-gdi], [enable the GDI render driver [[default=yes]]]),
  2441                                 , enable_render_gdi=yes)
  2442             if test x$enable_render_gdi = xyes; then
  2443                 AC_DEFINE(SDL_VIDEO_RENDER_GDI)
  2444             fi
  2445             AC_ARG_ENABLE(render-gapi,
  2446 AC_HELP_STRING([--enable-render-gapi], [enable the GAPI/RAWFRAMEBUFFER render driver [[default=yes]]]),
  2447                                 , enable_render_gapi=yes)
  2448             if test x$enable_render_gapi = xyes -a x$have_wince = xyes; then
  2449                 AC_DEFINE(SDL_VIDEO_RENDER_GAPI)
  2450             fi
  2451             AC_ARG_ENABLE(render-ddraw,
  2452 AC_HELP_STRING([--enable-render-ddraw], [enable the Mobile DirectDraw render driver [[default=yes]]]),
  2453                                 , enable_render_ddraw=yes)
  2454             if test x$enable_render_ddraw = xyes -a x$have_wince = xyes -a x$have_ddraw = xyes; then
  2455                 AC_DEFINE(SDL_VIDEO_RENDER_DDRAW)
  2456             fi
  2457             AC_ARG_ENABLE(render-d3d,
  2458 AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
  2459                                 , enable_render_d3d=yes)
  2460             enable_render_d3d=no
  2461             if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
  2462                 AC_DEFINE(SDL_VIDEO_RENDER_D3D)
  2463             fi
  2464         fi
  2465         # Set up files for the audio library
  2466         if test x$enable_audio = xyes; then
  2467             AC_DEFINE(SDL_AUDIO_DRIVER_WINWAVEOUT)
  2468             SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
  2469             if test x$have_dsound = xyes; then
  2470                 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
  2471                 SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
  2472             fi
  2473             have_audio=yes
  2474         fi
  2475         # Set up dummy files for the joystick for now
  2476         if test x$enable_joystick = xyes; then
  2477             AC_DEFINE(SDL_JOYSTICK_DUMMY)
  2478             SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  2479             have_joystick=yes
  2480         fi
  2481         # Set up files for the thread library
  2482         if test x$enable_threads = xyes; then
  2483             AC_DEFINE(SDL_THREAD_WIN32)
  2484             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
  2485             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
  2486             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
  2487             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2488             have_threads=yes
  2489         fi
  2490         # Set up files for the timer library
  2491         if test x$enable_timers = xyes; then
  2492             AC_DEFINE(SDL_TIMER_WINCE)
  2493             SOURCES="$SOURCES $srcdir/src/timer/wince/*.c"
  2494             have_timers=yes
  2495         fi
  2496         # Set up files for the shared object loading library
  2497         if test x$enable_loadso = xyes; then
  2498             AC_DEFINE(SDL_LOADSO_WIN32)
  2499             SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
  2500             have_loadso=yes
  2501         fi
  2502         # Set up the system libraries we need
  2503         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lcoredll -lcommctrl -lmmtimer"
  2504 
  2505 	# mingw32ce library
  2506 	case "$host" in
  2507     	    *-mingw32ce)
  2508     		EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmingwex"
  2509     		;;
  2510     	    *)
  2511         	;;
  2512 	esac
  2513 
  2514         # The Win32 platform requires special setup
  2515         SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
  2516         EXTRA_CFLAGS="$EXTRA_CFLAGS -Dmain=SDL_main -D_WIN32_WCE=0x420"
  2517         EXTRA_LDFLAGS="-lSDLmain $EXTRA_LDFLAGS"
  2518         ;;
  2519     *-*-cygwin* | *-*-mingw32*)
  2520         ARCH=win32
  2521         if test "$build" != "$host"; then # cross-compiling
  2522             # Default cross-compile location
  2523             ac_default_prefix=/usr/local/cross-tools/$host
  2524         else
  2525             # Look for the location of the tools and install there
  2526             if test "$BUILD_PREFIX" != ""; then
  2527                 ac_default_prefix=$BUILD_PREFIX
  2528             fi
  2529         fi
  2530         CheckDummyVideo
  2531         CheckDiskAudio
  2532         CheckDummyAudio
  2533         CheckWIN32
  2534         CheckWIN32GL
  2535         CheckDIRECTX
  2536         # Set up files for the video library
  2537         if test x$enable_video = xyes; then
  2538             AC_DEFINE(SDL_VIDEO_DRIVER_WIN32)
  2539             SOURCES="$SOURCES $srcdir/src/video/win32/*.c"
  2540             have_video=yes
  2541             AC_ARG_ENABLE(render-gdi,
  2542 AC_HELP_STRING([--enable-render-gdi], [enable the GDI render driver [[default=yes]]]),
  2543                                 , enable_render_gdi=yes)
  2544             if test x$enable_render_gdi = xyes; then
  2545                 AC_DEFINE(SDL_VIDEO_RENDER_GDI)
  2546             fi
  2547             AC_ARG_ENABLE(render-d3d,
  2548 AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
  2549                                 , enable_render_d3d=yes)
  2550             if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
  2551                 AC_DEFINE(SDL_VIDEO_RENDER_D3D)
  2552             fi
  2553         fi
  2554         # Set up files for the audio library
  2555         if test x$enable_audio = xyes; then
  2556             AC_DEFINE(SDL_AUDIO_DRIVER_WINWAVEOUT)
  2557             SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
  2558             if test x$have_dsound = xyes; then
  2559                 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
  2560                 SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
  2561             fi
  2562             have_audio=yes
  2563         fi
  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"
  2570             else
  2571                 AC_DEFINE(SDL_JOYSTICK_WINMM)
  2572                 SOURCES="$SOURCES $srcdir/src/joystick/win32/SDL_mmjoystick.c"
  2573             fi
  2574             have_joystick=yes
  2575         fi
  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"
  2580                 have_haptic=yes
  2581             fi
  2582         fi
  2583         if test x$enable_power = xyes; then
  2584             AC_DEFINE(SDL_POWER_WINDOWS)
  2585             SOURCES="$SOURCES $srcdir/src/power/windows/SDL_syspower.c"
  2586             have_power=yes
  2587         fi
  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"
  2595             have_threads=yes
  2596         fi
  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"
  2601             have_timers=yes
  2602         fi
  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"
  2607             have_loadso=yes
  2608         fi
  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"
  2619         ;;
  2620     *-*-beos* | *-*-haiku*)
  2621         ARCH=beos
  2622         ac_default_prefix=/boot/develop/tools/gnupro
  2623         CheckDummyVideo
  2624         CheckDiskAudio
  2625         CheckDummyAudio
  2626         CheckBWINDOW
  2627         CheckBeGL
  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"
  2632             have_audio=yes
  2633         fi
  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"
  2638             have_joystick=yes
  2639         fi
  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"
  2646             have_threads=yes
  2647         fi
  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"
  2652             have_timers=yes
  2653         fi
  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"
  2658             have_loadso=yes
  2659         fi
  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"
  2664             have_power=yes
  2665         fi
  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"
  2669         ;;
  2670     *-*-darwin* )
  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)
  2674         ARCH=macosx
  2675 
  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"
  2679 
  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.
  2684         EXTRA_LDFLAGS=""
  2685 
  2686         CheckVisibilityHidden
  2687         CheckDummyVideo
  2688         CheckDiskAudio
  2689         CheckDummyAudio
  2690         CheckDLOPEN
  2691 
  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"
  2697             have_loadso=yes
  2698         fi
  2699 
  2700         CheckCOCOA
  2701         CheckX11
  2702         CheckMacGL
  2703         CheckOpenGLX11
  2704         CheckPTHREAD
  2705 
  2706         # Good optimization on Mac OS X, yes...
  2707         EXTRA_CFLAGS="$EXTRA_CFLAGS -falign-loops=16"
  2708 
  2709         # Need this or things might misbuild on a G3.
  2710         EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"
  2711 
  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"
  2716             have_audio=yes
  2717         fi
  2718         # Set up files for the joystick library
  2719         if test x$enable_joystick = xyes; then
  2720             AC_DEFINE(SDL_JOYSTICK_IOKIT)
  2721             SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
  2722             have_joystick=yes
  2723         fi
  2724         # Set up files for the haptic library
  2725         if test x$enable_haptic = xyes; then
  2726             AC_DEFINE(SDL_HAPTIC_IOKIT)
  2727             SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
  2728             have_haptic=yes
  2729             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
  2730         fi
  2731         # Set up files for the power library
  2732         if test x$enable_power = xyes; then
  2733             AC_DEFINE(SDL_POWER_MACOSX)
  2734             SOURCES="$SOURCES $srcdir/src/power/macosx/*.c"
  2735             have_power=yes
  2736         fi
  2737         # Set up files for the timer library
  2738         if test x$enable_timers = xyes; then
  2739             AC_DEFINE(SDL_TIMER_UNIX)
  2740             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2741             have_timers=yes
  2742         fi
  2743         # Set up additional files for the file library
  2744         if test x$enable_file = xyes; then
  2745             SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
  2746         fi
  2747         # The Mac OS X platform requires special setup.
  2748         EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
  2749         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc"
  2750         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
  2751         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
  2752         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
  2753         # If audio is used, add the AudioUnit framework
  2754         if test x$enable_audio = xyes; then
  2755             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit"
  2756         fi
  2757         ;;
  2758     *-riscos)
  2759         ARCH=riscos
  2760         CheckOSS
  2761         CheckPTHREAD
  2762         # Set up files for the video library
  2763         if test x$enable_video = xyes; then
  2764             AC_DEFINE(SDL_VIDEO_DRIVER_RISCOS)
  2765             SOURCES="$SOURCES $srcdir/src/video/riscos/*.c"
  2766             SOURCES="$SOURCES $srcdir/src/video/riscos/*.S"
  2767             have_video=yes
  2768         fi
  2769         # Set up files for the joystick library
  2770         if test x$enable_joystick = xyes; then
  2771             AC_DEFINE(SDL_JOYSTICK_RISCOS)
  2772             SOURCES="$SOURCES $srcdir/src/joystick/riscos/*.c"
  2773             have_joystick=yes
  2774         fi
  2775         # Set up files for the timer library
  2776         if test x$enable_timers = xyes; then
  2777             AC_DEFINE(SDL_TIMER_RISCOS)
  2778             SOURCES="$SOURCES $srcdir/src/timer/riscos/*.c"
  2779             have_timers=yes
  2780         fi
  2781         # The RISC OS platform requires special setup.
  2782         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ljpeg -ltiff -lpng -lz"
  2783         ;;
  2784     *)
  2785         AC_MSG_ERROR([
  2786 *** Unsupported host:  Please add to configure.in
  2787         ])
  2788         ;;
  2789 esac
  2790 
  2791 # Verify that we have all the platform specific files we need
  2792 
  2793 if test x$have_joystick != xyes; then
  2794     if test x$enable_joystick = xyes; then
  2795         AC_DEFINE(SDL_JOYSTICK_DISABLED)
  2796     fi
  2797     SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  2798 fi
  2799 if test x$have_haptic != xyes; then
  2800     if test x$enable_haptic = xyes; then
  2801         AC_DEFINE(SDL_HAPTIC_DISABLED)
  2802     fi
  2803     SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
  2804 fi
  2805 if test x$have_threads != xyes; then
  2806     if test x$enable_threads = xyes; then
  2807         AC_DEFINE(SDL_THREADS_DISABLED)
  2808     fi
  2809     SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
  2810 fi
  2811 if test x$have_timers != xyes; then
  2812     if test x$enable_timers = xyes; then
  2813         AC_DEFINE(SDL_TIMERS_DISABLED)
  2814     fi
  2815     SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
  2816 fi
  2817 if test x$have_loadso != xyes; then
  2818     if test x$enable_loadso = xyes; then
  2819         AC_DEFINE(SDL_LOADSO_DISABLED)
  2820     fi
  2821     SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
  2822 fi
  2823 if test x$SDLMAIN_SOURCES = x; then
  2824     SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
  2825 fi
  2826 
  2827 OBJECTS=`echo $SOURCES`
  2828 DEPENDS=`echo $SOURCES`
  2829 for EXT in asm cc m c S; do
  2830     OBJECTS=`echo "$OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.'$EXT',$(objects)/\1.lo,g'`
  2831     DEPENDS=`echo "$DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.$EXT,\\\\
  2832 \\$(objects)/\\2.lo: \\1/\\2.$EXT\\\\
  2833 	\\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
  2834 done
  2835 
  2836 VERSION_OBJECTS=`echo $VERSION_SOURCES`
  2837 VERSION_DEPENDS=`echo $VERSION_SOURCES`
  2838 VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
  2839 VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.rc,\\\\
  2840 \\$(objects)/\\2.o: \\1/\\2.rc\\\\
  2841 	\\$(WINDRES) \\$< \\$@,g"`
  2842 
  2843 SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES`
  2844 SDLMAIN_DEPENDS=`echo $SDLMAIN_SOURCES`
  2845 SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
  2846 SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
  2847 \\$(objects)/\\2.o: \\1/\\2.c\\\\
  2848 	\\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
  2849 
  2850 # Set runtime shared library paths as needed
  2851 
  2852 if test "x$enable_rpath" = "xyes"; then
  2853   if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = irix -o $ARCH = linux -o $ARCH = netbsd; then
  2854     SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
  2855   fi
  2856   if test $ARCH = solaris; then
  2857     SDL_RLD_FLAGS="-R\${libdir}"
  2858   fi
  2859 else
  2860   SDL_RLD_FLAGS=""
  2861 fi
  2862 
  2863 case "$ARCH" in
  2864   macosx)
  2865     # Evil hack to allow static linking on Mac OS X
  2866     SDL_STATIC_LIBS="\${libdir}/libSDL.a $EXTRA_LDFLAGS"
  2867     ;;
  2868   *)
  2869     SDL_STATIC_LIBS="$SDL_LIBS $EXTRA_LDFLAGS"
  2870     ;;
  2871 esac
  2872 
  2873 dnl Expand the cflags and libraries needed by apps using SDL
  2874 AC_SUBST(SDL_CFLAGS)
  2875 AC_SUBST(SDL_LIBS)
  2876 AC_SUBST(SDL_STATIC_LIBS)
  2877 AC_SUBST(SDL_RLD_FLAGS)
  2878 if test x$enable_shared = xyes; then
  2879     ENABLE_SHARED_TRUE=
  2880     ENABLE_SHARED_FALSE="#"
  2881 else
  2882     ENABLE_SHARED_TRUE="#"
  2883     ENABLE_SHARED_FALSE=
  2884 fi
  2885 if test x$enable_static = xyes; then
  2886     ENABLE_STATIC_TRUE=
  2887     ENABLE_STATIC_FALSE="#"
  2888 else
  2889     ENABLE_STATIC_TRUE="#"
  2890     ENABLE_STATIC_FALSE=
  2891 fi
  2892 AC_SUBST(ENABLE_SHARED_TRUE)
  2893 AC_SUBST(ENABLE_SHARED_FALSE)
  2894 AC_SUBST(ENABLE_STATIC_TRUE)
  2895 AC_SUBST(ENABLE_STATIC_FALSE)
  2896 
  2897 dnl Expand the sources and objects needed to build the library
  2898 AC_SUBST(ac_aux_dir)
  2899 AC_SUBST(INCLUDE)
  2900 AC_SUBST(OBJECTS)
  2901 AC_SUBST(DEPENDS)
  2902 AC_SUBST(VERSION_OBJECTS)
  2903 AC_SUBST(VERSION_DEPENDS)
  2904 AC_SUBST(SDLMAIN_OBJECTS)
  2905 AC_SUBST(SDLMAIN_DEPENDS)
  2906 AC_SUBST(BUILD_CFLAGS)
  2907 AC_SUBST(EXTRA_CFLAGS)
  2908 AC_SUBST(BUILD_LDFLAGS)
  2909 AC_SUBST(EXTRA_LDFLAGS)
  2910 AC_SUBST(WINDRES)
  2911 
  2912 AC_OUTPUT([
  2913     Makefile sdl-config SDL.spec sdl.pc
  2914 ])