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