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