configure.in
author Ryan C. Gordon <icculus@icculus.org>
Thu, 08 Sep 2005 06:16:14 +0000
changeset 1133 609c060fd2a2
parent 1127 fb8818ee9112
child 1136 d16c010d5d98
permissions -rw-r--r--
The MacOSX Carbon/Cocoa/X11 all in one library patch. Relevant emails:


To: SDL Developers <sdl@libsdl.org>
From: =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb@algonet.se>
Date: Mon, 30 May 2005 23:29:04 +0200
Subject: [SDL] Mac OS X Video Drivers [patch]

I've updated/added the Carbon and X11 video drivers
to the Mac OS X port of SDL 1.2 (the CVS version),
and made the Cocoa driver and runtime *optional*.

The default is still Cocoa, and the "Quartz" driver.
But you can now also use "toolbox" for Carbon, and
"x11" for running with Apple's (or other) X11 server:

export SDL_VIDEODRIVER=x11
export SDL_VIDEO_GL_DRIVER=/usr/X11R6/lib/libGL.dylib

It also checks if the frameworks are available, by a:
#include <Carbon/Carbon.h> or #import <Cocoa/Cocoa.h>
(this should make it configure on plain Darwin as well?)


Here are the new configure targets:
--enable-video-cocoa use Cocoa/Quartz video driver default=yes
--enable-video-carbon use Carbon/QuickDraw video driver default=yes
--enable-video-x11 use X11 video driver default=no

./configure --enable-video-cocoa --enable-video-carbon
--enable-video-x11 \
--x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib

The Carbon version is just an updated version of the old
SDL driver for Mac OS 9, and could probably be improved...
(but it does work, including the Carbon version of SDLmain)

If you disable cocoa, you can run with -framework Carbon only,
and the C version of SDL_main.c. And if you disable carbon too,
you can still use the X11 version which doesn't require SDLmain.

I updated the DrawSprocket version, but did not include it.
(no blitters or VRAM GWorlds etc. available on OS X anyway)
Besides for Mac OS 9, I don't think there's any use for it ?

And note that any performance on Mac OS X equals OpenGL anyway...
You can get "fair" software SDL results on captured CG displays,
but for decent frame rates you need to be using GL for rendering.


Finally, here is the patch itself:
http://www.algonet.se/~afb/SDL-12CVS-macvideo.patch

--anders

PS. It says "video", but as usual it applies to mouse/keyboard too.


------


To: A list for developers using the SDL library <sdl@libsdl.org>
From: =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb@algonet.se>
Date: Sun, 4 Sep 2005 10:02:15 +0200
Subject: [SDL] Updated Mac patch

Updated the previous Mac patch to disable Carbon by default.
Also "fixed" the SDL.spec again, so that it builds on Darwin.

http://www.algonet.se/~afb/SDL-1.2.9-mac.patch
Also applied fine to SDL12 CVS, when I tried it.
slouken@0
     1
dnl Process this file with autoconf to produce a configure script.
slouken@0
     2
AC_INIT(README)
slouken@0
     3
slouken@0
     4
dnl Set various version strings - taken gratefully from the GTk sources
slouken@0
     5
#
slouken@0
     6
# Making releases:
slouken@0
     7
# Edit include/SDL/SDL_version.h and change the version, then:
slouken@0
     8
#   SDL_MICRO_VERSION += 1;
slouken@0
     9
#   SDL_INTERFACE_AGE += 1;
slouken@0
    10
#   SDL_BINARY_AGE += 1;
slouken@0
    11
# if any functions have been added, set SDL_INTERFACE_AGE to 0.
slouken@0
    12
# if backwards compatibility has been broken,
slouken@0
    13
# set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0.
slouken@0
    14
#
slouken@0
    15
SDL_MAJOR_VERSION=1
slouken@0
    16
SDL_MINOR_VERSION=2
slouken@1024
    17
SDL_MICRO_VERSION=9
slouken@1024
    18
SDL_INTERFACE_AGE=2
slouken@1024
    19
SDL_BINARY_AGE=9
slouken@0
    20
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
slouken@0
    21
slouken@0
    22
AC_SUBST(SDL_MAJOR_VERSION)
slouken@0
    23
AC_SUBST(SDL_MINOR_VERSION)
slouken@0
    24
AC_SUBST(SDL_MICRO_VERSION)
slouken@0
    25
AC_SUBST(SDL_INTERFACE_AGE)
slouken@0
    26
AC_SUBST(SDL_BINARY_AGE)
slouken@0
    27
AC_SUBST(SDL_VERSION)
slouken@0
    28
slouken@0
    29
# libtool versioning
slouken@0
    30
LT_RELEASE=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION
slouken@0
    31
LT_CURRENT=`expr $SDL_MICRO_VERSION - $SDL_INTERFACE_AGE`
slouken@0
    32
LT_REVISION=$SDL_INTERFACE_AGE
slouken@0
    33
LT_AGE=`expr $SDL_BINARY_AGE - $SDL_INTERFACE_AGE`
slouken@0
    34
slouken@0
    35
AC_SUBST(LT_RELEASE)
slouken@0
    36
AC_SUBST(LT_CURRENT)
slouken@0
    37
AC_SUBST(LT_REVISION)
slouken@0
    38
AC_SUBST(LT_AGE)
slouken@0
    39
slouken@0
    40
dnl Detect the canonical host and target build environment
slouken@557
    41
AC_CANONICAL_SYSTEM
slouken@0
    42
slouken@51
    43
dnl Setup for automake
slouken@51
    44
AM_INIT_AUTOMAKE(SDL, $SDL_VERSION)
slouken@51
    45
slouken@0
    46
dnl Check for tools
slouken@0
    47
slouken@0
    48
AC_LIBTOOL_WIN32_DLL
slouken@0
    49
AM_PROG_LIBTOOL
slouken@0
    50
AC_PROG_MAKE_SET
slouken@0
    51
AC_PROG_CC
slouken@0
    52
AC_C_INLINE
slouken@0
    53
AC_C_CONST
slouken@200
    54
AC_PROG_CXX
slouken@0
    55
AC_PROG_INSTALL
slouken@0
    56
AC_FUNC_ALLOCA
slouken@258
    57
ASFLAGS=""
slouken@258
    58
AC_SUBST(ASFLAGS)
slouken@436
    59
CCAS="$CC"
slouken@436
    60
AC_SUBST(CCAS)
slouken@436
    61
CCASFLAGS=""
slouken@436
    62
AC_SUBST(CCASFLAGS)
slouken@682
    63
AM_CONDITIONAL([am__fastdepOBJC], false)
slouken@0
    64
slouken@0
    65
dnl The alpha architecture needs special flags for binary portability
slouken@0
    66
case "$target" in
slouken@0
    67
    alpha*-*-linux*)
slouken@0
    68
        if test x$ac_cv_prog_gcc = xyes; then
slouken@0
    69
            CFLAGS="$CFLAGS -mcpu=ev4 -Wa,-mall"
slouken@0
    70
        fi
slouken@0
    71
        ;;
slouken@0
    72
esac
slouken@0
    73
slouken@0
    74
dnl Add compiler-specific optimization flags
slouken@0
    75
slouken@0
    76
dnl See if the user wants aggressive optimizations of the code
slouken@0
    77
AC_ARG_ENABLE(debug,
slouken@0
    78
[  --enable-debug          Disable aggressive optimizations [default=yes]],
slouken@0
    79
              , enable_debug=yes)
slouken@0
    80
if test x$enable_debug != xyes; then
slouken@0
    81
    if test x$ac_cv_prog_gcc = xyes; then
slouken@0
    82
        CFLAGS="$CFLAGS -fexpensive-optimizations"
slouken@0
    83
        # Ack! This breaks the MMX YV12 conversion on gcc 2.95.2
slouken@0
    84
        # CFLAGS="$CFLAGS -fomit-frame-pointer"
slouken@0
    85
    fi
slouken@0
    86
    case "$target" in
slouken@0
    87
        i486-*-*)
slouken@0
    88
            if test x$ac_cv_prog_gcc = xyes; then
slouken@802
    89
                CFLAGS="$CFLAGS -march=i486"
slouken@0
    90
            fi
slouken@0
    91
            ;;
slouken@0
    92
        i?86-*-*)
slouken@0
    93
            if test x$ac_cv_prog_gcc = xyes; then
slouken@0
    94
                CFLAGS="$CFLAGS -march=pentium -mcpu=pentiumpro"
slouken@0
    95
            fi
slouken@0
    96
            ;;
slouken@0
    97
        *-*-osf*)
slouken@0
    98
            if test x$ac_cv_prog_gcc != xyes; then
slouken@0
    99
                CFLAGS="-g3 -fast -arch host"
slouken@0
   100
            fi
slouken@0
   101
            ;;
slouken@0
   102
    esac
slouken@0
   103
fi
slouken@0
   104
slouken@0
   105
dnl Add verbose warnings by default, and allow ANSI compliance checking
slouken@0
   106
AC_ARG_ENABLE(strict-ansi,
slouken@0
   107
[  --enable-strict-ansi    Enable strict ANSI compliance build [default=no]],
slouken@0
   108
              , enable_strict_ansi=no)
slouken@0
   109
if test x$ac_cv_prog_gcc = xyes; then
slouken@0
   110
    CFLAGS="$CFLAGS -Wall"
slouken@0
   111
    if test x$enable_strict_ansi = xyes; then
slouken@0
   112
        CFLAGS="$CFLAGS -ansi -pedantic -D_XOPEN_SOURCE"
slouken@0
   113
    fi
slouken@0
   114
fi
slouken@0
   115
slouken@0
   116
dnl Initialize the compiler and linker flags for SDL applications
slouken@0
   117
slouken@0
   118
SDL_CFLAGS=""
slouken@0
   119
SDL_LIBS="-lSDL"
slouken@0
   120
slouken@0
   121
dnl Add the math library for the new gamma correction support
slouken@0
   122
slouken@0
   123
case "$target" in
slouken@0
   124
    *-*-cygwin* | *-*-mingw32*)
slouken@0
   125
        MATHLIB=""
slouken@0
   126
        ;;
slouken@0
   127
    *-*-beos*)
slouken@0
   128
        MATHLIB=""
slouken@0
   129
        ;;
slouken@0
   130
    *-*-darwin*)
slouken@0
   131
        MATHLIB=""
slouken@0
   132
        ;;
slouken@0
   133
    *)
slouken@0
   134
        MATHLIB="-lm"
slouken@0
   135
        ;;
slouken@0
   136
esac
slouken@0
   137
SYSTEM_LIBS="$SYSTEM_LIBS $MATHLIB"
slouken@0
   138
slouken@0
   139
dnl Enable/disable various subsystems of the SDL library
slouken@0
   140
slouken@0
   141
AC_ARG_ENABLE(audio,
slouken@0
   142
[  --enable-audio          Enable the audio subsystem [default=yes]],
slouken@0
   143
              , enable_audio=yes)
slouken@0
   144
if test x$enable_audio = xyes; then
slouken@0
   145
    SDL_EXTRADIRS="$SDL_EXTRADIRS audio"
slouken@0
   146
    SDL_EXTRALIBS="$SDL_EXTRALIBS audio/libaudio.la"
slouken@0
   147
else
slouken@0
   148
    CFLAGS="$CFLAGS -DDISABLE_AUDIO"
slouken@0
   149
fi
slouken@0
   150
AC_ARG_ENABLE(video,
slouken@0
   151
[  --enable-video          Enable the video subsystem [default=yes]],
slouken@0
   152
              , enable_video=yes)
slouken@0
   153
if test x$enable_video = xyes; then
slouken@0
   154
    SDL_EXTRADIRS="$SDL_EXTRADIRS video"
slouken@0
   155
    SDL_EXTRALIBS="$SDL_EXTRALIBS video/libvideo.la"
slouken@0
   156
else
slouken@0
   157
    CFLAGS="$CFLAGS -DDISABLE_VIDEO"
slouken@0
   158
fi
slouken@0
   159
AC_ARG_ENABLE(events,
slouken@0
   160
[  --enable-events         Enable the events subsystem [default=yes]],
slouken@0
   161
              , enable_events=yes)
slouken@0
   162
if test x$enable_video = xyes -a x$enable_events = xyes; then
slouken@0
   163
    SDL_EXTRADIRS="$SDL_EXTRADIRS events"
slouken@0
   164
    SDL_EXTRALIBS="$SDL_EXTRALIBS events/libevents.la"
slouken@0
   165
else
slouken@0
   166
    CFLAGS="$CFLAGS -DDISABLE_EVENTS"
slouken@0
   167
fi
slouken@0
   168
AC_ARG_ENABLE(joystick,
slouken@0
   169
[  --enable-joystick       Enable the joystick subsystem [default=yes]],
slouken@0
   170
              , enable_joystick=yes)
slouken@0
   171
if test x$enable_joystick = xyes; then
slouken@0
   172
    SDL_EXTRADIRS="$SDL_EXTRADIRS joystick"
slouken@0
   173
    SDL_EXTRALIBS="$SDL_EXTRALIBS joystick/libjoystick.la"
slouken@0
   174
else
slouken@0
   175
    CFLAGS="$CFLAGS -DDISABLE_JOYSTICK"
slouken@0
   176
fi
slouken@0
   177
AC_ARG_ENABLE(cdrom,
slouken@0
   178
[  --enable-cdrom          Enable the cdrom subsystem [default=yes]],
slouken@0
   179
              , enable_cdrom=yes)
slouken@0
   180
if test x$enable_cdrom = xyes; then
slouken@0
   181
    SDL_EXTRADIRS="$SDL_EXTRADIRS cdrom"
slouken@0
   182
    SDL_EXTRALIBS="$SDL_EXTRALIBS cdrom/libcdrom.la"
slouken@0
   183
else
slouken@0
   184
    CFLAGS="$CFLAGS -DDISABLE_CDROM"
slouken@0
   185
fi
slouken@0
   186
AC_ARG_ENABLE(threads,
slouken@0
   187
[  --enable-threads        Enable the threading subsystem [default=yes]],
slouken@0
   188
              , enable_threads=yes)
slouken@0
   189
SDL_EXTRADIRS="$SDL_EXTRADIRS thread"
slouken@0
   190
SDL_EXTRALIBS="$SDL_EXTRALIBS thread/libthread.la"
slouken@0
   191
if test x$enable_threads != xyes; then
slouken@0
   192
    CFLAGS="$CFLAGS -DDISABLE_THREADS"
slouken@0
   193
    COPY_ARCH_SRC(src/thread, generic, SDL_systhread.c)
slouken@0
   194
    COPY_ARCH_SRC(src/thread, generic, SDL_systhread_c.h)
slouken@0
   195
    COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
slouken@0
   196
    COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
slouken@0
   197
    COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
slouken@0
   198
    COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
slouken@0
   199
    COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
slouken@0
   200
    COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
slouken@0
   201
fi
slouken@0
   202
AC_ARG_ENABLE(timers,
slouken@0
   203
[  --enable-timers         Enable the timer subsystem [default=yes]],
slouken@0
   204
              , enable_timers=yes)
slouken@0
   205
if test x$enable_timers = xyes; then
slouken@0
   206
    SDL_EXTRADIRS="$SDL_EXTRADIRS timer"
slouken@0
   207
    SDL_EXTRALIBS="$SDL_EXTRALIBS timer/libtimer.la"
slouken@0
   208
else
slouken@0
   209
    CFLAGS="$CFLAGS -DDISABLE_TIMERS"
slouken@0
   210
fi
slouken@0
   211
AC_ARG_ENABLE(endian,
slouken@0
   212
[  --enable-endian         Enable the endian subsystem [default=yes]],
slouken@0
   213
              , enable_endian=yes)
slouken@0
   214
if test x$enable_endian = xyes; then
slouken@0
   215
    SDL_EXTRADIRS="$SDL_EXTRADIRS endian"
slouken@0
   216
    SDL_EXTRALIBS="$SDL_EXTRALIBS endian/libendian.la"
slouken@0
   217
else
slouken@0
   218
    CFLAGS="$CFLAGS -DDISABLE_ENDIAN"
slouken@0
   219
fi
slouken@0
   220
AC_ARG_ENABLE(file,
slouken@0
   221
[  --enable-file           Enable the file subsystem [default=yes]],
slouken@0
   222
              , enable_file=yes)
slouken@0
   223
if test x$enable_file = xyes; then
slouken@0
   224
    SDL_EXTRADIRS="$SDL_EXTRADIRS file"
slouken@0
   225
    SDL_EXTRALIBS="$SDL_EXTRALIBS file/libfile.la"
slouken@0
   226
else
slouken@0
   227
    CFLAGS="$CFLAGS -DDISABLE_FILE"
slouken@0
   228
fi
slouken@740
   229
AC_ARG_ENABLE(cpuinfo,
slouken@740
   230
[  --enable-cpuinfo        Enable the cpuinfo subsystem [default=yes]],
slouken@740
   231
              , enable_cpuinfo=yes)
slouken@740
   232
if test x$enable_cpuinfo = xyes; then
slouken@740
   233
    SDL_EXTRADIRS="$SDL_EXTRADIRS cpuinfo"
slouken@740
   234
    SDL_EXTRALIBS="$SDL_EXTRALIBS cpuinfo/libcpuinfo.la"
slouken@740
   235
else
slouken@740
   236
    CFLAGS="$CFLAGS -DDISABLE_CPUINFO"
slouken@740
   237
fi
slouken@0
   238
slouken@0
   239
dnl See if the OSS audio interface is supported
slouken@0
   240
CheckOSS()
slouken@0
   241
{
slouken@0
   242
    AC_ARG_ENABLE(oss,
slouken@0
   243
[  --enable-oss            support the OSS audio API [default=yes]],
slouken@0
   244
                  , enable_oss=yes)
slouken@0
   245
    if test x$enable_audio = xyes -a x$enable_oss = xyes; then
slouken@0
   246
        AC_MSG_CHECKING(for OSS audio support)
slouken@0
   247
        have_oss=no
slouken@94
   248
        if test x$have_oss != xyes; then
slouken@94
   249
            AC_TRY_COMPILE([
slouken@94
   250
              #include <sys/soundcard.h>
slouken@94
   251
            ],[
slouken@94
   252
              int arg = SNDCTL_DSP_SETFRAGMENT;
slouken@94
   253
            ],[
slouken@94
   254
            have_oss=yes
slouken@94
   255
            ])
slouken@94
   256
        fi
slouken@94
   257
        if test x$have_oss != xyes; then
slouken@94
   258
            AC_TRY_COMPILE([
slouken@94
   259
              #include <soundcard.h>
slouken@94
   260
            ],[
slouken@94
   261
              int arg = SNDCTL_DSP_SETFRAGMENT;
slouken@94
   262
            ],[
slouken@94
   263
            have_oss=yes
slouken@94
   264
            CFLAGS="$CFLAGS -DOSS_USE_SOUNDCARD_H"
slouken@94
   265
            ])
slouken@94
   266
        fi
slouken@0
   267
        AC_MSG_RESULT($have_oss)
slouken@0
   268
        if test x$have_oss = xyes; then
slouken@0
   269
            CFLAGS="$CFLAGS -DOSS_SUPPORT"
slouken@0
   270
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS dsp"
slouken@0
   271
            AUDIO_DRIVERS="$AUDIO_DRIVERS dsp/libaudio_dsp.la"
slouken@0
   272
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS dma"
slouken@0
   273
            AUDIO_DRIVERS="$AUDIO_DRIVERS dma/libaudio_dma.la"
slouken@0
   274
        fi
slouken@0
   275
    fi
slouken@0
   276
}
slouken@0
   277
slouken@0
   278
dnl See if the ALSA audio interface is supported
slouken@0
   279
CheckALSA()
slouken@0
   280
{
slouken@0
   281
    AC_ARG_ENABLE(alsa,
slouken@0
   282
[  --enable-alsa           support the ALSA audio API [default=yes]],
slouken@0
   283
                  , enable_alsa=yes)
slouken@0
   284
    if test x$enable_audio = xyes -a x$enable_alsa = xyes; then
slouken@948
   285
        AM_PATH_ALSA(0.9.0, have_alsa=yes, have_alsa=no)
slouken@1009
   286
        # Restore all flags from before the ALSA detection runs
slouken@1009
   287
        CFLAGS="$alsa_save_CFLAGS"
slouken@1009
   288
        LDFLAGS="$alsa_save_LDFLAGS"
slouken@1009
   289
        LIBS="$alsa_save_LIBS"
slouken@354
   290
        if test x$have_alsa = xyes; then
slouken@865
   291
            AC_ARG_ENABLE(alsa-shared,
slouken@865
   292
[  --enable-alsa-shared     dynamically load ALSA audio support [default=yes]],
slouken@865
   293
                          , enable_alsa_shared=yes)
slouken@939
   294
            if test "x`echo $ALSA_LIBS | grep -- -L`" = "x"; then
slouken@973
   295
                if test "x`ls /lib/libasound.so.* 2> /dev/null`" != "x"; then
slouken@973
   296
                    ALSA_LIBS="-L/lib $ALSA_LIBS"
slouken@973
   297
                elif test "x`ls /usr/lib/libasound.so.* 2> /dev/null`" != "x"; then
slouken@939
   298
                    ALSA_LIBS="-L/usr/lib $ALSA_LIBS"
slouken@973
   299
                elif test "x`ls /usr/local/lib/libasound.so.* 2> /dev/null`" != "x"; then
slouken@939
   300
                    ALSA_LIBS="-L/usr/local/lib $ALSA_LIBS"
slouken@973
   301
                fi
slouken@939
   302
            fi
slouken@939
   303
            alsa_lib_spec=`echo $ALSA_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libasound.so.*/'`
slouken@939
   304
            alsa_lib=`ls $alsa_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
slouken@939
   305
            echo "-- $alsa_lib_spec -> $alsa_lib"
slouken@939
   306
slouken@865
   307
            if test x$use_dlopen != xyes && \
slouken@865
   308
               test x$enable_alsa_shared = xyes; then
slouken@865
   309
                AC_MSG_ERROR([You must have dlopen() support and use the --enable-dlopen option])
slouken@865
   310
            fi
slouken@865
   311
            if test x$use_dlopen = xyes && \
slouken@865
   312
               test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
slouken@939
   313
                CFLAGS="$CFLAGS -DALSA_SUPPORT -DALSA_DYNAMIC=\$(alsa_lib) $ALSA_CFLAGS"
slouken@865
   314
                AC_SUBST(alsa_lib)
slouken@939
   315
slouken@939
   316
                AC_MSG_CHECKING(for dlvsym)
slouken@939
   317
                use_dlvsym=no
slouken@939
   318
                AC_TRY_COMPILE([
slouken@939
   319
                  #include <stdio.h>
slouken@939
   320
                  #define __USE_GNU
slouken@939
   321
                  #include <dlfcn.h>
slouken@939
   322
                ],[
slouken@939
   323
                  dlvsym(NULL,"","");
slouken@939
   324
                ],[
slouken@939
   325
                use_dlvsym=yes
slouken@939
   326
                ])
slouken@939
   327
                AC_MSG_RESULT($use_dlvsym);
slouken@939
   328
                if test x$use_dlvsym = xyes; then
slouken@939
   329
                    CFLAGS="$CFLAGS -DUSE_DLVSYM"
slouken@939
   330
                fi
slouken@865
   331
            else
slouken@939
   332
                CFLAGS="$CFLAGS -DALSA_SUPPORT $ALSA_CFLAGS"
slouken@939
   333
                SYSTEM_LIBS="$SYSTEM_LIBS $ALSA_LIBS"
slouken@865
   334
            fi
slouken@0
   335
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS alsa"
slouken@0
   336
            AUDIO_DRIVERS="$AUDIO_DRIVERS alsa/libaudio_alsa.la"
slouken@0
   337
        fi
slouken@0
   338
    fi
slouken@0
   339
}
slouken@0
   340
slouken@148
   341
dnl Check whether we want to use IRIX 6.5+ native audio or not
slouken@148
   342
CheckDMEDIA()
slouken@148
   343
{
slouken@148
   344
    if test x$enable_audio = xyes; then
slouken@148
   345
        AC_MSG_CHECKING(for dmedia audio support)
slouken@148
   346
        have_dmedia=no
slouken@148
   347
        AC_TRY_COMPILE([
slouken@148
   348
          #include <dmedia/audio.h>
slouken@148
   349
        ],[
slouken@148
   350
          ALport audio_port;
slouken@148
   351
        ],[
slouken@148
   352
        have_dmedia=yes
slouken@148
   353
        ])
slouken@935
   354
        AC_MSG_RESULT($have_dmedia)
slouken@148
   355
        # Set up files for the audio library
slouken@148
   356
        if test x$have_dmedia = xyes; then
slouken@148
   357
            CFLAGS="$CFLAGS -DDMEDIA_SUPPORT"
slouken@148
   358
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS dmedia"
slouken@148
   359
            AUDIO_DRIVERS="$AUDIO_DRIVERS dmedia/libaudio_dmedia.la"
slouken@148
   360
            SYSTEM_LIBS="$SYSTEM_LIBS -laudio"
slouken@148
   361
        fi
slouken@148
   362
    fi
slouken@148
   363
}
slouken@148
   364
slouken@0
   365
dnl Find the ESD includes and libraries
slouken@0
   366
CheckESD()
slouken@0
   367
{
slouken@0
   368
    AC_ARG_ENABLE(esd,
slouken@0
   369
[  --enable-esd            support the Enlightened Sound Daemon [default=yes]],
slouken@0
   370
                  , enable_esd=yes)
slouken@0
   371
    if test x$enable_audio = xyes -a x$enable_esd = xyes; then
slouken@948
   372
        AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no)
slouken@948
   373
        if test x$have_esd = xyes; then
slouken@294
   374
            AC_ARG_ENABLE(esd-shared,
slouken@678
   375
[  --enable-esd-shared     dynamically load ESD audio support [default=yes]],
slouken@678
   376
                          , enable_esd_shared=yes)
slouken@294
   377
            esd_lib_spec=`echo $ESD_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libesd.so.*/'`
slouken@868
   378
            esd_lib=`ls $esd_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
slouken@371
   379
            echo "-- $esd_lib_spec -> $esd_lib"
slouken@731
   380
            if test x$use_dlopen != xyes && \
slouken@296
   381
               test x$enable_esd_shared = xyes; then
slouken@296
   382
                AC_MSG_ERROR([You must have dlopen() support and use the --enable-dlopen option])
slouken@296
   383
            fi
slouken@731
   384
            if test x$use_dlopen = xyes && \
slouken@294
   385
               test x$enable_esd_shared = xyes && test x$esd_lib != x; then
slouken@294
   386
                CFLAGS="$CFLAGS -DESD_SUPPORT -DESD_DYNAMIC=\$(esd_lib) $ESD_CFLAGS"
slouken@371
   387
                AC_SUBST(esd_lib)
slouken@294
   388
            else
slouken@294
   389
                CFLAGS="$CFLAGS -DESD_SUPPORT $ESD_CFLAGS"
slouken@294
   390
                SYSTEM_LIBS="$SYSTEM_LIBS $ESD_LIBS"
slouken@294
   391
            fi
slouken@0
   392
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS esd"
slouken@0
   393
            AUDIO_DRIVERS="$AUDIO_DRIVERS esd/libaudio_esd.la"
slouken@294
   394
        fi
slouken@0
   395
    fi
slouken@0
   396
}
slouken@0
   397
slouken@0
   398
CheckARTSC()
slouken@0
   399
{
slouken@0
   400
    AC_ARG_ENABLE(arts,
slouken@0
   401
[  --enable-arts           support the Analog Real Time Synthesizer [default=yes]],
slouken@0
   402
                  , enable_arts=yes)
slouken@0
   403
    if test x$enable_audio = xyes -a x$enable_arts = xyes; then
slouken@0
   404
        AC_PATH_PROG(ARTSCCONFIG, artsc-config)
slouken@0
   405
        if test x$ARTSCCONFIG = x -o x$ARTSCCONFIG = x'"$ARTSCCONFIG"'; then
slouken@0
   406
            : # arts isn't installed
slouken@0
   407
        else
slouken@0
   408
            ARTSC_CFLAGS=`$ARTSCCONFIG --cflags`
slouken@0
   409
            ARTSC_LIBS=`$ARTSCCONFIG --libs`
slouken@856
   410
            ARTSC_PREFIX=`$ARTSCCONFIG --arts-prefix`
slouken@0
   411
            AC_MSG_CHECKING(for aRts development environment)
slouken@0
   412
            audio_arts=no
slouken@0
   413
            save_CFLAGS="$CFLAGS"
slouken@0
   414
            CFLAGS="$CFLAGS $ARTSC_CFLAGS"
slouken@0
   415
            AC_TRY_COMPILE([
slouken@0
   416
             #include <artsc.h>
slouken@0
   417
            ],[
slouken@0
   418
             arts_stream_t stream;
slouken@0
   419
            ],[
slouken@0
   420
            audio_arts=yes
slouken@0
   421
            ])
slouken@0
   422
            CFLAGS="$save_CFLAGS"
slouken@0
   423
            AC_MSG_RESULT($audio_arts)
slouken@0
   424
            if test x$audio_arts = xyes; then
slouken@294
   425
                AC_ARG_ENABLE(arts-shared,
slouken@678
   426
[  --enable-arts-shared    dynamically load aRts audio support [default=yes]],
slouken@678
   427
                              , enable_arts_shared=yes)
slouken@856
   428
                arts_lib_spec="$ARTSC_PREFIX/lib/libartsc.so.*"
slouken@868
   429
                arts_lib=`ls $arts_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
slouken@371
   430
                echo "-- $arts_lib_spec -> $arts_lib"
slouken@731
   431
                if test x$use_dlopen != xyes && \
slouken@296
   432
                   test x$enable_arts_shared = xyes; then
slouken@296
   433
                    AC_MSG_ERROR([You must have dlopen() support and use the --enable-dlopen option])
slouken@296
   434
                fi
slouken@731
   435
                if test x$use_dlopen = xyes && \
slouken@294
   436
                   test x$enable_arts_shared = xyes && test x$arts_lib != x; then
slouken@294
   437
                    CFLAGS="$CFLAGS -DARTSC_SUPPORT -DARTSC_DYNAMIC=\$(arts_lib) $ARTSC_CFLAGS"
slouken@371
   438
                    AC_SUBST(arts_lib)
slouken@294
   439
                else
slouken@294
   440
                    CFLAGS="$CFLAGS -DARTSC_SUPPORT $ARTSC_CFLAGS"
slouken@294
   441
                    SYSTEM_LIBS="$SYSTEM_LIBS $ARTSC_LIBS"
slouken@294
   442
                fi
slouken@0
   443
                AUDIO_SUBDIRS="$AUDIO_SUBDIRS arts"
slouken@0
   444
                AUDIO_DRIVERS="$AUDIO_DRIVERS arts/libaudio_arts.la"
slouken@0
   445
            fi
slouken@0
   446
        fi
slouken@0
   447
    fi
slouken@0
   448
}
slouken@0
   449
slouken@0
   450
dnl See if the NAS audio interface is supported
slouken@0
   451
CheckNAS()
slouken@0
   452
{
slouken@0
   453
    AC_ARG_ENABLE(nas,
patmandin@651
   454
[  --enable-nas            support the NAS audio API [default=yes]],
slouken@41
   455
                  , enable_nas=yes)
slouken@0
   456
    if test x$enable_audio = xyes -a x$enable_nas = xyes; then
slouken@41
   457
        AC_MSG_CHECKING(for NAS audio support)
slouken@41
   458
        have_nas=no
slouken@41
   459
        if test -r /usr/X11R6/include/audio/audiolib.h; then
slouken@41
   460
            have_nas=yes
slouken@720
   461
            CFLAGS="$CFLAGS -DNAS_SUPPORT -I/usr/X11R6/include/"
slouken@41
   462
            SYSTEM_LIBS="$SYSTEM_LIBS -laudio -lXt"
slouken@41
   463
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS nas"
slouken@41
   464
            AUDIO_DRIVERS="$AUDIO_DRIVERS nas/libaudio_nas.la"
slouken@605
   465
slouken@605
   466
        dnl On IRIX, the NAS includes are in a different directory,
slouken@605
   467
        dnl and libnas must be explicitly linked in
slouken@605
   468
slouken@605
   469
        elif test -r /usr/freeware/include/nas/audiolib.h; then
slouken@605
   470
            have_nas=yes
slouken@605
   471
            CFLAGS="$CFLAGS -DNAS_SUPPORT"
slouken@605
   472
            SYSTEM_LIBS="$SYSTEM_LIBS -lnas -lXt"
slouken@605
   473
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS nas"
slouken@605
   474
            AUDIO_DRIVERS="$AUDIO_DRIVERS nas/libaudio_nas.la"
slouken@41
   475
        fi
slouken@605
   476
        AC_MSG_RESULT($have_nas)
slouken@0
   477
    fi
slouken@0
   478
}
slouken@0
   479
slouken@68
   480
dnl rcg07142001 See if the user wants the disk writer audio driver...
slouken@68
   481
CheckDiskAudio()
slouken@68
   482
{
slouken@68
   483
    AC_ARG_ENABLE(diskaudio,
patmandin@651
   484
[  --enable-diskaudio      support the disk writer audio driver [default=yes]],
slouken@86
   485
                  , enable_diskaudio=yes)
slouken@68
   486
    if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
slouken@68
   487
        CFLAGS="$CFLAGS -DDISKAUD_SUPPORT"
slouken@68
   488
        AUDIO_SUBDIRS="$AUDIO_SUBDIRS disk"
slouken@68
   489
        AUDIO_DRIVERS="$AUDIO_DRIVERS disk/libaudio_disk.la"
slouken@68
   490
    fi
slouken@68
   491
}
slouken@68
   492
slouken@398
   493
dnl Set up the Atari Audio driver
slouken@398
   494
CheckAtariAudio()
slouken@398
   495
{
slouken@398
   496
    AC_ARG_ENABLE(mintaudio,
slouken@398
   497
[  --enable-mintaudio      support Atari audio driver [default=yes]],
slouken@398
   498
                  , enable_mintaudio=yes)
slouken@398
   499
    if test x$enable_audio = xyes -a x$enable_mintaudio = xyes; then
slouken@398
   500
        mintaudio=no
slouken@398
   501
        AC_CHECK_HEADER(mint/falcon.h, have_mint_falcon_hdr=yes)
slouken@398
   502
        if test x$have_mint_falcon_hdr = xyes; then
slouken@398
   503
            mintaudio=yes
slouken@398
   504
            CFLAGS="$CFLAGS -DMINTAUDIO_SUPPORT"
slouken@398
   505
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS mint"
slouken@398
   506
            AUDIO_DRIVERS="$AUDIO_DRIVERS mint/libaudio_mintaudio.la"
slouken@398
   507
        fi
slouken@398
   508
    fi
slouken@398
   509
}
slouken@398
   510
slouken@0
   511
dnl See if we can use x86 assembly blitters
slouken@212
   512
# NASM is available from: http://nasm.octium.net/
slouken@0
   513
CheckNASM()
slouken@0
   514
{
slouken@0
   515
    dnl Make sure we are running on an x86 platform
slouken@0
   516
    case $target in
slouken@0
   517
        i?86*)
slouken@0
   518
            ;;
slouken@0
   519
        *)
slouken@0
   520
        # Nope, bail early.
slouken@0
   521
            return
slouken@0
   522
            ;;
slouken@0
   523
    esac
slouken@0
   524
    dnl Check for NASM (for assembly blit routines)
slouken@0
   525
    AC_ARG_ENABLE(nasm,
slouken@0
   526
[  --enable-nasm           use nasm assembly blitters on x86 [default=yes]],
slouken@0
   527
                  , enable_nasm=yes)
slouken@0
   528
    if test x$enable_video = xyes -a x$enable_nasm = xyes; then
slouken@0
   529
        AC_PATH_PROG(NASM, nasm)
slouken@0
   530
        if test x$NASM = x -o x$NASM = x'"$NASM"'; then
slouken@0
   531
            : # nasm isn't installed
slouken@0
   532
        else
slouken@0
   533
            CFLAGS="$CFLAGS -DUSE_ASMBLIT -I$srcdir/hermes"
slouken@0
   534
            case $ARCH in
slouken@0
   535
              win32)
slouken@0
   536
                  NASMFLAGS="-f win32"
slouken@0
   537
                  ;;
slouken@360
   538
              openbsd)
slouken@360
   539
                  NASMFLAGS="-f aoutb"
slouken@360
   540
                  ;;
slouken@0
   541
              *)
slouken@754
   542
                  NASMFLAGS="-f elf"
slouken@0
   543
                  ;;
slouken@0
   544
            esac
slouken@0
   545
            AC_SUBST(NASMFLAGS)
slouken@0
   546
            CFLAGS="$CFLAGS -I\$(top_srcdir)/src/hermes"
slouken@0
   547
            SDL_EXTRADIRS="$SDL_EXTRADIRS hermes"
slouken@0
   548
            SDL_EXTRALIBS="$SDL_EXTRALIBS hermes/libhermes.la"
slouken@739
   549
            use_nasm=yes
slouken@886
   550
            
slouken@886
   551
            case "$target" in
slouken@886
   552
                # this line is needed for QNX, because it's not defined the __ELF__
slouken@886
   553
                *-*-qnx*) CFLAGS="$CFLAGS -D__ELF__"
slouken@886
   554
                          ;;
slouken@886
   555
slouken@886
   556
            esac
slouken@886
   557
slouken@0
   558
        fi
slouken@0
   559
    fi
slouken@0
   560
}
slouken@0
   561
slouken@30
   562
dnl Find the nanox include and library directories
slouken@30
   563
CheckNANOX()
slouken@30
   564
{
slouken@292
   565
    AC_ARG_ENABLE(video-nanox,
slouken@292
   566
        [  --enable-video-nanox use nanox video driver [default=no]],
slouken@292
   567
        , enable_video_nanox=no)
slouken@292
   568
    AC_ARG_ENABLE(nanox-debug,  
slouken@292
   569
        [  --enable-nanox-debug print debug messages [default=no]],
slouken@292
   570
        , enable_nanox_debug=no)
slouken@292
   571
    AC_ARG_ENABLE(nanox-share-memory,  
slouken@292
   572
        [  --enable-nanox-share-memory use share memory [default=no]],
slouken@292
   573
        , enable_nanox_share_memory=no)
slouken@471
   574
    AC_ARG_ENABLE(nanox_direct_fb, 
slouken@471
   575
        [  --enable-nanox-direct-fb use direct framebuffer access [default=no]],
slouken@471
   576
        , enable_nanox_direct_fb=no)
slouken@30
   577
slouken@292
   578
    if test x$enable_video = xyes -a x$enable_video_nanox = xyes; then
slouken@292
   579
        if test x$enable_nanox_debug = xyes; then
slouken@292
   580
            CFLAGS="$CFLAGS -DENABLE_NANOX_DEBUG"
slouken@292
   581
        fi
slouken@30
   582
slouken@292
   583
        if test x$enable_nanox_share_memory = xyes; then
slouken@292
   584
            CFLAGS="$CFLAGS -DNANOX_SHARE_MEMORY"
slouken@292
   585
        fi
slouken@30
   586
slouken@471
   587
        if test x$enable_nanox_direct_fb = xyes; then
slouken@471
   588
            CFLAGS="$CFLAGS -DENABLE_NANOX_DIRECT_FB"
slouken@471
   589
        fi
slouken@30
   590
slouken@292
   591
        CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_NANOX"
slouken@292
   592
        SYSTEM_LIBS="$SYSTEM_LIBS -lnano-X"
slouken@292
   593
        VIDEO_SUBDIRS="$VIDEO_SUBDIRS nanox"
slouken@292
   594
        VIDEO_DRIVERS="$VIDEO_DRIVERS nanox/libvideo_nanox.la"
slouken@292
   595
    fi
slouken@30
   596
}
slouken@30
   597
slouken@0
   598
dnl Find the X11 include and library directories
slouken@0
   599
CheckX11()
slouken@0
   600
{
slouken@0
   601
    AC_ARG_ENABLE(video-x11,
slouken@0
   602
[  --enable-video-x11      use X11 video driver [default=yes]],
slouken@0
   603
                  , enable_video_x11=yes)
slouken@0
   604
    if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
slouken@0
   605
        AC_PATH_X
slouken@0
   606
        AC_PATH_XTRA
slouken@0
   607
        if test x$have_x = xyes; then
slouken@690
   608
            CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_X11 -DXTHREADS -I$srcdir/include -I$srcdir/src/video"
slouken@0
   609
            if test x$ac_cv_func_shmat != xyes; then
slouken@0
   610
                CFLAGS="$CFLAGS -DNO_SHARED_MEMORY"
slouken@0
   611
            fi
slouken@0
   612
            SYSTEM_LIBS="$SYSTEM_LIBS $X_LIBS -lX11 -lXext"
slouken@0
   613
            VIDEO_SUBDIRS="$VIDEO_SUBDIRS x11"
slouken@0
   614
            VIDEO_DRIVERS="$VIDEO_DRIVERS x11/libvideo_x11.la"
slouken@0
   615
slouken@0
   616
            AC_ARG_ENABLE(video-x11-vm,
slouken@0
   617
[  --enable-video-x11-vm   use X11 VM extension for fullscreen [default=yes]],
slouken@0
   618
                          , enable_video_x11_vm=yes)
slouken@0
   619
            if test x$enable_video_x11_vm = xyes; then
slouken@0
   620
                AC_MSG_CHECKING(for XFree86 VidMode 1.0 support)
slouken@0
   621
                video_x11_vm=no
slouken@0
   622
                AC_TRY_COMPILE([
slouken@0
   623
                 #include <X11/Xlib.h>
slouken@292
   624
                 #include <XFree86/extensions/xf86vmode.h>
slouken@0
   625
                ],[
slouken@0
   626
                ],[
slouken@0
   627
                video_x11_vm=yes
slouken@0
   628
                ])
slouken@0
   629
                AC_MSG_RESULT($video_x11_vm)
slouken@0
   630
                if test x$video_x11_vm = xyes; then
slouken@0
   631
                    CFLAGS="$CFLAGS -DXFREE86_VM"
slouken@292
   632
                    VIDEO_SUBDIRS="$VIDEO_SUBDIRS XFree86/Xxf86vm"
slouken@292
   633
                    VIDEO_DRIVERS="$VIDEO_DRIVERS XFree86/Xxf86vm/libXFree86_Xxf86vm.la"
slouken@0
   634
                    AC_MSG_CHECKING(for XFree86 VidMode gamma support)
slouken@0
   635
                    video_x11_vmgamma=no
slouken@0
   636
                    AC_TRY_COMPILE([
slouken@0
   637
                     #include <X11/Xlib.h>
slouken@292
   638
                     #include <XFree86/extensions/xf86vmode.h>
slouken@0
   639
                    ],[
slouken@292
   640
                     SDL_NAME(XF86VidModeGamma) gamma;
slouken@0
   641
                    ],[
slouken@0
   642
                    video_x11_vmgamma=yes
slouken@0
   643
                    ])
slouken@0
   644
                    AC_MSG_RESULT($video_x11_vmgamma)
slouken@0
   645
                    if test x$video_x11_vmgamma = xyes; then
slouken@0
   646
                        CFLAGS="$CFLAGS -DXFREE86_VMGAMMA"
slouken@0
   647
                    fi
slouken@0
   648
                fi
slouken@0
   649
            fi
slouken@16
   650
            AC_ARG_ENABLE(dga,
slouken@16
   651
[  --enable-dga            allow use of X11 DGA code [default=yes]],
slouken@16
   652
                          , enable_dga=yes)
slouken@0
   653
            AC_ARG_ENABLE(video-x11-dgamouse,
slouken@0
   654
[  --enable-video-x11-dgamouse  use X11 DGA for mouse events [default=yes]],
slouken@0
   655
                          , enable_video_x11_dgamouse=yes)
slouken@16
   656
            if test x$enable_dga = xyes; then
slouken@16
   657
                AC_MSG_CHECKING(for XFree86 DGA 1.0 support)
slouken@16
   658
                video_x11_dga=no
slouken@16
   659
                AC_TRY_COMPILE([
slouken@16
   660
                 #include <X11/Xlib.h>
slouken@292
   661
                 #include <XFree86/extensions/xf86dga.h>
slouken@16
   662
                ],[
slouken@16
   663
                ],[
slouken@16
   664
                video_x11_dga=yes
slouken@16
   665
                ])
slouken@16
   666
                AC_MSG_RESULT($video_x11_dga)
slouken@16
   667
                if test x$video_x11_dga = xyes; then
slouken@16
   668
                    CFLAGS="$CFLAGS -DXFREE86_DGAMOUSE"
slouken@16
   669
                    if test x$enable_video_x11_dgamouse = xyes; then
slouken@16
   670
                        CFLAGS="$CFLAGS -DDEFAULT_DGAMOUSE"
slouken@16
   671
                    fi
slouken@292
   672
                    VIDEO_SUBDIRS="$VIDEO_SUBDIRS XFree86/Xxf86dga"
slouken@292
   673
                    VIDEO_DRIVERS="$VIDEO_DRIVERS XFree86/Xxf86dga/libXFree86_Xxf86dga.la"
slouken@0
   674
                fi
slouken@0
   675
            fi
slouken@0
   676
            AC_ARG_ENABLE(video-x11-xv,
slouken@0
   677
[  --enable-video-x11-xv   use X11 XvImage extension for video [default=yes]],
slouken@0
   678
                          , enable_video_x11_xv=yes)
slouken@0
   679
            if test x$enable_video_x11_xv = xyes; then
slouken@0
   680
                AC_MSG_CHECKING(for XFree86 XvImage support)
slouken@0
   681
                video_x11_xv=no
slouken@0
   682
                AC_TRY_COMPILE([
slouken@0
   683
                 #include <X11/Xlib.h>
slouken@0
   684
                 #include <sys/ipc.h>
slouken@0
   685
                 #include <sys/shm.h>
slouken@0
   686
                 #include <X11/extensions/XShm.h>
slouken@292
   687
                 #include <XFree86/extensions/Xvlib.h>
slouken@0
   688
                ],[
slouken@292
   689
                 SDL_NAME(XvImage) *image;
slouken@0
   690
                ],[
slouken@0
   691
                video_x11_xv=yes
slouken@0
   692
                ])
slouken@0
   693
                AC_MSG_RESULT($video_x11_xv)
slouken@0
   694
                if test x$video_x11_xv = xyes; then
slouken@0
   695
                    CFLAGS="$CFLAGS -DXFREE86_XV"
slouken@292
   696
                    VIDEO_SUBDIRS="$VIDEO_SUBDIRS XFree86/Xv"
slouken@292
   697
                    VIDEO_DRIVERS="$VIDEO_DRIVERS XFree86/Xv/libXFree86_Xv.la"
slouken@0
   698
                fi
slouken@0
   699
            fi
slouken@227
   700
            AC_ARG_ENABLE(video-x11-xinerama,
slouken@227
   701
[  --enable-video-x11-xinerama   enable X11 Xinerama support [default=yes]],
slouken@227
   702
                            , enable_video_x11_xinerama=yes)
slouken@227
   703
            if test x$enable_video_x11_xinerama = xyes; then
slouken@227
   704
                AC_MSG_CHECKING(for X11 Xinerama support)
slouken@227
   705
                video_x11_xinerama=no
slouken@227
   706
                AC_TRY_COMPILE([
slouken@227
   707
                 #include <X11/Xlib.h>
slouken@292
   708
                 #include <XFree86/extensions/Xinerama.h>
slouken@227
   709
                ],[
slouken@292
   710
                 SDL_NAME(XineramaScreenInfo) *xinerama;
slouken@227
   711
                ],[
slouken@227
   712
                video_x11_xinerama=yes
slouken@227
   713
                ])
slouken@227
   714
                AC_MSG_RESULT($video_x11_xinerama)
slouken@227
   715
                if test x$video_x11_xinerama = xyes; then
slouken@227
   716
                    CFLAGS="$CFLAGS -DHAVE_XINERAMA"
slouken@292
   717
                    VIDEO_SUBDIRS="$VIDEO_SUBDIRS XFree86/Xinerama"
slouken@292
   718
                    VIDEO_DRIVERS="$VIDEO_DRIVERS XFree86/Xinerama/libXFree86_Xinerama.la"
slouken@227
   719
                fi
slouken@227
   720
            fi
slouken@242
   721
            AC_ARG_ENABLE(video-x11-xme,
slouken@242
   722
[  --enable-video-x11-xme  enable Xi Graphics XME for fullscreen [default=yes]],
slouken@242
   723
                            , enable_video_x11_xme=yes)
slouken@242
   724
            if test x$enable_video_x11_xme = xyes; then
slouken@242
   725
                AC_MSG_CHECKING(for Xi Graphics XiGMiscExtension support)
slouken@242
   726
                video_x11_xme=no
slouken@242
   727
                AC_TRY_COMPILE([
slouken@242
   728
                 #include <X11/Xlib.h>
slouken@242
   729
                 #include <X11/extensions/xme.h>
slouken@242
   730
                ],[
slouken@242
   731
                 XiGMiscResolutionInfo *resolutions;
slouken@242
   732
                ],[
slouken@242
   733
                video_x11_xme=yes
slouken@242
   734
                ])
slouken@242
   735
                AC_MSG_RESULT($video_x11_xme)
slouken@242
   736
                if test x$video_x11_xme = xyes; then
slouken@242
   737
                    CFLAGS="$CFLAGS -DHAVE_XIGXME"
slouken@242
   738
                    SYSTEM_LIBS="$SYSTEM_LIBS -lxme"
slouken@242
   739
                fi
slouken@242
   740
            fi
slouken@0
   741
        fi
slouken@0
   742
    fi
slouken@0
   743
}
slouken@279
   744
icculus@1133
   745
icculus@1133
   746
dnl Check for X11 on Mac OS X / Darwin
icculus@1133
   747
CheckMacX11()
icculus@1133
   748
{
icculus@1133
   749
    AC_ARG_ENABLE(video-x11,
icculus@1133
   750
[  --enable-video-x11      use X11 video driver [default=no]],
icculus@1133
   751
                  , enable_video_x11=no)
icculus@1133
   752
    if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
icculus@1133
   753
        AC_PATH_X
icculus@1133
   754
        AC_PATH_XTRA
icculus@1133
   755
        if test x$have_x = xyes; then
icculus@1133
   756
            CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_X11 -DXTHREADS -I$srcdir/include -I$srcdir/src/video"
icculus@1133
   757
            if test x$ac_cv_func_shmat != xyes; then
icculus@1133
   758
                CFLAGS="$CFLAGS -DNO_SHARED_MEMORY"
icculus@1133
   759
            fi
icculus@1133
   760
            SYSTEM_LIBS="$SYSTEM_LIBS $X_LIBS -lX11 -lXext"
icculus@1133
   761
            VIDEO_SUBDIRS="$VIDEO_SUBDIRS x11"
icculus@1133
   762
            VIDEO_DRIVERS="$VIDEO_DRIVERS x11/libvideo_x11.la"
icculus@1133
   763
        fi
icculus@1133
   764
    fi
icculus@1133
   765
}
icculus@1133
   766
slouken@292
   767
dnl Find the X11 DGA 2.0 include and library directories
slouken@292
   768
CheckDGA()
slouken@292
   769
{
slouken@292
   770
    AC_ARG_ENABLE(video-dga,
slouken@292
   771
[  --enable-video-dga      use DGA 2.0 video driver [default=yes]],
slouken@292
   772
                  , enable_video_dga=yes)
slouken@292
   773
    if test x$video_x11_dga = xyes -a x$enable_video_dga = xyes; then
slouken@292
   774
        save_CFLAGS="$CFLAGS"; CFLAGS="$CFLAGS -Isrc/video"
slouken@292
   775
        AC_MSG_CHECKING(for XFree86 DGA 2.0 support)
slouken@292
   776
        video_x11_dga2=no
slouken@292
   777
        AC_TRY_COMPILE([
slouken@292
   778
         #include <X11/Xlib.h>
slouken@292
   779
         #include <XFree86/extensions/xf86dga.h>
slouken@292
   780
        ],[
slouken@292
   781
         SDL_NAME(XDGAEvent) xevent;
slouken@292
   782
        ],[
slouken@292
   783
        video_x11_dga2=yes
slouken@292
   784
        ])
slouken@292
   785
        AC_MSG_RESULT($video_x11_dga2)
slouken@292
   786
        if test x$video_x11_dga2 = xyes; then
slouken@292
   787
            CFLAGS="$CFLAGS -DENABLE_DGA"
slouken@292
   788
            VIDEO_SUBDIRS="$VIDEO_SUBDIRS dga"
slouken@292
   789
            VIDEO_DRIVERS="$VIDEO_DRIVERS dga/libvideo_dga.la"
slouken@292
   790
        fi
slouken@292
   791
    fi
slouken@292
   792
}
slouken@292
   793
slouken@0
   794
CheckPHOTON()
slouken@0
   795
{
slouken@0
   796
    AC_ARG_ENABLE(video-photon,
slouken@72
   797
[  --enable-video-photon   use QNX Photon video driver [default=yes]],
slouken@0
   798
                  , enable_video_photon=yes)
slouken@0
   799
    if test x$enable_video = xyes -a x$enable_video_photon = xyes; then
slouken@0
   800
        AC_MSG_CHECKING(for QNX Photon support)
slouken@0
   801
        video_photon=no
slouken@0
   802
        AC_TRY_COMPILE([
slouken@0
   803
          #include <Ph.h>
slouken@0
   804
          #include <Pt.h>
slouken@0
   805
          #include <photon/Pg.h>
slouken@0
   806
          #include <photon/PdDirect.h>
slouken@0
   807
        ],[
slouken@0
   808
         PgDisplaySettings_t *visual;
slouken@0
   809
        ],[
slouken@0
   810
        video_photon=yes
slouken@0
   811
        ])
slouken@0
   812
        AC_MSG_RESULT($video_photon)
slouken@0
   813
        if test x$video_photon = xyes; then
slouken@19
   814
            CFLAGS="$CFLAGS -DENABLE_PHOTON"
slouken@0
   815
            SYSTEM_LIBS="$SYSTEM_LIBS -lph"
slouken@0
   816
            VIDEO_SUBDIRS="$VIDEO_SUBDIRS photon"
slouken@0
   817
            VIDEO_DRIVERS="$VIDEO_DRIVERS photon/libvideo_photon.la"
slouken@279
   818
            CheckOpenGLQNX
slouken@0
   819
        fi
slouken@0
   820
    fi
slouken@0
   821
}
slouken@0
   822
slouken@0
   823
dnl Find the framebuffer console includes
slouken@0
   824
CheckFBCON()
slouken@0
   825
{
slouken@0
   826
    AC_ARG_ENABLE(video-fbcon,
slouken@0
   827
[  --enable-video-fbcon    use framebuffer console video driver [default=yes]],
slouken@0
   828
                  , enable_video_fbcon=yes)
slouken@0
   829
    if test x$enable_video = xyes -a x$enable_video_fbcon = xyes; then
slouken@0
   830
        AC_MSG_CHECKING(for framebuffer console support)
slouken@0
   831
        video_fbcon=no
slouken@0
   832
        AC_TRY_COMPILE([
slouken@0
   833
         #include <linux/fb.h>
slouken@0
   834
         #include <linux/kd.h>
slouken@0
   835
         #include <linux/keyboard.h>
slouken@0
   836
        ],[
slouken@0
   837
        ],[
slouken@0
   838
        video_fbcon=yes
slouken@0
   839
        ])
slouken@0
   840
        AC_MSG_RESULT($video_fbcon)
slouken@0
   841
        if test x$video_fbcon = xyes; then
slouken@0
   842
            CFLAGS="$CFLAGS -DENABLE_FBCON"
slouken@0
   843
            VIDEO_SUBDIRS="$VIDEO_SUBDIRS fbcon"
slouken@0
   844
            VIDEO_DRIVERS="$VIDEO_DRIVERS fbcon/libvideo_fbcon.la"
slouken@0
   845
        fi
slouken@0
   846
    fi
slouken@0
   847
}
slouken@0
   848
slouken@167
   849
dnl Find DirectFB
slouken@167
   850
CheckDirectFB()
slouken@167
   851
{
slouken@167
   852
    AC_ARG_ENABLE(video-directfb,
slouken@678
   853
[  --enable-video-directfb use DirectFB video driver [default=no]],
slouken@678
   854
                  , enable_video_directfb=no)
slouken@167
   855
    if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
slouken@167
   856
        video_directfb=no
slouken@167
   857
slouken@167
   858
        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
slouken@167
   859
        if test x$PKG_CONFIG = xno ; then
slouken@167
   860
            AC_MSG_WARN([*** pkg-config is required to build the DirectFB video driver.])
slouken@167
   861
        else
slouken@167
   862
            AC_MSG_CHECKING(for DirectFB support)
slouken@167
   863
slouken@477
   864
            if ! $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then
slouken@477
   865
                AC_MSG_ERROR([*** pkg-config too old; version 0.7 or better required.])
slouken@167
   866
            fi
slouken@167
   867
slouken@546
   868
            DIRECTFB_REQUIRED_VERSION=0.9.15
slouken@167
   869
slouken@167
   870
            if $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb ; then
slouken@167
   871
                DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
slouken@167
   872
                DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
slouken@167
   873
                video_directfb=yes
slouken@167
   874
            fi
slouken@167
   875
        fi
slouken@167
   876
slouken@167
   877
        AC_MSG_RESULT($video_directfb)
slouken@167
   878
        if test x$video_directfb = xyes; then
slouken@167
   879
            CFLAGS="$CFLAGS -DENABLE_DIRECTFB"
slouken@167
   880
            VIDEO_SUBDIRS="$VIDEO_SUBDIRS directfb"
slouken@167
   881
            VIDEO_DRIVERS="$VIDEO_DRIVERS directfb/libvideo_directfb.la"
slouken@167
   882
slouken@167
   883
            AC_SUBST(DIRECTFB_CFLAGS)
slouken@167
   884
            AC_SUBST(DIRECTFB_LIBS)
slouken@167
   885
        fi
slouken@167
   886
    fi
slouken@167
   887
}
slouken@167
   888
slouken@70
   889
dnl See if we're running on PlayStation 2 hardware
slouken@70
   890
CheckPS2GS()
slouken@70
   891
{
slouken@72
   892
    AC_ARG_ENABLE(video-ps2gs,
slouken@72
   893
[  --enable-video-ps2gs    use PlayStation 2 GS video driver [default=yes]],
slouken@72
   894
                  , enable_video_ps2gs=yes)
slouken@70
   895
    if test x$enable_video = xyes -a x$enable_video_ps2gs = xyes; then
slouken@72
   896
        AC_MSG_CHECKING(for PlayStation 2 GS support)
slouken@70
   897
        video_ps2gs=no
slouken@70
   898
        AC_TRY_COMPILE([
slouken@70
   899
         #include <linux/ps2/dev.h>
slouken@70
   900
         #include <linux/ps2/gs.h>
slouken@70
   901
        ],[
slouken@70
   902
        ],[
slouken@70
   903
        video_ps2gs=yes
slouken@70
   904
        ])
slouken@72
   905
        AC_MSG_RESULT($video_ps2gs)
slouken@70
   906
        if test x$video_ps2gs = xyes; then
slouken@70
   907
            CFLAGS="$CFLAGS -DENABLE_PS2GS"
slouken@70
   908
            VIDEO_SUBDIRS="$VIDEO_SUBDIRS ps2gs"
slouken@70
   909
            VIDEO_DRIVERS="$VIDEO_DRIVERS ps2gs/libvideo_ps2gs.la"
slouken@70
   910
        fi
slouken@70
   911
    fi
slouken@70
   912
}
slouken@70
   913
slouken@0
   914
dnl Find the GGI includes
slouken@0
   915
CheckGGI()
slouken@0
   916
{
slouken@0
   917
    AC_ARG_ENABLE(video-ggi,
slouken@0
   918
[  --enable-video-ggi      use GGI video driver [default=no]],
slouken@0
   919
                  , enable_video_ggi=no)
slouken@0
   920
    if test x$enable_video = xyes -a x$enable_video_ggi = xyes; then
slouken@0
   921
        AC_MSG_CHECKING(for GGI support)
slouken@0
   922
        video_ggi=no
slouken@0
   923
        AC_TRY_COMPILE([
slouken@0
   924
         #include <ggi/ggi.h>
slouken@0
   925
         #include <ggi/gii.h>
slouken@0
   926
        ],[
slouken@0
   927
        ],[
slouken@0
   928
        video_ggi=yes
slouken@0
   929
        ])
slouken@0
   930
        AC_MSG_RESULT($video_ggi)
slouken@0
   931
        if test x$video_ggi = xyes; then
slouken@0
   932
            CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_GGI"
slouken@0
   933
            SYSTEM_LIBS="$SYSTEM_LIBS -lggi -lgii -lgg"
slouken@0
   934
slouken@0
   935
            VIDEO_SUBDIRS="$VIDEO_SUBDIRS ggi"
slouken@0
   936
            VIDEO_DRIVERS="$VIDEO_DRIVERS ggi/libvideo_ggi.la"
slouken@0
   937
        fi
slouken@0
   938
    fi
slouken@0
   939
}
slouken@0
   940
slouken@0
   941
dnl Find the SVGAlib includes and libraries
slouken@0
   942
CheckSVGA()
slouken@0
   943
{
slouken@0
   944
    AC_ARG_ENABLE(video-svga,
slouken@0
   945
[  --enable-video-svga     use SVGAlib video driver [default=no]],
slouken@0
   946
                  , enable_video_svga=no)
slouken@0
   947
    if test x$enable_video = xyes -a x$enable_video_svga = xyes; then
slouken@0
   948
        AC_MSG_CHECKING(for SVGAlib (1.4.0+) support)
slouken@0
   949
        video_svga=no
slouken@0
   950
        AC_TRY_COMPILE([
slouken@0
   951
         #include <vga.h>
slouken@0
   952
         #include <vgamouse.h>
slouken@0
   953
         #include <vgakeyboard.h>
slouken@0
   954
        ],[
slouken@0
   955
         if ( SCANCODE_RIGHTWIN && SCANCODE_LEFTWIN ) {
slouken@0
   956
             exit(0);
slouken@0
   957
         }
slouken@0
   958
        ],[
slouken@0
   959
        video_svga=yes
slouken@0
   960
        ])
slouken@0
   961
        AC_MSG_RESULT($video_svga)
slouken@0
   962
        if test x$video_svga = xyes; then
slouken@0
   963
            CFLAGS="$CFLAGS -DENABLE_SVGALIB"
slouken@0
   964
            SYSTEM_LIBS="$SYSTEM_LIBS -lvga"
slouken@0
   965
slouken@0
   966
            VIDEO_SUBDIRS="$VIDEO_SUBDIRS svga"
slouken@0
   967
            VIDEO_DRIVERS="$VIDEO_DRIVERS svga/libvideo_svga.la"
slouken@0
   968
        fi
slouken@0
   969
    fi
slouken@0
   970
}
slouken@0
   971
slouken@75
   972
dnl Find the VGL includes and libraries
slouken@75
   973
CheckVGL()
slouken@75
   974
{
slouken@75
   975
    AC_ARG_ENABLE(video-vgl,
patmandin@651
   976
[  --enable-video-vgl      use VGL video driver [default=no]],
slouken@75
   977
                  , enable_video_vgl=no)
slouken@75
   978
    if test x$enable_video = xyes -a x$enable_video_vgl = xyes; then
slouken@75
   979
        AC_MSG_CHECKING(for libVGL support)
slouken@75
   980
        video_vgl=no
slouken@75
   981
        AC_TRY_COMPILE([
slouken@75
   982
         #include <sys/fbio.h>
slouken@75
   983
         #include <sys/consio.h>
slouken@75
   984
         #include <sys/kbio.h>
slouken@75
   985
         #include <vgl.h>
slouken@75
   986
        ],[
slouken@75
   987
         VGLBitmap bitmap;
slouken@144
   988
         exit(bitmap.Bitmap);
slouken@75
   989
        ],[
slouken@75
   990
        video_vgl=yes
slouken@75
   991
        ])
slouken@75
   992
        AC_MSG_RESULT($video_vgl)
slouken@75
   993
        if test x$video_vgl = xyes; then
slouken@75
   994
            CFLAGS="$CFLAGS -DENABLE_VGL"
slouken@75
   995
            SYSTEM_LIBS="$SYSTEM_LIBS -lvgl"
slouken@75
   996
slouken@75
   997
            VIDEO_SUBDIRS="$VIDEO_SUBDIRS vgl"
slouken@75
   998
            VIDEO_DRIVERS="$VIDEO_DRIVERS vgl/libvideo_vgl.la"
slouken@75
   999
        fi
slouken@75
  1000
    fi
slouken@75
  1001
}
slouken@75
  1002
slouken@0
  1003
dnl Find the AAlib includes
slouken@0
  1004
CheckAAlib()
slouken@0
  1005
{
slouken@0
  1006
    AC_ARG_ENABLE(video-aalib,
slouken@0
  1007
[  --enable-video-aalib    use AAlib video driver [default=no]],
slouken@0
  1008
                  , enable_video_aalib=no)
slouken@0
  1009
    if test x$enable_video = xyes -a x$enable_video_aalib = xyes; then
slouken@0
  1010
        AC_MSG_CHECKING(for AAlib support)
slouken@0
  1011
        video_aalib=no
slouken@0
  1012
        AC_TRY_COMPILE([
slouken@0
  1013
         #include <aalib.h>
slouken@0
  1014
        ],[
slouken@0
  1015
        ],[
slouken@0
  1016
        video_aalib=yes
slouken@0
  1017
        ])
slouken@0
  1018
        AC_MSG_RESULT($video_aalib)
slouken@0
  1019
        if test x$video_aalib = xyes; then
slouken@0
  1020
            CFLAGS="$CFLAGS -DENABLE_AALIB"
slouken@0
  1021
            SYSTEM_LIBS="$SYSTEM_LIBS -laa"
slouken@0
  1022
slouken@0
  1023
            VIDEO_SUBDIRS="$VIDEO_SUBDIRS aalib"
slouken@0
  1024
            VIDEO_DRIVERS="$VIDEO_DRIVERS aalib/libvideo_aa.la"
slouken@0
  1025
        fi
slouken@0
  1026
    fi
slouken@0
  1027
}
slouken@0
  1028
slouken@281
  1029
dnl Set up the Atari Xbios driver
slouken@281
  1030
CheckAtariXbiosVideo()
slouken@281
  1031
{
slouken@281
  1032
    AC_ARG_ENABLE(xbios,
slouken@281
  1033
[  --enable-video-xbios    use Atari Xbios video driver [default=yes]],
slouken@281
  1034
                  , enable_video_xbios=yes)
slouken@281
  1035
    video_xbios=no
slouken@281
  1036
    if test x$enable_video = xyes -a x$enable_video_xbios = xyes; then
slouken@281
  1037
        video_xbios=yes
slouken@281
  1038
        CFLAGS="$CFLAGS -DENABLE_XBIOS"
slouken@281
  1039
        VIDEO_SUBDIRS="$VIDEO_SUBDIRS xbios"
slouken@281
  1040
        VIDEO_DRIVERS="$VIDEO_DRIVERS xbios/libvideo_xbios.la"
slouken@281
  1041
    fi
slouken@281
  1042
}
slouken@281
  1043
slouken@281
  1044
dnl Set up the Atari Gem driver
slouken@281
  1045
CheckAtariGemVideo()
slouken@281
  1046
{
slouken@281
  1047
    AC_ARG_ENABLE(gem,
slouken@281
  1048
[  --enable-video-gem      use Atari Gem video driver [default=yes]],
slouken@281
  1049
                  , enable_video_gem=yes)
slouken@281
  1050
    if test x$enable_video = xyes -a x$enable_video_gem = xyes; then
slouken@281
  1051
        video_gem=no
slouken@281
  1052
        AC_CHECK_HEADER(gem.h, have_gem_hdr=yes)
slouken@281
  1053
        AC_CHECK_LIB(gem, appl_init, have_gem_lib=yes)
slouken@281
  1054
        if test x$have_gem_hdr = xyes -a x$have_gem_lib = xyes; then
slouken@281
  1055
            video_gem=yes
slouken@281
  1056
            CFLAGS="$CFLAGS -DENABLE_GEM"
slouken@281
  1057
            SYSTEM_LIBS="$SYSTEM_LIBS -lgem"
slouken@281
  1058
            VIDEO_SUBDIRS="$VIDEO_SUBDIRS gem"
slouken@281
  1059
            VIDEO_DRIVERS="$VIDEO_DRIVERS gem/libvideo_gem.la"
slouken@281
  1060
        fi
slouken@281
  1061
    fi
slouken@281
  1062
}
slouken@281
  1063
slouken@281
  1064
dnl Set up the Atari Bios keyboard driver
slouken@281
  1065
CheckAtariBiosEvent()
slouken@281
  1066
{
slouken@281
  1067
    CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video/ataricommon"
slouken@281
  1068
    VIDEO_SUBDIRS="$VIDEO_SUBDIRS ataricommon"
slouken@281
  1069
    VIDEO_DRIVERS="$VIDEO_DRIVERS ataricommon/libvideo_ataricommon.la"
slouken@281
  1070
}
slouken@281
  1071
slouken@1
  1072
dnl rcg04172001 Set up the Null video driver.
slouken@1
  1073
CheckDummyVideo()
slouken@1
  1074
{
slouken@1
  1075
    AC_ARG_ENABLE(video-dummy,
slouken@86
  1076
[  --enable-video-dummy    use dummy video driver [default=yes]],
slouken@86
  1077
                  , enable_video_dummy=yes)
slouken@1
  1078
    if test x$enable_video_dummy = xyes; then
slouken@1
  1079
      CFLAGS="$CFLAGS -DENABLE_DUMMYVIDEO"
slouken@1
  1080
      VIDEO_SUBDIRS="$VIDEO_SUBDIRS dummy"
slouken@1
  1081
      VIDEO_DRIVERS="$VIDEO_DRIVERS dummy/libvideo_null.la"
slouken@1
  1082
    fi
slouken@1
  1083
}
slouken@1
  1084
slouken@0
  1085
dnl Check to see if OpenGL support is desired
slouken@0
  1086
AC_ARG_ENABLE(video-opengl,
slouken@0
  1087
[  --enable-video-opengl   include OpenGL context creation [default=yes]],
slouken@0
  1088
              , enable_video_opengl=yes)
slouken@0
  1089
slouken@0
  1090
dnl Find OpenGL
slouken@0
  1091
CheckOpenGL()
slouken@0
  1092
{
slouken@0
  1093
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@0
  1094
        AC_MSG_CHECKING(for OpenGL (GLX) support)
slouken@0
  1095
        video_opengl=no
slouken@0
  1096
        AC_TRY_COMPILE([
slouken@0
  1097
         #include <GL/gl.h>
slouken@0
  1098
         #include <GL/glx.h>
slouken@0
  1099
         #include <dlfcn.h> /* For loading extensions */
slouken@0
  1100
        ],[
slouken@0
  1101
        ],[
slouken@0
  1102
        video_opengl=yes
slouken@0
  1103
        ])
slouken@0
  1104
        AC_MSG_RESULT($video_opengl)
slouken@0
  1105
        if test x$video_opengl = xyes; then
slouken@0
  1106
            CFLAGS="$CFLAGS -DHAVE_OPENGL"
slouken@296
  1107
            if test x$use_dlopen != xyes; then
slouken@296
  1108
                AC_CHECK_LIB(dl, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS -ldl")
slouken@296
  1109
            fi
slouken@0
  1110
        fi
slouken@0
  1111
    fi
slouken@0
  1112
}
slouken@0
  1113
slouken@279
  1114
dnl Find QNX RtP OpenGL
slouken@279
  1115
CheckOpenGLQNX()
slouken@279
  1116
{
slouken@279
  1117
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@279
  1118
        AC_MSG_CHECKING(for OpenGL (Photon) support)
slouken@279
  1119
        video_opengl=no
slouken@279
  1120
        AC_TRY_COMPILE([
slouken@279
  1121
         #include <GL/gl.h>
slouken@279
  1122
        ],[
slouken@279
  1123
        ],[
slouken@279
  1124
        video_opengl=yes
slouken@279
  1125
        ])
slouken@279
  1126
        AC_MSG_RESULT($video_opengl)
slouken@279
  1127
        if test x$video_opengl = xyes; then
slouken@279
  1128
            CFLAGS="$CFLAGS -DHAVE_OPENGL"
slouken@279
  1129
            SYSTEM_LIBS="$SYSTEM_LIBS -lGL"
slouken@570
  1130
            if test x$use_dlopen != xyes; then
slouken@666
  1131
                AC_CHECK_LIB(c, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS", AC_CHECK_LIB(ltdl, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS -lltdl"))
slouken@570
  1132
            fi
slouken@279
  1133
        fi
slouken@279
  1134
    fi
slouken@279
  1135
}
slouken@279
  1136
slouken@0
  1137
dnl Check for BeOS OpenGL
slouken@0
  1138
CheckBeGL()
slouken@0
  1139
{
slouken@0
  1140
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@0
  1141
        CFLAGS="$CFLAGS -DHAVE_OPENGL"
slouken@0
  1142
        SYSTEM_LIBS="$SYSTEM_LIBS -lGL"
slouken@0
  1143
    fi
slouken@0
  1144
}
slouken@0
  1145
slouken@0
  1146
dnl Check for MacOS OpenGL
slouken@0
  1147
CheckMacGL()
slouken@0
  1148
{
slouken@0
  1149
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@0
  1150
        CFLAGS="$CFLAGS -DHAVE_OPENGL"
slouken@0
  1151
        case "$target" in
slouken@0
  1152
            *-*-darwin*)
icculus@1133
  1153
                SYSTEM_LIBS="$SYSTEM_LIBS -framework OpenGL"
icculus@1133
  1154
                # The following is probably not available in Darwin:
icculus@1133
  1155
                SYSTEM_LIBS="$SYSTEM_LIBS -framework AGL"
slouken@0
  1156
        esac
slouken@0
  1157
    fi
slouken@0
  1158
}
slouken@0
  1159
patmandin@978
  1160
dnl Check for Mesa offscreen rendering
patmandin@989
  1161
CheckAtariOSMesa()
patmandin@978
  1162
{
patmandin@989
  1163
    if test "x$enable_video" = "xyes" -a "x$enable_video_opengl" = "xyes"; then
patmandin@991
  1164
        AC_CHECK_HEADER(GL/osmesa.h, have_osmesa_hdr=yes)
patmandin@991
  1165
        AC_CHECK_LIB(OSMesa, OSMesaCreateContext, have_osmesa_lib=yes, have_osmesa_lib=no, -lm)
patmandin@991
  1166
patmandin@991
  1167
        # Static linking to -lOSMesa
patmandin@989
  1168
        AC_PATH_PROG(OSMESA_CONFIG, osmesa-config, no)
patmandin@989
  1169
        if test "x$OSMESA_CONFIG" = "xno" -o "x$enable_atari_ldg" = "xno"; then
patmandin@991
  1170
            # -lOSMesa is really the static library
patmandin@989
  1171
            if test "x$have_osmesa_hdr" = "xyes" -a "x$have_osmesa_lib" = "xyes"; then
patmandin@989
  1172
    	        CFLAGS="$CFLAGS -DHAVE_OPENGL"
patmandin@989
  1173
		    	SYSTEM_LIBS="$SYSTEM_LIBS -lOSMesa"
patmandin@989
  1174
            fi
patmandin@989
  1175
        else
patmandin@991
  1176
            # -lOSMesa is a loader for OSMesa.ldg
patmandin@989
  1177
            OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags`
patmandin@989
  1178
            OSMESA_LIBS=`$OSMESA_CONFIG --libs`
patmandin@991
  1179
            CFLAGS="$CFLAGS -DHAVE_OPENGL $OSMESA_CFLAGS"
patmandin@989
  1180
            SYSTEM_LIBS="$SYSTEM_LIBS $OSMESA_LIBS"
patmandin@978
  1181
        fi
patmandin@991
  1182
patmandin@991
  1183
        AC_ARG_ENABLE(osmesa-shared,
patmandin@991
  1184
[  --enable-osmesa-shared  dynamically load OSMesa OpenGL support [default=yes]],
patmandin@991
  1185
                              , enable_osmesa_shared=yes)
patmandin@991
  1186
        if test "x$enable_osmesa_shared" = "xyes" -a "x$enable_atari_ldg" = "xyes"; then
patmandin@991
  1187
            # Dynamic linking
patmandin@991
  1188
            if test "x$have_osmesa_hdr" = "xyes"; then
patmandin@991
  1189
                CFLAGS="$CFLAGS -DENABLE_OSMESA_SHARED"
patmandin@991
  1190
            fi
patmandin@991
  1191
		fi
patmandin@978
  1192
    fi
patmandin@978
  1193
}
patmandin@978
  1194
slouken@0
  1195
dnl See if we can use the new unified event interface in Linux 2.4
slouken@0
  1196
CheckInputEvents()
slouken@0
  1197
{
slouken@0
  1198
    dnl Check for Linux 2.4 unified input event interface support
slouken@0
  1199
    AC_ARG_ENABLE(input-events,
slouken@211
  1200
[  --enable-input-events   use Linux 2.4 unified input interface [default=yes]],
slouken@211
  1201
                  , enable_input_events=yes)
slouken@0
  1202
    if test x$enable_input_events = xyes; then
slouken@0
  1203
        AC_MSG_CHECKING(for Linux 2.4 unified input interface)
slouken@0
  1204
        use_input_events=no
slouken@0
  1205
        AC_TRY_COMPILE([
slouken@0
  1206
          #include <linux/input.h>
slouken@0
  1207
        ],[
slouken@0
  1208
          #ifndef EVIOCGNAME
slouken@0
  1209
          #error EVIOCGNAME() ioctl not available
slouken@0
  1210
          #endif
slouken@0
  1211
        ],[
slouken@0
  1212
        use_input_events=yes
slouken@0
  1213
        ])
slouken@0
  1214
        AC_MSG_RESULT($use_input_events)
slouken@0
  1215
        if test x$use_input_events = xyes; then
slouken@0
  1216
            CFLAGS="$CFLAGS -DUSE_INPUT_EVENTS"
slouken@0
  1217
        fi
slouken@0
  1218
    fi
slouken@0
  1219
}
slouken@0
  1220
slouken@399
  1221
dnl See if we can use GNU pth library for threads
slouken@399
  1222
CheckPTH()
slouken@399
  1223
{
slouken@399
  1224
    dnl Check for pth support
slouken@399
  1225
    AC_ARG_ENABLE(pth,
slouken@399
  1226
[  --enable-pth            use GNU pth library for multi-threading [default=yes]],
slouken@399
  1227
                  , enable_pth=yes)
slouken@399
  1228
    if test x$enable_threads = xyes -a x$enable_pth = xyes; then
slouken@399
  1229
        AC_PATH_PROG(PTH_CONFIG, pth-config, no)
slouken@399
  1230
        if test "$PTH_CONFIG" = "no"; then
slouken@399
  1231
            use_pth=no
slouken@399
  1232
        else
slouken@399
  1233
            PTH_CFLAGS=`$PTH_CONFIG --cflags`
slouken@399
  1234
            PTH_LIBS=`$PTH_CONFIG --libs --all`
slouken@399
  1235
            SDL_CFLAGS="$SDL_CFLAGS $PTH_CFLAGS"
slouken@399
  1236
            SDL_LIBS="$SDL_LIBS $PTH_LIBS"
slouken@399
  1237
            CFLAGS="$CFLAGS -DENABLE_PTH"
slouken@399
  1238
            use_pth=yes
slouken@399
  1239
        fi
slouken@399
  1240
        AC_MSG_CHECKING(pth)
slouken@399
  1241
        if test "x$use_pth" = xyes; then
slouken@399
  1242
            AC_MSG_RESULT(yes)
slouken@399
  1243
        else
slouken@399
  1244
            AC_MSG_RESULT(no)
slouken@399
  1245
        fi
slouken@399
  1246
    fi
slouken@399
  1247
}
slouken@399
  1248
slouken@0
  1249
dnl See what type of thread model to use on Linux and Solaris
slouken@0
  1250
CheckPTHREAD()
slouken@0
  1251
{
slouken@0
  1252
    dnl Check for pthread support
slouken@0
  1253
    AC_ARG_ENABLE(pthreads,
slouken@0
  1254
[  --enable-pthreads       use POSIX threads for multi-threading [default=yes]],
slouken@0
  1255
                  , enable_pthreads=yes)
slouken@0
  1256
    dnl This is used on Linux for glibc binary compatibility (Doh!)
slouken@0
  1257
    AC_ARG_ENABLE(pthread-sem,
slouken@86
  1258
[  --enable-pthread-sem    use pthread semaphores [default=yes]],
slouken@0
  1259
                  , enable_pthread_sem=yes)
slouken@0
  1260
    case "$target" in
slouken@0
  1261
        *-*-bsdi*)
slouken@0
  1262
            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
slouken@0
  1263
            pthread_lib=""
slouken@0
  1264
            ;;
slouken@0
  1265
        *-*-darwin*)
slouken@0
  1266
            pthread_cflags="-D_THREAD_SAFE"
slouken@0
  1267
# causes Carbon.p complaints?
slouken@0
  1268
#            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
slouken@0
  1269
            ;;
slouken@0
  1270
        *-*-freebsd*)
slouken@0
  1271
            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
slouken@0
  1272
            pthread_lib="-pthread"
slouken@0
  1273
            ;;
slouken@43
  1274
        *-*-netbsd*)
slouken@43
  1275
            pthread_cflags="-I/usr/pkg/include -D_REENTRANT"
slouken@43
  1276
            pthread_lib="-L/usr/pkg/lib -lpthread -lsem"
slouken@43
  1277
            ;;
slouken@0
  1278
        *-*-openbsd*)
slouken@0
  1279
            pthread_cflags="-D_REENTRANT"
slouken@0
  1280
            pthread_lib="-pthread"
slouken@0
  1281
            ;;
slouken@0
  1282
        *-*-solaris*)
slouken@0
  1283
            pthread_cflags="-D_REENTRANT"
slouken@0
  1284
            pthread_lib="-lpthread -lposix4"
slouken@0
  1285
            ;;
slouken@0
  1286
        *-*-sysv5*)
slouken@0
  1287
            pthread_cflags="-D_REENTRANT -Kthread"
slouken@0
  1288
            pthread_lib=""
slouken@0
  1289
            ;;
slouken@0
  1290
        *-*-irix*)
slouken@0
  1291
            pthread_cflags="-D_SGI_MP_SOURCE"
slouken@0
  1292
            pthread_lib="-lpthread"
slouken@0
  1293
            ;;
slouken@0
  1294
        *-*-aix*)
slouken@0
  1295
            pthread_cflags="-D_REENTRANT -mthreads"
slouken@0
  1296
            pthread_lib="-lpthread"
slouken@0
  1297
            ;;
icculus@425
  1298
        *-*-hpux11*)
icculus@425
  1299
            pthread_cflags="-D_REENTRANT"
icculus@425
  1300
            pthread_lib="-L/usr/lib -lpthread"
icculus@425
  1301
            ;;
slouken@0
  1302
        *-*-qnx*)
slouken@0
  1303
            pthread_cflags=""
slouken@0
  1304
            pthread_lib=""
slouken@0
  1305
            ;;
slouken@873
  1306
        *-*-osf*)
slouken@1019
  1307
            pthread_cflags="-D_REENTRANT"
slouken@873
  1308
            if test x$ac_cv_prog_gcc = xyes; then
slouken@873
  1309
                pthread_lib="-lpthread -lrt"
slouken@873
  1310
            else
slouken@1019
  1311
                pthread_lib="-lpthread -lexc -lrt"
slouken@873
  1312
            fi
slouken@873
  1313
            ;;
slouken@0
  1314
        *)
slouken@0
  1315
            pthread_cflags="-D_REENTRANT"
slouken@0
  1316
            pthread_lib="-lpthread"
slouken@0
  1317
            ;;
slouken@0
  1318
    esac
slouken@0
  1319
    if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
slouken@415
  1320
        # Save the original compiler flags and libraries
slouken@415
  1321
        ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
slouken@415
  1322
        # Add the pthread compiler flags and libraries
slouken@415
  1323
        CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
slouken@415
  1324
        # Check to see if we have pthread support on this system
slouken@0
  1325
        AC_MSG_CHECKING(for pthreads)
slouken@0
  1326
        use_pthreads=no
slouken@0
  1327
        AC_TRY_LINK([
slouken@0
  1328
         #include <pthread.h>
slouken@0
  1329
        ],[
slouken@0
  1330
         pthread_attr_t type;
slouken@0
  1331
         pthread_attr_init(&type);
slouken@0
  1332
        ],[
slouken@0
  1333
        use_pthreads=yes
slouken@0
  1334
        ])
slouken@0
  1335
        AC_MSG_RESULT($use_pthreads)
slouken@415
  1336
        # Restore the compiler flags and libraries
slouken@415
  1337
        CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
slouken@415
  1338
        # Do futher testing if we have pthread support...
slouken@0
  1339
        if test x$use_pthreads = xyes; then
slouken@0
  1340
            CFLAGS="$CFLAGS $pthread_cflags -DSDL_USE_PTHREADS"
slouken@846
  1341
            LIBS="$LIBS $pthread_lib"
slouken@0
  1342
            SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
slouken@0
  1343
            SDL_LIBS="$SDL_LIBS $pthread_lib"
slouken@0
  1344
slouken@0
  1345
            # Check to see if recursive mutexes are available
slouken@0
  1346
            AC_MSG_CHECKING(for recursive mutexes)
slouken@0
  1347
            has_recursive_mutexes=no
slouken@0
  1348
            AC_TRY_LINK([
slouken@0
  1349
              #include <pthread.h>
slouken@0
  1350
            ],[
slouken@0
  1351
              pthread_mutexattr_t attr;
slouken@371
  1352
              #if defined(linux) && !(defined(__arm__) && defined(QWS))
slouken@0
  1353
              pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
slouken@0
  1354
              #else
slouken@0
  1355
              pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
slouken@0
  1356
              #endif
slouken@0
  1357
            ],[
slouken@0
  1358
            has_recursive_mutexes=yes
slouken@0
  1359
            ])
slouken@0
  1360
            # Some systems have broken recursive mutex implementations
slouken@0
  1361
            case "$target" in
slouken@399
  1362
                *-*-darwin*)
slouken@399
  1363
                    has_recursive_mutexes=no
slouken@399
  1364
                    ;;
slouken@0
  1365
                *-*-solaris*)
slouken@0
  1366
                    has_recursive_mutexes=no
slouken@0
  1367
                    ;;
slouken@0
  1368
            esac
slouken@0
  1369
            AC_MSG_RESULT($has_recursive_mutexes)
slouken@0
  1370
            if test x$has_recursive_mutexes != xyes; then
slouken@0
  1371
                CFLAGS="$CFLAGS -DPTHREAD_NO_RECURSIVE_MUTEX"
slouken@0
  1372
            fi
slouken@0
  1373
slouken@94
  1374
            # Check to see if pthread semaphore support is missing
slouken@94
  1375
            if test x$enable_pthread_sem = xyes; then
slouken@94
  1376
                AC_MSG_CHECKING(for pthread semaphores)
slouken@94
  1377
                have_pthread_sem=no
slouken@94
  1378
                AC_TRY_COMPILE([
slouken@94
  1379
                  #include <pthread.h>
slouken@94
  1380
                  #include <semaphore.h>
slouken@94
  1381
                ],[
slouken@94
  1382
                ],[
slouken@94
  1383
                have_pthread_sem=yes
slouken@94
  1384
                ])
slouken@94
  1385
                AC_MSG_RESULT($have_pthread_sem)
slouken@94
  1386
            fi
slouken@94
  1387
slouken@0
  1388
            # Check to see if this is broken glibc 2.0 pthreads
slouken@0
  1389
            case "$target" in
slouken@0
  1390
                *-*-linux*)
slouken@0
  1391
                    AC_MSG_CHECKING(for broken glibc 2.0 pthreads)
slouken@0
  1392
                    glibc20_pthreads=no
slouken@0
  1393
                    AC_TRY_COMPILE([
slouken@0
  1394
                      #include <features.h>
slouken@0
  1395
                      #if (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0)
slouken@0
  1396
                      #warning Working around a bug in glibc 2.0 pthreads
slouken@0
  1397
                      #else
slouken@0
  1398
                      #error pthread implementation okay
slouken@0
  1399
                      #endif /* glibc 2.0 */
slouken@0
  1400
                    ],[
slouken@0
  1401
                    ],[
slouken@0
  1402
                    glibc20_pthreads=yes
slouken@0
  1403
                    ])
slouken@0
  1404
                    AC_MSG_RESULT($glibc20_pthreads)
slouken@0
  1405
            esac
slouken@0
  1406
        fi
slouken@0
  1407
    fi
slouken@0
  1408
slouken@0
  1409
    AC_MSG_CHECKING(whether semun is defined in /usr/include/sys/sem.h)
slouken@0
  1410
    have_semun=no
slouken@0
  1411
    AC_TRY_COMPILE([
slouken@0
  1412
      #include <sys/types.h>
slouken@0
  1413
      #include <sys/sem.h>
slouken@0
  1414
    ],[
slouken@0
  1415
      union semun t;
slouken@0
  1416
    ],[
slouken@0
  1417
    have_semun=yes
slouken@0
  1418
    ])
slouken@0
  1419
    AC_MSG_RESULT($have_semun)
slouken@0
  1420
    if test x$have_semun = xyes; then
slouken@0
  1421
        CFLAGS="$CFLAGS -DHAVE_SEMUN"
slouken@0
  1422
    fi
slouken@0
  1423
slouken@399
  1424
    # See if we can use GNU Pth or clone() on Linux directly
slouken@0
  1425
    if test x$enable_threads = xyes -a x$use_pthreads != xyes; then
slouken@399
  1426
        CheckPTH
slouken@399
  1427
        if test x$use_pth != xyes; then
slouken@399
  1428
            case "$target" in
slouken@399
  1429
                *-*-linux*)
slouken@399
  1430
                    use_clone=yes
slouken@399
  1431
                    ;;
slouken@399
  1432
            esac
slouken@399
  1433
        fi
slouken@0
  1434
    fi
slouken@0
  1435
}
slouken@0
  1436
slouken@399
  1437
# Note that we need to have either semaphores or to have mutexes and
slouken@399
  1438
# condition variables to implement all thread synchronization primitives
slouken@399
  1439
CopyUnixThreadSource()
slouken@185
  1440
{
slouken@399
  1441
    if test x$use_pthreads = xyes -o x$use_clone = xyes; then
slouken@399
  1442
        # Basic thread creation functions
slouken@399
  1443
        COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
slouken@399
  1444
        COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
slouken@399
  1445
slouken@399
  1446
        # Semaphores
slouken@399
  1447
        # We can fake these with mutexes and condition variables if necessary
slouken@399
  1448
        if test x$use_pthreads = xyes -a x$have_pthread_sem != xyes; then
slouken@399
  1449
            COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
slouken@185
  1450
        else
slouken@399
  1451
            COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
slouken@185
  1452
        fi
slouken@399
  1453
        COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
slouken@399
  1454
slouken@399
  1455
        # Mutexes
slouken@399
  1456
        # We can fake these with semaphores if necessary
slouken@399
  1457
        case "$target" in
slouken@399
  1458
            *-*-bsdi*)
slouken@399
  1459
                COPY_ARCH_SRC(src/thread, bsdi, SDL_syssem.c)
slouken@399
  1460
                COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
slouken@599
  1461
                COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
slouken@599
  1462
                COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
slouken@399
  1463
                ;;
slouken@399
  1464
            *)
slouken@399
  1465
                if test x$glibc20_pthreads = xyes; then
slouken@399
  1466
                    COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
slouken@399
  1467
                    COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
slouken@399
  1468
                else
slouken@399
  1469
                    COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
slouken@399
  1470
                    COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
slouken@399
  1471
                fi
slouken@399
  1472
                ;;
slouken@399
  1473
        esac
slouken@399
  1474
slouken@399
  1475
        # Condition variables
slouken@399
  1476
        # We can fake these with semaphores and mutexes if necessary
slouken@399
  1477
        if test x$glibc20_pthreads = xyes -o x$has_recursive_mutexes != xyes; then
slouken@399
  1478
            COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
slouken@185
  1479
        else
slouken@399
  1480
            COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
slouken@185
  1481
        fi
slouken@399
  1482
        COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
slouken@399
  1483
slouken@400
  1484
    elif test x$use_pth = xyes; then
slouken@399
  1485
        COPY_ARCH_SRC(src/thread, pth, SDL_systhread.c)
slouken@399
  1486
        COPY_ARCH_SRC(src/thread, pth, SDL_systhread_c.h)
slouken@399
  1487
        COPY_ARCH_SRC(src/thread, pth, SDL_sysmutex.c)
slouken@399
  1488
        COPY_ARCH_SRC(src/thread, pth, SDL_sysmutex_c.h)
slouken@399
  1489
        COPY_ARCH_SRC(src/thread, pth, SDL_syscond.c)
slouken@399
  1490
        COPY_ARCH_SRC(src/thread, pth, SDL_syscond_c.h)
slouken@399
  1491
        COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
slouken@399
  1492
        COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
slouken@399
  1493
    else
slouken@399
  1494
       AC_MSG_ERROR([
slouken@399
  1495
*** No thread support detected
slouken@399
  1496
       ])
slouken@185
  1497
    fi
slouken@185
  1498
}
slouken@185
  1499
slouken@814
  1500
dnl See if we can use sigaction() instead of signal()
slouken@814
  1501
CheckSIGACTION()
slouken@814
  1502
{
slouken@814
  1503
    dnl Check for sigaction support
slouken@814
  1504
    AC_ARG_ENABLE(sigaction,
slouken@814
  1505
[  --enable-sigaction      use sigaction instead of signal [default=yes]],
slouken@814
  1506
                  , enable_sigaction=yes)
slouken@814
  1507
    if test x$enable_sigaction = xyes; then
slouken@814
  1508
        AC_MSG_CHECKING(sigaction)
slouken@814
  1509
        have_sigaction=no
slouken@814
  1510
        AC_TRY_COMPILE([
slouken@814
  1511
         #include <signal.h>
slouken@814
  1512
        ],[
slouken@814
  1513
         struct sigaction junk;
slouken@814
  1514
         sigaction(0, &junk, &junk);
slouken@814
  1515
        ],[
slouken@814
  1516
        have_sigaction=yes
slouken@814
  1517
        ])
slouken@814
  1518
        AC_MSG_RESULT($have_sigaction)
slouken@814
  1519
        if test x$have_sigaction = xyes; then
slouken@814
  1520
            CFLAGS="$CFLAGS -DHAVE_SIGACTION"
slouken@814
  1521
        fi
slouken@814
  1522
    fi
slouken@814
  1523
}
slouken@814
  1524
slouken@0
  1525
dnl Determine whether the compiler can produce Win32 executables
slouken@0
  1526
CheckWIN32()
slouken@0
  1527
{
slouken@0
  1528
    AC_MSG_CHECKING(Win32 compiler)
slouken@0
  1529
    have_win32_gcc=no
slouken@0
  1530
    AC_TRY_COMPILE([
slouken@0
  1531
     #include <windows.h>
slouken@0
  1532
    ],[
slouken@0
  1533
    ],[
slouken@0
  1534
    have_win32_gcc=yes
slouken@0
  1535
    ])
slouken@0
  1536
    AC_MSG_RESULT($have_win32_gcc)
slouken@0
  1537
    if test x$have_win32_gcc != xyes; then
slouken@0
  1538
       AC_MSG_ERROR([
slouken@0
  1539
*** Your compiler ($CC) does not produce Win32 executables!
slouken@0
  1540
       ])
slouken@0
  1541
    fi
slouken@0
  1542
slouken@0
  1543
    dnl See if the user wants to redirect standard output to files
slouken@0
  1544
    AC_ARG_ENABLE(stdio-redirect,
slouken@0
  1545
[  --enable-stdio-redirect Redirect STDIO to files on Win32 [default=yes]],
slouken@0
  1546
                  , enable_stdio_redirect=yes)
slouken@0
  1547
    if test x$enable_stdio_redirect != xyes; then
slouken@0
  1548
        CFLAGS="$CFLAGS -DNO_STDIO_REDIRECT"
slouken@0
  1549
    fi
slouken@0
  1550
}
slouken@0
  1551
slouken@0
  1552
dnl Find the DirectX includes and libraries
slouken@0
  1553
CheckDIRECTX()
slouken@0
  1554
{
slouken@0
  1555
    AC_ARG_ENABLE(directx,
slouken@0
  1556
[  --enable-directx        use DirectX for Win32 audio/video [default=yes]],
slouken@0
  1557
                  , enable_directx=yes)
slouken@0
  1558
    if test x$enable_directx = xyes; then
slouken@0
  1559
        AC_MSG_CHECKING(for DirectX headers and libraries)
slouken@0
  1560
        use_directx=no
patmandin@780
  1561
        tmp_cflags=$CFLAGS
patmandin@780
  1562
        CFLAGS="$CFLAGS -I$srcdir"
slouken@0
  1563
        AC_TRY_COMPILE([
slouken@0
  1564
         #include "src/video/windx5/directx.h"
slouken@0
  1565
        ],[
slouken@0
  1566
        ],[
slouken@0
  1567
        use_directx=yes
slouken@0
  1568
        ])
patmandin@780
  1569
        CFLAGS=$tmp_cflags
slouken@0
  1570
        AC_MSG_RESULT($use_directx)
slouken@0
  1571
    fi
slouken@0
  1572
slouken@0
  1573
    CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video/wincommon"
slouken@0
  1574
    SYSTEM_LIBS="$SYSTEM_LIBS -luser32 -lgdi32 -lwinmm"
slouken@0
  1575
    VIDEO_SUBDIRS="$VIDEO_SUBDIRS wincommon"
slouken@0
  1576
    VIDEO_DRIVERS="$VIDEO_DRIVERS wincommon/libvideo_wincommon.la"
slouken@0
  1577
    # Enable the DIB driver
slouken@0
  1578
    CFLAGS="$CFLAGS -DENABLE_WINDIB"
slouken@0
  1579
    VIDEO_SUBDIRS="$VIDEO_SUBDIRS windib"
slouken@0
  1580
    VIDEO_DRIVERS="$VIDEO_DRIVERS windib/libvideo_windib.la"
slouken@0
  1581
    # See if we should enable the DirectX driver
slouken@0
  1582
    if test x$use_directx = xyes; then
slouken@0
  1583
        CFLAGS="$CFLAGS -DENABLE_DIRECTX"
slouken@0
  1584
        SYSTEM_LIBS="$SYSTEM_LIBS -ldxguid"
slouken@0
  1585
        VIDEO_SUBDIRS="$VIDEO_SUBDIRS windx5"
slouken@0
  1586
        VIDEO_DRIVERS="$VIDEO_DRIVERS windx5/libvideo_windx5.la"
slouken@0
  1587
    fi
slouken@0
  1588
}
slouken@0
  1589
slouken@0
  1590
dnl Set up the BWindow video driver on BeOS
slouken@0
  1591
CheckBWINDOW()
slouken@0
  1592
{
slouken@0
  1593
    CFLAGS="$CFLAGS -DENABLE_BWINDOW"
slouken@0
  1594
    VIDEO_SUBDIRS="$VIDEO_SUBDIRS bwindow"
slouken@0
  1595
    VIDEO_DRIVERS="$VIDEO_DRIVERS bwindow/libvideo_bwindow.la"
slouken@0
  1596
}
slouken@0
  1597
slouken@371
  1598
dnl Set up the QTopia video driver if enabled
slouken@371
  1599
CheckQtopia()
slouken@371
  1600
{
slouken@371
  1601
    AC_ARG_ENABLE(video-qtopia,
slouken@371
  1602
[  --enable-video-qtopia   use Qtopia video driver [default=no]],
slouken@371
  1603
                  , enable_video_qtopia=no)
slouken@371
  1604
    if test x$enable_video = xyes -a x$enable_video_qtopia = xyes; then
slouken@371
  1605
        AC_MSG_CHECKING(for Qtopia support)
slouken@371
  1606
        video_qtopia=no
slouken@371
  1607
        AC_LANG_CPLUSPLUS
slouken@371
  1608
        OLD_CXX="$CXXFLAGS"
slouken@371
  1609
        CXXFLAGS="-DQT_QWS_EBX -fno-rtti -fno-exceptions -DQT_QWS_CUSTOM -DQWS -I${QPEDIR}/include -I${QTDIR}/include/ -DNO_DEBUG"
slouken@371
  1610
        AC_TRY_COMPILE([
slouken@371
  1611
         #include <qpe/qpeapplication.h>
slouken@371
  1612
        ],[
slouken@371
  1613
        ],[
slouken@371
  1614
        video_qtopia=yes
slouken@371
  1615
        ])
slouken@371
  1616
        CXXFLAGS="$OLD_CXX"
slouken@371
  1617
        AC_MSG_RESULT($video_qtopia)
slouken@371
  1618
        if test x$video_qtopia = xyes; then
slouken@371
  1619
            CFLAGS="$CFLAGS -DENABLE_QTOPIA -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -I${QPEDIR}/include -I${QTDIR}/include/ -DNO_DEBUG -fno-rtti -fno-exceptions"
slouken@378
  1620
            SDL_LIBS="$SDL_LIBS -L${QPEDIR}/lib -L${QTDIR}/lib/ -lqpe -lqte"
slouken@567
  1621
            SDL_CFLAGS="$SDL_CFLAGS -DQWS"	  
slouken@371
  1622
            VIDEO_SUBDIRS="$VIDEO_SUBDIRS qtopia"
slouken@371
  1623
            VIDEO_DRIVERS="$VIDEO_DRIVERS qtopia/libvideo_qtopia.la"
slouken@567
  1624
        else
slouken@567
  1625
	AC_MSG_ERROR([
slouken@567
  1626
*** Failed to find Qtopia includes. Make sure that the QTDIR and QPEDIR
slouken@567
  1627
*** environment variables are set correctly.])
slouken@371
  1628
        fi
slouken@371
  1629
        AC_LANG_C
slouken@371
  1630
    fi
slouken@371
  1631
}
slouken@371
  1632
slouken@433
  1633
dnl Set up the PicoGUI video driver if enabled
slouken@433
  1634
CheckPicoGUI()
slouken@433
  1635
{
slouken@433
  1636
    AC_ARG_ENABLE(video-picogui,
slouken@433
  1637
[  --enable-video-picogui  use PicoGUI video driver [default=no]],
slouken@433
  1638
                  , enable_video_picogui=no)
slouken@433
  1639
    if test x$enable_video = xyes -a x$enable_video_picogui = xyes; then
slouken@433
  1640
        AC_MSG_CHECKING(for PicoGUI support)
slouken@433
  1641
        video_picogui=no
slouken@433
  1642
        AC_TRY_COMPILE([
slouken@433
  1643
         #include <picogui.h>
slouken@433
  1644
        ],[
slouken@433
  1645
        ],[
slouken@433
  1646
        video_picogui=yes
slouken@433
  1647
        ])
slouken@433
  1648
        AC_MSG_RESULT($video_picogui)
slouken@433
  1649
        if test x$video_picogui = xyes; then
slouken@433
  1650
	    SDL_LIBS="$SDL_LIBS -lpgui"
slouken@433
  1651
            CFLAGS="$CFLAGS -DENABLE_PICOGUI"
slouken@433
  1652
            VIDEO_SUBDIRS="$VIDEO_SUBDIRS picogui"
slouken@433
  1653
            VIDEO_DRIVERS="$VIDEO_DRIVERS picogui/libvideo_picogui.la"
slouken@433
  1654
        fi
slouken@433
  1655
        AC_LANG_C
slouken@433
  1656
    fi
slouken@433
  1657
}
slouken@433
  1658
slouken@0
  1659
dnl Set up the Mac toolbox video driver for Mac OS 7-9
slouken@0
  1660
CheckTOOLBOX()
slouken@0
  1661
{
icculus@1133
  1662
    CFLAGS="$CFLAGS -DENABLE_TOOLBOX -DENABLE_DRAWSPROCKET"
slouken@0
  1663
    VIDEO_SUBDIRS="$VIDEO_SUBDIRS maccommon"
slouken@0
  1664
    VIDEO_DRIVERS="$VIDEO_DRIVERS maccommon/libvideo_maccommon.la"
slouken@0
  1665
    VIDEO_SUBDIRS="$VIDEO_SUBDIRS macrom"
slouken@0
  1666
    VIDEO_DRIVERS="$VIDEO_DRIVERS macrom/libvideo_macrom.la"
icculus@1133
  1667
    VIDEO_SUBDIRS="$VIDEO_SUBDIRS macdsp"
icculus@1133
  1668
    VIDEO_DRIVERS="$VIDEO_DRIVERS macdsp/libvideo_macdsp.la"
slouken@0
  1669
}
slouken@0
  1670
icculus@1133
  1671
dnl Set up the Carbon/QuickDraw video driver for Mac OS X (but not Darwin)
slouken@0
  1672
CheckCARBON()
slouken@0
  1673
{
icculus@1133
  1674
    AC_ARG_ENABLE(video-carbon,
icculus@1133
  1675
[  --enable-video-carbon   use Carbon/QuickDraw video driver [default=no]],
icculus@1133
  1676
                  , enable_video_carbon=no)
icculus@1133
  1677
  if test x$enable_video = xyes -a x$enable_video_carbon = xyes; then
icculus@1133
  1678
    AC_MSG_CHECKING(for Carbon framework)
icculus@1133
  1679
    have_carbon=no
icculus@1133
  1680
    if test x$have_carbon != xyes; then
icculus@1133
  1681
        AC_TRY_COMPILE([
icculus@1133
  1682
          #include <Carbon/Carbon.h>
icculus@1133
  1683
        ],[
icculus@1133
  1684
        ],[
icculus@1133
  1685
        have_carbon=yes
icculus@1133
  1686
        ])
icculus@1133
  1687
    fi
icculus@1133
  1688
    AC_MSG_RESULT($have_carbon)
icculus@1133
  1689
    if test x$have_carbon = xyes; then
slouken@0
  1690
    # "MACOSX" is not an official definition, but it's commonly
slouken@0
  1691
    # accepted as a way to differentiate between what runs on X
slouken@0
  1692
    # and what runs on older Macs - while in theory "Carbon" defns
slouken@0
  1693
    # are consistent between the two, in practice Carbon is still
slouken@0
  1694
    # changing. -sts Aug 2000
slouken@0
  1695
    mac_autoconf_target_workaround="MAC"
slouken@0
  1696
    CFLAGS="$CFLAGS -I/System/Library/Frameworks/Carbon.framework/Headers \
slouken@0
  1697
      -fpascal-strings -DENABLE_TOOLBOX -DMACOSX -DTARGET_API_${mac_autoconf_target_workaround}_CARBON=1 -I\$(top_srcdir)/src/video/maccommon -I\$(top_srcdir)/src/video/macrom -I\$(top_srcdir)/src/video/macdsp"
slouken@0
  1698
    VIDEO_SUBDIRS="$VIDEO_SUBDIRS maccommon"
slouken@0
  1699
    VIDEO_DRIVERS="$VIDEO_DRIVERS maccommon/libvideo_maccommon.la"
slouken@0
  1700
    VIDEO_SUBDIRS="$VIDEO_SUBDIRS macrom"
slouken@0
  1701
    VIDEO_DRIVERS="$VIDEO_DRIVERS macrom/libvideo_macrom.la"
icculus@1133
  1702
    #VIDEO_SUBDIRS="$VIDEO_SUBDIRS macdsp"
icculus@1133
  1703
    #VIDEO_DRIVERS="$VIDEO_DRIVERS macdsp/libvideo_macdsp.la"
icculus@1133
  1704
    fi
icculus@1133
  1705
  fi
slouken@0
  1706
}
slouken@0
  1707
icculus@1133
  1708
dnl Set up the Cocoa/Quartz video driver for Mac OS X (but not Darwin)
icculus@1133
  1709
CheckCOCOA()
slouken@158
  1710
{
icculus@1133
  1711
    AC_ARG_ENABLE(video-cocoa,
icculus@1133
  1712
[  --enable-video-cocoa    use Cocoa/Quartz video driver [default=yes]],
icculus@1133
  1713
                  , enable_video_cocoa=yes)
icculus@1133
  1714
  if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
icculus@1133
  1715
    old_CFLAGS="$CFLAGS"
icculus@1133
  1716
    dnl work around that we don't have Objective-C support in autoconf
icculus@1133
  1717
    CFLAGS="$CFLAGS -x objective-c"
icculus@1133
  1718
    AC_MSG_CHECKING(for Cocoa framework)
icculus@1133
  1719
    have_cocoa=no
icculus@1133
  1720
    if test x$have_cocoa != xyes; then
icculus@1133
  1721
        AC_TRY_COMPILE([
icculus@1133
  1722
          #import <Cocoa/Cocoa.h>
icculus@1133
  1723
        ],[
icculus@1133
  1724
        ],[
icculus@1133
  1725
        have_cocoa=yes
icculus@1133
  1726
        ])
icculus@1133
  1727
    fi
icculus@1133
  1728
    AC_MSG_RESULT($have_cocoa)
icculus@1133
  1729
    CFLAGS="$old_CFLAGS"
icculus@1133
  1730
    if test x$have_cocoa = xyes; then
slouken@158
  1731
    # "MACOSX" is not an official definition, but it's commonly
slouken@158
  1732
    # accepted as a way to differentiate between what runs on X
slouken@158
  1733
    # and what runs on older Macs - while in theory "Carbon" defns
slouken@158
  1734
    # are consistent between the two, in practice Carbon is still
slouken@158
  1735
    # changing. -sts Aug 2000
slouken@166
  1736
    mac_autoconf_target_workaround="MAC"
slouken@158
  1737
    CFLAGS="$CFLAGS -I/System/Library/Frameworks/Carbon.framework/Headers \
slouken@158
  1738
      -I/System/Library/Frameworks/Cocoa.framework/Headers -fpascal-strings \
slouken@166
  1739
      -DENABLE_QUARTZ -DMACOSX -DTARGET_API_${mac_autoconf_target_workaround}_CARBON=1 -I\$(top_srcdir)/src/video/quartz"
slouken@158
  1740
    VIDEO_SUBDIRS="$VIDEO_SUBDIRS quartz"
slouken@158
  1741
    VIDEO_DRIVERS="$VIDEO_DRIVERS quartz/libvideo_quartz.la"
icculus@1133
  1742
    fi
icculus@1133
  1743
  fi
slouken@158
  1744
}
slouken@158
  1745
slouken@294
  1746
dnl Check for the dlfcn.h interface for dynamically loading objects
slouken@294
  1747
CheckDLOPEN()
slouken@294
  1748
{
slouken@731
  1749
    AC_ARG_ENABLE(sdl-dlopen,
slouken@731
  1750
[  --enable-sdl-dlopen     use dlopen for shared object loading [default=yes]],
slouken@731
  1751
                  , enable_sdl_dlopen=yes)
slouken@731
  1752
    if test x$enable_sdl_dlopen = xyes; then
slouken@294
  1753
        AC_MSG_CHECKING(for dlopen)
slouken@294
  1754
        use_dlopen=no
slouken@294
  1755
        AC_TRY_COMPILE([
slouken@294
  1756
         #include <dlfcn.h>
slouken@294
  1757
        ],[
slouken@294
  1758
        ],[
slouken@294
  1759
        use_dlopen=yes
slouken@294
  1760
        ])
slouken@294
  1761
        AC_MSG_RESULT($use_dlopen)
slouken@294
  1762
slouken@294
  1763
        if test x$use_dlopen = xyes; then
slouken@294
  1764
            CFLAGS="$CFLAGS -DUSE_DLOPEN"
slouken@753
  1765
            AC_CHECK_LIB(c, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS",
slouken@753
  1766
               AC_CHECK_LIB(dl, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS -ldl",
slouken@753
  1767
                  AC_CHECK_LIB(ltdl, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS -lltdl")))
slouken@294
  1768
        fi
slouken@294
  1769
    fi
slouken@294
  1770
}
slouken@294
  1771
patmandin@651
  1772
dnl Set up the Atari LDG (shared object loader)
patmandin@651
  1773
CheckAtariLdg()
patmandin@651
  1774
{
patmandin@651
  1775
    AC_ARG_ENABLE(atari-ldg,
patmandin@651
  1776
[  --enable-atari-ldg      use Atari LDG for shared object loading [default=yes]],
patmandin@651
  1777
                  , enable_atari_ldg=yes)
patmandin@651
  1778
    if test x$video_gem = xyes -a x$enable_atari_ldg = xyes; then
patmandin@651
  1779
        AC_CHECK_HEADER(ldg.h, have_ldg_hdr=yes)
patmandin@651
  1780
        AC_CHECK_LIB(ldg, ldg_open, have_ldg_lib=yes, have_ldg_lib=no, -lgem)
patmandin@651
  1781
        if test x$have_ldg_hdr = xyes -a x$have_ldg_lib = xyes; then
patmandin@651
  1782
            CFLAGS="$CFLAGS -DENABLE_LDG"
patmandin@824
  1783
            SYSTEM_LIBS="$SYSTEM_LIBS -lldg -lgem"
patmandin@651
  1784
        fi
patmandin@651
  1785
    fi
patmandin@651
  1786
}
patmandin@651
  1787
slouken@381
  1788
dnl Check for the usbhid(3) library on *BSD
slouken@381
  1789
CheckUSBHID()
slouken@381
  1790
{
slouken@381
  1791
    if test x$enable_joystick = xyes; then
slouken@381
  1792
        have_libusbhid=no
slouken@381
  1793
        have_libusb=no
slouken@381
  1794
        AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
slouken@381
  1795
        AC_CHECK_LIB(usb, hid_init, have_libusb=yes)
slouken@381
  1796
        if test x$have_libusbhid = xyes; then
slouken@381
  1797
            SYSTEM_LIBS="$SYSTEM_LIBS -lusbhid"
slouken@381
  1798
        fi
slouken@381
  1799
        if test x$have_libusb = xyes; then
slouken@381
  1800
            SYSTEM_LIBS="$SYSTEM_LIBS -lusb"
slouken@381
  1801
        fi
slouken@381
  1802
slouken@403
  1803
        AC_CHECK_HEADER(usb.h, have_usb_h=yes)
slouken@381
  1804
        AC_CHECK_HEADER(usbhid.h, have_usbhid_h=yes)
slouken@381
  1805
        AC_CHECK_HEADER(libusb.h, have_libusb_h=yes)
slouken@381
  1806
        AC_CHECK_HEADER(libusbhid.h, have_libusbhid_h=yes)
slouken@403
  1807
        if test x$have_usb_h = xyes; then
slouken@403
  1808
            CFLAGS="$CFLAGS -DHAVE_USB_H"
slouken@403
  1809
        fi
slouken@381
  1810
        if test x$have_usbhid_h = xyes; then
slouken@381
  1811
            CFLAGS="$CFLAGS -DHAVE_USBHID_H"
slouken@381
  1812
        fi
slouken@381
  1813
        if test x$have_libusb_h = xyes; then
slouken@381
  1814
            CFLAGS="$CFLAGS -DHAVE_LIBUSB_H"
slouken@381
  1815
        fi
slouken@381
  1816
        if test x$have_libusbhid_h = xyes; then
slouken@381
  1817
            CFLAGS="$CFLAGS -DHAVE_LIBUSBHID_H"
slouken@381
  1818
        fi
slouken@381
  1819
slouken@381
  1820
        AC_MSG_CHECKING(for usbhid)
slouken@381
  1821
        have_usbhid=no
slouken@381
  1822
        AC_TRY_COMPILE([
slouken@404
  1823
          #include <sys/types.h>
slouken@403
  1824
          #if defined(HAVE_USB_H)
slouken@403
  1825
          #include <usb.h>
slouken@403
  1826
          #endif
slouken@381
  1827
          #include <dev/usb/usb.h>
slouken@381
  1828
          #include <dev/usb/usbhid.h>
slouken@381
  1829
          #if defined(HAVE_USBHID_H)
slouken@381
  1830
          #include <usbhid.h>
slouken@381
  1831
          #elif defined(HAVE_LIBUSB_H)
slouken@381
  1832
          #include <libusb.h>
slouken@381
  1833
          #elif defined(HAVE_LIBUSBHID_H)
slouken@381
  1834
          #include <libusbhid.h>
slouken@404
  1835
          #endif
slouken@381
  1836
        ],[
slouken@381
  1837
          struct report_desc *repdesc;
slouken@381
  1838
          struct usb_ctl_report *repbuf;
slouken@402
  1839
          hid_kind_t hidkind;
slouken@381
  1840
        ],[
slouken@381
  1841
        have_usbhid=yes
slouken@381
  1842
        ])
slouken@381
  1843
        AC_MSG_RESULT($have_usbhid)
slouken@381
  1844
slouken@381
  1845
        if test x$have_usbhid = xyes; then
slouken@381
  1846
            AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
slouken@381
  1847
            have_usbhid_ucr_data=no
slouken@381
  1848
            AC_TRY_COMPILE([
slouken@404
  1849
              #include <sys/types.h>
slouken@404
  1850
              #if defined(HAVE_USB_H)
slouken@404
  1851
              #include <usb.h>
slouken@404
  1852
              #endif
slouken@381
  1853
              #include <dev/usb/usb.h>
slouken@381
  1854
              #include <dev/usb/usbhid.h>
slouken@381
  1855
              #if defined(HAVE_USBHID_H)
slouken@381
  1856
              #include <usbhid.h>
slouken@381
  1857
              #elif defined(HAVE_LIBUSB_H)
slouken@381
  1858
              #include <libusb.h>
slouken@381
  1859
              #elif defined(HAVE_LIBUSBHID_H)
slouken@381
  1860
              #include <libusbhid.h>
slouken@381
  1861
              #endif
slouken@381
  1862
            ],[
slouken@381
  1863
              struct usb_ctl_report buf;
slouken@381
  1864
              if (buf.ucr_data) { }
slouken@381
  1865
            ],[
slouken@381
  1866
            have_usbhid_ucr_data=yes
slouken@381
  1867
            ])
slouken@381
  1868
            if test x$have_usbhid_ucr_data = xyes; then
slouken@381
  1869
                CFLAGS="$CFLAGS -DUSBHID_UCR_DATA"
slouken@381
  1870
            fi
slouken@381
  1871
            AC_MSG_RESULT($have_usbhid_ucr_data)
slouken@407
  1872
            
slouken@407
  1873
	    AC_MSG_CHECKING(for new usbhid API)
slouken@407
  1874
            have_usbhid_new=no
slouken@407
  1875
            AC_TRY_COMPILE([
slouken@407
  1876
              #include <sys/types.h>
slouken@407
  1877
              #if defined(HAVE_USB_H)
slouken@407
  1878
              #include <usb.h>
slouken@407
  1879
              #endif
slouken@407
  1880
              #include <dev/usb/usb.h>
slouken@407
  1881
              #include <dev/usb/usbhid.h>
slouken@407
  1882
              #if defined(HAVE_USBHID_H)
slouken@407
  1883
              #include <usbhid.h>
slouken@407
  1884
              #elif defined(HAVE_LIBUSB_H)
slouken@407
  1885
              #include <libusb.h>
slouken@407
  1886
              #elif defined(HAVE_LIBUSBHID_H)
slouken@407
  1887
              #include <libusbhid.h>
slouken@407
  1888
              #endif
slouken@407
  1889
            ],[
slouken@407
  1890
              report_desc_t d;
slouken@407
  1891
	      hid_start_parse(d, 1, 1);
slouken@407
  1892
            ],[
slouken@407
  1893
            have_usbhid_new=yes
slouken@407
  1894
            ])
slouken@407
  1895
            if test x$have_usbhid_new = xyes; then
slouken@407
  1896
                CFLAGS="$CFLAGS -DUSBHID_NEW"
slouken@407
  1897
            fi
slouken@407
  1898
            AC_MSG_RESULT($have_usbhid_new)
slouken@381
  1899
slouken@381
  1900
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS bsd"
slouken@381
  1901
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS bsd/libjoystick_bsd.la"
slouken@381
  1902
        fi
slouken@381
  1903
    fi
slouken@381
  1904
}
slouken@381
  1905
slouken@795
  1906
dnl Check for altivec instruction support using gas syntax
slouken@795
  1907
CheckAltivec()
slouken@795
  1908
{
slouken@795
  1909
    AC_MSG_CHECKING(for GCC Altivec instruction support)
slouken@795
  1910
    have_gcc_altivec=no
icculus@1047
  1911
    save_CFLAGS="${CFLAGS}"
icculus@1047
  1912
    CFLAGS="${CFLAGS} -DGCC_ALTIVEC -DUSE_ALTIVEC_BLITTERS -faltivec"
slouken@795
  1913
    AC_TRY_COMPILE([
icculus@1047
  1914
    vector unsigned int vzero() {
icculus@1047
  1915
        return vec_splat_u32(0);
icculus@1047
  1916
    }
slouken@795
  1917
    ],[
slouken@795
  1918
    ],[
slouken@795
  1919
    have_gcc_altivec=yes
slouken@795
  1920
    ])
icculus@1047
  1921
    if test x$have_gcc_altivec = xno; then
icculus@1047
  1922
        CFLAGS="${save_CFLAGS}"
slouken@795
  1923
    fi
slouken@795
  1924
    AC_MSG_RESULT($have_gcc_altivec)
slouken@795
  1925
}
slouken@795
  1926
slouken@1062
  1927
dnl Check for a valid linux/version.h
slouken@1062
  1928
CheckLinuxVersion()
slouken@1062
  1929
{
slouken@1062
  1930
    AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
slouken@1062
  1931
    if test x$have_linux_version_h = xyes; then
slouken@1062
  1932
        CFLAGS="$CFLAGS -DHAVE_LINUX_VERSION_H"
slouken@1062
  1933
    fi
slouken@1062
  1934
}
slouken@1062
  1935
slouken@1127
  1936
dnl Check if we want to use RPATH
slouken@1127
  1937
CheckRPATH()
slouken@1127
  1938
{
slouken@1127
  1939
    AC_ARG_ENABLE(rpath,
slouken@1127
  1940
[  --enable-rpath          use an rpath when linking SDL [default=yes]],
slouken@1127
  1941
                  , enable_rpath=yes)
slouken@1127
  1942
}
slouken@1127
  1943
slouken@0
  1944
case "$target" in
slouken@719
  1945
    *-*-linux*|*-*-gnu*|*-*-k*bsd*-gnu)
slouken@719
  1946
        case "$target" in
slouken@795
  1947
          *-*-linux*) ARCH=linux ;;
slouken@795
  1948
          *-*-kfreebsd*-gnu) ARCH=kfreebsd-gnu ;;
slouken@795
  1949
          *-*-knetbsd*-gnu) ARCH=knetbsd-gnu ;;
slouken@795
  1950
          *-*-kopenbsd*-gnu) ARCH=kopenbsd-gnu ;;
slouken@795
  1951
          *-*-gnu*) ARCH=gnu ;; # must be last
slouken@795
  1952
        esac
slouken@1
  1953
        CheckDummyVideo
slouken@68
  1954
        CheckDiskAudio
slouken@371
  1955
        CheckDLOPEN
slouken@0
  1956
        CheckNASM
slouken@0
  1957
        CheckOSS
slouken@0
  1958
        CheckALSA
slouken@0
  1959
        CheckARTSC
slouken@0
  1960
        CheckESD
slouken@0
  1961
        CheckNAS
slouken@0
  1962
        CheckX11
slouken@30
  1963
        CheckNANOX
slouken@0
  1964
        CheckDGA
slouken@0
  1965
        CheckFBCON
slouken@167
  1966
        CheckDirectFB
slouken@70
  1967
        CheckPS2GS
slouken@0
  1968
        CheckGGI
slouken@0
  1969
        CheckSVGA
slouken@0
  1970
        CheckAAlib
slouken@371
  1971
        CheckQtopia
slouken@433
  1972
        CheckPicoGUI
slouken@0
  1973
        CheckOpenGL
slouken@0
  1974
        CheckInputEvents
slouken@0
  1975
        CheckPTHREAD
slouken@814
  1976
        CheckSIGACTION
slouken@795
  1977
        CheckAltivec
slouken@1062
  1978
        CheckLinuxVersion
slouken@1127
  1979
        CheckRPATH
slouken@1062
  1980
slouken@0
  1981
        # Set up files for the main() stub
slouken@371
  1982
        if test "x$video_qtopia" = "xyes"; then
slouken@371
  1983
          SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
slouken@371
  1984
          SDL_LIBS="-lSDLmain $SDL_LIBS"
slouken@371
  1985
        fi
slouken@0
  1986
        # Set up files for the audio library
slouken@0
  1987
        # We use the OSS and ALSA API's, not the Sun audio API
slouken@0
  1988
        #if test x$enable_audio = xyes; then
slouken@148
  1989
        #    CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
slouken@0
  1990
        #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
slouken@0
  1991
        #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
slouken@0
  1992
        #fi
slouken@0
  1993
        # Set up files for the joystick library
slouken@0
  1994
        if test x$enable_joystick = xyes; then
slouken@719
  1995
	  case $ARCH in
slouken@719
  1996
	    linux)
slouken@719
  1997
              JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS linux"
slouken@719
  1998
              JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS linux/libjoystick_linux.la"
slouken@719
  1999
	    ;;
slouken@719
  2000
	    gnu)
slouken@719
  2001
              JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
slouken@719
  2002
              JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
slouken@719
  2003
	    ;;
slouken@719
  2004
	    k*bsd-gnu)
slouken@719
  2005
              JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS bsd"
slouken@719
  2006
              JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS bsd/libjoystick_bsd.la"
slouken@719
  2007
	    ;;
slouken@719
  2008
	  esac
slouken@0
  2009
        fi
slouken@0
  2010
        # Set up files for the cdrom library
slouken@0
  2011
        if test x$enable_cdrom = xyes; then
slouken@719
  2012
	  case $ARCH in
slouken@719
  2013
	    linux)
slouken@719
  2014
              CDROM_SUBDIRS="$CDROM_SUBDIRS linux"
slouken@719
  2015
              CDROM_DRIVERS="$CDROM_DRIVERS linux/libcdrom_linux.la"
slouken@719
  2016
	    ;;
slouken@719
  2017
	    gnu)
slouken@719
  2018
              CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
slouken@719
  2019
              CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
slouken@719
  2020
	    ;;
slouken@719
  2021
	    kfreebsd-gnu)
slouken@719
  2022
              CDROM_SUBDIRS="$CDROM_SUBDIRS freebsd"
slouken@719
  2023
              CDROM_DRIVERS="$CDROM_DRIVERS freebsd/libcdrom_freebsd.la"
slouken@719
  2024
	    ;;
slouken@719
  2025
	    knetbsd-gnu|kopenbsd-gnu)
slouken@719
  2026
              CDROM_SUBDIRS="$CDROM_SUBDIRS openbsd"
slouken@719
  2027
              CDROM_DRIVERS="$CDROM_DRIVERS openbsd/libcdrom_openbsd.la"
slouken@719
  2028
	    ;;
slouken@719
  2029
	  esac
slouken@0
  2030
        fi
slouken@0
  2031
        # Set up files for the thread library
slouken@0
  2032
        if test x$enable_threads = xyes; then
slouken@399
  2033
            CopyUnixThreadSource
slouken@0
  2034
        fi
slouken@0
  2035
        # Set up files for the timer library
slouken@0
  2036
        if test x$enable_timers = xyes; then
slouken@0
  2037
            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
slouken@0
  2038
        fi
slouken@0
  2039
        ;;
slouken@0
  2040
    *-*-bsdi*)
slouken@0
  2041
        ARCH=bsdi
slouken@1
  2042
        CheckDummyVideo
slouken@68
  2043
        CheckDiskAudio
slouken@371
  2044
        CheckDLOPEN
slouken@0
  2045
        CheckNASM
slouken@0
  2046
        CheckOSS
slouken@35
  2047
        CheckARTSC
slouken@35
  2048
        CheckESD
slouken@0
  2049
        CheckNAS
slouken@0
  2050
        CheckX11
slouken@0
  2051
        CheckDGA
slouken@0
  2052
        CheckSVGA
slouken@0
  2053
        CheckAAlib
slouken@0
  2054
        CheckOpenGL
slouken@0
  2055
        CheckPTHREAD
slouken@814
  2056
        CheckSIGACTION
slouken@1127
  2057
        CheckRPATH
slouken@148
  2058
        # Set up files for the audio library
slouken@148
  2059
        # We use the OSS and ALSA API's, not the Sun audio API
slouken@148
  2060
        #if test x$enable_audio = xyes; then
slouken@148
  2061
        #    CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
slouken@148
  2062
        #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
slouken@148
  2063
        #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
slouken@148
  2064
        #fi
slouken@0
  2065
        # Set up files for the joystick library
slouken@0
  2066
        # (No joystick support yet)
slouken@0
  2067
        if test x$enable_joystick = xyes; then
slouken@0
  2068
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
slouken@0
  2069
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
slouken@0
  2070
        fi
slouken@0
  2071
        # Set up files for the cdrom library
slouken@0
  2072
        if test x$enable_cdrom = xyes; then
slouken@178
  2073
            CDROM_SUBDIRS="$CDROM_SUBDIRS bsdi"
slouken@178
  2074
            CDROM_DRIVERS="$CDROM_DRIVERS bsdi/libcdrom_bsdi.la"
slouken@0
  2075
        fi
slouken@0
  2076
        # Set up files for the thread library
slouken@0
  2077
        if test x$enable_threads = xyes; then
slouken@399
  2078
            CopyUnixThreadSource
slouken@0
  2079
        fi
slouken@0
  2080
        # Set up files for the timer library
slouken@0
  2081
        if test x$enable_timers = xyes; then
slouken@0
  2082
            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
slouken@0
  2083
        fi
slouken@0
  2084
        ;;
slouken@0
  2085
    *-*-freebsd*)
slouken@0
  2086
        ARCH=freebsd
slouken@1
  2087
        CheckDummyVideo
slouken@68
  2088
        CheckDiskAudio
slouken@371
  2089
        CheckDLOPEN
slouken@129
  2090
        CheckVGL
slouken@0
  2091
        CheckNASM
slouken@0
  2092
        CheckOSS
slouken@0
  2093
        CheckARTSC
slouken@0
  2094
        CheckESD
slouken@0
  2095
        CheckNAS
slouken@0
  2096
        CheckX11
slouken@0
  2097
        CheckDGA
slouken@0
  2098
        CheckSVGA
slouken@0
  2099
        CheckAAlib
slouken@0
  2100
        CheckOpenGL
slouken@0
  2101
        CheckPTHREAD
slouken@814
  2102
        CheckSIGACTION
slouken@381
  2103
        CheckUSBHID
slouken@1127
  2104
        CheckRPATH
slouken@0
  2105
        # Set up files for the audio library
slouken@0
  2106
        # We use the OSS and ALSA API's, not the Sun audio API
slouken@0
  2107
        #if test x$enable_audio = xyes; then
slouken@148
  2108
        #    CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
slouken@0
  2109
        #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
slouken@0
  2110
        #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
slouken@0
  2111
        #fi
slouken@0
  2112
        # Set up files for the cdrom library
slouken@0
  2113
        if test x$enable_cdrom = xyes; then
slouken@153
  2114
            CDROM_SUBDIRS="$CDROM_SUBDIRS freebsd"
slouken@153
  2115
            CDROM_DRIVERS="$CDROM_DRIVERS freebsd/libcdrom_freebsd.la"
slouken@0
  2116
        fi
slouken@0
  2117
        # Set up files for the thread library
slouken@0
  2118
        if test x$enable_threads = xyes; then
slouken@399
  2119
            CopyUnixThreadSource
slouken@0
  2120
        fi
slouken@0
  2121
        # Set up files for the timer library
slouken@0
  2122
        if test x$enable_timers = xyes; then
slouken@0
  2123
            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
slouken@0
  2124
        fi
slouken@0
  2125
        ;;
slouken@0
  2126
    *-*-netbsd*)
slouken@0
  2127
        ARCH=netbsd
slouken@1
  2128
        CheckDummyVideo
slouken@68
  2129
        CheckDiskAudio
slouken@371
  2130
        CheckDLOPEN
slouken@0
  2131
        CheckNASM
slouken@0
  2132
        CheckOSS
slouken@0
  2133
        CheckARTSC
slouken@0
  2134
        CheckESD
slouken@0
  2135
        CheckNAS
slouken@0
  2136
        CheckX11
slouken@0
  2137
        CheckAAlib
slouken@0
  2138
        CheckOpenGL
slouken@0
  2139
        CheckPTHREAD
slouken@814
  2140
        CheckSIGACTION
slouken@381
  2141
        CheckUSBHID
slouken@1127
  2142
        CheckRPATH
slouken@0
  2143
        # Set up files for the audio library
slouken@0
  2144
        if test x$enable_audio = xyes; then
slouken@148
  2145
            CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
slouken@0
  2146
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
slouken@0
  2147
            AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
slouken@0
  2148
        fi
slouken@0
  2149
        # Set up files for the cdrom library
slouken@0
  2150
        if test x$enable_cdrom = xyes; then
slouken@153
  2151
            CDROM_SUBDIRS="$CDROM_SUBDIRS openbsd"
slouken@153
  2152
            CDROM_DRIVERS="$CDROM_DRIVERS openbsd/libcdrom_openbsd.la"
slouken@0
  2153
        fi
slouken@0
  2154
        # Set up files for the thread library
slouken@0
  2155
        if test x$enable_threads = xyes; then
slouken@401
  2156
            if test x$use_pthreads = xyes; then
slouken@401
  2157
                CFLAGS="$CFLAGS -D_POSIX_THREAD_SYSCALL_SOFT=1"
slouken@401
  2158
            fi
slouken@399
  2159
            CopyUnixThreadSource
slouken@0
  2160
        fi
slouken@0
  2161
        # Set up files for the timer library
slouken@0
  2162
        if test x$enable_timers = xyes; then
slouken@0
  2163
            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
slouken@0
  2164
        fi
slouken@0
  2165
        # NetBSD does not define "unix"
slouken@401
  2166
        CFLAGS="$CFLAGS -Dunix"
slouken@0
  2167
        ;;
slouken@0
  2168
    *-*-openbsd*)
slouken@0
  2169
        ARCH=openbsd
slouken@1
  2170
        CheckDummyVideo
slouken@68
  2171
        CheckDiskAudio
slouken@371
  2172
        CheckDLOPEN
slouken@0
  2173
        CheckNASM
slouken@0
  2174
        CheckOSS
slouken@0
  2175
        CheckARTSC
slouken@0
  2176
        CheckESD
slouken@0
  2177
        CheckNAS
slouken@0
  2178
        CheckX11
slouken@0
  2179
        CheckAAlib
slouken@0
  2180
        CheckOpenGL
slouken@0
  2181
        CheckPTHREAD
slouken@814
  2182
        CheckSIGACTION
slouken@381
  2183
        CheckUSBHID
slouken@1127
  2184
        CheckRPATH
slouken@0
  2185
        # Set up files for the audio library
slouken@360
  2186
        if test x$enable_audio = xyes; then
slouken@360
  2187
            CFLAGS="$CFLAGS -DOPENBSD_AUDIO_SUPPORT"
slouken@360
  2188
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS openbsd"
slouken@360
  2189
            AUDIO_DRIVERS="$AUDIO_DRIVERS openbsd/libaudio_openbsd.la"
slouken@360
  2190
        fi
slouken@94
  2191
        # OpenBSD needs linking with ossaudio emulation library
slouken@94
  2192
        if test x$have_oss = xyes; then
slouken@94
  2193
            SYSTEM_LIBS="$SYSTEM_LIBS -lossaudio"
slouken@94
  2194
        fi
slouken@0
  2195
        # Set up files for the cdrom library
slouken@0
  2196
        if test x$enable_cdrom = xyes; then
slouken@153
  2197
            CDROM_SUBDIRS="$CDROM_SUBDIRS openbsd"
slouken@153
  2198
            CDROM_DRIVERS="$CDROM_DRIVERS openbsd/libcdrom_openbsd.la"
slouken@0
  2199
        fi
slouken@0
  2200
        # Set up files for the thread library
slouken@0
  2201
        if test x$enable_threads = xyes; then
slouken@399
  2202
            CopyUnixThreadSource
slouken@0
  2203
        fi
slouken@0
  2204
        # Set up files for the timer library
slouken@0
  2205
        if test x$enable_timers = xyes; then
slouken@0
  2206
            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
slouken@0
  2207
        fi
slouken@37
  2208
        # OpenBSD does not define "unix"
slouken@37
  2209
        CFLAGS="$CFLAGS -Dunix"
slouken@0
  2210
        ;;
slouken@0
  2211
    *-*-sysv5*)
slouken@0
  2212
        ARCH=sysv5
slouken@1
  2213
        CheckDummyVideo
slouken@68
  2214
        CheckDiskAudio
slouken@371
  2215
        CheckDLOPEN
slouken@0
  2216
        CheckNASM
slouken@0
  2217
        CheckOSS
slouken@0
  2218
        CheckARTSC
slouken@0
  2219
        CheckESD
slouken@0
  2220
        CheckNAS
slouken@0
  2221
        CheckX11
slouken@0
  2222
        CheckAAlib
slouken@0
  2223
        CheckOpenGL
slouken@0
  2224
        CheckPTHREAD
slouken@814
  2225
        CheckSIGACTION
slouken@1127
  2226
        CheckRPATH
slouken@0
  2227
        # Set up files for the audio library
slouken@0
  2228
        if test x$enable_audio = xyes; then
slouken@148
  2229
            CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
slouken@0
  2230
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
slouken@0
  2231
            AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
slouken@0
  2232
        fi
slouken@0
  2233
        # Set up files for the joystick library
slouken@0
  2234
        # (No joystick support yet)
slouken@0
  2235
        if test x$enable_joystick = xyes; then
slouken@0
  2236
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
slouken@0
  2237
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
slouken@0
  2238
        fi
slouken@0
  2239
        # Set up files for the cdrom library
slouken@0
  2240
        if test x$enable_cdrom = xyes; then
slouken@153
  2241
            CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
slouken@153
  2242
            CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
slouken@0
  2243
        fi
slouken@0
  2244
        # Set up files for the thread library
slouken@0
  2245
        if test x$enable_threads = xyes; then
slouken@399
  2246
            CopyUnixThreadSource
slouken@0
  2247
        fi
slouken@0
  2248
        # Set up files for the timer library
slouken@0
  2249
        if test x$enable_timers = xyes; then
slouken@0
  2250
            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
slouken@0
  2251
        fi
slouken@0
  2252
        ;;
slouken@0
  2253
    *-*-solaris*)
slouken@0
  2254
        ARCH=solaris
slouken@1
  2255
        CFLAGS="$CFLAGS -D__ELF__" # Fix for nasm on Solaris x86
slouken@1
  2256
        CheckDummyVideo
slouken@68
  2257
        CheckDiskAudio
slouken@371
  2258
        CheckDLOPEN
slouken@0
  2259
        CheckNASM
slouken@35
  2260
        CheckOSS
slouken@0
  2261
        CheckARTSC
slouken@0
  2262
        CheckESD
slouken@0
  2263
        CheckNAS
slouken@0
  2264
        CheckX11
slouken@0
  2265
        CheckAAlib
slouken@0
  2266
        CheckOpenGL
slouken@0
  2267
        CheckPTHREAD
slouken@814
  2268
        CheckSIGACTION
slouken@1127
  2269
        CheckRPATH
slouken@0
  2270
        # Set up files for the audio library
slouken@0
  2271
        if test x$enable_audio = xyes; then
slouken@148
  2272
            CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
slouken@0
  2273
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
slouken@0
  2274
            AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
slouken@0
  2275
        fi
slouken@0
  2276
        # Set up files for the joystick library
slouken@0
  2277
        # (No joystick support yet)
slouken@0
  2278
        if test x$enable_joystick = xyes; then
slouken@0
  2279
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
slouken@0
  2280
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
slouken@0
  2281
        fi
slouken@0
  2282
        # Set up files for the cdrom library
slouken@0
  2283
        if test x$enable_cdrom = xyes; then
slouken@153
  2284
            CDROM_SUBDIRS="$CDROM_SUBDIRS linux"
slouken@153
  2285
            CDROM_DRIVERS="$CDROM_DRIVERS linux/libcdrom_linux.la"
slouken@0
  2286
        fi
slouken@0
  2287
        # Set up files for the thread library
slouken@0
  2288
        if test x$enable_threads = xyes; then
slouken@399
  2289
            CopyUnixThreadSource
slouken@0
  2290
        fi
slouken@0
  2291
        # Set up files for the timer library
slouken@0
  2292
        if test x$enable_timers = xyes; then
slouken@0
  2293
            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
slouken@0
  2294
        fi
slouken@0
  2295
        ;;
slouken@0
  2296
    *-*-irix*)
slouken@0
  2297
        ARCH=irix
slouken@1
  2298
        CheckDummyVideo
slouken@68
  2299
        CheckDiskAudio
slouken@371
  2300
        CheckDLOPEN
slouken@148
  2301
        CheckDMEDIA
slouken@148
  2302
        CheckESD
slouken@0
  2303
        CheckNAS
slouken@0
  2304
        CheckX11
slouken@0
  2305
        CheckAAlib
slouken@0
  2306
        CheckOpenGL
slouken@0
  2307
        CheckPTHREAD
slouken@814
  2308
        CheckSIGACTION
slouken@148
  2309
        # We use the dmedia audio API, not the Sun audio API
slouken@148
  2310
        #if test x$enable_audio = xyes; then
slouken@148
  2311
        #    CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
slouken@148
  2312
        #    AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
slouken@148
  2313
        #    AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
slouken@148
  2314
        #fi
slouken@0
  2315
        # Set up files for the joystick library
slouken@0
  2316
        # (No joystick support yet)
slouken@0
  2317
        if test x$enable_joystick = xyes; then
slouken@0
  2318
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
slouken@0
  2319
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
slouken@0
  2320
        fi
slouken@0
  2321
        # Set up files for the cdrom library
slouken@0
  2322
        # (No CD-ROM support yet)
slouken@0
  2323
        if test x$enable_cdrom = xyes; then
slouken@153
  2324
            CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
slouken@153
  2325
            CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
slouken@0
  2326
        fi
slouken@0
  2327
        # Set up files for the thread library
slouken@0
  2328
        if test x$enable_threads = xyes; then
slouken@399
  2329
            if test x$use_pthreads = xyes -o x$use_pth = xyes; then
slouken@399
  2330
                CopyUnixThreadSource
slouken@0
  2331
            else
slouken@0
  2332
                COPY_ARCH_SRC(src/thread, irix, SDL_systhread.c)
slouken@0
  2333
                COPY_ARCH_SRC(src/thread, irix, SDL_systhread_c.h)
slouken@0
  2334
                COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
slouken@0
  2335
                COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
slouken@0
  2336
                COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
slouken@0
  2337
                COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
slouken@0
  2338
                COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
slouken@0
  2339
                COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
slouken@0
  2340
            fi
slouken@0
  2341
        fi
slouken@0
  2342
        # Set up files for the timer library
slouken@0
  2343
        if test x$enable_timers = xyes; then
slouken@0
  2344
            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
slouken@0
  2345
        fi
slouken@0
  2346
        ;;
slouken@0
  2347
    *-*-hpux*)
slouken@0
  2348
        ARCH=hpux
slouken@1
  2349
        CheckDummyVideo
slouken@68
  2350
        CheckDiskAudio
slouken@371
  2351
        CheckDLOPEN
slouken@35
  2352
        CheckOSS
slouken@0
  2353
        CheckNAS
slouken@0
  2354
        CheckX11
slouken@0
  2355
        CheckGGI
slouken@0
  2356
        CheckAAlib
slouken@0
  2357
        CheckOpenGL
slouken@0
  2358
        CheckPTHREAD
slouken@814
  2359
        CheckSIGACTION
slouken@0
  2360
        # Set up files for the audio library
slouken@0
  2361
        if test x$enable_audio = xyes; then
slouken@148
  2362
            CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
slouken@0
  2363
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
slouken@0
  2364
            AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
slouken@0
  2365
        fi
slouken@0
  2366
        # Set up files for the joystick library
slouken@0
  2367
        # (No joystick support yet)
slouken@0
  2368
        if test x$enable_joystick = xyes; then
slouken@0
  2369
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
slouken@0
  2370
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
slouken@0
  2371
        fi
slouken@0
  2372
        # Set up files for the cdrom library
slouken@0
  2373
        # (No CD-ROM support yet)
slouken@0
  2374
        if test x$enable_cdrom = xyes; then
slouken@153
  2375
            CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
slouken@153
  2376
            CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
slouken@0
  2377
        fi
slouken@0
  2378
        # Set up files for the thread library
slouken@0
  2379
        if test x$enable_threads = xyes; then
slouken@399
  2380
            CopyUnixThreadSource
slouken@0
  2381
        fi
slouken@0
  2382
        # Set up files for the timer library
slouken@0
  2383
        if test x$enable_timers = xyes; then
slouken@0
  2384
            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
slouken@0
  2385
        fi
slouken@0
  2386
        ;;
slouken@0
  2387
    *-*-aix*)
slouken@0
  2388
        ARCH=aix
slouken@1
  2389
        CheckDummyVideo
slouken@68
  2390
        CheckDiskAudio
slouken@371
  2391
        CheckDLOPEN
slouken@35
  2392
        CheckOSS
slouken@0
  2393
        CheckNAS
slouken@0
  2394
        CheckX11
slouken@0
  2395
        CheckGGI
slouken@0
  2396
        CheckAAlib
slouken@0
  2397
        CheckOpenGL
slouken@0
  2398
        CheckPTHREAD
slouken@814
  2399
        CheckSIGACTION
slouken@0
  2400
        # Set up files for the audio library
slouken@0
  2401
        if test x$enable_audio = xyes; then
slouken@0
  2402
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS paudio"
slouken@0
  2403
            AUDIO_DRIVERS="$AUDIO_DRIVERS paudio/libaudio_paudio.la"
slouken@0
  2404
        fi
slouken@0
  2405
        # Set up files for the joystick library
slouken@0
  2406
        # (No joystick support yet)
slouken@0
  2407
        if test x$enable_joystick = xyes; then
slouken@0
  2408
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
slouken@0
  2409
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
slouken@0
  2410
        fi
slouken@0
  2411
        # Set up files for the cdrom library
slouken@0
  2412
        if test x$enable_cdrom = xyes; then
slouken@153
  2413
            CDROM_SUBDIRS="$CDROM_SUBDIRS aix"
slouken@153
  2414
            CDROM_DRIVERS="$CDROM_DRIVERS aix/libcdrom_aix.la"
slouken@0
  2415
        fi
slouken@0
  2416
        # Set up files for the thread library
slouken@0
  2417
        if test x$enable_threads = xyes; then
slouken@399
  2418
            CopyUnixThreadSource
slouken@0
  2419
        fi
slouken@0
  2420
        # Set up files for the timer library
slouken@0
  2421
        if test x$enable_timers = xyes; then
slouken@0
  2422
            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
slouken@0
  2423
        fi
slouken@0
  2424
        ;;
slouken@0
  2425
    *-*-osf*)
slouken@0
  2426
        ARCH=osf
slouken@1
  2427
        CheckDummyVideo
slouken@68
  2428
        CheckDiskAudio
slouken@371
  2429
        CheckDLOPEN
slouken@0
  2430
        CheckNAS
slouken@0
  2431
        CheckX11
slouken@0
  2432
        CheckGGI
slouken@0
  2433
        CheckAAlib
slouken@0
  2434
        CheckOpenGL
slouken@0
  2435
        CheckPTHREAD
slouken@814
  2436
        CheckSIGACTION
slouken@0
  2437
        # Set up files for the audio library
slouken@0
  2438
        if test x$enable_audio = xyes; then
slouken@654
  2439
            CFLAGS="$CFLAGS -I/usr/include/mme -DMMEAUDIO_SUPPORT"
slouken@654
  2440
            SYSTEM_LIBS="$SYSTEM_LIBS -lmme"
slouken@654
  2441
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS mme"
slouken@654
  2442
            AUDIO_DRIVERS="$AUDIO_DRIVERS mme/libaudio_mme.la"
slouken@0
  2443
        fi
slouken@0
  2444
        # Set up files for the joystick library
slouken@0
  2445
        # (No joystick support yet)
slouken@0
  2446
        if test x$enable_joystick = xyes; then
slouken@0
  2447
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
slouken@0
  2448
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
slouken@0
  2449
        fi
slouken@0
  2450
        # Set up files for the cdrom library
slouken@0
  2451
        # (No cdrom support yet)
slouken@0
  2452
        if test x$enable_cdrom = xyes; then
slouken@654
  2453
            CDROM_SUBDIRS="$CDROM_SUBDIRS osf"
slouken@654
  2454
            CDROM_DRIVERS="$CDROM_DRIVERS osf/libcdrom_osf.la"
slouken@0
  2455
        fi
slouken@0
  2456
        # Set up files for the thread library
slouken@0
  2457
        if test x$enable_threads = xyes; then
slouken@399
  2458
            CopyUnixThreadSource
slouken@0
  2459
        fi
slouken@0
  2460
        # Set up files for the timer library
slouken@0
  2461
        if test x$enable_timers = xyes; then
slouken@0
  2462
            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
slouken@0
  2463
        fi
slouken@0
  2464
        ;;
slouken@0
  2465
    *-*-qnx*)
slouken@0
  2466
        ARCH=qnx
slouken@1
  2467
        CheckDummyVideo
slouken@68
  2468
        CheckDiskAudio
slouken@886
  2469
        # CheckNASM
slouken@371
  2470
        CheckDLOPEN
slouken@0
  2471
        CheckNAS
slouken@0
  2472
        CheckPHOTON
slouken@0
  2473
        CheckX11
slouken@0
  2474
        CheckOpenGL
slouken@0
  2475
        CheckPTHREAD
slouken@814
  2476
        CheckSIGACTION
slouken@0
  2477
        # Set up files for the audio library
slouken@0
  2478
        if test x$enable_audio = xyes; then
slouken@666
  2479
            CFLAGS="$CFLAGS -DQNXNTOAUDIO_SUPPORT"
slouken@0
  2480
            SYSTEM_LIBS="$SYSTEM_LIBS -lasound"
slouken@0
  2481
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS nto"
slouken@0
  2482
            AUDIO_DRIVERS="$AUDIO_DRIVERS nto/libaudio_nto.la"
slouken@0
  2483
        fi
slouken@0
  2484
        # Set up files for the joystick library
slouken@0
  2485
        if test x$enable_joystick = xyes; then
slouken@0
  2486
        # (No joystick support yet)
slouken@0
  2487
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy"
slouken@0
  2488
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la"
slouken@0
  2489
        fi
slouken@0
  2490
        # Set up files for the cdrom library
slouken@0
  2491
        if test x$enable_cdrom = xyes; then
slouken@153
  2492
            CDROM_SUBDIRS="$CDROM_SUBDIRS qnx"
slouken@153
  2493
            CDROM_DRIVERS="$CDROM_DRIVERS qnx/libcdrom_qnx.la"
slouken@0
  2494
        fi
slouken@0
  2495
        # Set up files for the thread library
slouken@0
  2496
        if test x$enable_threads = xyes; then
slouken@399
  2497
            CopyUnixThreadSource
slouken@0
  2498
        fi
slouken@0
  2499
        # Set up files for the timer library
slouken@0
  2500
        if test x$enable_timers = xyes; then
slouken@0
  2501
            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
slouken@0
  2502
        fi
slouken@0
  2503
        ;;
slouken@0
  2504
    *-*-cygwin* | *-*-mingw32*)
slouken@0
  2505
        ARCH=win32
slouken@0
  2506
        if test "$build" != "$target"; then # cross-compiling
slouken@0
  2507
            # Default cross-compile location
slouken@0
  2508
            ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc
slouken@0
  2509
        else
slouken@0
  2510
            # Look for the location of the tools and install there
slouken@750
  2511
            if test "$BUILD_PREFIX" != ""; then
slouken@1
  2512
                ac_default_prefix=$BUILD_PREFIX
slouken@1
  2513
            fi
slouken@0
  2514
        fi
slouken@1
  2515
        CheckDummyVideo
slouken@68
  2516
        CheckDiskAudio
slouken@0
  2517
        CheckWIN32
slouken@0
  2518
        CheckDIRECTX
slouken@0
  2519
        CheckNASM
slouken@0
  2520
        # Set up files for the audio library
slouken@0
  2521
        if test x$enable_audio = xyes; then
slouken@0
  2522
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS windib"
slouken@0
  2523
            AUDIO_DRIVERS="$AUDIO_DRIVERS windib/libaudio_windib.la"
slouken@0
  2524
            if test x$use_directx = xyes; then
slouken@41
  2525
                AUDIO_SUBDIRS="$AUDIO_SUBDIRS windx5"
slouken@41
  2526
                AUDIO_DRIVERS="$AUDIO_DRIVERS windx5/libaudio_windx5.la"
slouken@0
  2527
            fi
slouken@0
  2528
        fi
slouken@0
  2529
        # Set up files for the joystick library
slouken@0
  2530
        if test x$enable_joystick = xyes; then
slouken@0
  2531
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS win32"
slouken@0
  2532
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS win32/libjoystick_winmm.la"
slouken@0
  2533
        fi
slouken@0
  2534
        # Set up files for the cdrom library
slouken@0
  2535
        if test x$enable_cdrom = xyes; then
slouken@153
  2536
            CDROM_SUBDIRS="$CDROM_SUBDIRS win32"
slouken@153
  2537
            CDROM_DRIVERS="$CDROM_DRIVERS win32/libcdrom_win32.la"
slouken@0
  2538
        fi
slouken@0
  2539
        # Set up files for the thread library
slouken@0
  2540
        if test x$enable_threads = xyes; then
slouken@0
  2541
            COPY_ARCH_SRC(src/thread, win32, SDL_systhread.c)
slouken@0
  2542
            COPY_ARCH_SRC(src/thread, win32, SDL_systhread_c.h)
slouken@0
  2543
            COPY_ARCH_SRC(src/thread, win32, SDL_sysmutex.c)
slouken@0
  2544
            COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
slouken@0
  2545
            COPY_ARCH_SRC(src/thread, win32, SDL_syssem.c)
slouken@0
  2546
            COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
slouken@0
  2547
            COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
slouken@0
  2548
            COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
slouken@0
  2549
        fi
slouken@0
  2550
        # Set up files for the timer library
slouken@0
  2551
        if test x$enable_timers = xyes; then
slouken@0
  2552
            COPY_ARCH_SRC(src/timer, win32, SDL_systimer.c)
slouken@0
  2553
        fi
slouken@0
  2554
        # The Win32 platform requires special setup
slouken@0
  2555
        SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
slouken@1
  2556
        case "$target" in
slouken@1
  2557
            *-*-cygwin*)
slouken@263
  2558
                CFLAGS="$CFLAGS -I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin"
slouken@263
  2559
                SDL_CFLAGS="$SDL_CFLAGS -I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin"
slouken@1
  2560
                LIBS="$LIBS -mno-cygwin"
slouken@1
  2561
                SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows -mno-cygwin"
slouken@1
  2562
                ;;
slouken@1
  2563
            *-*-mingw32*)
slouken@1
  2564
                SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
slouken@1
  2565
                ;;
slouken@1
  2566
        esac
slouken@0
  2567
        ;;
slouken@0
  2568
    *-*-beos*)
slouken@0
  2569
        ARCH=beos
slouken@0
  2570
        ac_default_prefix=/boot/develop/tools/gnupro
slouken@1
  2571
        CheckDummyVideo
slouken@68
  2572
        CheckDiskAudio
slouken@0
  2573
        CheckNASM
slouken@0
  2574
        CheckBWINDOW
slouken@0
  2575
        CheckBeGL
slouken@0
  2576
        # Set up files for the audio library
slouken@0
  2577
        if test x$enable_audio = xyes; then
slouken@0
  2578
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS baudio"
slouken@0
  2579
            AUDIO_DRIVERS="$AUDIO_DRIVERS baudio/libaudio_baudio.la"
slouken@0
  2580
        fi
slouken@0
  2581
        # Set up files for the joystick library
slouken@0
  2582
        if test x$enable_joystick = xyes; then
slouken@0
  2583
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS beos"
slouken@0
  2584
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS beos/libjoystick_beos.la"
slouken@0
  2585
        fi
slouken@0
  2586
        # Set up files for the cdrom library
slouken@0
  2587
        if test x$enable_cdrom = xyes; then
slouken@153
  2588
            CDROM_SUBDIRS="$CDROM_SUBDIRS beos"
slouken@153
  2589
            CDROM_DRIVERS="$CDROM_DRIVERS beos/libcdrom_beos.la"
slouken@0
  2590
        fi
slouken@0
  2591
        # Set up files for the thread library
slouken@0
  2592
        if test x$enable_threads = xyes; then
slouken@0
  2593
            COPY_ARCH_SRC(src/thread, beos, SDL_systhread.c)
slouken@0
  2594
            COPY_ARCH_SRC(src/thread, beos, SDL_systhread_c.h)
slouken@0
  2595
            COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
slouken@0
  2596
            COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
slouken@0
  2597
            COPY_ARCH_SRC(src/thread, beos, SDL_syssem.c)
slouken@0
  2598
            COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
slouken@0
  2599
            COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
slouken@0
  2600
            COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
slouken@0
  2601
        fi
slouken@0
  2602
        # Set up files for the timer library
slouken@0
  2603
        if test x$enable_timers = xyes; then
slouken@0
  2604
            COPY_ARCH_SRC(src/timer, beos, SDL_systimer.c)
slouken@0
  2605
        fi
slouken@0
  2606
        # The BeOS platform requires special libraries
slouken@0
  2607
        SYSTEM_LIBS="$SYSTEM_LIBS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
slouken@0
  2608
        ;;
slouken@0
  2609
    *-*-macos*)
slouken@0
  2610
        # This would be used if cross-compiling to MacOS 9.  No way to
slouken@0
  2611
        # use it at present, but Apple is working on a X-to-9 compiler
slouken@0
  2612
        # for which this case would be handy.
slouken@0
  2613
        ARCH=macos
slouken@1
  2614
        CheckDummyVideo
slouken@68
  2615
        CheckDiskAudio
slouken@0
  2616
        CheckTOOLBOX
slouken@0
  2617
        CheckMacGL
slouken@0
  2618
        # Set up files for the audio library
slouken@0
  2619
        if test x$enable_audio = xyes; then
slouken@0
  2620
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS macrom"
slouken@0
  2621
            AUDIO_DRIVERS="$AUDIO_DRIVERS macrom/libaudio_macrom.la"
slouken@0
  2622
        fi
slouken@0
  2623
        # Set up files for the joystick library
slouken@0
  2624
        if test x$enable_joystick = xyes; then
slouken@0
  2625
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS macos"
slouken@0
  2626
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS macos/libjoystick_macos.la"
slouken@0
  2627
        fi
slouken@0
  2628
        # Set up files for the cdrom library
slouken@0
  2629
        if test x$enable_cdrom = xyes; then
slouken@153
  2630
            CDROM_SUBDIRS="$CDROM_SUBDIRS macos"
slouken@153
  2631
            CDROM_DRIVERS="$CDROM_DRIVERS macos/libcdrom_macos.la"
slouken@0
  2632
        fi
slouken@0
  2633
        # Set up files for the thread library
slouken@0
  2634
        if test x$enable_threads = xyes; then
slouken@0
  2635
            COPY_ARCH_SRC(src/thread, macos, SDL_systhread.c)
slouken@0
  2636
            COPY_ARCH_SRC(src/thread, macos, SDL_systhread_c.h)
slouken@0
  2637
            COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c)
slouken@0
  2638
            COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h)
slouken@0
  2639
            COPY_ARCH_SRC(src/thread, macos, SDL_syssem.c)
slouken@0
  2640
            COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
slouken@0
  2641
            COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
slouken@0
  2642
            COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
slouken@0
  2643
        fi
slouken@0
  2644
        # Set up files for the timer library
slouken@0
  2645
        if test x$enable_timers = xyes; then
slouken@0
  2646
            COPY_ARCH_SRC(src/timer, macos, SDL_systimer.c)
slouken@0
  2647
        fi
slouken@0
  2648
        # The MacOS platform requires special setup
slouken@0
  2649
        SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
slouken@0
  2650
        SDL_LIBS="-lSDLmain $SDL_LIBS"
slouken@0
  2651
        ;;
slouken@0
  2652
    *-*-darwin* )
icculus@1133
  2653
        # This could be either full "Mac OS X", or plain "Darwin" which is
slouken@158
  2654
        # just the OS X kernel sans upper layers like Carbon and Cocoa.
icculus@1133
  2655
        # Next line is broken, and a few files below require Mac OS X (full)
slouken@158
  2656
        ARCH=macosx
slouken@1
  2657
        CheckDummyVideo
slouken@68
  2658
        CheckDiskAudio
icculus@1133
  2659
        CheckCOCOA
icculus@1133
  2660
        CheckCARBON
icculus@1133
  2661
        CheckMacX11
slouken@0
  2662
        CheckMacGL
slouken@0
  2663
        CheckPTHREAD
slouken@814
  2664
        CheckSIGACTION
icculus@1047
  2665
        CheckAltivec
slouken@935
  2666
        # If either the audio or CD driver is used, add the AudioUnit framework
slouken@935
  2667
        if test x$enable_audio = xyes -o x$enable_cdrom = xyes; then
slouken@935
  2668
            SYSTEM_LIBS="$SYSTEM_LIBS -framework AudioToolbox -framework AudioUnit"
slouken@935
  2669
        fi
slouken@0
  2670
        # Set up files for the audio library
slouken@0
  2671
        if test x$enable_audio = xyes; then
slouken@936
  2672
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS macosx"
slouken@936
  2673
            AUDIO_DRIVERS="$AUDIO_DRIVERS macosx/libaudio_macosx.la"
slouken@0
  2674
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS macrom"
slouken@0
  2675
            AUDIO_DRIVERS="$AUDIO_DRIVERS macrom/libaudio_macrom.la"
slouken@0
  2676
        fi
slouken@0
  2677
        # Set up files for the joystick library
slouken@0
  2678
        if test x$enable_joystick = xyes; then
slouken@172
  2679
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS darwin"
slouken@172
  2680
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS darwin/libjoystick_darwin.la"
slouken@387
  2681
            SYSTEM_LIBS="$SYSTEM_LIBS -framework IOKit"
slouken@0
  2682
        fi
slouken@0
  2683
        # Set up files for the cdrom library
slouken@0
  2684
        if test x$enable_cdrom = xyes; then
slouken@768
  2685
            CDROM_SUBDIRS="$CDROM_SUBDIRS macosx"
slouken@768
  2686
            CDROM_DRIVERS="$CDROM_DRIVERS macosx/libcdrom_macosx.la"
slouken@935
  2687
            SYSTEM_LIBS="$SYSTEM_LIBS -lstdc++"
slouken@0
  2688
        fi
slouken@0
  2689
        # Set up files for the thread library
slouken@0
  2690
        if test x$enable_threads = xyes; then
slouken@399
  2691
            CopyUnixThreadSource
slouken@0
  2692
        fi
slouken@0
  2693
        # Set up files for the timer library
slouken@0
  2694
        if test x$enable_timers = xyes; then
slouken@0
  2695
            COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
slouken@0
  2696
        fi
slouken@387
  2697
        # The MacOS X platform requires special setup.
slouken@387
  2698
        SDL_LIBS="-lSDLmain $SDL_LIBS"
icculus@1133
  2699
        if test x$enable_video_cocoa = xyes; then
icculus@1133
  2700
            SYSTEM_LIBS="$SYSTEM_LIBS -framework Cocoa"
icculus@1133
  2701
        fi
icculus@1133
  2702
        if test x$enable_video_carbon = xyes -o x$enable_video_cocoa = xyes; then
icculus@1133
  2703
            # The Cocoa backend still needs Carbon, and the YUV code QuickTime
icculus@1133
  2704
            SYSTEM_LIBS="$SYSTEM_LIBS -framework Carbon -framework QuickTime"
icculus@1133
  2705
        fi
icculus@1133
  2706
        #if test x$enable_video_carbon = xyes; then
icculus@1133
  2707
        #    SYSTEM_LIBS="$SYSTEM_LIBS -framework DrawSprocket"
icculus@1133
  2708
        #fi
slouken@0
  2709
        ;;
slouken@281
  2710
    *-*-mint*)
slouken@281
  2711
        ARCH=mint
slouken@281
  2712
        CheckDummyVideo
slouken@281
  2713
        CheckDiskAudio
slouken@281
  2714
        CheckAtariBiosEvent
slouken@281
  2715
        CheckAtariXbiosVideo
slouken@281
  2716
        CheckAtariGemVideo
slouken@398
  2717
        CheckAtariAudio
patmandin@651
  2718
        CheckAtariLdg
patmandin@989
  2719
		CheckAtariOSMesa
slouken@281
  2720
        CheckPTH
slouken@281
  2721
        # Set up files for the audio library
slouken@398
  2722
        if test x$enable_threads = xyes -a x$enable_pth = xyes; then
slouken@398
  2723
            if test x$enable_audio = xyes; then
slouken@398
  2724
                CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
slouken@398
  2725
                AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
slouken@398
  2726
                AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
slouken@398
  2727
            fi
slouken@281
  2728
        fi
slouken@281
  2729
        # Set up files for the joystick library
slouken@281
  2730
        if test x$enable_joystick = xyes; then
slouken@302
  2731
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS mint"
slouken@302
  2732
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS mint/libjoystick_mint.la"
slouken@281
  2733
        fi
slouken@281
  2734
        # Set up files for the cdrom library
slouken@281
  2735
        if test x$enable_cdrom = xyes; then
patmandin@724
  2736
            CDROM_SUBDIRS="$CDROM_SUBDIRS mint"
patmandin@724
  2737
            CDROM_DRIVERS="$CDROM_DRIVERS mint/libcdrom_mint.la"
slouken@281
  2738
        fi
slouken@281
  2739
        # Set up files for the thread library
slouken@281
  2740
        if test x$enable_threads = xyes; then
slouken@399
  2741
            CopyUnixThreadSource
slouken@281
  2742
        fi
slouken@281
  2743
        # Set up files for the timer library
slouken@281
  2744
        if test x$enable_timers = xyes; then
slouken@557
  2745
            if test x$enable_threads = xyes -a x$enable_pth = xyes; then
slouken@557
  2746
                COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
slouken@557
  2747
            else
slouken@557
  2748
                COPY_ARCH_SRC(src/timer, mint, SDL_systimer.c)
slouken@557
  2749
            fi
slouken@281
  2750
        fi
slouken@281
  2751
        # MiNT does not define "unix"
slouken@281
  2752
        CFLAGS="$CFLAGS -Dunix"
slouken@281
  2753
        ;;
slouken@1035
  2754
    *-riscos)
slouken@687
  2755
        ARCH=riscos
slouken@955
  2756
        # Set up files for the video library
slouken@955
  2757
        if test x$enable_video = xyes; then
slouken@955
  2758
            VIDEO_SUBDIRS="$VIDEO_SUBDIRS riscos"
slouken@955
  2759
            VIDEO_DRIVERS="$VIDEO_DRIVERS riscos/libvideo_riscos.la"
slouken@955
  2760
        fi
slouken@955
  2761
        # Set up files for the audio library
slouken@955
  2762
        if test x$enable_audio = xyes; then
slouken@1035
  2763
            CFLAGS="$CFLAGS -DOSS_SUPPORT"
slouken@1035
  2764
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS dsp"
slouken@1035
  2765
            AUDIO_DRIVERS="$AUDIO_DRIVERS dsp/libaudio_dsp.la"
slouken@1035
  2766
            AUDIO_SUBDIRS="$AUDIO_SUBDIRS dma"
slouken@1035
  2767
            AUDIO_DRIVERS="$AUDIO_DRIVERS dma/libaudio_dma.la"
slouken@955
  2768
        fi
slouken@955
  2769
        # Set up files for the joystick library
slouken@955
  2770
        if test x$enable_joystick = xyes; then
slouken@955
  2771
            JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS riscos"
slouken@955
  2772
            JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS riscos/libjoystick_riscos.la"
slouken@955
  2773
        fi
slouken@955
  2774
        # Set up files for the cdrom library
slouken@687
  2775
        if test x$enable_cdrom = xyes; then
slouken@687
  2776
            CDROM_SUBDIRS="$CDROM_SUBDIRS dummy"
slouken@687
  2777
            CDROM_DRIVERS="$CDROM_DRIVERS dummy/libcdrom_dummy.la"
slouken@687
  2778
        fi
slouken@955
  2779
        # Set up files for the thread library
slouken@955
  2780
        if test x$enable_threads = xyes; then
slouken@955
  2781
            COPY_ARCH_SRC(src/thread, riscos, SDL_systhread.c)
slouken@955
  2782
            COPY_ARCH_SRC(src/thread, riscos, SDL_systhread_c.h)
slouken@955
  2783
            COPY_ARCH_SRC(src/thread, riscos, SDL_sysmutex.c)
slouken@955
  2784
            COPY_ARCH_SRC(src/thread, riscos, SDL_sysmutex_c.h)
slouken@955
  2785
            COPY_ARCH_SRC(src/thread, riscos, SDL_syssem.c)
slouken@955
  2786
            COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
slouken@955
  2787
            COPY_ARCH_SRC(src/thread, riscos, SDL_syscond.c)
slouken@955
  2788
            COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
slouken@955
  2789
        else
slouken@955
  2790
            CFLAGS="$CFLAGS -DDISABLE_THREADS"
slouken@955
  2791
        fi
slouken@955
  2792
        # Set up files for the timer library
slouken@955
  2793
        if test x$enable_timers = xyes; then
slouken@955
  2794
            COPY_ARCH_SRC(src/timer, riscos, SDL_systimer.c)
slouken@955
  2795
        fi
slouken@687
  2796
slouken@1035
  2797
        CFLAGS="$CFLAGS -DENABLE_RISCOS"
slouken@687
  2798
slouken@687
  2799
        SYSTEM_LIBS="$SYSTEM_LIBS -ljpeg -ltiff -lpng -lz"
slouken@687
  2800
        ;;
slouken@0
  2801
    *)
slouken@0
  2802
        AC_MSG_ERROR(Unsupported target:  Please add to configure.in)
slouken@0
  2803
        ;;
slouken@0
  2804
esac
slouken@0
  2805
AC_SUBST(ARCH)
slouken@0
  2806
slouken@0
  2807
# Set the conditional variables for this target
slouken@0
  2808
AM_CONDITIONAL(TARGET_LINUX, test $ARCH = linux)
slouken@371
  2809
AM_CONDITIONAL(TARGET_QTOPIA, test "x$video_qtopia" = "xyes")
slouken@0
  2810
AM_CONDITIONAL(TARGET_SOLARIS, test $ARCH = solaris)
slouken@0
  2811
AM_CONDITIONAL(TARGET_IRIX, test $ARCH = irix)
slouken@0
  2812
AM_CONDITIONAL(TARGET_BSDI, test $ARCH = bsdi)
slouken@0
  2813
AM_CONDITIONAL(TARGET_FREEBSD, test $ARCH = freebsd)
slouken@39
  2814
AM_CONDITIONAL(TARGET_NETBSD, test $ARCH = netbsd)
slouken@0
  2815
AM_CONDITIONAL(TARGET_OPENBSD, test $ARCH = openbsd)
slouken@0
  2816
AM_CONDITIONAL(TARGET_AIX, test $ARCH = aix)
slouken@0
  2817
AM_CONDITIONAL(TARGET_WIN32, test $ARCH = win32)
slouken@0
  2818
AM_CONDITIONAL(TARGET_BEOS, test $ARCH = beos)
slouken@0
  2819
AM_CONDITIONAL(TARGET_MACOS, test $ARCH = macos)
slouken@158
  2820
AM_CONDITIONAL(TARGET_MACOSX, test $ARCH = macosx)
slouken@279
  2821
AM_CONDITIONAL(TARGET_QNX, test $ARCH = qnx)
slouken@281
  2822
AM_CONDITIONAL(TARGET_MINT, test $ARCH = mint)
slouken@0
  2823
slouken@387
  2824
# More automake conditionals
slouken@387
  2825
AM_CONDITIONAL(USE_DIRECTX, test x$use_directx = xyes)
slouken@387
  2826
AM_CONDITIONAL(USE_CLONE, test x$use_clone = xyes)
slouken@739
  2827
AM_CONDITIONAL(HAVE_NASM, test x$use_nasm = xyes)