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