configure.in
author Sam Lantinga <slouken@libsdl.org>
Thu, 13 Apr 2006 13:29:00 +0000
changeset 1624 8208ae96bb2d
parent 1621 f12379c41042
child 1625 7e89aa7843c5
permissions -rw-r--r--
Fixed bug #192

The change made to sdl-config.in on March 18 (rev 11, see
http://www.libsdl.org/cgi/cvsweb.cgi/SDL12/sdl-config.in), broke static linking
under Mac OS X for unix style build systems. In other words, "sdl-config
--static-libs" no longer produces the correct output, as it is missing the
required -framework switches.

The attached patch fixes this.
     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=2
    19 SDL_MICRO_VERSION=10
    20 SDL_INTERFACE_AGE=3
    21 SDL_BINARY_AGE=10
    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"
    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                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGL"
  1448                 # The following is probably not available in Darwin:
  1449                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AGL"
  1450         esac
  1451     fi
  1452 }
  1453 
  1454 dnl Check for Mesa offscreen rendering
  1455 CheckAtariOSMesa()
  1456 {
  1457     if test "x$enable_video" = "xyes" -a "x$enable_video_opengl" = "xyes"; then
  1458         AC_CHECK_HEADER(GL/osmesa.h, have_osmesa_hdr=yes)
  1459         AC_CHECK_LIB(OSMesa, OSMesaCreateContext, have_osmesa_lib=yes, have_osmesa_lib=no, -lm)
  1460 
  1461         # Static linking to -lOSMesa
  1462         AC_PATH_PROG(OSMESA_CONFIG, osmesa-config, no)
  1463         if test "x$OSMESA_CONFIG" = "xno" -o "x$enable_atari_ldg" = "xno"; then
  1464             # -lOSMesa is really the static library
  1465             if test "x$have_osmesa_hdr" = "xyes" -a "x$have_osmesa_lib" = "xyes"; then
  1466                 OSMESA_LIBS="-lOSMesa"
  1467             fi
  1468         else
  1469             # -lOSMesa is a loader for OSMesa.ldg
  1470             OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags`
  1471             OSMESA_LIBS=`$OSMESA_CONFIG --libs`
  1472         fi
  1473         AC_DEFINE(SDL_VIDEO_OPENGL)
  1474         AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA)
  1475         EXTRA_CFLAGS="$EXTRA_CFLAGS $OSMESA_CFLAGS"
  1476         EXTRA_LDFLAGS="$EXTRA_LDFLAGS $OSMESA_LIBS"
  1477 
  1478         AC_ARG_ENABLE(osmesa-shared,
  1479 AC_HELP_STRING([--enable-osmesa-shared], [dynamically load OSMesa OpenGL support [default=yes]]),
  1480                               , enable_osmesa_shared=yes)
  1481         if test "x$enable_osmesa_shared" = "xyes" -a "x$enable_atari_ldg" = "xyes"; then
  1482             # Dynamic linking
  1483             if test "x$have_osmesa_hdr" = "xyes"; then
  1484                 AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA_DYNAMIC)
  1485             fi
  1486         fi
  1487     fi
  1488 }
  1489 
  1490 dnl See if we can use the new unified event interface in Linux 2.4
  1491 CheckInputEvents()
  1492 {
  1493     dnl Check for Linux 2.4 unified input event interface support
  1494     AC_ARG_ENABLE(input-events,
  1495 AC_HELP_STRING([--enable-input-events], [use Linux 2.4 unified input interface [default=yes]]),
  1496                   , enable_input_events=yes)
  1497     if test x$enable_input_events = xyes; then
  1498         AC_MSG_CHECKING(for Linux 2.4 unified input interface)
  1499         use_input_events=no
  1500         AC_TRY_COMPILE([
  1501           #include <linux/input.h>
  1502         ],[
  1503           #ifndef EVIOCGNAME
  1504           #error EVIOCGNAME() ioctl not available
  1505           #endif
  1506         ],[
  1507         use_input_events=yes
  1508         ])
  1509         AC_MSG_RESULT($use_input_events)
  1510         if test x$use_input_events = xyes; then
  1511             AC_DEFINE(SDL_INPUT_LINUXEV)
  1512         fi
  1513     fi
  1514 }
  1515 
  1516 dnl See if we can use the Touchscreen input library
  1517 CheckTslib()
  1518 {
  1519     AC_ARG_ENABLE(input-tslib,
  1520 AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [default=yes]]),
  1521                   , enable_input_tslib=yes)
  1522     if test x$enable_input_tslib = xyes; then
  1523         AC_MSG_CHECKING(for Touchscreen library support)
  1524         enable_input_tslib=no
  1525         AC_TRY_COMPILE([
  1526           #include "tslib.h"
  1527         ],[
  1528         ],[
  1529         enable_input_tslib=yes
  1530         ])
  1531         AC_MSG_RESULT($enable_input_tslib)
  1532         if test x$enable_input_tslib = xyes; then
  1533             AC_DEFINE(SDL_INPUT_TSLIB)
  1534             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
  1535         fi
  1536     fi
  1537 }
  1538 
  1539 dnl See if we can use GNU pth library for threads
  1540 CheckPTH()
  1541 {
  1542     dnl Check for pth support
  1543     AC_ARG_ENABLE(pth,
  1544 AC_HELP_STRING([--enable-pth], [use GNU pth library for multi-threading [default=yes]]),
  1545                   , enable_pth=yes)
  1546     if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  1547         AC_PATH_PROG(PTH_CONFIG, pth-config, no)
  1548         if test "$PTH_CONFIG" = "no"; then
  1549             use_pth=no
  1550         else
  1551             use_pth=yes
  1552         fi
  1553         AC_MSG_CHECKING(pth)
  1554         AC_MSG_RESULT($use_pth)
  1555         if test "x$use_pth" = xyes; then
  1556             AC_DEFINE(SDL_THREAD_PTH)
  1557             SOURCES="$SOURCES $srcdir/src/thread/pth/*.c"
  1558             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  1559             SDL_CFLAGS="$SDL_CFLAGS `$PTH_CONFIG --cflags`"
  1560             SDL_LIBS="$SDL_LIBS `$PTH_CONFIG --libs --all`"
  1561             have_threads=yes
  1562         fi
  1563     fi
  1564 }
  1565 
  1566 dnl See what type of thread model to use on Linux and Solaris
  1567 CheckPTHREAD()
  1568 {
  1569     dnl Check for pthread support
  1570     AC_ARG_ENABLE(pthreads,
  1571 AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [default=yes]]),
  1572                   , enable_pthreads=yes)
  1573     dnl This is used on Linux for glibc binary compatibility (Doh!)
  1574     AC_ARG_ENABLE(pthread-sem,
  1575 AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [default=yes]]),
  1576                   , enable_pthread_sem=yes)
  1577     case "$host" in
  1578         *-*-linux*)
  1579             pthread_cflags="-D_REENTRANT"
  1580             pthread_lib="-lpthread"
  1581             ;;
  1582         *-*-bsdi*)
  1583             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1584             pthread_lib=""
  1585             ;;
  1586         *-*-darwin*)
  1587             pthread_cflags="-D_THREAD_SAFE"
  1588 # causes Carbon.p complaints?
  1589 #            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1590             ;;
  1591         *-*-freebsd*|*-*-dragonfly*)
  1592             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1593             pthread_lib="-pthread"
  1594             ;;
  1595         *-*-netbsd*)
  1596             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1597             pthread_lib="-L/usr/lib -lpthread"
  1598             ;;
  1599         *-*-openbsd*)
  1600             pthread_cflags="-D_REENTRANT"
  1601             pthread_lib="-pthread"
  1602             ;;
  1603         *-*-solaris*)
  1604             pthread_cflags="-D_REENTRANT"
  1605             pthread_lib="-lpthread -lposix4"
  1606             ;;
  1607         *-*-sysv5*)
  1608             pthread_cflags="-D_REENTRANT -Kthread"
  1609             pthread_lib=""
  1610             ;;
  1611         *-*-irix*)
  1612             pthread_cflags="-D_SGI_MP_SOURCE"
  1613             pthread_lib="-lpthread"
  1614             ;;
  1615         *-*-aix*)
  1616             pthread_cflags="-D_REENTRANT -mthreads"
  1617             pthread_lib="-lpthread"
  1618             ;;
  1619         *-*-hpux11*)
  1620             pthread_cflags="-D_REENTRANT"
  1621             pthread_lib="-L/usr/lib -lpthread"
  1622             ;;
  1623         *-*-qnx*)
  1624             pthread_cflags=""
  1625             pthread_lib=""
  1626             ;;
  1627         *-*-osf*)
  1628             pthread_cflags="-D_REENTRANT"
  1629             if test x$ac_cv_prog_gcc = xyes; then
  1630                 pthread_lib="-lpthread -lrt"
  1631             else
  1632                 pthread_lib="-lpthread -lexc -lrt"
  1633             fi
  1634             ;;
  1635         *)
  1636             pthread_cflags="-D_REENTRANT"
  1637             pthread_lib="-lpthread"
  1638             ;;
  1639     esac
  1640     if test x$enable_threads = xyes -a x$enable_pthreads = xyes -a x$enable_ipod != xyes; then
  1641         # Save the original compiler flags and libraries
  1642         ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1643         # Add the pthread compiler flags and libraries
  1644         CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1645         # Check to see if we have pthread support on this system
  1646         AC_MSG_CHECKING(for pthreads)
  1647         use_pthreads=no
  1648         AC_TRY_LINK([
  1649          #include <pthread.h>
  1650         ],[
  1651          pthread_attr_t type;
  1652          pthread_attr_init(&type);
  1653         ],[
  1654         use_pthreads=yes
  1655         ])
  1656         AC_MSG_RESULT($use_pthreads)
  1657         # Restore the compiler flags and libraries
  1658         CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1659 
  1660         # Do futher testing if we have pthread support...
  1661         if test x$use_pthreads = xyes; then
  1662             AC_DEFINE(SDL_THREAD_PTHREAD)
  1663             EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
  1664             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
  1665             SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
  1666             SDL_LIBS="$SDL_LIBS $pthread_lib"
  1667 
  1668             # Save the original compiler flags and libraries
  1669             ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1670             # Add the pthread compiler flags and libraries
  1671             CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1672 
  1673             # Check to see if recursive mutexes are available
  1674             AC_MSG_CHECKING(for recursive mutexes)
  1675             has_recursive_mutexes=no
  1676             if test x$has_recursive_mutexes = xno; then
  1677                 AC_TRY_COMPILE([
  1678                   #include <pthread.h>
  1679                 ],[
  1680                   pthread_mutexattr_t attr;
  1681                   pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
  1682                 ],[
  1683                 has_recursive_mutexes=yes
  1684                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX)
  1685                 ])
  1686             fi
  1687             if test x$has_recursive_mutexes = xno; then
  1688                 AC_TRY_COMPILE([
  1689                   #include <pthread.h>
  1690                 ],[
  1691                   pthread_mutexattr_t attr;
  1692                   pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
  1693                 ],[
  1694                 has_recursive_mutexes=yes
  1695                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP)
  1696                 ])
  1697             fi
  1698             AC_MSG_RESULT($has_recursive_mutexes)
  1699 
  1700             # Check to see if pthread semaphore support is missing
  1701             if test x$enable_pthread_sem = xyes; then
  1702                 AC_MSG_CHECKING(for pthread semaphores)
  1703                 have_pthread_sem=no
  1704                 AC_TRY_COMPILE([
  1705                   #include <pthread.h>
  1706                   #include <semaphore.h>
  1707                 ],[
  1708                 ],[
  1709                 have_pthread_sem=yes
  1710                 ])
  1711                 AC_MSG_RESULT($have_pthread_sem)
  1712             fi
  1713 
  1714             # Restore the compiler flags and libraries
  1715             CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1716 
  1717             # Basic thread creation functions
  1718             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
  1719 
  1720             # Semaphores
  1721             # We can fake these with mutexes and condition variables if necessary
  1722             if test x$have_pthread_sem = xyes; then
  1723                 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
  1724             else
  1725                 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  1726             fi
  1727 
  1728             # Mutexes
  1729             # We can fake these with semaphores if necessary
  1730             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
  1731 
  1732             # Condition variables
  1733             # We can fake these with semaphores and mutexes if necessary
  1734             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
  1735 
  1736             have_threads=yes
  1737         else
  1738             CheckPTH
  1739         fi
  1740     fi
  1741 }
  1742 
  1743 dnl Determine whether the compiler can produce Win32 executables
  1744 CheckWIN32()
  1745 {
  1746     AC_MSG_CHECKING(Win32 compiler)
  1747     have_win32_gcc=no
  1748     AC_TRY_COMPILE([
  1749      #include <windows.h>
  1750     ],[
  1751     ],[
  1752     have_win32_gcc=yes
  1753     ])
  1754     AC_MSG_RESULT($have_win32_gcc)
  1755     if test x$have_win32_gcc != xyes; then
  1756        AC_MSG_ERROR([
  1757 *** Your compiler ($CC) does not produce Win32 executables!
  1758        ])
  1759     fi
  1760 
  1761     dnl See if the user wants to redirect standard output to files
  1762     AC_ARG_ENABLE(stdio-redirect,
  1763 AC_HELP_STRING([--enable-stdio-redirect], [Redirect STDIO to files on Win32 [default=yes]]),
  1764                   , enable_stdio_redirect=yes)
  1765     if test x$enable_stdio_redirect != xyes; then
  1766         EXTRA_CFLAGS="$EXTRA_CFLAGS -DNO_STDIO_REDIRECT"
  1767     fi
  1768 
  1769     if test x$enable_video = xyes; then
  1770         AC_DEFINE(SDL_VIDEO_DRIVER_WINDIB)
  1771         SOURCES="$SOURCES $srcdir/src/video/wincommon/*.c"
  1772         SOURCES="$SOURCES $srcdir/src/video/windib/*.c"
  1773         have_video=yes
  1774     fi
  1775 }
  1776 
  1777 dnl Find the DirectX includes and libraries
  1778 CheckDIRECTX()
  1779 {
  1780     AC_ARG_ENABLE(directx,
  1781 AC_HELP_STRING([--enable-directx], [use DirectX for Win32 audio/video [default=yes]]),
  1782                   , enable_directx=yes)
  1783     if test x$enable_directx = xyes; then
  1784         have_directx=no
  1785         AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
  1786         AC_CHECK_HEADER(dsound.h, have_dsound=yes)
  1787         AC_CHECK_HEADER(dinput.h, use_dinput=yes)
  1788         if test x$have_ddraw = xyes -a x$have_dsound = xyes -a x$use_dinput = xyes; then
  1789             have_directx=yes
  1790         fi
  1791         if test x$enable_video = xyes -a x$have_directx = xyes; then
  1792             AC_DEFINE(SDL_VIDEO_DRIVER_DDRAW)
  1793             SOURCES="$SOURCES $srcdir/src/video/windx5/*.c"
  1794             have_video=yes
  1795         fi
  1796     fi
  1797 }
  1798 
  1799 dnl Check for the dlfcn.h interface for dynamically loading objects
  1800 CheckDLOPEN()
  1801 {
  1802     AC_ARG_ENABLE(sdl-dlopen,
  1803 AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [default=yes]]),
  1804                   , enable_sdl_dlopen=yes)
  1805     if test x$enable_sdl_dlopen = xyes; then
  1806         AC_MSG_CHECKING(for dlopen)
  1807         have_dlopen=no
  1808         AC_TRY_COMPILE([
  1809          #include <dlfcn.h>
  1810         ],[
  1811         ],[
  1812         have_dlopen=yes
  1813         ])
  1814         AC_MSG_RESULT($have_dlopen)
  1815 
  1816         if test x$have_dlopen = xyes; then
  1817             AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
  1818                AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
  1819                   AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
  1820             AC_CHECK_LIB(dl, dlvsym, have_dlvsym=yes)
  1821             if test x$have_dlvsym = xyes; then
  1822                 AC_DEFINE(HAVE_DLVSYM)
  1823             fi
  1824             AC_DEFINE(SDL_LOADSO_DLOPEN)
  1825             SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
  1826             have_loadso=yes
  1827         fi
  1828     fi
  1829 }
  1830 
  1831 dnl Set up the Atari LDG (shared object loader)
  1832 CheckAtariLdg()
  1833 {
  1834     AC_ARG_ENABLE(atari-ldg,
  1835 AC_HELP_STRING([--enable-atari-ldg], [use Atari LDG for shared object loading [default=yes]]),
  1836                   , enable_atari_ldg=yes)
  1837     if test x$video_gem = xyes -a x$enable_atari_ldg = xyes; then
  1838         AC_CHECK_HEADER(ldg.h, have_ldg_hdr=yes)
  1839         AC_CHECK_LIB(ldg, ldg_open, have_ldg_lib=yes, have_ldg_lib=no, -lgem)
  1840         if test x$have_ldg_hdr = xyes -a x$have_ldg_lib = xyes; then
  1841             AC_DEFINE(SDL_LOADSO_LDG)
  1842             SOURCES="$SOURCES $srcdir/src/loadso/mint/*.c"
  1843             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lldg -lgem"
  1844             have_loadso=yes
  1845         fi
  1846     fi
  1847 }
  1848 
  1849 dnl Check for the usbhid(3) library on *BSD
  1850 CheckUSBHID()
  1851 {
  1852     if test x$enable_joystick = xyes; then
  1853         AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
  1854         if test x$have_libusbhid = xyes; then
  1855             AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
  1856             AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
  1857             USB_LIBS="$USB_LIBS -lusbhid"
  1858         else
  1859             AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
  1860             AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
  1861             AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
  1862         fi
  1863             
  1864         save_CFLAGS="$CFLAGS"
  1865         CFLAGS="$CFLAGS $USB_CFLAGS"
  1866 
  1867         AC_MSG_CHECKING(for usbhid)
  1868         have_usbhid=no
  1869         AC_TRY_COMPILE([
  1870           #include <sys/types.h>
  1871           #if defined(HAVE_USB_H)
  1872           #include <usb.h>
  1873           #endif
  1874           #ifdef __DragonFly__
  1875           # include <bus/usb/usb.h>
  1876           # include <bus/usb/usbhid.h>
  1877           #else
  1878           # include <dev/usb/usb.h>
  1879           # include <dev/usb/usbhid.h>
  1880           #endif
  1881           #if defined(HAVE_USBHID_H)
  1882           #include <usbhid.h>
  1883           #elif defined(HAVE_LIBUSB_H)
  1884           #include <libusb.h>
  1885           #elif defined(HAVE_LIBUSBHID_H)
  1886           #include <libusbhid.h>
  1887           #endif
  1888         ],[
  1889           struct report_desc *repdesc;
  1890           struct usb_ctl_report *repbuf;
  1891           hid_kind_t hidkind;
  1892         ],[
  1893         have_usbhid=yes
  1894         ])
  1895         AC_MSG_RESULT($have_usbhid)
  1896 
  1897         if test x$have_usbhid = xyes; then
  1898             AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
  1899             have_usbhid_ucr_data=no
  1900             AC_TRY_COMPILE([
  1901               #include <sys/types.h>
  1902               #if defined(HAVE_USB_H)
  1903               #include <usb.h>
  1904               #endif
  1905               #ifdef __DragonFly__
  1906               # include <bus/usb/usb.h>
  1907               # include <bus/usb/usbhid.h>
  1908               #else
  1909               # include <dev/usb/usb.h>
  1910               # include <dev/usb/usbhid.h>
  1911               #endif
  1912               #if defined(HAVE_USBHID_H)
  1913               #include <usbhid.h>
  1914               #elif defined(HAVE_LIBUSB_H)
  1915               #include <libusb.h>
  1916               #elif defined(HAVE_LIBUSBHID_H)
  1917               #include <libusbhid.h>
  1918               #endif
  1919             ],[
  1920               struct usb_ctl_report buf;
  1921               if (buf.ucr_data) { }
  1922             ],[
  1923             have_usbhid_ucr_data=yes
  1924             ])
  1925             if test x$have_usbhid_ucr_data = xyes; then
  1926                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
  1927             fi
  1928             AC_MSG_RESULT($have_usbhid_ucr_data)
  1929             
  1930             AC_MSG_CHECKING(for new usbhid API)
  1931             have_usbhid_new=no
  1932             AC_TRY_COMPILE([
  1933               #include <sys/types.h>
  1934               #if defined(HAVE_USB_H)
  1935               #include <usb.h>
  1936               #endif
  1937               #include <dev/usb/usb.h>
  1938               #include <dev/usb/usbhid.h>
  1939               #if defined(HAVE_USBHID_H)
  1940               #include <usbhid.h>
  1941               #elif defined(HAVE_LIBUSB_H)
  1942               #include <libusb.h>
  1943               #elif defined(HAVE_LIBUSBHID_H)
  1944               #include <libusbhid.h>
  1945               #endif
  1946             ],[
  1947               report_desc_t d;
  1948               hid_start_parse(d, 1, 1);
  1949             ],[
  1950             have_usbhid_new=yes
  1951             ])
  1952             if test x$have_usbhid_new = xyes; then
  1953                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
  1954             fi
  1955             AC_MSG_RESULT($have_usbhid_new)
  1956 
  1957             AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
  1958             have_machine_joystick=no
  1959             AC_TRY_COMPILE([
  1960               #include <machine/joystick.h>
  1961             ],[
  1962               struct joystick t;
  1963             ],[
  1964             have_machine_joystick=yes
  1965             ])
  1966             if test x$have_machine_joystick = xyes; then
  1967                 AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H)
  1968             fi
  1969             AC_MSG_RESULT($have_machine_joystick)
  1970 
  1971             AC_DEFINE(SDL_JOYSTICK_USBHID)
  1972             SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
  1973             EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
  1974             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
  1975             have_joystick=yes
  1976         fi
  1977         CFLAGS="$save_CFLAGS"
  1978     fi
  1979 }
  1980 
  1981 dnl Check for clock_gettime()
  1982 CheckClockGettime()
  1983 {
  1984     AC_ARG_ENABLE(clock_gettime,
  1985 AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [default=no]]),
  1986                   , enable_clock_gettime=no)
  1987     if test x$enable_clock_gettime = xyes; then
  1988         AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
  1989         if test x$have_clock_gettime = xyes; then
  1990             AC_DEFINE(HAVE_CLOCK_GETTIME)
  1991             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
  1992         fi
  1993     fi
  1994 }
  1995 
  1996 dnl Check for a valid linux/version.h
  1997 CheckLinuxVersion()
  1998 {
  1999     AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
  2000     if test x$have_linux_version_h = xyes; then
  2001         EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
  2002     fi
  2003 }
  2004 
  2005 dnl Check if we want to use RPATH
  2006 CheckRPATH()
  2007 {
  2008     AC_ARG_ENABLE(rpath,
  2009 AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [default=yes]]),
  2010                   , enable_rpath=yes)
  2011 }
  2012 
  2013 dnl Set up the configuration based on the host platform!
  2014 case "$host" in
  2015     arm-*-elf*) # FIXME: Can we get more specific for iPodLinux?
  2016         ARCH=linux
  2017         CheckDummyVideo
  2018         CheckIPod
  2019         # Set up files for the timer library
  2020         if test x$enable_timers = xyes; then
  2021             AC_DEFINE(SDL_TIMER_UNIX)
  2022             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2023             have_timers=yes
  2024         fi
  2025         ;;
  2026     *-*-linux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-irix*|*-*-aix*|*-*-osf*)
  2027         case "$host" in
  2028             *-*-linux*)         ARCH=linux ;;
  2029             *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
  2030             *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
  2031             *-*-kopenbsd*-gnu)  ARCH=kopenbsd-gnu ;;
  2032             *-*-gnu*)           ARCH=gnu ;; # must be last of the gnu variants
  2033             *-*-bsdi*)          ARCH=bsdi ;;
  2034             *-*-freebsd*)       ARCH=freebsd ;;
  2035             *-*-dragonfly*)     ARCH=freebsd ;;
  2036             *-*-netbsd*)        ARCH=netbsd ;;
  2037             *-*-openbsd*)       ARCH=openbsd ;;
  2038             *-*-sysv5*)         ARCH=sysv5 ;;
  2039             *-*-solaris*)       ARCH=solaris ;;
  2040             *-*-hpux*)          ARCH=hpux ;;
  2041             *-*-irix*)          ARCH=irix ;;
  2042             *-*-aix*)           ARCH=aix ;;
  2043             *-*-osf*)           ARCH=osf ;;
  2044         esac
  2045         CheckVisibilityHidden
  2046         CheckDummyVideo
  2047         CheckDiskAudio
  2048         CheckDummyAudio
  2049         CheckDLOPEN
  2050         CheckNASM
  2051         CheckAltivec
  2052         CheckOSS
  2053         CheckDMEDIA
  2054         CheckMME
  2055         CheckALSA
  2056         CheckARTSC
  2057         CheckESD
  2058         CheckNAS
  2059         CheckX11
  2060         CheckNANOX
  2061         CheckFBCON
  2062         CheckDirectFB
  2063         CheckPS2GS
  2064         CheckGGI
  2065         CheckSVGA
  2066         CheckVGL
  2067         CheckWscons
  2068         CheckAAlib
  2069         CheckQtopia
  2070         CheckPicoGUI
  2071         CheckOpenGLX11
  2072         CheckInputEvents
  2073         CheckTslib
  2074         CheckUSBHID
  2075         CheckPTHREAD
  2076         CheckClockGettime
  2077         CheckLinuxVersion
  2078         CheckRPATH
  2079         # Set up files for the audio library
  2080         if test x$enable_audio = xyes; then
  2081           case $ARCH in
  2082             sysv5|solaris|hpux)
  2083                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
  2084                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  2085                 have_audio=yes
  2086             ;;
  2087             netbsd|openbsd)
  2088                 AC_DEFINE(SDL_AUDIO_DRIVER_BSD)
  2089                 SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c"
  2090                 have_audio=yes
  2091             ;;
  2092             aix)
  2093                 AC_DEFINE(SDL_AUDIO_DRIVER_PAUD)
  2094                 SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
  2095                 have_audio=yes
  2096             ;;
  2097           esac
  2098         fi
  2099         # Set up files for the joystick library
  2100         if test x$enable_joystick = xyes; then
  2101           case $ARCH in
  2102             linux)
  2103                 AC_DEFINE(SDL_JOYSTICK_LINUX)
  2104                 SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
  2105                 have_joystick=yes
  2106             ;;
  2107           esac
  2108         fi
  2109         # Set up files for the cdrom library
  2110         if test x$enable_cdrom = xyes; then
  2111           case $ARCH in
  2112             linux|solaris)
  2113                 AC_DEFINE(SDL_CDROM_LINUX)
  2114                 SOURCES="$SOURCES $srcdir/src/cdrom/linux/*.c"
  2115                 have_cdrom=yes
  2116             ;;
  2117             *freebsd*)
  2118                 AC_DEFINE(SDL_CDROM_FREEBSD)
  2119                 SOURCES="$SOURCES $srcdir/src/cdrom/freebsd/*.c"
  2120                 have_cdrom=yes
  2121             ;;
  2122             *openbsd*|*netbsd*)
  2123                 AC_DEFINE(SDL_CDROM_OPENBSD)
  2124                 SOURCES="$SOURCES $srcdir/src/cdrom/openbsd/*.c"
  2125                 have_cdrom=yes
  2126             ;;
  2127             bsdi)
  2128                 AC_DEFINE(SDL_CDROM_BSDI)
  2129                 SOURCES="$SOURCES $srcdir/src/cdrom/bsdi/*.c"
  2130                 have_cdrom=yes
  2131             ;;
  2132             aix)
  2133                 AC_DEFINE(SDL_CDROM_AIX)
  2134                 SOURCES="$SOURCES $srcdir/src/cdrom/aix/*.c"
  2135                 have_cdrom=yes
  2136             ;;
  2137             osf)
  2138                 AC_DEFINE(SDL_CDROM_OSF)
  2139                 SOURCES="$SOURCES $srcdir/src/cdrom/osf/*.c"
  2140                 have_cdrom=yes
  2141             ;;
  2142           esac
  2143         fi
  2144         # Set up files for the thread library
  2145         if test x$enable_threads = xyes -a x$use_pthreads != xyes -a x$use_pth != xyes -a x$ARCH = xirix; then
  2146             AC_DEFINE(SDL_THREAD_SPROC)
  2147             SOURCES="$SOURCES $srcdir/src/thread/irix/*.c"
  2148             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2149             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2150             have_threads=yes
  2151         fi
  2152         # Set up files for the timer library
  2153         if test x$enable_timers = xyes; then
  2154             AC_DEFINE(SDL_TIMER_UNIX)
  2155             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2156             have_timers=yes
  2157         fi
  2158         ;;
  2159     *-*-qnx*)
  2160         ARCH=qnx
  2161         CheckDummyVideo
  2162         CheckDiskAudio
  2163         CheckDummyAudio
  2164         # CheckNASM
  2165         CheckDLOPEN
  2166         CheckNAS
  2167         CheckPHOTON
  2168         CheckX11
  2169         CheckOpenGLX11
  2170         CheckPTHREAD
  2171         # Set up files for the audio library
  2172         if test x$enable_audio = xyes; then
  2173             AC_DEFINE(SDL_AUDIO_DRIVER_QNXNTO)
  2174             SOURCES="$SOURCES $srcdir/src/audio/nto/*.c"
  2175             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound"
  2176             have_audio=yes
  2177         fi
  2178         # Set up files for the cdrom library
  2179         if test x$enable_cdrom = xyes; then
  2180             AC_DEFINE(SDL_CDROM_QNX)
  2181             SOURCES="$SOURCES $srcdir/src/cdrom/qnx/*.c"
  2182             have_cdrom=yes
  2183         fi
  2184         # Set up files for the timer library
  2185         if test x$enable_timers = xyes; then
  2186             AC_DEFINE(SDL_TIMER_UNIX)
  2187             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2188             have_timers=yes
  2189         fi
  2190         ;;
  2191     *-*-cygwin* | *-*-mingw32*)
  2192         ARCH=win32
  2193         if test "$build" != "$host"; then # cross-compiling
  2194             # Default cross-compile location
  2195             ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc
  2196         else
  2197             # Look for the location of the tools and install there
  2198             if test "$BUILD_PREFIX" != ""; then
  2199                 ac_default_prefix=$BUILD_PREFIX
  2200             fi
  2201         fi
  2202         CheckDummyVideo
  2203         CheckDiskAudio
  2204         CheckDummyAudio
  2205         CheckWIN32
  2206         CheckWIN32GL
  2207         CheckDIRECTX
  2208         CheckNASM
  2209         # Set up files for the audio library
  2210         if test x$enable_audio = xyes; then
  2211             AC_DEFINE(SDL_AUDIO_DRIVER_WAVEOUT)
  2212             SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
  2213             if test x$have_directx = xyes; then
  2214                 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
  2215                 SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
  2216             fi
  2217             have_audio=yes
  2218         fi
  2219         # Set up files for the joystick library
  2220         if test x$enable_joystick = xyes; then
  2221             AC_DEFINE(SDL_JOYSTICK_WINMM)
  2222             SOURCES="$SOURCES $srcdir/src/joystick/win32/*.c"
  2223             have_joystick=yes
  2224         fi
  2225         # Set up files for the cdrom library
  2226         if test x$enable_cdrom = xyes; then
  2227             AC_DEFINE(SDL_CDROM_WIN32)
  2228             SOURCES="$SOURCES $srcdir/src/cdrom/win32/*.c"
  2229             have_cdrom=yes
  2230         fi
  2231         # Set up files for the thread library
  2232         if test x$enable_threads = xyes; then
  2233             AC_DEFINE(SDL_THREAD_WIN32)
  2234             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
  2235             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
  2236             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
  2237             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2238             have_threads=yes
  2239         fi
  2240         # Set up files for the timer library
  2241         if test x$enable_timers = xyes; then
  2242             AC_DEFINE(SDL_TIMER_WIN32)
  2243             SOURCES="$SOURCES $srcdir/src/timer/win32/*.c"
  2244             have_timers=yes
  2245         fi
  2246         # Set up files for the shared object loading library
  2247         if test x$enable_loadso = xyes; then
  2248             AC_DEFINE(SDL_LOADSO_WIN32)
  2249             SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
  2250             have_loadso=yes
  2251         fi
  2252         # Set up the system libraries we need
  2253         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm"
  2254         if test x$have_directx = xyes; then
  2255             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldxguid"
  2256         fi
  2257         # The Win32 platform requires special setup
  2258         SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
  2259         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  2260         SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
  2261         ;;
  2262     *-*-beos*)
  2263         ARCH=beos
  2264         ac_default_prefix=/boot/develop/tools/gnupro
  2265         CheckDummyVideo
  2266         CheckDiskAudio
  2267         CheckDummyAudio
  2268         CheckNASM
  2269         CheckBWINDOW
  2270         CheckBeGL
  2271         # Set up files for the audio library
  2272         if test x$enable_audio = xyes; then
  2273             AC_DEFINE(SDL_AUDIO_DRIVER_BAUDIO)
  2274             SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc"
  2275             have_audio=yes
  2276         fi
  2277         # Set up files for the joystick library
  2278         if test x$enable_joystick = xyes; then
  2279             AC_DEFINE(SDL_JOYSTICK_BEOS)
  2280             SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc"
  2281             have_joystick=yes
  2282         fi
  2283         # Set up files for the cdrom library
  2284         if test x$enable_cdrom = xyes; then
  2285             AC_DEFINE(SDL_CDROM_BEOS)
  2286             SOURCES="$SOURCES $srcdir/src/cdrom/beos/*.cc"
  2287             have_cdrom=yes
  2288         fi
  2289         # Set up files for the thread library
  2290         if test x$enable_threads = xyes; then
  2291             AC_DEFINE(SDL_THREAD_BEOS)
  2292             SOURCES="$SOURCES $srcdir/src/thread/beos/*.c"
  2293             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2294             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2295             have_threads=yes
  2296         fi
  2297         # Set up files for the timer library
  2298         if test x$enable_timers = xyes; then
  2299             AC_DEFINE(SDL_TIMER_BEOS)
  2300             SOURCES="$SOURCES $srcdir/src/timer/beos/*.c"
  2301             have_timers=yes
  2302         fi
  2303         # Set up files for the shared object loading library
  2304         if test x$enable_loadso = xyes; then
  2305             AC_DEFINE(SDL_LOADSO_BEOS)
  2306             SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
  2307             have_loadso=yes
  2308         fi
  2309         # The BeOS platform requires special setup.
  2310         SOURCES="$srcdir/src/main/beos/*.cc $SOURCES"
  2311         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
  2312         ;;
  2313     *-*-darwin* )
  2314         # This could be either full "Mac OS X", or plain "Darwin" which is
  2315         # just the OS X kernel sans upper layers like Carbon and Cocoa.
  2316         # Next line is broken, and a few files below require Mac OS X (full)
  2317         ARCH=macosx
  2318 
  2319         # HACK: Reset EXTRA_LDFLAGS; the only thing it contains at this point is 
  2320         # -lm which is not needed under Mac OS X. But for some reasons it also
  2321         # tends to contain spurious -L switches, which we don't want to use
  2322         # here or in sdl-config. Hence we reset it.
  2323         EXTRA_LDFLAGS=""
  2324 
  2325         CheckDummyVideo
  2326         CheckDiskAudio
  2327         CheckDummyAudio
  2328         CheckDLOPEN
  2329         CheckCOCOA
  2330         CheckCARBON
  2331         CheckX11
  2332         CheckMacGL
  2333         CheckOpenGLX11
  2334         CheckPTHREAD
  2335         CheckAltivec
  2336 
  2337         # Need this or things might misbuild on a G3.
  2338         EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"
  2339 
  2340         # Set up files for the audio library
  2341         if test x$enable_audio = xyes; then
  2342             AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO)
  2343             SOURCES="$SOURCES $srcdir/src/audio/macosx/*.c"
  2344             AC_DEFINE(SDL_AUDIO_DRIVER_SNDMGR)
  2345             SOURCES="$SOURCES $srcdir/src/audio/macrom/*.c"
  2346             have_audio=yes
  2347         fi
  2348         # Set up files for the joystick library
  2349         if test x$enable_joystick = xyes; then
  2350             AC_DEFINE(SDL_JOYSTICK_IOKIT)
  2351             SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
  2352             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
  2353             have_joystick=yes
  2354         fi
  2355         # Set up files for the cdrom library
  2356         if test x$enable_cdrom = xyes; then
  2357             AC_DEFINE(SDL_CDROM_MACOSX)
  2358             SOURCES="$SOURCES $srcdir/src/cdrom/macosx/*.c"
  2359             have_cdrom=yes
  2360         fi
  2361         # Set up files for the timer library
  2362         if test x$enable_timers = xyes; then
  2363             AC_DEFINE(SDL_TIMER_UNIX)
  2364             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2365             have_timers=yes
  2366         fi
  2367         # Set up files for the shared object loading library
  2368         if test x$enable_loadso = xyes -a x$have_dlopen != xyes; then
  2369             AC_DEFINE(SDL_LOADSO_DLCOMPAT)
  2370             SOURCES="$SOURCES $srcdir/src/loadso/macosx/*.c"
  2371             have_loadso=yes
  2372         fi
  2373         # The Mac OS X platform requires special setup.
  2374         SDLMAIN_SOURCES="$srcdir/src/main/macosx/*.m"
  2375         EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
  2376         SDL_LIBS="-lSDLmain $SDL_LIBS"
  2377         if test x$enable_video_cocoa = xyes; then
  2378             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
  2379         fi
  2380         if test x$enable_video_carbon = xyes -o x$enable_video_cocoa = xyes; then
  2381             # The Cocoa backend still needs Carbon, and the YUV code QuickTime
  2382             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuickTime -Wl,-framework,ApplicationServices"
  2383             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
  2384         fi
  2385         # If either the audio or CD driver is used, add the AudioUnit framework
  2386         if test x$enable_audio = xyes -o x$enable_cdrom = xyes; then
  2387             EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit"
  2388         fi
  2389         ;;
  2390     *-*-mint*)
  2391         ARCH=mint
  2392         CheckDummyVideo
  2393         CheckDiskAudio
  2394         CheckDummyAudio
  2395         CheckAtariBiosEvent
  2396         CheckAtariXbiosVideo
  2397         CheckAtariGemVideo
  2398         CheckAtariAudio
  2399         CheckAtariLdg
  2400         CheckAtariOSMesa
  2401         CheckPTH
  2402         # Set up files for the audio library
  2403         if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  2404             if test x$enable_audio = xyes; then
  2405                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
  2406                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  2407                 have_audio=yes
  2408             fi
  2409         fi
  2410         # Set up files for the joystick library
  2411         if test x$enable_joystick = xyes; then
  2412             AC_DEFINE(SDL_JOYSTICK_MINT)
  2413             SOURCES="$SOURCES $srcdir/src/joystick/mint/*.c"
  2414             have_joystick=yes
  2415         fi
  2416         # Set up files for the cdrom library
  2417         if test x$enable_cdrom = xyes; then
  2418             AC_DEFINE(SDL_CDROM_MINT)
  2419             SOURCES="$SOURCES $srcdir/src/cdrom/mint/*.c"
  2420             have_cdrom=yes
  2421         fi
  2422         # Set up files for the timer library
  2423         if test x$enable_timers = xyes; then
  2424             if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  2425                 AC_DEFINE(SDL_TIMER_UNIX)
  2426                 SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2427             else
  2428                 AC_DEFINE(SDL_TIMER_MINT)
  2429                 SOURCES="$SOURCES $srcdir/src/timer/mint/*.c"
  2430                 SOURCES="$SOURCES $srcdir/src/timer/mint/*.S"
  2431             fi
  2432             have_timers=yes
  2433         fi
  2434         ;;
  2435     *-riscos)
  2436         ARCH=riscos
  2437         CheckOSS
  2438         CheckPTHREAD
  2439         # Set up files for the video library
  2440         if test x$enable_video = xyes; then
  2441             AC_DEFINE(SDL_VIDEO_DRIVER_RISCOS)
  2442             SOURCES="$SOURCES $srcdir/src/video/riscos/*.c"
  2443             SOURCES="$SOURCES $srcdir/src/video/riscos/*.S"
  2444             have_video=yes
  2445         fi
  2446         # Set up files for the joystick library
  2447         if test x$enable_joystick = xyes; then
  2448             AC_DEFINE(SDL_JOYSTICK_RISCOS)
  2449             SOURCES="$SOURCES $srcdir/src/joystick/riscos/*.c"
  2450             have_joystick=yes
  2451         fi
  2452         # Set up files for the timer library
  2453         if test x$enable_timers = xyes; then
  2454             AC_DEFINE(SDL_TIMER_RISCOS)
  2455             SOURCES="$SOURCES $srcdir/src/timer/riscos/*.c"
  2456             have_timers=yes
  2457         fi
  2458         # The RISC OS platform requires special setup.
  2459         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ljpeg -ltiff -lpng -lz"
  2460         ;;
  2461     *)
  2462         AC_MSG_ERROR([
  2463 *** Unsupported host:  Please add to configure.in
  2464         ])
  2465         ;;
  2466 esac
  2467 
  2468 # Verify that we have all the platform specific files we need
  2469 if test x$have_joystick != xyes; then
  2470     if test x$enable_joystick = xyes; then
  2471         AC_DEFINE(SDL_JOYSTICK_DISABLED)
  2472     fi
  2473     SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  2474 fi
  2475 if test x$have_cdrom != xyes; then
  2476     if test x$enable_cdrom = xyes; then
  2477         AC_DEFINE(SDL_CDROM_DISABLED)
  2478     fi
  2479     SOURCES="$SOURCES $srcdir/src/cdrom/dummy/*.c"
  2480 fi
  2481 if test x$have_threads != xyes; then
  2482     if test x$enable_threads = xyes; then
  2483         AC_DEFINE(SDL_THREADS_DISABLED)
  2484     fi
  2485     SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
  2486 fi
  2487 if test x$have_timers != xyes; then
  2488     if test x$enable_timers = xyes; then
  2489         AC_DEFINE(SDL_TIMERS_DISABLED)
  2490     fi
  2491     SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
  2492 fi
  2493 if test x$have_loadso != xyes; then
  2494     if test x$enable_loadso = xyes; then
  2495         AC_DEFINE(SDL_LOADSO_DISABLED)
  2496     fi
  2497     SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
  2498 fi
  2499 if test x$SDLMAIN_SOURCES = x; then
  2500     SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
  2501 fi
  2502 
  2503 OBJECTS=`echo $SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.asm,$(objects)/\1.lo,g'`
  2504 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.lo,g'`
  2505 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.lo,g'`
  2506 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
  2507 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.S,$(objects)/\1.lo,g'`
  2508 
  2509 SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.o,g'`
  2510 SDLMAIN_OBJECTS=`echo $SDLMAIN_OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.o,g'`
  2511 SDLMAIN_OBJECTS=`echo $SDLMAIN_OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
  2512 
  2513 # Set runtime shared library paths as needed
  2514 
  2515 if test "x$enable_rpath" = "xyes"; then
  2516   if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = irix -o $ARCH = linux -o $ARCH = netbsd; then
  2517     SDL_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib"
  2518   fi
  2519   if test $ARCH = solaris; then
  2520     SDL_RLD_FLAGS="-R\${exec_prefix}/lib"
  2521   fi
  2522 else
  2523   SDL_RLD_FLAGS=""
  2524 fi
  2525 
  2526 case "$ARCH" in
  2527   macosx)
  2528     if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
  2529       SDL_LIBS="$SDL_LIBS -Wl,-framework,Cocoa"
  2530     fi
  2531     if test x$enable_video = xyes -a x$enable_video_carbon = xyes; then
  2532       SDL_LIBS="$SDL_LIBS -Wl,-framework,Carbon"
  2533     fi
  2534     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  2535       SDL_LIBS="$SDL_LIBS -Wl,-framework,OpenGL"
  2536     fi
  2537     # Evil hack to allow static linking on Mac OS X
  2538     SDL_STATIC_LIBS="\${exec_prefix}/lib/libSDLmain.a \${exec_prefix}/lib/libSDL.a $EXTRA_LDFLAGS"
  2539     ;;
  2540   *)
  2541     SDL_STATIC_LIBS="$SDL_LIBS"
  2542     ;;
  2543 esac
  2544 
  2545 dnl Expand the cflags and libraries needed by apps using SDL
  2546 AC_SUBST(SDL_CFLAGS)
  2547 AC_SUBST(SDL_LIBS)
  2548 AC_SUBST(SDL_STATIC_LIBS)
  2549 AC_SUBST(SDL_RLD_FLAGS)
  2550 if test x$enable_shared = xyes; then
  2551     ENABLE_SHARED_TRUE=
  2552     ENABLE_SHARED_FALSE="#"
  2553 else
  2554     ENABLE_SHARED_TRUE="#"
  2555     ENABLE_SHARED_FALSE=
  2556 fi
  2557 if test x$enable_static = xyes; then
  2558     ENABLE_STATIC_TRUE=
  2559     ENABLE_STATIC_FALSE="#"
  2560 else
  2561     ENABLE_STATIC_TRUE="#"
  2562     ENABLE_STATIC_FALSE=
  2563 fi
  2564 AC_SUBST(ENABLE_SHARED_TRUE)
  2565 AC_SUBST(ENABLE_SHARED_FALSE)
  2566 AC_SUBST(ENABLE_STATIC_TRUE)
  2567 AC_SUBST(ENABLE_STATIC_FALSE)
  2568 
  2569 dnl Expand the sources and objects needed to build the library
  2570 AC_SUBST(ac_aux_dir)
  2571 AC_SUBST(INCLUDE)
  2572 AC_SUBST(SOURCES)
  2573 AC_SUBST(OBJECTS)
  2574 AC_SUBST(SDLMAIN_SOURCES)
  2575 AC_SUBST(SDLMAIN_OBJECTS)
  2576 AC_SUBST(BUILD_CFLAGS)
  2577 AC_SUBST(EXTRA_CFLAGS)
  2578 AC_SUBST(BUILD_LDFLAGS)
  2579 AC_SUBST(EXTRA_LDFLAGS)
  2580 
  2581 AC_OUTPUT([
  2582     Makefile sdl-config SDL.spec SDL.qpg
  2583 ], [
  2584     : >build-deps
  2585     make depend
  2586 ])