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