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