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