configure.in
author Sam Lantinga <slouken@libsdl.org>
Mon, 20 Feb 2006 08:49:00 +0000
changeset 1384 6fd39b50dd91
parent 1383 1736c5e2173f
child 1389 ce65f014190a
permissions -rw-r--r--
build fixes for IRIX 6.5 - dynamic X11 loading works! :)
slouken@0
     1
dnl Process this file with autoconf to produce a configure script.
slouken@0
     2
AC_INIT(README)
slouken@1341
     3
AC_CONFIG_HEADER(include/SDL_config.h)
slouken@1353
     4
AC_GNU_SOURCE
slouken@0
     5
slouken@0
     6
dnl Set various version strings - taken gratefully from the GTk sources
slouken@0
     7
#
slouken@0
     8
# Making releases:
slouken@0
     9
# Edit include/SDL/SDL_version.h and change the version, then:
slouken@0
    10
#   SDL_MICRO_VERSION += 1;
slouken@0
    11
#   SDL_INTERFACE_AGE += 1;
slouken@0
    12
#   SDL_BINARY_AGE += 1;
slouken@0
    13
# if any functions have been added, set SDL_INTERFACE_AGE to 0.
slouken@0
    14
# if backwards compatibility has been broken,
slouken@0
    15
# set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0.
slouken@0
    16
#
slouken@0
    17
SDL_MAJOR_VERSION=1
slouken@0
    18
SDL_MINOR_VERSION=2
slouken@1222
    19
SDL_MICRO_VERSION=10
slouken@1222
    20
SDL_INTERFACE_AGE=3
slouken@1222
    21
SDL_BINARY_AGE=10
slouken@0
    22
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
slouken@0
    23
slouken@0
    24
AC_SUBST(SDL_MAJOR_VERSION)
slouken@0
    25
AC_SUBST(SDL_MINOR_VERSION)
slouken@0
    26
AC_SUBST(SDL_MICRO_VERSION)
slouken@0
    27
AC_SUBST(SDL_INTERFACE_AGE)
slouken@0
    28
AC_SUBST(SDL_BINARY_AGE)
slouken@0
    29
AC_SUBST(SDL_VERSION)
slouken@0
    30
slouken@0
    31
# libtool versioning
slouken@0
    32
LT_RELEASE=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION
slouken@0
    33
LT_CURRENT=`expr $SDL_MICRO_VERSION - $SDL_INTERFACE_AGE`
slouken@0
    34
LT_REVISION=$SDL_INTERFACE_AGE
slouken@0
    35
LT_AGE=`expr $SDL_BINARY_AGE - $SDL_INTERFACE_AGE`
slouken@0
    36
slouken@0
    37
AC_SUBST(LT_RELEASE)
slouken@0
    38
AC_SUBST(LT_CURRENT)
slouken@0
    39
AC_SUBST(LT_REVISION)
slouken@0
    40
AC_SUBST(LT_AGE)
slouken@0
    41
slouken@0
    42
dnl Detect the canonical host and target build environment
slouken@1361
    43
AC_CONFIG_AUX_DIRS($srcdir/build-scripts)
slouken@557
    44
AC_CANONICAL_SYSTEM
slouken@1354
    45
AC_C_BIGENDIAN
slouken@1354
    46
if test x$ac_cv_c_bigendian = xyes; then
slouken@1354
    47
    AC_DEFINE(SDL_BYTEORDER, 4321)
slouken@1354
    48
else
slouken@1354
    49
    AC_DEFINE(SDL_BYTEORDER, 1234)
slouken@1354
    50
fi
slouken@0
    51
slouken@1363
    52
dnl Set up the base CFLAGS and LIBS
slouken@1363
    53
case "$target" in
slouken@1363
    54
    *-*-cygwin*)
slouken@1363
    55
        # We build SDL on cygwin without the UNIX emulation layer
slouken@1363
    56
        BASE_CFLAGS="-I/usr/include/mingw -DWIN32 -Uunix -mno-cygwin"
slouken@1363
    57
        BASE_LIBS="-mno-cygwin"
slouken@1363
    58
        ;;
slouken@1363
    59
    *)
slouken@1363
    60
        BASE_CFLAGS="-D_GNU_SOURCE=1"
slouken@1363
    61
        BASE_LIBS=""
slouken@1363
    62
        ;;
slouken@1363
    63
esac
slouken@1363
    64
CFLAGS="$CFLAGS $BASE_CFLAGS"
slouken@1363
    65
slouken@1373
    66
dnl Set up the compiler and linker flags for building SDL
slouken@1373
    67
INCLUDE="-I$srcdir/include"
slouken@1373
    68
if test x$srcdir != x.; then
slouken@1373
    69
    INCLUDE="-Iinclude $INCLUDE"
slouken@1373
    70
fi
slouken@1373
    71
BUILD_CFLAGS="$BASE_CFLAGS \$(INCLUDE)"
slouken@1373
    72
BUILD_LIBS="$BASE_LIBS"
slouken@1373
    73
slouken@1373
    74
dnl Set up the compiler and linker flags for SDL applications
slouken@1373
    75
SDL_CFLAGS="$BASE_CFLAGS"
slouken@1373
    76
SDL_LIBS="$BASE_LIBS -lSDL"
slouken@1373
    77
slouken@0
    78
dnl Check for tools
slouken@1361
    79
#AC_LIBTOOL_DLOPEN
slouken@0
    80
AC_LIBTOOL_WIN32_DLL
slouken@1361
    81
AC_PROG_LIBTOOL
slouken@0
    82
AC_PROG_CC
slouken@200
    83
AC_PROG_CXX
slouken@0
    84
AC_PROG_INSTALL
slouken@1380
    85
AC_PROG_MAKE_SET
slouken@1341
    86
slouken@1353
    87
dnl Check for compiler characteristics
slouken@1341
    88
AC_C_CONST
slouken@1341
    89
AC_C_INLINE
slouken@1353
    90
AC_C_VOLATILE
slouken@1353
    91
slouken@1361
    92
dnl See whether we are allowed to use the system C library
slouken@1361
    93
AC_ARG_ENABLE(libc,
slouken@1361
    94
AC_HELP_STRING([--enable-libc], [Use the system C library [default=yes]]),
slouken@1361
    95
              , enable_libc=yes)
slouken@1361
    96
if test x$enable_libc = xyes; then
slouken@1361
    97
    AC_DEFINE(HAVE_LIBC)
slouken@1353
    98
slouken@1361
    99
    dnl Check for C library headers
slouken@1361
   100
    AC_HEADER_STDC
slouken@1361
   101
    AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h inttypes.h stdint.h ctype.h math.h signal.h)
slouken@1361
   102
slouken@1361
   103
    dnl Check for typedefs, structures, etc.
slouken@1361
   104
    AC_TYPE_SIZE_T
slouken@1361
   105
    if test x$ac_cv_header_inttypes_h = xyes -o x$ac_cv_header_stdint_h = xyes; then
slouken@1361
   106
        AC_CHECK_TYPE(int64_t)
slouken@1361
   107
        if test x$ac_cv_type_int64_t = xyes; then
slouken@1361
   108
            AC_DEFINE(SDL_HAS_64BIT_TYPE)
slouken@1361
   109
        fi
slouken@1361
   110
        have_inttypes=yes
slouken@1353
   111
    fi
slouken@1361
   112
slouken@1361
   113
    dnl Checks for library functions.
slouken@1361
   114
    AC_FUNC_ALLOCA
slouken@1361
   115
    AC_FUNC_MEMCMP
slouken@1361
   116
    if test x$ac_cv_func_memcmp_working = xyes; then
slouken@1361
   117
        AC_DEFINE(HAVE_MEMCMP)
slouken@1361
   118
    fi
slouken@1361
   119
    AC_FUNC_STRTOD
slouken@1361
   120
    if test x$ac_cv_func_strtod = xyes; then
slouken@1361
   121
        AC_DEFINE(HAVE_STRTOD)
slouken@1361
   122
    fi
slouken@1379
   123
    AC_CHECK_FUNCS(malloc calloc realloc free getenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol _i64toa _ui64toa strtoll atoi atof strcmp strncmp stricmp strcasecmp sscanf snprintf vsnprintf sigaction setjmp nanosleep)
slouken@1373
   124
slouken@1373
   125
    AC_CHECK_LIB(m, pow, [BUILD_LIBS="$BUILD_LIBS -lm"])
slouken@1361
   126
fi
slouken@1361
   127
slouken@1361
   128
if test x$have_inttypes != xyes; then
slouken@1353
   129
    AC_CHECK_SIZEOF(char, 1)
slouken@1353
   130
    AC_CHECK_SIZEOF(short, 2)
slouken@1353
   131
    AC_CHECK_SIZEOF(int, 4)
slouken@1353
   132
    AC_CHECK_SIZEOF(long, 4)
slouken@1353
   133
    AC_CHECK_SIZEOF(long long, 8)
slouken@1353
   134
    if test x$ac_cv_sizeof_char = x1; then
slouken@1353
   135
        AC_DEFINE(int8_t, signed char)
slouken@1353
   136
        AC_DEFINE(uint8_t, unsigned char)
slouken@1353
   137
    fi
slouken@1353
   138
    if test x$ac_cv_sizeof_short = x2; then
slouken@1353
   139
        AC_DEFINE(int16_t, signed short)
slouken@1353
   140
        AC_DEFINE(uint16_t, unsigned short)
slouken@1353
   141
    else
slouken@1353
   142
        if test x$ac_cv_sizeof_int = x2; then
slouken@1353
   143
            AC_DEFINE(int16_t, signed int)
slouken@1353
   144
            AC_DEFINE(uint16_t, unsigned int)
slouken@1353
   145
        fi
slouken@1353
   146
    fi
slouken@1353
   147
    if test x$ac_cv_sizeof_int = x4; then
slouken@1353
   148
        AC_DEFINE(int32_t, signed int)
slouken@1353
   149
        AC_DEFINE(uint32_t, unsigned int)
slouken@1353
   150
    else
slouken@1353
   151
        if test x$ac_cv_sizeof_long = x4; then
slouken@1353
   152
            AC_DEFINE(int32_t, signed long)
slouken@1353
   153
            AC_DEFINE(uint32_t, unsigned long)
slouken@1353
   154
        fi
slouken@1353
   155
    fi
slouken@1353
   156
    if test x$ac_cv_sizeof_long = x8; then
slouken@1353
   157
        AC_DEFINE(int64_t, signed long)
slouken@1353
   158
        AC_DEFINE(uint64_t, unsigned long)
slouken@1353
   159
        AC_DEFINE(SDL_HAS_64BIT_TYPE)
slouken@1353
   160
    else
slouken@1353
   161
        if test x$ac_cv_sizeof_long_long = x8; then
slouken@1353
   162
            AC_DEFINE(int64_t, signed long long)
slouken@1353
   163
            AC_DEFINE(uint64_t, unsigned long long)
slouken@1353
   164
            AC_DEFINE(SDL_HAS_64BIT_TYPE)
slouken@1353
   165
        fi
slouken@1353
   166
    fi
slouken@1361
   167
    AC_DEFINE(size_t, unsigned int)
slouken@1361
   168
    AC_DEFINE(uintptr_t, unsigned long)
slouken@1353
   169
fi
slouken@1341
   170
slouken@1361
   171
# Standard C sources
slouken@1361
   172
SOURCES="$SOURCES $srcdir/src/*.c"
slouken@1361
   173
SOURCES="$SOURCES $srcdir/src/audio/*.c"
slouken@1361
   174
SOURCES="$SOURCES $srcdir/src/cdrom/*.c"
slouken@1361
   175
SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c"
slouken@1361
   176
SOURCES="$SOURCES $srcdir/src/events/*.c"
slouken@1361
   177
SOURCES="$SOURCES $srcdir/src/file/*.c"
slouken@1361
   178
SOURCES="$SOURCES $srcdir/src/joystick/*.c"
slouken@1361
   179
SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
slouken@1361
   180
SOURCES="$SOURCES $srcdir/src/thread/*.c"
slouken@1361
   181
SOURCES="$SOURCES $srcdir/src/timer/*.c"
slouken@1361
   182
SOURCES="$SOURCES $srcdir/src/video/*.c"
slouken@1361
   183
slouken@0
   184
dnl Enable/disable various subsystems of the SDL library
slouken@0
   185
slouken@0
   186
AC_ARG_ENABLE(audio,
slouken@1361
   187
AC_HELP_STRING([--enable-audio], [Enable the audio subsystem [default=yes]]),
slouken@0
   188
              , enable_audio=yes)
slouken@1361
   189
if test x$enable_audio != xyes; then
slouken@1361
   190
    AC_DEFINE(SDL_AUDIO_DISABLED)
slouken@0
   191
fi
slouken@0
   192
AC_ARG_ENABLE(video,
slouken@1361
   193
AC_HELP_STRING([--enable-video], [Enable the video subsystem [default=yes]]),
slouken@0
   194
              , enable_video=yes)
slouken@1361
   195
if test x$enable_video != xyes; then
slouken@1361
   196
    AC_DEFINE(SDL_VIDEO_DISABLED)
slouken@0
   197
fi
slouken@0
   198
AC_ARG_ENABLE(events,
slouken@1361
   199
AC_HELP_STRING([--enable-events], [Enable the events subsystem [default=yes]]),
slouken@0
   200
              , enable_events=yes)
slouken@1361
   201
if test x$enable_events != xyes; then
slouken@1361
   202
    AC_DEFINE(SDL_EVENTS_DISABLED)
slouken@0
   203
fi
slouken@0
   204
AC_ARG_ENABLE(joystick,
slouken@1361
   205
AC_HELP_STRING([--enable-joystick], [Enable the joystick subsystem [default=yes]]),
slouken@0
   206
              , enable_joystick=yes)
slouken@1361
   207
if test x$enable_joystick != xyes; then
slouken@1361
   208
    AC_DEFINE(SDL_JOYSTICK_DISABLED)
slouken@0
   209
fi
slouken@0
   210
AC_ARG_ENABLE(cdrom,
slouken@1361
   211
AC_HELP_STRING([--enable-cdrom], [Enable the cdrom subsystem [default=yes]]),
slouken@0
   212
              , enable_cdrom=yes)
slouken@1361
   213
if test x$enable_cdrom != xyes; then
slouken@1361
   214
    AC_DEFINE(SDL_CDROM_DISABLED)
slouken@0
   215
fi
slouken@0
   216
AC_ARG_ENABLE(threads,
slouken@1361
   217
AC_HELP_STRING([--enable-threads], [Enable the threading subsystem [default=yes]]),
slouken@0
   218
              , enable_threads=yes)
slouken@0
   219
if test x$enable_threads != xyes; then
slouken@1361
   220
    AC_DEFINE(SDL_THREADS_DISABLED)
slouken@0
   221
fi
slouken@0
   222
AC_ARG_ENABLE(timers,
slouken@1361
   223
AC_HELP_STRING([--enable-timers], [Enable the timer subsystem [default=yes]]),
slouken@0
   224
              , enable_timers=yes)
slouken@1361
   225
if test x$enable_timers != xyes; then
slouken@1361
   226
    AC_DEFINE(SDL_TIMERS_DISABLED)
slouken@0
   227
fi
slouken@0
   228
AC_ARG_ENABLE(file,
slouken@1361
   229
AC_HELP_STRING([--enable-file], [Enable the file subsystem [default=yes]]),
slouken@0
   230
              , enable_file=yes)
slouken@1361
   231
if test x$enable_file != xyes; then
slouken@1361
   232
    AC_DEFINE(SDL_FILE_DISABLED)
slouken@1361
   233
fi
slouken@1361
   234
AC_ARG_ENABLE(loadso,
slouken@1361
   235
AC_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [default=yes]]),
slouken@1361
   236
              , enable_loadso=yes)
slouken@1361
   237
if test x$enable_loadso != xyes; then
slouken@1361
   238
    AC_DEFINE(SDL_LOADSO_DISABLED)
slouken@0
   239
fi
slouken@740
   240
AC_ARG_ENABLE(cpuinfo,
slouken@1361
   241
AC_HELP_STRING([--enable-cpuinfo], [Enable the cpuinfo subsystem [default=yes]]),
slouken@740
   242
              , enable_cpuinfo=yes)
slouken@1361
   243
if test x$enable_cpuinfo != xyes; then
slouken@1361
   244
    AC_DEFINE(SDL_CPUINFO_DISABLED)
slouken@1361
   245
fi
slouken@1361
   246
AC_ARG_ENABLE(assembly-blit,
slouken@1361
   247
AC_HELP_STRING([--enable-asm-blit], [Enable assembly blitters [default=yes]]),
slouken@1361
   248
              , enable_asm_blit=yes)
slouken@1361
   249
if test x$enable_asm_blit = xyes; then
slouken@1361
   250
    AC_DEFINE(SDL_ASSEMBLY_BLITTERS)
slouken@740
   251
fi
slouken@0
   252
slouken@0
   253
dnl See if the OSS audio interface is supported
slouken@0
   254
CheckOSS()
slouken@0
   255
{
slouken@0
   256
    AC_ARG_ENABLE(oss,
slouken@1361
   257
AC_HELP_STRING([--enable-oss], [support the OSS audio API [default=yes]]),
slouken@0
   258
                  , enable_oss=yes)
slouken@0
   259
    if test x$enable_audio = xyes -a x$enable_oss = xyes; then
slouken@0
   260
        AC_MSG_CHECKING(for OSS audio support)
slouken@0
   261
        have_oss=no
slouken@94
   262
        if test x$have_oss != xyes; then
slouken@94
   263
            AC_TRY_COMPILE([
slouken@94
   264
              #include <sys/soundcard.h>
slouken@94
   265
            ],[
slouken@94
   266
              int arg = SNDCTL_DSP_SETFRAGMENT;
slouken@94
   267
            ],[
slouken@94
   268
            have_oss=yes
slouken@94
   269
            ])
slouken@94
   270
        fi
slouken@94
   271
        if test x$have_oss != xyes; then
slouken@94
   272
            AC_TRY_COMPILE([
slouken@94
   273
              #include <soundcard.h>
slouken@94
   274
            ],[
slouken@94
   275
              int arg = SNDCTL_DSP_SETFRAGMENT;
slouken@94
   276
            ],[
slouken@94
   277
            have_oss=yes
slouken@1361
   278
            AC_DEFINE(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H)
slouken@94
   279
            ])
slouken@94
   280
        fi
slouken@0
   281
        AC_MSG_RESULT($have_oss)
slouken@0
   282
        if test x$have_oss = xyes; then
slouken@1361
   283
            AC_DEFINE(SDL_AUDIO_DRIVER_OSS)
slouken@1361
   284
            SOURCES="$SOURCES $srcdir/src/audio/dsp/*.c"
slouken@1361
   285
            SOURCES="$SOURCES $srcdir/src/audio/dma/*.c"
slouken@1361
   286
            have_audio=yes
slouken@1361
   287
slouken@1361
   288
            # OpenBSD needs linking with ossaudio emulation library
slouken@1361
   289
            case "$target" in
slouken@1383
   290
                *-*-openbsd*|*-*-netbsd*)
slouken@1361
   291
                    BUILD_LIBS="$BUILD_LIBS -lossaudio";;
slouken@1361
   292
            esac
slouken@0
   293
        fi
slouken@0
   294
    fi
slouken@0
   295
}
slouken@0
   296
slouken@0
   297
dnl See if the ALSA audio interface is supported
slouken@0
   298
CheckALSA()
slouken@0
   299
{
slouken@0
   300
    AC_ARG_ENABLE(alsa,
slouken@1361
   301
AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [default=yes]]),
slouken@0
   302
                  , enable_alsa=yes)
slouken@0
   303
    if test x$enable_audio = xyes -a x$enable_alsa = xyes; then
slouken@948
   304
        AM_PATH_ALSA(0.9.0, have_alsa=yes, have_alsa=no)
slouken@1009
   305
        # Restore all flags from before the ALSA detection runs
slouken@1009
   306
        CFLAGS="$alsa_save_CFLAGS"
slouken@1009
   307
        LDFLAGS="$alsa_save_LDFLAGS"
slouken@1009
   308
        LIBS="$alsa_save_LIBS"
slouken@354
   309
        if test x$have_alsa = xyes; then
slouken@865
   310
            AC_ARG_ENABLE(alsa-shared,
slouken@1361
   311
AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [default=yes]]),
slouken@1361
   312
                          , enable_alsa_shared=yes)
slouken@1361
   313
            if test "x`echo $ALSA_LIBS | grep -- -L`" = "x"; then
slouken@1361
   314
                if test "x`ls /lib/libasound.so.* 2> /dev/null`" != "x"; then
slouken@1361
   315
                    ALSA_LIBS="-L/lib $ALSA_LIBS"
slouken@1361
   316
                elif test "x`ls /usr/lib/libasound.so.* 2> /dev/null`" != "x"; then
slouken@1361
   317
                    ALSA_LIBS="-L/usr/lib $ALSA_LIBS"
slouken@1361
   318
                elif test "x`ls /usr/local/lib/libasound.so.* 2> /dev/null`" != "x"; then
slouken@1361
   319
                    ALSA_LIBS="-L/usr/local/lib $ALSA_LIBS"
slouken@1361
   320
                fi
slouken@1361
   321
            fi
slouken@1361
   322
            alsa_lib_spec=`echo $ALSA_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libasound.so.*/'`
slouken@1361
   323
            alsa_lib=`ls $alsa_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
slouken@1361
   324
            echo "-- $alsa_lib_spec -> $alsa_lib"
slouken@1361
   325
slouken@1361
   326
            AC_DEFINE(SDL_AUDIO_DRIVER_ALSA)
slouken@1361
   327
            SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c"
slouken@1361
   328
            BUILD_CFLAGS="$BUILD_CFLAGS $ALSA_CFLAGS"
slouken@1361
   329
            if test x$have_loadso != xyes && \
slouken@1361
   330
               test x$enable_alsa_shared = xyes; then
slouken@1361
   331
                AC_MSG_ERROR([You must have SDL_LoadObject() support])
slouken@1361
   332
            fi
slouken@1361
   333
            if test x$have_loadso = xyes && \
slouken@1361
   334
               test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
slouken@1361
   335
                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ALSA_DYNAMIC, "$alsa_lib")
slouken@1361
   336
            else
slouken@1361
   337
                BUILD_LIBS="$BUILD_LIBS $ALSA_LIBS"
slouken@1361
   338
            fi
slouken@1361
   339
            have_audio=yes
slouken@1361
   340
        fi
slouken@1361
   341
    fi
slouken@1361
   342
        if test x$have_alsa = xyes; then
slouken@1361
   343
            AC_ARG_ENABLE(alsa-shared,
slouken@865
   344
[  --enable-alsa-shared     dynamically load ALSA audio support [default=yes]],
slouken@865
   345
                          , enable_alsa_shared=yes)
slouken@939
   346
            if test "x`echo $ALSA_LIBS | grep -- -L`" = "x"; then
slouken@973
   347
                if test "x`ls /lib/libasound.so.* 2> /dev/null`" != "x"; then
slouken@973
   348
                    ALSA_LIBS="-L/lib $ALSA_LIBS"
slouken@973
   349
                elif test "x`ls /usr/lib/libasound.so.* 2> /dev/null`" != "x"; then
slouken@939
   350
                    ALSA_LIBS="-L/usr/lib $ALSA_LIBS"
slouken@973
   351
                elif test "x`ls /usr/local/lib/libasound.so.* 2> /dev/null`" != "x"; then
slouken@939
   352
                    ALSA_LIBS="-L/usr/local/lib $ALSA_LIBS"
slouken@973
   353
                fi
slouken@939
   354
            fi
slouken@939
   355
            alsa_lib_spec=`echo $ALSA_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libasound.so.*/'`
slouken@939
   356
            alsa_lib=`ls $alsa_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
slouken@939
   357
            echo "-- $alsa_lib_spec -> $alsa_lib"
slouken@939
   358
icculus@1173
   359
            if test x$have_loadso != xyes && \
slouken@865
   360
               test x$enable_alsa_shared = xyes; then
icculus@1173
   361
                AC_MSG_ERROR([You must have SDL_LoadObject() support])
slouken@865
   362
            fi
icculus@1173
   363
            if test x$have_loadso = xyes && \
slouken@865
   364
               test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
slouken@939
   365
                CFLAGS="$CFLAGS -DALSA_SUPPORT -DALSA_DYNAMIC=\$(alsa_lib) $ALSA_CFLAGS"
slouken@865
   366
                AC_SUBST(alsa_lib)
slouken@939
   367
slouken@939
   368
                use_dlvsym=no
icculus@1136
   369
                AC_CHECK_LIB(dl, dlvsym, [use_dlvsym=yes])
slouken@939
   370
                if test x$use_dlvsym = xyes; then
slouken@939
   371
                    CFLAGS="$CFLAGS -DUSE_DLVSYM"
slouken@939
   372
                fi
slouken@865
   373
            else
slouken@939
   374
                CFLAGS="$CFLAGS -DALSA_SUPPORT $ALSA_CFLAGS"
slouken@939
   375
                SYSTEM_LIBS="$SYSTEM_LIBS $ALSA_LIBS"
slouken@865
   376
            fi
slouken@1361
   377
            SDL_SRCS="$SDL_SRCS `(cd $srcdir && ls audio/alsa/*.c)`"
slouken@0
   378
        fi
slouken@0
   379
}
slouken@0
   380
slouken@148
   381
dnl Check whether we want to use IRIX 6.5+ native audio or not
slouken@148
   382
CheckDMEDIA()
slouken@148
   383
{
slouken@148
   384
    if test x$enable_audio = xyes; then
slouken@148
   385
        AC_MSG_CHECKING(for dmedia audio support)
slouken@148
   386
        have_dmedia=no
slouken@148
   387
        AC_TRY_COMPILE([
slouken@148
   388
          #include <dmedia/audio.h>
slouken@148
   389
        ],[
slouken@148
   390
          ALport audio_port;
slouken@148
   391
        ],[
slouken@148
   392
        have_dmedia=yes
slouken@148
   393
        ])
slouken@935
   394
        AC_MSG_RESULT($have_dmedia)
slouken@148
   395
        # Set up files for the audio library
slouken@148
   396
        if test x$have_dmedia = xyes; then
slouken@1361
   397
            AC_DEFINE(SDL_AUDIO_DRIVER_DMEDIA)
slouken@1361
   398
            SOURCES="$SOURCES $srcdir/src/audio/dmedia/*.c"
slouken@1361
   399
            BUILD_LIBS="$BUILD_LIBS -laudio"
slouken@1361
   400
            have_audio=yes
slouken@148
   401
        fi
slouken@148
   402
    fi
slouken@148
   403
}
slouken@148
   404
slouken@0
   405
dnl Find the ESD includes and libraries
slouken@0
   406
CheckESD()
slouken@0
   407
{
slouken@0
   408
    AC_ARG_ENABLE(esd,
slouken@1361
   409
AC_HELP_STRING([--enable-esd], [support the Enlightened Sound Daemon [default=yes]]),
slouken@0
   410
                  , enable_esd=yes)
slouken@0
   411
    if test x$enable_audio = xyes -a x$enable_esd = xyes; then
slouken@948
   412
        AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no)
slouken@948
   413
        if test x$have_esd = xyes; then
slouken@294
   414
            AC_ARG_ENABLE(esd-shared,
slouken@1361
   415
AC_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [default=yes]]),
slouken@678
   416
                          , enable_esd_shared=yes)
slouken@294
   417
            esd_lib_spec=`echo $ESD_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libesd.so.*/'`
slouken@868
   418
            esd_lib=`ls $esd_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
slouken@371
   419
            echo "-- $esd_lib_spec -> $esd_lib"
icculus@1173
   420
            if test x$have_loadso != xyes && \
slouken@296
   421
               test x$enable_esd_shared = xyes; then
icculus@1173
   422
                AC_MSG_ERROR([You must have SDL_LoadObject() support])
slouken@296
   423
            fi
icculus@1173
   424
            if test x$have_loadso = xyes && \
slouken@294
   425
               test x$enable_esd_shared = xyes && test x$esd_lib != x; then
slouken@1361
   426
                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ESD_DYNAMIC, "$esd_lib")
slouken@294
   427
            fi
slouken@1361
   428
            AC_DEFINE(SDL_AUDIO_DRIVER_ESD)
slouken@1361
   429
            SOURCES="$SOURCES $srcdir/src/audio/esd/*.c"
slouken@1361
   430
            BUILD_CFLAGS="$BUILD_CFLAGS $ESD_CFLAGS"
slouken@1361
   431
            BUILD_LIBS="$BUILD_LIBS $ESD_LIBS"
slouken@1361
   432
            have_audio=yes
slouken@294
   433
        fi
slouken@0
   434
    fi
slouken@0
   435
}
slouken@0
   436
slouken@0
   437
CheckARTSC()
slouken@0
   438
{
slouken@0
   439
    AC_ARG_ENABLE(arts,
slouken@1361
   440
AC_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [default=yes]]),
slouken@0
   441
                  , enable_arts=yes)
slouken@0
   442
    if test x$enable_audio = xyes -a x$enable_arts = xyes; then
slouken@1361
   443
        AC_PATH_PROG(ARTSCONFIG, artsc-config)
slouken@1361
   444
        if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then
slouken@0
   445
            : # arts isn't installed
slouken@0
   446
        else
slouken@1361
   447
            ARTS_CFLAGS=`$ARTSCONFIG --cflags`
slouken@1361
   448
            ARTS_LIBS=`$ARTSCONFIG --libs`
slouken@1361
   449
            ARTS_PREFIX=`$ARTSCONFIG --arts-prefix`
slouken@0
   450
            AC_MSG_CHECKING(for aRts development environment)
slouken@0
   451
            audio_arts=no
slouken@0
   452
            save_CFLAGS="$CFLAGS"
slouken@1361
   453
            CFLAGS="$CFLAGS $ARTS_CFLAGS"
slouken@0
   454
            AC_TRY_COMPILE([
slouken@0
   455
             #include <artsc.h>
slouken@0
   456
            ],[
slouken@0
   457
             arts_stream_t stream;
slouken@0
   458
            ],[
slouken@0
   459
            audio_arts=yes
slouken@0
   460
            ])
slouken@0
   461
            CFLAGS="$save_CFLAGS"
slouken@0
   462
            AC_MSG_RESULT($audio_arts)
slouken@0
   463
            if test x$audio_arts = xyes; then
slouken@294
   464
                AC_ARG_ENABLE(arts-shared,
slouken@1361
   465
AC_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [default=yes]]),
slouken@678
   466
                              , enable_arts_shared=yes)
slouken@1361
   467
                arts_lib_spec="$ARTS_PREFIX/lib/libartsc.so.*"
slouken@868
   468
                arts_lib=`ls $arts_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
slouken@371
   469
                echo "-- $arts_lib_spec -> $arts_lib"
icculus@1173
   470
                if test x$have_loadso != xyes && \
slouken@296
   471
                   test x$enable_arts_shared = xyes; then
icculus@1173
   472
                    AC_MSG_ERROR([You must have SDL_LoadObject() support])
slouken@296
   473
                fi
icculus@1173
   474
                if test x$have_loadso = xyes && \
slouken@294
   475
                   test x$enable_arts_shared = xyes && test x$arts_lib != x; then
slouken@1361
   476
                    AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ARTS_DYNAMIC, "$arts_lib")
slouken@294
   477
                fi
slouken@1361
   478
                AC_DEFINE(SDL_AUDIO_DRIVER_ARTS)
slouken@1361
   479
                SOURCES="$SOURCES $srcdir/src/audio/arts/*.c"
slouken@1361
   480
                BUILD_CFLAGS="$BUILD_CFLAGS $ARTS_CFLAGS"
slouken@1361
   481
                BUILD_LIBS="$BUILD_LIBS $ARTS_LIBS"
slouken@1361
   482
                have_audio=yes
slouken@0
   483
            fi
slouken@0
   484
        fi
slouken@0
   485
    fi
slouken@0
   486
}
slouken@0
   487
slouken@0
   488
dnl See if the NAS audio interface is supported
slouken@0
   489
CheckNAS()
slouken@0
   490
{
slouken@0
   491
    AC_ARG_ENABLE(nas,
slouken@1361
   492
AC_HELP_STRING([--enable-nas], [support the NAS audio API [default=yes]]),
slouken@41
   493
                  , enable_nas=yes)
slouken@0
   494
    if test x$enable_audio = xyes -a x$enable_nas = xyes; then
slouken@41
   495
        AC_MSG_CHECKING(for NAS audio support)
slouken@41
   496
        have_nas=no
slouken@41
   497
        if test -r /usr/X11R6/include/audio/audiolib.h; then
slouken@41
   498
            have_nas=yes
slouken@1361
   499
            NAS_CFLAGS="-I/usr/X11R6/include/"
slouken@1361
   500
            NAS_LIBS="-laudio -lXt"
slouken@605
   501
slouken@605
   502
        dnl On IRIX, the NAS includes are in a different directory,
slouken@605
   503
        dnl and libnas must be explicitly linked in
slouken@605
   504
slouken@605
   505
        elif test -r /usr/freeware/include/nas/audiolib.h; then
slouken@605
   506
            have_nas=yes
slouken@1361
   507
            NAS_LIBS="-lnas -lXt"
slouken@41
   508
        fi
slouken@605
   509
        AC_MSG_RESULT($have_nas)
slouken@1361
   510
        if test x$have_nas = xyes; then
slouken@1361
   511
            AC_DEFINE(SDL_AUDIO_DRIVER_NAS)
slouken@1361
   512
            SOURCES="$SOURCES $srcdir/src/audio/nas/*.c"
slouken@1361
   513
            BUILD_CFLAGS="$BUILD_CFLAGS $NAS_CFLAGS"
slouken@1361
   514
            BUILD_LIBS="$BUILD_LIBS $NAS_LIBS"
slouken@1361
   515
            have_audio=yes
slouken@1361
   516
        fi
slouken@0
   517
    fi
slouken@0
   518
}
slouken@0
   519
slouken@68
   520
dnl rcg07142001 See if the user wants the disk writer audio driver...
slouken@68
   521
CheckDiskAudio()
slouken@68
   522
{
slouken@68
   523
    AC_ARG_ENABLE(diskaudio,
slouken@1361
   524
AC_HELP_STRING([--enable-diskaudio], [support the disk writer audio driver [default=yes]]),
slouken@86
   525
                  , enable_diskaudio=yes)
slouken@68
   526
    if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
slouken@1361
   527
        AC_DEFINE(SDL_AUDIO_DRIVER_DISK)
slouken@1361
   528
        SOURCES="$SOURCES $srcdir/src/audio/disk/*.c"
slouken@68
   529
    fi
slouken@68
   530
}
slouken@68
   531
slouken@398
   532
dnl Set up the Atari Audio driver
slouken@398
   533
CheckAtariAudio()
slouken@398
   534
{
slouken@398
   535
    AC_ARG_ENABLE(mintaudio,
slouken@1361
   536
AC_HELP_STRING([--enable-mintaudio], [support Atari audio driver [default=yes]]),
slouken@398
   537
                  , enable_mintaudio=yes)
slouken@398
   538
    if test x$enable_audio = xyes -a x$enable_mintaudio = xyes; then
slouken@398
   539
        mintaudio=no
slouken@398
   540
        AC_CHECK_HEADER(mint/falcon.h, have_mint_falcon_hdr=yes)
slouken@398
   541
        if test x$have_mint_falcon_hdr = xyes; then
slouken@398
   542
            mintaudio=yes
slouken@1361
   543
            AC_DEFINE(SDL_AUDIO_DRIVER_MINT)
patmandin@1364
   544
            SOURCES="$SOURCES $srcdir/src/audio/mint/*.c"
slouken@1361
   545
            have_audio=yes
slouken@398
   546
        fi
slouken@398
   547
    fi
slouken@398
   548
}
slouken@398
   549
slouken@0
   550
dnl See if we can use x86 assembly blitters
slouken@1361
   551
# NASM is available from: http://nasm.sourceforge.net
slouken@0
   552
CheckNASM()
slouken@0
   553
{
slouken@0
   554
    dnl Make sure we are running on an x86 platform
slouken@0
   555
    case $target in
slouken@0
   556
        i?86*)
slouken@0
   557
            ;;
slouken@0
   558
        *)
slouken@0
   559
        # Nope, bail early.
slouken@0
   560
            return
slouken@0
   561
            ;;
slouken@0
   562
    esac
slouken@0
   563
    dnl Check for NASM (for assembly blit routines)
slouken@0
   564
    AC_ARG_ENABLE(nasm,
slouken@1361
   565
AC_HELP_STRING([--enable-nasm], [use nasm assembly blitters on x86 [default=yes]]),
slouken@0
   566
                  , enable_nasm=yes)
slouken@1361
   567
    if test x$enable_video = xyes -a x$enable_asm_blit = xyes -a x$enable_nasm = xyes; then
slouken@0
   568
        AC_PATH_PROG(NASM, nasm)
slouken@1361
   569
        if test x$NASM != x -a x$NASM != x'"$NASM"'; then
slouken@1361
   570
            AC_DEFINE(SDL_HERMES_BLITTERS)
slouken@1361
   571
            SOURCES="$SOURCES $srcdir/src/hermes/*.asm"
slouken@0
   572
            case $ARCH in
slouken@0
   573
              win32)
slouken@0
   574
                  NASMFLAGS="-f win32"
slouken@0
   575
                  ;;
slouken@360
   576
              openbsd)
slouken@360
   577
                  NASMFLAGS="-f aoutb"
slouken@360
   578
                  ;;
slouken@0
   579
              *)
slouken@754
   580
                  NASMFLAGS="-f elf"
slouken@0
   581
                  ;;
slouken@0
   582
            esac
slouken@1361
   583
            AC_SUBST(NASM)
slouken@0
   584
            AC_SUBST(NASMFLAGS)
slouken@1361
   585
slouken@886
   586
            case "$target" in
slouken@886
   587
                # this line is needed for QNX, because it's not defined the __ELF__
slouken@1361
   588
                *-*-qnx*)
slouken@1361
   589
                     BUILD_CFLAGS="$BUILD_CFLAGS -D__ELF__";;
slouken@1361
   590
                *-*-solaris*)
slouken@1361
   591
                     BUILD_CFLAGS="$BUILD_CFLAGS -D__ELF__";;
slouken@1361
   592
            esac
slouken@1361
   593
        fi
slouken@1361
   594
    fi
slouken@1361
   595
}
slouken@886
   596
slouken@1361
   597
dnl Check for altivec instruction support using gas syntax
slouken@1361
   598
CheckAltivec()
slouken@1361
   599
{
slouken@1361
   600
    AC_ARG_ENABLE(altivec,
slouken@1361
   601
AC_HELP_STRING([--enable-altivec], [use altivec assembly blitters on PPC [default=yes]]),
slouken@1361
   602
                  , enable_altivec=yes)
slouken@1361
   603
    if test x$enable_video = xyes -a x$enable_asm_blit = xyes -a x$enable_altivec = xyes; then
slouken@1361
   604
        have_altivec_h_hdr=no
slouken@1361
   605
        AC_CHECK_HEADER(altivec.h, have_altivec_h_hdr=yes)
slouken@886
   606
slouken@1361
   607
        save_CFLAGS="$CFLAGS"
slouken@1361
   608
        have_gcc_altivec=no
slouken@1361
   609
        AC_MSG_CHECKING(for Altivec with GCC -maltivec option)
slouken@1361
   610
        altivec_CFLAGS="-maltivec"
slouken@1361
   611
        CFLAGS="$save_CFLAGS $altivec_CFLAGS"
slouken@1361
   612
slouken@1361
   613
        if test x$have_altivec_h_hdr = xyes; then
slouken@1361
   614
          AC_TRY_COMPILE([
slouken@1361
   615
          #include <altivec.h>
slouken@1361
   616
          vector unsigned int vzero() {
slouken@1361
   617
              return vec_splat_u32(0);
slouken@1361
   618
          }
slouken@1361
   619
          ],[
slouken@1361
   620
          ],[
slouken@1361
   621
          have_gcc_altivec=yes
slouken@1361
   622
          ])
slouken@1361
   623
          AC_MSG_RESULT($have_gcc_altivec)
slouken@1361
   624
        else
slouken@1361
   625
          AC_TRY_COMPILE([
slouken@1361
   626
          vector unsigned int vzero() {
slouken@1361
   627
              return vec_splat_u32(0);
slouken@1361
   628
          }
slouken@1361
   629
          ],[
slouken@1361
   630
          ],[
slouken@1361
   631
          have_gcc_altivec=yes
slouken@1361
   632
          ])
slouken@1361
   633
          AC_MSG_RESULT($have_gcc_altivec)
slouken@1361
   634
        fi
slouken@1361
   635
slouken@1361
   636
        if test x$have_gcc_altivec = xno; then
slouken@1361
   637
            AC_MSG_CHECKING(for Altivec with GCC -faltivec option)
slouken@1361
   638
            altivec_CFLAGS="-faltivec"
slouken@1361
   639
            CFLAGS="$save_CFLAGS $altivec_CFLAGS"
slouken@1361
   640
            if test x$have_altivec_h_hdr = xyes; then
slouken@1361
   641
              AC_TRY_COMPILE([
slouken@1361
   642
              #include <altivec.h>
slouken@1361
   643
              vector unsigned int vzero() {
slouken@1361
   644
                  return vec_splat_u32(0);
slouken@1361
   645
              }
slouken@1361
   646
              ],[
slouken@1361
   647
              ],[
slouken@1361
   648
              have_gcc_altivec=yes
slouken@1361
   649
              ])
slouken@1361
   650
              AC_MSG_RESULT($have_gcc_altivec)
slouken@1361
   651
            else
slouken@1361
   652
              AC_TRY_COMPILE([
slouken@1361
   653
              vector unsigned int vzero() {
slouken@1361
   654
                  return vec_splat_u32(0);
slouken@1361
   655
              }
slouken@1361
   656
              ],[
slouken@1361
   657
              ],[
slouken@1361
   658
              have_gcc_altivec=yes
slouken@1361
   659
              ])
slouken@1361
   660
              AC_MSG_RESULT($have_gcc_altivec)
slouken@1361
   661
            fi
slouken@1361
   662
        fi
slouken@1361
   663
        CFLAGS="$save_CFLAGS"
slouken@1361
   664
slouken@1361
   665
        if test x$have_gcc_altivec = xyes; then
slouken@1361
   666
            AC_DEFINE(SDL_ALTIVEC_BLITTERS)
slouken@1361
   667
            if test x$have_altivec_h_hdr = xyes; then
slouken@1361
   668
              AC_DEFINE(HAVE_ALTIVEC_H)
slouken@1361
   669
            fi
slouken@1361
   670
            BUILD_CFLAGS="$BUILD_CFLAGS $altivec_CFLAGS"
slouken@0
   671
        fi
slouken@0
   672
    fi
slouken@0
   673
}
slouken@0
   674
icculus@1140
   675
dnl Do the iPod thing
icculus@1140
   676
CheckIPod()
icculus@1140
   677
{
icculus@1140
   678
    AC_ARG_ENABLE(ipod,
slouken@1361
   679
AC_HELP_STRING([--enable-ipod], [configure SDL to work with iPodLinux [default=yes on arm-elf]]),
slouken@1361
   680
        , enable_ipod=yes)
icculus@1140
   681
icculus@1140
   682
    if test x$enable_ipod = xyes; then
slouken@1361
   683
        BUILD_CFLAGS="$BUILD_CFLAGS -DIPOD"
slouken@1361
   684
        AC_DEFINE(SDL_VIDEO_DRIVER_IPOD)
slouken@1361
   685
        SOURCES="$SOURCES $srcdir/src/video/ipod/*.c"
icculus@1140
   686
    fi
slouken@1361
   687
}
icculus@1140
   688
slouken@30
   689
dnl Find the nanox include and library directories
slouken@30
   690
CheckNANOX()
slouken@30
   691
{
slouken@292
   692
    AC_ARG_ENABLE(video-nanox,
slouken@1361
   693
        AC_HELP_STRING([--enable-video-nanox], [use nanox video driver [default=no]]),
slouken@292
   694
        , enable_video_nanox=no)
slouken@30
   695
slouken@292
   696
    if test x$enable_video = xyes -a x$enable_video_nanox = xyes; then
slouken@1361
   697
        AC_ARG_ENABLE(nanox-debug,  
slouken@1361
   698
            AC_HELP_STRING([--enable-nanox-debug], [print debug messages [default=no]]),
slouken@1361
   699
            , enable_nanox_debug=no)
slouken@292
   700
        if test x$enable_nanox_debug = xyes; then
slouken@1361
   701
            BUILD_CFLAGS="$BUILD_CFLAGS -DENABLE_NANOX_DEBUG"
slouken@292
   702
        fi
slouken@30
   703
slouken@1361
   704
        AC_ARG_ENABLE(nanox-share-memory,  
slouken@1361
   705
            AC_HELP_STRING([--enable-nanox-share-memory], [use share memory [default=no]]),
slouken@1361
   706
            , enable_nanox_share_memory=no)
slouken@292
   707
        if test x$enable_nanox_share_memory = xyes; then
slouken@1361
   708
            BUILD_CFLAGS="$BUILD_CFLAGS -DNANOX_SHARE_MEMORY"
slouken@292
   709
        fi
slouken@30
   710
slouken@1361
   711
        AC_ARG_ENABLE(nanox_direct_fb, 
slouken@1361
   712
            AC_HELP_STRING([--enable-nanox-direct-fb], [use direct framebuffer access [default=no]]),
slouken@1361
   713
            , enable_nanox_direct_fb=no)
slouken@471
   714
        if test x$enable_nanox_direct_fb = xyes; then
slouken@1361
   715
            BUILD_CFLAGS="$BUILD_CFLAGS -DENABLE_NANOX_DIRECT_FB"
slouken@471
   716
        fi
slouken@30
   717
slouken@1361
   718
        AC_DEFINE(SDL_VIDEO_DRIVER_NANOX)
slouken@1361
   719
        SOURCES="$SOURCES $srcdir/src/video/nanox/*.c"
slouken@1361
   720
        BUILD_LIBS="$BUILD_LIBS -lnano-X"
slouken@1361
   721
        have_video=yes
slouken@292
   722
    fi
slouken@30
   723
}
slouken@30
   724
slouken@0
   725
dnl Find the X11 include and library directories
slouken@0
   726
CheckX11()
slouken@0
   727
{
slouken@0
   728
    AC_ARG_ENABLE(video-x11,
slouken@1361
   729
AC_HELP_STRING([--enable-video-x11], [use X11 video driver [default=yes]]),
slouken@0
   730
                  , enable_video_x11=yes)
slouken@0
   731
    if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
slouken@0
   732
        AC_PATH_X
slouken@0
   733
        AC_PATH_XTRA
slouken@0
   734
        if test x$have_x = xyes; then
icculus@1168
   735
            AC_ARG_ENABLE(x11-shared,
slouken@1361
   736
AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [default=yes]]),
icculus@1168
   737
                          , enable_x11_shared=yes)
icculus@1168
   738
icculus@1174
   739
            case "$target" in
slouken@1384
   740
                *-*-darwin*)
icculus@1174
   741
                    x11_lib='/usr/X11R6/lib/libX11.6.dylib'
icculus@1174
   742
                    x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
icculus@1174
   743
                    ;;
slouken@1384
   744
                *-*-osf*)
slouken@1384
   745
                    x11_lib='libX11.so'
slouken@1384
   746
                    x11ext_lib='libXext.so'
slouken@1384
   747
                    ;;
slouken@1384
   748
                *-*-irix*) # IRIX 6.5 requires that we use /usr/lib32
icculus@1299
   749
                    x11_lib='libX11.so'
icculus@1299
   750
                    x11ext_lib='libXext.so'
icculus@1299
   751
                    ;;
icculus@1174
   752
                *)
slouken@1370
   753
                    if test x$X_LIBS = x; then X_LIBS="-L/usr/lib"; fi
slouken@1384
   754
                    x11_lib_spec=`echo $X_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libX11.so*/'`
slouken@1384
   755
                    x11_lib=`ls $x11_lib_spec 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`
slouken@1384
   756
                    x11ext_lib_spec=`echo $X_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libXext.so*/'`
slouken@1384
   757
                    x11ext_lib=`ls $x11ext_lib_spec 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`
icculus@1174
   758
                    ;;
icculus@1174
   759
            esac
icculus@1168
   760
slouken@1361
   761
            X_CFLAGS="$X_CFLAGS -DXTHREADS"
slouken@1361
   762
            if test x$ac_cv_func_shmat != xyes; then
slouken@1361
   763
                X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY"
slouken@1361
   764
            fi
icculus@1173
   765
            if test x$have_loadso != xyes && \
icculus@1168
   766
               test x$enable_x11_shared = xyes; then
icculus@1173
   767
                AC_MSG_ERROR([You must have SDL_LoadObject() support])
icculus@1168
   768
            fi
icculus@1168
   769
icculus@1173
   770
            if test x$have_loadso = xyes && \
icculus@1170
   771
               test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then
icculus@1174
   772
                echo "-- dynamic libX11 -> $x11_lib"
icculus@1174
   773
                echo "-- dynamic libX11ext -> $x11ext_lib"
slouken@1361
   774
                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib")
slouken@1361
   775
                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib")
icculus@1168
   776
            else
slouken@1361
   777
                X_LIBS="$X_LIBS -lX11 -lXext"
icculus@1168
   778
            fi
icculus@1168
   779
slouken@1361
   780
            AC_DEFINE(SDL_VIDEO_DRIVER_X11)
slouken@1361
   781
            SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
slouken@1361
   782
            BUILD_CFLAGS="$BUILD_CFLAGS $X_CFLAGS"
slouken@1361
   783
            BUILD_LIBS="$BUILD_LIBS $X_LIBS"
slouken@1361
   784
            have_video=yes
slouken@0
   785
slouken@1307
   786
            AC_ARG_ENABLE(dga,
slouken@1361
   787
AC_HELP_STRING([--enable-dga], [allow use of X11 DGA code [default=yes]]),
slouken@1307
   788
                          , enable_dga=yes)
slouken@1307
   789
            if test x$enable_dga = xyes; then
slouken@1361
   790
                SOURCES="$SOURCES $srcdir/src/video/Xext/Xxf86dga/*.c"
slouken@1307
   791
            fi
slouken@1307
   792
            AC_ARG_ENABLE(video-dga,
slouken@1361
   793
AC_HELP_STRING([--enable-video-dga], [use DGA 2.0 video driver [default=yes]]),
slouken@1307
   794
                  , enable_video_dga=yes)
slouken@1307
   795
            if test x$enable_dga = xyes -a x$enable_video_dga = xyes; then
slouken@1361
   796
                AC_DEFINE(SDL_VIDEO_DRIVER_DGA)
slouken@1361
   797
                SOURCES="$SOURCES $srcdir/src/video/dga/*.c"
slouken@1307
   798
            fi
slouken@1307
   799
            AC_ARG_ENABLE(video-x11-dgamouse,
slouken@1361
   800
AC_HELP_STRING([--enable-video-x11-dgamouse], [use X11 DGA for mouse events [default=yes]]),
slouken@1307
   801
                          , enable_video_x11_dgamouse=yes)
slouken@1307
   802
            if test x$enable_dga = xyes -a x$enable_video_x11_dgamouse = xyes; then
slouken@1361
   803
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_DGAMOUSE)
slouken@1307
   804
            fi
slouken@0
   805
            AC_ARG_ENABLE(video-x11-vm,
slouken@1361
   806
AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [default=yes]]),
slouken@0
   807
                          , enable_video_x11_vm=yes)
slouken@0
   808
            if test x$enable_video_x11_vm = xyes; then
slouken@1361
   809
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_VIDMODE)
slouken@1361
   810
                SOURCES="$SOURCES $srcdir/src/video/Xext/Xxf86vm/*.c"
slouken@0
   811
            fi
slouken@0
   812
            AC_ARG_ENABLE(video-x11-xv,
slouken@1361
   813
AC_HELP_STRING([--enable-video-x11-xv], [use X11 XvImage extension for video [default=yes]]),
slouken@0
   814
                          , enable_video_x11_xv=yes)
slouken@0
   815
            if test x$enable_video_x11_xv = xyes; then
slouken@1361
   816
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XV)
slouken@1361
   817
                SOURCES="$SOURCES $srcdir/src/video/Xext/Xv/*.c"
slouken@0
   818
            fi
slouken@227
   819
            AC_ARG_ENABLE(video-x11-xinerama,
slouken@1361
   820
AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [default=yes]]),
slouken@227
   821
                            , enable_video_x11_xinerama=yes)
slouken@227
   822
            if test x$enable_video_x11_xinerama = xyes; then
slouken@1361
   823
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA)
slouken@1361
   824
                SOURCES="$SOURCES $srcdir/src/video/Xext/Xinerama/*.c"
slouken@227
   825
            fi
slouken@242
   826
            AC_ARG_ENABLE(video-x11-xme,
slouken@1361
   827
AC_HELP_STRING([--enable-video-x11-xme], [enable Xi Graphics XME for fullscreen [default=yes]]),
slouken@242
   828
                            , enable_video_x11_xme=yes)
slouken@242
   829
            if test x$enable_video_x11_xme = xyes; then
slouken@1361
   830
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XME)
slouken@1361
   831
                SOURCES="$SOURCES $srcdir/src/video/Xext/XME/*.c"
slouken@242
   832
            fi
slouken@0
   833
        fi
slouken@0
   834
    fi
slouken@0
   835
}
slouken@279
   836
slouken@1361
   837
dnl Check for QNX photon video driver
slouken@0
   838
CheckPHOTON()
slouken@0
   839
{
slouken@0
   840
    AC_ARG_ENABLE(video-photon,
slouken@1361
   841
AC_HELP_STRING([--enable-video-photon], [use QNX Photon video driver [default=yes]]),
slouken@0
   842
                  , enable_video_photon=yes)
slouken@0
   843
    if test x$enable_video = xyes -a x$enable_video_photon = xyes; then
slouken@0
   844
        AC_MSG_CHECKING(for QNX Photon support)
slouken@0
   845
        video_photon=no
slouken@0
   846
        AC_TRY_COMPILE([
slouken@0
   847
          #include <Ph.h>
slouken@0
   848
          #include <Pt.h>
slouken@0
   849
          #include <photon/Pg.h>
slouken@0
   850
          #include <photon/PdDirect.h>
slouken@0
   851
        ],[
slouken@0
   852
         PgDisplaySettings_t *visual;
slouken@0
   853
        ],[
slouken@0
   854
        video_photon=yes
slouken@0
   855
        ])
slouken@0
   856
        AC_MSG_RESULT($video_photon)
slouken@0
   857
        if test x$video_photon = xyes; then
slouken@1361
   858
            AC_DEFINE(SDL_VIDEO_DRIVER_PHOTON)
slouken@1361
   859
            SOURCES="$SOURCES $srcdir/src/video/photon/*.c"
slouken@1361
   860
            BUILD_LIBS="$BUILD_LIBS -lph"
slouken@1361
   861
            have_video=yes
slouken@1361
   862
slouken@279
   863
            CheckOpenGLQNX
slouken@0
   864
        fi
slouken@0
   865
    fi
slouken@0
   866
}
slouken@0
   867
slouken@1361
   868
dnl Set up the BWindow video driver if enabled
slouken@1361
   869
CheckBWINDOW()
slouken@1361
   870
{
slouken@1361
   871
    if test x$enable_video = xyes; then
slouken@1361
   872
        AC_DEFINE(SDL_VIDEO_DRIVER_BWINDOW)
slouken@1361
   873
        SOURCES="$SOURCES $srcdir/src/video/bwindow/*.cc"
slouken@1361
   874
        have_video=yes
slouken@1361
   875
    fi
slouken@1361
   876
}
slouken@1361
   877
slouken@1361
   878
dnl Set up the Carbon/QuickDraw video driver for Mac OS X (but not Darwin)
slouken@1361
   879
CheckCARBON()
slouken@1361
   880
{
slouken@1361
   881
    AC_ARG_ENABLE(video-carbon,
slouken@1361
   882
AC_HELP_STRING([--enable-video-carbon], [use Carbon/QuickDraw video driver [default=no]]),
slouken@1361
   883
                  , enable_video_carbon=no)
slouken@1361
   884
    if test x$enable_video = xyes -a x$enable_video_carbon = xyes; then
slouken@1361
   885
        AC_MSG_CHECKING(for Carbon framework)
slouken@1361
   886
        have_carbon=no
slouken@1361
   887
        AC_TRY_COMPILE([
slouken@1361
   888
          #include <Carbon/Carbon.h>
slouken@1361
   889
        ],[
slouken@1361
   890
        ],[
slouken@1361
   891
        have_carbon=yes
slouken@1361
   892
        ])
slouken@1361
   893
        AC_MSG_RESULT($have_carbon)
slouken@1361
   894
        if test x$have_carbon = xyes; then
slouken@1361
   895
            AC_DEFINE(SDL_VIDEO_DRIVER_TOOLBOX)
slouken@1361
   896
            SOURCES="$SOURCES $srcdir/src/video/maccommon/*.c"
slouken@1361
   897
            SOURCES="$SOURCES $srcdir/src/video/macrom/*.c"
slouken@1361
   898
            have_video=yes
slouken@1361
   899
        fi
slouken@1361
   900
    fi
slouken@1361
   901
}
slouken@1361
   902
slouken@1361
   903
dnl Set up the Cocoa/Quartz video driver for Mac OS X (but not Darwin)
slouken@1361
   904
CheckCOCOA()
slouken@1361
   905
{
slouken@1361
   906
    AC_ARG_ENABLE(video-cocoa,
slouken@1361
   907
AC_HELP_STRING([--enable-video-cocoa], [use Cocoa/Quartz video driver [default=yes]]),
slouken@1361
   908
                  , enable_video_cocoa=yes)
slouken@1361
   909
    if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
slouken@1361
   910
        save_CFLAGS="$CFLAGS"
slouken@1361
   911
        dnl work around that we don't have Objective-C support in autoconf
slouken@1361
   912
        CFLAGS="$CFLAGS -x objective-c"
slouken@1361
   913
        AC_MSG_CHECKING(for Cocoa framework)
slouken@1361
   914
        have_cocoa=no
slouken@1361
   915
        AC_TRY_COMPILE([
slouken@1361
   916
          #import <Cocoa/Cocoa.h>
slouken@1361
   917
        ],[
slouken@1361
   918
        ],[
slouken@1361
   919
        have_cocoa=yes
slouken@1361
   920
        ])
slouken@1361
   921
        AC_MSG_RESULT($have_cocoa)
slouken@1361
   922
        CFLAGS="$save_CFLAGS"
slouken@1361
   923
        if test x$have_cocoa = xyes; then
slouken@1361
   924
            AC_DEFINE(SDL_VIDEO_DRIVER_QUARTZ)
slouken@1361
   925
            SOURCES="$SOURCES $srcdir/src/video/quartz/*.m"
slouken@1361
   926
            have_video=yes
slouken@1361
   927
        fi
slouken@1361
   928
    fi
slouken@1361
   929
}
slouken@1361
   930
slouken@0
   931
dnl Find the framebuffer console includes
slouken@0
   932
CheckFBCON()
slouken@0
   933
{
slouken@0
   934
    AC_ARG_ENABLE(video-fbcon,
slouken@1361
   935
AC_HELP_STRING([--enable-video-fbcon], [use framebuffer console video driver [default=yes]]),
slouken@0
   936
                  , enable_video_fbcon=yes)
slouken@0
   937
    if test x$enable_video = xyes -a x$enable_video_fbcon = xyes; then
slouken@0
   938
        AC_MSG_CHECKING(for framebuffer console support)
slouken@0
   939
        video_fbcon=no
slouken@0
   940
        AC_TRY_COMPILE([
slouken@0
   941
         #include <linux/fb.h>
slouken@0
   942
         #include <linux/kd.h>
slouken@0
   943
         #include <linux/keyboard.h>
slouken@0
   944
        ],[
slouken@0
   945
        ],[
slouken@0
   946
        video_fbcon=yes
slouken@0
   947
        ])
slouken@0
   948
        AC_MSG_RESULT($video_fbcon)
slouken@0
   949
        if test x$video_fbcon = xyes; then
slouken@1361
   950
            AC_DEFINE(SDL_VIDEO_DRIVER_FBCON)
slouken@1361
   951
            SOURCES="$SOURCES $srcdir/src/video/fbcon/*.c"
slouken@1361
   952
            have_video=yes
slouken@0
   953
        fi
slouken@0
   954
    fi
slouken@0
   955
}
slouken@0
   956
slouken@167
   957
dnl Find DirectFB
slouken@167
   958
CheckDirectFB()
slouken@167
   959
{
slouken@167
   960
    AC_ARG_ENABLE(video-directfb,
slouken@1361
   961
AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [default=no]]),
slouken@678
   962
                  , enable_video_directfb=no)
slouken@167
   963
    if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
slouken@167
   964
        video_directfb=no
slouken@167
   965
slouken@167
   966
        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
slouken@167
   967
        if test x$PKG_CONFIG = xno ; then
slouken@167
   968
            AC_MSG_WARN([*** pkg-config is required to build the DirectFB video driver.])
slouken@167
   969
        else
slouken@167
   970
            AC_MSG_CHECKING(for DirectFB support)
slouken@167
   971
slouken@477
   972
            if ! $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then
slouken@477
   973
                AC_MSG_ERROR([*** pkg-config too old; version 0.7 or better required.])
slouken@167
   974
            fi
slouken@167
   975
slouken@546
   976
            DIRECTFB_REQUIRED_VERSION=0.9.15
slouken@167
   977
slouken@167
   978
            if $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb ; then
slouken@167
   979
                DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
slouken@167
   980
                DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
slouken@167
   981
                video_directfb=yes
slouken@167
   982
            fi
slouken@167
   983
        fi
slouken@167
   984
slouken@167
   985
        AC_MSG_RESULT($video_directfb)
slouken@167
   986
        if test x$video_directfb = xyes; then
slouken@1361
   987
            AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB)
slouken@1361
   988
            SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
slouken@1361
   989
            BUILD_CFLAGS="$BUILD_CFLAGS $DIRECTFB_CFLAGS"
slouken@1361
   990
            BUILD_LIBS="$BUILD_LIBS $DIRECTFB_LIBS"
slouken@1361
   991
            have_video=yes
slouken@167
   992
        fi
slouken@167
   993
    fi
slouken@167
   994
}
slouken@167
   995
slouken@70
   996
dnl See if we're running on PlayStation 2 hardware
slouken@70
   997
CheckPS2GS()
slouken@70
   998
{
slouken@72
   999
    AC_ARG_ENABLE(video-ps2gs,
slouken@1361
  1000
AC_HELP_STRING([--enable-video-ps2gs], [use PlayStation 2 GS video driver [default=yes]]),
slouken@72
  1001
                  , enable_video_ps2gs=yes)
slouken@70
  1002
    if test x$enable_video = xyes -a x$enable_video_ps2gs = xyes; then
slouken@72
  1003
        AC_MSG_CHECKING(for PlayStation 2 GS support)
slouken@70
  1004
        video_ps2gs=no
slouken@70
  1005
        AC_TRY_COMPILE([
slouken@70
  1006
         #include <linux/ps2/dev.h>
slouken@70
  1007
         #include <linux/ps2/gs.h>
slouken@70
  1008
        ],[
slouken@70
  1009
        ],[
slouken@70
  1010
        video_ps2gs=yes
slouken@70
  1011
        ])
slouken@72
  1012
        AC_MSG_RESULT($video_ps2gs)
slouken@70
  1013
        if test x$video_ps2gs = xyes; then
slouken@1361
  1014
            AC_DEFINE(SDL_VIDEO_DRIVER_PS2GS)
slouken@1361
  1015
            SOURCES="$SOURCES $srcdir/src/video/ps2gs/*.c"
slouken@1361
  1016
            have_video=yes
slouken@70
  1017
        fi
slouken@70
  1018
    fi
slouken@70
  1019
}
slouken@70
  1020
slouken@0
  1021
dnl Find the GGI includes
slouken@0
  1022
CheckGGI()
slouken@0
  1023
{
slouken@0
  1024
    AC_ARG_ENABLE(video-ggi,
slouken@1361
  1025
AC_HELP_STRING([--enable-video-ggi], [use GGI video driver [default=no]]),
slouken@0
  1026
                  , enable_video_ggi=no)
slouken@0
  1027
    if test x$enable_video = xyes -a x$enable_video_ggi = xyes; then
slouken@0
  1028
        AC_MSG_CHECKING(for GGI support)
slouken@0
  1029
        video_ggi=no
slouken@0
  1030
        AC_TRY_COMPILE([
slouken@0
  1031
         #include <ggi/ggi.h>
slouken@0
  1032
         #include <ggi/gii.h>
slouken@0
  1033
        ],[
slouken@0
  1034
        ],[
slouken@0
  1035
        video_ggi=yes
slouken@0
  1036
        ])
slouken@0
  1037
        AC_MSG_RESULT($video_ggi)
slouken@0
  1038
        if test x$video_ggi = xyes; then
slouken@1361
  1039
            AC_DEFINE(SDL_VIDEO_DRIVER_GGI)
slouken@1361
  1040
            SOURCES="$SOURCES $srcdir/src/video/ggi/*.c"
slouken@1361
  1041
            BUILD_LIBS="$BUILD_LIBS -lggi -lgii -lgg"
slouken@1361
  1042
            have_video=yes
slouken@0
  1043
        fi
slouken@0
  1044
    fi
slouken@0
  1045
}
slouken@0
  1046
slouken@0
  1047
dnl Find the SVGAlib includes and libraries
slouken@0
  1048
CheckSVGA()
slouken@0
  1049
{
slouken@0
  1050
    AC_ARG_ENABLE(video-svga,
slouken@1361
  1051
AC_HELP_STRING([--enable-video-svga], [use SVGAlib video driver [default=no]]),
slouken@0
  1052
                  , enable_video_svga=no)
slouken@0
  1053
    if test x$enable_video = xyes -a x$enable_video_svga = xyes; then
slouken@0
  1054
        AC_MSG_CHECKING(for SVGAlib (1.4.0+) support)
slouken@0
  1055
        video_svga=no
slouken@0
  1056
        AC_TRY_COMPILE([
slouken@0
  1057
         #include <vga.h>
slouken@0
  1058
         #include <vgamouse.h>
slouken@0
  1059
         #include <vgakeyboard.h>
slouken@0
  1060
        ],[
slouken@0
  1061
         if ( SCANCODE_RIGHTWIN && SCANCODE_LEFTWIN ) {
slouken@0
  1062
             exit(0);
slouken@0
  1063
         }
slouken@0
  1064
        ],[
slouken@0
  1065
        video_svga=yes
slouken@0
  1066
        ])
slouken@0
  1067
        AC_MSG_RESULT($video_svga)
slouken@0
  1068
        if test x$video_svga = xyes; then
slouken@1361
  1069
            AC_DEFINE(SDL_VIDEO_DRIVER_SVGALIB)
slouken@1361
  1070
            SOURCES="$SOURCES $srcdir/src/video/svga/*.c"
slouken@1361
  1071
            BUILD_LIBS="$BUILD_LIBS -lvga"
slouken@1361
  1072
            have_video=yes
slouken@0
  1073
        fi
slouken@0
  1074
    fi
slouken@0
  1075
}
slouken@0
  1076
slouken@75
  1077
dnl Find the VGL includes and libraries
slouken@75
  1078
CheckVGL()
slouken@75
  1079
{
slouken@75
  1080
    AC_ARG_ENABLE(video-vgl,
slouken@1361
  1081
AC_HELP_STRING([--enable-video-vgl], [use VGL video driver [default=no]]),
slouken@75
  1082
                  , enable_video_vgl=no)
slouken@75
  1083
    if test x$enable_video = xyes -a x$enable_video_vgl = xyes; then
slouken@75
  1084
        AC_MSG_CHECKING(for libVGL support)
slouken@75
  1085
        video_vgl=no
slouken@75
  1086
        AC_TRY_COMPILE([
slouken@75
  1087
         #include <sys/fbio.h>
slouken@75
  1088
         #include <sys/consio.h>
slouken@75
  1089
         #include <sys/kbio.h>
slouken@75
  1090
         #include <vgl.h>
slouken@75
  1091
        ],[
slouken@75
  1092
         VGLBitmap bitmap;
slouken@144
  1093
         exit(bitmap.Bitmap);
slouken@75
  1094
        ],[
slouken@75
  1095
        video_vgl=yes
slouken@75
  1096
        ])
slouken@75
  1097
        AC_MSG_RESULT($video_vgl)
slouken@75
  1098
        if test x$video_vgl = xyes; then
slouken@1361
  1099
            AC_DEFINE(SDL_VIDEO_DRIVER_VGL)
slouken@1361
  1100
            SOURCES="$SOURCES $srcdir/src/video/vgl/*.c"
slouken@1361
  1101
            BUILD_LIBS="$BUILD_LIBS -lvgl"
slouken@1361
  1102
            have_video=yes
slouken@75
  1103
        fi
slouken@75
  1104
    fi
slouken@75
  1105
}
slouken@75
  1106
slouken@1361
  1107
dnl Set up the wscons video driver if enabled
slouken@1361
  1108
CheckWscons()
slouken@1361
  1109
{
slouken@1361
  1110
    AC_ARG_ENABLE(video-wscons,
slouken@1361
  1111
AC_HELP_STRING([--enable-video-wscons], [use wscons video driver [default=yes]]),
slouken@1361
  1112
                  , enable_video_wscons=yes)
slouken@1361
  1113
    if test x$enable_video = xyes -a x$enable_video_wscons = xyes; then
slouken@1361
  1114
        AC_MSG_CHECKING(for wscons support)
slouken@1361
  1115
        video_wscons=no
slouken@1361
  1116
        AC_TRY_COMPILE([
slouken@1361
  1117
       #include <sys/time.h>
slouken@1361
  1118
       #include <dev/wscons/wsconsio.h>
slouken@1361
  1119
        ],[
slouken@1361
  1120
        ],[
slouken@1361
  1121
        video_wscons=yes
slouken@1361
  1122
        ])
slouken@1361
  1123
        AC_MSG_RESULT($video_wscons)
slouken@1361
  1124
        if test x$video_wscons = xyes; then
slouken@1361
  1125
            AC_DEFINE(SDL_VIDEO_DRIVER_WSCONS)
slouken@1361
  1126
            SOURCES="$SOURCES $srcdir/src/video/wscons/*.c"
slouken@1361
  1127
            have_video=yes
slouken@1361
  1128
        fi
slouken@1361
  1129
    fi
slouken@1361
  1130
}
slouken@1361
  1131
slouken@1361
  1132
slouken@0
  1133
dnl Find the AAlib includes
slouken@0
  1134
CheckAAlib()
slouken@0
  1135
{
slouken@0
  1136
    AC_ARG_ENABLE(video-aalib,
slouken@1361
  1137
AC_HELP_STRING([--enable-video-aalib], [use AAlib video driver [default=no]]),
slouken@0
  1138
                  , enable_video_aalib=no)
slouken@0
  1139
    if test x$enable_video = xyes -a x$enable_video_aalib = xyes; then
slouken@0
  1140
        AC_MSG_CHECKING(for AAlib support)
slouken@0
  1141
        video_aalib=no
slouken@0
  1142
        AC_TRY_COMPILE([
slouken@0
  1143
         #include <aalib.h>
slouken@0
  1144
        ],[
slouken@0
  1145
        ],[
slouken@0
  1146
        video_aalib=yes
slouken@0
  1147
        ])
slouken@0
  1148
        AC_MSG_RESULT($video_aalib)
slouken@0
  1149
        if test x$video_aalib = xyes; then
slouken@1361
  1150
            AC_DEFINE(SDL_VIDEO_DRIVER_AALIB)
slouken@1361
  1151
            SOURCES="$SOURCES $srcdir/src/video/aalib/*.c"
slouken@1361
  1152
            BUILD_LIBS="$BUILD_LIBS -laa"
slouken@1361
  1153
            have_video=yes
slouken@0
  1154
        fi
slouken@0
  1155
    fi
slouken@0
  1156
}
slouken@0
  1157
slouken@1361
  1158
dnl Set up the QTopia video driver if enabled
slouken@1361
  1159
CheckQtopia()
slouken@1361
  1160
{
slouken@1361
  1161
    AC_ARG_ENABLE(video-qtopia,
slouken@1361
  1162
AC_HELP_STRING([--enable-video-qtopia], [use Qtopia video driver [default=no]]),
slouken@1361
  1163
                  , enable_video_qtopia=no)
slouken@1361
  1164
    if test x$enable_video = xyes -a x$enable_video_qtopia = xyes; then
slouken@1361
  1165
        AC_MSG_CHECKING(for Qtopia support)
slouken@1361
  1166
        video_qtopia=no
slouken@1361
  1167
        QTOPIA_FLAGS="-DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -I${QPEDIR}/include -I${QTDIR}/include/ -DNO_DEBUG -fno-rtti -fno-exceptions"
slouken@1361
  1168
        AC_LANG_CPLUSPLUS
slouken@1361
  1169
        OLD_CXX="$CXXFLAGS"
slouken@1361
  1170
        CXXFLAGS="$QTOPIA_FLAGS"
slouken@1361
  1171
        AC_TRY_COMPILE([
slouken@1361
  1172
         #include <qpe/qpeapplication.h>
slouken@1361
  1173
        ],[
slouken@1361
  1174
        ],[
slouken@1361
  1175
        video_qtopia=yes
slouken@1361
  1176
        ])
slouken@1361
  1177
        CXXFLAGS="$OLD_CXX"
slouken@1361
  1178
        AC_MSG_RESULT($video_qtopia)
slouken@1361
  1179
        if test x$video_qtopia = xyes; then
slouken@1361
  1180
            AC_DEFINE(SDL_VIDEO_DRIVER_QTOPIA)
slouken@1361
  1181
            SOURCES="$SOURCES $srcdir/src/video/qtopia/*.cc"
slouken@1361
  1182
            BUILD_CFLAGS="$BUILD_CFLAGS $QTOPIA_FLAGS"
slouken@1361
  1183
            SDL_CFLAGS="$SDL_CFLAGS -DQWS -Dmain=SDL_main"
slouken@1361
  1184
            SDL_LIBS="-lSDLmain $SDL_LIBS -L${QPEDIR}/lib -L${QTDIR}/lib/ -lqpe -lqte"
slouken@1361
  1185
            have_video=yes
slouken@1361
  1186
        fi
slouken@1361
  1187
        AC_LANG_C
slouken@1361
  1188
    fi
slouken@1361
  1189
}
slouken@1361
  1190
slouken@1361
  1191
dnl Set up the PicoGUI video driver if enabled
slouken@1361
  1192
CheckPicoGUI()
slouken@1361
  1193
{
slouken@1361
  1194
    AC_ARG_ENABLE(video-picogui,
slouken@1361
  1195
AC_HELP_STRING([--enable-video-picogui], [use PicoGUI video driver [default=no]]),
slouken@1361
  1196
                  , enable_video_picogui=no)
slouken@1361
  1197
    if test x$enable_video = xyes -a x$enable_video_picogui = xyes; then
slouken@1361
  1198
        AC_MSG_CHECKING(for PicoGUI support)
slouken@1361
  1199
        video_picogui=no
slouken@1361
  1200
        AC_TRY_COMPILE([
slouken@1361
  1201
         #include <picogui.h>
slouken@1361
  1202
        ],[
slouken@1361
  1203
        ],[
slouken@1361
  1204
        video_picogui=yes
slouken@1361
  1205
        ])
slouken@1361
  1206
        AC_MSG_RESULT($video_picogui)
slouken@1361
  1207
        if test x$video_picogui = xyes; then
slouken@1361
  1208
            AC_DEFINE(SDL_VIDEO_DRIVER_PICOGUI)
slouken@1361
  1209
            SOURCES="$SOURCES $srcdir/src/video/picogui/*.c"
slouken@1361
  1210
            SDL_LIBS="$SDL_LIBS -lpgui"
slouken@1361
  1211
            have_video=yes
slouken@1361
  1212
        fi
slouken@1361
  1213
    fi
slouken@1361
  1214
}
slouken@1361
  1215
slouken@1361
  1216
dnl Set up the Atari Bios keyboard driver
slouken@1361
  1217
CheckAtariBiosEvent()
slouken@1361
  1218
{
slouken@1361
  1219
    SOURCES="$SOURCES $srcdir/src/video/ataricommon/*.c"
slouken@1361
  1220
}
slouken@1361
  1221
slouken@281
  1222
dnl Set up the Atari Xbios driver
slouken@281
  1223
CheckAtariXbiosVideo()
slouken@281
  1224
{
slouken@281
  1225
    AC_ARG_ENABLE(xbios,
slouken@1361
  1226
AC_HELP_STRING([--enable-video-xbios], [use Atari Xbios video driver [default=yes]]),
slouken@281
  1227
                  , enable_video_xbios=yes)
slouken@281
  1228
    video_xbios=no
slouken@281
  1229
    if test x$enable_video = xyes -a x$enable_video_xbios = xyes; then
slouken@281
  1230
        video_xbios=yes
slouken@1361
  1231
        AC_DEFINE(SDL_VIDEO_DRIVER_XBIOS)
slouken@1361
  1232
        SOURCES="$SOURCES $srcdir/src/video/xbios/*.c"
slouken@1361
  1233
        have_video=yes
slouken@281
  1234
    fi
slouken@281
  1235
}
slouken@281
  1236
slouken@281
  1237
dnl Set up the Atari Gem driver
slouken@281
  1238
CheckAtariGemVideo()
slouken@281
  1239
{
slouken@281
  1240
    AC_ARG_ENABLE(gem,
slouken@1361
  1241
AC_HELP_STRING([--enable-video-gem], [use Atari Gem video driver [default=yes]]),
slouken@281
  1242
                  , enable_video_gem=yes)
slouken@281
  1243
    if test x$enable_video = xyes -a x$enable_video_gem = xyes; then
slouken@281
  1244
        video_gem=no
slouken@281
  1245
        AC_CHECK_HEADER(gem.h, have_gem_hdr=yes)
slouken@281
  1246
        AC_CHECK_LIB(gem, appl_init, have_gem_lib=yes)
slouken@281
  1247
        if test x$have_gem_hdr = xyes -a x$have_gem_lib = xyes; then
slouken@1366
  1248
            video_gem=yes
slouken@1361
  1249
            AC_DEFINE(SDL_VIDEO_DRIVER_GEM)
slouken@1361
  1250
            SOURCES="$SOURCES $srcdir/src/video/gem/*.c"
slouken@1361
  1251
            BUILD_LIBS="$BUILD_LIBS -lgem"
slouken@1361
  1252
            have_video=yes
slouken@281
  1253
        fi
slouken@281
  1254
    fi
slouken@281
  1255
}
slouken@281
  1256
slouken@1
  1257
dnl rcg04172001 Set up the Null video driver.
slouken@1
  1258
CheckDummyVideo()
slouken@1
  1259
{
slouken@1
  1260
    AC_ARG_ENABLE(video-dummy,
slouken@1361
  1261
AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [default=yes]]),
slouken@86
  1262
                  , enable_video_dummy=yes)
slouken@1
  1263
    if test x$enable_video_dummy = xyes; then
slouken@1361
  1264
        AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY)
slouken@1361
  1265
        SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
slouken@1361
  1266
        have_video=yes
slouken@1
  1267
    fi
slouken@1
  1268
}
slouken@1
  1269
slouken@0
  1270
dnl Check to see if OpenGL support is desired
slouken@0
  1271
AC_ARG_ENABLE(video-opengl,
slouken@1361
  1272
AC_HELP_STRING([--enable-video-opengl], [include OpenGL context creation [default=yes]]),
slouken@0
  1273
              , enable_video_opengl=yes)
slouken@0
  1274
slouken@0
  1275
dnl Find OpenGL
icculus@1191
  1276
CheckOpenGLX11()
slouken@0
  1277
{
slouken@0
  1278
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@0
  1279
        AC_MSG_CHECKING(for OpenGL (GLX) support)
slouken@0
  1280
        video_opengl=no
slouken@0
  1281
        AC_TRY_COMPILE([
slouken@0
  1282
         #include <GL/gl.h>
slouken@0
  1283
         #include <GL/glx.h>
slouken@0
  1284
        ],[
slouken@0
  1285
        ],[
slouken@0
  1286
        video_opengl=yes
slouken@0
  1287
        ])
slouken@0
  1288
        AC_MSG_RESULT($video_opengl)
slouken@0
  1289
        if test x$video_opengl = xyes; then
slouken@1361
  1290
            AC_DEFINE(SDL_VIDEO_OPENGL)
slouken@1361
  1291
            AC_DEFINE(SDL_VIDEO_OPENGL_GLX)
slouken@0
  1292
        fi
slouken@0
  1293
    fi
slouken@0
  1294
}
slouken@0
  1295
slouken@279
  1296
dnl Find QNX RtP OpenGL
slouken@279
  1297
CheckOpenGLQNX()
slouken@279
  1298
{
slouken@279
  1299
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@279
  1300
        AC_MSG_CHECKING(for OpenGL (Photon) support)
slouken@279
  1301
        video_opengl=no
slouken@279
  1302
        AC_TRY_COMPILE([
slouken@279
  1303
         #include <GL/gl.h>
slouken@279
  1304
        ],[
slouken@279
  1305
        ],[
slouken@279
  1306
        video_opengl=yes
slouken@279
  1307
        ])
slouken@279
  1308
        AC_MSG_RESULT($video_opengl)
slouken@279
  1309
        if test x$video_opengl = xyes; then
slouken@1361
  1310
            AC_DEFINE(SDL_VIDEO_OPENGL)
slouken@1361
  1311
            BUILD_LIBS="$BUILD_LIBS -lGL"
slouken@279
  1312
        fi
slouken@279
  1313
    fi
slouken@279
  1314
}
slouken@279
  1315
slouken@1361
  1316
dnl Check for Win32 OpenGL
slouken@1361
  1317
CheckWIN32GL()
slouken@1361
  1318
{
slouken@1361
  1319
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@1361
  1320
        AC_DEFINE(SDL_VIDEO_OPENGL)
slouken@1361
  1321
        AC_DEFINE(SDL_VIDEO_OPENGL_WGL)
slouken@1361
  1322
    fi
slouken@1361
  1323
}
slouken@1361
  1324
slouken@0
  1325
dnl Check for BeOS OpenGL
slouken@0
  1326
CheckBeGL()
slouken@0
  1327
{
slouken@0
  1328
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@1361
  1329
        AC_DEFINE(SDL_VIDEO_OPENGL)
slouken@1361
  1330
        BUILD_LIBS="$BUILD_LIBS -lGL"
slouken@0
  1331
    fi
slouken@0
  1332
}
slouken@0
  1333
slouken@0
  1334
dnl Check for MacOS OpenGL
slouken@0
  1335
CheckMacGL()
slouken@0
  1336
{
slouken@0
  1337
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@1361
  1338
        AC_DEFINE(SDL_VIDEO_OPENGL)
slouken@0
  1339
        case "$target" in
slouken@0
  1340
            *-*-darwin*)
slouken@1361
  1341
                BUILD_LIBS="$BUILD_LIBS -framework OpenGL"
icculus@1133
  1342
                # The following is probably not available in Darwin:
slouken@1361
  1343
                BUILD_LIBS="$BUILD_LIBS -framework AGL"
slouken@0
  1344
        esac
slouken@0
  1345
    fi
slouken@0
  1346
}
slouken@0
  1347
patmandin@978
  1348
dnl Check for Mesa offscreen rendering
patmandin@989
  1349
CheckAtariOSMesa()
patmandin@978
  1350
{
patmandin@989
  1351
    if test "x$enable_video" = "xyes" -a "x$enable_video_opengl" = "xyes"; then
patmandin@991
  1352
        AC_CHECK_HEADER(GL/osmesa.h, have_osmesa_hdr=yes)
patmandin@991
  1353
        AC_CHECK_LIB(OSMesa, OSMesaCreateContext, have_osmesa_lib=yes, have_osmesa_lib=no, -lm)
patmandin@991
  1354
patmandin@991
  1355
        # Static linking to -lOSMesa
patmandin@989
  1356
        AC_PATH_PROG(OSMESA_CONFIG, osmesa-config, no)
patmandin@989
  1357
        if test "x$OSMESA_CONFIG" = "xno" -o "x$enable_atari_ldg" = "xno"; then
patmandin@991
  1358
            # -lOSMesa is really the static library
patmandin@989
  1359
            if test "x$have_osmesa_hdr" = "xyes" -a "x$have_osmesa_lib" = "xyes"; then
slouken@1361
  1360
                OSMESA_LIBS="-lOSMesa"
patmandin@989
  1361
            fi
patmandin@989
  1362
        else
patmandin@991
  1363
            # -lOSMesa is a loader for OSMesa.ldg
patmandin@989
  1364
            OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags`
patmandin@989
  1365
            OSMESA_LIBS=`$OSMESA_CONFIG --libs`
patmandin@978
  1366
        fi
slouken@1361
  1367
        AC_DEFINE(SDL_VIDEO_OPENGL)
slouken@1361
  1368
        AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA)
slouken@1361
  1369
        BUILD_CFLAGS="$BUILD_CFLAGS $OSMESA_CFLAGS"
slouken@1361
  1370
        BUILD_LIBS="$BUILD_LIBS $OSMESA_LIBS"
patmandin@991
  1371
patmandin@991
  1372
        AC_ARG_ENABLE(osmesa-shared,
slouken@1361
  1373
AC_HELP_STRING([--enable-osmesa-shared], [dynamically load OSMesa OpenGL support [default=yes]]),
patmandin@991
  1374
                              , enable_osmesa_shared=yes)
patmandin@991
  1375
        if test "x$enable_osmesa_shared" = "xyes" -a "x$enable_atari_ldg" = "xyes"; then
patmandin@991
  1376
            # Dynamic linking
patmandin@991
  1377
            if test "x$have_osmesa_hdr" = "xyes"; then
slouken@1361
  1378
                AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA_DYNAMIC)
patmandin@991
  1379
            fi
slouken@1361
  1380
        fi
patmandin@978
  1381
    fi
patmandin@978
  1382
}
patmandin@978
  1383
slouken@0
  1384
dnl See if we can use the new unified event interface in Linux 2.4
slouken@0
  1385
CheckInputEvents()
slouken@0
  1386
{
slouken@0
  1387
    dnl Check for Linux 2.4 unified input event interface support
slouken@0
  1388
    AC_ARG_ENABLE(input-events,
slouken@1361
  1389
AC_HELP_STRING([--enable-input-events], [use Linux 2.4 unified input interface [default=yes]]),
slouken@211
  1390
                  , enable_input_events=yes)
slouken@0
  1391
    if test x$enable_input_events = xyes; then
slouken@0
  1392
        AC_MSG_CHECKING(for Linux 2.4 unified input interface)
slouken@0
  1393
        use_input_events=no
slouken@0
  1394
        AC_TRY_COMPILE([
slouken@0
  1395
          #include <linux/input.h>
slouken@0
  1396
        ],[
slouken@0
  1397
          #ifndef EVIOCGNAME
slouken@0
  1398
          #error EVIOCGNAME() ioctl not available
slouken@0
  1399
          #endif
slouken@0
  1400
        ],[
slouken@0
  1401
        use_input_events=yes
slouken@0
  1402
        ])
slouken@0
  1403
        AC_MSG_RESULT($use_input_events)
slouken@0
  1404
        if test x$use_input_events = xyes; then
slouken@1361
  1405
            AC_DEFINE(SDL_INPUT_LINUXEV)
slouken@0
  1406
        fi
slouken@0
  1407
    fi
slouken@0
  1408
}
slouken@0
  1409
icculus@1201
  1410
dnl See if we can use the Touchscreen input library
icculus@1201
  1411
CheckTslib()
icculus@1201
  1412
{
icculus@1201
  1413
    AC_ARG_ENABLE(input-tslib,
slouken@1361
  1414
AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [default=yes]]),
icculus@1201
  1415
                  , enable_input_tslib=yes)
icculus@1201
  1416
    if test x$enable_input_tslib = xyes; then
icculus@1201
  1417
        AC_MSG_CHECKING(for Touchscreen library support)
icculus@1201
  1418
        enable_input_tslib=no
icculus@1201
  1419
        AC_TRY_COMPILE([
icculus@1201
  1420
          #include "tslib.h"
icculus@1201
  1421
        ],[
icculus@1201
  1422
        ],[
icculus@1201
  1423
        enable_input_tslib=yes
icculus@1201
  1424
        ])
icculus@1201
  1425
        AC_MSG_RESULT($enable_input_tslib)
icculus@1201
  1426
        if test x$enable_input_tslib = xyes; then
slouken@1361
  1427
            AC_DEFINE(SDL_INPUT_TSLIB)
slouken@1361
  1428
            BUILD_LIBS="$BUILD_LIBS -lts"
icculus@1201
  1429
        fi
icculus@1201
  1430
    fi
icculus@1201
  1431
}
icculus@1201
  1432
slouken@399
  1433
dnl See if we can use GNU pth library for threads
slouken@399
  1434
CheckPTH()
slouken@399
  1435
{
slouken@399
  1436
    dnl Check for pth support
slouken@399
  1437
    AC_ARG_ENABLE(pth,
slouken@1361
  1438
AC_HELP_STRING([--enable-pth], [use GNU pth library for multi-threading [default=yes]]),
slouken@399
  1439
                  , enable_pth=yes)
slouken@399
  1440
    if test x$enable_threads = xyes -a x$enable_pth = xyes; then
slouken@399
  1441
        AC_PATH_PROG(PTH_CONFIG, pth-config, no)
slouken@399
  1442
        if test "$PTH_CONFIG" = "no"; then
slouken@399
  1443
            use_pth=no
slouken@399
  1444
        else
slouken@399
  1445
            use_pth=yes
slouken@399
  1446
        fi
slouken@399
  1447
        AC_MSG_CHECKING(pth)
slouken@1361
  1448
        AC_MSG_RESULT($use_pth)
slouken@399
  1449
        if test "x$use_pth" = xyes; then
slouken@1361
  1450
            AC_DEFINE(SDL_THREAD_PTH)
slouken@1361
  1451
            SOURCES="$SOURCES $srcdir/src/thread/pth/*.c"
slouken@1361
  1452
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
slouken@1361
  1453
            SDL_CFLAGS="$SDL_CFLAGS `$PTH_CONFIG --cflags`"
slouken@1361
  1454
            SDL_LIBS="$SDL_LIBS `$PTH_CONFIG --libs --all`"
slouken@1361
  1455
            have_threads=yes
slouken@399
  1456
        fi
slouken@399
  1457
    fi
slouken@399
  1458
}
slouken@399
  1459
slouken@0
  1460
dnl See what type of thread model to use on Linux and Solaris
slouken@0
  1461
CheckPTHREAD()
slouken@0
  1462
{
slouken@0
  1463
    dnl Check for pthread support
slouken@0
  1464
    AC_ARG_ENABLE(pthreads,
slouken@1361
  1465
AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [default=yes]]),
slouken@0
  1466
                  , enable_pthreads=yes)
slouken@0
  1467
    dnl This is used on Linux for glibc binary compatibility (Doh!)
slouken@0
  1468
    AC_ARG_ENABLE(pthread-sem,
slouken@1361
  1469
AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [default=yes]]),
slouken@0
  1470
                  , enable_pthread_sem=yes)
slouken@0
  1471
    case "$target" in
slouken@1324
  1472
        *-*-linux*)
slouken@1361
  1473
            pthread_cflags="-D_REENTRANT"
slouken@1324
  1474
            pthread_lib="-lpthread"
slouken@1324
  1475
            ;;
slouken@0
  1476
        *-*-bsdi*)
slouken@0
  1477
            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
slouken@0
  1478
            pthread_lib=""
slouken@0
  1479
            ;;
slouken@0
  1480
        *-*-darwin*)
slouken@0
  1481
            pthread_cflags="-D_THREAD_SAFE"
slouken@0
  1482
# causes Carbon.p complaints?
slouken@0
  1483
#            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
slouken@0
  1484
            ;;
slouken@0
  1485
        *-*-freebsd*)
slouken@0
  1486
            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
slouken@0
  1487
            pthread_lib="-pthread"
slouken@0
  1488
            ;;
slouken@43
  1489
        *-*-netbsd*)
slouken@1383
  1490
            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
icculus@1200
  1491
            pthread_lib="-L/usr/lib -lpthread"
slouken@43
  1492
            ;;
slouken@0
  1493
        *-*-openbsd*)
slouken@0
  1494
            pthread_cflags="-D_REENTRANT"
slouken@0
  1495
            pthread_lib="-pthread"
slouken@0
  1496
            ;;
slouken@0
  1497
        *-*-solaris*)
slouken@0
  1498
            pthread_cflags="-D_REENTRANT"
slouken@0
  1499
            pthread_lib="-lpthread -lposix4"
slouken@0
  1500
            ;;
slouken@0
  1501
        *-*-sysv5*)
slouken@0
  1502
            pthread_cflags="-D_REENTRANT -Kthread"
slouken@0
  1503
            pthread_lib=""
slouken@0
  1504
            ;;
slouken@0
  1505
        *-*-irix*)
slouken@0
  1506
            pthread_cflags="-D_SGI_MP_SOURCE"
slouken@0
  1507
            pthread_lib="-lpthread"
slouken@0
  1508
            ;;
slouken@0
  1509
        *-*-aix*)
slouken@0
  1510
            pthread_cflags="-D_REENTRANT -mthreads"
slouken@0
  1511
            pthread_lib="-lpthread"
slouken@0
  1512
            ;;
icculus@425
  1513
        *-*-hpux11*)
icculus@425
  1514
            pthread_cflags="-D_REENTRANT"
icculus@425
  1515
            pthread_lib="-L/usr/lib -lpthread"
icculus@425
  1516
            ;;
slouken@0
  1517
        *-*-qnx*)
slouken@0
  1518
            pthread_cflags=""
slouken@0
  1519
            pthread_lib=""
slouken@0
  1520
            ;;
slouken@873
  1521
        *-*-osf*)
slouken@1019
  1522
            pthread_cflags="-D_REENTRANT"
slouken@873
  1523
            if test x$ac_cv_prog_gcc = xyes; then
slouken@873
  1524
                pthread_lib="-lpthread -lrt"
slouken@873
  1525
            else
slouken@1019
  1526
                pthread_lib="-lpthread -lexc -lrt"
slouken@873
  1527
            fi
slouken@873
  1528
            ;;
slouken@0
  1529
        *)
slouken@0
  1530
            pthread_cflags="-D_REENTRANT"
slouken@0
  1531
            pthread_lib="-lpthread"
slouken@0
  1532
            ;;
slouken@0
  1533
    esac
icculus@1140
  1534
    if test x$enable_threads = xyes -a x$enable_pthreads = xyes -a x$enable_ipod != xyes; then
slouken@415
  1535
        # Save the original compiler flags and libraries
slouken@415
  1536
        ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
slouken@415
  1537
        # Add the pthread compiler flags and libraries
slouken@415
  1538
        CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
slouken@415
  1539
        # Check to see if we have pthread support on this system
slouken@0
  1540
        AC_MSG_CHECKING(for pthreads)
slouken@0
  1541
        use_pthreads=no
slouken@0
  1542
        AC_TRY_LINK([
slouken@0
  1543
         #include <pthread.h>
slouken@0
  1544
        ],[
slouken@0
  1545
         pthread_attr_t type;
slouken@0
  1546
         pthread_attr_init(&type);
slouken@0
  1547
        ],[
slouken@0
  1548
        use_pthreads=yes
slouken@0
  1549
        ])
slouken@0
  1550
        AC_MSG_RESULT($use_pthreads)
slouken@415
  1551
        # Restore the compiler flags and libraries
slouken@415
  1552
        CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
slouken@1361
  1553
slouken@415
  1554
        # Do futher testing if we have pthread support...
slouken@0
  1555
        if test x$use_pthreads = xyes; then
slouken@1361
  1556
            AC_DEFINE(SDL_THREAD_PTHREAD)
slouken@1361
  1557
            BUILD_CFLAGS="$BUILD_CFLAGS $pthread_cflags"
slouken@1361
  1558
            BUILD_LIBS="$BUILD_LIBS $pthread_lib"
slouken@0
  1559
            SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
slouken@0
  1560
            SDL_LIBS="$SDL_LIBS $pthread_lib"
slouken@0
  1561
slouken@0
  1562
            # Check to see if recursive mutexes are available
slouken@0
  1563
            AC_MSG_CHECKING(for recursive mutexes)
slouken@0
  1564
            has_recursive_mutexes=no
slouken@1324
  1565
            if test x$has_recursive_mutexes = xno; then
slouken@1324
  1566
                AC_TRY_COMPILE([
slouken@1324
  1567
                  #include <pthread.h>
slouken@1324
  1568
                ],[
slouken@1324
  1569
                  pthread_mutexattr_t attr;
slouken@1324
  1570
                  pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
slouken@1324
  1571
                ],[
slouken@1324
  1572
                has_recursive_mutexes=yes
slouken@1361
  1573
                AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX)
slouken@1324
  1574
                ])
slouken@1324
  1575
            fi
slouken@1324
  1576
            if test x$has_recursive_mutexes = xno; then
slouken@1324
  1577
                AC_TRY_COMPILE([
slouken@1324
  1578
                  #include <pthread.h>
slouken@1324
  1579
                ],[
slouken@1324
  1580
                  pthread_mutexattr_t attr;
slouken@1324
  1581
                  pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
slouken@1324
  1582
                ],[
slouken@1324
  1583
                has_recursive_mutexes=yes
slouken@1361
  1584
                AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP)
slouken@1324
  1585
                ])
slouken@1324
  1586
            fi
slouken@0
  1587
            AC_MSG_RESULT($has_recursive_mutexes)
slouken@0
  1588
slouken@94
  1589
            # Check to see if pthread semaphore support is missing
slouken@94
  1590
            if test x$enable_pthread_sem = xyes; then
slouken@94
  1591
                AC_MSG_CHECKING(for pthread semaphores)
slouken@94
  1592
                have_pthread_sem=no
slouken@94
  1593
                AC_TRY_COMPILE([
slouken@94
  1594
                  #include <pthread.h>
slouken@94
  1595
                  #include <semaphore.h>
slouken@94
  1596
                ],[
slouken@94
  1597
                ],[
slouken@94
  1598
                have_pthread_sem=yes
slouken@94
  1599
                ])
slouken@94
  1600
                AC_MSG_RESULT($have_pthread_sem)
slouken@94
  1601
            fi
slouken@94
  1602
slouken@1361
  1603
            # Basic thread creation functions
slouken@1361
  1604
            SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
slouken@0
  1605
slouken@1361
  1606
            # Semaphores
slouken@1361
  1607
            # We can fake these with mutexes and condition variables if necessary
slouken@1361
  1608
            if test x$have_pthread_sem = xyes; then
slouken@1361
  1609
                SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
slouken@1361
  1610
            else
slouken@1361
  1611
                SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
slouken@1361
  1612
            fi
slouken@0
  1613
slouken@1361
  1614
            # Mutexes
slouken@1361
  1615
            # We can fake these with semaphores if necessary
slouken@1361
  1616
            SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
slouken@0
  1617
slouken@1361
  1618
            # Condition variables
slouken@1361
  1619
            # We can fake these with semaphores and mutexes if necessary
slouken@1361
  1620
            SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
slouken@399
  1621
slouken@1361
  1622
            have_threads=yes
slouken@185
  1623
        else
slouken@1361
  1624
            CheckPTH
slouken@814
  1625
        fi
slouken@814
  1626
    fi
slouken@814
  1627
}
slouken@814
  1628
slouken@0
  1629
dnl Determine whether the compiler can produce Win32 executables
slouken@0
  1630
CheckWIN32()
slouken@0
  1631
{
slouken@0
  1632
    AC_MSG_CHECKING(Win32 compiler)
slouken@0
  1633
    have_win32_gcc=no
slouken@0
  1634
    AC_TRY_COMPILE([
slouken@0
  1635
     #include <windows.h>
slouken@0
  1636
    ],[
slouken@0
  1637
    ],[
slouken@0
  1638
    have_win32_gcc=yes
slouken@0
  1639
    ])
slouken@0
  1640
    AC_MSG_RESULT($have_win32_gcc)
slouken@0
  1641
    if test x$have_win32_gcc != xyes; then
slouken@0
  1642
       AC_MSG_ERROR([
slouken@0
  1643
*** Your compiler ($CC) does not produce Win32 executables!
slouken@0
  1644
       ])
slouken@0
  1645
    fi
slouken@0
  1646
slouken@0
  1647
    dnl See if the user wants to redirect standard output to files
slouken@0
  1648
    AC_ARG_ENABLE(stdio-redirect,
slouken@1361
  1649
AC_HELP_STRING([--enable-stdio-redirect], [Redirect STDIO to files on Win32 [default=yes]]),
slouken@0
  1650
                  , enable_stdio_redirect=yes)
slouken@0
  1651
    if test x$enable_stdio_redirect != xyes; then
slouken@1361
  1652
        BUILD_CFLAGS="$BUILD_CFLAGS -DNO_STDIO_REDIRECT"
slouken@1361
  1653
    fi
slouken@1361
  1654
slouken@1361
  1655
    if test x$enable_video = xyes; then
slouken@1361
  1656
        AC_DEFINE(SDL_VIDEO_DRIVER_WINDIB)
slouken@1361
  1657
        SOURCES="$SOURCES $srcdir/src/video/wincommon/*.c"
slouken@1361
  1658
        SOURCES="$SOURCES $srcdir/src/video/windib/*.c"
slouken@1361
  1659
        have_video=yes
slouken@0
  1660
    fi
slouken@0
  1661
}
slouken@0
  1662
slouken@0
  1663
dnl Find the DirectX includes and libraries
slouken@0
  1664
CheckDIRECTX()
slouken@0
  1665
{
slouken@0
  1666
    AC_ARG_ENABLE(directx,
slouken@1361
  1667
AC_HELP_STRING([--enable-directx], [use DirectX for Win32 audio/video [default=yes]]),
slouken@0
  1668
                  , enable_directx=yes)
slouken@0
  1669
    if test x$enable_directx = xyes; then
slouken@1361
  1670
        have_directx=no
slouken@1361
  1671
        AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
slouken@1361
  1672
        AC_CHECK_HEADER(dsound.h, have_dsound=yes)
slouken@1361
  1673
        AC_CHECK_HEADER(dinput.h, use_dinput=yes)
slouken@1361
  1674
        if test x$have_ddraw = xyes -a x$have_dsound = xyes -a x$use_dinput = xyes; then
slouken@1361
  1675
            have_directx=yes
slouken@1361
  1676
        fi
slouken@1361
  1677
        if test x$enable_video = xyes -a x$have_directx = xyes; then
slouken@1361
  1678
            AC_DEFINE(SDL_VIDEO_DRIVER_DDRAW)
slouken@1361
  1679
            SOURCES="$SOURCES $srcdir/src/video/windx5/*.c"
slouken@1361
  1680
            have_video=yes
slouken@1361
  1681
        fi
slouken@0
  1682
    fi
slouken@158
  1683
}
slouken@158
  1684
slouken@294
  1685
dnl Check for the dlfcn.h interface for dynamically loading objects
slouken@294
  1686
CheckDLOPEN()
slouken@294
  1687
{
slouken@731
  1688
    AC_ARG_ENABLE(sdl-dlopen,
slouken@1361
  1689
AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [default=yes]]),
slouken@731
  1690
                  , enable_sdl_dlopen=yes)
slouken@731
  1691
    if test x$enable_sdl_dlopen = xyes; then
slouken@294
  1692
        AC_MSG_CHECKING(for dlopen)
slouken@1361
  1693
        have_dlopen=no
slouken@294
  1694
        AC_TRY_COMPILE([
slouken@294
  1695
         #include <dlfcn.h>
slouken@294
  1696
        ],[
slouken@294
  1697
        ],[
slouken@1361
  1698
        have_dlopen=yes
slouken@294
  1699
        ])
slouken@1361
  1700
        AC_MSG_RESULT($have_dlopen)
slouken@294
  1701
slouken@1361
  1702
        if test x$have_dlopen = xyes; then
slouken@1361
  1703
            AC_CHECK_LIB(c, dlopen, BUILD_LIBS="$BUILD_LIBS",
slouken@1361
  1704
               AC_CHECK_LIB(dl, dlopen, BUILD_LIBS="$BUILD_LIBS -ldl",
slouken@1361
  1705
                  AC_CHECK_LIB(ltdl, dlopen, BUILD_LIBS="$BUILD_LIBS -lltdl")))
slouken@1361
  1706
            AC_CHECK_LIB(dl, dlvsym, have_dlvsym=yes)
slouken@1361
  1707
            if test x$have_dlvsym = xyes; then
slouken@1361
  1708
                AC_DEFINE(HAVE_DLVSYM)
slouken@1361
  1709
            fi
slouken@1361
  1710
            AC_DEFINE(SDL_LOADSO_DLOPEN)
slouken@1361
  1711
            SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
slouken@1361
  1712
            have_loadso=yes
slouken@294
  1713
        fi
slouken@294
  1714
    fi
slouken@294
  1715
}
slouken@294
  1716
patmandin@651
  1717
dnl Set up the Atari LDG (shared object loader)
patmandin@651
  1718
CheckAtariLdg()
patmandin@651
  1719
{
patmandin@651
  1720
    AC_ARG_ENABLE(atari-ldg,
slouken@1361
  1721
AC_HELP_STRING([--enable-atari-ldg], [use Atari LDG for shared object loading [default=yes]]),
patmandin@651
  1722
                  , enable_atari_ldg=yes)
patmandin@651
  1723
    if test x$video_gem = xyes -a x$enable_atari_ldg = xyes; then
patmandin@651
  1724
        AC_CHECK_HEADER(ldg.h, have_ldg_hdr=yes)
patmandin@651
  1725
        AC_CHECK_LIB(ldg, ldg_open, have_ldg_lib=yes, have_ldg_lib=no, -lgem)
patmandin@651
  1726
        if test x$have_ldg_hdr = xyes -a x$have_ldg_lib = xyes; then
slouken@1361
  1727
            AC_DEFINE(SDL_LOADSO_LDG)
slouken@1361
  1728
            SOURCES="$SOURCES $srcdir/src/loadso/mint/*.c"
slouken@1361
  1729
            BUILD_LIBS="$BUILD_LIBS -lldg -lgem"
icculus@1173
  1730
            have_loadso=yes
patmandin@651
  1731
        fi
patmandin@651
  1732
    fi
patmandin@651
  1733
}
patmandin@651
  1734
slouken@381
  1735
dnl Check for the usbhid(3) library on *BSD
slouken@381
  1736
CheckUSBHID()
slouken@381
  1737
{
slouken@381
  1738
    if test x$enable_joystick = xyes; then
slouken@1361
  1739
        AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
slouken@1361
  1740
        AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
slouken@1361
  1741
        AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
slouken@1361
  1742
        AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
slouken@1361
  1743
            
slouken@1361
  1744
        AC_CHECK_LIB(usbhid, hid_init, [USB_LIBS="$USB_LIBS -lusbhid"])
slouken@1361
  1745
        AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
slouken@381
  1746
slouken@1361
  1747
        save_CFLAGS="$CFLAGS"
slouken@1361
  1748
        CFLAGS="$CFLAGS $USB_CFLAGS"
slouken@381
  1749
slouken@381
  1750
        AC_MSG_CHECKING(for usbhid)
slouken@381
  1751
        have_usbhid=no
slouken@381
  1752
        AC_TRY_COMPILE([
slouken@404
  1753
          #include <sys/types.h>
slouken@403
  1754
          #if defined(HAVE_USB_H)
slouken@403
  1755
          #include <usb.h>
slouken@403
  1756
          #endif
slouken@381
  1757
          #include <dev/usb/usb.h>
slouken@381
  1758
          #include <dev/usb/usbhid.h>
slouken@381
  1759
          #if defined(HAVE_USBHID_H)
slouken@381
  1760
          #include <usbhid.h>
slouken@381
  1761
          #elif defined(HAVE_LIBUSB_H)
slouken@381
  1762
          #include <libusb.h>
slouken@381
  1763
          #elif defined(HAVE_LIBUSBHID_H)
slouken@381
  1764
          #include <libusbhid.h>
slouken@404
  1765
          #endif
slouken@381
  1766
        ],[
slouken@381
  1767
          struct report_desc *repdesc;
slouken@381
  1768
          struct usb_ctl_report *repbuf;
slouken@402
  1769
          hid_kind_t hidkind;
slouken@381
  1770
        ],[
slouken@381
  1771
        have_usbhid=yes
slouken@381
  1772
        ])
slouken@381
  1773
        AC_MSG_RESULT($have_usbhid)
slouken@381
  1774
slouken@381
  1775
        if test x$have_usbhid = xyes; then
slouken@381
  1776
            AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
slouken@381
  1777
            have_usbhid_ucr_data=no
slouken@381
  1778
            AC_TRY_COMPILE([
slouken@404
  1779
              #include <sys/types.h>
slouken@404
  1780
              #if defined(HAVE_USB_H)
slouken@404
  1781
              #include <usb.h>
slouken@404
  1782
              #endif
slouken@381
  1783
              #include <dev/usb/usb.h>
slouken@381
  1784
              #include <dev/usb/usbhid.h>
slouken@381
  1785
              #if defined(HAVE_USBHID_H)
slouken@381
  1786
              #include <usbhid.h>
slouken@381
  1787
              #elif defined(HAVE_LIBUSB_H)
slouken@381
  1788
              #include <libusb.h>
slouken@381
  1789
              #elif defined(HAVE_LIBUSBHID_H)
slouken@381
  1790
              #include <libusbhid.h>
slouken@381
  1791
              #endif
slouken@381
  1792
            ],[
slouken@381
  1793
              struct usb_ctl_report buf;
slouken@381
  1794
              if (buf.ucr_data) { }
slouken@381
  1795
            ],[
slouken@381
  1796
            have_usbhid_ucr_data=yes
slouken@381
  1797
            ])
slouken@381
  1798
            if test x$have_usbhid_ucr_data = xyes; then
slouken@1361
  1799
                USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
slouken@381
  1800
            fi
slouken@381
  1801
            AC_MSG_RESULT($have_usbhid_ucr_data)
slouken@407
  1802
            
slouken@1361
  1803
            AC_MSG_CHECKING(for new usbhid API)
slouken@407
  1804
            have_usbhid_new=no
slouken@407
  1805
            AC_TRY_COMPILE([
slouken@407
  1806
              #include <sys/types.h>
slouken@407
  1807
              #if defined(HAVE_USB_H)
slouken@407
  1808
              #include <usb.h>
slouken@407
  1809
              #endif
slouken@407
  1810
              #include <dev/usb/usb.h>
slouken@407
  1811
              #include <dev/usb/usbhid.h>
slouken@407
  1812
              #if defined(HAVE_USBHID_H)
slouken@407
  1813
              #include <usbhid.h>
slouken@407
  1814
              #elif defined(HAVE_LIBUSB_H)
slouken@407
  1815
              #include <libusb.h>
slouken@407
  1816
              #elif defined(HAVE_LIBUSBHID_H)
slouken@407
  1817
              #include <libusbhid.h>
slouken@407
  1818
              #endif
slouken@407
  1819
            ],[
slouken@407
  1820
              report_desc_t d;
slouken@1361
  1821
              hid_start_parse(d, 1, 1);
slouken@407
  1822
            ],[
slouken@407
  1823
            have_usbhid_new=yes
slouken@407
  1824
            ])
slouken@407
  1825
            if test x$have_usbhid_new = xyes; then
slouken@1361
  1826
                USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
slouken@407
  1827
            fi
slouken@407
  1828
            AC_MSG_RESULT($have_usbhid_new)
slouken@381
  1829
slouken@1361
  1830
            AC_DEFINE(SDL_JOYSTICK_USBHID)
slouken@1361
  1831
            SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
slouken@1361
  1832
            BUILD_CFLAGS="$BUILD_CFLAGS $USB_CFLAGS"
slouken@1377
  1833
            BUILD_LIBS="$BUILD_LIBS $USB_LIBS"
slouken@1361
  1834
            have_joystick=yes
slouken@381
  1835
        fi
slouken@1361
  1836
        CFLAGS="$save_CFLAGS"
slouken@381
  1837
    fi
slouken@381
  1838
}
slouken@381
  1839
slouken@1361
  1840
dnl Check for clock_gettime()
slouken@1361
  1841
CheckClockGettime()
slouken@795
  1842
{
slouken@1361
  1843
    AC_ARG_ENABLE(clock_gettime,
slouken@1361
  1844
AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [default=no]]),
slouken@1361
  1845
                  , enable_clock_gettime=no)
slouken@1361
  1846
    if test x$enable_clock_gettime = xyes; then
slouken@1361
  1847
        AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
slouken@1361
  1848
        if test x$have_clock_gettime = xyes; then
slouken@1361
  1849
            AC_DEFINE(HAVE_CLOCK_GETTIME)
slouken@1361
  1850
            BUILD_LIBS="$BUILD_LIBS -lrt"
icculus@1175
  1851
        fi
slouken@795
  1852
    fi
slouken@795
  1853
}
slouken@795
  1854
slouken@1062
  1855
dnl Check for a valid linux/version.h
slouken@1062
  1856
CheckLinuxVersion()
slouken@1062
  1857
{
slouken@1062
  1858
    AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
slouken@1062
  1859
    if test x$have_linux_version_h = xyes; then
slouken@1361
  1860
        BUILD_CFLAGS="$BUILD_CFLAGS -DHAVE_LINUX_VERSION_H"
slouken@1062
  1861
    fi
slouken@1062
  1862
}
slouken@1062
  1863
slouken@1127
  1864
dnl Check if we want to use RPATH
slouken@1127
  1865
CheckRPATH()
slouken@1127
  1866
{
slouken@1127
  1867
    AC_ARG_ENABLE(rpath,
slouken@1361
  1868
AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [default=yes]]),
slouken@1127
  1869
                  , enable_rpath=yes)
slouken@1127
  1870
}
slouken@1127
  1871
slouken@1361
  1872
dnl Set up the configuration based on the target platform!
slouken@0
  1873
case "$target" in
slouken@1361
  1874
    arm-*-elf*) # FIXME: Can we get more specific for iPodLinux?
slouken@1361
  1875
        ARCH=linux
slouken@1361
  1876
        CheckDummyVideo
slouken@1361
  1877
        CheckIPod
slouken@1361
  1878
        # Set up files for the timer library
icculus@1140
  1879
        if test x$enable_timers = xyes; then
slouken@1361
  1880
            AC_DEFINE(SDL_TIMER_UNIX)
slouken@1361
  1881
            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
slouken@1361
  1882
            have_timers=yes
icculus@1140
  1883
        fi
slouken@1361
  1884
        ;;
slouken@1361
  1885
    *-*-linux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-irix*|*-*-aix*|*-*-osf*)
slouken@719
  1886
        case "$target" in
slouken@1361
  1887
            *-*-linux*)         ARCH=linux ;;
slouken@1361
  1888
            *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
slouken@1361
  1889
            *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
slouken@1361
  1890
            *-*-kopenbsd*-gnu)  ARCH=kopenbsd-gnu ;;
slouken@1361
  1891
            *-*-gnu*)           ARCH=gnu ;; # must be last of the gnu variants
slouken@1361
  1892
            *-*-bsdi*)          ARCH=bsdi ;;
slouken@1361
  1893
            *-*-freebsd*)       ARCH=freebsd ;;
slouken@1361
  1894
            *-*-netbsd*)        ARCH=netbsd ;;
slouken@1361
  1895
            *-*-openbsd*)       ARCH=openbsd ;;
slouken@1361
  1896
            *-*-sysv5*)         ARCH=sysv5 ;;
slouken@1361
  1897
            *-*-solaris*)       ARCH=solaris ;;
slouken@1361
  1898
            *-*-hpux*)          ARCH=hpux ;;
slouken@1361
  1899
            *-*-irix*)          ARCH=irix ;;
slouken@1361
  1900
            *-*-aix*)           ARCH=aix ;;
slouken@1361
  1901
            *-*-osf*)           ARCH=osf ;;
slouken@795
  1902
        esac
slouken@1
  1903
        CheckDummyVideo
slouken@68
  1904
        CheckDiskAudio
slouken@371
  1905
        CheckDLOPEN
slouken@0
  1906
        CheckNASM
slouken@1361
  1907
        CheckAltivec
slouken@0
  1908
        CheckOSS
slouken@1361
  1909
        CheckDMEDIA
slouken@0
  1910
        CheckALSA
slouken@0
  1911
        CheckARTSC
slouken@0
  1912
        CheckESD
slouken@0
  1913
        CheckNAS
slouken@0
  1914
        CheckX11
slouken@30
  1915
        CheckNANOX
slouken@0
  1916
        CheckFBCON
slouken@167
  1917
        CheckDirectFB
slouken@70
  1918
        CheckPS2GS
slouken@0
  1919
        CheckGGI
slouken@0
  1920
        CheckSVGA
slouken@1361
  1921
        CheckVGL
slouken@1361
  1922
        CheckWscons
slouken@0
  1923
        CheckAAlib
slouken@371
  1924
        CheckQtopia
slouken@433
  1925
        CheckPicoGUI
icculus@1191
  1926
        CheckOpenGLX11
slouken@0
  1927
        CheckInputEvents
icculus@1201
  1928
        CheckTslib
slouken@1361
  1929
        CheckUSBHID
slouken@0
  1930
        CheckPTHREAD
slouken@1361
  1931
        CheckClockGettime
slouken@1062
  1932
        CheckLinuxVersion
slouken@1127
  1933
        CheckRPATH
slouken@1361
  1934
        # Set up files for the audio library
slouken@1361
  1935
        if test x$enable_audio = xyes; then
slouken@1361
  1936
          case $ARCH in
slouken@1361
  1937
            netbsd|sysv5|solaris|hpux)
slouken@1361
  1938
                AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
slouken@1361
  1939
                SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
slouken@1361
  1940
                have_audio=yes
slouken@1361
  1941
            ;;
slouken@1361
  1942
            openbsd)
slouken@1361
  1943
                AC_DEFINE(SDL_AUDIO_DRIVER_OPENBSD)
slouken@1361
  1944
                SOURCES="$SOURCES $srcdir/src/audio/openbsd/*.c"
slouken@1361
  1945
                have_audio=yes
slouken@1361
  1946
            ;;
slouken@1361
  1947
            aix)
slouken@1361
  1948
                AC_DEFINE(SDL_AUDIO_DRIVER_PAUD)
slouken@1361
  1949
                SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
slouken@1361
  1950
                have_audio=yes
slouken@1361
  1951
            ;;
slouken@1361
  1952
            osf)
slouken@1361
  1953
                AC_DEFINE(SDL_AUDIO_DRIVER_MMEAUDIO)
slouken@1361
  1954
                SOURCES="$SOURCES $srcdir/src/audio/mme/*.c"
slouken@1361
  1955
                BUILD_LIBS="$BUILD_LIBS -lmme"
slouken@1361
  1956
                have_audio=yes
slouken@1361
  1957
            ;;
slouken@1361
  1958
          esac
slouken@371
  1959
        fi
slouken@0
  1960
        # Set up files for the joystick library
slouken@0
  1961
        if test x$enable_joystick = xyes; then
slouken@1361
  1962
          case $ARCH in
slouken@1361
  1963
            linux)
slouken@1361
  1964
                AC_DEFINE(SDL_JOYSTICK_LINUX)
slouken@1361
  1965
                SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
slouken@1361
  1966
                have_joystick=yes
slouken@1361
  1967
            ;;
slouken@1361
  1968
          esac
slouken@0
  1969
        fi
slouken@0
  1970
        # Set up files for the cdrom library
slouken@0
  1971
        if test x$enable_cdrom = xyes; then
slouken@1361
  1972
          case $ARCH in
slouken@1361
  1973
            linux|solaris)
slouken@1361
  1974
                AC_DEFINE(SDL_CDROM_LINUX)
slouken@1361
  1975
                SOURCES="$SOURCES $srcdir/src/cdrom/linux/*.c"
slouken@1361
  1976
                have_cdrom=yes
slouken@1361
  1977
            ;;
slouken@1361
  1978
            *freebsd*)
slouken@1361
  1979
                AC_DEFINE(SDL_CDROM_FREEBSD)
slouken@1361
  1980
                SOURCES="$SOURCES $srcdir/src/cdrom/freebsd/*.c"
slouken@1361
  1981
                have_cdrom=yes
slouken@1361
  1982
            ;;
slouken@1383
  1983
            *openbsd*|*netbsd*)
slouken@1361
  1984
                AC_DEFINE(SDL_CDROM_OPENBSD)
slouken@1361
  1985
                SOURCES="$SOURCES $srcdir/src/cdrom/openbsd/*.c"
slouken@1361
  1986
                have_cdrom=yes
slouken@1361
  1987
            ;;
slouken@1361
  1988
            bsdi)
slouken@1361
  1989
                AC_DEFINE(SDL_CDROM_BSDI)
slouken@1361
  1990
                SOURCES="$SOURCES $srcdir/src/cdrom/bsdi/*.c"
slouken@1361
  1991
                have_cdrom=yes
slouken@1361
  1992
            ;;
slouken@1361
  1993
            aix)
slouken@1361
  1994
                AC_DEFINE(SDL_CDROM_AIX)
slouken@1361
  1995
                SOURCES="$SOURCES $srcdir/src/cdrom/aix/*.c"
slouken@1361
  1996
                have_cdrom=yes
slouken@1361
  1997
            ;;
slouken@1361
  1998
            osf)
slouken@1361
  1999
                AC_DEFINE(SDL_CDROM_OSF)
slouken@1361
  2000
                SOURCES="$SOURCES $srcdir/src/cdrom/osf/*.c"
slouken@1361
  2001
                have_cdrom=yes
slouken@1361
  2002
            ;;
slouken@1361
  2003
          esac
slouken@0
  2004
        fi
slouken@0
  2005
        # Set up files for the thread library
slouken@1361
  2006
        if test x$enable_threads = xyes -a x$use_pthreads != xyes -a x$use_pth != xyes -a x$ARCH = xirix; then
slouken@1361
  2007
            AC_DEFINE(SDL_THREAD_SPROC)
slouken@1361
  2008
            SOURCES="$SOURCES $srcdir/src/thread/irix/*.c"
slouken@1361
  2009
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
slouken@1361
  2010
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
slouken@1361
  2011
            have_threads=yes
slouken@0
  2012
        fi
slouken@0
  2013
        # Set up files for the timer library
slouken@0
  2014
        if test x$enable_timers = xyes; then
slouken@1361
  2015
            AC_DEFINE(SDL_TIMER_UNIX)
slouken@1361
  2016
            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
slouken@1361
  2017
            have_timers=yes
slouken@0
  2018
        fi
slouken@1361
  2019
        # Do any final platform setup
slouken@1361
  2020
        case $ARCH in
slouken@1383
  2021
            openbsd|netbsd)
slouken@1383
  2022
                # OpenBSD and NetBSD do not define "unix"
slouken@1361
  2023
                BUILD_CFLAGS="$BUILD_CFLAGS -Dunix"
slouken@1361
  2024
            ;;
slouken@1361
  2025
        esac
slouken@0
  2026
        ;;
slouken@0
  2027
    *-*-qnx*)
slouken@0
  2028
        ARCH=qnx
slouken@1
  2029
        CheckDummyVideo
slouken@68
  2030
        CheckDiskAudio
slouken@886
  2031
        # CheckNASM
slouken@371
  2032
        CheckDLOPEN
slouken@0
  2033
        CheckNAS
slouken@0
  2034
        CheckPHOTON
slouken@0
  2035
        CheckX11
icculus@1191
  2036
        CheckOpenGLX11
slouken@0
  2037
        CheckPTHREAD
slouken@0
  2038
        # Set up files for the audio library
slouken@0
  2039
        if test x$enable_audio = xyes; then
slouken@1361
  2040
            AC_DEFINE(SDL_AUDIO_DRIVER_QNXNTO)
slouken@1361
  2041
            SOURCES="$SOURCES $srcdir/src/audio/nto/*.c"
slouken@1361
  2042
            BUILD_LIBS="$BUILD_LIBS -lasound"
slouken@1361
  2043
            have_audio=yes
slouken@0
  2044
        fi
slouken@0
  2045
        # Set up files for the cdrom library
slouken@0
  2046
        if test x$enable_cdrom = xyes; then
slouken@1361
  2047
            AC_DEFINE(SDL_CDROM_QNX)
slouken@1361
  2048
            SOURCES="$SOURCES $srcdir/src/cdrom/qnx/*.c"
slouken@1361
  2049
            have_cdrom=yes
slouken@0
  2050
        fi
slouken@0
  2051
        # Set up files for the timer library
slouken@0
  2052
        if test x$enable_timers = xyes; then
slouken@1361
  2053
            AC_DEFINE(SDL_TIMER_UNIX)
slouken@1361
  2054
            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
slouken@1361
  2055
            have_timers=yes
slouken@0
  2056
        fi
slouken@0
  2057
        ;;
slouken@0
  2058
    *-*-cygwin* | *-*-mingw32*)
slouken@0
  2059
        ARCH=win32
slouken@0
  2060
        if test "$build" != "$target"; then # cross-compiling
slouken@0
  2061
            # Default cross-compile location
slouken@0
  2062
            ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc
slouken@0
  2063
        else
slouken@0
  2064
            # Look for the location of the tools and install there
slouken@750
  2065
            if test "$BUILD_PREFIX" != ""; then
slouken@1
  2066
                ac_default_prefix=$BUILD_PREFIX
slouken@1
  2067
            fi
slouken@0
  2068
        fi
slouken@1
  2069
        CheckDummyVideo
slouken@68
  2070
        CheckDiskAudio
slouken@0
  2071
        CheckWIN32
slouken@1361
  2072
        CheckWIN32GL
slouken@0
  2073
        CheckDIRECTX
slouken@0
  2074
        CheckNASM
slouken@0
  2075
        # Set up files for the audio library
slouken@0
  2076
        if test x$enable_audio = xyes; then
slouken@1361
  2077
            AC_DEFINE(SDL_AUDIO_DRIVER_WAVEOUT)
slouken@1361
  2078
            SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
slouken@1361
  2079
            if test x$have_directx = xyes; then
slouken@1361
  2080
                AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
slouken@1361
  2081
                SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
slouken@0
  2082
            fi
slouken@1361
  2083
            have_audio=yes
slouken@0
  2084
        fi
slouken@0
  2085
        # Set up files for the joystick library
slouken@0
  2086
        if test x$enable_joystick = xyes; then
slouken@1361
  2087
            AC_DEFINE(SDL_JOYSTICK_WINMM)
slouken@1361
  2088
            SOURCES="$SOURCES $srcdir/src/joystick/win32/*.c"
slouken@1361
  2089
            have_joystick=yes
slouken@0
  2090
        fi
slouken@0
  2091
        # Set up files for the cdrom library
slouken@0
  2092
        if test x$enable_cdrom = xyes; then
slouken@1361
  2093
            AC_DEFINE(SDL_CDROM_WIN32)
slouken@1361
  2094
            SOURCES="$SOURCES $srcdir/src/cdrom/win32/*.c"
slouken@1361
  2095
            have_cdrom=yes
slouken@0
  2096
        fi
slouken@0
  2097
        # Set up files for the thread library
slouken@0
  2098
        if test x$enable_threads = xyes; then
slouken@1361
  2099
            AC_DEFINE(SDL_THREAD_WIN32)
slouken@1361
  2100
            SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
slouken@1361
  2101
            SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
slouken@1361
  2102
            SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
slouken@1361
  2103
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
slouken@1361
  2104
            have_threads=yes
slouken@0
  2105
        fi
slouken@0
  2106
        # Set up files for the timer library
slouken@0
  2107
        if test x$enable_timers = xyes; then
slouken@1361
  2108
            AC_DEFINE(SDL_TIMER_WIN32)
slouken@1361
  2109
            SOURCES="$SOURCES $srcdir/src/timer/win32/*.c"
slouken@1361
  2110
            have_timers=yes
slouken@1361
  2111
        fi
slouken@1361
  2112
        # Set up files for the shared object loading library
slouken@1361
  2113
        if test x$enable_loadso = xyes; then
slouken@1361
  2114
            AC_DEFINE(SDL_LOADSO_WIN32)
slouken@1361
  2115
            SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
slouken@1361
  2116
            have_loadso=yes
slouken@1361
  2117
        fi
slouken@1361
  2118
        # Set up the system libraries we need
slouken@1361
  2119
        BUILD_LIBS="$BUILD_LIBS -luser32 -lgdi32 -lwinmm"
slouken@1361
  2120
        if test x$have_directx = xyes; then
slouken@1361
  2121
            BUILD_LIBS="$BUILD_LIBS -ldxguid"
slouken@0
  2122
        fi
slouken@0
  2123
        # The Win32 platform requires special setup
slouken@0
  2124
        SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
slouken@1363
  2125
        SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
slouken@0
  2126
        ;;
slouken@0
  2127
    *-*-beos*)
slouken@0
  2128
        ARCH=beos
slouken@0
  2129
        ac_default_prefix=/boot/develop/tools/gnupro
slouken@1
  2130
        CheckDummyVideo
slouken@68
  2131
        CheckDiskAudio
slouken@0
  2132
        CheckNASM
slouken@0
  2133
        CheckBWINDOW
slouken@0
  2134
        CheckBeGL
slouken@0
  2135
        # Set up files for the audio library
slouken@0
  2136
        if test x$enable_audio = xyes; then
slouken@1361
  2137
            AC_DEFINE(SDL_AUDIO_DRIVER_BAUDIO)
slouken@1361
  2138
            SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc"
slouken@1361
  2139
            have_audio=yes
slouken@0
  2140
        fi
slouken@0
  2141
        # Set up files for the joystick library
slouken@0
  2142
        if test x$enable_joystick = xyes; then
slouken@1361
  2143
            AC_DEFINE(SDL_JOYSTICK_BEOS)
slouken@1361
  2144
            SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc"
slouken@1361
  2145
            have_joystick=yes
slouken@0
  2146
        fi
slouken@0
  2147
        # Set up files for the cdrom library
slouken@0
  2148
        if test x$enable_cdrom = xyes; then
slouken@1361
  2149
            AC_DEFINE(SDL_CDROM_BEOS)
slouken@1361
  2150
            SOURCES="$SOURCES $srcdir/src/cdrom/beos/*.cc"
slouken@1361
  2151
            have_cdrom=yes
slouken@0
  2152
        fi
slouken@0
  2153
        # Set up files for the thread library
slouken@0
  2154
        if test x$enable_threads = xyes; then
slouken@1361
  2155
            AC_DEFINE(SDL_THREAD_BEOS)
slouken@1361
  2156
            SOURCES="$SOURCES $srcdir/src/thread/beos/*.c"
slouken@1361
  2157
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
slouken@1361
  2158
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
slouken@1361
  2159
            have_threads=yes
slouken@0
  2160
        fi
slouken@0
  2161
        # Set up files for the timer library
slouken@0
  2162
        if test x$enable_timers = xyes; then
slouken@1361
  2163
            AC_DEFINE(SDL_TIMER_BEOS)
slouken@1361
  2164
            SOURCES="$SOURCES $srcdir/src/timer/beos/*.c"
slouken@1361
  2165
            have_timers=yes
slouken@1361
  2166
        fi
slouken@1361
  2167
        # Set up files for the shared object loading library
slouken@1361
  2168
        if test x$enable_loadso = xyes; then
slouken@1361
  2169
            AC_DEFINE(SDL_LOADSO_BEOS)
slouken@1361
  2170
            SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
slouken@1361
  2171
            have_loadso=yes
slouken@0
  2172
        fi
slouken@1367
  2173
        # The BeOS platform requires special setup.
slouken@1367
  2174
        SOURCES="$srcdir/src/main/beos/*.cc $SOURCES"
slouken@1361
  2175
        BUILD_LIBS="$BUILD_LIBS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
slouken@0
  2176
        ;;
slouken@0
  2177
    *-*-darwin* )
icculus@1133
  2178
        # This could be either full "Mac OS X", or plain "Darwin" which is
slouken@158
  2179
        # just the OS X kernel sans upper layers like Carbon and Cocoa.
icculus@1133
  2180
        # Next line is broken, and a few files below require Mac OS X (full)
slouken@158
  2181
        ARCH=macosx
slouken@1
  2182
        CheckDummyVideo
slouken@68
  2183
        CheckDiskAudio
slouken@1361
  2184
        CheckDLOPEN
icculus@1133
  2185
        CheckCOCOA
icculus@1133
  2186
        CheckCARBON
icculus@1174
  2187
        CheckX11
slouken@0
  2188
        CheckMacGL
icculus@1191
  2189
        CheckOpenGLX11
slouken@0
  2190
        CheckPTHREAD
icculus@1047
  2191
        CheckAltivec
slouken@0
  2192
        # Set up files for the audio library
slouken@0
  2193
        if test x$enable_audio = xyes; then
slouken@1361
  2194
            AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO)
slouken@1361
  2195
            SOURCES="$SOURCES $srcdir/src/audio/macosx/*.c"
slouken@1361
  2196
            AC_DEFINE(SDL_AUDIO_DRIVER_SNDMGR)
slouken@1361
  2197
            SOURCES="$SOURCES $srcdir/src/audio/macrom/*.c"
slouken@1361
  2198
            have_audio=yes
slouken@0
  2199
        fi
slouken@0
  2200
        # Set up files for the joystick library
slouken@0
  2201
        if test x$enable_joystick = xyes; then
slouken@1361
  2202
            AC_DEFINE(SDL_JOYSTICK_IOKIT)
slouken@1361
  2203
            SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
slouken@1361
  2204
            BUILD_LIBS="$BUILD_LIBS -framework IOKit"
slouken@1361
  2205
            have_joystick=yes
slouken@0
  2206
        fi
slouken@0
  2207
        # Set up files for the cdrom library
slouken@0
  2208
        if test x$enable_cdrom = xyes; then
slouken@1361
  2209
            AC_DEFINE(SDL_CDROM_MACOSX)
slouken@1361
  2210
            SOURCES="$SOURCES $srcdir/src/cdrom/macosx/*.c"
slouken@1361
  2211
            have_cdrom=yes
slouken@0
  2212
        fi
slouken@0
  2213
        # Set up files for the timer library
slouken@0
  2214
        if test x$enable_timers = xyes; then
slouken@1361
  2215
            AC_DEFINE(SDL_TIMER_UNIX)
slouken@1361
  2216
            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
slouken@1361
  2217
            have_timers=yes
slouken@1361
  2218
        fi
slouken@1361
  2219
        # Set up files for the shared object loading library
slouken@1361
  2220
        if test x$enable_loadso = xyes -a x$have_dlopen != xyes; then
slouken@1361
  2221
            AC_DEFINE(SDL_LOADSO_DLCOMPAT)
slouken@1361
  2222
            SOURCES="$SOURCES $srcdir/src/loadso/macosx/*.c"
slouken@1361
  2223
            have_loadso=yes
slouken@0
  2224
        fi
slouken@387
  2225
        # The MacOS X platform requires special setup.
slouken@1361
  2226
        AC_DEFINE(TARGET_API_MAC_CARBON)
slouken@1361
  2227
        BUILD_CFLAGS="$BUILD_CFLAGS -fpascal-strings -DMACOSX"
slouken@387
  2228
        SDL_LIBS="-lSDLmain $SDL_LIBS"
icculus@1133
  2229
        if test x$enable_video_cocoa = xyes; then
slouken@1361
  2230
            BUILD_LIBS="$BUILD_LIBS -framework Cocoa"
icculus@1133
  2231
        fi
icculus@1133
  2232
        if test x$enable_video_carbon = xyes -o x$enable_video_cocoa = xyes; then
icculus@1133
  2233
            # The Cocoa backend still needs Carbon, and the YUV code QuickTime
slouken@1374
  2234
            BUILD_LIBS="$BUILD_LIBS -framework QuickTime -framework ApplicationServices"
slouken@1374
  2235
            BUILD_LIBS="$BUILD_LIBS -framework Carbon"
icculus@1133
  2236
        fi
slouken@1361
  2237
        # If either the audio or CD driver is used, add the AudioUnit framework
slouken@1361
  2238
        if test x$enable_audio = xyes -o x$enable_cdrom = xyes; then
slouken@1361
  2239
            BUILD_LIBS="$BUILD_LIBS -framework AudioToolbox -framework AudioUnit"
slouken@1361
  2240
        fi
slouken@0
  2241
        ;;
slouken@281
  2242
    *-*-mint*)
slouken@281
  2243
        ARCH=mint
slouken@281
  2244
        CheckDummyVideo
slouken@281
  2245
        CheckDiskAudio
slouken@281
  2246
        CheckAtariBiosEvent
slouken@281
  2247
        CheckAtariXbiosVideo
slouken@281
  2248
        CheckAtariGemVideo
slouken@398
  2249
        CheckAtariAudio
patmandin@651
  2250
        CheckAtariLdg
slouken@1361
  2251
        CheckAtariOSMesa
slouken@281
  2252
        CheckPTH
slouken@281
  2253
        # Set up files for the audio library
slouken@398
  2254
        if test x$enable_threads = xyes -a x$enable_pth = xyes; then
slouken@398
  2255
            if test x$enable_audio = xyes; then
slouken@1361
  2256
                AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
slouken@1361
  2257
                SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
slouken@1361
  2258
                have_audio=yes
slouken@398
  2259
            fi
slouken@281
  2260
        fi
slouken@281
  2261
        # Set up files for the joystick library
slouken@281
  2262
        if test x$enable_joystick = xyes; then
slouken@1361
  2263
            AC_DEFINE(SDL_JOYSTICK_MINT)
slouken@1361
  2264
            SOURCES="$SOURCES $srcdir/src/joystick/mint/*.c"
slouken@1361
  2265
            have_joystick=yes
slouken@281
  2266
        fi
slouken@281
  2267
        # Set up files for the cdrom library
slouken@281
  2268
        if test x$enable_cdrom = xyes; then
slouken@1361
  2269
            AC_DEFINE(SDL_CDROM_MINT)
slouken@1361
  2270
            SOURCES="$SOURCES $srcdir/src/cdrom/mint/*.c"
slouken@1361
  2271
            have_cdrom=yes
slouken@281
  2272
        fi
slouken@281
  2273
        # Set up files for the timer library
slouken@281
  2274
        if test x$enable_timers = xyes; then
slouken@557
  2275
            if test x$enable_threads = xyes -a x$enable_pth = xyes; then
slouken@1361
  2276
                AC_DEFINE(SDL_TIMER_UNIX)
slouken@1361
  2277
                SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
slouken@557
  2278
            else
slouken@1361
  2279
                AC_DEFINE(SDL_TIMER_MINT)
slouken@1361
  2280
                SOURCES="$SOURCES $srcdir/src/timer/mint/*.c"
slouken@557
  2281
            fi
slouken@1361
  2282
            have_timers=yes
slouken@281
  2283
        fi
slouken@281
  2284
        # MiNT does not define "unix"
slouken@1361
  2285
        BUILD_CFLAGS="$BUILD_CFLAGS -Dunix"
slouken@281
  2286
        ;;
slouken@1035
  2287
    *-riscos)
slouken@687
  2288
        ARCH=riscos
slouken@1361
  2289
        CheckOSS
slouken@1361
  2290
        CheckPTHREAD
slouken@955
  2291
        # Set up files for the video library
slouken@955
  2292
        if test x$enable_video = xyes; then
slouken@1361
  2293
            AC_DEFINE(SDL_VIDEO_DRIVER_RISCOS)
slouken@1361
  2294
            SOURCES="$SOURCES $srcdir/src/video/riscos/*.c"
slouken@1361
  2295
            have_video=yes
slouken@955
  2296
        fi
slouken@955
  2297
        # Set up files for the joystick library
slouken@955
  2298
        if test x$enable_joystick = xyes; then
slouken@1361
  2299
            AC_DEFINE(SDL_JOYSTICK_RISCOS)
slouken@1361
  2300
            SOURCES="$SOURCES $srcdir/src/joystick/riscos/*.c"
slouken@1361
  2301
            have_joystick=yes
slouken@955
  2302
        fi
slouken@955
  2303
        # Set up files for the timer library
slouken@955
  2304
        if test x$enable_timers = xyes; then
slouken@1361
  2305
            AC_DEFINE(SDL_TIMER_RISCOS)
slouken@1361
  2306
            SOURCES="$SOURCES $srcdir/src/timer/riscos/*.c"
slouken@1361
  2307
            have_timers=yes
slouken@955
  2308
        fi
slouken@1361
  2309
        # The RISC OS platform requires special setup.
slouken@1361
  2310
        BUILD_LIBS="$BUILD_LIBS -ljpeg -ltiff -lpng -lz"
slouken@687
  2311
        ;;
slouken@0
  2312
    *)
slouken@1361
  2313
        AC_MSG_ERROR([
slouken@1361
  2314
*** Unsupported target:  Please add to configure.in
slouken@1361
  2315
        ])
slouken@0
  2316
        ;;
slouken@0
  2317
esac
slouken@0
  2318
slouken@1361
  2319
# Verify that we have all the platform specific files we need
slouken@1361
  2320
if test x$have_joystick != xyes; then
slouken@1361
  2321
    if test x$enable_joystick = xyes; then
slouken@1361
  2322
        AC_DEFINE(SDL_JOYSTICK_DISABLED)
slouken@1361
  2323
    fi
slouken@1361
  2324
    SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
slouken@1361
  2325
fi
slouken@1361
  2326
if test x$have_cdrom != xyes; then
slouken@1361
  2327
    if test x$enable_cdrom = xyes; then
slouken@1361
  2328
        AC_DEFINE(SDL_CDROM_DISABLED)
slouken@1361
  2329
    fi
slouken@1361
  2330
    SOURCES="$SOURCES $srcdir/src/cdrom/dummy/*.c"
slouken@1361
  2331
fi
slouken@1361
  2332
if test x$have_threads != xyes; then
slouken@1361
  2333
    if test x$enable_threads = xyes; then
slouken@1361
  2334
        AC_DEFINE(SDL_THREADS_DISABLED)
slouken@1361
  2335
    fi
slouken@1361
  2336
    SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
slouken@1361
  2337
fi
slouken@1361
  2338
if test x$have_timers != xyes; then
slouken@1361
  2339
    if test x$enable_timers = xyes; then
slouken@1361
  2340
        AC_DEFINE(SDL_TIMERS_DISABLED)
slouken@1361
  2341
    fi
slouken@1361
  2342
    SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
slouken@1361
  2343
fi
slouken@1361
  2344
if test x$have_loadso != xyes; then
slouken@1361
  2345
    if test x$enable_loadso = xyes; then
slouken@1361
  2346
        AC_DEFINE(SDL_LOADSO_DISABLED)
slouken@1361
  2347
    fi
slouken@1361
  2348
    SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
slouken@1361
  2349
fi
slouken@0
  2350
slouken@1361
  2351
OBJECTS=`echo $SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.asm,$(objects)/\1.lo,g'`
slouken@1361
  2352
OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.lo,g'`
slouken@1361
  2353
OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.lo,g'`
slouken@1361
  2354
OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
slouken@0
  2355
slouken@0
  2356
# Set runtime shared library paths as needed
slouken@0
  2357
slouken@1127
  2358
if test "x$enable_rpath" = "xyes"; then
slouken@1384
  2359
  if test $ARCH = linux -o $ARCH = freebsd -o $ARCH = bsdi -o $ARCH = irix; then
slouken@1127
  2360
    SDL_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib"
slouken@1127
  2361
  fi
slouken@1127
  2362
  if test $ARCH = solaris; then
slouken@1127
  2363
    SDL_RLD_FLAGS="-R\${exec_prefix}/lib"
slouken@1127
  2364
  fi
slouken@1127
  2365
else
slouken@1127
  2366
  SDL_RLD_FLAGS=""
slouken@0
  2367
fi
slouken@387
  2368
slouken@387
  2369
case "$ARCH" in
slouken@401
  2370
  openbsd | netbsd | bsdi)
slouken@257
  2371
    SHARED_SYSTEM_LIBS="$SYSTEM_LIBS"
slouken@387
  2372
    ;;
slouken@663
  2373
  qnx)
slouken@663
  2374
    SHARED_SYSTEM_LIBS="$SYSTEM_LIBS"
slouken@663
  2375
    ;;
slouken@387
  2376
  macosx)
icculus@1133
  2377
    SHARED_SYSTEM_LIBS=""
icculus@1133
  2378
    if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
icculus@1133
  2379
      SHARED_SYSTEM_LIBS="$SHARED_SYSTEM_LIBS -framework Cocoa"
icculus@1133
  2380
    fi
icculus@1133
  2381
    if test x$enable_video = xyes -a x$enable_video_carbon = xyes; then
icculus@1133
  2382
      SHARED_SYSTEM_LIBS="$SHARED_SYSTEM_LIBS -framework Carbon"
icculus@1133
  2383
    fi
slouken@387
  2384
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@387
  2385
      SHARED_SYSTEM_LIBS="$SHARED_SYSTEM_LIBS -framework OpenGL"
slouken@387
  2386
    fi
slouken@387
  2387
    ;;
slouken@387
  2388
  *)
slouken@257
  2389
    SHARED_SYSTEM_LIBS=""
slouken@387
  2390
    ;;
slouken@387
  2391
esac
slouken@387
  2392
slouken@807
  2393
case "$ARCH" in
slouken@807
  2394
  macosx)
slouken@807
  2395
    # Evil hack to allow static linking on Mac OS X
slouken@807
  2396
    SDL_STATIC_LIBS="\${exec_prefix}/lib/libSDLmain.a \${exec_prefix}/lib/libSDL.a"
slouken@807
  2397
    ;;
slouken@807
  2398
  *)
slouken@807
  2399
    SDL_STATIC_LIBS="$SDL_LIBS"
slouken@807
  2400
    ;;
slouken@807
  2401
esac
slouken@807
  2402
slouken@257
  2403
STATIC_SYSTEM_LIBS="$SYSTEM_LIBS"
slouken@1
  2404
slouken@0
  2405
dnl Expand the cflags and libraries needed by apps using SDL
slouken@0
  2406
AC_SUBST(SDL_CFLAGS)
slouken@0
  2407
AC_SUBST(SDL_LIBS)
slouken@807
  2408
AC_SUBST(SDL_STATIC_LIBS)
slouken@0
  2409
AC_SUBST(SDL_RLD_FLAGS)
slouken@1361
  2410
if test x$enable_shared = xyes; then
slouken@1361
  2411
    ENABLE_SHARED_TRUE=
slouken@1361
  2412
    ENABLE_SHARED_FALSE="#"
slouken@1361
  2413
else
slouken@1361
  2414
    ENABLE_SHARED_TRUE="#"
slouken@1361
  2415
    ENABLE_SHARED_FALSE=
slouken@1361
  2416
fi
slouken@1361
  2417
if test x$enable_static = xyes; then
slouken@1361
  2418
    ENABLE_STATIC_TRUE=
slouken@1361
  2419
    ENABLE_STATIC_FALSE="#"
slouken@1361
  2420
else
slouken@1361
  2421
    ENABLE_STATIC_TRUE="#"
slouken@1361
  2422
    ENABLE_STATIC_FALSE=
slouken@1361
  2423
fi
slouken@1361
  2424
AC_SUBST(ENABLE_SHARED_TRUE)
slouken@1361
  2425
AC_SUBST(ENABLE_SHARED_FALSE)
slouken@1361
  2426
AC_SUBST(ENABLE_STATIC_TRUE)
slouken@1361
  2427
AC_SUBST(ENABLE_STATIC_FALSE)
slouken@0
  2428
slouken@257
  2429
dnl Expand the libraries needed for static and dynamic linking
slouken@257
  2430
AC_SUBST(STATIC_SYSTEM_LIBS)
slouken@257
  2431
AC_SUBST(SHARED_SYSTEM_LIBS)
slouken@261
  2432
AC_SUBST(SYSTEM_LIBS)
slouken@257
  2433
slouken@1361
  2434
dnl Expand the sources and objects needed to build the library
slouken@1361
  2435
AC_SUBST(ac_aux_dir)
slouken@1361
  2436
AC_SUBST(INCLUDE)
slouken@1361
  2437
AC_SUBST(SOURCES)
slouken@1361
  2438
AC_SUBST(OBJECTS)
slouken@1361
  2439
AC_SUBST(BUILD_CFLAGS)
slouken@1361
  2440
AC_SUBST(BUILD_LIBS)
slouken@0
  2441
slouken@0
  2442
AC_OUTPUT([
slouken@1361
  2443
    Makefile sdl-config SDL.spec SDL.qpg
slouken@1361
  2444
], [
slouken@1361
  2445
    : >build-deps
slouken@1361
  2446
    make depend
slouken@1361
  2447
])