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