configure.in
author Ryan C. Gordon <icculus@icculus.org>
Mon, 20 Aug 2007 01:02:37 +0000
changeset 2271 60b4c52a7906
parent 2264 f7f80b822c1f
child 2290 323a5af2924b
permissions -rw-r--r--
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.

Fixes Bugzilla #439.
     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 dnl Find PulseAudio
   648 CheckPulseAudio()
   649 {
   650     AC_ARG_ENABLE(pulseaudio,
   651 AC_HELP_STRING([--enable-pulseaudio], [use PulseAudio [[default=yes]]]),
   652                   , enable_pulseaudio=yes)
   653     if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then
   654         audio_pulseaudio=no
   655 
   656         PULSEAUDIO_REQUIRED_VERSION=0.9
   657 
   658         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
   659         AC_MSG_CHECKING(for PulseAudio $PULSEAUDIO_REQUIRED_VERSION support)
   660         if test x$PKG_CONFIG != xno; then
   661         if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSEAUDIO_REQUIRED_VERSION libpulse-simple; then
   662                 PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple`
   663                 PULSEAUDIO_LIBS=`$PKG_CONFIG --libs libpulse-simple`
   664                 audio_pulseaudio=yes
   665         fi
   666         fi
   667         AC_MSG_RESULT($audio_pulseaudio)
   668 
   669         if test x$audio_pulseaudio = xyes; then
   670             AC_ARG_ENABLE(pulseaudio-shared,
   671 AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [[default=yes]]]),
   672                           , enable_pulseaudio_shared=yes)
   673             if test "x`echo $PULSEAUDIO_LIBS | grep -- -L`" = "x"; then
   674                 if test "x`ls /lib/libpulse-simple.so.* 2> /dev/null`" != "x"; then
   675                     PULSEAUDIO_LIBS="-L/lib $PULSEAUDIO_LIBS"
   676                 elif test "x`ls /usr/lib/libpulse-simple.so.* 2> /dev/null`" != "x"; then
   677                     PULSEAUDIO_LIBS="-L/usr/lib $PULSEAUDIO_LIBS"
   678                 elif test "x`ls /usr/local/lib/libpulse-simple.so.* 2> /dev/null`" != "x"; then
   679                     PULSEAUDIO_LIBS="-L/usr/local/lib $PULSEAUDIO_LIBS"
   680                 fi
   681             fi
   682             pulseaudio_lib_spec=`echo $PULSEAUDIO_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libpulse-simple.so.*/'`
   683             pulseaudio_lib=`ls -- $pulseaudio_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
   684             echo "-- $pulseaudio_lib_spec -> $pulseaudio_lib"
   685 
   686             AC_DEFINE(SDL_AUDIO_DRIVER_PULSEAUDIO)
   687             SOURCES="$SOURCES $srcdir/src/audio/pulseaudio/*.c"
   688             EXTRA_CFLAGS="$EXTRA_CFLAGS $PULSEAUDIO_CFLAGS"
   689             if test x$have_loadso != xyes && \
   690                test x$enable_pulseaudio_shared = xyes; then
   691                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic PulseAudio loading])
   692             fi
   693             if test x$have_loadso = xyes && \
   694                test x$enable_pulseaudio_shared = xyes && test x$pulseaudio_lib != x; then
   695                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC, "$pulseaudio_lib")
   696             else
   697                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PULSEAUDIO_LIBS"
   698             fi
   699             have_audio=yes
   700         fi
   701     fi
   702 }
   703 
   704 CheckARTSC()
   705 {
   706     AC_ARG_ENABLE(arts,
   707 AC_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [[default=yes]]]),
   708                   , enable_arts=yes)
   709     if test x$enable_audio = xyes -a x$enable_arts = xyes; then
   710         AC_PATH_PROG(ARTSCONFIG, artsc-config)
   711         if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then
   712             : # arts isn't installed
   713         else
   714             ARTS_CFLAGS=`$ARTSCONFIG --cflags`
   715             ARTS_LIBS=`$ARTSCONFIG --libs`
   716             ARTS_PREFIX=`$ARTSCONFIG --arts-prefix`
   717             AC_MSG_CHECKING(for aRts development environment)
   718             audio_arts=no
   719             save_CFLAGS="$CFLAGS"
   720             CFLAGS="$CFLAGS $ARTS_CFLAGS"
   721             AC_TRY_COMPILE([
   722              #include <artsc.h>
   723             ],[
   724              arts_stream_t stream;
   725             ],[
   726             audio_arts=yes
   727             ])
   728             CFLAGS="$save_CFLAGS"
   729             AC_MSG_RESULT($audio_arts)
   730             if test x$audio_arts = xyes; then
   731                 AC_ARG_ENABLE(arts-shared,
   732 AC_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [[default=yes]]]),
   733                               , enable_arts_shared=yes)
   734                 arts_lib_spec="$ARTS_PREFIX/lib/libartsc.so.*"
   735                 arts_lib=`ls -- $arts_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
   736                 echo "-- $arts_lib_spec -> $arts_lib"
   737 
   738                 AC_DEFINE(SDL_AUDIO_DRIVER_ARTS)
   739                 SOURCES="$SOURCES $srcdir/src/audio/arts/*.c"
   740                 EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS"
   741                 if test x$have_loadso != xyes && \
   742                    test x$enable_arts_shared = xyes; then
   743                     AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ARTS loading])
   744                 fi
   745                 if test x$have_loadso = xyes && \
   746                    test x$enable_arts_shared = xyes && test x$arts_lib != x; then
   747                     AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ARTS_DYNAMIC, "$arts_lib")
   748                 else
   749                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS"
   750                 fi
   751                 have_audio=yes
   752             fi
   753         fi
   754     fi
   755 }
   756 
   757 dnl See if the NAS audio interface is supported
   758 CheckNAS()
   759 {
   760     AC_ARG_ENABLE(nas,
   761 AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]),
   762                   , enable_nas=yes)
   763     if test x$enable_audio = xyes -a x$enable_nas = xyes; then
   764         AC_CHECK_HEADER(audio/audiolib.h, have_nas_hdr=yes)
   765         AC_CHECK_LIB(audio, AuOpenServer, have_nas_lib=yes)
   766 
   767         AC_MSG_CHECKING(for NAS audio support)
   768         have_nas=no
   769 
   770         if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then
   771             have_nas=yes
   772             NAS_LIBS="-laudio"
   773 
   774         elif test -r /usr/X11R6/include/audio/audiolib.h; then
   775             have_nas=yes
   776             NAS_CFLAGS="-I/usr/X11R6/include/"
   777             NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt"
   778 
   779         dnl On IRIX, the NAS includes are in a different directory,
   780         dnl and libnas must be explicitly linked in
   781 
   782         elif test -r /usr/freeware/include/nas/audiolib.h; then
   783             have_nas=yes
   784             NAS_LIBS="-lnas -lXt"
   785         fi
   786 
   787         AC_MSG_RESULT($have_nas)
   788 
   789         if test x$have_nas = xyes; then
   790             AC_ARG_ENABLE(nas-shared,
   791 AC_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[default=yes]]]),
   792                           , enable_nas_shared=yes)
   793             if test "x`echo $NAS_LIBS | grep -- -L`" = "x"; then
   794                 if test "x`ls /lib/libaudio.so.* 2> /dev/null`" != "x"; then
   795                     NAS_LIBS="-L/lib $NAS_LIBS"
   796                 elif test "x`ls /usr/lib/libaudio.so.* 2> /dev/null`" != "x"; then
   797                     NAS_LIBS="-L/usr/lib $NAS_LIBS"
   798                 elif test "x`ls /usr/local/lib/libaudio.so.* 2> /dev/null`" != "x"; then
   799                     NAS_LIBS="-L/usr/local/lib $NAS_LIBS"
   800                 fi
   801             fi
   802             nas_lib_spec=`echo $NAS_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libaudio.so.*/'`
   803             nas_lib=`ls -- $nas_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
   804             echo "-- $nas_lib_spec -> $nas_lib"
   805 
   806             if test x$have_loadso != xyes && \
   807                test x$enable_nas_shared = xyes; then
   808                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic NAS loading])
   809             fi
   810             if test x$have_loadso = xyes && \
   811                test x$enable_nas_shared = xyes && test x$nas_lib != x; then
   812                 AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_NAS_DYNAMIC, "$nas_lib")
   813             else
   814                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS"
   815             fi
   816 
   817             AC_DEFINE(SDL_AUDIO_DRIVER_NAS)
   818             SOURCES="$SOURCES $srcdir/src/audio/nas/*.c"
   819             EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS"
   820             have_audio=yes
   821         fi
   822     fi
   823 }
   824 
   825 dnl rcg07142001 See if the user wants the disk writer audio driver...
   826 CheckDiskAudio()
   827 {
   828     AC_ARG_ENABLE(diskaudio,
   829 AC_HELP_STRING([--enable-diskaudio], [support the disk writer audio driver [[default=yes]]]),
   830                   , enable_diskaudio=yes)
   831     if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
   832         AC_DEFINE(SDL_AUDIO_DRIVER_DISK)
   833         SOURCES="$SOURCES $srcdir/src/audio/disk/*.c"
   834     fi
   835 }
   836 
   837 dnl rcg03142006 See if the user wants the dummy audio driver...
   838 CheckDummyAudio()
   839 {
   840     AC_ARG_ENABLE(dummyaudio,
   841 AC_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [[default=yes]]]),
   842                   , enable_dummyaudio=yes)
   843     if test x$enable_audio = xyes -a x$enable_dummyaudio = xyes; then
   844         AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY)
   845         SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c"
   846     fi
   847 }
   848 
   849 dnl Set up the Atari Audio driver
   850 CheckAtariAudio()
   851 {
   852     AC_ARG_ENABLE(mintaudio,
   853 AC_HELP_STRING([--enable-mintaudio], [support Atari audio driver [[default=yes]]]),
   854                   , enable_mintaudio=yes)
   855     if test x$enable_audio = xyes -a x$enable_mintaudio = xyes; then
   856         mintaudio=no
   857         AC_CHECK_HEADER(mint/falcon.h, have_mint_falcon_hdr=yes)
   858         if test x$have_mint_falcon_hdr = xyes; then
   859             mintaudio=yes
   860             AC_DEFINE(SDL_AUDIO_DRIVER_MINT)
   861             SOURCES="$SOURCES $srcdir/src/audio/mint/*.c"
   862             SOURCES="$SOURCES $srcdir/src/audio/mint/*.S"
   863             have_audio=yes
   864         fi
   865     fi
   866 }
   867 
   868 dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
   869 dnl  Details of this flag are here: http://gcc.gnu.org/wiki/Visibility
   870 CheckVisibilityHidden()
   871 {
   872     AC_MSG_CHECKING(for GCC -fvisibility=hidden option)
   873     have_gcc_fvisibility=no
   874 
   875     visibility_CFLAGS="-fvisibility=hidden"
   876     save_CFLAGS="$CFLAGS"
   877     CFLAGS="$save_CFLAGS $visibility_CFLAGS"
   878     AC_TRY_COMPILE([
   879     #if !defined(__GNUC__) || __GNUC__ < 4
   880     #error SDL only uses visibility attributes in GCC 4 or newer
   881     #endif
   882     ],[
   883     ],[
   884     have_gcc_fvisibility=yes
   885     ])
   886     AC_MSG_RESULT($have_gcc_fvisibility)
   887     CFLAGS="$save_CFLAGS"
   888 
   889     if test x$have_gcc_fvisibility = xyes; then
   890         EXTRA_CFLAGS="$EXTRA_CFLAGS $visibility_CFLAGS"
   891     fi
   892 }
   893 
   894 
   895 dnl Do the iPod thing
   896 CheckIPod()
   897 {
   898     AC_ARG_ENABLE(ipod,
   899 AC_HELP_STRING([--enable-ipod], [configure SDL to work with iPodLinux [default=yes on arm-elf]]),
   900         , enable_ipod=yes)
   901 
   902     if test x$enable_ipod = xyes; then
   903         EXTRA_CFLAGS="$EXTRA_CFLAGS -DIPOD"
   904         AC_DEFINE(SDL_VIDEO_DRIVER_IPOD)
   905         SOURCES="$SOURCES $srcdir/src/video/ipod/*.c"
   906     fi
   907 }
   908 
   909 dnl Find the nanox include and library directories
   910 CheckNANOX()
   911 {
   912     AC_ARG_ENABLE(video-nanox,
   913         AC_HELP_STRING([--enable-video-nanox], [use nanox video driver [[default=no]]]),
   914         , enable_video_nanox=no)
   915 
   916     if test x$enable_video = xyes -a x$enable_video_nanox = xyes; then
   917         AC_ARG_ENABLE(nanox-debug,  
   918             AC_HELP_STRING([--enable-nanox-debug], [print debug messages [[default=no]]]),
   919             , enable_nanox_debug=no)
   920         if test x$enable_nanox_debug = xyes; then
   921             EXTRA_CFLAGS="$EXTRA_CFLAGS -DENABLE_NANOX_DEBUG"
   922         fi
   923 
   924         AC_ARG_ENABLE(nanox-share-memory,  
   925             AC_HELP_STRING([--enable-nanox-share-memory], [use share memory [[default=no]]]),
   926             , enable_nanox_share_memory=no)
   927         if test x$enable_nanox_share_memory = xyes; then
   928             EXTRA_CFLAGS="$EXTRA_CFLAGS -DNANOX_SHARE_MEMORY"
   929         fi
   930 
   931         AC_ARG_ENABLE(nanox_direct_fb, 
   932             AC_HELP_STRING([--enable-nanox-direct-fb], [use direct framebuffer access [[default=no]]]),
   933             , enable_nanox_direct_fb=no)
   934         if test x$enable_nanox_direct_fb = xyes; then
   935             EXTRA_CFLAGS="$EXTRA_CFLAGS -DENABLE_NANOX_DIRECT_FB"
   936         fi
   937 
   938         AC_DEFINE(SDL_VIDEO_DRIVER_NANOX)
   939         SOURCES="$SOURCES $srcdir/src/video/nanox/*.c"
   940         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lnano-X"
   941         have_video=yes
   942     fi
   943 }
   944 
   945 dnl Find the X11 include and library directories
   946 CheckX11()
   947 {
   948     AC_ARG_ENABLE(video-x11,
   949 AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]),
   950                   , enable_video_x11=yes)
   951     if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
   952         case "$host" in
   953             *-*-darwin*)
   954                 # This isn't necessary for X11, but fixes GLX detection
   955                 if test "x$x_includes" = xNONE && test "x$x_libraries" = xNONE; then
   956                     x_includes="/usr/X11R6/include"
   957                     x_libraries="/usr/X11R6/lib"
   958                 fi
   959                 ;;
   960         esac
   961         AC_PATH_X
   962         AC_PATH_XTRA
   963         if test x$have_x = xyes; then
   964             # Only allow dynamically loaded X11 if the X11 function pointers
   965             # will not end up in the global namespace, which causes problems
   966             # with other libraries calling X11 functions.
   967             x11_symbols_private=$have_gcc_fvisibility
   968 
   969             AC_ARG_ENABLE(x11-shared,
   970 AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=maybe]]]),
   971                           , enable_x11_shared=maybe)
   972 
   973             case "$host" in
   974                 *-*-darwin*) # Latest Mac OS X actually ships with Xrandr/Xrender libs...
   975                     x11_symbols_private=yes
   976                     x11_lib='/usr/X11R6/lib/libX11.6.dylib'
   977                     x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
   978                     xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
   979                     xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
   980                     ;;
   981                 *-*-osf*)
   982                     x11_lib='libX11.so'
   983                     x11ext_lib='libXext.so'
   984                     ;;
   985                 *-*-irix*) # IRIX 6.5 requires that we use /usr/lib32
   986                     x11_lib='libX11.so'
   987                     x11ext_lib='libXext.so'
   988                     ;;
   989                 *)
   990                     x11_lib_spec=[`echo $X_LIBS | sed 's/.*-L\([^ ]*\).*/\1/'`]
   991                     for path in $x11_lib_path /usr/lib /usr/X11/lib /usr/X11R6/lib; do
   992                         if test "x$x11_lib" = "x"; then
   993                             x11_lib=[`ls -- $path/libX11.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   994                             if test "x$x11_lib" = "x"; then
   995                                 x11_lib=[`ls -- $path/libX11.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
   996                             fi
   997                         fi
   998                         if test "x$x11ext_lib" = "x"; then
   999                             x11ext_lib=[`ls -- $path/libXext.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
  1000                             if test "x$x11ext_lib" = "x"; then
  1001                                 x11ext_lib=[`ls -- $path/libXext.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
  1002                             fi
  1003                         fi
  1004                         if test "x$xrender_lib" = "x"; then
  1005                             xrender_lib=[`ls -- $path/libXrender.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
  1006                             if test "x$xrender_lib" = "x"; then
  1007                                 xrender_lib=[`ls -- $path/libXrender.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
  1008                             fi
  1009                         fi
  1010                         if test "x$xrandr_lib" = "x"; then
  1011                             xrandr_lib=[`ls -- $path/libXrandr.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
  1012                             if test "x$xrandr_lib" = "x"; then
  1013                                 xrandr_lib=[`ls -- $path/libXrandr.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
  1014                             fi
  1015                         fi
  1016                     done
  1017                     ;;
  1018             esac
  1019 
  1020             X_CFLAGS="$X_CFLAGS -DXTHREADS"
  1021             if test x$ac_cv_func_shmat != xyes; then
  1022                 X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY"
  1023             fi
  1024             CFLAGS="$CFLAGS $X_CFLAGS"
  1025             LDFLAGS="$LDFLAGS $X_LIBS"
  1026 
  1027             AC_DEFINE(SDL_VIDEO_DRIVER_X11)
  1028             SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
  1029             SOURCES="$SOURCES $srcdir/src/video/Xext/XmuStdCmap/*.c"
  1030             EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
  1031 
  1032             if test x$enable_x11_shared = xmaybe; then
  1033                 enable_x11_shared=$x11_symbols_private
  1034             fi
  1035             if test x$have_loadso != xyes && \
  1036                test x$enable_x11_shared = xyes; then
  1037                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic X11 loading])
  1038                 enable_x11_shared=no
  1039             fi
  1040             if test x$x11_symbols_private != xyes && \
  1041                test x$enable_x11_shared = xyes; then
  1042                 AC_MSG_WARN([You must have gcc4 (-fvisibility=hidden) for dynamic X11 loading])
  1043                 enable_x11_shared=no
  1044             fi
  1045 
  1046             if test x$have_loadso = xyes && \
  1047                test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then
  1048                 echo "-- dynamic libX11 -> $x11_lib"
  1049                 echo "-- dynamic libX11ext -> $x11ext_lib"
  1050                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib")
  1051                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib")
  1052             else
  1053                 enable_x11_shared=no
  1054                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
  1055             fi
  1056             have_video=yes
  1057 
  1058             AC_ARG_ENABLE(video-x11-vm,
  1059 AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[default=yes]]]),
  1060                           , enable_video_x11_vm=yes)
  1061             if test x$enable_video_x11_vm = xyes; then
  1062                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_VIDMODE)
  1063                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xxf86vm/*.c"
  1064             fi
  1065             AC_ARG_ENABLE(video-x11-xv,
  1066 AC_HELP_STRING([--enable-video-x11-xv], [use X11 XvImage extension for video [[default=yes]]]),
  1067                           , enable_video_x11_xv=yes)
  1068             if test x$enable_video_x11_xv = xyes; then
  1069                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XV)
  1070                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xv/*.c"
  1071             fi
  1072             AC_ARG_ENABLE(video-x11-xinerama,
  1073 AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]),
  1074                             , enable_video_x11_xinerama=yes)
  1075             if test x$enable_video_x11_xinerama = xyes; then
  1076                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA)
  1077                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xinerama/*.c"
  1078             fi
  1079             AC_ARG_ENABLE(video-x11-xme,
  1080 AC_HELP_STRING([--enable-video-x11-xme], [enable Xi Graphics XME for fullscreen [[default=yes]]]),
  1081                             , enable_video_x11_xme=yes)
  1082             if test x$enable_video_x11_xme = xyes; then
  1083                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XME)
  1084                 SOURCES="$SOURCES $srcdir/src/video/Xext/XME/*.c"
  1085             fi
  1086             AC_ARG_ENABLE(video-x11-xrandr,
  1087 AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]),
  1088                             , enable_video_x11_xrandr=yes)
  1089             if test x$enable_video_x11_xrandr = xyes; then
  1090                 definitely_enable_video_x11_xrandr=no
  1091                 AC_CHECK_HEADER(X11/extensions/Xrandr.h,
  1092                                 have_xrandr_h_hdr=yes,
  1093                                 have_xrandr_h_hdr=no,
  1094                                 [#include <X11/Xlib.h>
  1095                                 ])
  1096                 if test x$have_xrandr_h_hdr = xyes; then
  1097                     if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then
  1098                         echo "-- dynamic libXrender -> $xrender_lib"
  1099                         echo "-- dynamic libXrandr -> $xrandr_lib"
  1100                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER, "$xrender_lib")
  1101                         AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib")
  1102                         definitely_enable_video_x11_xrandr=yes
  1103                     else
  1104                         AC_CHECK_LIB(Xrender, XRenderQueryExtension, have_xrender_lib=yes)
  1105                         AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes)
  1106                         if test x$have_xrender_lib = xyes && test x$have_xrandr_lib = xyes ; then
  1107                             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr -lXrender"
  1108                             definitely_enable_video_x11_xrandr=yes
  1109                         fi
  1110                     fi
  1111                 fi
  1112             fi
  1113             if test x$definitely_enable_video_x11_xrandr = xyes; then
  1114                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR)
  1115             fi
  1116             AC_ARG_ENABLE(video-x11-dpms,
  1117 AC_HELP_STRING([--enable-video-x11-dpms], [enable X11 DPMS extension [[default=yes]]]),
  1118                             , enable_video_x11_dpms=yes)
  1119             if test x$enable_video_x11_dpms = xyes; then
  1120                 AC_CHECK_HEADER(X11/extensions/dpms.h,
  1121                                 have_dpms_h_hdr=yes,
  1122                                 have_dpms_h_hdr=no,
  1123                                 [#include <X11/Xlib.h>
  1124                                 ])
  1125                 if test x$have_dpms_h_hdr = xyes; then
  1126                     AC_DEFINE(SDL_VIDEO_DRIVER_X11_DPMS)
  1127                 fi
  1128             fi
  1129         fi
  1130     fi
  1131 }
  1132 
  1133 dnl Check for QNX photon video driver
  1134 CheckPHOTON()
  1135 {
  1136     AC_ARG_ENABLE(video-photon,
  1137 AC_HELP_STRING([--enable-video-photon], [use QNX Photon video driver [[default=yes]]]),
  1138                   , enable_video_photon=yes)
  1139     if test x$enable_video = xyes -a x$enable_video_photon = xyes; then
  1140         AC_MSG_CHECKING(for QNX Photon support)
  1141         video_photon=no
  1142         AC_TRY_COMPILE([
  1143           #include <Ph.h>
  1144           #include <Pt.h>
  1145           #include <photon/Pg.h>
  1146           #include <photon/PdDirect.h>
  1147         ],[
  1148          PgDisplaySettings_t *visual;
  1149         ],[
  1150         video_photon=yes
  1151         ])
  1152         AC_MSG_RESULT($video_photon)
  1153         if test x$video_photon = xyes; then
  1154             AC_DEFINE(SDL_VIDEO_DRIVER_PHOTON)
  1155             SOURCES="$SOURCES $srcdir/src/video/photon/*.c"
  1156             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lph"
  1157             have_video=yes
  1158 
  1159             CheckOpenGLQNX
  1160         fi
  1161     fi
  1162 }
  1163 
  1164 dnl Set up the BWindow video driver if enabled
  1165 CheckBWINDOW()
  1166 {
  1167     if test x$enable_video = xyes; then
  1168         AC_DEFINE(SDL_VIDEO_DRIVER_BWINDOW)
  1169         SOURCES="$SOURCES $srcdir/src/video/bwindow/*.cc"
  1170         have_video=yes
  1171     fi
  1172 }
  1173 
  1174 dnl Set up the Cocoa video driver for Mac OS X (but not Darwin)
  1175 CheckCOCOA()
  1176 {
  1177     AC_ARG_ENABLE(video-cocoa,
  1178 AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]),
  1179                   , enable_video_cocoa=yes)
  1180     if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
  1181         save_CFLAGS="$CFLAGS"
  1182         dnl work around that we don't have Objective-C support in autoconf
  1183         CFLAGS="$CFLAGS -x objective-c"
  1184         AC_MSG_CHECKING(for Cocoa framework)
  1185         have_cocoa=no
  1186         AC_TRY_COMPILE([
  1187           #import <Cocoa/Cocoa.h>
  1188         ],[
  1189         ],[
  1190         have_cocoa=yes
  1191         ])
  1192         AC_MSG_RESULT($have_cocoa)
  1193         CFLAGS="$save_CFLAGS"
  1194         if test x$have_cocoa = xyes; then
  1195             AC_DEFINE(SDL_VIDEO_DRIVER_COCOA)
  1196             SOURCES="$SOURCES $srcdir/src/video/cocoa/*.m"
  1197             have_video=yes
  1198         fi
  1199     fi
  1200 }
  1201 
  1202 dnl Find the framebuffer console includes
  1203 CheckFBCON()
  1204 {
  1205     AC_ARG_ENABLE(video-fbcon,
  1206 AC_HELP_STRING([--enable-video-fbcon], [use framebuffer console video driver [[default=no]]]),
  1207                   , enable_video_fbcon=no)
  1208     if test x$enable_video = xyes -a x$enable_video_fbcon = xyes; then
  1209         AC_MSG_CHECKING(for framebuffer console support)
  1210         video_fbcon=no
  1211         AC_TRY_COMPILE([
  1212          #include <linux/fb.h>
  1213          #include <linux/kd.h>
  1214          #include <linux/keyboard.h>
  1215         ],[
  1216         ],[
  1217         video_fbcon=yes
  1218         ])
  1219         AC_MSG_RESULT($video_fbcon)
  1220         if test x$video_fbcon = xyes; then
  1221             AC_CHECK_FUNCS(getpagesize)
  1222             AC_DEFINE(SDL_VIDEO_DRIVER_FBCON)
  1223             SOURCES="$SOURCES $srcdir/src/video/fbcon/*.c"
  1224             have_video=yes
  1225         fi
  1226     fi
  1227 }
  1228 
  1229 dnl Find DirectFB
  1230 CheckDirectFB()
  1231 {
  1232     AC_ARG_ENABLE(video-directfb,
  1233 AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=yes]]]),
  1234                   , enable_video_directfb=yes)
  1235     if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
  1236         video_directfb=no
  1237 
  1238         DIRECTFB_REQUIRED_VERSION=0.9.15
  1239 
  1240         AC_PATH_PROG(DIRECTFBCONFIG, directfb-config, no)
  1241         if test x$DIRECTFBCONFIG = xno; then
  1242             AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1243             AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support)
  1244             if test x$PKG_CONFIG != xno; then
  1245                 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb; then
  1246                     DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
  1247                     DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
  1248                     video_directfb=yes
  1249                 fi
  1250             fi
  1251             AC_MSG_RESULT($video_directfb)
  1252         else
  1253             AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support)
  1254             set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'`
  1255             NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
  1256             set -- `directfb-config --version | sed 's/\./ /g'`
  1257             HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
  1258             if test $HAVE_VERSION -ge $NEED_VERSION; then
  1259                 DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags`
  1260                 DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs`
  1261                 video_directfb=yes
  1262             fi
  1263             AC_MSG_RESULT($video_directfb)
  1264         fi
  1265 
  1266         if test x$video_directfb = xyes; then
  1267             AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB)
  1268             SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
  1269             EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"
  1270             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
  1271             have_video=yes
  1272         fi
  1273     fi
  1274 }
  1275 
  1276 dnl See if we're running on PlayStation 2 hardware
  1277 CheckPS2GS()
  1278 {
  1279     AC_ARG_ENABLE(video-ps2gs,
  1280 AC_HELP_STRING([--enable-video-ps2gs], [use PlayStation 2 GS video driver [[default=yes]]]),
  1281                   , enable_video_ps2gs=yes)
  1282     if test x$enable_video = xyes -a x$enable_video_ps2gs = xyes; then
  1283         AC_MSG_CHECKING(for PlayStation 2 GS support)
  1284         video_ps2gs=no
  1285         AC_TRY_COMPILE([
  1286          #include <linux/ps2/dev.h>
  1287          #include <linux/ps2/gs.h>
  1288         ],[
  1289         ],[
  1290         video_ps2gs=yes
  1291         ])
  1292         AC_MSG_RESULT($video_ps2gs)
  1293         if test x$video_ps2gs = xyes; then
  1294             AC_DEFINE(SDL_VIDEO_DRIVER_PS2GS)
  1295             SOURCES="$SOURCES $srcdir/src/video/ps2gs/*.c"
  1296             have_video=yes
  1297         fi
  1298     fi
  1299 }
  1300 
  1301 dnl Find the SVGAlib includes and libraries
  1302 CheckSVGA()
  1303 {
  1304     AC_ARG_ENABLE(video-svga,
  1305 AC_HELP_STRING([--enable-video-svga], [use SVGAlib video driver [[default=yes]]]),
  1306                   , enable_video_svga=yes)
  1307     if test x$enable_video = xyes -a x$enable_video_svga = xyes; then
  1308         AC_MSG_CHECKING(for SVGAlib (1.4.0+) support)
  1309         video_svga=no
  1310         AC_TRY_COMPILE([
  1311          #include <vga.h>
  1312          #include <vgamouse.h>
  1313          #include <vgakeyboard.h>
  1314         ],[
  1315          if ( SCANCODE_RIGHTWIN && SCANCODE_LEFTWIN ) {
  1316              exit(0);
  1317          }
  1318         ],[
  1319         video_svga=yes
  1320         ])
  1321         AC_MSG_RESULT($video_svga)
  1322         if test x$video_svga = xyes; then
  1323             AC_DEFINE(SDL_VIDEO_DRIVER_SVGALIB)
  1324             SOURCES="$SOURCES $srcdir/src/video/svga/*.c"
  1325             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvga"
  1326             have_video=yes
  1327         fi
  1328     fi
  1329 }
  1330 
  1331 dnl Find the VGL includes and libraries
  1332 CheckVGL()
  1333 {
  1334     AC_ARG_ENABLE(video-vgl,
  1335 AC_HELP_STRING([--enable-video-vgl], [use VGL video driver [[default=yes]]]),
  1336                   , enable_video_vgl=yes)
  1337     if test x$enable_video = xyes -a x$enable_video_vgl = xyes; then
  1338         AC_MSG_CHECKING(for libVGL support)
  1339         video_vgl=no
  1340         AC_TRY_COMPILE([
  1341          #include <sys/fbio.h>
  1342          #include <sys/consio.h>
  1343          #include <sys/kbio.h>
  1344          #include <vgl.h>
  1345         ],[
  1346          VGLBitmap bitmap;
  1347          bitmap.Type = VIDBUF32;
  1348          bitmap.PixelBytes = 4;
  1349          exit(bitmap.Bitmap);
  1350         ],[
  1351         video_vgl=yes
  1352         ])
  1353         AC_MSG_RESULT($video_vgl)
  1354         if test x$video_vgl = xyes; then
  1355             AC_DEFINE(SDL_VIDEO_DRIVER_VGL)
  1356             SOURCES="$SOURCES $srcdir/src/video/vgl/*.c"
  1357             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvgl"
  1358             have_video=yes
  1359         fi
  1360     fi
  1361 }
  1362 
  1363 dnl Set up the wscons video driver if enabled
  1364 CheckWscons()
  1365 {
  1366     AC_ARG_ENABLE(video-wscons,
  1367 AC_HELP_STRING([--enable-video-wscons], [use wscons video driver [[default=yes]]]),
  1368                   , enable_video_wscons=yes)
  1369     if test x$enable_video = xyes -a x$enable_video_wscons = xyes; then
  1370         AC_MSG_CHECKING(for wscons support)
  1371         video_wscons=no
  1372         AC_TRY_COMPILE([
  1373          #include <sys/time.h>
  1374          #include <dev/wscons/wsconsio.h>
  1375          #include <dev/wscons/wsdisplay_usl_io.h>
  1376         ],[
  1377          int wsmode = WSDISPLAYIO_MODE_DUMBFB;
  1378         ],[
  1379         video_wscons=yes
  1380         ])
  1381         AC_MSG_RESULT($video_wscons)
  1382         if test x$video_wscons = xyes; then
  1383             AC_DEFINE(SDL_VIDEO_DRIVER_WSCONS)
  1384             SOURCES="$SOURCES $srcdir/src/video/wscons/*.c"
  1385             have_video=yes
  1386         fi
  1387     fi
  1388 }
  1389 
  1390 dnl Set up the Atari Bios keyboard driver
  1391 CheckAtariBiosEvent()
  1392 {
  1393     SOURCES="$SOURCES $srcdir/src/video/ataricommon/*.c"
  1394     SOURCES="$SOURCES $srcdir/src/video/ataricommon/*.S"
  1395 }
  1396 
  1397 dnl Set up the Atari Xbios driver
  1398 CheckAtariXbiosVideo()
  1399 {
  1400     AC_ARG_ENABLE(video-xbios,
  1401 AC_HELP_STRING([--enable-video-xbios], [use Atari Xbios video driver [[default=yes]]]),
  1402                   , enable_video_xbios=yes)
  1403     video_xbios=no
  1404     if test x$enable_video = xyes -a x$enable_video_xbios = xyes; then
  1405         video_xbios=yes
  1406         AC_DEFINE(SDL_VIDEO_DRIVER_XBIOS)
  1407         SOURCES="$SOURCES $srcdir/src/video/xbios/*.c"
  1408         have_video=yes
  1409     fi
  1410 }
  1411 
  1412 dnl Set up the Atari Gem driver
  1413 CheckAtariGemVideo()
  1414 {
  1415     AC_ARG_ENABLE(video-gem,
  1416 AC_HELP_STRING([--enable-video-gem], [use Atari Gem video driver [[default=yes]]]),
  1417                   , enable_video_gem=yes)
  1418     if test x$enable_video = xyes -a x$enable_video_gem = xyes; then
  1419         video_gem=no
  1420         AC_CHECK_HEADER(gem.h, have_gem_hdr=yes)
  1421         AC_CHECK_LIB(gem, appl_init, have_gem_lib=yes)
  1422         if test x$have_gem_hdr = xyes -a x$have_gem_lib = xyes; then
  1423             video_gem=yes
  1424             AC_DEFINE(SDL_VIDEO_DRIVER_GEM)
  1425             SOURCES="$SOURCES $srcdir/src/video/gem/*.c"
  1426             SDL_LIBS="$SDL_LIBS -lgem"
  1427             have_video=yes
  1428         fi
  1429     fi
  1430 }
  1431 
  1432 dnl rcg04172001 Set up the Null video driver.
  1433 CheckDummyVideo()
  1434 {
  1435     AC_ARG_ENABLE(video-dummy,
  1436 AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]),
  1437                   , enable_video_dummy=yes)
  1438     if test x$enable_video_dummy = xyes; then
  1439         AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY)
  1440         SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
  1441         have_video=yes
  1442     fi
  1443 }
  1444 
  1445 dnl Check to see if OpenGL support is desired
  1446 AC_ARG_ENABLE(video-opengl,
  1447 AC_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]),
  1448               , enable_video_opengl=yes)
  1449 
  1450 dnl Find OpenGL
  1451 CheckOpenGLX11()
  1452 {
  1453     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1454         AC_MSG_CHECKING(for OpenGL (GLX) support)
  1455         video_opengl=no
  1456         AC_TRY_COMPILE([
  1457          #include <GL/gl.h>
  1458          #include <GL/glx.h>
  1459          #include <GL/glu.h>
  1460         ],[
  1461         ],[
  1462         video_opengl=yes
  1463         ])
  1464         AC_MSG_RESULT($video_opengl)
  1465         if test x$video_opengl = xyes; then
  1466             AC_DEFINE(SDL_VIDEO_OPENGL)
  1467             AC_DEFINE(SDL_VIDEO_OPENGL_GLX)
  1468             AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1469         fi
  1470     fi
  1471 }
  1472 
  1473 dnl Find QNX RtP OpenGL
  1474 CheckOpenGLQNX()
  1475 {
  1476     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1477         AC_MSG_CHECKING(for OpenGL (Photon) support)
  1478         video_opengl=no
  1479         AC_TRY_COMPILE([
  1480          #include <GL/gl.h>
  1481         ],[
  1482         ],[
  1483         video_opengl=yes
  1484         ])
  1485         AC_MSG_RESULT($video_opengl)
  1486         if test x$video_opengl = xyes; then
  1487             AC_DEFINE(SDL_VIDEO_OPENGL)
  1488             AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1489             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
  1490         fi
  1491     fi
  1492 }
  1493 
  1494 dnl Check for Win32 OpenGL
  1495 CheckWIN32GL()
  1496 {
  1497     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1498         AC_DEFINE(SDL_VIDEO_OPENGL)
  1499         AC_DEFINE(SDL_VIDEO_OPENGL_WGL)
  1500         AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1501     fi
  1502 }
  1503 
  1504 dnl Check for BeOS OpenGL
  1505 CheckBeGL()
  1506 {
  1507     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1508         AC_DEFINE(SDL_VIDEO_OPENGL)
  1509         AC_DEFINE(SDL_VIDEO_OPENGL_BGL)
  1510         AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1511         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
  1512     fi
  1513 }
  1514 
  1515 dnl Check for MacOS OpenGL
  1516 CheckMacGL()
  1517 {
  1518     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1519         AC_DEFINE(SDL_VIDEO_OPENGL)
  1520         AC_DEFINE(SDL_VIDEO_OPENGL_CGL)
  1521         AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1522         case "$host" in
  1523             *-*-darwin*)
  1524                 if test x$enable_video_cocoa = xyes; then
  1525                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGL"
  1526                 fi
  1527         esac
  1528     fi
  1529 }
  1530 
  1531 dnl Check for Mesa offscreen rendering
  1532 CheckAtariOSMesa()
  1533 {
  1534     if test "x$enable_video" = "xyes" -a "x$enable_video_opengl" = "xyes"; then
  1535         AC_CHECK_HEADER(GL/osmesa.h, have_osmesa_hdr=yes)
  1536         AC_CHECK_LIB(OSMesa, OSMesaCreateContext, have_osmesa_lib=yes, have_osmesa_lib=no, -lm)
  1537 
  1538         # Static linking to -lOSMesa
  1539         AC_PATH_PROG(OSMESA_CONFIG, osmesa-config, no)
  1540         if test "x$OSMESA_CONFIG" = "xno" -o "x$enable_atari_ldg" = "xno"; then
  1541             # -lOSMesa is really the static library
  1542             if test "x$have_osmesa_hdr" = "xyes" -a "x$have_osmesa_lib" = "xyes"; then
  1543                 OSMESA_LIBS="-lOSMesa"
  1544             fi
  1545         else
  1546             # -lOSMesa is a loader for OSMesa.ldg
  1547             OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags`
  1548             OSMESA_LIBS=`$OSMESA_CONFIG --libs`
  1549         fi
  1550         AC_DEFINE(SDL_VIDEO_OPENGL)
  1551         AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA)
  1552         AC_DEFINE(SDL_VIDEO_RENDER_OGL)
  1553         SDL_CFLAGS="$SDL_CFLAGS $OSMESA_CFLAGS"
  1554         SDL_LIBS="$SDL_LIBS $OSMESA_LIBS"
  1555 
  1556         AC_ARG_ENABLE(osmesa-shared,
  1557 AC_HELP_STRING([--enable-osmesa-shared], [dynamically load OSMesa OpenGL support [[default=yes]]]),
  1558                               , enable_osmesa_shared=yes)
  1559         if test "x$enable_osmesa_shared" = "xyes" -a "x$enable_atari_ldg" = "xyes"; then
  1560             # Dynamic linking
  1561             if test "x$have_osmesa_hdr" = "xyes"; then
  1562                 AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA_DYNAMIC)
  1563             fi
  1564         fi
  1565     fi
  1566 }
  1567 
  1568 dnl See if we can use the new unified event interface in Linux 2.4
  1569 CheckInputEvents()
  1570 {
  1571     dnl Check for Linux 2.4 unified input event interface support
  1572     AC_ARG_ENABLE(input-events,
  1573 AC_HELP_STRING([--enable-input-events], [use Linux 2.4 unified input interface [[default=yes]]]),
  1574                   , enable_input_events=yes)
  1575     if test x$enable_input_events = xyes; then
  1576         AC_MSG_CHECKING(for Linux 2.4 unified input interface)
  1577         use_input_events=no
  1578         AC_TRY_COMPILE([
  1579           #include <linux/input.h>
  1580         ],[
  1581           #ifndef EVIOCGNAME
  1582           #error EVIOCGNAME() ioctl not available
  1583           #endif
  1584         ],[
  1585         use_input_events=yes
  1586         ])
  1587         AC_MSG_RESULT($use_input_events)
  1588         if test x$use_input_events = xyes; then
  1589             AC_DEFINE(SDL_INPUT_LINUXEV)
  1590         fi
  1591     fi
  1592 }
  1593 
  1594 dnl See if we can use the Touchscreen input library
  1595 CheckTslib()
  1596 {
  1597     AC_ARG_ENABLE(input-tslib,
  1598 AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]),
  1599                   , enable_input_tslib=yes)
  1600     if test x$enable_input_tslib = xyes; then
  1601         AC_MSG_CHECKING(for Touchscreen library support)
  1602         enable_input_tslib=no
  1603         AC_TRY_COMPILE([
  1604           #include "tslib.h"
  1605         ],[
  1606         ],[
  1607         enable_input_tslib=yes
  1608         ])
  1609         AC_MSG_RESULT($enable_input_tslib)
  1610         if test x$enable_input_tslib = xyes; then
  1611             AC_DEFINE(SDL_INPUT_TSLIB)
  1612             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
  1613         fi
  1614     fi
  1615 }
  1616 
  1617 dnl See if we can use GNU pth library for threads
  1618 CheckPTH()
  1619 {
  1620     dnl Check for pth support
  1621     AC_ARG_ENABLE(pth,
  1622 AC_HELP_STRING([--enable-pth], [use GNU pth library for multi-threading [[default=yes]]]),
  1623                   , enable_pth=yes)
  1624     if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  1625         AC_PATH_PROG(PTH_CONFIG, pth-config, no)
  1626         if test "$PTH_CONFIG" = "no"; then
  1627             use_pth=no
  1628         else
  1629             use_pth=yes
  1630         fi
  1631         AC_MSG_CHECKING(pth)
  1632         AC_MSG_RESULT($use_pth)
  1633         if test "x$use_pth" = xyes; then
  1634             AC_DEFINE(SDL_THREAD_PTH)
  1635             SOURCES="$SOURCES $srcdir/src/thread/pth/*.c"
  1636             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  1637             SDL_CFLAGS="$SDL_CFLAGS `$PTH_CONFIG --cflags`"
  1638             SDL_LIBS="$SDL_LIBS `$PTH_CONFIG --libs --all`"
  1639             have_threads=yes
  1640         fi
  1641     fi
  1642 }
  1643 
  1644 dnl See what type of thread model to use on Linux and Solaris
  1645 CheckPTHREAD()
  1646 {
  1647     dnl Check for pthread support
  1648     AC_ARG_ENABLE(pthreads,
  1649 AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]),
  1650                   , enable_pthreads=yes)
  1651     dnl This is used on Linux for glibc binary compatibility (Doh!)
  1652     AC_ARG_ENABLE(pthread-sem,
  1653 AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
  1654                   , enable_pthread_sem=yes)
  1655     case "$host" in
  1656         *-*-linux*|*-*-uclinux*)
  1657             pthread_cflags="-D_REENTRANT"
  1658             pthread_lib="-lpthread"
  1659             ;;
  1660         *-*-bsdi*)
  1661             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1662             pthread_lib=""
  1663             ;;
  1664         *-*-darwin*)
  1665             pthread_cflags="-D_THREAD_SAFE"
  1666 # causes Carbon.p complaints?
  1667 #            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1668             ;;
  1669         *-*-freebsd*|*-*-dragonfly*)
  1670             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1671             pthread_lib="-pthread"
  1672             ;;
  1673         *-*-netbsd*)
  1674             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1675             pthread_lib="-lpthread"
  1676             ;;
  1677         *-*-openbsd*)
  1678             pthread_cflags="-D_REENTRANT"
  1679             pthread_lib="-pthread"
  1680             ;;
  1681         *-*-solaris*)
  1682             pthread_cflags="-D_REENTRANT"
  1683             pthread_lib="-lpthread -lposix4"
  1684             ;;
  1685         *-*-sysv5*)
  1686             pthread_cflags="-D_REENTRANT -Kthread"
  1687             pthread_lib=""
  1688             ;;
  1689         *-*-irix*)
  1690             pthread_cflags="-D_SGI_MP_SOURCE"
  1691             pthread_lib="-lpthread"
  1692             ;;
  1693         *-*-aix*)
  1694             pthread_cflags="-D_REENTRANT -mthreads"
  1695             pthread_lib="-lpthread"
  1696             ;;
  1697         *-*-hpux11*)
  1698             pthread_cflags="-D_REENTRANT"
  1699             pthread_lib="-L/usr/lib -lpthread"
  1700             ;;
  1701         *-*-qnx*)
  1702             pthread_cflags=""
  1703             pthread_lib=""
  1704             ;;
  1705         *-*-osf*)
  1706             pthread_cflags="-D_REENTRANT"
  1707             if test x$ac_cv_prog_gcc = xyes; then
  1708                 pthread_lib="-lpthread -lrt"
  1709             else
  1710                 pthread_lib="-lpthread -lexc -lrt"
  1711             fi
  1712             ;;
  1713         *)
  1714             pthread_cflags="-D_REENTRANT"
  1715             pthread_lib="-lpthread"
  1716             ;;
  1717     esac
  1718     if test x$enable_threads = xyes -a x$enable_pthreads = xyes -a x$enable_ipod != xyes; then
  1719         # Save the original compiler flags and libraries
  1720         ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1721         # Add the pthread compiler flags and libraries
  1722         CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1723         # Check to see if we have pthread support on this system
  1724         AC_MSG_CHECKING(for pthreads)
  1725         use_pthreads=no
  1726         AC_TRY_LINK([
  1727          #include <pthread.h>
  1728         ],[
  1729          pthread_attr_t type;
  1730          pthread_attr_init(&type);
  1731         ],[
  1732         use_pthreads=yes
  1733         ])
  1734         AC_MSG_RESULT($use_pthreads)
  1735         # Restore the compiler flags and libraries
  1736         CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1737 
  1738         # Do futher testing if we have pthread support...
  1739         if test x$use_pthreads = xyes; then
  1740             AC_DEFINE(SDL_THREAD_PTHREAD)
  1741             EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
  1742             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
  1743             SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
  1744             SDL_LIBS="$SDL_LIBS $pthread_lib"
  1745 
  1746             # Save the original compiler flags and libraries
  1747             ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1748             # Add the pthread compiler flags and libraries
  1749             CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1750 
  1751             # Check to see if recursive mutexes are available
  1752             AC_MSG_CHECKING(for recursive mutexes)
  1753             has_recursive_mutexes=no
  1754             if test x$has_recursive_mutexes = xno; then
  1755                 AC_TRY_COMPILE([
  1756                   #include <pthread.h>
  1757                 ],[
  1758                   pthread_mutexattr_t attr;
  1759                   pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
  1760                 ],[
  1761                 has_recursive_mutexes=yes
  1762                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX)
  1763                 ])
  1764             fi
  1765             if test x$has_recursive_mutexes = xno; then
  1766                 AC_TRY_COMPILE([
  1767                   #include <pthread.h>
  1768                 ],[
  1769                   pthread_mutexattr_t attr;
  1770                   pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
  1771                 ],[
  1772                 has_recursive_mutexes=yes
  1773                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP)
  1774                 ])
  1775             fi
  1776             AC_MSG_RESULT($has_recursive_mutexes)
  1777 
  1778             # Check to see if pthread semaphore support is missing
  1779             if test x$enable_pthread_sem = xyes; then
  1780                 AC_MSG_CHECKING(for pthread semaphores)
  1781                 have_pthread_sem=no
  1782                 AC_TRY_COMPILE([
  1783                   #include <pthread.h>
  1784                   #include <semaphore.h>
  1785                 ],[
  1786                 ],[
  1787                 have_pthread_sem=yes
  1788                 ])
  1789                 AC_MSG_RESULT($have_pthread_sem)
  1790             fi
  1791 
  1792             # Restore the compiler flags and libraries
  1793             CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1794 
  1795             # Basic thread creation functions
  1796             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
  1797 
  1798             # Semaphores
  1799             # We can fake these with mutexes and condition variables if necessary
  1800             if test x$have_pthread_sem = xyes; then
  1801                 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
  1802             else
  1803                 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  1804             fi
  1805 
  1806             # Mutexes
  1807             # We can fake these with semaphores if necessary
  1808             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
  1809 
  1810             # Condition variables
  1811             # We can fake these with semaphores and mutexes if necessary
  1812             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
  1813 
  1814             have_threads=yes
  1815         else
  1816             CheckPTH
  1817         fi
  1818     fi
  1819 }
  1820 
  1821 dnl Determine whether the compiler can produce Win32 executables
  1822 CheckWIN32()
  1823 {
  1824     AC_MSG_CHECKING(Win32 compiler)
  1825     have_win32_gcc=no
  1826     AC_TRY_COMPILE([
  1827      #include <windows.h>
  1828     ],[
  1829     ],[
  1830     have_win32_gcc=yes
  1831     ])
  1832     AC_MSG_RESULT($have_win32_gcc)
  1833     if test x$have_win32_gcc != xyes; then
  1834        AC_MSG_ERROR([
  1835 *** Your compiler ($CC) does not produce Win32 executables!
  1836        ])
  1837     fi
  1838 
  1839     dnl See if the user wants to redirect standard output to files
  1840     AC_ARG_ENABLE(stdio-redirect,
  1841 AC_HELP_STRING([--enable-stdio-redirect], [Redirect STDIO to files on Win32 [[default=yes]]]),
  1842                   , enable_stdio_redirect=yes)
  1843     if test x$enable_stdio_redirect != xyes; then
  1844         EXTRA_CFLAGS="$EXTRA_CFLAGS -DNO_STDIO_REDIRECT"
  1845     fi
  1846 }
  1847 
  1848 dnl Find the DirectX includes and libraries
  1849 CheckDIRECTX()
  1850 {
  1851     AC_ARG_ENABLE(directx,
  1852 AC_HELP_STRING([--enable-directx], [use DirectX for Win32 audio/video [[default=yes]]]),
  1853                   , enable_directx=yes)
  1854     if test x$enable_directx = xyes; then
  1855         AC_CHECK_HEADER(d3d9.h, have_d3d=yes)
  1856         AC_CHECK_HEADER(dsound.h, have_dsound=yes)
  1857         AC_CHECK_HEADER(dinput.h, use_dinput=yes)
  1858     fi
  1859 }
  1860 
  1861 dnl Check for the dlfcn.h interface for dynamically loading objects
  1862 CheckDLOPEN()
  1863 {
  1864     AC_ARG_ENABLE(sdl-dlopen,
  1865 AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]),
  1866                   , enable_sdl_dlopen=yes)
  1867     if test x$enable_sdl_dlopen = xyes; then
  1868         AC_MSG_CHECKING(for dlopen)
  1869         have_dlopen=no
  1870         AC_TRY_COMPILE([
  1871          #include <dlfcn.h>
  1872         ],[
  1873          #if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED <= 1020
  1874          #error Use dlcompat for Mac OS X 10.2 compatibility
  1875          #endif
  1876         ],[
  1877         have_dlopen=yes
  1878         ])
  1879         AC_MSG_RESULT($have_dlopen)
  1880 
  1881         if test x$have_dlopen = xyes; then
  1882             AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
  1883                AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
  1884                   AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
  1885             AC_CHECK_LIB(dl, dlvsym, have_dlvsym=yes)
  1886             if test x$have_dlvsym = xyes; then
  1887                 AC_DEFINE(HAVE_DLVSYM)
  1888             fi
  1889             AC_DEFINE(SDL_LOADSO_DLOPEN)
  1890             SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
  1891             have_loadso=yes
  1892         fi
  1893     fi
  1894 }
  1895 
  1896 dnl Set up the Atari LDG (shared object loader)
  1897 CheckAtariLdg()
  1898 {
  1899     AC_ARG_ENABLE(atari-ldg,
  1900 AC_HELP_STRING([--enable-atari-ldg], [use Atari LDG for shared object loading [[default=yes]]]),
  1901                   , enable_atari_ldg=yes)
  1902     if test x$video_gem = xyes -a x$enable_atari_ldg = xyes; then
  1903         AC_CHECK_HEADER(ldg.h, have_ldg_hdr=yes)
  1904         AC_CHECK_LIB(ldg, ldg_open, have_ldg_lib=yes, have_ldg_lib=no, -lgem)
  1905         if test x$have_ldg_hdr = xyes -a x$have_ldg_lib = xyes; then
  1906             AC_DEFINE(SDL_LOADSO_LDG)
  1907             SOURCES="$SOURCES $srcdir/src/loadso/mint/*.c"
  1908             SDL_LIBS="$SDL_LIBS -lldg -lgem"
  1909             have_loadso=yes
  1910         fi
  1911     fi
  1912 }
  1913 
  1914 dnl Check for the usbhid(3) library on *BSD
  1915 CheckUSBHID()
  1916 {
  1917     if test x$enable_joystick = xyes; then
  1918         AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
  1919         if test x$have_libusbhid = xyes; then
  1920             AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
  1921             AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
  1922             USB_LIBS="$USB_LIBS -lusbhid"
  1923         else
  1924             AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
  1925             AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
  1926             AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
  1927         fi
  1928             
  1929         save_CFLAGS="$CFLAGS"
  1930         CFLAGS="$CFLAGS $USB_CFLAGS"
  1931 
  1932         AC_MSG_CHECKING(for usbhid)
  1933         have_usbhid=no
  1934         AC_TRY_COMPILE([
  1935           #include <sys/types.h>
  1936           #if defined(HAVE_USB_H)
  1937           #include <usb.h>
  1938           #endif
  1939           #ifdef __DragonFly__
  1940           # include <bus/usb/usb.h>
  1941           # include <bus/usb/usbhid.h>
  1942           #else
  1943           # include <dev/usb/usb.h>
  1944           # include <dev/usb/usbhid.h>
  1945           #endif
  1946           #if defined(HAVE_USBHID_H)
  1947           #include <usbhid.h>
  1948           #elif defined(HAVE_LIBUSB_H)
  1949           #include <libusb.h>
  1950           #elif defined(HAVE_LIBUSBHID_H)
  1951           #include <libusbhid.h>
  1952           #endif
  1953         ],[
  1954           struct report_desc *repdesc;
  1955           struct usb_ctl_report *repbuf;
  1956           hid_kind_t hidkind;
  1957         ],[
  1958         have_usbhid=yes
  1959         ])
  1960         AC_MSG_RESULT($have_usbhid)
  1961 
  1962         if test x$have_usbhid = xyes; then
  1963             AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
  1964             have_usbhid_ucr_data=no
  1965             AC_TRY_COMPILE([
  1966               #include <sys/types.h>
  1967               #if defined(HAVE_USB_H)
  1968               #include <usb.h>
  1969               #endif
  1970               #ifdef __DragonFly__
  1971               # include <bus/usb/usb.h>
  1972               # include <bus/usb/usbhid.h>
  1973               #else
  1974               # include <dev/usb/usb.h>
  1975               # include <dev/usb/usbhid.h>
  1976               #endif
  1977               #if defined(HAVE_USBHID_H)
  1978               #include <usbhid.h>
  1979               #elif defined(HAVE_LIBUSB_H)
  1980               #include <libusb.h>
  1981               #elif defined(HAVE_LIBUSBHID_H)
  1982               #include <libusbhid.h>
  1983               #endif
  1984             ],[
  1985               struct usb_ctl_report buf;
  1986               if (buf.ucr_data) { }
  1987             ],[
  1988             have_usbhid_ucr_data=yes
  1989             ])
  1990             if test x$have_usbhid_ucr_data = xyes; then
  1991                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
  1992             fi
  1993             AC_MSG_RESULT($have_usbhid_ucr_data)
  1994             
  1995             AC_MSG_CHECKING(for new usbhid API)
  1996             have_usbhid_new=no
  1997             AC_TRY_COMPILE([
  1998               #include <sys/types.h>
  1999               #if defined(HAVE_USB_H)
  2000               #include <usb.h>
  2001               #endif
  2002 	      #ifdef __DragonFly__
  2003               #include <bus/usb/usb.h>
  2004               #include <bus/usb/usbhid.h>
  2005 	      #else
  2006               #include <dev/usb/usb.h>
  2007               #include <dev/usb/usbhid.h>
  2008 	      #endif
  2009               #if defined(HAVE_USBHID_H)
  2010               #include <usbhid.h>
  2011               #elif defined(HAVE_LIBUSB_H)
  2012               #include <libusb.h>
  2013               #elif defined(HAVE_LIBUSBHID_H)
  2014               #include <libusbhid.h>
  2015               #endif
  2016             ],[
  2017               report_desc_t d;
  2018               hid_start_parse(d, 1, 1);
  2019             ],[
  2020             have_usbhid_new=yes
  2021             ])
  2022             if test x$have_usbhid_new = xyes; then
  2023                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
  2024             fi
  2025             AC_MSG_RESULT($have_usbhid_new)
  2026 
  2027             AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
  2028             have_machine_joystick=no
  2029             AC_TRY_COMPILE([
  2030               #include <machine/joystick.h>
  2031             ],[
  2032               struct joystick t;
  2033             ],[
  2034             have_machine_joystick=yes
  2035             ])
  2036             if test x$have_machine_joystick = xyes; then
  2037                 AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H)
  2038             fi
  2039             AC_MSG_RESULT($have_machine_joystick)
  2040 
  2041             AC_DEFINE(SDL_JOYSTICK_USBHID)
  2042             SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
  2043             EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
  2044             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
  2045             have_joystick=yes
  2046         fi
  2047         CFLAGS="$save_CFLAGS"
  2048     fi
  2049 }
  2050 
  2051 dnl Check for clock_gettime()
  2052 CheckClockGettime()
  2053 {
  2054     AC_ARG_ENABLE(clock_gettime,
  2055 AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=no]]]),
  2056                   , enable_clock_gettime=no)
  2057     if test x$enable_clock_gettime = xyes; then
  2058         AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
  2059         if test x$have_clock_gettime = xyes; then
  2060             AC_DEFINE(HAVE_CLOCK_GETTIME)
  2061             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
  2062         fi
  2063     fi
  2064 }
  2065 
  2066 dnl Check for a valid linux/version.h
  2067 CheckLinuxVersion()
  2068 {
  2069     AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
  2070     if test x$have_linux_version_h = xyes; then
  2071         EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
  2072     fi
  2073 }
  2074 
  2075 dnl Check if we want to use RPATH
  2076 CheckRPATH()
  2077 {
  2078     AC_ARG_ENABLE(rpath,
  2079 AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]),
  2080                   , enable_rpath=yes)
  2081 }
  2082 
  2083 dnl Set up the configuration based on the host platform!
  2084 case "$host" in
  2085     arm-*-elf*) # FIXME: Can we get more specific for iPodLinux?
  2086         ARCH=linux
  2087         CheckDummyVideo
  2088         CheckIPod
  2089         # Set up files for the timer library
  2090         if test x$enable_timers = xyes; then
  2091             AC_DEFINE(SDL_TIMER_UNIX)
  2092             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2093             have_timers=yes
  2094         fi
  2095         ;;
  2096     *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-irix*|*-*-aix*|*-*-osf*)
  2097         case "$host" in
  2098             *-*-linux*)         ARCH=linux ;;
  2099             *-*-uclinux*)       ARCH=linux ;;
  2100             *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
  2101             *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
  2102             *-*-kopenbsd*-gnu)  ARCH=kopenbsd-gnu ;;
  2103             *-*-gnu*)           ARCH=gnu ;; # must be last of the gnu variants
  2104             *-*-bsdi*)          ARCH=bsdi ;;
  2105             *-*-freebsd*)       ARCH=freebsd ;;
  2106             *-*-dragonfly*)     ARCH=freebsd ;;
  2107             *-*-netbsd*)        ARCH=netbsd ;;
  2108             *-*-openbsd*)       ARCH=openbsd ;;
  2109             *-*-sysv5*)         ARCH=sysv5 ;;
  2110             *-*-solaris*)       ARCH=solaris ;;
  2111             *-*-hpux*)          ARCH=hpux ;;
  2112             *-*-irix*)          ARCH=irix ;;
  2113             *-*-aix*)           ARCH=aix ;;
  2114             *-*-osf*)           ARCH=osf ;;
  2115         esac
  2116         CheckVisibilityHidden
  2117         CheckDummyVideo
  2118         CheckDiskAudio
  2119         CheckDummyAudio
  2120         CheckDLOPEN
  2121         CheckOSS
  2122         CheckDMEDIA
  2123         CheckMME
  2124         CheckALSA
  2125         CheckPulseAudio
  2126         CheckARTSC
  2127         CheckESD
  2128         CheckNAS
  2129         CheckX11
  2130         CheckNANOX
  2131         CheckFBCON
  2132         CheckDirectFB
  2133         CheckPS2GS
  2134         CheckSVGA
  2135         CheckVGL
  2136         CheckWscons
  2137         CheckOpenGLX11
  2138         CheckInputEvents
  2139         CheckTslib
  2140         CheckUSBHID
  2141         CheckPTHREAD
  2142         CheckClockGettime
  2143         CheckLinuxVersion
  2144         CheckRPATH
  2145         # Set up files for the audio library
  2146         if test x$enable_audio = xyes; then
  2147           case $ARCH in
  2148             sysv5|solaris|hpux)
  2149                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
  2150                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  2151                 have_audio=yes
  2152             ;;
  2153             netbsd|openbsd)
  2154                 AC_DEFINE(SDL_AUDIO_DRIVER_BSD)
  2155                 SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c"
  2156                 have_audio=yes
  2157             ;;
  2158             aix)
  2159                 AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO)
  2160                 SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
  2161                 have_audio=yes
  2162             ;;
  2163           esac
  2164         fi
  2165         # Set up files for the joystick library
  2166         if test x$enable_joystick = xyes; then
  2167           case $ARCH in
  2168             linux)
  2169                 AC_DEFINE(SDL_JOYSTICK_LINUX)
  2170                 SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
  2171                 have_joystick=yes
  2172             ;;
  2173           esac
  2174         fi
  2175         # Set up files for the cdrom library
  2176         if test x$enable_cdrom = xyes; then
  2177           case $ARCH in
  2178             linux|solaris)
  2179                 AC_DEFINE(SDL_CDROM_LINUX)
  2180                 SOURCES="$SOURCES $srcdir/src/cdrom/linux/*.c"
  2181                 have_cdrom=yes
  2182             ;;
  2183             *freebsd*)
  2184                 AC_DEFINE(SDL_CDROM_FREEBSD)
  2185                 SOURCES="$SOURCES $srcdir/src/cdrom/freebsd/*.c"
  2186                 have_cdrom=yes
  2187             ;;
  2188             *openbsd*|*netbsd*)
  2189                 AC_DEFINE(SDL_CDROM_OPENBSD)
  2190                 SOURCES="$SOURCES $srcdir/src/cdrom/openbsd/*.c"
  2191                 have_cdrom=yes
  2192             ;;
  2193             bsdi)
  2194                 AC_DEFINE(SDL_CDROM_BSDI)
  2195                 SOURCES="$SOURCES $srcdir/src/cdrom/bsdi/*.c"
  2196                 have_cdrom=yes
  2197             ;;
  2198             aix)
  2199                 AC_DEFINE(SDL_CDROM_AIX)
  2200                 SOURCES="$SOURCES $srcdir/src/cdrom/aix/*.c"
  2201                 have_cdrom=yes
  2202             ;;
  2203             osf)
  2204                 AC_DEFINE(SDL_CDROM_OSF)
  2205                 SOURCES="$SOURCES $srcdir/src/cdrom/osf/*.c"
  2206                 have_cdrom=yes
  2207             ;;
  2208           esac
  2209         fi
  2210         # Set up files for the thread library
  2211         if test x$enable_threads = xyes -a x$use_pthreads != xyes -a x$use_pth != xyes -a x$ARCH = xirix; then
  2212             AC_DEFINE(SDL_THREAD_SPROC)
  2213             SOURCES="$SOURCES $srcdir/src/thread/irix/*.c"
  2214             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2215             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2216             have_threads=yes
  2217         fi
  2218         # Set up files for the timer library
  2219         if test x$enable_timers = xyes; then
  2220             AC_DEFINE(SDL_TIMER_UNIX)
  2221             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2222             have_timers=yes
  2223         fi
  2224         ;;
  2225     *-*-qnx*)
  2226         ARCH=qnx
  2227         CheckDummyVideo
  2228         CheckDiskAudio
  2229         CheckDummyAudio
  2230         CheckDLOPEN
  2231         CheckNAS
  2232         CheckPHOTON
  2233         CheckX11
  2234         CheckOpenGLX11
  2235         CheckPTHREAD
  2236         # Set up files for the audio library
  2237         if test x$enable_audio = xyes; then
  2238             AC_DEFINE(SDL_AUDIO_DRIVER_QNXNTO)
  2239             SOURCES="$SOURCES $srcdir/src/audio/nto/*.c"
  2240             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound"
  2241             have_audio=yes
  2242         fi
  2243         # Set up files for the cdrom library
  2244         if test x$enable_cdrom = xyes; then
  2245             AC_DEFINE(SDL_CDROM_QNX)
  2246             SOURCES="$SOURCES $srcdir/src/cdrom/qnx/*.c"
  2247             have_cdrom=yes
  2248         fi
  2249         # Set up files for the timer library
  2250         if test x$enable_timers = xyes; then
  2251             AC_DEFINE(SDL_TIMER_UNIX)
  2252             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2253             have_timers=yes
  2254         fi
  2255         ;;
  2256     *-*-cygwin* | *-*-mingw32*)
  2257         ARCH=win32
  2258         if test "$build" != "$host"; then # cross-compiling
  2259             # Default cross-compile location
  2260             ac_default_prefix=/usr/local/cross-tools/i386-mingw32
  2261         else
  2262             # Look for the location of the tools and install there
  2263             if test "$BUILD_PREFIX" != ""; then
  2264                 ac_default_prefix=$BUILD_PREFIX
  2265             fi
  2266         fi
  2267         CheckDummyVideo
  2268         CheckDiskAudio
  2269         CheckDummyAudio
  2270         CheckWIN32
  2271         CheckWIN32GL
  2272         CheckDIRECTX
  2273         # Set up files for the video library
  2274         if test x$enable_video = xyes; then
  2275             AC_DEFINE(SDL_VIDEO_DRIVER_WIN32)
  2276             SOURCES="$SOURCES $srcdir/src/video/win32/*.c"
  2277             have_video=yes
  2278             AC_ARG_ENABLE(render-gdi,
  2279 AC_HELP_STRING([--enable-render-gdi], [enable the GDI render driver [[default=yes]]]),
  2280                                 , enable_render_gdi=yes)
  2281             if test x$enable_render_gdi = xyes; then
  2282                 AC_DEFINE(SDL_VIDEO_RENDER_GDI)
  2283             fi
  2284             AC_ARG_ENABLE(render-d3d,
  2285 AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
  2286                                 , enable_render_d3d=yes)
  2287             if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
  2288                 AC_DEFINE(SDL_VIDEO_RENDER_D3D)
  2289             fi
  2290         fi
  2291         # Set up files for the audio library
  2292         if test x$enable_audio = xyes; then
  2293             AC_DEFINE(SDL_AUDIO_DRIVER_WINWAVEOUT)
  2294             SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
  2295             if test x$have_dsound = xyes; then
  2296                 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
  2297                 SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
  2298             fi
  2299             have_audio=yes
  2300         fi
  2301         # Set up files for the joystick library
  2302         if test x$enable_joystick = xyes; then
  2303             if test x$have_dinput = xyes; then
  2304                 AC_DEFINE(SDL_JOYSTICK_DINPUT)
  2305                 SOURCES="$SOURCES $srcdir/src/joystick/win32/SDL_dxjoystick.c"
  2306             else
  2307                 AC_DEFINE(SDL_JOYSTICK_WINMM)
  2308                 SOURCES="$SOURCES $srcdir/src/joystick/win32/SDL_mmjoystick.c"
  2309             fi
  2310             have_joystick=yes
  2311         fi
  2312         # Set up files for the cdrom library
  2313         if test x$enable_cdrom = xyes; then
  2314             AC_DEFINE(SDL_CDROM_WIN32)
  2315             SOURCES="$SOURCES $srcdir/src/cdrom/win32/*.c"
  2316             have_cdrom=yes
  2317         fi
  2318         # Set up files for the thread library
  2319         if test x$enable_threads = xyes; then
  2320             AC_DEFINE(SDL_THREAD_WIN32)
  2321             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
  2322             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
  2323             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
  2324             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2325             have_threads=yes
  2326         fi
  2327         # Set up files for the timer library
  2328         if test x$enable_timers = xyes; then
  2329             AC_DEFINE(SDL_TIMER_WIN32)
  2330             SOURCES="$SOURCES $srcdir/src/timer/win32/*.c"
  2331             have_timers=yes
  2332         fi
  2333         # Set up files for the shared object loading library
  2334         if test x$enable_loadso = xyes; then
  2335             AC_DEFINE(SDL_LOADSO_WIN32)
  2336             SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
  2337             have_loadso=yes
  2338         fi
  2339         # Set up the system libraries we need
  2340         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lunicows -luser32 -lgdi32 -lmsimg32 -lwinmm"
  2341         # The Win32 platform requires special setup
  2342         SOURCES="$SOURCES $srcdir/src/main/win32/*.rc"
  2343         SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
  2344         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  2345         SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
  2346         ;;
  2347     *-*-beos*)
  2348         ARCH=beos
  2349         ac_default_prefix=/boot/develop/tools/gnupro
  2350         CheckDummyVideo
  2351         CheckDiskAudio
  2352         CheckDummyAudio
  2353         CheckBWINDOW
  2354         CheckBeGL
  2355         # Set up files for the audio library
  2356         if test x$enable_audio = xyes; then
  2357             AC_DEFINE(SDL_AUDIO_DRIVER_BEOSAUDIO)
  2358             SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc"
  2359             have_audio=yes
  2360         fi
  2361         # Set up files for the joystick library
  2362         if test x$enable_joystick = xyes; then
  2363             AC_DEFINE(SDL_JOYSTICK_BEOS)
  2364             SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc"
  2365             have_joystick=yes
  2366         fi
  2367         # Set up files for the cdrom library
  2368         if test x$enable_cdrom = xyes; then
  2369             AC_DEFINE(SDL_CDROM_BEOS)
  2370             SOURCES="$SOURCES $srcdir/src/cdrom/beos/*.cc"
  2371             have_cdrom=yes
  2372         fi
  2373         # Set up files for the thread library
  2374         if test x$enable_threads = xyes; then
  2375             AC_DEFINE(SDL_THREAD_BEOS)
  2376             SOURCES="$SOURCES $srcdir/src/thread/beos/*.c"
  2377             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2378             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2379             have_threads=yes
  2380         fi
  2381         # Set up files for the timer library
  2382         if test x$enable_timers = xyes; then
  2383             AC_DEFINE(SDL_TIMER_BEOS)
  2384             SOURCES="$SOURCES $srcdir/src/timer/beos/*.c"
  2385             have_timers=yes
  2386         fi
  2387         # Set up files for the shared object loading library
  2388         if test x$enable_loadso = xyes; then
  2389             AC_DEFINE(SDL_LOADSO_BEOS)
  2390             SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
  2391             have_loadso=yes
  2392         fi
  2393         # The BeOS platform requires special setup.
  2394         SOURCES="$srcdir/src/main/beos/*.cc $SOURCES"
  2395         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
  2396         ;;
  2397     *-*-darwin* )
  2398         # This could be either full "Mac OS X", or plain "Darwin" which is
  2399         # just the OS X kernel sans upper layers like Carbon and Cocoa.
  2400         # Next line is broken, and a few files below require Mac OS X (full)
  2401         ARCH=macosx
  2402 
  2403         # Mac OS X builds with both the Carbon and OSX APIs at the moment
  2404         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
  2405         EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
  2406 
  2407         # HACK: Reset EXTRA_LDFLAGS; the only thing it contains at this point
  2408         # is -lm which is not needed under Mac OS X. But for some reasons it
  2409         # also tends to contain spurious -L switches, which we don't want to
  2410         # use here or in sdl-config. Hence we reset it.
  2411         EXTRA_LDFLAGS=""
  2412 
  2413         CheckVisibilityHidden
  2414         CheckDummyVideo
  2415         CheckDiskAudio
  2416         CheckDummyAudio
  2417         CheckDLOPEN
  2418 
  2419         # Set up files for the shared object loading library
  2420         # (this needs to be done before the dynamic X11 check)
  2421         if test x$enable_loadso = xyes -a x$have_dlopen != xyes; then
  2422             AC_DEFINE(SDL_LOADSO_DLCOMPAT)
  2423             SOURCES="$SOURCES $srcdir/src/loadso/macosx/*.c"
  2424             have_loadso=yes
  2425         fi
  2426 
  2427         CheckCOCOA
  2428         CheckX11
  2429         CheckMacGL
  2430         CheckOpenGLX11
  2431         CheckPTHREAD
  2432 
  2433         # Good optimization on Mac OS X, yes...
  2434         EXTRA_CFLAGS="$EXTRA_CFLAGS -falign-loops=16"
  2435 
  2436         # Need this or things might misbuild on a G3.
  2437         EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"
  2438 
  2439         # Set up files for the audio library
  2440         if test x$enable_audio = xyes; then
  2441             AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO)
  2442             SOURCES="$SOURCES $srcdir/src/audio/macosx/*.c"
  2443             AC_DEFINE(SDL_AUDIO_DRIVER_SNDMGR)
  2444             SOURCES="$SOURCES $srcdir/src/audio/macrom/*.c"
  2445             have_audio=yes
  2446         fi
  2447         # Set up files for the joystick library
  2448         if test x$enable_joystick = xyes; then
  2449             AC_DEFINE(SDL_JOYSTICK_IOKIT)
  2450             SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
  2451             have_joystick=yes
  2452         fi
  2453         # Set up files for the cdrom library
  2454         if test x$enable_cdrom = xyes; then
  2455             AC_DEFINE(SDL_CDROM_MACOSX)
  2456             SOURCES="$SOURCES $srcdir/src/cdrom/macosx/*.c"
  2457             have_cdrom=yes
  2458         fi
  2459         # Set up files for the timer library
  2460         if test x$enable_timers = xyes; then
  2461             AC_DEFINE(SDL_TIMER_UNIX)
  2462             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2463             have_timers=yes
  2464         fi
  2465         # The Mac OS X platform requires special setup.
  2466         EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
  2467         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
  2468         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
  2469         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
  2470         # If either the audio or CD driver is used, add the AudioUnit framework
  2471         if test x$enable_audio = xyes -o x$enable_cdrom = xyes; then
  2472             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -framework,AudioToolbox -Wl,-framework,AudioUnit"
  2473         fi
  2474         ;;
  2475     *-*-mint*)
  2476         ARCH=mint
  2477         CheckDummyVideo
  2478         CheckDiskAudio
  2479         CheckDummyAudio
  2480         CheckAtariBiosEvent
  2481         CheckAtariXbiosVideo
  2482         CheckAtariGemVideo
  2483         CheckAtariAudio
  2484         CheckAtariLdg
  2485         CheckAtariOSMesa
  2486         CheckPTH
  2487         # Set up files for the audio library
  2488         if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  2489             if test x$enable_audio = xyes; then
  2490                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
  2491                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  2492                 have_audio=yes
  2493             fi
  2494         fi
  2495         # Set up files for the joystick library
  2496         if test x$enable_joystick = xyes; then
  2497             AC_DEFINE(SDL_JOYSTICK_MINT)
  2498             SOURCES="$SOURCES $srcdir/src/joystick/mint/*.c"
  2499             have_joystick=yes
  2500         fi
  2501         # Set up files for the cdrom library
  2502         if test x$enable_cdrom = xyes; then
  2503             AC_DEFINE(SDL_CDROM_MINT)
  2504             SOURCES="$SOURCES $srcdir/src/cdrom/mint/*.c"
  2505             have_cdrom=yes
  2506         fi
  2507         # Set up files for the timer library
  2508         if test x$enable_timers = xyes; then
  2509             if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  2510                 AC_DEFINE(SDL_TIMER_UNIX)
  2511                 SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2512             else
  2513                 AC_DEFINE(SDL_TIMER_MINT)
  2514                 SOURCES="$SOURCES $srcdir/src/timer/mint/*.c"
  2515                 SOURCES="$SOURCES $srcdir/src/timer/mint/*.S"
  2516             fi
  2517             have_timers=yes
  2518         fi
  2519         ;;
  2520     *-riscos)
  2521         ARCH=riscos
  2522         CheckOSS
  2523         CheckPTHREAD
  2524         # Set up files for the video library
  2525         if test x$enable_video = xyes; then
  2526             AC_DEFINE(SDL_VIDEO_DRIVER_RISCOS)
  2527             SOURCES="$SOURCES $srcdir/src/video/riscos/*.c"
  2528             SOURCES="$SOURCES $srcdir/src/video/riscos/*.S"
  2529             have_video=yes
  2530         fi
  2531         # Set up files for the joystick library
  2532         if test x$enable_joystick = xyes; then
  2533             AC_DEFINE(SDL_JOYSTICK_RISCOS)
  2534             SOURCES="$SOURCES $srcdir/src/joystick/riscos/*.c"
  2535             have_joystick=yes
  2536         fi
  2537         # Set up files for the timer library
  2538         if test x$enable_timers = xyes; then
  2539             AC_DEFINE(SDL_TIMER_RISCOS)
  2540             SOURCES="$SOURCES $srcdir/src/timer/riscos/*.c"
  2541             have_timers=yes
  2542         fi
  2543         # The RISC OS platform requires special setup.
  2544         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ljpeg -ltiff -lpng -lz"
  2545         ;;
  2546     *)
  2547         AC_MSG_ERROR([
  2548 *** Unsupported host:  Please add to configure.in
  2549         ])
  2550         ;;
  2551 esac
  2552 
  2553 # Verify that we have all the platform specific files we need
  2554 
  2555 if test x$enable_joystick = xyes; then
  2556   if test x$have_joystick != xyes; then
  2557     # Wants joystick subsystem, but doesn't have a platform-specific backend...
  2558     SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  2559   fi
  2560 fi
  2561 if test x$have_cdrom != xyes; then
  2562     if test x$enable_cdrom = xyes; then
  2563         AC_DEFINE(SDL_CDROM_DISABLED)
  2564     fi
  2565     SOURCES="$SOURCES $srcdir/src/cdrom/dummy/*.c"
  2566 fi
  2567 if test x$have_threads != xyes; then
  2568     if test x$enable_threads = xyes; then
  2569         AC_DEFINE(SDL_THREADS_DISABLED)
  2570     fi
  2571     SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
  2572 fi
  2573 if test x$have_timers != xyes; then
  2574     if test x$enable_timers = xyes; then
  2575         AC_DEFINE(SDL_TIMERS_DISABLED)
  2576     fi
  2577     SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
  2578 fi
  2579 if test x$have_loadso != xyes; then
  2580     if test x$enable_loadso = xyes; then
  2581         AC_DEFINE(SDL_LOADSO_DISABLED)
  2582     fi
  2583     SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
  2584 fi
  2585 if test x$SDLMAIN_SOURCES = x; then
  2586     SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
  2587 fi
  2588 
  2589 OBJECTS=`echo $SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.asm,$(objects)/\1.lo,g'`
  2590 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.lo,g'`
  2591 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.lo,g'`
  2592 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
  2593 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.S,$(objects)/\1.lo,g'`
  2594 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
  2595 
  2596 SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.o,g'`
  2597 SDLMAIN_OBJECTS=`echo $SDLMAIN_OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
  2598 
  2599 # Set runtime shared library paths as needed
  2600 
  2601 if test "x$enable_rpath" = "xyes"; then
  2602   if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = irix -o $ARCH = linux -o $ARCH = netbsd; then
  2603     SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
  2604   fi
  2605   if test $ARCH = solaris; then
  2606     SDL_RLD_FLAGS="-R\${libdir}"
  2607   fi
  2608 else
  2609   SDL_RLD_FLAGS=""
  2610 fi
  2611 
  2612 case "$ARCH" in
  2613   macosx)
  2614     # Evil hack to allow static linking on Mac OS X
  2615     SDL_STATIC_LIBS="\${libdir}/libSDL.a $EXTRA_LDFLAGS"
  2616     ;;
  2617   *)
  2618     SDL_STATIC_LIBS="$SDL_LIBS"
  2619     ;;
  2620 esac
  2621 
  2622 dnl Expand the cflags and libraries needed by apps using SDL
  2623 AC_SUBST(SDL_CFLAGS)
  2624 AC_SUBST(SDL_LIBS)
  2625 AC_SUBST(SDL_STATIC_LIBS)
  2626 AC_SUBST(SDL_RLD_FLAGS)
  2627 if test x$enable_shared = xyes; then
  2628     ENABLE_SHARED_TRUE=
  2629     ENABLE_SHARED_FALSE="#"
  2630 else
  2631     ENABLE_SHARED_TRUE="#"
  2632     ENABLE_SHARED_FALSE=
  2633 fi
  2634 if test x$enable_static = xyes; then
  2635     ENABLE_STATIC_TRUE=
  2636     ENABLE_STATIC_FALSE="#"
  2637 else
  2638     ENABLE_STATIC_TRUE="#"
  2639     ENABLE_STATIC_FALSE=
  2640 fi
  2641 AC_SUBST(ENABLE_SHARED_TRUE)
  2642 AC_SUBST(ENABLE_SHARED_FALSE)
  2643 AC_SUBST(ENABLE_STATIC_TRUE)
  2644 AC_SUBST(ENABLE_STATIC_FALSE)
  2645 
  2646 dnl Expand the sources and objects needed to build the library
  2647 AC_SUBST(ac_aux_dir)
  2648 AC_SUBST(INCLUDE)
  2649 AC_SUBST(SOURCES)
  2650 AC_SUBST(OBJECTS)
  2651 AC_SUBST(SDLMAIN_SOURCES)
  2652 AC_SUBST(SDLMAIN_OBJECTS)
  2653 AC_SUBST(BUILD_CFLAGS)
  2654 AC_SUBST(EXTRA_CFLAGS)
  2655 AC_SUBST(BUILD_LDFLAGS)
  2656 AC_SUBST(EXTRA_LDFLAGS)
  2657 AC_SUBST(WINDRES)
  2658 
  2659 AC_OUTPUT([
  2660     Makefile sdl-config SDL.spec SDL.qpg sdl.pc
  2661 ], [
  2662     : >build-deps
  2663     if test x"$MAKE" = x; then MAKE=make; fi; $MAKE depend
  2664 ])