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