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