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