configure.in
author Sam Lantinga <slouken@libsdl.org>
Wed, 19 Jan 2011 00:07:43 -0800
changeset 5030 6a0803e47c7b
parent 5029 5d7d48157be7
child 5040 ff8873816c30
permissions -rw-r--r--
Greg Jandl to SDL

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