configure.in
author Sam Lantinga <slouken@libsdl.org>
Wed, 13 Jan 2010 07:25:28 +0000
changeset 3649 1e74d7984d0b
parent 3647 c5925cd41955
child 3654 336f3df1578d
permissions -rw-r--r--
The config sets the default assertion level so people can override it for their own use in application code.
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@3085
     5
AC_CONFIG_AUX_DIRS($srcdir/build-scripts)
slouken@0
     6
slouken@3382
     7
dnl Save the CFLAGS to see whether they were passed in or generated
slouken@3382
     8
orig_CFLAGS="$CFLAGS"
slouken@3382
     9
slouken@0
    10
dnl Set various version strings - taken gratefully from the GTk sources
slouken@0
    11
#
slouken@0
    12
# Making releases:
slouken@0
    13
# Edit include/SDL/SDL_version.h and change the version, then:
slouken@0
    14
#   SDL_MICRO_VERSION += 1;
slouken@0
    15
#   SDL_INTERFACE_AGE += 1;
slouken@0
    16
#   SDL_BINARY_AGE += 1;
slouken@0
    17
# if any functions have been added, set SDL_INTERFACE_AGE to 0.
slouken@0
    18
# if backwards compatibility has been broken,
slouken@0
    19
# set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0.
slouken@0
    20
#
slouken@0
    21
SDL_MAJOR_VERSION=1
slouken@1895
    22
SDL_MINOR_VERSION=3
slouken@1895
    23
SDL_MICRO_VERSION=0
slouken@1886
    24
SDL_INTERFACE_AGE=0
slouken@1895
    25
SDL_BINARY_AGE=0
slouken@0
    26
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
slouken@0
    27
slouken@0
    28
AC_SUBST(SDL_MAJOR_VERSION)
slouken@0
    29
AC_SUBST(SDL_MINOR_VERSION)
slouken@0
    30
AC_SUBST(SDL_MICRO_VERSION)
slouken@0
    31
AC_SUBST(SDL_INTERFACE_AGE)
slouken@0
    32
AC_SUBST(SDL_BINARY_AGE)
slouken@0
    33
AC_SUBST(SDL_VERSION)
slouken@0
    34
slouken@0
    35
# libtool versioning
slouken@3085
    36
LT_INIT([win32-dll])
slouken@3085
    37
slouken@0
    38
LT_RELEASE=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION
slouken@0
    39
LT_CURRENT=`expr $SDL_MICRO_VERSION - $SDL_INTERFACE_AGE`
slouken@0
    40
LT_REVISION=$SDL_INTERFACE_AGE
slouken@0
    41
LT_AGE=`expr $SDL_BINARY_AGE - $SDL_INTERFACE_AGE`
slouken@3368
    42
m4_pattern_allow([^LT_])
slouken@0
    43
slouken@0
    44
AC_SUBST(LT_RELEASE)
slouken@0
    45
AC_SUBST(LT_CURRENT)
slouken@0
    46
AC_SUBST(LT_REVISION)
slouken@0
    47
AC_SUBST(LT_AGE)
slouken@0
    48
slouken@1550
    49
dnl Detect the canonical build and host environments
slouken@3368
    50
dnl AC_CANONICAL_HOST
slouken@0
    51
slouken@3332
    52
dnl Check for tools
slouken@3332
    53
AC_PROG_LIBTOOL
slouken@3332
    54
AC_PROG_CC
slouken@3332
    55
AC_PROG_CXX
slouken@3332
    56
AC_PROG_INSTALL
slouken@3332
    57
AC_PROG_MAKE_SET
slouken@3332
    58
if test -z "$host_alias"; then
slouken@3332
    59
    hostaliaswindres=
slouken@3332
    60
else
slouken@3332
    61
    hostaliaswindres="$host_alias-windres"
slouken@3332
    62
fi
slouken@3332
    63
AC_CHECK_PROGS(WINDRES, [windres $hostaliaswindres $host_os-windres])
slouken@3332
    64
slouken@1389
    65
dnl Set up the compiler and linker flags
slouken@1571
    66
INCLUDE="-I$srcdir/include"
slouken@1373
    67
if test x$srcdir != x.; then
slouken@1742
    68
    # Remove SDL_config.h from the source directory, since it's the
slouken@1742
    69
    # default one, and we want to include the one that we generate.
slouken@1742
    70
    if test -f $srcdir/include/SDL_config.h; then
slouken@1742
    71
        rm $srcdir/include/SDL_config.h
slouken@1742
    72
    fi
slouken@1571
    73
    INCLUDE="-Iinclude $INCLUDE"
slouken@1373
    74
fi
slouken@1550
    75
case "$host" in
slouken@1389
    76
    *-*-cygwin*)
slouken@1389
    77
        # We build SDL on cygwin without the UNIX emulation layer
slouken@1521
    78
        BASE_CFLAGS="-I/usr/include/mingw -mno-cygwin"
slouken@1521
    79
        BASE_LDFLAGS="-mno-cygwin"
slouken@1389
    80
        ;;
slouken@1389
    81
    *)
slouken@3604
    82
        BASE_CFLAGS=""
slouken@1521
    83
        BASE_LDFLAGS=""
slouken@1389
    84
        ;;
slouken@1389
    85
esac
slouken@1648
    86
BUILD_CFLAGS="$CFLAGS $CPPFLAGS"
slouken@3382
    87
# The default optimization for SDL 1.3 is -O3 (Bug #31)
slouken@3382
    88
if test x$orig_CFLAGS = x; then
slouken@3382
    89
    BUILD_CFLAGS=`echo $BUILD_CFLAGS | sed 's/-O2/-O3/'`
slouken@3382
    90
fi
slouken@1521
    91
EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS"
slouken@1521
    92
BUILD_LDFLAGS="$LDFLAGS"
slouken@1521
    93
EXTRA_LDFLAGS="$BASE_LDFLAGS"
slouken@2163
    94
## These are common directories to find software packages
slouken@2163
    95
#for path in /usr/freeware /usr/pkg /usr/X11R6 /usr/local; do
slouken@1823
    96
#    if test -d $path/include; then
slouken@1823
    97
#        EXTRA_CFLAGS="$EXTRA_CFLAGS -I$path/include"
slouken@1823
    98
#    fi
slouken@1823
    99
#    if test -d $path/lib; then
slouken@1823
   100
#        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$path/lib"
slouken@1823
   101
#    fi
slouken@1823
   102
#done
slouken@1521
   103
SDL_CFLAGS="$BASE_CFLAGS"
slouken@1521
   104
SDL_LIBS="-lSDL $BASE_LDFLAGS"
slouken@1521
   105
CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS"
slouken@1521
   106
CFLAGS="$CFLAGS $EXTRA_CFLAGS"
slouken@1521
   107
LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
slouken@1373
   108
slouken@3391
   109
dnl set this to use on systems that use lib64 instead of lib
slouken@3391
   110
base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
slouken@3391
   111
slouken@3391
   112
dnl Function to find a library in the compiler search path
slouken@3391
   113
find_lib()
slouken@3391
   114
{
slouken@3391
   115
    gcc_bin_path=[`$CC -print-search-dirs 2>/dev/null | fgrep programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
slouken@3391
   116
    gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
slouken@3391
   117
    env_lib_path=[`echo $LIBS $LDFLAGS $* | sed 's/-L[ ]*//g'`]
slouken@3391
   118
    if test "$cross_compiling" = yes; then
slouken@3391
   119
        host_lib_path=""
slouken@3391
   120
    else
slouken@3391
   121
        host_lib_path="/usr/$base_libdir /usr/local/$base_libdir"
slouken@3391
   122
    fi
slouken@3391
   123
    for path in $gcc_bin_path $gcc_lib_path $env_lib_path $host_lib_path; do
slouken@3391
   124
        lib=[`ls -- $path/$1 2>/dev/null | sort | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@3391
   125
        if test x$lib != x; then
slouken@3391
   126
            echo $lib
slouken@3391
   127
            return
slouken@3391
   128
        fi
slouken@3391
   129
    done
slouken@3391
   130
}
slouken@3391
   131
slouken@1353
   132
dnl Check for compiler characteristics
slouken@1341
   133
AC_C_CONST
slouken@1341
   134
AC_C_INLINE
slouken@1353
   135
AC_C_VOLATILE
slouken@1353
   136
slouken@3647
   137
dnl See whether we want assertions for debugging/sanity checking SDL itself.
slouken@3647
   138
AC_ARG_ENABLE(assertions,
slouken@3647
   139
AC_HELP_STRING([--enable-assertions],
slouken@3647
   140
               [Enable internal sanity checks (yes/no/release/paranoid) [[default=release]]]),
slouken@3647
   141
              , enable_assertions=release)
slouken@3647
   142
sdl_valid_assertion_level=no
slouken@3647
   143
if test x$enable_assertions = xno; then
slouken@3647
   144
    sdl_valid_assertion_level=yes
slouken@3649
   145
    AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 0)
slouken@3647
   146
fi
slouken@3647
   147
if test x$enable_assertions = xrelease; then
slouken@3647
   148
    sdl_valid_assertion_level=yes
slouken@3649
   149
    AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 1)
slouken@3647
   150
fi
slouken@3647
   151
if test x$enable_assertions = xyes; then
slouken@3647
   152
    sdl_valid_assertion_level=yes
slouken@3649
   153
    AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 2)
slouken@3647
   154
fi
slouken@3647
   155
if test x$enable_assertions = xparanoid; then
slouken@3647
   156
    sdl_valid_assertion_level=yes
slouken@3649
   157
    AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 3)
slouken@3647
   158
fi
slouken@3647
   159
if test x$sdl_valid_assertion_level = xno; then
slouken@3647
   160
    AC_MSG_ERROR([*** unknown assertion level. stop.])
slouken@3647
   161
fi
slouken@3647
   162
slouken@3354
   163
dnl See whether we can use gcc style dependency tracking
slouken@3354
   164
AC_ARG_ENABLE(dependency-tracking,
slouken@3354
   165
AC_HELP_STRING([--enable-dependency-tracking],
slouken@3354
   166
               [Use gcc -MMD -MT dependency tracking [[default=yes]]]),
slouken@3354
   167
              , enable_dependency_tracking=yes)
slouken@3354
   168
if test x$enable_dependency_tracking = xyes; then
slouken@3354
   169
    have_gcc_mmd_mt=no
slouken@3354
   170
    AC_MSG_CHECKING(for GCC -MMD -MT option)
slouken@3354
   171
    AC_TRY_COMPILE([
slouken@3354
   172
    #if !defined(__GNUC__) || __GNUC__ < 3
slouken@3354
   173
    #error Dependency tracking requires GCC 3.0 or newer
slouken@3354
   174
    #endif
slouken@3354
   175
    ],[
slouken@3354
   176
    ],[
slouken@3354
   177
    have_gcc_mmd_mt=yes
slouken@3354
   178
    ])
slouken@3354
   179
    AC_MSG_RESULT($have_gcc_mmd_mt)
slouken@3354
   180
slouken@3354
   181
    if test x$have_gcc_mmd_mt = xyes; then
slouken@3354
   182
        DEPENDENCY_TRACKING_OPTIONS="-MMD -MT \$@"
slouken@3354
   183
    fi
slouken@3354
   184
fi
slouken@3354
   185
    
slouken@1361
   186
dnl See whether we are allowed to use the system C library
slouken@1361
   187
AC_ARG_ENABLE(libc,
slouken@1637
   188
AC_HELP_STRING([--enable-libc], [Use the system C library [[default=yes]]]),
slouken@1361
   189
              , enable_libc=yes)
slouken@1361
   190
if test x$enable_libc = xyes; then
slouken@1361
   191
    AC_DEFINE(HAVE_LIBC)
slouken@1353
   192
slouken@1361
   193
    dnl Check for C library headers
slouken@1361
   194
    AC_HEADER_STDC
slouken@1501
   195
    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 iconv.h signal.h)
slouken@1361
   196
slouken@1361
   197
    dnl Check for typedefs, structures, etc.
slouken@1361
   198
    AC_TYPE_SIZE_T
slouken@1361
   199
    if test x$ac_cv_header_inttypes_h = xyes -o x$ac_cv_header_stdint_h = xyes; then
slouken@1361
   200
        AC_CHECK_TYPE(int64_t)
slouken@1361
   201
        if test x$ac_cv_type_int64_t = xyes; then
slouken@1361
   202
            AC_DEFINE(SDL_HAS_64BIT_TYPE)
slouken@1361
   203
        fi
slouken@1361
   204
        have_inttypes=yes
slouken@1353
   205
    fi
slouken@1361
   206
slouken@3012
   207
    dnl Check for defines
slouken@3012
   208
    AC_CHECK_DEFINE(M_PI, math.h)
slouken@3012
   209
slouken@1361
   210
    dnl Checks for library functions.
icculus@2079
   211
    case "$host" in
icculus@2079
   212
    *-*-cygwin* | *-*-mingw32*)
icculus@2079
   213
        ;;
icculus@2079
   214
    *)
icculus@2079
   215
        AC_FUNC_ALLOCA
icculus@2079
   216
        ;;
icculus@2079
   217
    esac
icculus@2079
   218
slouken@1361
   219
    AC_FUNC_MEMCMP
slouken@1361
   220
    if test x$ac_cv_func_memcmp_working = xyes; then
slouken@1361
   221
        AC_DEFINE(HAVE_MEMCMP)
slouken@1361
   222
    fi
slouken@1361
   223
    AC_FUNC_STRTOD
slouken@1361
   224
    if test x$ac_cv_func_strtod = xyes; then
slouken@1361
   225
        AC_DEFINE(HAVE_STRTOD)
slouken@1361
   226
    fi
slouken@3405
   227
    AC_CHECK_FUNC(mprotect,
slouken@3405
   228
        AC_TRY_COMPILE([
slouken@3405
   229
          #include <sys/types.h>
slouken@3405
   230
          #include <sys/mman.h>
slouken@3405
   231
        ],[
slouken@3405
   232
        ],[
slouken@3405
   233
        AC_DEFINE(HAVE_MPROTECT)
slouken@3405
   234
        ]),
slouken@3405
   235
    )
slouken@3586
   236
    AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp sscanf snprintf vsnprintf sigaction setjmp nanosleep sysconf sysctlbyname)
slouken@1373
   237
slouken@3014
   238
    AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
slouken@3032
   239
    AC_CHECK_FUNCS(ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt)
slouken@3014
   240
slouken@3014
   241
    AC_CHECK_LIB(iconv, libiconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"])
slouken@3014
   242
    AC_CHECK_FUNCS(iconv)
slouken@1361
   243
fi
slouken@1361
   244
bob@3180
   245
AC_CHECK_SIZEOF(void*)
slouken@1361
   246
if test x$have_inttypes != xyes; then
slouken@1353
   247
    AC_CHECK_SIZEOF(char, 1)
slouken@1353
   248
    AC_CHECK_SIZEOF(short, 2)
slouken@1353
   249
    AC_CHECK_SIZEOF(int, 4)
slouken@1353
   250
    AC_CHECK_SIZEOF(long, 4)
slouken@1353
   251
    AC_CHECK_SIZEOF(long long, 8)
slouken@1353
   252
    if test x$ac_cv_sizeof_char = x1; then
slouken@1353
   253
        AC_DEFINE(int8_t, signed char)
slouken@1353
   254
        AC_DEFINE(uint8_t, unsigned char)
slouken@1353
   255
    fi
slouken@1353
   256
    if test x$ac_cv_sizeof_short = x2; then
slouken@1353
   257
        AC_DEFINE(int16_t, signed short)
slouken@1353
   258
        AC_DEFINE(uint16_t, unsigned short)
slouken@1353
   259
    else
slouken@1353
   260
        if test x$ac_cv_sizeof_int = x2; then
slouken@1353
   261
            AC_DEFINE(int16_t, signed int)
slouken@1353
   262
            AC_DEFINE(uint16_t, unsigned int)
slouken@1353
   263
        fi
slouken@1353
   264
    fi
slouken@1353
   265
    if test x$ac_cv_sizeof_int = x4; then
slouken@1353
   266
        AC_DEFINE(int32_t, signed int)
slouken@1353
   267
        AC_DEFINE(uint32_t, unsigned int)
slouken@1353
   268
    else
slouken@1353
   269
        if test x$ac_cv_sizeof_long = x4; then
slouken@1353
   270
            AC_DEFINE(int32_t, signed long)
slouken@1353
   271
            AC_DEFINE(uint32_t, unsigned long)
slouken@1353
   272
        fi
slouken@1353
   273
    fi
slouken@1353
   274
    if test x$ac_cv_sizeof_long = x8; then
slouken@1353
   275
        AC_DEFINE(int64_t, signed long)
slouken@1353
   276
        AC_DEFINE(uint64_t, unsigned long)
slouken@1353
   277
        AC_DEFINE(SDL_HAS_64BIT_TYPE)
slouken@1353
   278
    else
slouken@1353
   279
        if test x$ac_cv_sizeof_long_long = x8; then
slouken@1353
   280
            AC_DEFINE(int64_t, signed long long)
slouken@1353
   281
            AC_DEFINE(uint64_t, unsigned long long)
slouken@1353
   282
            AC_DEFINE(SDL_HAS_64BIT_TYPE)
slouken@1353
   283
        fi
slouken@1353
   284
    fi
slouken@1361
   285
    AC_DEFINE(size_t, unsigned int)
slouken@1361
   286
    AC_DEFINE(uintptr_t, unsigned long)
slouken@1353
   287
fi
slouken@1341
   288
slouken@1361
   289
# Standard C sources
slouken@1361
   290
SOURCES="$SOURCES $srcdir/src/*.c"
slouken@1361
   291
SOURCES="$SOURCES $srcdir/src/audio/*.c"
slouken@1361
   292
SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c"
slouken@1361
   293
SOURCES="$SOURCES $srcdir/src/events/*.c"
slouken@1361
   294
SOURCES="$SOURCES $srcdir/src/file/*.c"
slouken@1361
   295
SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
slouken@1361
   296
SOURCES="$SOURCES $srcdir/src/thread/*.c"
slouken@1361
   297
SOURCES="$SOURCES $srcdir/src/timer/*.c"
slouken@1361
   298
SOURCES="$SOURCES $srcdir/src/video/*.c"
slouken@1361
   299
slouken@0
   300
dnl Enable/disable various subsystems of the SDL library
slouken@0
   301
bob@3199
   302
AC_ARG_ENABLE(atomic,
bob@3199
   303
AC_HELP_STRING([--enable-atomic], [Enable the atomic operations subsystem [[default=yes]]]),
bob@3199
   304
              , enable_atomic=yes)
bob@3199
   305
if test x$enable_atomic != xyes; then
bob@3199
   306
    AC_DEFINE(SDL_ATOMIC_DISABLED)
bob@3199
   307
fi
slouken@0
   308
AC_ARG_ENABLE(audio,
slouken@1637
   309
AC_HELP_STRING([--enable-audio], [Enable the audio subsystem [[default=yes]]]),
slouken@0
   310
              , enable_audio=yes)
slouken@1361
   311
if test x$enable_audio != xyes; then
slouken@1361
   312
    AC_DEFINE(SDL_AUDIO_DISABLED)
slouken@0
   313
fi
slouken@0
   314
AC_ARG_ENABLE(video,
slouken@1637
   315
AC_HELP_STRING([--enable-video], [Enable the video subsystem [[default=yes]]]),
slouken@0
   316
              , enable_video=yes)
slouken@1361
   317
if test x$enable_video != xyes; then
slouken@1361
   318
    AC_DEFINE(SDL_VIDEO_DISABLED)
slouken@0
   319
fi
slouken@0
   320
AC_ARG_ENABLE(events,
slouken@1637
   321
AC_HELP_STRING([--enable-events], [Enable the events subsystem [[default=yes]]]),
slouken@0
   322
              , enable_events=yes)
slouken@1361
   323
if test x$enable_events != xyes; then
slouken@1361
   324
    AC_DEFINE(SDL_EVENTS_DISABLED)
slouken@0
   325
fi
slouken@0
   326
AC_ARG_ENABLE(joystick,
slouken@1637
   327
AC_HELP_STRING([--enable-joystick], [Enable the joystick subsystem [[default=yes]]]),
slouken@0
   328
              , enable_joystick=yes)
slouken@1361
   329
if test x$enable_joystick != xyes; then
slouken@1361
   330
    AC_DEFINE(SDL_JOYSTICK_DISABLED)
icculus@2103
   331
else
icculus@2103
   332
    SOURCES="$SOURCES $srcdir/src/joystick/*.c"
slouken@0
   333
fi
slouken@2713
   334
AC_ARG_ENABLE(haptic,
slouken@2713
   335
AC_HELP_STRING([--enable-haptic], [Enable the haptic (force feedback) subsystem [[default=yes]]]),
slouken@2713
   336
              , enable_haptic=yes)
slouken@2713
   337
if test x$enable_haptic != xyes; then
slouken@2713
   338
    AC_DEFINE(SDL_HAPTIC_DISABLED)
slouken@2713
   339
else
slouken@2713
   340
    SOURCES="$SOURCES $srcdir/src/haptic/*.c"
slouken@2713
   341
fi
icculus@3170
   342
AC_ARG_ENABLE(power,
icculus@3170
   343
AC_HELP_STRING([--enable-power], [Enable the power subsystem [[default=yes]]]),
icculus@3170
   344
              , enable_power=yes)
icculus@3170
   345
if test x$enable_power != xyes; then
icculus@3170
   346
    AC_DEFINE(SDL_POWER_DISABLED)
icculus@3170
   347
else
icculus@3170
   348
    SOURCES="$SOURCES $srcdir/src/power/*.c"
icculus@3170
   349
fi
slouken@0
   350
AC_ARG_ENABLE(threads,
slouken@1637
   351
AC_HELP_STRING([--enable-threads], [Enable the threading subsystem [[default=yes]]]),
slouken@0
   352
              , enable_threads=yes)
slouken@0
   353
if test x$enable_threads != xyes; then
slouken@1361
   354
    AC_DEFINE(SDL_THREADS_DISABLED)
slouken@0
   355
fi
slouken@0
   356
AC_ARG_ENABLE(timers,
slouken@1637
   357
AC_HELP_STRING([--enable-timers], [Enable the timer subsystem [[default=yes]]]),
slouken@0
   358
              , enable_timers=yes)
slouken@1361
   359
if test x$enable_timers != xyes; then
slouken@1361
   360
    AC_DEFINE(SDL_TIMERS_DISABLED)
slouken@0
   361
fi
slouken@0
   362
AC_ARG_ENABLE(file,
slouken@1637
   363
AC_HELP_STRING([--enable-file], [Enable the file subsystem [[default=yes]]]),
slouken@0
   364
              , enable_file=yes)
slouken@1361
   365
if test x$enable_file != xyes; then
slouken@1361
   366
    AC_DEFINE(SDL_FILE_DISABLED)
slouken@1361
   367
fi
slouken@1361
   368
AC_ARG_ENABLE(loadso,
slouken@1637
   369
AC_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [[default=yes]]]),
slouken@1361
   370
              , enable_loadso=yes)
slouken@1361
   371
if test x$enable_loadso != xyes; then
slouken@1361
   372
    AC_DEFINE(SDL_LOADSO_DISABLED)
slouken@0
   373
fi
slouken@740
   374
AC_ARG_ENABLE(cpuinfo,
slouken@1637
   375
AC_HELP_STRING([--enable-cpuinfo], [Enable the cpuinfo subsystem [[default=yes]]]),
slouken@740
   376
              , enable_cpuinfo=yes)
slouken@1361
   377
if test x$enable_cpuinfo != xyes; then
slouken@1361
   378
    AC_DEFINE(SDL_CPUINFO_DISABLED)
slouken@1361
   379
fi
slouken@1402
   380
AC_ARG_ENABLE(assembly,
slouken@1637
   381
AC_HELP_STRING([--enable-assembly], [Enable assembly routines [[default=yes]]]),
slouken@1402
   382
              , enable_assembly=yes)
slouken@1402
   383
if test x$enable_assembly = xyes; then
slouken@1402
   384
    AC_DEFINE(SDL_ASSEMBLY_ROUTINES)
slouken@2247
   385
slouken@2856
   386
    # Make sure that we don't generate floating point code that would
slouken@2856
   387
    # cause illegal instruction exceptions on older processors
slouken@2856
   388
    case "$host" in
slouken@2856
   389
        *-*-darwin*)
slouken@2856
   390
            # Don't need to worry about Apple hardware, it's all SSE capable
slouken@2856
   391
            default_ssemath=yes
slouken@2856
   392
            ;;
slouken@2856
   393
        *64-*-*)
slouken@2856
   394
            # x86 64-bit architectures all have SSE instructions
slouken@2856
   395
            default_ssemath=yes
slouken@2856
   396
            ;;
slouken@3392
   397
        *)
slouken@2856
   398
            default_ssemath=no
slouken@2856
   399
            ;;
slouken@2856
   400
    esac
slouken@2856
   401
    AC_ARG_ENABLE(ssemath,
slouken@2856
   402
AC_HELP_STRING([--enable-ssemath], [Allow GCC to use SSE floating point math [[default=no]]]),
slouken@2856
   403
                  , enable_ssemath=$default_ssemath)
slouken@2856
   404
    if test x$enable_ssemath = xno; then
slouken@2856
   405
        if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes; then
slouken@2856
   406
            EXTRA_CFLAGS="$EXTRA_CFLAGS -mfpmath=387"
slouken@2856
   407
        fi
slouken@2856
   408
    fi
slouken@2856
   409
slouken@2247
   410
    dnl Check for various instruction support
slouken@2247
   411
    AC_ARG_ENABLE(mmx,
slouken@2247
   412
AC_HELP_STRING([--enable-mmx], [use MMX assembly routines [[default=yes]]]),
slouken@2247
   413
                  , enable_mmx=yes)
slouken@2247
   414
    if test x$enable_mmx = xyes; then
slouken@2247
   415
        save_CFLAGS="$CFLAGS"
slouken@2247
   416
        have_gcc_mmx=no
slouken@2247
   417
        AC_MSG_CHECKING(for GCC -mmmx option)
slouken@2247
   418
        mmx_CFLAGS="-mmmx"
slouken@2247
   419
        CFLAGS="$save_CFLAGS $mmx_CFLAGS"
slouken@2247
   420
slouken@2247
   421
        AC_TRY_COMPILE([
slouken@2247
   422
        #include <mmintrin.h>
slouken@2261
   423
        #ifndef __MMX__
slouken@2261
   424
        #error Assembler CPP flag not enabled
slouken@2261
   425
        #endif
slouken@2247
   426
        ],[
slouken@2247
   427
        ],[
slouken@2247
   428
        have_gcc_mmx=yes
slouken@2247
   429
        ])
slouken@2247
   430
        AC_MSG_RESULT($have_gcc_mmx)
slouken@2290
   431
        CFLAGS="$save_CFLAGS"
slouken@2247
   432
slouken@2247
   433
        if test x$have_gcc_mmx = xyes; then
slouken@2247
   434
            EXTRA_CFLAGS="$EXTRA_CFLAGS $mmx_CFLAGS"
slouken@2247
   435
        fi
slouken@2247
   436
    fi
slouken@2247
   437
slouken@2261
   438
    AC_ARG_ENABLE(3dnow,
slouken@2261
   439
AC_HELP_STRING([--enable-3dnow], [use MMX assembly routines [[default=yes]]]),
slouken@2261
   440
                  , enable_3dnow=yes)
slouken@2261
   441
    if test x$enable_3dnow = xyes; then
slouken@2261
   442
        save_CFLAGS="$CFLAGS"
slouken@2261
   443
        have_gcc_3dnow=no
slouken@2261
   444
        AC_MSG_CHECKING(for GCC -m3dnow option)
slouken@2261
   445
        amd3dnow_CFLAGS="-m3dnow"
slouken@2261
   446
        CFLAGS="$save_CFLAGS $amd3dnow_CFLAGS"
slouken@2261
   447
slouken@2261
   448
        AC_TRY_COMPILE([
slouken@2261
   449
        #include <mm3dnow.h>
slouken@2261
   450
        #ifndef __3dNOW__
slouken@2261
   451
        #error Assembler CPP flag not enabled
slouken@2261
   452
        #endif
slouken@2261
   453
        ],[
slouken@2261
   454
        ],[
slouken@2261
   455
        have_gcc_3dnow=yes
slouken@2261
   456
        ])
slouken@2261
   457
        AC_MSG_RESULT($have_gcc_3dnow)
slouken@2290
   458
        CFLAGS="$save_CFLAGS"
slouken@2261
   459
slouken@2261
   460
        if test x$have_gcc_3dnow = xyes; then
slouken@2261
   461
            EXTRA_CFLAGS="$EXTRA_CFLAGS $amd3dnow_CFLAGS"
slouken@2261
   462
        fi
slouken@2261
   463
    fi
slouken@2261
   464
slouken@2247
   465
    AC_ARG_ENABLE(sse,
slouken@2247
   466
AC_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]),
slouken@2247
   467
                  , enable_sse=yes)
slouken@2247
   468
    if test x$enable_sse = xyes; then
slouken@2247
   469
        save_CFLAGS="$CFLAGS"
slouken@2247
   470
        have_gcc_sse=no
slouken@2247
   471
        AC_MSG_CHECKING(for GCC -msse option)
slouken@2247
   472
        sse_CFLAGS="-msse"
slouken@2247
   473
        CFLAGS="$save_CFLAGS $sse_CFLAGS"
slouken@2247
   474
slouken@2247
   475
        AC_TRY_COMPILE([
slouken@2247
   476
        #include <xmmintrin.h>
slouken@2261
   477
        #ifndef __SSE__
slouken@2261
   478
        #error Assembler CPP flag not enabled
slouken@2261
   479
        #endif
slouken@2247
   480
        ],[
slouken@2247
   481
        ],[
slouken@2247
   482
        have_gcc_sse=yes
slouken@2247
   483
        ])
slouken@2247
   484
        AC_MSG_RESULT($have_gcc_sse)
slouken@2290
   485
        CFLAGS="$save_CFLAGS"
slouken@2247
   486
slouken@2247
   487
        if test x$have_gcc_sse = xyes; then
slouken@2247
   488
            EXTRA_CFLAGS="$EXTRA_CFLAGS $sse_CFLAGS"
slouken@2247
   489
        fi
slouken@2247
   490
    fi
slouken@2247
   491
slouken@2264
   492
    AC_ARG_ENABLE(sse2,
slouken@2856
   493
AC_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=no]]]),
slouken@2856
   494
                  , enable_sse2=$default_ssemath)
slouken@2264
   495
    if test x$enable_sse2 = xyes; then
slouken@2264
   496
        save_CFLAGS="$CFLAGS"
slouken@2264
   497
        have_gcc_sse2=no
slouken@2264
   498
        AC_MSG_CHECKING(for GCC -msse2 option)
slouken@2264
   499
        sse2_CFLAGS="-msse2"
slouken@2264
   500
        CFLAGS="$save_CFLAGS $sse2_CFLAGS"
slouken@2264
   501
slouken@2264
   502
        AC_TRY_COMPILE([
slouken@2264
   503
        #include <emmintrin.h>
slouken@2264
   504
        #ifndef __SSE2__
slouken@2264
   505
        #error Assembler CPP flag not enabled
slouken@2264
   506
        #endif
slouken@2264
   507
        ],[
slouken@2264
   508
        ],[
slouken@2264
   509
        have_gcc_sse2=yes
slouken@2264
   510
        ])
slouken@2264
   511
        AC_MSG_RESULT($have_gcc_sse2)
slouken@2290
   512
        CFLAGS="$save_CFLAGS"
slouken@2264
   513
slouken@2264
   514
        if test x$have_gcc_sse2 = xyes; then
slouken@2264
   515
            EXTRA_CFLAGS="$EXTRA_CFLAGS $sse2_CFLAGS"
slouken@2264
   516
        fi
slouken@2264
   517
    fi
slouken@2264
   518
slouken@2247
   519
    AC_ARG_ENABLE(altivec,
slouken@2247
   520
AC_HELP_STRING([--enable-altivec], [use Altivec assembly routines [[default=yes]]]),
slouken@2247
   521
                  , enable_altivec=yes)
slouken@2247
   522
    if test x$enable_altivec = xyes; then
slouken@2247
   523
        save_CFLAGS="$CFLAGS"
slouken@2247
   524
        have_gcc_altivec=no
slouken@3390
   525
        have_altivec_h_hdr=no
slouken@2247
   526
        altivec_CFLAGS="-maltivec"
slouken@2247
   527
        CFLAGS="$save_CFLAGS $altivec_CFLAGS"
slouken@2247
   528
slouken@3390
   529
        AC_MSG_CHECKING(for Altivec with GCC altivec.h and -maltivec option)
slouken@3390
   530
        AC_TRY_COMPILE([
slouken@3390
   531
        #include <altivec.h>
slouken@3390
   532
        vector unsigned int vzero() {
slouken@3390
   533
            return vec_splat_u32(0);
slouken@3390
   534
        }
slouken@3390
   535
        ],[
slouken@3390
   536
        ],[
slouken@3390
   537
        have_gcc_altivec=yes
slouken@3390
   538
        have_altivec_h_hdr=yes
slouken@3390
   539
        ])
slouken@3390
   540
        AC_MSG_RESULT($have_gcc_altivec)
slouken@3390
   541
slouken@3390
   542
        if test x$have_gcc_altivec = xno; then
slouken@3390
   543
            AC_MSG_CHECKING(for Altivec with GCC -maltivec option)
slouken@3390
   544
            AC_TRY_COMPILE([
slouken@3390
   545
            vector unsigned int vzero() {
slouken@3390
   546
                return vec_splat_u32(0);
slouken@3390
   547
            }
slouken@3390
   548
            ],[
slouken@3390
   549
            ],[
slouken@3390
   550
            have_gcc_altivec=yes
slouken@3390
   551
            ])
slouken@3390
   552
            AC_MSG_RESULT($have_gcc_altivec)
slouken@2247
   553
        fi
slouken@2247
   554
slouken@2247
   555
        if test x$have_gcc_altivec = xno; then
slouken@3390
   556
            AC_MSG_CHECKING(for Altivec with GCC altivec.h and -faltivec option)
slouken@2247
   557
            altivec_CFLAGS="-faltivec"
slouken@2247
   558
            CFLAGS="$save_CFLAGS $altivec_CFLAGS"
slouken@3390
   559
            AC_TRY_COMPILE([
slouken@3390
   560
            #include <altivec.h>
slouken@3390
   561
            vector unsigned int vzero() {
slouken@3390
   562
                return vec_splat_u32(0);
slouken@3390
   563
            }
slouken@3390
   564
            ],[
slouken@3390
   565
            ],[
slouken@3390
   566
            have_gcc_altivec=yes
slouken@3390
   567
            have_altivec_h_hdr=yes
slouken@3390
   568
            ])
slouken@3390
   569
            AC_MSG_RESULT($have_gcc_altivec)
slouken@3392
   570
        fi
slouken@3390
   571
slouken@3390
   572
        if test x$have_gcc_altivec = xno; then
slouken@3390
   573
            AC_MSG_CHECKING(for Altivec with GCC -faltivec option)
slouken@3390
   574
            AC_TRY_COMPILE([
slouken@3390
   575
            vector unsigned int vzero() {
slouken@3390
   576
                return vec_splat_u32(0);
slouken@3390
   577
            }
slouken@3390
   578
            ],[
slouken@3390
   579
            ],[
slouken@3390
   580
            have_gcc_altivec=yes
slouken@3390
   581
            ])
slouken@3390
   582
            AC_MSG_RESULT($have_gcc_altivec)
slouken@2247
   583
        fi
slouken@2247
   584
        CFLAGS="$save_CFLAGS"
slouken@2247
   585
slouken@2247
   586
        if test x$have_gcc_altivec = xyes; then
slouken@2247
   587
            AC_DEFINE(SDL_ALTIVEC_BLITTERS)
slouken@2247
   588
            if test x$have_altivec_h_hdr = xyes; then
slouken@2247
   589
              AC_DEFINE(HAVE_ALTIVEC_H)
slouken@2247
   590
            fi
slouken@2247
   591
            EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS"
slouken@2247
   592
        fi
slouken@2247
   593
    fi
slouken@740
   594
fi
slouken@0
   595
slouken@0
   596
dnl See if the OSS audio interface is supported
slouken@0
   597
CheckOSS()
slouken@0
   598
{
slouken@0
   599
    AC_ARG_ENABLE(oss,
slouken@1637
   600
AC_HELP_STRING([--enable-oss], [support the OSS audio API [[default=yes]]]),
slouken@0
   601
                  , enable_oss=yes)
slouken@0
   602
    if test x$enable_audio = xyes -a x$enable_oss = xyes; then
slouken@0
   603
        AC_MSG_CHECKING(for OSS audio support)
slouken@0
   604
        have_oss=no
slouken@94
   605
        if test x$have_oss != xyes; then
slouken@94
   606
            AC_TRY_COMPILE([
slouken@94
   607
              #include <sys/soundcard.h>
slouken@94
   608
            ],[
slouken@94
   609
              int arg = SNDCTL_DSP_SETFRAGMENT;
slouken@94
   610
            ],[
slouken@94
   611
            have_oss=yes
slouken@94
   612
            ])
slouken@94
   613
        fi
slouken@94
   614
        if test x$have_oss != xyes; then
slouken@94
   615
            AC_TRY_COMPILE([
slouken@94
   616
              #include <soundcard.h>
slouken@94
   617
            ],[
slouken@94
   618
              int arg = SNDCTL_DSP_SETFRAGMENT;
slouken@94
   619
            ],[
slouken@94
   620
            have_oss=yes
slouken@1361
   621
            AC_DEFINE(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H)
slouken@94
   622
            ])
slouken@94
   623
        fi
slouken@0
   624
        AC_MSG_RESULT($have_oss)
slouken@0
   625
        if test x$have_oss = xyes; then
slouken@1361
   626
            AC_DEFINE(SDL_AUDIO_DRIVER_OSS)
slouken@1361
   627
            SOURCES="$SOURCES $srcdir/src/audio/dsp/*.c"
slouken@1361
   628
            SOURCES="$SOURCES $srcdir/src/audio/dma/*.c"
slouken@1361
   629
            have_audio=yes
slouken@1361
   630
slouken@1565
   631
            # We may need to link with ossaudio emulation library
slouken@1550
   632
            case "$host" in
slouken@1383
   633
                *-*-openbsd*|*-*-netbsd*)
slouken@1521
   634
                    EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";;
slouken@1361
   635
            esac
slouken@0
   636
        fi
slouken@0
   637
    fi
slouken@0
   638
}
slouken@0
   639
slouken@0
   640
dnl See if the ALSA audio interface is supported
slouken@0
   641
CheckALSA()
slouken@0
   642
{
slouken@0
   643
    AC_ARG_ENABLE(alsa,
slouken@1637
   644
AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [[default=yes]]]),
slouken@0
   645
                  , enable_alsa=yes)
slouken@0
   646
    if test x$enable_audio = xyes -a x$enable_alsa = xyes; then
slouken@948
   647
        AM_PATH_ALSA(0.9.0, have_alsa=yes, have_alsa=no)
slouken@1009
   648
        # Restore all flags from before the ALSA detection runs
slouken@1009
   649
        CFLAGS="$alsa_save_CFLAGS"
slouken@1009
   650
        LDFLAGS="$alsa_save_LDFLAGS"
slouken@1009
   651
        LIBS="$alsa_save_LIBS"
slouken@354
   652
        if test x$have_alsa = xyes; then
slouken@865
   653
            AC_ARG_ENABLE(alsa-shared,
slouken@1637
   654
AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [[default=yes]]]),
slouken@1361
   655
                          , enable_alsa_shared=yes)
slouken@3391
   656
            alsa_lib=[`find_lib "libasound.so.*" "$ALSA_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@1361
   657
slouken@1361
   658
            AC_DEFINE(SDL_AUDIO_DRIVER_ALSA)
slouken@1361
   659
            SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c"
slouken@1521
   660
            EXTRA_CFLAGS="$EXTRA_CFLAGS $ALSA_CFLAGS"
slouken@1361
   661
            if test x$have_loadso != xyes && \
slouken@1361
   662
               test x$enable_alsa_shared = xyes; then
slouken@1467
   663
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ALSA loading])
slouken@1361
   664
            fi
slouken@1361
   665
            if test x$have_loadso = xyes && \
slouken@1361
   666
               test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
slouken@3392
   667
                echo "-- dynamic libasound -> $alsa_lib"
slouken@1361
   668
                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ALSA_DYNAMIC, "$alsa_lib")
slouken@1361
   669
            else
slouken@1521
   670
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ALSA_LIBS"
slouken@1361
   671
            fi
slouken@1361
   672
            have_audio=yes
slouken@1361
   673
        fi
slouken@1361
   674
    fi
slouken@0
   675
}
slouken@0
   676
slouken@148
   677
dnl Check whether we want to use IRIX 6.5+ native audio or not
slouken@148
   678
CheckDMEDIA()
slouken@148
   679
{
slouken@148
   680
    if test x$enable_audio = xyes; then
slouken@148
   681
        AC_MSG_CHECKING(for dmedia audio support)
slouken@148
   682
        have_dmedia=no
slouken@148
   683
        AC_TRY_COMPILE([
slouken@148
   684
          #include <dmedia/audio.h>
slouken@148
   685
        ],[
slouken@148
   686
          ALport audio_port;
slouken@148
   687
        ],[
slouken@148
   688
        have_dmedia=yes
slouken@148
   689
        ])
slouken@935
   690
        AC_MSG_RESULT($have_dmedia)
slouken@148
   691
        # Set up files for the audio library
slouken@148
   692
        if test x$have_dmedia = xyes; then
slouken@1361
   693
            AC_DEFINE(SDL_AUDIO_DRIVER_DMEDIA)
slouken@1361
   694
            SOURCES="$SOURCES $srcdir/src/audio/dmedia/*.c"
slouken@1521
   695
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -laudio"
slouken@1361
   696
            have_audio=yes
slouken@148
   697
        fi
slouken@148
   698
    fi
slouken@148
   699
}
slouken@148
   700
slouken@1438
   701
dnl Check whether we want to use Tru64 UNIX native audio or not
slouken@1438
   702
CheckMME()
slouken@1438
   703
{
slouken@1438
   704
    dnl Make sure we are running on an Tru64 UNIX
slouken@1438
   705
    case $ARCH in
slouken@1438
   706
        osf)
slouken@1438
   707
            ;;
slouken@1438
   708
        *)
slouken@1438
   709
            return
slouken@1438
   710
            ;;
slouken@1438
   711
    esac
slouken@1438
   712
    if test x$enable_audio = xyes; then
slouken@1438
   713
        AC_MSG_CHECKING(for MME audio support)
slouken@1438
   714
        MME_CFLAGS="-I/usr/include/mme"
slouken@1438
   715
        MME_LIBS="-lmme"
slouken@1438
   716
        have_mme=no
slouken@1438
   717
        save_CFLAGS="$CFLAGS"
slouken@1438
   718
        CFLAGS="$CFLAGS $MME_CFLAGS"
slouken@1438
   719
        AC_TRY_COMPILE([
slouken@1438
   720
          #include <mme_api.h>
slouken@1438
   721
        ],[
slouken@1438
   722
          HWAVEOUT sound;
slouken@1438
   723
        ],[
slouken@1438
   724
        have_mme=yes
slouken@1438
   725
        ])
slouken@1438
   726
        CFLAGS="$save_CFLAGS"
slouken@1438
   727
        AC_MSG_RESULT($have_mme)
slouken@1438
   728
        # Set up files for the audio library
slouken@1438
   729
        if test x$have_mme = xyes; then
slouken@1438
   730
            AC_DEFINE(SDL_AUDIO_DRIVER_MMEAUDIO)
slouken@1438
   731
            SOURCES="$SOURCES $srcdir/src/audio/mme/*.c"
slouken@1521
   732
            EXTRA_CFLAGS="$EXTRA_CFLAGS $MME_CFLAGS"
slouken@1521
   733
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MME_LIBS"
slouken@1438
   734
            have_audio=yes
slouken@1438
   735
        fi
slouken@1438
   736
    fi
slouken@1438
   737
}
slouken@1438
   738
slouken@0
   739
dnl Find the ESD includes and libraries
slouken@0
   740
CheckESD()
slouken@0
   741
{
slouken@0
   742
    AC_ARG_ENABLE(esd,
slouken@1637
   743
AC_HELP_STRING([--enable-esd], [support the Enlightened Sound Daemon [[default=yes]]]),
slouken@0
   744
                  , enable_esd=yes)
slouken@0
   745
    if test x$enable_audio = xyes -a x$enable_esd = xyes; then
slouken@948
   746
        AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no)
slouken@948
   747
        if test x$have_esd = xyes; then
slouken@294
   748
            AC_ARG_ENABLE(esd-shared,
slouken@1637
   749
AC_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [[default=yes]]]),
slouken@678
   750
                          , enable_esd_shared=yes)
slouken@3391
   751
            esd_lib=[`find_lib "libesd.so.*" "$ESD_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@1467
   752
slouken@1467
   753
            AC_DEFINE(SDL_AUDIO_DRIVER_ESD)
slouken@1467
   754
            SOURCES="$SOURCES $srcdir/src/audio/esd/*.c"
slouken@1521
   755
            EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS"
icculus@1173
   756
            if test x$have_loadso != xyes && \
slouken@296
   757
               test x$enable_esd_shared = xyes; then
slouken@1467
   758
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ESD loading])
slouken@296
   759
            fi
icculus@1173
   760
            if test x$have_loadso = xyes && \
slouken@294
   761
               test x$enable_esd_shared = xyes && test x$esd_lib != x; then
slouken@3392
   762
                echo "-- dynamic libesd -> $esd_lib"
slouken@1361
   763
                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ESD_DYNAMIC, "$esd_lib")
slouken@1467
   764
            else
slouken@1521
   765
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ESD_LIBS"
slouken@294
   766
            fi
slouken@1361
   767
            have_audio=yes
slouken@294
   768
        fi
slouken@0
   769
    fi
slouken@0
   770
}
slouken@0
   771
icculus@2271
   772
dnl Find PulseAudio
icculus@2271
   773
CheckPulseAudio()
icculus@2271
   774
{
icculus@2271
   775
    AC_ARG_ENABLE(pulseaudio,
icculus@2271
   776
AC_HELP_STRING([--enable-pulseaudio], [use PulseAudio [[default=yes]]]),
icculus@2271
   777
                  , enable_pulseaudio=yes)
icculus@2271
   778
    if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then
icculus@2271
   779
        audio_pulseaudio=no
icculus@2271
   780
icculus@2271
   781
        PULSEAUDIO_REQUIRED_VERSION=0.9
icculus@2271
   782
icculus@2271
   783
        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
icculus@2271
   784
        AC_MSG_CHECKING(for PulseAudio $PULSEAUDIO_REQUIRED_VERSION support)
icculus@2271
   785
        if test x$PKG_CONFIG != xno; then
icculus@2271
   786
        if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSEAUDIO_REQUIRED_VERSION libpulse-simple; then
icculus@2271
   787
                PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple`
icculus@2271
   788
                PULSEAUDIO_LIBS=`$PKG_CONFIG --libs libpulse-simple`
icculus@2271
   789
                audio_pulseaudio=yes
slouken@3391
   790
            fi
icculus@2271
   791
        fi
icculus@2271
   792
        AC_MSG_RESULT($audio_pulseaudio)
icculus@2271
   793
icculus@2271
   794
        if test x$audio_pulseaudio = xyes; then
icculus@2271
   795
            AC_ARG_ENABLE(pulseaudio-shared,
icculus@2271
   796
AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [[default=yes]]]),
icculus@2271
   797
                          , enable_pulseaudio_shared=yes)
slouken@3391
   798
            pulseaudio_lib=[`find_lib "libpulse-simple.so.*" "$PULSEAUDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
icculus@2271
   799
icculus@2271
   800
            AC_DEFINE(SDL_AUDIO_DRIVER_PULSEAUDIO)
icculus@2271
   801
            SOURCES="$SOURCES $srcdir/src/audio/pulseaudio/*.c"
icculus@2271
   802
            EXTRA_CFLAGS="$EXTRA_CFLAGS $PULSEAUDIO_CFLAGS"
icculus@2271
   803
            if test x$have_loadso != xyes && \
icculus@2271
   804
               test x$enable_pulseaudio_shared = xyes; then
icculus@2271
   805
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic PulseAudio loading])
icculus@2271
   806
            fi
icculus@2271
   807
            if test x$have_loadso = xyes && \
icculus@2271
   808
               test x$enable_pulseaudio_shared = xyes && test x$pulseaudio_lib != x; then
slouken@3392
   809
                echo "-- dynamic libpulse-simple -> $pulseaudio_lib"
icculus@2271
   810
                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC, "$pulseaudio_lib")
icculus@2271
   811
            else
icculus@2271
   812
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PULSEAUDIO_LIBS"
icculus@2271
   813
            fi
icculus@2271
   814
            have_audio=yes
icculus@2271
   815
        fi
icculus@2271
   816
    fi
icculus@2271
   817
}
icculus@2271
   818
slouken@0
   819
CheckARTSC()
slouken@0
   820
{
slouken@0
   821
    AC_ARG_ENABLE(arts,
slouken@1637
   822
AC_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [[default=yes]]]),
slouken@0
   823
                  , enable_arts=yes)
slouken@0
   824
    if test x$enable_audio = xyes -a x$enable_arts = xyes; then
slouken@1361
   825
        AC_PATH_PROG(ARTSCONFIG, artsc-config)
slouken@1361
   826
        if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then
slouken@0
   827
            : # arts isn't installed
slouken@0
   828
        else
slouken@1361
   829
            ARTS_CFLAGS=`$ARTSCONFIG --cflags`
slouken@1361
   830
            ARTS_LIBS=`$ARTSCONFIG --libs`
slouken@0
   831
            AC_MSG_CHECKING(for aRts development environment)
slouken@0
   832
            audio_arts=no
slouken@0
   833
            save_CFLAGS="$CFLAGS"
slouken@1361
   834
            CFLAGS="$CFLAGS $ARTS_CFLAGS"
slouken@0
   835
            AC_TRY_COMPILE([
slouken@0
   836
             #include <artsc.h>
slouken@0
   837
            ],[
slouken@0
   838
             arts_stream_t stream;
slouken@0
   839
            ],[
slouken@0
   840
            audio_arts=yes
slouken@0
   841
            ])
slouken@0
   842
            CFLAGS="$save_CFLAGS"
slouken@0
   843
            AC_MSG_RESULT($audio_arts)
slouken@0
   844
            if test x$audio_arts = xyes; then
slouken@294
   845
                AC_ARG_ENABLE(arts-shared,
slouken@1637
   846
AC_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [[default=yes]]]),
slouken@678
   847
                              , enable_arts_shared=yes)
slouken@3391
   848
                arts_lib=[`find_lib "libartsc.so.*" "$ARTS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@1467
   849
slouken@1467
   850
                AC_DEFINE(SDL_AUDIO_DRIVER_ARTS)
slouken@1467
   851
                SOURCES="$SOURCES $srcdir/src/audio/arts/*.c"
slouken@1521
   852
                EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS"
icculus@1173
   853
                if test x$have_loadso != xyes && \
slouken@296
   854
                   test x$enable_arts_shared = xyes; then
slouken@1467
   855
                    AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ARTS loading])
slouken@296
   856
                fi
icculus@1173
   857
                if test x$have_loadso = xyes && \
slouken@294
   858
                   test x$enable_arts_shared = xyes && test x$arts_lib != x; then
slouken@3392
   859
                    echo "-- dynamic libartsc -> $arts_lib"
slouken@1361
   860
                    AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ARTS_DYNAMIC, "$arts_lib")
slouken@1467
   861
                else
slouken@1521
   862
                    EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS"
slouken@294
   863
                fi
slouken@1361
   864
                have_audio=yes
slouken@0
   865
            fi
slouken@0
   866
        fi
slouken@0
   867
    fi
slouken@0
   868
}
slouken@0
   869
slouken@0
   870
dnl See if the NAS audio interface is supported
slouken@0
   871
CheckNAS()
slouken@0
   872
{
slouken@0
   873
    AC_ARG_ENABLE(nas,
slouken@1637
   874
AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]),
slouken@41
   875
                  , enable_nas=yes)
slouken@0
   876
    if test x$enable_audio = xyes -a x$enable_nas = xyes; then
icculus@2049
   877
        AC_CHECK_HEADER(audio/audiolib.h, have_nas_hdr=yes)
icculus@2049
   878
        AC_CHECK_LIB(audio, AuOpenServer, have_nas_lib=yes)
icculus@2049
   879
slouken@41
   880
        AC_MSG_CHECKING(for NAS audio support)
slouken@41
   881
        have_nas=no
icculus@2049
   882
icculus@2049
   883
        if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then
icculus@2049
   884
            have_nas=yes
icculus@2049
   885
            NAS_LIBS="-laudio"
icculus@2049
   886
icculus@2049
   887
        elif test -r /usr/X11R6/include/audio/audiolib.h; then
slouken@41
   888
            have_nas=yes
slouken@1361
   889
            NAS_CFLAGS="-I/usr/X11R6/include/"
slouken@1520
   890
            NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt"
slouken@605
   891
slouken@605
   892
        dnl On IRIX, the NAS includes are in a different directory,
slouken@605
   893
        dnl and libnas must be explicitly linked in
slouken@605
   894
slouken@605
   895
        elif test -r /usr/freeware/include/nas/audiolib.h; then
slouken@605
   896
            have_nas=yes
slouken@1361
   897
            NAS_LIBS="-lnas -lXt"
slouken@41
   898
        fi
icculus@2049
   899
slouken@605
   900
        AC_MSG_RESULT($have_nas)
icculus@2049
   901
slouken@1361
   902
        if test x$have_nas = xyes; then
icculus@2049
   903
            AC_ARG_ENABLE(nas-shared,
icculus@2049
   904
AC_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[default=yes]]]),
icculus@2049
   905
                          , enable_nas_shared=yes)
slouken@3391
   906
            nas_lib=[`find_lib "libaudio.so.*" "$NAS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
icculus@2049
   907
icculus@2049
   908
            if test x$have_loadso != xyes && \
icculus@2049
   909
               test x$enable_nas_shared = xyes; then
icculus@2049
   910
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic NAS loading])
icculus@2049
   911
            fi
icculus@2049
   912
            if test x$have_loadso = xyes && \
slouken@2163
   913
               test x$enable_nas_shared = xyes && test x$nas_lib != x; then
slouken@3392
   914
                echo "-- dynamic libaudio -> $nas_lib"
icculus@2049
   915
                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_NAS_DYNAMIC, "$nas_lib")
icculus@2049
   916
            else
icculus@2049
   917
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS"
icculus@2049
   918
            fi
icculus@2049
   919
slouken@1361
   920
            AC_DEFINE(SDL_AUDIO_DRIVER_NAS)
slouken@1361
   921
            SOURCES="$SOURCES $srcdir/src/audio/nas/*.c"
slouken@1521
   922
            EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS"
slouken@1361
   923
            have_audio=yes
slouken@1361
   924
        fi
slouken@0
   925
    fi
slouken@0
   926
}
slouken@0
   927
slouken@68
   928
dnl rcg07142001 See if the user wants the disk writer audio driver...
slouken@68
   929
CheckDiskAudio()
slouken@68
   930
{
slouken@68
   931
    AC_ARG_ENABLE(diskaudio,
slouken@1637
   932
AC_HELP_STRING([--enable-diskaudio], [support the disk writer audio driver [[default=yes]]]),
slouken@86
   933
                  , enable_diskaudio=yes)
slouken@68
   934
    if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
slouken@1361
   935
        AC_DEFINE(SDL_AUDIO_DRIVER_DISK)
slouken@1361
   936
        SOURCES="$SOURCES $srcdir/src/audio/disk/*.c"
slouken@68
   937
    fi
slouken@68
   938
}
slouken@68
   939
icculus@1532
   940
dnl rcg03142006 See if the user wants the dummy audio driver...
icculus@1532
   941
CheckDummyAudio()
icculus@1532
   942
{
icculus@1532
   943
    AC_ARG_ENABLE(dummyaudio,
slouken@1637
   944
AC_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [[default=yes]]]),
icculus@1532
   945
                  , enable_dummyaudio=yes)
icculus@1532
   946
    if test x$enable_audio = xyes -a x$enable_dummyaudio = xyes; then
icculus@1532
   947
        AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY)
icculus@1532
   948
        SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c"
icculus@1532
   949
    fi
icculus@1532
   950
}
icculus@1532
   951
icculus@1573
   952
dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
icculus@1573
   953
dnl  Details of this flag are here: http://gcc.gnu.org/wiki/Visibility
icculus@1573
   954
CheckVisibilityHidden()
icculus@1573
   955
{
icculus@1573
   956
    AC_MSG_CHECKING(for GCC -fvisibility=hidden option)
icculus@1573
   957
    have_gcc_fvisibility=no
icculus@1573
   958
icculus@1573
   959
    visibility_CFLAGS="-fvisibility=hidden"
icculus@1573
   960
    save_CFLAGS="$CFLAGS"
slouken@2292
   961
    CFLAGS="$save_CFLAGS $visibility_CFLAGS -Werror"
icculus@1573
   962
    AC_TRY_COMPILE([
slouken@1745
   963
    #if !defined(__GNUC__) || __GNUC__ < 4
slouken@1745
   964
    #error SDL only uses visibility attributes in GCC 4 or newer
slouken@1745
   965
    #endif
icculus@1573
   966
    ],[
icculus@1573
   967
    ],[
icculus@1573
   968
    have_gcc_fvisibility=yes
icculus@1573
   969
    ])
icculus@1573
   970
    AC_MSG_RESULT($have_gcc_fvisibility)
icculus@1573
   971
    CFLAGS="$save_CFLAGS"
icculus@1573
   972
icculus@1573
   973
    if test x$have_gcc_fvisibility = xyes; then
slouken@1574
   974
        EXTRA_CFLAGS="$EXTRA_CFLAGS $visibility_CFLAGS"
icculus@1573
   975
    fi
icculus@1573
   976
}
icculus@1573
   977
icculus@1573
   978
slouken@0
   979
dnl Find the X11 include and library directories
slouken@0
   980
CheckX11()
slouken@0
   981
{
slouken@0
   982
    AC_ARG_ENABLE(video-x11,
slouken@1637
   983
AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]),
slouken@0
   984
                  , enable_video_x11=yes)
slouken@0
   985
    if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
slouken@1806
   986
        case "$host" in
slouken@1807
   987
            *-*-darwin*)
slouken@1807
   988
                # This isn't necessary for X11, but fixes GLX detection
slouken@1808
   989
                if test "x$x_includes" = xNONE && test "x$x_libraries" = xNONE; then
slouken@1806
   990
                    x_includes="/usr/X11R6/include"
slouken@1806
   991
                    x_libraries="/usr/X11R6/lib"
slouken@1806
   992
                fi
slouken@1806
   993
                ;;
slouken@1806
   994
        esac
slouken@0
   995
        AC_PATH_X
slouken@0
   996
        AC_PATH_XTRA
slouken@0
   997
        if test x$have_x = xyes; then
slouken@1879
   998
            # Only allow dynamically loaded X11 if the X11 function pointers
slouken@1879
   999
            # will not end up in the global namespace, which causes problems
slouken@1879
  1000
            # with other libraries calling X11 functions.
slouken@1879
  1001
            x11_symbols_private=$have_gcc_fvisibility
slouken@1879
  1002
icculus@1168
  1003
            AC_ARG_ENABLE(x11-shared,
slouken@1879
  1004
AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=maybe]]]),
slouken@1879
  1005
                          , enable_x11_shared=maybe)
icculus@1168
  1006
slouken@1550
  1007
            case "$host" in
icculus@1589
  1008
                *-*-darwin*) # Latest Mac OS X actually ships with Xrandr/Xrender libs...
slouken@1879
  1009
                    x11_symbols_private=yes
icculus@1174
  1010
                    x11_lib='/usr/X11R6/lib/libX11.6.dylib'
icculus@1174
  1011
                    x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
slouken@1592
  1012
                    xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
icculus@1589
  1013
                    xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
icculus@2763
  1014
                    xinput_lib='/usr/X11R6/lib/libXi.6.dylib'
slouken@3025
  1015
                    xss_lib='/usr/X11R6/lib/libXss.6.dylib'
icculus@1174
  1016
                    ;;
slouken@1384
  1017
                *-*-osf*)
slouken@1384
  1018
                    x11_lib='libX11.so'
slouken@1384
  1019
                    x11ext_lib='libXext.so'
slouken@1384
  1020
                    ;;
slouken@1384
  1021
                *-*-irix*) # IRIX 6.5 requires that we use /usr/lib32
icculus@1299
  1022
                    x11_lib='libX11.so'
icculus@1299
  1023
                    x11ext_lib='libXext.so'
icculus@1299
  1024
                    ;;
icculus@1174
  1025
                *)
slouken@3391
  1026
                    x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@3391
  1027
                    x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@3391
  1028
                    xrender_lib=[`find_lib "libXrender.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@3391
  1029
                    xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@3391
  1030
                    xinput_lib=[`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@3391
  1031
                    xss_lib=[`find_lib "libXss.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
icculus@1174
  1032
                    ;;
icculus@1174
  1033
            esac
icculus@1168
  1034
slouken@1361
  1035
            if test x$ac_cv_func_shmat != xyes; then
slouken@1361
  1036
                X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY"
slouken@1361
  1037
            fi
slouken@1799
  1038
            CFLAGS="$CFLAGS $X_CFLAGS"
slouken@1799
  1039
            LDFLAGS="$LDFLAGS $X_LIBS"
slouken@1468
  1040
slouken@1468
  1041
            AC_DEFINE(SDL_VIDEO_DRIVER_X11)
slouken@1468
  1042
            SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
bob@2185
  1043
            SOURCES="$SOURCES $srcdir/src/video/Xext/XmuStdCmap/*.c"
slouken@1521
  1044
            EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
slouken@1879
  1045
slouken@1879
  1046
            if test x$enable_x11_shared = xmaybe; then
slouken@1879
  1047
                enable_x11_shared=$x11_symbols_private
slouken@1879
  1048
            fi
icculus@1173
  1049
            if test x$have_loadso != xyes && \
icculus@1168
  1050
               test x$enable_x11_shared = xyes; then
slouken@1467
  1051
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic X11 loading])
icculus@1875
  1052
                enable_x11_shared=no
icculus@1168
  1053
            fi
slouken@1879
  1054
            if test x$x11_symbols_private != xyes && \
icculus@1875
  1055
               test x$enable_x11_shared = xyes; then
icculus@1875
  1056
                AC_MSG_WARN([You must have gcc4 (-fvisibility=hidden) for dynamic X11 loading])
icculus@1875
  1057
                enable_x11_shared=no
icculus@1875
  1058
            fi
icculus@1875
  1059
icculus@1173
  1060
            if test x$have_loadso = xyes && \
icculus@1170
  1061
               test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then
icculus@1174
  1062
                echo "-- dynamic libX11 -> $x11_lib"
icculus@1174
  1063
                echo "-- dynamic libX11ext -> $x11ext_lib"
slouken@1361
  1064
                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib")
slouken@1361
  1065
                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib")
icculus@1168
  1066
            else
icculus@1589
  1067
                enable_x11_shared=no
icculus@2763
  1068
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
icculus@1168
  1069
            fi
slouken@1361
  1070
            have_video=yes
slouken@0
  1071
slouken@0
  1072
            AC_ARG_ENABLE(video-x11-vm,
slouken@1637
  1073
AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[default=yes]]]),
slouken@0
  1074
                          , enable_video_x11_vm=yes)
slouken@0
  1075
            if test x$enable_video_x11_vm = xyes; then
slouken@1361
  1076
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_VIDMODE)
slouken@1361
  1077
                SOURCES="$SOURCES $srcdir/src/video/Xext/Xxf86vm/*.c"
slouken@0
  1078
            fi
slouken@0
  1079
            AC_ARG_ENABLE(video-x11-xv,
slouken@1637
  1080
AC_HELP_STRING([--enable-video-x11-xv], [use X11 XvImage extension for video [[default=yes]]]),
slouken@0
  1081
                          , enable_video_x11_xv=yes)
slouken@0
  1082
            if test x$enable_video_x11_xv = xyes; then
slouken@1361
  1083
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XV)
slouken@1361
  1084
                SOURCES="$SOURCES $srcdir/src/video/Xext/Xv/*.c"
slouken@0
  1085
            fi
slouken@227
  1086
            AC_ARG_ENABLE(video-x11-xinerama,
slouken@1637
  1087
AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]),
slouken@227
  1088
                            , enable_video_x11_xinerama=yes)
slouken@227
  1089
            if test x$enable_video_x11_xinerama = xyes; then
slouken@1361
  1090
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA)
slouken@1361
  1091
                SOURCES="$SOURCES $srcdir/src/video/Xext/Xinerama/*.c"
slouken@227
  1092
            fi
icculus@1589
  1093
            AC_ARG_ENABLE(video-x11-xrandr,
slouken@1637
  1094
AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]),
icculus@1589
  1095
                            , enable_video_x11_xrandr=yes)
icculus@1589
  1096
            if test x$enable_video_x11_xrandr = xyes; then
icculus@1589
  1097
                definitely_enable_video_x11_xrandr=no
icculus@1589
  1098
                AC_CHECK_HEADER(X11/extensions/Xrandr.h,
icculus@1589
  1099
                                have_xrandr_h_hdr=yes,
icculus@1589
  1100
                                have_xrandr_h_hdr=no,
icculus@1589
  1101
                                [#include <X11/Xlib.h>
icculus@1589
  1102
                                ])
icculus@1589
  1103
                if test x$have_xrandr_h_hdr = xyes; then
icculus@1589
  1104
                    if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then
icculus@1589
  1105
                        echo "-- dynamic libXrender -> $xrender_lib"
icculus@1589
  1106
                        echo "-- dynamic libXrandr -> $xrandr_lib"
icculus@1589
  1107
                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER, "$xrender_lib")
icculus@1589
  1108
                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib")
icculus@1589
  1109
                        definitely_enable_video_x11_xrandr=yes
icculus@1589
  1110
                    else
icculus@1589
  1111
                        AC_CHECK_LIB(Xrender, XRenderQueryExtension, have_xrender_lib=yes)
icculus@1589
  1112
                        AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes)
icculus@1589
  1113
                        if test x$have_xrender_lib = xyes && test x$have_xrandr_lib = xyes ; then
icculus@1589
  1114
                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr -lXrender"
icculus@1589
  1115
                            definitely_enable_video_x11_xrandr=yes
icculus@1589
  1116
                        fi
icculus@1589
  1117
                    fi
icculus@1589
  1118
                fi
icculus@1589
  1119
            fi
icculus@1589
  1120
            if test x$definitely_enable_video_x11_xrandr = xyes; then
icculus@1589
  1121
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR)
icculus@1589
  1122
            fi
icculus@2763
  1123
            AC_ARG_ENABLE(video-x11-xinput,
icculus@2763
  1124
AC_HELP_STRING([--enable-video-x11-xinput], [enable X11 XInput extension for manymouse, tablets, etc [[default=yes]]]),
icculus@2763
  1125
                            , enable_video_x11_xinput=yes)
icculus@2763
  1126
            if test x$enable_video_x11_xinput = xyes; then
icculus@2763
  1127
                definitely_enable_video_x11_xinput=no
icculus@2763
  1128
                AC_CHECK_HEADER(X11/extensions/XInput.h,
icculus@2763
  1129
                                have_xinput_h_hdr=yes,
icculus@2763
  1130
                                have_xinput_h_hdr=no,
icculus@2763
  1131
                                [#include <X11/Xlib.h>
icculus@2763
  1132
                                ])
icculus@2763
  1133
                if test x$have_xinput_h_hdr = xyes; then
icculus@2763
  1134
                    if test x$enable_x11_shared = xyes && test x$xinput_lib != x ; then
icculus@2763
  1135
                        echo "-- dynamic libXi -> $xinput_lib"
icculus@2763
  1136
                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT, "$xinput_lib")
icculus@2763
  1137
                        definitely_enable_video_x11_xinput=yes
icculus@2763
  1138
                    else
icculus@2763
  1139
                        AC_CHECK_LIB(Xi, XOpenDevice, have_xinput_lib=yes)
icculus@2763
  1140
                        if test x$have_xinput_lib = xyes ; then
icculus@2763
  1141
                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXi"
icculus@2763
  1142
                            definitely_enable_video_x11_xinput=yes
icculus@2763
  1143
                        fi
icculus@2763
  1144
                    fi
icculus@2763
  1145
                fi
icculus@2763
  1146
            fi
icculus@2763
  1147
            if test x$definitely_enable_video_x11_xinput = xyes; then
icculus@2763
  1148
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT)
icculus@2763
  1149
            fi
slouken@3025
  1150
            AC_ARG_ENABLE(video-x11-scrnsaver,
slouken@3025
  1151
AC_HELP_STRING([--enable-video-x11-scrnsaver], [enable X11 screensaver extension [[default=yes]]]),
slouken@3025
  1152
                            , enable_video_x11_scrnsaver=yes)
slouken@3025
  1153
            if test x$enable_video_x11_scrnsaver = xyes; then
slouken@3025
  1154
                AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
slouken@3025
  1155
                                have_scrnsaver_h_hdr=yes,
slouken@3025
  1156
                                have_scrnsaver_h_hdr=no,
slouken@1783
  1157
                                [#include <X11/Xlib.h>
slouken@1783
  1158
                                ])
slouken@3025
  1159
                if test x$have_scrnsaver_h_hdr = xyes; then
slouken@3025
  1160
                    if test x$enable_x11_shared = xyes && test x$xss_lib != x ; then
slouken@3025
  1161
                        echo "-- dynamic libXss -> $xss_lib"
slouken@3025
  1162
                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS, "$xss_lib")
slouken@3025
  1163
                        definitely_enable_video_x11_scrnsaver=yes
slouken@3025
  1164
                    else
slouken@3025
  1165
                        AC_CHECK_LIB(Xss, XScreenSaverSuspend, have_xss_lib=yes)
slouken@3025
  1166
                        if test x$have_xss_lib = xyes ; then
slouken@3025
  1167
                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXss"
slouken@3025
  1168
                            definitely_enable_video_x11_scrnsaver=yes
slouken@3025
  1169
                        fi
slouken@3025
  1170
                    fi
slouken@1783
  1171
                fi
slouken@1783
  1172
            fi
slouken@3025
  1173
            if test x$definitely_enable_video_x11_scrnsaver = xyes; then
slouken@3025
  1174
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_SCRNSAVER)
slouken@3025
  1175
            fi
slouken@2810
  1176
slouken@2810
  1177
            AC_ARG_ENABLE(render-x11,
slouken@2810
  1178
AC_HELP_STRING([--enable-render-x11], [enable the X11 render driver [[default=yes]]]),
slouken@2810
  1179
                                , enable_render_x11=yes)
slouken@2810
  1180
            if test x$enable_render_x11 = xyes; then
slouken@2810
  1181
                AC_DEFINE(SDL_VIDEO_RENDER_X11)
slouken@2810
  1182
            fi
slouken@0
  1183
        fi
slouken@0
  1184
    fi
slouken@0
  1185
}
slouken@279
  1186
slouken@1361
  1187
dnl Check for QNX photon video driver
slouken@0
  1188
CheckPHOTON()
slouken@0
  1189
{
slouken@0
  1190
    AC_ARG_ENABLE(video-photon,
slouken@1637
  1191
AC_HELP_STRING([--enable-video-photon], [use QNX Photon video driver [[default=yes]]]),
slouken@0
  1192
                  , enable_video_photon=yes)
slouken@0
  1193
    if test x$enable_video = xyes -a x$enable_video_photon = xyes; then
slouken@0
  1194
        AC_MSG_CHECKING(for QNX Photon support)
slouken@0
  1195
        video_photon=no
slouken@0
  1196
        AC_TRY_COMPILE([
slouken@0
  1197
          #include <Ph.h>
slouken@0
  1198
          #include <Pt.h>
slouken@0
  1199
          #include <photon/Pg.h>
slouken@0
  1200
          #include <photon/PdDirect.h>
slouken@0
  1201
        ],[
slouken@0
  1202
         PgDisplaySettings_t *visual;
slouken@0
  1203
        ],[
slouken@0
  1204
        video_photon=yes
slouken@0
  1205
        ])
slouken@0
  1206
        AC_MSG_RESULT($video_photon)
slouken@0
  1207
        if test x$video_photon = xyes; then
slouken@1361
  1208
            AC_DEFINE(SDL_VIDEO_DRIVER_PHOTON)
slouken@1361
  1209
            SOURCES="$SOURCES $srcdir/src/video/photon/*.c"
lestat@3372
  1210
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lph -lphrender"
slouken@1361
  1211
            have_video=yes
slouken@1361
  1212
slouken@279
  1213
            CheckOpenGLQNX
slouken@0
  1214
        fi
slouken@0
  1215
    fi
slouken@0
  1216
}
slouken@0
  1217
slouken@3083
  1218
dnl Check for QNX photon video driver
slouken@3083
  1219
CheckQNXGF()
slouken@3083
  1220
{
slouken@3083
  1221
    AC_ARG_ENABLE(video-qnxgf,
slouken@3083
  1222
                  AC_HELP_STRING([--enable-video-qnxgf], [use QNX GF video driver [[default=yes]]]),
slouken@3083
  1223
                  , enable_video_qnxgf=yes)
slouken@3083
  1224
    if test x$enable_video = xyes -a x$enable_video_qnxgf = xyes; then
slouken@3083
  1225
        AC_MSG_CHECKING(for QNX GF support)
slouken@3083
  1226
        video_qnxgf=no
slouken@3083
  1227
        AC_TRY_COMPILE([
slouken@3083
  1228
          #include <gf/gf.h>
slouken@3083
  1229
          #include <gf/gf3d.h>
slouken@3083
  1230
        ],[
slouken@3083
  1231
         gf_3d_config_info_t* gfinfo;
slouken@3083
  1232
        ],[
slouken@3083
  1233
        video_qnxgf=yes
slouken@3083
  1234
        ])
slouken@3083
  1235
        AC_MSG_RESULT($video_qnxgf)
slouken@3083
  1236
        if test x$video_qnxgf = xyes; then
slouken@3083
  1237
            AC_DEFINE(SDL_VIDEO_DRIVER_QNXGF)
slouken@3083
  1238
            SOURCES="$SOURCES $srcdir/src/video/qnxgf/*.c"
slouken@3083
  1239
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lgf"
lestat@3113
  1240
lestat@3113
  1241
            # Add HIDDI library for HID support using GF
lestat@3113
  1242
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lhiddi"
lestat@3113
  1243
slouken@3083
  1244
            have_video=yes
slouken@3083
  1245
slouken@3083
  1246
            CheckOpenGLESQNX
slouken@3083
  1247
        fi
slouken@3083
  1248
    fi
slouken@3083
  1249
}
slouken@3083
  1250
slouken@1361
  1251
dnl Set up the BWindow video driver if enabled
slouken@1361
  1252
CheckBWINDOW()
slouken@1361
  1253
{
slouken@1361
  1254
    if test x$enable_video = xyes; then
slouken@1361
  1255
        AC_DEFINE(SDL_VIDEO_DRIVER_BWINDOW)
slouken@1361
  1256
        SOURCES="$SOURCES $srcdir/src/video/bwindow/*.cc"
slouken@1361
  1257
        have_video=yes
slouken@1361
  1258
    fi
slouken@1361
  1259
}
slouken@1361
  1260
slouken@1931
  1261
dnl Set up the Cocoa video driver for Mac OS X (but not Darwin)
slouken@1361
  1262
CheckCOCOA()
slouken@1361
  1263
{
slouken@1361
  1264
    AC_ARG_ENABLE(video-cocoa,
slouken@1931
  1265
AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]),
slouken@1361
  1266
                  , enable_video_cocoa=yes)
slouken@1361
  1267
    if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
slouken@1361
  1268
        save_CFLAGS="$CFLAGS"
slouken@1361
  1269
        dnl work around that we don't have Objective-C support in autoconf
slouken@1361
  1270
        CFLAGS="$CFLAGS -x objective-c"
slouken@1361
  1271
        AC_MSG_CHECKING(for Cocoa framework)
slouken@1361
  1272
        have_cocoa=no
slouken@1361
  1273
        AC_TRY_COMPILE([
slouken@1361
  1274
          #import <Cocoa/Cocoa.h>
slouken@1361
  1275
        ],[
slouken@1361
  1276
        ],[
slouken@1361
  1277
        have_cocoa=yes
slouken@1361
  1278
        ])
slouken@1361
  1279
        AC_MSG_RESULT($have_cocoa)
slouken@1361
  1280
        CFLAGS="$save_CFLAGS"
slouken@1361
  1281
        if test x$have_cocoa = xyes; then
slouken@1931
  1282
            AC_DEFINE(SDL_VIDEO_DRIVER_COCOA)
slouken@1931
  1283
            SOURCES="$SOURCES $srcdir/src/video/cocoa/*.m"
slouken@1361
  1284
            have_video=yes
slouken@1361
  1285
        fi
slouken@1361
  1286
    fi
slouken@1361
  1287
}
slouken@1361
  1288
slouken@0
  1289
dnl Find the framebuffer console includes
slouken@0
  1290
CheckFBCON()
slouken@0
  1291
{
slouken@0
  1292
    AC_ARG_ENABLE(video-fbcon,
slouken@2021
  1293
AC_HELP_STRING([--enable-video-fbcon], [use framebuffer console video driver [[default=no]]]),
slouken@2021
  1294
                  , enable_video_fbcon=no)
slouken@0
  1295
    if test x$enable_video = xyes -a x$enable_video_fbcon = xyes; then
slouken@0
  1296
        AC_MSG_CHECKING(for framebuffer console support)
slouken@0
  1297
        video_fbcon=no
slouken@0
  1298
        AC_TRY_COMPILE([
slouken@0
  1299
         #include <linux/fb.h>
slouken@0
  1300
         #include <linux/kd.h>
slouken@0
  1301
         #include <linux/keyboard.h>
slouken@0
  1302
        ],[
slouken@0
  1303
        ],[
slouken@0
  1304
        video_fbcon=yes
slouken@0
  1305
        ])
slouken@0
  1306
        AC_MSG_RESULT($video_fbcon)
slouken@0
  1307
        if test x$video_fbcon = xyes; then
icculus@2093
  1308
            AC_CHECK_FUNCS(getpagesize)
slouken@1361
  1309
            AC_DEFINE(SDL_VIDEO_DRIVER_FBCON)
slouken@1361
  1310
            SOURCES="$SOURCES $srcdir/src/video/fbcon/*.c"
slouken@1361
  1311
            have_video=yes
slouken@0
  1312
        fi
slouken@0
  1313
    fi
slouken@0
  1314
}
slouken@0
  1315
slouken@167
  1316
dnl Find DirectFB
slouken@167
  1317
CheckDirectFB()
slouken@167
  1318
{
slouken@167
  1319
    AC_ARG_ENABLE(video-directfb,
slouken@2314
  1320
AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=no]]]),
slouken@2314
  1321
                  , enable_video_directfb=no)
slouken@167
  1322
    if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
slouken@167
  1323
        video_directfb=no
slouken@167
  1324
slouken@2998
  1325
        DIRECTFB_REQUIRED_VERSION=1.0.0
slouken@1588
  1326
slouken@1602
  1327
        AC_PATH_PROG(DIRECTFBCONFIG, directfb-config, no)
slouken@1602
  1328
        if test x$DIRECTFBCONFIG = xno; then
slouken@1588
  1329
            AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
slouken@1602
  1330
            if test x$PKG_CONFIG != xno; then
slouken@1602
  1331
                if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb; then
slouken@1588
  1332
                    DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
slouken@1588
  1333
                    DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
slouken@2998
  1334
                    DIRECTFB_PREFIX=`$PKG_CONFIG --variable=prefix directfb`
slouken@1588
  1335
                    video_directfb=yes
slouken@1588
  1336
                fi
slouken@1588
  1337
            fi
slouken@167
  1338
        else
slouken@1588
  1339
            set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'`
slouken@1588
  1340
            NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
slouken@1588
  1341
            set -- `directfb-config --version | sed 's/\./ /g'`
slouken@1588
  1342
            HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
slouken@1588
  1343
            if test $HAVE_VERSION -ge $NEED_VERSION; then
slouken@1588
  1344
                DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags`
slouken@1588
  1345
                DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs`
slouken@2998
  1346
                DIRECTFB_PREFIX=`$DIRECTFBCONFIG --prefix`
slouken@167
  1347
                video_directfb=yes
slouken@167
  1348
            fi
slouken@167
  1349
        fi
slouken@3351
  1350
        if test x$video_directfb = xyes; then
slouken@3351
  1351
            # SuSE 11.1 installs directfb-config without directfb-devel
couriersud@3639
  1352
            save_CPPFLAGS="$CPPFLAGS"
couriersud@3639
  1353
            CPPFLAGS="$CPPFLAGS $DIRECTFB_CFLAGS"
slouken@3351
  1354
            AC_CHECK_HEADER(directfb.h, have_directfb_hdr=yes, have_directfb_hdr=no)
couriersud@3639
  1355
            CPPFLAGS="$save_CPPFLAGS"
slouken@3351
  1356
            video_directfb=$have_directfb_hdr
slouken@3351
  1357
        fi
slouken@3351
  1358
        AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support)
slouken@3351
  1359
        AC_MSG_RESULT($video_directfb)
slouken@167
  1360
slouken@167
  1361
        if test x$video_directfb = xyes; then
slouken@2998
  1362
            AC_ARG_ENABLE(directfb-shared,
slouken@2998
  1363
AC_HELP_STRING([--enable-directfb-shared], [dynamically load directfb support [[default=yes]]]),
slouken@2998
  1364
                              , enable_directfb_shared=yes)
slouken@2998
  1365
slouken@1361
  1366
            AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB)
slouken@1361
  1367
            SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
slouken@1521
  1368
            EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"
slouken@2998
  1369
slouken@3392
  1370
            AC_MSG_CHECKING(for directfb dynamic loading support)
slouken@3392
  1371
            directfb_shared=no
slouken@3392
  1372
            directfb_lib=[`find_lib "libdirectfb.so.*" "$DIRECTFB_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@2998
  1373
slouken@2998
  1374
            if test x$have_loadso != xyes && \
slouken@2998
  1375
               test x$enable_directfb_shared = xyes; then
slouken@2998
  1376
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic directfb loading])
slouken@2998
  1377
            fi
slouken@2998
  1378
            if test x$have_loadso = xyes && \
slouken@2998
  1379
               test x$enable_directfb_shared = xyes && test x$directfb_lib != x; then
slouken@3392
  1380
                directfb_shared=yes
slouken@3392
  1381
                echo "-- $directfb_lib_spec -> $directfb_lib"
slouken@2998
  1382
                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC, "$directfb_lib")
slouken@2998
  1383
            else
slouken@3392
  1384
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
slouken@2998
  1385
            fi
slouken@3392
  1386
            AC_MSG_RESULT($directfb_shared)
slouken@1361
  1387
            have_video=yes
slouken@167
  1388
        fi
slouken@167
  1389
    fi
slouken@167
  1390
}
slouken@167
  1391
slouken@2947
  1392
dnl Find FusionSound
slouken@2947
  1393
CheckFusionSound()
slouken@2947
  1394
{
slouken@2947
  1395
    AC_ARG_ENABLE(fusionsound,
slouken@2947
  1396
AC_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]),
slouken@2947
  1397
                  , enable_fusionsound=no)
slouken@2947
  1398
    if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then
slouken@2947
  1399
        fusionsound=no
slouken@2947
  1400
slouken@2947
  1401
        FUSIONSOUND_REQUIRED_VERSION=1.1.1
slouken@2947
  1402
slouken@2947
  1403
        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
slouken@2947
  1404
        AC_MSG_CHECKING(for FusionSound $FUSIONSOUND_REQUIRED_VERSION support)
slouken@2947
  1405
        if test x$PKG_CONFIG != xno; then
slouken@2947
  1406
            if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then
slouken@2947
  1407
                FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound`
slouken@2947
  1408
                FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound`
slouken@2947
  1409
                fusionsound=yes
slouken@2947
  1410
            fi
slouken@2947
  1411
        fi
slouken@2947
  1412
        AC_MSG_RESULT($fusionsound)
slouken@2947
  1413
slouken@2947
  1414
        if test x$fusionsound = xyes; then
slouken@2947
  1415
            AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND)
slouken@2947
  1416
            SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c"
slouken@2947
  1417
            EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS"
slouken@2947
  1418
            
slouken@2947
  1419
            AC_ARG_ENABLE(fusionsound-shared,
slouken@2947
  1420
AC_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]),
slouken@2947
  1421
                          , enable_fusionsound_shared=yes)
slouken@2947
  1422
            fusionsound_shared=no
slouken@3392
  1423
            AC_MSG_CHECKING(for FusionSound dynamic loading support)
slouken@2947
  1424
            if test x$have_loadso != xyes && \
slouken@2947
  1425
               test x$enable_fusionsound_shared = xyes; then
slouken@2947
  1426
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading])
slouken@2947
  1427
            fi
slouken@2947
  1428
            if test x$have_loadso = xyes && \
slouken@2947
  1429
               test x$enable_fusionsound_shared = xyes; then
slouken@2947
  1430
                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so")
slouken@3392
  1431
                fusionsound_shared=yes
slouken@2947
  1432
            else
slouken@3392
  1433
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS"
slouken@2947
  1434
            fi
slouken@3392
  1435
            AC_MSG_RESULT($fusionsound_shared)
slouken@2947
  1436
            
slouken@2947
  1437
            have_audio=yes
slouken@2947
  1438
        fi
slouken@2947
  1439
    fi
slouken@2947
  1440
}
slouken@2947
  1441
slouken@70
  1442
dnl See if we're running on PlayStation 2 hardware
slouken@70
  1443
CheckPS2GS()
slouken@70
  1444
{
slouken@72
  1445
    AC_ARG_ENABLE(video-ps2gs,
slouken@2793
  1446
AC_HELP_STRING([--enable-video-ps2gs], [use PlayStation 2 GS video driver [[default=no]]]),
slouken@2793
  1447
                  , enable_video_ps2gs=no)
slouken@70
  1448
    if test x$enable_video = xyes -a x$enable_video_ps2gs = xyes; then
slouken@72
  1449
        AC_MSG_CHECKING(for PlayStation 2 GS support)
slouken@70
  1450
        video_ps2gs=no
slouken@70
  1451
        AC_TRY_COMPILE([
slouken@70
  1452
         #include <linux/ps2/dev.h>
slouken@70
  1453
         #include <linux/ps2/gs.h>
slouken@70
  1454
        ],[
slouken@70
  1455
        ],[
slouken@70
  1456
        video_ps2gs=yes
slouken@70
  1457
        ])
slouken@72
  1458
        AC_MSG_RESULT($video_ps2gs)
slouken@70
  1459
        if test x$video_ps2gs = xyes; then
slouken@1361
  1460
            AC_DEFINE(SDL_VIDEO_DRIVER_PS2GS)
slouken@1361
  1461
            SOURCES="$SOURCES $srcdir/src/video/ps2gs/*.c"
slouken@1361
  1462
            have_video=yes
slouken@70
  1463
        fi
slouken@70
  1464
    fi
slouken@70
  1465
}
slouken@70
  1466
slouken@3257
  1467
dnl See if we're running on PlayStation 3 Cell hardware
slouken@3257
  1468
CheckPS3()
slouken@3257
  1469
{
slouken@3257
  1470
  AC_ARG_ENABLE(video-ps3,
slouken@3257
  1471
                AC_HELP_STRING([--enable-video-ps3], [use PlayStation 3 Cell driver [[default=yes]]]),
slouken@3257
  1472
                , enable_video_ps3=yes)
slouken@3257
  1473
  if test x$enable_video = xyes -a x$enable_video_ps3 = xyes; then 
slouken@3257
  1474
    video_ps3=no
slouken@3257
  1475
    AC_CHECK_HEADER([linux/fb.h])
slouken@3257
  1476
    AC_CHECK_HEADER([asm/ps3fb.h], [have_ps3fb_hdr=yes], [],
slouken@3392
  1477
            [#ifndef _LINUX_TYPES_H
slouken@3392
  1478
                #include <linux/types.h>
slouken@3392
  1479
            #endif])
slouken@3257
  1480
    AC_CHECK_HEADER([libspe2.h], have_libspe2_hdr=yes)
slouken@3257
  1481
    AC_CHECK_LIB([spe2], spe_context_create, have_spe2_lib=yes)
slouken@3257
  1482
slouken@3257
  1483
    AC_CHECK_PROGS(SPU_GCC, [spu-gcc])
slouken@3257
  1484
    AC_CHECK_PROGS(EMBEDSPU, [embedspu])
slouken@3257
  1485
slouken@3257
  1486
    have_spu_libs=yes
slouken@3257
  1487
    AC_CHECK_LIB([fb_writer_spu], [main], [], [have_spu_libs=no])
slouken@3257
  1488
    AC_CHECK_LIB([yuv2rgb_spu], [main], [], [have_spu_libs=no])
slouken@3257
  1489
    AC_CHECK_LIB([bilin_scaler_spu], [main], [], [have_spu_libs=no])
slouken@3257
  1490
    if test x$have_ps3fb_hdr = xyes -a x$have_libspe2_hdr = xyes -a x$have_spe2_lib = xyes -a "$SPU_GCC" -a "$EMBEDSPU"; then
slouken@3257
  1491
        AC_DEFINE(SDL_VIDEO_DRIVER_PS3)
slouken@3257
  1492
        video_ps3=yes
slouken@3257
  1493
        have_video=yes
slouken@3257
  1494
        SOURCES="$SOURCES $srcdir/src/video/ps3/*.c"
slouken@3257
  1495
        EXTRA_CFLAGS="$EXTRA_CFLAGS -I/opt/cell/sdk/usr/include"
slouken@3257
  1496
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L/opt/cell/sdk/usr/lib -lspe2 -lfb_writer_spu -lyuv2rgb_spu -lbilin_scaler_spu"
slouken@3257
  1497
slouken@3257
  1498
        if test x$have_spu_libs = xno; then 
slouken@3257
  1499
              AC_MSG_WARN([ps3libs missing, please run make ps3libs])
slouken@3257
  1500
        fi
slouken@3257
  1501
    fi
slouken@3257
  1502
    AC_MSG_CHECKING([for PlayStation 3 Cell support])
slouken@3257
  1503
    AC_MSG_RESULT([$video_ps3])
slouken@3257
  1504
  fi
slouken@3257
  1505
}
slouken@3257
  1506
slouken@0
  1507
dnl Find the SVGAlib includes and libraries
slouken@0
  1508
CheckSVGA()
slouken@0
  1509
{
slouken@0
  1510
    AC_ARG_ENABLE(video-svga,
slouken@2793
  1511
AC_HELP_STRING([--enable-video-svga], [use SVGAlib video driver [[default=no]]]),
slouken@2793
  1512
                  , enable_video_svga=no)
slouken@0
  1513
    if test x$enable_video = xyes -a x$enable_video_svga = xyes; then
slouken@0
  1514
        AC_MSG_CHECKING(for SVGAlib (1.4.0+) support)
slouken@0
  1515
        video_svga=no
slouken@0
  1516
        AC_TRY_COMPILE([
slouken@0
  1517
         #include <vga.h>
slouken@0
  1518
         #include <vgamouse.h>
slouken@0
  1519
         #include <vgakeyboard.h>
slouken@0
  1520
        ],[
slouken@0
  1521
         if ( SCANCODE_RIGHTWIN && SCANCODE_LEFTWIN ) {
slouken@0
  1522
             exit(0);
slouken@0
  1523
         }
slouken@0
  1524
        ],[
slouken@0
  1525
        video_svga=yes
slouken@0
  1526
        ])
slouken@0
  1527
        AC_MSG_RESULT($video_svga)
slouken@0
  1528
        if test x$video_svga = xyes; then
slouken@1361
  1529
            AC_DEFINE(SDL_VIDEO_DRIVER_SVGALIB)
slouken@1361
  1530
            SOURCES="$SOURCES $srcdir/src/video/svga/*.c"
slouken@1556
  1531
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvga"
slouken@1361
  1532
            have_video=yes
slouken@0
  1533
        fi
slouken@0
  1534
    fi
slouken@0
  1535
}
slouken@0
  1536
slouken@1
  1537
dnl rcg04172001 Set up the Null video driver.
slouken@1
  1538
CheckDummyVideo()
slouken@1
  1539
{
slouken@1
  1540
    AC_ARG_ENABLE(video-dummy,
slouken@1637
  1541
AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]),
slouken@86
  1542
                  , enable_video_dummy=yes)
slouken@1
  1543
    if test x$enable_video_dummy = xyes; then
slouken@1361
  1544
        AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY)
slouken@1361
  1545
        SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
slouken@1361
  1546
        have_video=yes
slouken@1
  1547
    fi
slouken@1
  1548
}
slouken@1
  1549
slouken@0
  1550
dnl Check to see if OpenGL support is desired
slouken@0
  1551
AC_ARG_ENABLE(video-opengl,
slouken@1952
  1552
AC_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]),
slouken@0
  1553
              , enable_video_opengl=yes)
slouken@0
  1554
slouken@0
  1555
dnl Find OpenGL
icculus@1191
  1556
CheckOpenGLX11()
slouken@0
  1557
{
slouken@0
  1558
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@0
  1559
        AC_MSG_CHECKING(for OpenGL (GLX) support)
slouken@0
  1560
        video_opengl=no
slouken@0
  1561
        AC_TRY_COMPILE([
slouken@0
  1562
         #include <GL/gl.h>
slouken@0
  1563
         #include <GL/glx.h>
icculus@2125
  1564
         #include <GL/glu.h>
slouken@0
  1565
        ],[
slouken@0
  1566
        ],[
slouken@0
  1567
        video_opengl=yes
slouken@0
  1568
        ])
slouken@0
  1569
        AC_MSG_RESULT($video_opengl)
slouken@0
  1570
        if test x$video_opengl = xyes; then
slouken@1361
  1571
            AC_DEFINE(SDL_VIDEO_OPENGL)
slouken@1361
  1572
            AC_DEFINE(SDL_VIDEO_OPENGL_GLX)
slouken@1952
  1573
            AC_DEFINE(SDL_VIDEO_RENDER_OGL)
slouken@0
  1574
        fi
slouken@0
  1575
    fi
slouken@0
  1576
}
slouken@0
  1577
slouken@3083
  1578
dnl Find QNX 6.x Software OpenGL
slouken@279
  1579
CheckOpenGLQNX()
slouken@279
  1580
{
slouken@279
  1581
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@3083
  1582
        AC_MSG_CHECKING(for QNX 6.x Photon OpenGL support)
slouken@279
  1583
        video_opengl=no
slouken@279
  1584
        AC_TRY_COMPILE([
slouken@279
  1585
         #include <GL/gl.h>
slouken@279
  1586
        ],[
slouken@279
  1587
        ],[
slouken@279
  1588
        video_opengl=yes
slouken@279
  1589
        ])
slouken@279
  1590
        AC_MSG_RESULT($video_opengl)
slouken@279
  1591
        if test x$video_opengl = xyes; then
slouken@1361
  1592
            AC_DEFINE(SDL_VIDEO_OPENGL)
slouken@1952
  1593
            AC_DEFINE(SDL_VIDEO_RENDER_OGL)
slouken@1521
  1594
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
slouken@279
  1595
        fi
slouken@279
  1596
    fi
slouken@279
  1597
}
slouken@279
  1598
slouken@3083
  1599
dnl Find QNX 6.3 and above OpenGL ES implementation
slouken@3083
  1600
CheckOpenGLESQNX()
slouken@3083
  1601
{
slouken@3083
  1602
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@3083
  1603
        AC_MSG_CHECKING(for QNX OpenGL ES (CM) support)
slouken@3083
  1604
        video_opengl=no
slouken@3083
  1605
        AC_TRY_COMPILE([
slouken@3083
  1606
         #include <GLES/egl.h>
slouken@3083
  1607
        ],[
slouken@3083
  1608
        ],[
slouken@3083
  1609
        video_opengl=yes
slouken@3083
  1610
        ])
slouken@3083
  1611
        AC_MSG_RESULT($video_opengl)
slouken@3083
  1612
        if test x$video_opengl = xyes; then
slouken@3083
  1613
            AC_DEFINE(SDL_VIDEO_OPENGL_ES)
slouken@3099
  1614
            AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES)
slouken@3083
  1615
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGLES_CM"
slouken@3083
  1616
        else
slouken@3083
  1617
            AC_MSG_CHECKING(for QNX OpenGL ES (CL) support)
slouken@3083
  1618
            video_opengl=no
slouken@3083
  1619
            AC_TRY_COMPILE([
slouken@3087
  1620
             #define COMMON_LITE
slouken@3083
  1621
             #include <GLES/egl.h>
slouken@3083
  1622
            ],[
slouken@3083
  1623
            ],[
slouken@3083
  1624
            video_opengl=yes
slouken@3083
  1625
            ])
slouken@3083
  1626
            AC_MSG_RESULT($video_opengl)
slouken@3083
  1627
            if test x$video_opengl = xyes; then
slouken@3083
  1628
                AC_DEFINE(SDL_VIDEO_OPENGL_ES)
slouken@3099
  1629
                AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES)
slouken@3099
  1630
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGLES_CLS"
slouken@3083
  1631
            fi
slouken@3083
  1632
        fi
slouken@3083
  1633
    fi
slouken@3083
  1634
}
slouken@3083
  1635
slouken@3083
  1636
slouken@1361
  1637
dnl Check for Win32 OpenGL
slouken@1361
  1638
CheckWIN32GL()
slouken@1361
  1639
{
slouken@1361
  1640
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@1361
  1641
        AC_DEFINE(SDL_VIDEO_OPENGL)
slouken@1361
  1642
        AC_DEFINE(SDL_VIDEO_OPENGL_WGL)
slouken@1952
  1643
        AC_DEFINE(SDL_VIDEO_RENDER_OGL)
slouken@1361
  1644
    fi
slouken@1361
  1645
}
slouken@1361
  1646
slouken@0
  1647
dnl Check for BeOS OpenGL
slouken@0
  1648
CheckBeGL()
slouken@0
  1649
{
slouken@0
  1650
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@1361
  1651
        AC_DEFINE(SDL_VIDEO_OPENGL)
slouken@1952
  1652
        AC_DEFINE(SDL_VIDEO_OPENGL_BGL)
slouken@1952
  1653
        AC_DEFINE(SDL_VIDEO_RENDER_OGL)
slouken@1521
  1654
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
slouken@0
  1655
    fi
slouken@0
  1656
}
slouken@0
  1657
slouken@0
  1658
dnl Check for MacOS OpenGL
slouken@0
  1659
CheckMacGL()
slouken@0
  1660
{
slouken@0
  1661
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@1361
  1662
        AC_DEFINE(SDL_VIDEO_OPENGL)
slouken@1952
  1663
        AC_DEFINE(SDL_VIDEO_OPENGL_CGL)
slouken@1952
  1664
        AC_DEFINE(SDL_VIDEO_RENDER_OGL)
slouken@1550
  1665
        case "$host" in
slouken@0
  1666
            *-*-darwin*)
slouken@1625
  1667
                if test x$enable_video_cocoa = xyes; then
icculus@3623
  1668
                    EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGL"
slouken@1625
  1669
                fi
slouken@0
  1670
        esac
slouken@0
  1671
    fi
slouken@0
  1672
}
slouken@0
  1673
slouken@0
  1674
dnl See if we can use the new unified event interface in Linux 2.4
slouken@0
  1675
CheckInputEvents()
slouken@0
  1676
{
slouken@0
  1677
    dnl Check for Linux 2.4 unified input event interface support
slouken@0
  1678
    AC_ARG_ENABLE(input-events,
slouken@1637
  1679
AC_HELP_STRING([--enable-input-events], [use Linux 2.4 unified input interface [[default=yes]]]),
slouken@211
  1680
                  , enable_input_events=yes)
slouken@0
  1681
    if test x$enable_input_events = xyes; then
slouken@0
  1682
        AC_MSG_CHECKING(for Linux 2.4 unified input interface)
slouken@0
  1683
        use_input_events=no
slouken@0
  1684
        AC_TRY_COMPILE([
slouken@0
  1685
          #include <linux/input.h>
slouken@0
  1686
        ],[
slouken@0
  1687
          #ifndef EVIOCGNAME
slouken@0
  1688
          #error EVIOCGNAME() ioctl not available
slouken@0
  1689
          #endif
slouken@0
  1690
        ],[
slouken@0
  1691
        use_input_events=yes
slouken@0
  1692
        ])
slouken@0
  1693
        AC_MSG_RESULT($use_input_events)
slouken@0
  1694
        if test x$use_input_events = xyes; then
slouken@1361
  1695
            AC_DEFINE(SDL_INPUT_LINUXEV)
slouken@0
  1696
        fi
slouken@0
  1697
    fi
slouken@0
  1698
}
slouken@0
  1699
icculus@1201
  1700
dnl See if we can use the Touchscreen input library
icculus@1201
  1701
CheckTslib()
icculus@1201
  1702
{
icculus@1201
  1703
    AC_ARG_ENABLE(input-tslib,
slouken@1637
  1704
AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]),
icculus@1201
  1705
                  , enable_input_tslib=yes)
icculus@1201
  1706
    if test x$enable_input_tslib = xyes; then
icculus@1201
  1707
        AC_MSG_CHECKING(for Touchscreen library support)
icculus@1201
  1708
        enable_input_tslib=no
icculus@1201
  1709
        AC_TRY_COMPILE([
icculus@1201
  1710
          #include "tslib.h"
icculus@1201
  1711
        ],[
icculus@1201
  1712
        ],[
icculus@1201
  1713
        enable_input_tslib=yes
icculus@1201
  1714
        ])
icculus@1201
  1715
        AC_MSG_RESULT($enable_input_tslib)
icculus@1201
  1716
        if test x$enable_input_tslib = xyes; then
slouken@1361
  1717
            AC_DEFINE(SDL_INPUT_TSLIB)
slouken@1521
  1718
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
icculus@1201
  1719
        fi
icculus@1201
  1720
    fi
icculus@1201
  1721
}
icculus@1201
  1722
slouken@399
  1723
dnl See if we can use GNU pth library for threads
slouken@399
  1724
CheckPTH()
slouken@399
  1725
{
slouken@399
  1726
    dnl Check for pth support
slouken@399
  1727
    AC_ARG_ENABLE(pth,
slouken@1637
  1728
AC_HELP_STRING([--enable-pth], [use GNU pth library for multi-threading [[default=yes]]]),
slouken@399
  1729
                  , enable_pth=yes)
slouken@399
  1730
    if test x$enable_threads = xyes -a x$enable_pth = xyes; then
slouken@399
  1731
        AC_PATH_PROG(PTH_CONFIG, pth-config, no)
slouken@399
  1732
        if test "$PTH_CONFIG" = "no"; then
slouken@399
  1733
            use_pth=no
slouken@399
  1734
        else
slouken@399
  1735
            use_pth=yes
slouken@399
  1736
        fi
slouken@399
  1737
        AC_MSG_CHECKING(pth)
slouken@1361
  1738
        AC_MSG_RESULT($use_pth)
slouken@399
  1739
        if test "x$use_pth" = xyes; then
slouken@1361
  1740
            AC_DEFINE(SDL_THREAD_PTH)
slouken@1361
  1741
            SOURCES="$SOURCES $srcdir/src/thread/pth/*.c"
slouken@1361
  1742
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
slouken@1361
  1743
            SDL_CFLAGS="$SDL_CFLAGS `$PTH_CONFIG --cflags`"
slouken@1361
  1744
            SDL_LIBS="$SDL_LIBS `$PTH_CONFIG --libs --all`"
slouken@1361
  1745
            have_threads=yes
slouken@399
  1746
        fi
slouken@399
  1747
    fi
slouken@399
  1748
}
slouken@399
  1749
slouken@0
  1750
dnl See what type of thread model to use on Linux and Solaris
slouken@0
  1751
CheckPTHREAD()
slouken@0
  1752
{
slouken@0
  1753
    dnl Check for pthread support
slouken@0
  1754
    AC_ARG_ENABLE(pthreads,
slouken@1637
  1755
AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]),
slouken@0
  1756
                  , enable_pthreads=yes)
slouken@0
  1757
    dnl This is used on Linux for glibc binary compatibility (Doh!)
slouken@0
  1758
    AC_ARG_ENABLE(pthread-sem,
slouken@1637
  1759
AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
slouken@0
  1760
                  , enable_pthread_sem=yes)
slouken@1550
  1761
    case "$host" in
slouken@1820
  1762
        *-*-linux*|*-*-uclinux*)
slouken@1361
  1763
            pthread_cflags="-D_REENTRANT"
slouken@1324
  1764
            pthread_lib="-lpthread"
slouken@1324
  1765
            ;;
slouken@0
  1766
        *-*-bsdi*)
slouken@0
  1767
            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
slouken@0
  1768
            pthread_lib=""
slouken@0
  1769
            ;;
slouken@0
  1770
        *-*-darwin*)
slouken@0
  1771
            pthread_cflags="-D_THREAD_SAFE"
slouken@0
  1772
# causes Carbon.p complaints?
slouken@0
  1773
#            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
slouken@0
  1774
            ;;
slouken@1565
  1775
        *-*-freebsd*|*-*-dragonfly*)
slouken@0
  1776
            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
slouken@0
  1777
            pthread_lib="-pthread"
slouken@0
  1778
            ;;
slouken@43
  1779
        *-*-netbsd*)
slouken@1383
  1780
            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
slouken@2158
  1781
            pthread_lib="-lpthread"
slouken@43
  1782
            ;;
slouken@0
  1783
        *-*-openbsd*)
slouken@0
  1784
            pthread_cflags="-D_REENTRANT"
slouken@0
  1785
            pthread_lib="-pthread"
slouken@0
  1786
            ;;
slouken@0
  1787
        *-*-solaris*)
slouken@0
  1788
            pthread_cflags="-D_REENTRANT"
slouken@0
  1789
            pthread_lib="-lpthread -lposix4"
slouken@0
  1790
            ;;
slouken@0
  1791
        *-*-sysv5*)
slouken@0
  1792
            pthread_cflags="-D_REENTRANT -Kthread"
slouken@0
  1793
            pthread_lib=""
slouken@0
  1794
            ;;
slouken@0
  1795
        *-*-irix*)
slouken@0
  1796
            pthread_cflags="-D_SGI_MP_SOURCE"
slouken@0
  1797
            pthread_lib="-lpthread"
slouken@0
  1798
            ;;
slouken@0
  1799
        *-*-aix*)
slouken@0
  1800
            pthread_cflags="-D_REENTRANT -mthreads"
slouken@0
  1801
            pthread_lib="-lpthread"
slouken@0
  1802
            ;;
icculus@425
  1803
        *-*-hpux11*)
icculus@425
  1804
            pthread_cflags="-D_REENTRANT"
icculus@425
  1805
            pthread_lib="-L/usr/lib -lpthread"
icculus@425
  1806
            ;;
slouken@0
  1807
        *-*-qnx*)
slouken@0
  1808
            pthread_cflags=""
slouken@0
  1809
            pthread_lib=""
slouken@0
  1810
            ;;
slouken@873
  1811
        *-*-osf*)
slouken@1019
  1812
            pthread_cflags="-D_REENTRANT"
slouken@873
  1813
            if test x$ac_cv_prog_gcc = xyes; then
slouken@873
  1814
                pthread_lib="-lpthread -lrt"
slouken@873
  1815
            else
slouken@1019
  1816
                pthread_lib="-lpthread -lexc -lrt"
slouken@873
  1817
            fi
slouken@873
  1818
            ;;
slouken@0
  1819
        *)
slouken@0
  1820
            pthread_cflags="-D_REENTRANT"
slouken@0
  1821
            pthread_lib="-lpthread"
slouken@0
  1822
            ;;
slouken@0
  1823
    esac
slouken@3268
  1824
    if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
slouken@415
  1825
        # Save the original compiler flags and libraries
slouken@415
  1826
        ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
slouken@415
  1827
        # Add the pthread compiler flags and libraries
slouken@415
  1828
        CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
slouken@415
  1829
        # Check to see if we have pthread support on this system
slouken@0
  1830
        AC_MSG_CHECKING(for pthreads)
slouken@0
  1831
        use_pthreads=no
slouken@0
  1832
        AC_TRY_LINK([
slouken@0
  1833
         #include <pthread.h>
slouken@0
  1834
        ],[
slouken@0
  1835
         pthread_attr_t type;
slouken@0
  1836
         pthread_attr_init(&type);
slouken@0
  1837
        ],[
slouken@0
  1838
        use_pthreads=yes
slouken@0
  1839
        ])
slouken@0
  1840
        AC_MSG_RESULT($use_pthreads)
slouken@415
  1841
        # Restore the compiler flags and libraries
slouken@415
  1842
        CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
slouken@1361
  1843
slouken@415
  1844
        # Do futher testing if we have pthread support...
slouken@0
  1845
        if test x$use_pthreads = xyes; then
slouken@1361
  1846
            AC_DEFINE(SDL_THREAD_PTHREAD)
slouken@1521
  1847
            EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
slouken@1521
  1848
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
slouken@0
  1849
            SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
slouken@0
  1850
            SDL_LIBS="$SDL_LIBS $pthread_lib"
slouken@0
  1851
slouken@1438
  1852
            # Save the original compiler flags and libraries
slouken@1438
  1853
            ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
slouken@1438
  1854
            # Add the pthread compiler flags and libraries
slouken@1438
  1855
            CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
slouken@1438
  1856
slouken@0
  1857
            # Check to see if recursive mutexes are available
slouken@0
  1858
            AC_MSG_CHECKING(for recursive mutexes)
slouken@0
  1859
            has_recursive_mutexes=no
slouken@1324
  1860
            if test x$has_recursive_mutexes = xno; then
slouken@1324
  1861
                AC_TRY_COMPILE([
slouken@1324
  1862
                  #include <pthread.h>
slouken@1324
  1863
                ],[
slouken@1324
  1864
                  pthread_mutexattr_t attr;
slouken@1324
  1865
                  pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
slouken@1324
  1866
                ],[
slouken@1324
  1867
                has_recursive_mutexes=yes
slouken@1361
  1868
                AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX)
slouken@1324
  1869
                ])
slouken@1324
  1870
            fi
slouken@1324
  1871
            if test x$has_recursive_mutexes = xno; then
slouken@1324
  1872
                AC_TRY_COMPILE([
slouken@1324
  1873
                  #include <pthread.h>
slouken@1324
  1874
                ],[
slouken@1324
  1875
                  pthread_mutexattr_t attr;
slouken@1324
  1876
                  pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
slouken@1324
  1877
                ],[
slouken@1324
  1878
                has_recursive_mutexes=yes
slouken@1361
  1879
                AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP)
slouken@1324
  1880
                ])
slouken@1324
  1881
            fi
slouken@0
  1882
            AC_MSG_RESULT($has_recursive_mutexes)
slouken@0
  1883
slouken@94
  1884
            # Check to see if pthread semaphore support is missing
slouken@94
  1885
            if test x$enable_pthread_sem = xyes; then
slouken@94
  1886
                AC_MSG_CHECKING(for pthread semaphores)
slouken@94
  1887
                have_pthread_sem=no
slouken@94
  1888
                AC_TRY_COMPILE([
slouken@94
  1889
                  #include <pthread.h>
slouken@94
  1890
                  #include <semaphore.h>
slouken@94
  1891
                ],[
slouken@94
  1892
                ],[
slouken@94
  1893
                have_pthread_sem=yes
slouken@94
  1894
                ])
slouken@94
  1895
                AC_MSG_RESULT($have_pthread_sem)
slouken@94
  1896
            fi
slouken@94
  1897
slouken@1438
  1898
            # Restore the compiler flags and libraries
slouken@1438
  1899
            CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
slouken@1438
  1900
slouken@1361
  1901
            # Basic thread creation functions
slouken@1361
  1902
            SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
slouken@0
  1903
slouken@1361
  1904
            # Semaphores
slouken@1361
  1905
            # We can fake these with mutexes and condition variables if necessary
slouken@1361
  1906
            if test x$have_pthread_sem = xyes; then
slouken@1361
  1907
                SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
slouken@1361
  1908
            else
slouken@1361
  1909
                SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
slouken@1361
  1910
            fi
slouken@0
  1911
slouken@1361
  1912
            # Mutexes
slouken@1361
  1913
            # We can fake these with semaphores if necessary
slouken@1361
  1914
            SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
slouken@0
  1915
slouken@1361
  1916
            # Condition variables
slouken@1361
  1917
            # We can fake these with semaphores and mutexes if necessary
slouken@1361
  1918
            SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
slouken@399
  1919
slouken@1361
  1920
            have_threads=yes
slouken@185
  1921
        else
slouken@1361
  1922
            CheckPTH
slouken@814
  1923
        fi
slouken@814
  1924
    fi
slouken@814
  1925
}
slouken@814
  1926
slouken@0
  1927
dnl Determine whether the compiler can produce Win32 executables
slouken@0
  1928
CheckWIN32()
slouken@0
  1929
{
slouken@0
  1930
    AC_MSG_CHECKING(Win32 compiler)
slouken@0
  1931
    have_win32_gcc=no
slouken@0
  1932
    AC_TRY_COMPILE([
slouken@0
  1933
     #include <windows.h>
slouken@0
  1934
    ],[
slouken@0
  1935
    ],[
slouken@0
  1936
    have_win32_gcc=yes
slouken@0
  1937
    ])
slouken@0
  1938
    AC_MSG_RESULT($have_win32_gcc)
slouken@0
  1939
    if test x$have_win32_gcc != xyes; then
slouken@0
  1940
       AC_MSG_ERROR([
slouken@0
  1941
*** Your compiler ($CC) does not produce Win32 executables!
slouken@0
  1942
       ])
slouken@0
  1943
    fi
slouken@0
  1944
slouken@3168
  1945
    AC_MSG_CHECKING(Windows CE)
slouken@3168
  1946
    have_wince=no
slouken@3168
  1947
    AC_TRY_COMPILE([
slouken@3168
  1948
#ifndef _WIN32_WCE
slouken@3168
  1949
#error This is not Windows CE
slouken@3168
  1950
#endif
slouken@3168
  1951
    ],[
slouken@3168
  1952
    ],[
slouken@3168
  1953
    have_wince=yes
slouken@3168
  1954
    ])
slouken@3168
  1955
    AC_MSG_RESULT($have_wince)
slouken@3168
  1956
slouken@0
  1957
    dnl See if the user wants to redirect standard output to files
slouken@0
  1958
    AC_ARG_ENABLE(stdio-redirect,
slouken@1637
  1959
AC_HELP_STRING([--enable-stdio-redirect], [Redirect STDIO to files on Win32 [[default=yes]]]),
slouken@0
  1960
                  , enable_stdio_redirect=yes)
slouken@0
  1961
    if test x$enable_stdio_redirect != xyes; then
slouken@1521
  1962
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DNO_STDIO_REDIRECT"
slouken@1361
  1963
    fi
slouken@0
  1964
}
slouken@0
  1965
slouken@0
  1966
dnl Find the DirectX includes and libraries
slouken@0
  1967
CheckDIRECTX()
slouken@0
  1968
{
slouken@0
  1969
    AC_ARG_ENABLE(directx,
slouken@1637
  1970
AC_HELP_STRING([--enable-directx], [use DirectX for Win32 audio/video [[default=yes]]]),
slouken@0
  1971
                  , enable_directx=yes)
slouken@0
  1972
    if test x$enable_directx = xyes; then
slouken@1895
  1973
        AC_CHECK_HEADER(d3d9.h, have_d3d=yes)
slouken@3168
  1974
        AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
slouken@1361
  1975
        AC_CHECK_HEADER(dsound.h, have_dsound=yes)
slouken@2714
  1976
        AC_CHECK_HEADER(dinput.h, have_dinput=yes)
slouken@0
  1977
    fi
slouken@158
  1978
}
slouken@158
  1979
slouken@294
  1980
dnl Check for the dlfcn.h interface for dynamically loading objects
slouken@294
  1981
CheckDLOPEN()
slouken@294
  1982
{
slouken@731
  1983
    AC_ARG_ENABLE(sdl-dlopen,
slouken@1637
  1984
AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]),
slouken@731
  1985
                  , enable_sdl_dlopen=yes)
slouken@731
  1986
    if test x$enable_sdl_dlopen = xyes; then
slouken@294
  1987
        AC_MSG_CHECKING(for dlopen)
slouken@1361
  1988
        have_dlopen=no
slouken@294
  1989
        AC_TRY_COMPILE([
slouken@294
  1990
         #include <dlfcn.h>
slouken@294
  1991
        ],[
slouken@1638
  1992
         #if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED <= 1020
slouken@1638
  1993
         #error Use dlcompat for Mac OS X 10.2 compatibility
slouken@1638
  1994
         #endif
slouken@294
  1995
        ],[
slouken@1361
  1996
        have_dlopen=yes
slouken@294
  1997
        ])
slouken@1361
  1998
        AC_MSG_RESULT($have_dlopen)
slouken@294
  1999
slouken@1361
  2000
        if test x$have_dlopen = xyes; then
slouken@1521
  2001
            AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
slouken@1521
  2002
               AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
slouken@1521
  2003
                  AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
slouken@1361
  2004
            AC_DEFINE(SDL_LOADSO_DLOPEN)
slouken@1361
  2005
            SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
slouken@1361
  2006
            have_loadso=yes
slouken@294
  2007
        fi
slouken@294
  2008
    fi
slouken@294
  2009
}
slouken@294
  2010
slouken@381
  2011
dnl Check for the usbhid(3) library on *BSD
slouken@381
  2012
CheckUSBHID()
slouken@381
  2013
{
slouken@381
  2014
    if test x$enable_joystick = xyes; then
slouken@1565
  2015
        AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
slouken@1565
  2016
        if test x$have_libusbhid = xyes; then
slouken@1565
  2017
            AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
slouken@1565
  2018
            AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
slouken@1565
  2019
            USB_LIBS="$USB_LIBS -lusbhid"
slouken@1565
  2020
        else
slouken@1565
  2021
            AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
slouken@1565
  2022
            AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
slouken@1565
  2023
            AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
slouken@1565
  2024
        fi
slouken@1361
  2025
            
slouken@1361
  2026
        save_CFLAGS="$CFLAGS"
slouken@1361
  2027
        CFLAGS="$CFLAGS $USB_CFLAGS"
slouken@381
  2028
slouken@381
  2029
        AC_MSG_CHECKING(for usbhid)
slouken@381
  2030
        have_usbhid=no
slouken@381
  2031
        AC_TRY_COMPILE([
slouken@404
  2032
          #include <sys/types.h>
slouken@403
  2033
          #if defined(HAVE_USB_H)
slouken@403
  2034
          #include <usb.h>
slouken@403
  2035
          #endif
slouken@1565
  2036
          #ifdef __DragonFly__
slouken@1565
  2037
          # include <bus/usb/usb.h>
slouken@1565
  2038
          # include <bus/usb/usbhid.h>
slouken@1565
  2039
          #else
slouken@1565
  2040
          # include <dev/usb/usb.h>
slouken@1565
  2041
          # include <dev/usb/usbhid.h>
slouken@1565
  2042
          #endif
slouken@381
  2043
          #if defined(HAVE_USBHID_H)
slouken@381
  2044
          #include <usbhid.h>
slouken@381
  2045
          #elif defined(HAVE_LIBUSB_H)
slouken@381
  2046
          #include <libusb.h>
slouken@381
  2047
          #elif defined(HAVE_LIBUSBHID_H)
slouken@381
  2048
          #include <libusbhid.h>
slouken@404
  2049
          #endif
slouken@381
  2050
        ],[
slouken@381
  2051
          struct report_desc *repdesc;
slouken@381
  2052
          struct usb_ctl_report *repbuf;
slouken@402
  2053
          hid_kind_t hidkind;
slouken@381
  2054
        ],[
slouken@381
  2055
        have_usbhid=yes
slouken@381
  2056
        ])
slouken@381
  2057
        AC_MSG_RESULT($have_usbhid)
slouken@381
  2058
slouken@381
  2059
        if test x$have_usbhid = xyes; then
slouken@381
  2060
            AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
slouken@381
  2061
            have_usbhid_ucr_data=no
slouken@381
  2062
            AC_TRY_COMPILE([
slouken@404
  2063
              #include <sys/types.h>
slouken@404
  2064
              #if defined(HAVE_USB_H)
slouken@404
  2065
              #include <usb.h>
slouken@404
  2066
              #endif
slouken@1565
  2067
              #ifdef __DragonFly__
slouken@1565
  2068
              # include <bus/usb/usb.h>
slouken@1565
  2069
              # include <bus/usb/usbhid.h>
slouken@1565
  2070
              #else
slouken@1565
  2071
              # include <dev/usb/usb.h>
slouken@1565
  2072
              # include <dev/usb/usbhid.h>
slouken@1565
  2073
              #endif
slouken@381
  2074
              #if defined(HAVE_USBHID_H)
slouken@381
  2075
              #include <usbhid.h>
slouken@381
  2076
              #elif defined(HAVE_LIBUSB_H)
slouken@381
  2077
              #include <libusb.h>
slouken@381
  2078
              #elif defined(HAVE_LIBUSBHID_H)
slouken@381
  2079
              #include <libusbhid.h>
slouken@381
  2080
              #endif
slouken@381
  2081
            ],[
slouken@381
  2082
              struct usb_ctl_report buf;
slouken@381
  2083
              if (buf.ucr_data) { }
slouken@381
  2084
            ],[
slouken@381
  2085
            have_usbhid_ucr_data=yes
slouken@381
  2086
            ])
slouken@381
  2087
            if test x$have_usbhid_ucr_data = xyes; then
slouken@1361
  2088
                USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
slouken@381
  2089
            fi
slouken@381
  2090
            AC_MSG_RESULT($have_usbhid_ucr_data)
slouken@407
  2091
            
slouken@1361
  2092
            AC_MSG_CHECKING(for new usbhid API)
slouken@407
  2093
            have_usbhid_new=no
slouken@407
  2094
            AC_TRY_COMPILE([
slouken@407
  2095
              #include <sys/types.h>
slouken@407
  2096
              #if defined(HAVE_USB_H)
slouken@407
  2097
              #include <usb.h>
slouken@407
  2098
              #endif
slouken@3392
  2099
              #ifdef __DragonFly__
slouken@2158
  2100
              #include <bus/usb/usb.h>
slouken@2158
  2101
              #include <bus/usb/usbhid.h>
slouken@3392
  2102
              #else
slouken@407
  2103
              #include <dev/usb/usb.h>
slouken@407
  2104
              #include <dev/usb/usbhid.h>
slouken@3392
  2105
              #endif
slouken@407
  2106
              #if defined(HAVE_USBHID_H)
slouken@407
  2107
              #include <usbhid.h>
slouken@407
  2108
              #elif defined(HAVE_LIBUSB_H)
slouken@407
  2109
              #include <libusb.h>
slouken@407
  2110
              #elif defined(HAVE_LIBUSBHID_H)
slouken@407
  2111
              #include <libusbhid.h>
slouken@407
  2112
              #endif
slouken@407
  2113
            ],[
slouken@407
  2114
              report_desc_t d;
slouken@1361
  2115
              hid_start_parse(d, 1, 1);
slouken@407
  2116
            ],[
slouken@407
  2117
            have_usbhid_new=yes
slouken@407
  2118
            ])
slouken@407
  2119
            if test x$have_usbhid_new = xyes; then
slouken@1361
  2120
                USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
slouken@407
  2121
            fi
slouken@407
  2122
            AC_MSG_RESULT($have_usbhid_new)
slouken@381
  2123
slouken@1565
  2124
            AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
slouken@1565
  2125
            have_machine_joystick=no
slouken@1565
  2126
            AC_TRY_COMPILE([
slouken@1565
  2127
              #include <machine/joystick.h>
slouken@1565
  2128
            ],[
slouken@1565
  2129
              struct joystick t;
slouken@1565
  2130
            ],[
slouken@1565
  2131
            have_machine_joystick=yes
slouken@1565
  2132
            ])
slouken@1565
  2133
            if test x$have_machine_joystick = xyes; then
slouken@1565
  2134
                AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H)
slouken@1565
  2135
            fi
slouken@1565
  2136
            AC_MSG_RESULT($have_machine_joystick)
slouken@1565
  2137
slouken@1361
  2138
            AC_DEFINE(SDL_JOYSTICK_USBHID)
slouken@1361
  2139
            SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
slouken@1521
  2140
            EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
slouken@1521
  2141
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
slouken@1361
  2142
            have_joystick=yes
slouken@381
  2143
        fi
slouken@1361
  2144
        CFLAGS="$save_CFLAGS"
slouken@381
  2145
    fi
slouken@381
  2146
}
slouken@381
  2147
slouken@1361
  2148
dnl Check for clock_gettime()
slouken@1361
  2149
CheckClockGettime()
slouken@795
  2150
{
slouken@1361
  2151
    AC_ARG_ENABLE(clock_gettime,
slouken@1637
  2152
AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=no]]]),
slouken@1361
  2153
                  , enable_clock_gettime=no)
slouken@1361
  2154
    if test x$enable_clock_gettime = xyes; then
slouken@1361
  2155
        AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
slouken@1361
  2156
        if test x$have_clock_gettime = xyes; then
slouken@1361
  2157
            AC_DEFINE(HAVE_CLOCK_GETTIME)
slouken@1521
  2158
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
slouken@3087
  2159
        else
slouken@3087
  2160
            AC_CHECK_LIB(c, clock_gettime, have_clock_gettime=yes)
slouken@3087
  2161
            if test x$have_clock_gettime = xyes; then
slouken@3087
  2162
               AC_DEFINE(HAVE_CLOCK_GETTIME)
slouken@3087
  2163
               EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
slouken@3087
  2164
            fi
icculus@1175
  2165
        fi
slouken@795
  2166
    fi
slouken@795
  2167
}
slouken@795
  2168
slouken@1062
  2169
dnl Check for a valid linux/version.h
slouken@1062
  2170
CheckLinuxVersion()
slouken@1062
  2171
{
slouken@1062
  2172
    AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
slouken@1062
  2173
    if test x$have_linux_version_h = xyes; then
slouken@1521
  2174
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
slouken@1062
  2175
    fi
slouken@1062
  2176
}
slouken@1062
  2177
slouken@1127
  2178
dnl Check if we want to use RPATH
slouken@1127
  2179
CheckRPATH()
slouken@1127
  2180
{
slouken@1127
  2181
    AC_ARG_ENABLE(rpath,
slouken@1637
  2182
AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]),
slouken@1127
  2183
                  , enable_rpath=yes)
slouken@1127
  2184
}
slouken@1127
  2185
slouken@1550
  2186
dnl Set up the configuration based on the host platform!
slouken@1550
  2187
case "$host" in
slouken@1361
  2188
    arm-*-elf*) # FIXME: Can we get more specific for iPodLinux?
slouken@1361
  2189
        ARCH=linux
slouken@1361
  2190
        CheckDummyVideo
slouken@1361
  2191
        CheckIPod
slouken@1361
  2192
        # Set up files for the timer library
icculus@1140
  2193
        if test x$enable_timers = xyes; then
slouken@1361
  2194
            AC_DEFINE(SDL_TIMER_UNIX)
slouken@1361
  2195
            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
slouken@1361
  2196
            have_timers=yes
icculus@1140
  2197
        fi
slouken@1361
  2198
        ;;
slouken@2775
  2199
    *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-irix*|*-*-aix*|*-*-osf*|*-*-minix*)
slouken@1550
  2200
        case "$host" in
slouken@1361
  2201
            *-*-linux*)         ARCH=linux ;;
slouken@1820
  2202
            *-*-uclinux*)       ARCH=linux ;;
slouken@1361
  2203
            *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
slouken@1361
  2204
            *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
slouken@1361
  2205
            *-*-kopenbsd*-gnu)  ARCH=kopenbsd-gnu ;;
slouken@1361
  2206
            *-*-gnu*)           ARCH=gnu ;; # must be last of the gnu variants
slouken@1361
  2207
            *-*-bsdi*)          ARCH=bsdi ;;
slouken@1361
  2208
            *-*-freebsd*)       ARCH=freebsd ;;
slouken@1565
  2209
            *-*-dragonfly*)     ARCH=freebsd ;;
slouken@1361
  2210
            *-*-netbsd*)        ARCH=netbsd ;;
slouken@1361
  2211
            *-*-openbsd*)       ARCH=openbsd ;;
slouken@1361
  2212
            *-*-sysv5*)         ARCH=sysv5 ;;
slouken@1361
  2213
            *-*-solaris*)       ARCH=solaris ;;
slouken@1361
  2214
            *-*-hpux*)          ARCH=hpux ;;
slouken@1361
  2215
            *-*-irix*)          ARCH=irix ;;
slouken@1361
  2216
            *-*-aix*)           ARCH=aix ;;
slouken@1361
  2217
            *-*-osf*)           ARCH=osf ;;
slouken@2775
  2218
            *-*-minix*)         ARCH=minix ;;
slouken@795
  2219
        esac
icculus@1573
  2220
        CheckVisibilityHidden
slouken@1
  2221
        CheckDummyVideo
slouken@68
  2222
        CheckDiskAudio
icculus@1532
  2223
        CheckDummyAudio
slouken@371
  2224
        CheckDLOPEN
slouken@0
  2225
        CheckOSS
slouken@1361
  2226
        CheckDMEDIA
slouken@1438
  2227
        CheckMME
slouken@0
  2228
        CheckALSA
icculus@2271
  2229
        CheckPulseAudio
slouken@0
  2230
        CheckARTSC
slouken@0
  2231
        CheckESD
slouken@0
  2232
        CheckNAS
slouken@0
  2233
        CheckX11
slouken@0
  2234
        CheckFBCON
slouken@167
  2235
        CheckDirectFB
slouken@2947
  2236
        CheckFusionSound
slouken@70
  2237
        CheckPS2GS
slouken@3257
  2238
        CheckPS3
slouken@0
  2239
        CheckSVGA
icculus@1191
  2240
        CheckOpenGLX11
slouken@0
  2241
        CheckInputEvents
icculus@1201
  2242
        CheckTslib
slouken@1361
  2243
        CheckUSBHID
slouken@0
  2244
        CheckPTHREAD
slouken@1361
  2245
        CheckClockGettime
slouken@1062
  2246
        CheckLinuxVersion
slouken@1127
  2247
        CheckRPATH
slouken@1361
  2248
        # Set up files for the audio library
slouken@1361
  2249
        if test x$enable_audio = xyes; then
slouken@1361
  2250
          case $ARCH in
slouken@1565
  2251
            sysv5|solaris|hpux)
slouken@1361
  2252
                AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
slouken@1361
  2253
                SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
slouken@1361
  2254
                have_audio=yes
slouken@1361
  2255
            ;;
slouken@1565
  2256
            netbsd|openbsd)
slouken@1567
  2257
                AC_DEFINE(SDL_AUDIO_DRIVER_BSD)
slouken@1567
  2258
                SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c"
slouken@1361
  2259
                have_audio=yes
slouken@1361
  2260
            ;;
slouken@1361
  2261
            aix)
icculus@2049
  2262
                AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO)
slouken@1361
  2263
                SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
slouken@1361
  2264
                have_audio=yes
slouken@1361
  2265
            ;;
slouken@1361
  2266
          esac
slouken@371
  2267
        fi
bob@3199
  2268
        # Set up files for the atomic operations library
bob@3199
  2269
        if test x$enable_atomic = xyes; then
bob@3199
  2270
          case $ARCH in
bob@3199
  2271
            linux)
bob@3199
  2272
                AC_DEFINE(SDL_ATOMIC_LINUX)
bob@3199
  2273
                SOURCES="$SOURCES $srcdir/src/atomic/linux/*.c"
bob@3199
  2274
                have_atomic=yes
bob@3199
  2275
            ;;
bob@3199
  2276
          esac
bob@3199
  2277
        fi
slouken@0
  2278
        # Set up files for the joystick library
slouken@0
  2279
        if test x$enable_joystick = xyes; then
slouken@1361
  2280
          case $ARCH in
slouken@1361
  2281
            linux)
slouken@1361
  2282
                AC_DEFINE(SDL_JOYSTICK_LINUX)
slouken@1361
  2283
                SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
slouken@1361
  2284
                have_joystick=yes
slouken@1361
  2285
            ;;
slouken@1361
  2286
          esac
slouken@0
  2287
        fi
slouken@2713
  2288
        # Set up files for the haptic library
slouken@2713
  2289
        if test x$enable_haptic = xyes; then
slouken@2713
  2290
           if test x$use_input_events = xyes; then
slouken@2713
  2291
             case $ARCH in
slouken@2713
  2292
               linux)
slouken@2713
  2293
                   AC_DEFINE(SDL_HAPTIC_LINUX)
slouken@2713
  2294
                   SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c"
slouken@2713
  2295
                   have_haptic=yes
slouken@2713
  2296
               ;;
slouken@2713
  2297
             esac
slouken@2713
  2298
           fi
slouken@2713
  2299
        fi
icculus@3170
  2300
        # Set up files for the power library
icculus@3170
  2301
        if test x$enable_power = xyes; then
icculus@3170
  2302
             case $ARCH in
icculus@3170
  2303
               linux)
icculus@3170
  2304
                   AC_DEFINE(SDL_POWER_LINUX)
icculus@3170
  2305
                   SOURCES="$SOURCES $srcdir/src/power/linux/*.c"
icculus@3170
  2306
                   have_power=yes
icculus@3170
  2307
               ;;
icculus@3170
  2308
             esac
icculus@3170
  2309
        fi
slouken@0
  2310
        # Set up files for the thread library
slouken@1361
  2311
        if test x$enable_threads = xyes -a x$use_pthreads != xyes -a x$use_pth != xyes -a x$ARCH = xirix; then
slouken@1361
  2312
            AC_DEFINE(SDL_THREAD_SPROC)
slouken@1361
  2313
            SOURCES="$SOURCES $srcdir/src/thread/irix/*.c"
slouken@1361
  2314
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
slouken@1361
  2315
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
slouken@1361
  2316
            have_threads=yes
slouken@0
  2317
        fi
slouken@0
  2318
        # Set up files for the timer library
slouken@0
  2319
        if test x$enable_timers = xyes; then
slouken@1361
  2320
            AC_DEFINE(SDL_TIMER_UNIX)
slouken@1361
  2321
            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
slouken@1361
  2322
            have_timers=yes
slouken@0
  2323
        fi
slouken@0
  2324
        ;;
slouken@0
  2325
    *-*-qnx*)
slouken@3083
  2326
slouken@3083
  2327
        EXTRA_CFLAGS="-I/usr/include $CFLAGS"
slouken@3083
  2328
        EXTRA_LDLAGS="-L/usr/lib $LDFLAGS"
slouken@3083
  2329
slouken@0
  2330
        ARCH=qnx
slouken@3083
  2331
        CheckVisibilityHidden
slouken@1
  2332
        CheckDummyVideo
slouken@68
  2333
        CheckDiskAudio
icculus@1532
  2334
        CheckDummyAudio
slouken@371
  2335
        CheckDLOPEN
slouken@3083
  2336
        CheckPulseAudio
slouken@3083
  2337
        CheckESD
slouken@0
  2338
        CheckNAS
slouken@0
  2339
        CheckPHOTON
slouken@3083
  2340
        CheckQNXGF
slouken@0
  2341
        CheckX11
icculus@1191
  2342
        CheckOpenGLX11
slouken@0
  2343
        CheckPTHREAD
slouken@3083
  2344
        CheckClockGettime
slouken@3083
  2345
slouken@3083
  2346
slouken@0
  2347
        # Set up files for the audio library
slouken@0
  2348
        if test x$enable_audio = xyes; then
slouken@3099
  2349
            AC_DEFINE(SDL_AUDIO_DRIVER_QSA)
slouken@3099
  2350
            SOURCES="$SOURCES $srcdir/src/audio/qsa/*.c"
slouken@1521
  2351
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound"
slouken@1361
  2352
            have_audio=yes
slouken@0
  2353
        fi
slouken@0
  2354
        # Set up files for the timer library
slouken@0
  2355
        if test x$enable_timers = xyes; then
slouken@1361
  2356
            AC_DEFINE(SDL_TIMER_UNIX)
slouken@1361
  2357
            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
slouken@1361
  2358
            have_timers=yes
slouken@0
  2359
        fi
lestat@3217
  2360
        # Setup files for the atomic operations
lestat@3217
  2361
        if test x$enable_atomic = xyes; then
lestat@3217
  2362
                AC_DEFINE(SDL_ATOMIC_QNX)
lestat@3217
  2363
                SOURCES="$SOURCES $srcdir/src/atomic/qnx/*.c"
lestat@3217
  2364
                have_atomic=yes
lestat@3217
  2365
        fi
slouken@3083
  2366
        # Set up dummy files for the joystick for now
slouken@3083
  2367
        if test x$enable_joystick = xyes; then
slouken@3083
  2368
            AC_DEFINE(SDL_JOYSTICK_DUMMY)
slouken@3083
  2369
            SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
slouken@3083
  2370
            have_joystick=yes
slouken@3083
  2371
        fi
slouken@3083
  2372
        # Set up dummy files for the haptic for now
slouken@3083
  2373
        if test x$enable_haptic = xyes; then
slouken@3083
  2374
            AC_DEFINE(SDL_HAPTIC_DUMMY)
slouken@3083
  2375
            SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
slouken@3083
  2376
            have_haptic=yes
slouken@3083
  2377
        fi
slouken@0
  2378
        ;;
slouken@3097
  2379
    *-wince* | *-mingw32ce)
slouken@3097
  2380
        ARCH=win32
slouken@3097
  2381
        CheckDummyVideo
slouken@3097
  2382
        CheckDiskAudio
slouken@3097
  2383
        CheckDummyAudio
slouken@3097
  2384
        CheckWIN32
slouken@3097
  2385
        if test x$enable_video = xyes; then
slouken@3097
  2386
            AC_DEFINE(SDL_VIDEO_DRIVER_WIN32)
slouken@3097
  2387
            SOURCES="$SOURCES $srcdir/src/video/win32/*.c"
slouken@3097
  2388
            have_video=yes
slouken@3097
  2389
            AC_ARG_ENABLE(render-gdi,
slouken@3097
  2390
AC_HELP_STRING([--enable-render-gdi], [enable the GDI render driver [[default=yes]]]),
slouken@3097
  2391
                                , enable_render_gdi=yes)
slouken@3097
  2392
            if test x$enable_render_gdi = xyes; then
slouken@3097
  2393
                AC_DEFINE(SDL_VIDEO_RENDER_GDI)
slouken@3097
  2394
            fi
slouken@3168
  2395
            AC_ARG_ENABLE(render-gapi,
slouken@3168
  2396
AC_HELP_STRING([--enable-render-gapi], [enable the GAPI/RAWFRAMEBUFFER render driver [[default=yes]]]),
slouken@3168
  2397
                                , enable_render_gapi=yes)
slouken@3168
  2398
            if test x$enable_render_gapi = xyes -a x$have_wince = xyes; then
slouken@3168
  2399
                AC_DEFINE(SDL_VIDEO_RENDER_GAPI)
slouken@3168
  2400
            fi
slouken@3168
  2401
            AC_ARG_ENABLE(render-ddraw,
slouken@3168
  2402
AC_HELP_STRING([--enable-render-ddraw], [enable the Mobile DirectDraw render driver [[default=yes]]]),
slouken@3168
  2403
                                , enable_render_ddraw=yes)
slouken@3168
  2404
            if test x$enable_render_ddraw = xyes -a x$have_wince = xyes -a x$have_ddraw = xyes; then
slouken@3168
  2405
                AC_DEFINE(SDL_VIDEO_RENDER_DDRAW)
slouken@3168
  2406
            fi
slouken@3097
  2407
            AC_ARG_ENABLE(render-d3d,
slouken@3097
  2408
AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
slouken@3097
  2409
                                , enable_render_d3d=yes)
slouken@3097
  2410
            enable_render_d3d=no
slouken@3097
  2411
            if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
slouken@3097
  2412
                AC_DEFINE(SDL_VIDEO_RENDER_D3D)
slouken@3097
  2413
            fi
slouken@3097
  2414
        fi
slouken@3097
  2415
        # Set up files for the audio library
slouken@3097
  2416
        if test x$enable_audio = xyes; then
slouken@3097
  2417
            AC_DEFINE(SDL_AUDIO_DRIVER_WINWAVEOUT)
slouken@3097
  2418
            SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
slouken@3097
  2419
            if test x$have_dsound = xyes; then
slouken@3097
  2420
                AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
slouken@3097
  2421
                SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
slouken@3097
  2422
            fi
slouken@3097
  2423
            have_audio=yes
slouken@3097
  2424
        fi
slouken@3097
  2425
        # Set up files for the thread library
slouken@3097
  2426
        if test x$enable_threads = xyes; then
slouken@3097
  2427
            AC_DEFINE(SDL_THREAD_WIN32)
slouken@3097
  2428
            SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
slouken@3097
  2429
            SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
slouken@3097
  2430
            SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
slouken@3097
  2431
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
slouken@3097
  2432
            have_threads=yes
slouken@3097
  2433
        fi
slouken@3097
  2434
        # Set up files for the timer library
slouken@3097
  2435
        if test x$enable_timers = xyes; then
slouken@3097
  2436
            AC_DEFINE(SDL_TIMER_WINCE)
slouken@3097
  2437
            SOURCES="$SOURCES $srcdir/src/timer/wince/*.c"
slouken@3097
  2438
            have_timers=yes
slouken@3097
  2439
        fi
slouken@3097
  2440
        # Set up files for the shared object loading library
slouken@3097
  2441
        if test x$enable_loadso = xyes; then
slouken@3097
  2442
            AC_DEFINE(SDL_LOADSO_WIN32)
slouken@3097
  2443
            SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
slouken@3097
  2444
            have_loadso=yes
slouken@3097
  2445
        fi
icculus@3170
  2446
        # Set up files for the system power library
icculus@3170
  2447
        if test x$enable_power = xyes; then
icculus@3170
  2448
            AC_DEFINE(SDL_POWER_WINDOWS)
icculus@3170
  2449
            SOURCES="$SOURCES $srcdir/src/power/windows/*.c"
icculus@3170
  2450
            have_power=yes
icculus@3170
  2451
        fi
slouken@3097
  2452
        # Set up the system libraries we need
slouken@3097
  2453
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lcoredll -lcommctrl -lmmtimer"
slouken@3097
  2454
        # The Win32 platform requires special setup
slouken@3097
  2455
        SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
slouken@3097
  2456
        SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main -D_WIN32_WCE=0x420"
slouken@3097
  2457
        SDL_LIBS="-lSDLmain $SDL_LIBS"
slouken@3097
  2458
        ;;
slouken@0
  2459
    *-*-cygwin* | *-*-mingw32*)
slouken@0
  2460
        ARCH=win32
slouken@1550
  2461
        if test "$build" != "$host"; then # cross-compiling
slouken@0
  2462
            # Default cross-compile location
slouken@2148
  2463
            ac_default_prefix=/usr/local/cross-tools/i386-mingw32
slouken@0
  2464
        else
slouken@0
  2465
            # Look for the location of the tools and install there
slouken@750
  2466
            if test "$BUILD_PREFIX" != ""; then
slouken@1
  2467
                ac_default_prefix=$BUILD_PREFIX
slouken@1
  2468
            fi
slouken@0
  2469
        fi
slouken@1
  2470
        CheckDummyVideo
slouken@68
  2471
        CheckDiskAudio
icculus@1532
  2472
        CheckDummyAudio
slouken@0
  2473
        CheckWIN32
slouken@1361
  2474
        CheckWIN32GL
slouken@0
  2475
        CheckDIRECTX
slouken@1895
  2476
        # Set up files for the video library
slouken@1895
  2477
        if test x$enable_video = xyes; then
slouken@1895
  2478
            AC_DEFINE(SDL_VIDEO_DRIVER_WIN32)
slouken@1895
  2479
            SOURCES="$SOURCES $srcdir/src/video/win32/*.c"
slouken@1895
  2480
            have_video=yes
slouken@1895
  2481
            AC_ARG_ENABLE(render-gdi,
slouken@1895
  2482
AC_HELP_STRING([--enable-render-gdi], [enable the GDI render driver [[default=yes]]]),
slouken@1895
  2483
                                , enable_render_gdi=yes)
slouken@1895
  2484
            if test x$enable_render_gdi = xyes; then
slouken@1895
  2485
                AC_DEFINE(SDL_VIDEO_RENDER_GDI)
slouken@1895
  2486
            fi
slouken@1895
  2487
            AC_ARG_ENABLE(render-d3d,
slouken@1895
  2488
AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
slouken@1895
  2489
                                , enable_render_d3d=yes)
slouken@1895
  2490
            if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
slouken@1895
  2491
                AC_DEFINE(SDL_VIDEO_RENDER_D3D)
slouken@1895
  2492
            fi
slouken@1895
  2493
        fi
slouken@0
  2494
        # Set up files for the audio library
slouken@0
  2495
        if test x$enable_audio = xyes; then
icculus@2070
  2496
            AC_DEFINE(SDL_AUDIO_DRIVER_WINWAVEOUT)
slouken@1361
  2497
            SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
slouken@1895
  2498
            if test x$have_dsound = xyes; then
slouken@1361
  2499
                AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
slouken@1361
  2500
                SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
slouken@0
  2501
            fi
slouken@1361
  2502
            have_audio=yes
slouken@0
  2503
        fi
bob@3307
  2504
        # Set up files for the atomic operations library
bob@3307
  2505
        if test x$enable_atomic = xyes; then
bob@3307
  2506
            AC_DEFINE(SDL_ATOMIC_WIN32)
bob@3307
  2507
            SOURCES="$SOURCES $srcdir/src/atomic/win32/*.c"
bob@3307
  2508
            have_atomic=yes
bob@3307
  2509
        fi
slouken@0
  2510
        # Set up files for the joystick library
slouken@0
  2511
        if test x$enable_joystick = xyes; then
slouken@1895
  2512
            if test x$have_dinput = xyes; then
slouken@1895
  2513
                AC_DEFINE(SDL_JOYSTICK_DINPUT)
slouken@1895
  2514
                SOURCES="$SOURCES $srcdir/src/joystick/win32/SDL_dxjoystick.c"
bobbens@2717
  2515
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8 -lole32"
slouken@1895
  2516
            else
slouken@1895
  2517
                AC_DEFINE(SDL_JOYSTICK_WINMM)
slouken@1895
  2518
                SOURCES="$SOURCES $srcdir/src/joystick/win32/SDL_mmjoystick.c"
slouken@1895
  2519
            fi
slouken@1361
  2520
            have_joystick=yes
slouken@0
  2521
        fi
slouken@2713
  2522
        if test x$enable_haptic = xyes; then
slouken@2713
  2523
            if test x$have_dinput = xyes; then
slouken@2713
  2524
                AC_DEFINE(SDL_HAPTIC_DINPUT)
slouken@2713
  2525
                SOURCES="$SOURCES $srcdir/src/haptic/win32/SDL_syshaptic.c"
slouken@2713
  2526
                have_haptic=yes
slouken@2713
  2527
            fi
slouken@2713
  2528
        fi
icculus@3170
  2529
        if test x$enable_power = xyes; then
icculus@3170
  2530
            AC_DEFINE(SDL_POWER_WINDOWS)
icculus@3170
  2531
            SOURCES="$SOURCES $srcdir/src/power/windows/SDL_syspower.c"
icculus@3170
  2532
            have_power=yes
icculus@3170
  2533
        fi
slouken@0
  2534
        # Set up files for the thread library
slouken@0
  2535
        if test x$enable_threads = xyes; then
slouken@1361
  2536
            AC_DEFINE(SDL_THREAD_WIN32)
slouken@1361
  2537
            SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
slouken@1361
  2538
            SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
slouken@1361
  2539
            SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
slouken@1361
  2540
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
slouken@1361
  2541
            have_threads=yes
slouken@0
  2542
        fi
slouken@0
  2543
        # Set up files for the timer library
slouken@0
  2544
        if test x$enable_timers = xyes; then
slouken@1361
  2545
            AC_DEFINE(SDL_TIMER_WIN32)
slouken@1361
  2546
            SOURCES="$SOURCES $srcdir/src/timer/win32/*.c"
slouken@1361
  2547
            have_timers=yes
slouken@1361
  2548
        fi
slouken@1361
  2549
        # Set up files for the shared object loading library
slouken@1361
  2550
        if test x$enable_loadso = xyes; then
slouken@1361
  2551
            AC_DEFINE(SDL_LOADSO_WIN32)
slouken@1361
  2552
            SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
slouken@1361
  2553
            have_loadso=yes
slouken@1361
  2554
        fi
slouken@1361
  2555
        # Set up the system libraries we need
slouken@3082
  2556
        # SDL 1.3 is unicode, and unicows emulates this on Windows 98/ME
slouken@3082
  2557
        # You can get this here: http://libunicows.sourceforge.net/
slouken@3082
  2558
        #EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lunicows"
slouken@3082
  2559
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lmsimg32 -lwinmm"
slouken@0
  2560
        # The Win32 platform requires special setup
slouken@3334
  2561
        VERSION_SOURCES="$srcdir/src/main/win32/*.rc"
slouken@1397
  2562
        SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
slouken@0
  2563
        SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
slouken@1363
  2564
        SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
slouken@0
  2565
        ;;
slouken@3292
  2566
    *-*-beos* | *-*-haiku*)
slouken@0
  2567
        ARCH=beos
slouken@0
  2568
        ac_default_prefix=/boot/develop/tools/gnupro
slouken@1
  2569
        CheckDummyVideo
slouken@68
  2570
        CheckDiskAudio
icculus@1532
  2571
        CheckDummyAudio
slouken@0
  2572
        CheckBWINDOW
slouken@0
  2573
        CheckBeGL
slouken@0
  2574
        # Set up files for the audio library
slouken@0
  2575
        if test x$enable_audio = xyes; then
icculus@2049
  2576
            AC_DEFINE(SDL_AUDIO_DRIVER_BEOSAUDIO)
slouken@1361
  2577
            SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc"
slouken@1361
  2578
            have_audio=yes
slouken@0
  2579
        fi
slouken@0
  2580
        # Set up files for the joystick library
slouken@0
  2581
        if test x$enable_joystick = xyes; then
slouken@1361
  2582
            AC_DEFINE(SDL_JOYSTICK_BEOS)
slouken@1361
  2583
            SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc"
slouken@1361
  2584
            have_joystick=yes
slouken@0
  2585
        fi
slouken@0
  2586
        # Set up files for the thread library
slouken@0
  2587
        if test x$enable_threads = xyes; then
slouken@1361
  2588
            AC_DEFINE(SDL_THREAD_BEOS)
slouken@1361
  2589
            SOURCES="$SOURCES $srcdir/src/thread/beos/*.c"
slouken@1361
  2590
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
slouken@1361
  2591
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
slouken@1361
  2592
            have_threads=yes
slouken@0
  2593
        fi
slouken@0
  2594
        # Set up files for the timer library
slouken@0
  2595
        if test x$enable_timers = xyes; then
slouken@1361
  2596
            AC_DEFINE(SDL_TIMER_BEOS)
slouken@1361
  2597
            SOURCES="$SOURCES $srcdir/src/timer/beos/*.c"
slouken@1361
  2598
            have_timers=yes
slouken@1361
  2599
        fi
slouken@1361
  2600
        # Set up files for the shared object loading library
slouken@1361
  2601
        if test x$enable_loadso = xyes; then
slouken@1361
  2602
            AC_DEFINE(SDL_LOADSO_BEOS)
slouken@1361
  2603
            SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
slouken@1361
  2604
            have_loadso=yes
slouken@0
  2605
        fi
icculus@3173
  2606
        # Set up files for the system power library
icculus@3173
  2607
        if test x$enable_power = xyes; then
icculus@3173
  2608
            AC_DEFINE(SDL_POWER_BEOS)
icculus@3173
  2609
            SOURCES="$SOURCES $srcdir/src/power/beos/*.c"
icculus@3173
  2610
            have_power=yes
icculus@3173
  2611
        fi
slouken@1367
  2612
        # The BeOS platform requires special setup.
slouken@1367
  2613
        SOURCES="$srcdir/src/main/beos/*.cc $SOURCES"
slouken@1521
  2614
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
slouken@0
  2615
        ;;
slouken@0
  2616
    *-*-darwin* )
icculus@1133
  2617
        # This could be either full "Mac OS X", or plain "Darwin" which is
slouken@158
  2618
        # just the OS X kernel sans upper layers like Carbon and Cocoa.
icculus@1133
  2619
        # Next line is broken, and a few files below require Mac OS X (full)
slouken@158
  2620
        ARCH=macosx
slouken@1624
  2621
slouken@1628
  2622
        # Mac OS X builds with both the Carbon and OSX APIs at the moment
slouken@1638
  2623
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
slouken@1638
  2624
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
slouken@1628
  2625
slouken@1628
  2626
        # HACK: Reset EXTRA_LDFLAGS; the only thing it contains at this point
slouken@1628
  2627
        # is -lm which is not needed under Mac OS X. But for some reasons it
slouken@1628
  2628
        # also tends to contain spurious -L switches, which we don't want to
slouken@1628
  2629
        # use here or in sdl-config. Hence we reset it.
slouken@1624
  2630
        EXTRA_LDFLAGS=""
slouken@1624
  2631
slouken@1742
  2632
        CheckVisibilityHidden
slouken@1
  2633
        CheckDummyVideo
slouken@68
  2634
        CheckDiskAudio
icculus@1532
  2635
        CheckDummyAudio
slouken@1638
  2636
        CheckDLOPEN
slouken@1889
  2637
slouken@1648
  2638
        # Set up files for the shared object loading library
slouken@1648
  2639
        # (this needs to be done before the dynamic X11 check)
slouken@1648
  2640
        if test x$enable_loadso = xyes -a x$have_dlopen != xyes; then
slouken@1648
  2641
            AC_DEFINE(SDL_LOADSO_DLCOMPAT)
slouken@1648
  2642
            SOURCES="$SOURCES $srcdir/src/loadso/macosx/*.c"
slouken@1648
  2643
            have_loadso=yes
slouken@1648
  2644
        fi
slouken@1648
  2645
icculus@1133
  2646
        CheckCOCOA
icculus@1174
  2647
        CheckX11
slouken@0
  2648
        CheckMacGL
icculus@1191
  2649
        CheckOpenGLX11
slouken@0
  2650
        CheckPTHREAD
icculus@1445
  2651
slouken@2238
  2652
        # Good optimization on Mac OS X, yes...
slouken@2238
  2653
        EXTRA_CFLAGS="$EXTRA_CFLAGS -falign-loops=16"
slouken@2238
  2654
icculus@1445
  2655
        # Need this or things might misbuild on a G3.
slouken@1521
  2656
        EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"
icculus@1445
  2657
slouken@0
  2658
        # Set up files for the audio library
slouken@0
  2659
        if test x$enable_audio = xyes; then
slouken@1361
  2660
            AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO)
slouken@1361
  2661
            SOURCES="$SOURCES $srcdir/src/audio/macosx/*.c"
slouken@1361
  2662
            have_audio=yes
slouken@0
  2663
        fi
bob@3214
  2664
        # Set up files for the atomic operations library
bob@3214
  2665
        if test x$enable_atomic = xyes; then
bob@3214
  2666
            AC_DEFINE(SDL_ATOMIC_MACOSX)
bob@3214
  2667
            SOURCES="$SOURCES $srcdir/src/atomic/macosx/*.c"
bob@3214
  2668
            have_atomic=yes
bob@3214
  2669
        fi
slouken@0
  2670
        # Set up files for the joystick library
slouken@0
  2671
        if test x$enable_joystick = xyes; then
slouken@1361
  2672
            AC_DEFINE(SDL_JOYSTICK_IOKIT)
slouken@1361
  2673
            SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
slouken@1361
  2674
            have_joystick=yes
slouken@0
  2675
        fi
slouken@2713
  2676
        # Set up files for the haptic library
slouken@2713
  2677
        if test x$enable_haptic = xyes; then
slouken@2713
  2678
            AC_DEFINE(SDL_HAPTIC_IOKIT)
slouken@2713
  2679
            SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
slouken@2713
  2680
            have_haptic=yes
icculus@3623
  2681
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
slouken@2713
  2682
        fi
icculus@3170
  2683
        # Set up files for the power library
icculus@3170
  2684
        if test x$enable_power = xyes; then
icculus@3170
  2685
            AC_DEFINE(SDL_POWER_MACOSX)
icculus@3170
  2686
            SOURCES="$SOURCES $srcdir/src/power/macosx/*.c"
icculus@3170
  2687
            have_power=yes
icculus@3170
  2688
        fi
slouken@0
  2689
        # Set up files for the timer library
slouken@0
  2690
        if test x$enable_timers = xyes; then
slouken@1361
  2691
            AC_DEFINE(SDL_TIMER_UNIX)
slouken@1361
  2692
            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
slouken@1361
  2693
            have_timers=yes
slouken@1361
  2694
        fi
slouken@1621
  2695
        # The Mac OS X platform requires special setup.
slouken@1521
  2696
        EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
slouken@3049
  2697
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc"
icculus@3623
  2698
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
icculus@3623
  2699
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
icculus@3623
  2700
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
slouken@3621
  2701
        # If audio is used, add the AudioUnit framework
slouken@3243
  2702
        if test x$enable_audio = xyes; then
icculus@3623
  2703
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit"
slouken@1361
  2704
        fi
slouken@0
  2705
        ;;
slouken@1035
  2706
    *-riscos)
slouken@687
  2707
        ARCH=riscos
slouken@1361
  2708
        CheckOSS
slouken@1361
  2709
        CheckPTHREAD
slouken@955
  2710
        # Set up files for the video library
slouken@955
  2711
        if test x$enable_video = xyes; then
slouken@1361
  2712
            AC_DEFINE(SDL_VIDEO_DRIVER_RISCOS)
slouken@1361
  2713
            SOURCES="$SOURCES $srcdir/src/video/riscos/*.c"
slouken@1459
  2714
            SOURCES="$SOURCES $srcdir/src/video/riscos/*.S"
slouken@1361
  2715
            have_video=yes
slouken@955
  2716
        fi
slouken@955
  2717
        # Set up files for the joystick library
slouken@955
  2718
        if test x$enable_joystick = xyes; then
slouken@1361
  2719
            AC_DEFINE(SDL_JOYSTICK_RISCOS)
slouken@1361
  2720
            SOURCES="$SOURCES $srcdir/src/joystick/riscos/*.c"
slouken@1361
  2721
            have_joystick=yes
slouken@955
  2722
        fi
slouken@955
  2723
        # Set up files for the timer library
slouken@955
  2724
        if test x$enable_timers = xyes; then
slouken@1361
  2725
            AC_DEFINE(SDL_TIMER_RISCOS)
slouken@1361
  2726
            SOURCES="$SOURCES $srcdir/src/timer/riscos/*.c"
slouken@1361
  2727
            have_timers=yes