configure.in
author Sam Lantinga <slouken@libsdl.org>
Mon, 25 Aug 2008 06:33:00 +0000
changeset 2710 44e49d3fa6cf
parent 2314 33052794de27
child 2713 0906692aa6a4
permissions -rw-r--r--
Final merge of Google Summer of Code 2008 work...

Many-mouse and tablet support
by Szymon Wilczek, mentored by Ryan C. Gordon

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