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