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