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