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