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