configure.in
author Ryan C. Gordon <icculus@icculus.org>
Thu, 08 Sep 2005 07:33:22 +0000
changeset 1140 af8b0f9ac2f4
parent 1136 d16c010d5d98
child 1162 2651158f59b8
permissions -rw-r--r--
iPod Linux framebuffer support.

--ryan.


Date: Sun, 19 Jun 2005 15:53:22 -0700
From: Joshua Oreman <oremanj@gmail.com>
To: sdl@libsdl.org
Subject: [SDL] [PATCH] iPod framebuffer video driver

Hi SDL-list,

I've been working on a port of SDL to iPodLinux
(http://www.ipodlinux.org). I've created a patch for both the
standard 2-bit iPod screen (using an unchangeable palette) and the
16-bit iPod photo. The patch is attached, against version 1.2.8.

I've created two pages on the iPodLinux wiki about this patch:
http://www.ipodlinux.org/Building_SDL and
http://www.ipodlinux.org/SDL_Programming. See those pages if you're
curious.

Comments? Questions? Is this something that might be able to get into SDL 1.2.9?

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