configure.in
author Patrice Mandin
Thu, 16 Feb 2006 22:33:34 +0000
changeset 1365 b70f45aa5d0c
parent 1364 4214be2b8d77
child 1366 34d9df784d84
permissions -rw-r--r--
Add missing clause
     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 vsnprint 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                     x11_lib='libX11.so.6'
   766                     x11ext_lib='libXext.so.6'
   767                     ;;
   768             esac
   769 
   770             X_CFLAGS="$X_CFLAGS -DXTHREADS"
   771             if test x$ac_cv_func_shmat != xyes; then
   772                 X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY"
   773             fi
   774             if test x$have_loadso != xyes && \
   775                test x$enable_x11_shared = xyes; then
   776                 AC_MSG_ERROR([You must have SDL_LoadObject() support])
   777             fi
   778 
   779             if test x$have_loadso = xyes && \
   780                test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then
   781                 echo "-- dynamic libX11 -> $x11_lib"
   782                 echo "-- dynamic libX11ext -> $x11ext_lib"
   783                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib")
   784                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib")
   785             else
   786                 X_LIBS="$X_LIBS -lX11 -lXext"
   787             fi
   788 
   789 
   790             AC_DEFINE(SDL_VIDEO_DRIVER_X11)
   791             SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
   792             BUILD_CFLAGS="$BUILD_CFLAGS $X_CFLAGS"
   793             BUILD_LIBS="$BUILD_LIBS $X_LIBS"
   794             have_video=yes
   795 
   796             AC_ARG_ENABLE(dga,
   797 AC_HELP_STRING([--enable-dga], [allow use of X11 DGA code [default=yes]]),
   798                           , enable_dga=yes)
   799             if test x$enable_dga = xyes; then
   800                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xxf86dga/*.c"
   801             fi
   802             AC_ARG_ENABLE(video-dga,
   803 AC_HELP_STRING([--enable-video-dga], [use DGA 2.0 video driver [default=yes]]),
   804                   , enable_video_dga=yes)
   805             if test x$enable_dga = xyes -a x$enable_video_dga = xyes; then
   806                 AC_DEFINE(SDL_VIDEO_DRIVER_DGA)
   807                 SOURCES="$SOURCES $srcdir/src/video/dga/*.c"
   808             fi
   809             AC_ARG_ENABLE(video-x11-dgamouse,
   810 AC_HELP_STRING([--enable-video-x11-dgamouse], [use X11 DGA for mouse events [default=yes]]),
   811                           , enable_video_x11_dgamouse=yes)
   812             if test x$enable_dga = xyes -a x$enable_video_x11_dgamouse = xyes; then
   813                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_DGAMOUSE)
   814             fi
   815             AC_ARG_ENABLE(video-x11-vm,
   816 AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [default=yes]]),
   817                           , enable_video_x11_vm=yes)
   818             if test x$enable_video_x11_vm = xyes; then
   819                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_VIDMODE)
   820                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xxf86vm/*.c"
   821             fi
   822             AC_ARG_ENABLE(video-x11-xv,
   823 AC_HELP_STRING([--enable-video-x11-xv], [use X11 XvImage extension for video [default=yes]]),
   824                           , enable_video_x11_xv=yes)
   825             if test x$enable_video_x11_xv = xyes; then
   826                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XV)
   827                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xv/*.c"
   828             fi
   829             AC_ARG_ENABLE(video-x11-xinerama,
   830 AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [default=yes]]),
   831                             , enable_video_x11_xinerama=yes)
   832             if test x$enable_video_x11_xinerama = xyes; then
   833                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA)
   834                 SOURCES="$SOURCES $srcdir/src/video/Xext/Xinerama/*.c"
   835             fi
   836             AC_ARG_ENABLE(video-x11-xme,
   837 AC_HELP_STRING([--enable-video-x11-xme], [enable Xi Graphics XME for fullscreen [default=yes]]),
   838                             , enable_video_x11_xme=yes)
   839             if test x$enable_video_x11_xme = xyes; then
   840                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XME)
   841                 SOURCES="$SOURCES $srcdir/src/video/Xext/XME/*.c"
   842             fi
   843         fi
   844     fi
   845 }
   846 
   847 dnl Check for QNX photon video driver
   848 CheckPHOTON()
   849 {
   850     AC_ARG_ENABLE(video-photon,
   851 AC_HELP_STRING([--enable-video-photon], [use QNX Photon video driver [default=yes]]),
   852                   , enable_video_photon=yes)
   853     if test x$enable_video = xyes -a x$enable_video_photon = xyes; then
   854         AC_MSG_CHECKING(for QNX Photon support)
   855         video_photon=no
   856         AC_TRY_COMPILE([
   857           #include <Ph.h>
   858           #include <Pt.h>
   859           #include <photon/Pg.h>
   860           #include <photon/PdDirect.h>
   861         ],[
   862          PgDisplaySettings_t *visual;
   863         ],[
   864         video_photon=yes
   865         ])
   866         AC_MSG_RESULT($video_photon)
   867         if test x$video_photon = xyes; then
   868             AC_DEFINE(SDL_VIDEO_DRIVER_PHOTON)
   869             SOURCES="$SOURCES $srcdir/src/video/photon/*.c"
   870             BUILD_LIBS="$BUILD_LIBS -lph"
   871             have_video=yes
   872 
   873             CheckOpenGLQNX
   874         fi
   875     fi
   876 }
   877 
   878 dnl Set up the BWindow video driver if enabled
   879 CheckBWINDOW()
   880 {
   881     if test x$enable_video = xyes; then
   882         AC_DEFINE(SDL_VIDEO_DRIVER_BWINDOW)
   883         SOURCES="$SOURCES $srcdir/src/video/bwindow/*.cc"
   884         have_video=yes
   885     fi
   886 }
   887 
   888 dnl Set up the Carbon/QuickDraw video driver for Mac OS X (but not Darwin)
   889 CheckCARBON()
   890 {
   891     AC_ARG_ENABLE(video-carbon,
   892 AC_HELP_STRING([--enable-video-carbon], [use Carbon/QuickDraw video driver [default=no]]),
   893                   , enable_video_carbon=no)
   894     if test x$enable_video = xyes -a x$enable_video_carbon = xyes; then
   895         AC_MSG_CHECKING(for Carbon framework)
   896         have_carbon=no
   897         AC_TRY_COMPILE([
   898           #include <Carbon/Carbon.h>
   899         ],[
   900         ],[
   901         have_carbon=yes
   902         ])
   903         AC_MSG_RESULT($have_carbon)
   904         if test x$have_carbon = xyes; then
   905             AC_DEFINE(SDL_VIDEO_DRIVER_TOOLBOX)
   906             SOURCES="$SOURCES $srcdir/src/video/maccommon/*.c"
   907             SOURCES="$SOURCES $srcdir/src/video/macrom/*.c"
   908             have_video=yes
   909         fi
   910     fi
   911 }
   912 
   913 dnl Set up the Cocoa/Quartz video driver for Mac OS X (but not Darwin)
   914 CheckCOCOA()
   915 {
   916     AC_ARG_ENABLE(video-cocoa,
   917 AC_HELP_STRING([--enable-video-cocoa], [use Cocoa/Quartz video driver [default=yes]]),
   918                   , enable_video_cocoa=yes)
   919     if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
   920         save_CFLAGS="$CFLAGS"
   921         dnl work around that we don't have Objective-C support in autoconf
   922         CFLAGS="$CFLAGS -x objective-c"
   923         AC_MSG_CHECKING(for Cocoa framework)
   924         have_cocoa=no
   925         AC_TRY_COMPILE([
   926           #import <Cocoa/Cocoa.h>
   927         ],[
   928         ],[
   929         have_cocoa=yes
   930         ])
   931         AC_MSG_RESULT($have_cocoa)
   932         CFLAGS="$save_CFLAGS"
   933         if test x$have_cocoa = xyes; then
   934             AC_DEFINE(SDL_VIDEO_DRIVER_QUARTZ)
   935             SOURCES="$SOURCES $srcdir/src/video/quartz/*.m"
   936             have_video=yes
   937         fi
   938     fi
   939 }
   940 
   941 dnl Find the framebuffer console includes
   942 CheckFBCON()
   943 {
   944     AC_ARG_ENABLE(video-fbcon,
   945 AC_HELP_STRING([--enable-video-fbcon], [use framebuffer console video driver [default=yes]]),
   946                   , enable_video_fbcon=yes)
   947     if test x$enable_video = xyes -a x$enable_video_fbcon = xyes; then
   948         AC_MSG_CHECKING(for framebuffer console support)
   949         video_fbcon=no
   950         AC_TRY_COMPILE([
   951          #include <linux/fb.h>
   952          #include <linux/kd.h>
   953          #include <linux/keyboard.h>
   954         ],[
   955         ],[
   956         video_fbcon=yes
   957         ])
   958         AC_MSG_RESULT($video_fbcon)
   959         if test x$video_fbcon = xyes; then
   960             AC_DEFINE(SDL_VIDEO_DRIVER_FBCON)
   961             SOURCES="$SOURCES $srcdir/src/video/fbcon/*.c"
   962             have_video=yes
   963         fi
   964     fi
   965 }
   966 
   967 dnl Find DirectFB
   968 CheckDirectFB()
   969 {
   970     AC_ARG_ENABLE(video-directfb,
   971 AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [default=no]]),
   972                   , enable_video_directfb=no)
   973     if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
   974         video_directfb=no
   975 
   976         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
   977         if test x$PKG_CONFIG = xno ; then
   978             AC_MSG_WARN([*** pkg-config is required to build the DirectFB video driver.])
   979         else
   980             AC_MSG_CHECKING(for DirectFB support)
   981 
   982             if ! $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then
   983                 AC_MSG_ERROR([*** pkg-config too old; version 0.7 or better required.])
   984             fi
   985 
   986             DIRECTFB_REQUIRED_VERSION=0.9.15
   987 
   988             if $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb ; then
   989                 DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
   990                 DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
   991                 video_directfb=yes
   992             fi
   993         fi
   994 
   995         AC_MSG_RESULT($video_directfb)
   996         if test x$video_directfb = xyes; then
   997             AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB)
   998             SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
   999             BUILD_CFLAGS="$BUILD_CFLAGS $DIRECTFB_CFLAGS"
  1000             BUILD_LIBS="$BUILD_LIBS $DIRECTFB_LIBS"
  1001             have_video=yes
  1002         fi
  1003     fi
  1004 }
  1005 
  1006 dnl See if we're running on PlayStation 2 hardware
  1007 CheckPS2GS()
  1008 {
  1009     AC_ARG_ENABLE(video-ps2gs,
  1010 AC_HELP_STRING([--enable-video-ps2gs], [use PlayStation 2 GS video driver [default=yes]]),
  1011                   , enable_video_ps2gs=yes)
  1012     if test x$enable_video = xyes -a x$enable_video_ps2gs = xyes; then
  1013         AC_MSG_CHECKING(for PlayStation 2 GS support)
  1014         video_ps2gs=no
  1015         AC_TRY_COMPILE([
  1016          #include <linux/ps2/dev.h>
  1017          #include <linux/ps2/gs.h>
  1018         ],[
  1019         ],[
  1020         video_ps2gs=yes
  1021         ])
  1022         AC_MSG_RESULT($video_ps2gs)
  1023         if test x$video_ps2gs = xyes; then
  1024             AC_DEFINE(SDL_VIDEO_DRIVER_PS2GS)
  1025             SOURCES="$SOURCES $srcdir/src/video/ps2gs/*.c"
  1026             have_video=yes
  1027         fi
  1028     fi
  1029 }
  1030 
  1031 dnl Find the GGI includes
  1032 CheckGGI()
  1033 {
  1034     AC_ARG_ENABLE(video-ggi,
  1035 AC_HELP_STRING([--enable-video-ggi], [use GGI video driver [default=no]]),
  1036                   , enable_video_ggi=no)
  1037     if test x$enable_video = xyes -a x$enable_video_ggi = xyes; then
  1038         AC_MSG_CHECKING(for GGI support)
  1039         video_ggi=no
  1040         AC_TRY_COMPILE([
  1041          #include <ggi/ggi.h>
  1042          #include <ggi/gii.h>
  1043         ],[
  1044         ],[
  1045         video_ggi=yes
  1046         ])
  1047         AC_MSG_RESULT($video_ggi)
  1048         if test x$video_ggi = xyes; then
  1049             AC_DEFINE(SDL_VIDEO_DRIVER_GGI)
  1050             SOURCES="$SOURCES $srcdir/src/video/ggi/*.c"
  1051             BUILD_LIBS="$BUILD_LIBS -lggi -lgii -lgg"
  1052             have_video=yes
  1053         fi
  1054     fi
  1055 }
  1056 
  1057 dnl Find the SVGAlib includes and libraries
  1058 CheckSVGA()
  1059 {
  1060     AC_ARG_ENABLE(video-svga,
  1061 AC_HELP_STRING([--enable-video-svga], [use SVGAlib video driver [default=no]]),
  1062                   , enable_video_svga=no)
  1063     if test x$enable_video = xyes -a x$enable_video_svga = xyes; then
  1064         AC_MSG_CHECKING(for SVGAlib (1.4.0+) support)
  1065         video_svga=no
  1066         AC_TRY_COMPILE([
  1067          #include <vga.h>
  1068          #include <vgamouse.h>
  1069          #include <vgakeyboard.h>
  1070         ],[
  1071          if ( SCANCODE_RIGHTWIN && SCANCODE_LEFTWIN ) {
  1072              exit(0);
  1073          }
  1074         ],[
  1075         video_svga=yes
  1076         ])
  1077         AC_MSG_RESULT($video_svga)
  1078         if test x$video_svga = xyes; then
  1079             AC_DEFINE(SDL_VIDEO_DRIVER_SVGALIB)
  1080             SOURCES="$SOURCES $srcdir/src/video/svga/*.c"
  1081             BUILD_LIBS="$BUILD_LIBS -lvga"
  1082             have_video=yes
  1083         fi
  1084     fi
  1085 }
  1086 
  1087 dnl Find the VGL includes and libraries
  1088 CheckVGL()
  1089 {
  1090     AC_ARG_ENABLE(video-vgl,
  1091 AC_HELP_STRING([--enable-video-vgl], [use VGL video driver [default=no]]),
  1092                   , enable_video_vgl=no)
  1093     if test x$enable_video = xyes -a x$enable_video_vgl = xyes; then
  1094         AC_MSG_CHECKING(for libVGL support)
  1095         video_vgl=no
  1096         AC_TRY_COMPILE([
  1097          #include <sys/fbio.h>
  1098          #include <sys/consio.h>
  1099          #include <sys/kbio.h>
  1100          #include <vgl.h>
  1101         ],[
  1102          VGLBitmap bitmap;
  1103          exit(bitmap.Bitmap);
  1104         ],[
  1105         video_vgl=yes
  1106         ])
  1107         AC_MSG_RESULT($video_vgl)
  1108         if test x$video_vgl = xyes; then
  1109             AC_DEFINE(SDL_VIDEO_DRIVER_VGL)
  1110             SOURCES="$SOURCES $srcdir/src/video/vgl/*.c"
  1111             BUILD_LIBS="$BUILD_LIBS -lvgl"
  1112             have_video=yes
  1113         fi
  1114     fi
  1115 }
  1116 
  1117 dnl Set up the wscons video driver if enabled
  1118 CheckWscons()
  1119 {
  1120     AC_ARG_ENABLE(video-wscons,
  1121 AC_HELP_STRING([--enable-video-wscons], [use wscons video driver [default=yes]]),
  1122                   , enable_video_wscons=yes)
  1123     if test x$enable_video = xyes -a x$enable_video_wscons = xyes; then
  1124         AC_MSG_CHECKING(for wscons support)
  1125         video_wscons=no
  1126         AC_TRY_COMPILE([
  1127        #include <sys/time.h>
  1128        #include <dev/wscons/wsconsio.h>
  1129         ],[
  1130         ],[
  1131         video_wscons=yes
  1132         ])
  1133         AC_MSG_RESULT($video_wscons)
  1134         if test x$video_wscons = xyes; then
  1135             AC_DEFINE(SDL_VIDEO_DRIVER_WSCONS)
  1136             SOURCES="$SOURCES $srcdir/src/video/wscons/*.c"
  1137             have_video=yes
  1138         fi
  1139     fi
  1140 }
  1141 
  1142 
  1143 dnl Find the AAlib includes
  1144 CheckAAlib()
  1145 {
  1146     AC_ARG_ENABLE(video-aalib,
  1147 AC_HELP_STRING([--enable-video-aalib], [use AAlib video driver [default=no]]),
  1148                   , enable_video_aalib=no)
  1149     if test x$enable_video = xyes -a x$enable_video_aalib = xyes; then
  1150         AC_MSG_CHECKING(for AAlib support)
  1151         video_aalib=no
  1152         AC_TRY_COMPILE([
  1153          #include <aalib.h>
  1154         ],[
  1155         ],[
  1156         video_aalib=yes
  1157         ])
  1158         AC_MSG_RESULT($video_aalib)
  1159         if test x$video_aalib = xyes; then
  1160             AC_DEFINE(SDL_VIDEO_DRIVER_AALIB)
  1161             SOURCES="$SOURCES $srcdir/src/video/aalib/*.c"
  1162             BUILD_LIBS="$BUILD_LIBS -laa"
  1163             have_video=yes
  1164         fi
  1165     fi
  1166 }
  1167 
  1168 dnl Set up the QTopia video driver if enabled
  1169 CheckQtopia()
  1170 {
  1171     AC_ARG_ENABLE(video-qtopia,
  1172 AC_HELP_STRING([--enable-video-qtopia], [use Qtopia video driver [default=no]]),
  1173                   , enable_video_qtopia=no)
  1174     if test x$enable_video = xyes -a x$enable_video_qtopia = xyes; then
  1175         AC_MSG_CHECKING(for Qtopia support)
  1176         video_qtopia=no
  1177         QTOPIA_FLAGS="-DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -I${QPEDIR}/include -I${QTDIR}/include/ -DNO_DEBUG -fno-rtti -fno-exceptions"
  1178         AC_LANG_CPLUSPLUS
  1179         OLD_CXX="$CXXFLAGS"
  1180         CXXFLAGS="$QTOPIA_FLAGS"
  1181         AC_TRY_COMPILE([
  1182          #include <qpe/qpeapplication.h>
  1183         ],[
  1184         ],[
  1185         video_qtopia=yes
  1186         ])
  1187         CXXFLAGS="$OLD_CXX"
  1188         AC_MSG_RESULT($video_qtopia)
  1189         if test x$video_qtopia = xyes; then
  1190             AC_DEFINE(SDL_VIDEO_DRIVER_QTOPIA)
  1191             SOURCES="$SOURCES $srcdir/src/video/qtopia/*.cc"
  1192             BUILD_CFLAGS="$BUILD_CFLAGS $QTOPIA_FLAGS"
  1193             SDL_CFLAGS="$SDL_CFLAGS -DQWS -Dmain=SDL_main"
  1194             SDL_LIBS="-lSDLmain $SDL_LIBS -L${QPEDIR}/lib -L${QTDIR}/lib/ -lqpe -lqte"
  1195             have_video=yes
  1196         fi
  1197         AC_LANG_C
  1198     fi
  1199 }
  1200 
  1201 dnl Set up the PicoGUI video driver if enabled
  1202 CheckPicoGUI()
  1203 {
  1204     AC_ARG_ENABLE(video-picogui,
  1205 AC_HELP_STRING([--enable-video-picogui], [use PicoGUI video driver [default=no]]),
  1206                   , enable_video_picogui=no)
  1207     if test x$enable_video = xyes -a x$enable_video_picogui = xyes; then
  1208         AC_MSG_CHECKING(for PicoGUI support)
  1209         video_picogui=no
  1210         AC_TRY_COMPILE([
  1211          #include <picogui.h>
  1212         ],[
  1213         ],[
  1214         video_picogui=yes
  1215         ])
  1216         AC_MSG_RESULT($video_picogui)
  1217         if test x$video_picogui = xyes; then
  1218             AC_DEFINE(SDL_VIDEO_DRIVER_PICOGUI)
  1219             SOURCES="$SOURCES $srcdir/src/video/picogui/*.c"
  1220             SDL_LIBS="$SDL_LIBS -lpgui"
  1221             have_video=yes
  1222         fi
  1223     fi
  1224 }
  1225 
  1226 dnl Set up the Atari Bios keyboard driver
  1227 CheckAtariBiosEvent()
  1228 {
  1229     SOURCES="$SOURCES $srcdir/src/video/ataricommon/*.c"
  1230 }
  1231 
  1232 dnl Set up the Atari Xbios driver
  1233 CheckAtariXbiosVideo()
  1234 {
  1235     AC_ARG_ENABLE(xbios,
  1236 AC_HELP_STRING([--enable-video-xbios], [use Atari Xbios video driver [default=yes]]),
  1237                   , enable_video_xbios=yes)
  1238     video_xbios=no
  1239     if test x$enable_video = xyes -a x$enable_video_xbios = xyes; then
  1240         video_xbios=yes
  1241         AC_DEFINE(SDL_VIDEO_DRIVER_XBIOS)
  1242         SOURCES="$SOURCES $srcdir/src/video/xbios/*.c"
  1243         have_video=yes
  1244     fi
  1245 }
  1246 
  1247 dnl Set up the Atari Gem driver
  1248 CheckAtariGemVideo()
  1249 {
  1250     AC_ARG_ENABLE(gem,
  1251 AC_HELP_STRING([--enable-video-gem], [use Atari Gem video driver [default=yes]]),
  1252                   , enable_video_gem=yes)
  1253     if test x$enable_video = xyes -a x$enable_video_gem = xyes; then
  1254         video_gem=no
  1255         AC_CHECK_HEADER(gem.h, have_gem_hdr=yes)
  1256         AC_CHECK_LIB(gem, appl_init, have_gem_lib=yes)
  1257         if test x$have_gem_hdr = xyes -a x$have_gem_lib = xyes; then
  1258 			video_gem=yes
  1259             AC_DEFINE(SDL_VIDEO_DRIVER_GEM)
  1260             SOURCES="$SOURCES $srcdir/src/video/gem/*.c"
  1261             BUILD_LIBS="$BUILD_LIBS -lgem"
  1262             have_video=yes
  1263         fi
  1264     fi
  1265 }
  1266 
  1267 dnl rcg04172001 Set up the Null video driver.
  1268 CheckDummyVideo()
  1269 {
  1270     AC_ARG_ENABLE(video-dummy,
  1271 AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [default=yes]]),
  1272                   , enable_video_dummy=yes)
  1273     if test x$enable_video_dummy = xyes; then
  1274         AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY)
  1275         SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
  1276         have_video=yes
  1277     fi
  1278 }
  1279 
  1280 dnl Check to see if OpenGL support is desired
  1281 AC_ARG_ENABLE(video-opengl,
  1282 AC_HELP_STRING([--enable-video-opengl], [include OpenGL context creation [default=yes]]),
  1283               , enable_video_opengl=yes)
  1284 
  1285 dnl Find OpenGL
  1286 CheckOpenGLX11()
  1287 {
  1288     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1289         AC_MSG_CHECKING(for OpenGL (GLX) support)
  1290         video_opengl=no
  1291         AC_TRY_COMPILE([
  1292          #include <GL/gl.h>
  1293          #include <GL/glx.h>
  1294         ],[
  1295         ],[
  1296         video_opengl=yes
  1297         ])
  1298         AC_MSG_RESULT($video_opengl)
  1299         if test x$video_opengl = xyes; then
  1300             AC_DEFINE(SDL_VIDEO_OPENGL)
  1301             AC_DEFINE(SDL_VIDEO_OPENGL_GLX)
  1302         fi
  1303     fi
  1304 }
  1305 
  1306 dnl Find QNX RtP OpenGL
  1307 CheckOpenGLQNX()
  1308 {
  1309     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1310         AC_MSG_CHECKING(for OpenGL (Photon) support)
  1311         video_opengl=no
  1312         AC_TRY_COMPILE([
  1313          #include <GL/gl.h>
  1314         ],[
  1315         ],[
  1316         video_opengl=yes
  1317         ])
  1318         AC_MSG_RESULT($video_opengl)
  1319         if test x$video_opengl = xyes; then
  1320             AC_DEFINE(SDL_VIDEO_OPENGL)
  1321             BUILD_LIBS="$BUILD_LIBS -lGL"
  1322         fi
  1323     fi
  1324 }
  1325 
  1326 dnl Check for Win32 OpenGL
  1327 CheckWIN32GL()
  1328 {
  1329     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1330         AC_DEFINE(SDL_VIDEO_OPENGL)
  1331         AC_DEFINE(SDL_VIDEO_OPENGL_WGL)
  1332     fi
  1333 }
  1334 
  1335 dnl Check for BeOS OpenGL
  1336 CheckBeGL()
  1337 {
  1338     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1339         AC_DEFINE(SDL_VIDEO_OPENGL)
  1340         BUILD_LIBS="$BUILD_LIBS -lGL"
  1341     fi
  1342 }
  1343 
  1344 dnl Check for MacOS OpenGL
  1345 CheckMacGL()
  1346 {
  1347     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1348         AC_DEFINE(SDL_VIDEO_OPENGL)
  1349         case "$target" in
  1350             *-*-darwin*)
  1351                 BUILD_LIBS="$BUILD_LIBS -framework OpenGL"
  1352                 # The following is probably not available in Darwin:
  1353                 BUILD_LIBS="$BUILD_LIBS -framework AGL"
  1354         esac
  1355     fi
  1356 }
  1357 
  1358 dnl Check for Mesa offscreen rendering
  1359 CheckAtariOSMesa()
  1360 {
  1361     if test "x$enable_video" = "xyes" -a "x$enable_video_opengl" = "xyes"; then
  1362         AC_CHECK_HEADER(GL/osmesa.h, have_osmesa_hdr=yes)
  1363         AC_CHECK_LIB(OSMesa, OSMesaCreateContext, have_osmesa_lib=yes, have_osmesa_lib=no, -lm)
  1364 
  1365         # Static linking to -lOSMesa
  1366         AC_PATH_PROG(OSMESA_CONFIG, osmesa-config, no)
  1367         if test "x$OSMESA_CONFIG" = "xno" -o "x$enable_atari_ldg" = "xno"; then
  1368             # -lOSMesa is really the static library
  1369             if test "x$have_osmesa_hdr" = "xyes" -a "x$have_osmesa_lib" = "xyes"; then
  1370                 OSMESA_LIBS="-lOSMesa"
  1371             fi
  1372         else
  1373             # -lOSMesa is a loader for OSMesa.ldg
  1374             OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags`
  1375             OSMESA_LIBS=`$OSMESA_CONFIG --libs`
  1376         fi
  1377         AC_DEFINE(SDL_VIDEO_OPENGL)
  1378         AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA)
  1379         BUILD_CFLAGS="$BUILD_CFLAGS $OSMESA_CFLAGS"
  1380         BUILD_LIBS="$BUILD_LIBS $OSMESA_LIBS"
  1381 
  1382         AC_ARG_ENABLE(osmesa-shared,
  1383 AC_HELP_STRING([--enable-osmesa-shared], [dynamically load OSMesa OpenGL support [default=yes]]),
  1384                               , enable_osmesa_shared=yes)
  1385         if test "x$enable_osmesa_shared" = "xyes" -a "x$enable_atari_ldg" = "xyes"; then
  1386             # Dynamic linking
  1387             if test "x$have_osmesa_hdr" = "xyes"; then
  1388                 AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA_DYNAMIC)
  1389             fi
  1390         fi
  1391     fi
  1392 }
  1393 
  1394 dnl See if we can use the new unified event interface in Linux 2.4
  1395 CheckInputEvents()
  1396 {
  1397     dnl Check for Linux 2.4 unified input event interface support
  1398     AC_ARG_ENABLE(input-events,
  1399 AC_HELP_STRING([--enable-input-events], [use Linux 2.4 unified input interface [default=yes]]),
  1400                   , enable_input_events=yes)
  1401     if test x$enable_input_events = xyes; then
  1402         AC_MSG_CHECKING(for Linux 2.4 unified input interface)
  1403         use_input_events=no
  1404         AC_TRY_COMPILE([
  1405           #include <linux/input.h>
  1406         ],[
  1407           #ifndef EVIOCGNAME
  1408           #error EVIOCGNAME() ioctl not available
  1409           #endif
  1410         ],[
  1411         use_input_events=yes
  1412         ])
  1413         AC_MSG_RESULT($use_input_events)
  1414         if test x$use_input_events = xyes; then
  1415             AC_DEFINE(SDL_INPUT_LINUXEV)
  1416         fi
  1417     fi
  1418 }
  1419 
  1420 dnl See if we can use the Touchscreen input library
  1421 CheckTslib()
  1422 {
  1423     AC_ARG_ENABLE(input-tslib,
  1424 AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [default=yes]]),
  1425                   , enable_input_tslib=yes)
  1426     if test x$enable_input_tslib = xyes; then
  1427         AC_MSG_CHECKING(for Touchscreen library support)
  1428         enable_input_tslib=no
  1429         AC_TRY_COMPILE([
  1430           #include "tslib.h"
  1431         ],[
  1432         ],[
  1433         enable_input_tslib=yes
  1434         ])
  1435         AC_MSG_RESULT($enable_input_tslib)
  1436         if test x$enable_input_tslib = xyes; then
  1437             AC_DEFINE(SDL_INPUT_TSLIB)
  1438             BUILD_LIBS="$BUILD_LIBS -lts"
  1439         fi
  1440     fi
  1441 }
  1442 
  1443 dnl See if we can use GNU pth library for threads
  1444 CheckPTH()
  1445 {
  1446     dnl Check for pth support
  1447     AC_ARG_ENABLE(pth,
  1448 AC_HELP_STRING([--enable-pth], [use GNU pth library for multi-threading [default=yes]]),
  1449                   , enable_pth=yes)
  1450     if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  1451         AC_PATH_PROG(PTH_CONFIG, pth-config, no)
  1452         if test "$PTH_CONFIG" = "no"; then
  1453             use_pth=no
  1454         else
  1455             use_pth=yes
  1456         fi
  1457         AC_MSG_CHECKING(pth)
  1458         AC_MSG_RESULT($use_pth)
  1459         if test "x$use_pth" = xyes; then
  1460             AC_DEFINE(SDL_THREAD_PTH)
  1461             SOURCES="$SOURCES $srcdir/src/thread/pth/*.c"
  1462             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  1463             SDL_CFLAGS="$SDL_CFLAGS `$PTH_CONFIG --cflags`"
  1464             SDL_LIBS="$SDL_LIBS `$PTH_CONFIG --libs --all`"
  1465             have_threads=yes
  1466         fi
  1467     fi
  1468 }
  1469 
  1470 dnl See what type of thread model to use on Linux and Solaris
  1471 CheckPTHREAD()
  1472 {
  1473     dnl Check for pthread support
  1474     AC_ARG_ENABLE(pthreads,
  1475 AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [default=yes]]),
  1476                   , enable_pthreads=yes)
  1477     dnl This is used on Linux for glibc binary compatibility (Doh!)
  1478     AC_ARG_ENABLE(pthread-sem,
  1479 AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [default=yes]]),
  1480                   , enable_pthread_sem=yes)
  1481     case "$target" in
  1482         *-*-linux*)
  1483             pthread_cflags="-D_REENTRANT"
  1484             pthread_lib="-lpthread"
  1485             ;;
  1486         *-*-bsdi*)
  1487             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1488             pthread_lib=""
  1489             ;;
  1490         *-*-darwin*)
  1491             pthread_cflags="-D_THREAD_SAFE"
  1492 # causes Carbon.p complaints?
  1493 #            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1494             ;;
  1495         *-*-freebsd*)
  1496             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1497             pthread_lib="-pthread"
  1498             ;;
  1499         *-*-netbsd*)
  1500             pthread_cflags="-I/usr/include -D_REENTRANT -D_THREAD_SAFE -D_POSIX_THREAD_SYSCALL_SOFT=1"
  1501             pthread_lib="-L/usr/lib -lpthread"
  1502             ;;
  1503         *-*-openbsd*)
  1504             pthread_cflags="-D_REENTRANT"
  1505             pthread_lib="-pthread"
  1506             ;;
  1507         *-*-solaris*)
  1508             pthread_cflags="-D_REENTRANT"
  1509             pthread_lib="-lpthread -lposix4"
  1510             ;;
  1511         *-*-sysv5*)
  1512             pthread_cflags="-D_REENTRANT -Kthread"
  1513             pthread_lib=""
  1514             ;;
  1515         *-*-irix*)
  1516             pthread_cflags="-D_SGI_MP_SOURCE"
  1517             pthread_lib="-lpthread"
  1518             ;;
  1519         *-*-aix*)
  1520             pthread_cflags="-D_REENTRANT -mthreads"
  1521             pthread_lib="-lpthread"
  1522             ;;
  1523         *-*-hpux11*)
  1524             pthread_cflags="-D_REENTRANT"
  1525             pthread_lib="-L/usr/lib -lpthread"
  1526             ;;
  1527         *-*-qnx*)
  1528             pthread_cflags=""
  1529             pthread_lib=""
  1530             ;;
  1531         *-*-osf*)
  1532             pthread_cflags="-D_REENTRANT"
  1533             if test x$ac_cv_prog_gcc = xyes; then
  1534                 pthread_lib="-lpthread -lrt"
  1535             else
  1536                 pthread_lib="-lpthread -lexc -lrt"
  1537             fi
  1538             ;;
  1539         *)
  1540             pthread_cflags="-D_REENTRANT"
  1541             pthread_lib="-lpthread"
  1542             ;;
  1543     esac
  1544     if test x$enable_threads = xyes -a x$enable_pthreads = xyes -a x$enable_ipod != xyes; then
  1545         # Save the original compiler flags and libraries
  1546         ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1547         # Add the pthread compiler flags and libraries
  1548         CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1549         # Check to see if we have pthread support on this system
  1550         AC_MSG_CHECKING(for pthreads)
  1551         use_pthreads=no
  1552         AC_TRY_LINK([
  1553          #include <pthread.h>
  1554         ],[
  1555          pthread_attr_t type;
  1556          pthread_attr_init(&type);
  1557         ],[
  1558         use_pthreads=yes
  1559         ])
  1560         AC_MSG_RESULT($use_pthreads)
  1561         # Restore the compiler flags and libraries
  1562         CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1563 
  1564         # Do futher testing if we have pthread support...
  1565         if test x$use_pthreads = xyes; then
  1566             AC_DEFINE(SDL_THREAD_PTHREAD)
  1567             BUILD_CFLAGS="$BUILD_CFLAGS $pthread_cflags"
  1568             BUILD_LIBS="$BUILD_LIBS $pthread_lib"
  1569             SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
  1570             SDL_LIBS="$SDL_LIBS $pthread_lib"
  1571 
  1572             # Check to see if recursive mutexes are available
  1573             AC_MSG_CHECKING(for recursive mutexes)
  1574             has_recursive_mutexes=no
  1575             if test x$has_recursive_mutexes = xno; then
  1576                 AC_TRY_COMPILE([
  1577                   #include <pthread.h>
  1578                 ],[
  1579                   pthread_mutexattr_t attr;
  1580                   pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
  1581                 ],[
  1582                 has_recursive_mutexes=yes
  1583                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX)
  1584                 ])
  1585             fi
  1586             if test x$has_recursive_mutexes = xno; then
  1587                 AC_TRY_COMPILE([
  1588                   #include <pthread.h>
  1589                 ],[
  1590                   pthread_mutexattr_t attr;
  1591                   pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
  1592                 ],[
  1593                 has_recursive_mutexes=yes
  1594                 AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP)
  1595                 ])
  1596             fi
  1597             AC_MSG_RESULT($has_recursive_mutexes)
  1598 
  1599             # Check to see if pthread semaphore support is missing
  1600             if test x$enable_pthread_sem = xyes; then
  1601                 AC_MSG_CHECKING(for pthread semaphores)
  1602                 have_pthread_sem=no
  1603                 AC_TRY_COMPILE([
  1604                   #include <pthread.h>
  1605                   #include <semaphore.h>
  1606                 ],[
  1607                 ],[
  1608                 have_pthread_sem=yes
  1609                 ])
  1610                 AC_MSG_RESULT($have_pthread_sem)
  1611             fi
  1612 
  1613             # Basic thread creation functions
  1614             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
  1615 
  1616             # Semaphores
  1617             # We can fake these with mutexes and condition variables if necessary
  1618             if test x$have_pthread_sem = xyes; then
  1619                 SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
  1620             else
  1621                 SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  1622             fi
  1623 
  1624             # Mutexes
  1625             # We can fake these with semaphores if necessary
  1626             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
  1627 
  1628             # Condition variables
  1629             # We can fake these with semaphores and mutexes if necessary
  1630             SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
  1631 
  1632             have_threads=yes
  1633         else
  1634             CheckPTH
  1635         fi
  1636     fi
  1637 }
  1638 
  1639 dnl Determine whether the compiler can produce Win32 executables
  1640 CheckWIN32()
  1641 {
  1642     AC_MSG_CHECKING(Win32 compiler)
  1643     have_win32_gcc=no
  1644     AC_TRY_COMPILE([
  1645      #include <windows.h>
  1646     ],[
  1647     ],[
  1648     have_win32_gcc=yes
  1649     ])
  1650     AC_MSG_RESULT($have_win32_gcc)
  1651     if test x$have_win32_gcc != xyes; then
  1652        AC_MSG_ERROR([
  1653 *** Your compiler ($CC) does not produce Win32 executables!
  1654        ])
  1655     fi
  1656 
  1657     dnl See if the user wants to redirect standard output to files
  1658     AC_ARG_ENABLE(stdio-redirect,
  1659 AC_HELP_STRING([--enable-stdio-redirect], [Redirect STDIO to files on Win32 [default=yes]]),
  1660                   , enable_stdio_redirect=yes)
  1661     if test x$enable_stdio_redirect != xyes; then
  1662         BUILD_CFLAGS="$BUILD_CFLAGS -DNO_STDIO_REDIRECT"
  1663     fi
  1664 
  1665     if test x$enable_video = xyes; then
  1666         AC_DEFINE(SDL_VIDEO_DRIVER_WINDIB)
  1667         SOURCES="$SOURCES $srcdir/src/video/wincommon/*.c"
  1668         SOURCES="$SOURCES $srcdir/src/video/windib/*.c"
  1669         have_video=yes
  1670     fi
  1671 }
  1672 
  1673 dnl Find the DirectX includes and libraries
  1674 CheckDIRECTX()
  1675 {
  1676     AC_ARG_ENABLE(directx,
  1677 AC_HELP_STRING([--enable-directx], [use DirectX for Win32 audio/video [default=yes]]),
  1678                   , enable_directx=yes)
  1679     if test x$enable_directx = xyes; then
  1680         have_directx=no
  1681         AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
  1682         AC_CHECK_HEADER(dsound.h, have_dsound=yes)
  1683         AC_CHECK_HEADER(dinput.h, use_dinput=yes)
  1684         if test x$have_ddraw = xyes -a x$have_dsound = xyes -a x$use_dinput = xyes; then
  1685             have_directx=yes
  1686         fi
  1687         if test x$enable_video = xyes -a x$have_directx = xyes; then
  1688             AC_DEFINE(SDL_VIDEO_DRIVER_DDRAW)
  1689             SOURCES="$SOURCES $srcdir/src/video/windx5/*.c"
  1690             have_video=yes
  1691         fi
  1692     fi
  1693 }
  1694 
  1695 dnl Check for the dlfcn.h interface for dynamically loading objects
  1696 CheckDLOPEN()
  1697 {
  1698     AC_ARG_ENABLE(sdl-dlopen,
  1699 AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [default=yes]]),
  1700                   , enable_sdl_dlopen=yes)
  1701     if test x$enable_sdl_dlopen = xyes; then
  1702         AC_MSG_CHECKING(for dlopen)
  1703         have_dlopen=no
  1704         AC_TRY_COMPILE([
  1705          #include <dlfcn.h>
  1706         ],[
  1707         ],[
  1708         have_dlopen=yes
  1709         ])
  1710         AC_MSG_RESULT($have_dlopen)
  1711 
  1712         if test x$have_dlopen = xyes; then
  1713             AC_CHECK_LIB(c, dlopen, BUILD_LIBS="$BUILD_LIBS",
  1714                AC_CHECK_LIB(dl, dlopen, BUILD_LIBS="$BUILD_LIBS -ldl",
  1715                   AC_CHECK_LIB(ltdl, dlopen, BUILD_LIBS="$BUILD_LIBS -lltdl")))
  1716             AC_CHECK_LIB(dl, dlvsym, have_dlvsym=yes)
  1717             if test x$have_dlvsym = xyes; then
  1718                 AC_DEFINE(HAVE_DLVSYM)
  1719             fi
  1720             AC_DEFINE(SDL_LOADSO_DLOPEN)
  1721             SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
  1722             have_loadso=yes
  1723         fi
  1724     fi
  1725 }
  1726 
  1727 dnl Set up the Atari LDG (shared object loader)
  1728 CheckAtariLdg()
  1729 {
  1730     AC_ARG_ENABLE(atari-ldg,
  1731 AC_HELP_STRING([--enable-atari-ldg], [use Atari LDG for shared object loading [default=yes]]),
  1732                   , enable_atari_ldg=yes)
  1733     if test x$video_gem = xyes -a x$enable_atari_ldg = xyes; then
  1734         AC_CHECK_HEADER(ldg.h, have_ldg_hdr=yes)
  1735         AC_CHECK_LIB(ldg, ldg_open, have_ldg_lib=yes, have_ldg_lib=no, -lgem)
  1736         if test x$have_ldg_hdr = xyes -a x$have_ldg_lib = xyes; then
  1737             AC_DEFINE(SDL_LOADSO_LDG)
  1738             SOURCES="$SOURCES $srcdir/src/loadso/mint/*.c"
  1739             BUILD_LIBS="$BUILD_LIBS -lldg -lgem"
  1740             have_loadso=yes
  1741         fi
  1742     fi
  1743 }
  1744 
  1745 dnl Check for the usbhid(3) library on *BSD
  1746 CheckUSBHID()
  1747 {
  1748     if test x$enable_joystick = xyes; then
  1749         AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
  1750         AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
  1751         AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
  1752         AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
  1753             
  1754         AC_CHECK_LIB(usbhid, hid_init, [USB_LIBS="$USB_LIBS -lusbhid"])
  1755         AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
  1756 
  1757         save_CFLAGS="$CFLAGS"
  1758         CFLAGS="$CFLAGS $USB_CFLAGS"
  1759 
  1760         AC_MSG_CHECKING(for usbhid)
  1761         have_usbhid=no
  1762         AC_TRY_COMPILE([
  1763           #include <sys/types.h>
  1764           #if defined(HAVE_USB_H)
  1765           #include <usb.h>
  1766           #endif
  1767           #include <dev/usb/usb.h>
  1768           #include <dev/usb/usbhid.h>
  1769           #if defined(HAVE_USBHID_H)
  1770           #include <usbhid.h>
  1771           #elif defined(HAVE_LIBUSB_H)
  1772           #include <libusb.h>
  1773           #elif defined(HAVE_LIBUSBHID_H)
  1774           #include <libusbhid.h>
  1775           #endif
  1776         ],[
  1777           struct report_desc *repdesc;
  1778           struct usb_ctl_report *repbuf;
  1779           hid_kind_t hidkind;
  1780         ],[
  1781         have_usbhid=yes
  1782         ])
  1783         AC_MSG_RESULT($have_usbhid)
  1784 
  1785         if test x$have_usbhid = xyes; then
  1786             AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
  1787             have_usbhid_ucr_data=no
  1788             AC_TRY_COMPILE([
  1789               #include <sys/types.h>
  1790               #if defined(HAVE_USB_H)
  1791               #include <usb.h>
  1792               #endif
  1793               #include <dev/usb/usb.h>
  1794               #include <dev/usb/usbhid.h>
  1795               #if defined(HAVE_USBHID_H)
  1796               #include <usbhid.h>
  1797               #elif defined(HAVE_LIBUSB_H)
  1798               #include <libusb.h>
  1799               #elif defined(HAVE_LIBUSBHID_H)
  1800               #include <libusbhid.h>
  1801               #endif
  1802             ],[
  1803               struct usb_ctl_report buf;
  1804               if (buf.ucr_data) { }
  1805             ],[
  1806             have_usbhid_ucr_data=yes
  1807             ])
  1808             if test x$have_usbhid_ucr_data = xyes; then
  1809                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
  1810             fi
  1811             AC_MSG_RESULT($have_usbhid_ucr_data)
  1812             
  1813             AC_MSG_CHECKING(for new usbhid API)
  1814             have_usbhid_new=no
  1815             AC_TRY_COMPILE([
  1816               #include <sys/types.h>
  1817               #if defined(HAVE_USB_H)
  1818               #include <usb.h>
  1819               #endif
  1820               #include <dev/usb/usb.h>
  1821               #include <dev/usb/usbhid.h>
  1822               #if defined(HAVE_USBHID_H)
  1823               #include <usbhid.h>
  1824               #elif defined(HAVE_LIBUSB_H)
  1825               #include <libusb.h>
  1826               #elif defined(HAVE_LIBUSBHID_H)
  1827               #include <libusbhid.h>
  1828               #endif
  1829             ],[
  1830               report_desc_t d;
  1831               hid_start_parse(d, 1, 1);
  1832             ],[
  1833             have_usbhid_new=yes
  1834             ])
  1835             if test x$have_usbhid_new = xyes; then
  1836                 USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
  1837             fi
  1838             AC_MSG_RESULT($have_usbhid_new)
  1839 
  1840             AC_DEFINE(SDL_JOYSTICK_USBHID)
  1841             SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
  1842             BUILD_CFLAGS="$BUILD_CFLAGS $USB_CFLAGS"
  1843             BUILD_LIBS="$BUILD_CFLAGS $USB_LIBS"
  1844             have_joystick=yes
  1845         fi
  1846         CFLAGS="$save_CFLAGS"
  1847     fi
  1848 }
  1849 
  1850 dnl Check for clock_gettime()
  1851 CheckClockGettime()
  1852 {
  1853     AC_ARG_ENABLE(clock_gettime,
  1854 AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [default=no]]),
  1855                   , enable_clock_gettime=no)
  1856     if test x$enable_clock_gettime = xyes; then
  1857         AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
  1858         if test x$have_clock_gettime = xyes; then
  1859             AC_DEFINE(HAVE_CLOCK_GETTIME)
  1860             BUILD_LIBS="$BUILD_LIBS -lrt"
  1861         fi
  1862     fi
  1863 }
  1864 
  1865 dnl Check for a valid linux/version.h
  1866 CheckLinuxVersion()
  1867 {
  1868     AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
  1869     if test x$have_linux_version_h = xyes; then
  1870         BUILD_CFLAGS="$BUILD_CFLAGS -DHAVE_LINUX_VERSION_H"
  1871     fi
  1872 }
  1873 
  1874 dnl Check if we want to use RPATH
  1875 CheckRPATH()
  1876 {
  1877     AC_ARG_ENABLE(rpath,
  1878 AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [default=yes]]),
  1879                   , enable_rpath=yes)
  1880 }
  1881 
  1882 dnl Set up the configuration based on the target platform!
  1883 case "$target" in
  1884     arm-*-elf*) # FIXME: Can we get more specific for iPodLinux?
  1885         ARCH=linux
  1886         CheckDummyVideo
  1887         CheckIPod
  1888         # Set up files for the timer library
  1889         if test x$enable_timers = xyes; then
  1890             AC_DEFINE(SDL_TIMER_UNIX)
  1891             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  1892             have_timers=yes
  1893         fi
  1894         ;;
  1895     *-*-linux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-irix*|*-*-aix*|*-*-osf*)
  1896         case "$target" in
  1897             *-*-linux*)         ARCH=linux ;;
  1898             *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
  1899             *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
  1900             *-*-kopenbsd*-gnu)  ARCH=kopenbsd-gnu ;;
  1901             *-*-gnu*)           ARCH=gnu ;; # must be last of the gnu variants
  1902             *-*-bsdi*)          ARCH=bsdi ;;
  1903             *-*-freebsd*)       ARCH=freebsd ;;
  1904             *-*-netbsd*)        ARCH=netbsd ;;
  1905             *-*-openbsd*)       ARCH=openbsd ;;
  1906             *-*-sysv5*)         ARCH=sysv5 ;;
  1907             *-*-solaris*)       ARCH=solaris ;;
  1908             *-*-hpux*)          ARCH=hpux ;;
  1909             *-*-irix*)          ARCH=irix ;;
  1910             *-*-aix*)           ARCH=aix ;;
  1911             *-*-osf*)           ARCH=osf ;;
  1912         esac
  1913         CheckDummyVideo
  1914         CheckDiskAudio
  1915         CheckDLOPEN
  1916         CheckNASM
  1917         CheckAltivec
  1918         CheckOSS
  1919         CheckDMEDIA
  1920         CheckALSA
  1921         CheckARTSC
  1922         CheckESD
  1923         CheckNAS
  1924         CheckX11
  1925         CheckNANOX
  1926         CheckFBCON
  1927         CheckDirectFB
  1928         CheckPS2GS
  1929         CheckGGI
  1930         CheckSVGA
  1931         CheckVGL
  1932         CheckWscons
  1933         CheckAAlib
  1934         CheckQtopia
  1935         CheckPicoGUI
  1936         CheckOpenGLX11
  1937         CheckInputEvents
  1938         CheckTslib
  1939         CheckUSBHID
  1940         CheckPTHREAD
  1941         CheckClockGettime
  1942         CheckLinuxVersion
  1943         CheckRPATH
  1944         # Set up files for the audio library
  1945         if test x$enable_audio = xyes; then
  1946           case $ARCH in
  1947             netbsd|sysv5|solaris|hpux)
  1948                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
  1949                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  1950                 have_audio=yes
  1951             ;;
  1952             openbsd)
  1953                 AC_DEFINE(SDL_AUDIO_DRIVER_OPENBSD)
  1954                 SOURCES="$SOURCES $srcdir/src/audio/openbsd/*.c"
  1955                 have_audio=yes
  1956             ;;
  1957             aix)
  1958                 AC_DEFINE(SDL_AUDIO_DRIVER_PAUD)
  1959                 SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
  1960                 have_audio=yes
  1961             ;;
  1962             osf)
  1963                 AC_DEFINE(SDL_AUDIO_DRIVER_MMEAUDIO)
  1964                 SOURCES="$SOURCES $srcdir/src/audio/mme/*.c"
  1965                 BUILD_LIBS="$BUILD_LIBS -lmme"
  1966                 have_audio=yes
  1967             ;;
  1968           esac
  1969         fi
  1970         # Set up files for the joystick library
  1971         if test x$enable_joystick = xyes; then
  1972           case $ARCH in
  1973             linux)
  1974                 AC_DEFINE(SDL_JOYSTICK_LINUX)
  1975                 SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
  1976                 have_joystick=yes
  1977             ;;
  1978           esac
  1979         fi
  1980         # Set up files for the cdrom library
  1981         if test x$enable_cdrom = xyes; then
  1982           case $ARCH in
  1983             linux|solaris)
  1984                 AC_DEFINE(SDL_CDROM_LINUX)
  1985                 SOURCES="$SOURCES $srcdir/src/cdrom/linux/*.c"
  1986                 have_cdrom=yes
  1987             ;;
  1988             *freebsd*)
  1989                 AC_DEFINE(SDL_CDROM_FREEBSD)
  1990                 SOURCES="$SOURCES $srcdir/src/cdrom/freebsd/*.c"
  1991                 have_cdrom=yes
  1992             ;;
  1993             *netbsd*|*openbsd*)
  1994                 AC_DEFINE(SDL_CDROM_OPENBSD)
  1995                 SOURCES="$SOURCES $srcdir/src/cdrom/openbsd/*.c"
  1996                 have_cdrom=yes
  1997             ;;
  1998             bsdi)
  1999                 AC_DEFINE(SDL_CDROM_BSDI)
  2000                 SOURCES="$SOURCES $srcdir/src/cdrom/bsdi/*.c"
  2001                 have_cdrom=yes
  2002             ;;
  2003             aix)
  2004                 AC_DEFINE(SDL_CDROM_AIX)
  2005                 SOURCES="$SOURCES $srcdir/src/cdrom/aix/*.c"
  2006                 have_cdrom=yes
  2007             ;;
  2008             osf)
  2009                 AC_DEFINE(SDL_CDROM_OSF)
  2010                 SOURCES="$SOURCES $srcdir/src/cdrom/osf/*.c"
  2011                 have_cdrom=yes
  2012             ;;
  2013           esac
  2014         fi
  2015         # Set up files for the thread library
  2016         if test x$enable_threads = xyes -a x$use_pthreads != xyes -a x$use_pth != xyes -a x$ARCH = xirix; then
  2017             AC_DEFINE(SDL_THREAD_SPROC)
  2018             SOURCES="$SOURCES $srcdir/src/thread/irix/*.c"
  2019             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2020             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2021             have_threads=yes
  2022         fi
  2023         # Set up files for the timer library
  2024         if test x$enable_timers = xyes; then
  2025             AC_DEFINE(SDL_TIMER_UNIX)
  2026             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2027             have_timers=yes
  2028         fi
  2029         # Do any final platform setup
  2030         case $ARCH in
  2031             netbsd)
  2032                 # NetBSD does not define "unix"
  2033                 BUILD_CFLAGS="$BUILD_CFLAGS -Dunix"
  2034             ;;
  2035             openbsd)
  2036                 # OpenBSD does not define "unix"
  2037                 BUILD_CFLAGS="$BUILD_CFLAGS -Dunix"
  2038             ;;
  2039         esac
  2040         ;;
  2041     *-*-qnx*)
  2042         ARCH=qnx
  2043         CheckDummyVideo
  2044         CheckDiskAudio
  2045         # CheckNASM
  2046         CheckDLOPEN
  2047         CheckNAS
  2048         CheckPHOTON
  2049         CheckX11
  2050         CheckOpenGLX11
  2051         CheckPTHREAD
  2052         # Set up files for the audio library
  2053         if test x$enable_audio = xyes; then
  2054             AC_DEFINE(SDL_AUDIO_DRIVER_QNXNTO)
  2055             SOURCES="$SOURCES $srcdir/src/audio/nto/*.c"
  2056             BUILD_LIBS="$BUILD_LIBS -lasound"
  2057             have_audio=yes
  2058         fi
  2059         # Set up files for the cdrom library
  2060         if test x$enable_cdrom = xyes; then
  2061             AC_DEFINE(SDL_CDROM_QNX)
  2062             SOURCES="$SOURCES $srcdir/src/cdrom/qnx/*.c"
  2063             have_cdrom=yes
  2064         fi
  2065         # Set up files for the timer library
  2066         if test x$enable_timers = xyes; then
  2067             AC_DEFINE(SDL_TIMER_UNIX)
  2068             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2069             have_timers=yes
  2070         fi
  2071         ;;
  2072     *-*-cygwin* | *-*-mingw32*)
  2073         ARCH=win32
  2074         if test "$build" != "$target"; then # cross-compiling
  2075             # Default cross-compile location
  2076             ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc
  2077         else
  2078             # Look for the location of the tools and install there
  2079             if test "$BUILD_PREFIX" != ""; then
  2080                 ac_default_prefix=$BUILD_PREFIX
  2081             fi
  2082         fi
  2083         CheckDummyVideo
  2084         CheckDiskAudio
  2085         CheckWIN32
  2086         CheckWIN32GL
  2087         CheckDIRECTX
  2088         CheckNASM
  2089         # Set up files for the audio library
  2090         if test x$enable_audio = xyes; then
  2091             AC_DEFINE(SDL_AUDIO_DRIVER_WAVEOUT)
  2092             SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
  2093             if test x$have_directx = xyes; then
  2094                 AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
  2095                 SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
  2096             fi
  2097             have_audio=yes
  2098         fi
  2099         # Set up files for the joystick library
  2100         if test x$enable_joystick = xyes; then
  2101             AC_DEFINE(SDL_JOYSTICK_WINMM)
  2102             SOURCES="$SOURCES $srcdir/src/joystick/win32/*.c"
  2103             have_joystick=yes
  2104         fi
  2105         # Set up files for the cdrom library
  2106         if test x$enable_cdrom = xyes; then
  2107             AC_DEFINE(SDL_CDROM_WIN32)
  2108             SOURCES="$SOURCES $srcdir/src/cdrom/win32/*.c"
  2109             have_cdrom=yes
  2110         fi
  2111         # Set up files for the thread library
  2112         if test x$enable_threads = xyes; then
  2113             AC_DEFINE(SDL_THREAD_WIN32)
  2114             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
  2115             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
  2116             SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
  2117             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2118             have_threads=yes
  2119         fi
  2120         # Set up files for the timer library
  2121         if test x$enable_timers = xyes; then
  2122             AC_DEFINE(SDL_TIMER_WIN32)
  2123             SOURCES="$SOURCES $srcdir/src/timer/win32/*.c"
  2124             have_timers=yes
  2125         fi
  2126         # Set up files for the shared object loading library
  2127         if test x$enable_loadso = xyes; then
  2128             AC_DEFINE(SDL_LOADSO_WIN32)
  2129             SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
  2130             have_loadso=yes
  2131         fi
  2132         # Set up the system libraries we need
  2133         BUILD_LIBS="$BUILD_LIBS -luser32 -lgdi32 -lwinmm"
  2134         if test x$have_directx = xyes; then
  2135             BUILD_LIBS="$BUILD_LIBS -ldxguid"
  2136         fi
  2137         # The Win32 platform requires special setup
  2138         SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  2139         SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
  2140         ;;
  2141     *-*-beos*)
  2142         ARCH=beos
  2143         ac_default_prefix=/boot/develop/tools/gnupro
  2144         CheckDummyVideo
  2145         CheckDiskAudio
  2146         CheckNASM
  2147         CheckBWINDOW
  2148         CheckBeGL
  2149         # Set up files for the audio library
  2150         if test x$enable_audio = xyes; then
  2151             AC_DEFINE(SDL_AUDIO_DRIVER_BAUDIO)
  2152             SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc"
  2153             have_audio=yes
  2154         fi
  2155         # Set up files for the joystick library
  2156         if test x$enable_joystick = xyes; then
  2157             AC_DEFINE(SDL_JOYSTICK_BEOS)
  2158             SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc"
  2159             have_joystick=yes
  2160         fi
  2161         # Set up files for the cdrom library
  2162         if test x$enable_cdrom = xyes; then
  2163             AC_DEFINE(SDL_CDROM_BEOS)
  2164             SOURCES="$SOURCES $srcdir/src/cdrom/beos/*.cc"
  2165             have_cdrom=yes
  2166         fi
  2167         # Set up files for the thread library
  2168         if test x$enable_threads = xyes; then
  2169             AC_DEFINE(SDL_THREAD_BEOS)
  2170             SOURCES="$SOURCES $srcdir/src/thread/beos/*.c"
  2171             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
  2172             SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2173             have_threads=yes
  2174         fi
  2175         # Set up files for the timer library
  2176         if test x$enable_timers = xyes; then
  2177             AC_DEFINE(SDL_TIMER_BEOS)
  2178             SOURCES="$SOURCES $srcdir/src/timer/beos/*.c"
  2179             have_timers=yes
  2180         fi
  2181         # Set up files for the shared object loading library
  2182         if test x$enable_loadso = xyes; then
  2183             AC_DEFINE(SDL_LOADSO_BEOS)
  2184             SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
  2185             have_loadso=yes
  2186         fi
  2187         # The BeOS platform requires special libraries
  2188         BUILD_LIBS="$BUILD_LIBS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
  2189         ;;
  2190     *-*-darwin* )
  2191         # This could be either full "Mac OS X", or plain "Darwin" which is
  2192         # just the OS X kernel sans upper layers like Carbon and Cocoa.
  2193         # Next line is broken, and a few files below require Mac OS X (full)
  2194         ARCH=macosx
  2195         CheckDummyVideo
  2196         CheckDiskAudio
  2197         CheckDLOPEN
  2198         CheckCOCOA
  2199         CheckCARBON
  2200         CheckX11
  2201         CheckMacGL
  2202         CheckOpenGLX11
  2203         CheckPTHREAD
  2204         CheckAltivec
  2205         # Set up files for the audio library
  2206         if test x$enable_audio = xyes; then
  2207             AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO)
  2208             SOURCES="$SOURCES $srcdir/src/audio/macosx/*.c"
  2209             AC_DEFINE(SDL_AUDIO_DRIVER_SNDMGR)
  2210             SOURCES="$SOURCES $srcdir/src/audio/macrom/*.c"
  2211             have_audio=yes
  2212         fi
  2213         # Set up files for the joystick library
  2214         if test x$enable_joystick = xyes; then
  2215             AC_DEFINE(SDL_JOYSTICK_IOKIT)
  2216             SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
  2217             BUILD_LIBS="$BUILD_LIBS -framework IOKit"
  2218             have_joystick=yes
  2219         fi
  2220         # Set up files for the cdrom library
  2221         if test x$enable_cdrom = xyes; then
  2222             AC_DEFINE(SDL_CDROM_MACOSX)
  2223             SOURCES="$SOURCES $srcdir/src/cdrom/macosx/*.c"
  2224             have_cdrom=yes
  2225         fi
  2226         # Set up files for the timer library
  2227         if test x$enable_timers = xyes; then
  2228             AC_DEFINE(SDL_TIMER_UNIX)
  2229             SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2230             have_timers=yes
  2231         fi
  2232         # Set up files for the shared object loading library
  2233         if test x$enable_loadso = xyes -a x$have_dlopen != xyes; then
  2234             AC_DEFINE(SDL_LOADSO_DLCOMPAT)
  2235             SOURCES="$SOURCES $srcdir/src/loadso/macosx/*.c"
  2236             have_loadso=yes
  2237         fi
  2238         # The MacOS X platform requires special setup.
  2239         AC_DEFINE(TARGET_API_MAC_CARBON)
  2240         BUILD_CFLAGS="$BUILD_CFLAGS -fpascal-strings -DMACOSX"
  2241         SDL_LIBS="-lSDLmain $SDL_LIBS"
  2242         if test x$enable_video_cocoa = xyes; then
  2243             BUILD_LIBS="$BUILD_LIBS -framework Cocoa"
  2244         fi
  2245         if test x$enable_video_carbon = xyes -o x$enable_video_cocoa = xyes; then
  2246             # The Cocoa backend still needs Carbon, and the YUV code QuickTime
  2247             BUILD_LIBS="$BUILD_LIBS -framework Carbon -framework QuickTime"
  2248         fi
  2249         # If either the audio or CD driver is used, add the AudioUnit framework
  2250         if test x$enable_audio = xyes -o x$enable_cdrom = xyes; then
  2251             BUILD_LIBS="$BUILD_LIBS -framework AudioToolbox -framework AudioUnit"
  2252         fi
  2253         ;;
  2254     *-*-mint*)
  2255         ARCH=mint
  2256         CheckDummyVideo
  2257         CheckDiskAudio
  2258         CheckAtariBiosEvent
  2259         CheckAtariXbiosVideo
  2260         CheckAtariGemVideo
  2261         CheckAtariAudio
  2262         CheckAtariLdg
  2263         CheckAtariOSMesa
  2264         CheckPTH
  2265         # Set up files for the audio library
  2266         if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  2267             if test x$enable_audio = xyes; then
  2268                 AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
  2269                 SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  2270                 have_audio=yes
  2271             fi
  2272         fi
  2273         # Set up files for the joystick library
  2274         if test x$enable_joystick = xyes; then
  2275             AC_DEFINE(SDL_JOYSTICK_MINT)
  2276             SOURCES="$SOURCES $srcdir/src/joystick/mint/*.c"
  2277             have_joystick=yes
  2278         fi
  2279         # Set up files for the cdrom library
  2280         if test x$enable_cdrom = xyes; then
  2281             AC_DEFINE(SDL_CDROM_MINT)
  2282             SOURCES="$SOURCES $srcdir/src/cdrom/mint/*.c"
  2283             have_cdrom=yes
  2284         fi
  2285         # Set up files for the timer library
  2286         if test x$enable_timers = xyes; then
  2287             if test x$enable_threads = xyes -a x$enable_pth = xyes; then
  2288                 AC_DEFINE(SDL_TIMER_UNIX)
  2289                 SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2290             else
  2291                 AC_DEFINE(SDL_TIMER_MINT)
  2292                 SOURCES="$SOURCES $srcdir/src/timer/mint/*.c"
  2293             fi
  2294             have_timers=yes
  2295         fi
  2296         # MiNT does not define "unix"
  2297         BUILD_CFLAGS="$BUILD_CFLAGS -Dunix"
  2298         ;;
  2299     *-riscos)
  2300         ARCH=riscos
  2301         CheckOSS
  2302         CheckPTHREAD
  2303         # Set up files for the video library
  2304         if test x$enable_video = xyes; then
  2305             AC_DEFINE(SDL_VIDEO_DRIVER_RISCOS)
  2306             SOURCES="$SOURCES $srcdir/src/video/riscos/*.c"
  2307             have_video=yes
  2308         fi
  2309         # Set up files for the joystick library
  2310         if test x$enable_joystick = xyes; then
  2311             AC_DEFINE(SDL_JOYSTICK_RISCOS)
  2312             SOURCES="$SOURCES $srcdir/src/joystick/riscos/*.c"
  2313             have_joystick=yes
  2314         fi
  2315         # Set up files for the timer library
  2316         if test x$enable_timers = xyes; then
  2317             AC_DEFINE(SDL_TIMER_RISCOS)
  2318             SOURCES="$SOURCES $srcdir/src/timer/riscos/*.c"
  2319             have_timers=yes
  2320         fi
  2321         # The RISC OS platform requires special setup.
  2322         BUILD_LIBS="$BUILD_LIBS -ljpeg -ltiff -lpng -lz"
  2323         ;;
  2324     *)
  2325         AC_MSG_ERROR([
  2326 *** Unsupported target:  Please add to configure.in
  2327         ])
  2328         ;;
  2329 esac
  2330 
  2331 # Verify that we have all the platform specific files we need
  2332 if test x$have_joystick != xyes; then
  2333     if test x$enable_joystick = xyes; then
  2334         AC_DEFINE(SDL_JOYSTICK_DISABLED)
  2335     fi
  2336     SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  2337 fi
  2338 if test x$have_cdrom != xyes; then
  2339     if test x$enable_cdrom = xyes; then
  2340         AC_DEFINE(SDL_CDROM_DISABLED)
  2341     fi
  2342     SOURCES="$SOURCES $srcdir/src/cdrom/dummy/*.c"
  2343 fi
  2344 if test x$have_threads != xyes; then
  2345     if test x$enable_threads = xyes; then
  2346         AC_DEFINE(SDL_THREADS_DISABLED)
  2347     fi
  2348     SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
  2349 fi
  2350 if test x$have_timers != xyes; then
  2351     if test x$enable_timers = xyes; then
  2352         AC_DEFINE(SDL_TIMERS_DISABLED)
  2353     fi
  2354     SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
  2355 fi
  2356 if test x$have_loadso != xyes; then
  2357     if test x$enable_loadso = xyes; then
  2358         AC_DEFINE(SDL_LOADSO_DISABLED)
  2359     fi
  2360     SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
  2361 fi
  2362 
  2363 OBJECTS=`echo $SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.asm,$(objects)/\1.lo,g'`
  2364 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.lo,g'`
  2365 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.lo,g'`
  2366 OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
  2367 
  2368 # Set runtime shared library paths as needed
  2369 
  2370 if test "x$enable_rpath" = "xyes"; then
  2371   if test $ARCH = linux -o $ARCH = freebsd -o $ARCH = bsdi; then
  2372     SDL_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib"
  2373   fi
  2374   if test $ARCH = solaris; then
  2375     SDL_RLD_FLAGS="-R\${exec_prefix}/lib"
  2376   fi
  2377 else
  2378   SDL_RLD_FLAGS=""
  2379 fi
  2380 
  2381 case "$ARCH" in
  2382   openbsd | netbsd | bsdi)
  2383     SHARED_SYSTEM_LIBS="$SYSTEM_LIBS"
  2384     ;;
  2385   qnx)
  2386     SHARED_SYSTEM_LIBS="$SYSTEM_LIBS"
  2387     ;;
  2388   macosx)
  2389     SHARED_SYSTEM_LIBS=""
  2390     if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
  2391       SHARED_SYSTEM_LIBS="$SHARED_SYSTEM_LIBS -framework Cocoa"
  2392     fi
  2393     if test x$enable_video = xyes -a x$enable_video_carbon = xyes; then
  2394       SHARED_SYSTEM_LIBS="$SHARED_SYSTEM_LIBS -framework Carbon"
  2395     fi
  2396     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  2397       SHARED_SYSTEM_LIBS="$SHARED_SYSTEM_LIBS -framework OpenGL"
  2398     fi
  2399     ;;
  2400   *)
  2401     SHARED_SYSTEM_LIBS=""
  2402     ;;
  2403 esac
  2404 
  2405 case "$ARCH" in
  2406   macosx)
  2407     # Evil hack to allow static linking on Mac OS X
  2408     SDL_STATIC_LIBS="\${exec_prefix}/lib/libSDLmain.a \${exec_prefix}/lib/libSDL.a"
  2409     ;;
  2410   *)
  2411     SDL_STATIC_LIBS="$SDL_LIBS"
  2412     ;;
  2413 esac
  2414 
  2415 STATIC_SYSTEM_LIBS="$SYSTEM_LIBS"
  2416 
  2417 dnl Expand the cflags and libraries needed by apps using SDL
  2418 AC_SUBST(SDL_CFLAGS)
  2419 AC_SUBST(SDL_LIBS)
  2420 AC_SUBST(SDL_STATIC_LIBS)
  2421 AC_SUBST(SDL_RLD_FLAGS)
  2422 if test x$enable_shared = xyes; then
  2423     ENABLE_SHARED_TRUE=
  2424     ENABLE_SHARED_FALSE="#"
  2425 else
  2426     ENABLE_SHARED_TRUE="#"
  2427     ENABLE_SHARED_FALSE=
  2428 fi
  2429 if test x$enable_static = xyes; then
  2430     ENABLE_STATIC_TRUE=
  2431     ENABLE_STATIC_FALSE="#"
  2432 else
  2433     ENABLE_STATIC_TRUE="#"
  2434     ENABLE_STATIC_FALSE=
  2435 fi
  2436 AC_SUBST(ENABLE_SHARED_TRUE)
  2437 AC_SUBST(ENABLE_SHARED_FALSE)
  2438 AC_SUBST(ENABLE_STATIC_TRUE)
  2439 AC_SUBST(ENABLE_STATIC_FALSE)
  2440 
  2441 dnl Expand the libraries needed for static and dynamic linking
  2442 AC_SUBST(STATIC_SYSTEM_LIBS)
  2443 AC_SUBST(SHARED_SYSTEM_LIBS)
  2444 AC_SUBST(SYSTEM_LIBS)
  2445 
  2446 dnl Expand the sources and objects needed to build the library
  2447 AC_SUBST(ac_aux_dir)
  2448 AC_SUBST(INCLUDE)
  2449 AC_SUBST(SOURCES)
  2450 AC_SUBST(OBJECTS)
  2451 AC_SUBST(BUILD_CFLAGS)
  2452 AC_SUBST(BUILD_LIBS)
  2453 
  2454 AC_OUTPUT([
  2455     Makefile sdl-config SDL.spec SDL.qpg
  2456 ], [
  2457     : >build-deps
  2458     make depend
  2459 ])