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