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