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