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