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