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