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