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