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