configure.in
author Ryan C. Gordon <icculus@icculus.org>
Thu, 08 Sep 2005 06:43:51 +0000
changeset 1136 d16c010d5d98
parent 1133 609c060fd2a2
child 1140 af8b0f9ac2f4
permissions -rw-r--r--
Fix dlvsym() detection in the configure script.

--ryan.


From: Mike Frysinger <vapier@gentoo.org>
To: sdl@libsdl.org
Subject: Re: [SDL] sdl, sdl-mixer not compiling with uclibc
Date: Wed, 7 Sep 2005 19:17:49 -0400

in this case actually, the error is in libsdl

the configure check for dlvsym presence is pretty pointless, it currently
always detects it

AC_TRY_COMPILE([
#include <stdio.h>
#define __USE_GNU
#include <dlfcn.h>
],[
dlvsym(NULL,"","");
],[
use_dlvsym=yes
])

since it's merely compiling, the warning about dlvsym being implicitly
declared doesnt trigger a failure

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