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