configure.in
author Ryan C. Gordon <icculus@icculus.org>
Thu, 21 Apr 2016 03:16:44 -0400
changeset 11729 d1ce8396c356
parent 11726 27d08f1aab80
child 11730 ac6c607e065c
permissions -rw-r--r--
Initial shot at a renderer target for Apple's Metal API.

This isn't complete, but is enough to run testsprite2. It's currently
Mac-only; with a little work to figure out how to properly glue in a Metal
layer to a UIView, this will likely work on iOS, too.

This is only wired up to the configure script right now, and disabled by
default. CMake and Xcode still need their bits filled in as appropriate.
slouken@0
     1
dnl Process this file with autoconf to produce a configure script.
slouken@7222
     2
AC_INIT(README.txt)
slouken@6235
     3
AC_CONFIG_HEADER(include/SDL_config.h)
slouken@6086
     4
AC_CONFIG_AUX_DIR(build-scripts)
icculus@5548
     5
AC_CONFIG_MACRO_DIR([acinclude])
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@6250
    13
# Edit include/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@6250
    21
SDL_MAJOR_VERSION=2
slouken@6250
    22
SDL_MINOR_VERSION=0
slouken@11687
    23
SDL_MICRO_VERSION=8
slouken@10595
    24
SDL_INTERFACE_AGE=0
slouken@11687
    25
SDL_BINARY_AGE=8
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
icculus@5888
    58
AC_CHECK_TOOL(WINDRES, [windres], [:])
slouken@3332
    59
slouken@7379
    60
dnl Make sure that srcdir is a full pathname
slouken@7573
    61
case "$host" in
slouken@7573
    62
    *-*-mingw32*)
slouken@7573
    63
        # Except on msys, where make can't handle full pathnames (bug 1972)
slouken@7573
    64
        ;;
slouken@7573
    65
    *)
slouken@7573
    66
        srcdir=`cd $srcdir && pwd`
slouken@7573
    67
        ;;
slouken@7573
    68
esac
slouken@7379
    69
slouken@1389
    70
dnl Set up the compiler and linker flags
slouken@11427
    71
INCLUDE="-I$srcdir/include -idirafter $srcdir/src/video/khronos"
slouken@1373
    72
if test x$srcdir != x.; then
slouken@1571
    73
    INCLUDE="-Iinclude $INCLUDE"
slouken@6217
    74
elif test -d .hg; then
slouken@6217
    75
    AC_MSG_ERROR([
slouken@6217
    76
*** When building from Mercurial you should configure and build in a
slouken@6235
    77
    separate directory so you don't clobber SDL_config.h, SDL_revision.h
slouken@6217
    78
])
slouken@1373
    79
fi
slouken@7498
    80
BASE_CFLAGS=""
slouken@7498
    81
BASE_LDFLAGS=""
slouken@1550
    82
case "$host" in
slouken@1389
    83
    *-*-cygwin*)
slouken@1389
    84
        # We build SDL on cygwin without the UNIX emulation layer
slouken@7498
    85
        save_CFLAGS="$CFLAGS"
slouken@7498
    86
        have_no_cygwin=no
slouken@7498
    87
        AC_MSG_CHECKING(for GCC -mno-cygwin option)
slouken@7498
    88
        CFLAGS="$save_CFLAGS -mno-cygwin"
slouken@7498
    89
slouken@7498
    90
        AC_TRY_COMPILE([
slouken@7498
    91
        ],[
slouken@7498
    92
        ],[
slouken@7498
    93
        have_no_cygwin=yes
slouken@7498
    94
        ])
slouken@7498
    95
        AC_MSG_RESULT($have_no_cygwin)
slouken@7498
    96
        CFLAGS="$save_CFLAGS"
slouken@7498
    97
slouken@7498
    98
        if test x$have_no_cygwin = xyes; then
slouken@7498
    99
            BASE_CFLAGS="-mno-cygwin"
slouken@7498
   100
            BASE_LDFLAGS="-mno-cygwin"
slouken@7498
   101
        fi
slouken@7498
   102
        BASE_CFLAGS="$BASE_CFLAGS -I/usr/include/mingw"
slouken@1389
   103
        ;;
slouken@1389
   104
esac
slouken@5030
   105
# Uncomment the following line if you want to force SDL and applications
slouken@5030
   106
# built with it to be compiled for a particular architecture.
slouken@5030
   107
#AX_GCC_ARCHFLAG([no], [BASE_CFLAGS="$BASE_CFLAGS $ax_cv_gcc_archflag]")
slouken@6235
   108
BUILD_CFLAGS="$CFLAGS $CPPFLAGS -DUSING_GENERATED_CONFIG_H"
slouken@6250
   109
# The default optimization for SDL is -O3 (Bug #31)
slouken@6378
   110
if test "x$orig_CFLAGS" = x; then
slouken@3382
   111
    BUILD_CFLAGS=`echo $BUILD_CFLAGS | sed 's/-O2/-O3/'`
slouken@3382
   112
fi
slouken@1521
   113
EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS"
slouken@1521
   114
BUILD_LDFLAGS="$LDFLAGS"
slouken@1521
   115
EXTRA_LDFLAGS="$BASE_LDFLAGS"
slouken@2163
   116
## These are common directories to find software packages
slouken@2163
   117
#for path in /usr/freeware /usr/pkg /usr/X11R6 /usr/local; do
slouken@1823
   118
#    if test -d $path/include; then
slouken@1823
   119
#        EXTRA_CFLAGS="$EXTRA_CFLAGS -I$path/include"
slouken@1823
   120
#    fi
slouken@1823
   121
#    if test -d $path/lib; then
slouken@1823
   122
#        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$path/lib"
slouken@1823
   123
#    fi
slouken@1823
   124
#done
slouken@1521
   125
SDL_CFLAGS="$BASE_CFLAGS"
slouken@6250
   126
SDL_LIBS="-lSDL2 $BASE_LDFLAGS"
slouken@1521
   127
CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS"
slouken@1521
   128
CFLAGS="$CFLAGS $EXTRA_CFLAGS"
slouken@1521
   129
LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
slouken@1373
   130
slouken@3391
   131
dnl set this to use on systems that use lib64 instead of lib
slouken@3391
   132
base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
slouken@3391
   133
slouken@3391
   134
dnl Function to find a library in the compiler search path
slouken@3391
   135
find_lib()
slouken@3391
   136
{
slouken@3391
   137
    gcc_bin_path=[`$CC -print-search-dirs 2>/dev/null | fgrep programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
slouken@3391
   138
    gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
slouken@3391
   139
    env_lib_path=[`echo $LIBS $LDFLAGS $* | sed 's/-L[ ]*//g'`]
slouken@3391
   140
    if test "$cross_compiling" = yes; then
slouken@3391
   141
        host_lib_path=""
slouken@3391
   142
    else
slouken@3391
   143
        host_lib_path="/usr/$base_libdir /usr/local/$base_libdir"
slouken@3391
   144
    fi
slouken@9252
   145
    for path in $env_lib_path $gcc_bin_path $gcc_lib_path $host_lib_path; do
slouken@7300
   146
        lib=[`ls -- $path/$1 2>/dev/null | sed -e '/\.so\..*\./d' -e 's,.*/,,' | sort | tail -1`]
slouken@3391
   147
        if test x$lib != x; then
slouken@3391
   148
            echo $lib
slouken@3391
   149
            return
slouken@3391
   150
        fi
slouken@3391
   151
    done
slouken@3391
   152
}
slouken@3391
   153
slouken@1353
   154
dnl Check for compiler characteristics
slouken@1341
   155
AC_C_CONST
slouken@1341
   156
AC_C_INLINE
slouken@1353
   157
AC_C_VOLATILE
slouken@1353
   158
slouken@3647
   159
dnl See whether we want assertions for debugging/sanity checking SDL itself.
slouken@3647
   160
AC_ARG_ENABLE(assertions,
slouken@3647
   161
AC_HELP_STRING([--enable-assertions],
slouken@3654
   162
               [Enable internal sanity checks (auto/disabled/release/enabled/paranoid) [[default=auto]]]),
slouken@3654
   163
              , enable_assertions=auto)
slouken@3654
   164
case "$enable_assertions" in
slouken@3654
   165
    auto) # Use optimization settings to determine assertion level
slouken@3654
   166
        ;;
slouken@3654
   167
    disabled)
icculus@5548
   168
        AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 0, [ ])
slouken@3654
   169
        ;;
slouken@3654
   170
    release)
icculus@5548
   171
        AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 1, [ ])
slouken@3654
   172
        ;;
slouken@3654
   173
    enabled)
icculus@5548
   174
        AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 2, [ ])
slouken@3654
   175
        ;;
slouken@3654
   176
    paranoid)
icculus@5548
   177
        AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 3, [ ])
slouken@3654
   178
        ;;
slouken@3654
   179
    *)
slouken@3654
   180
        AC_MSG_ERROR([*** unknown assertion level. stop.])
slouken@3654
   181
        ;;
slouken@3654
   182
esac
slouken@3647
   183
slouken@3354
   184
dnl See whether we can use gcc style dependency tracking
slouken@3354
   185
AC_ARG_ENABLE(dependency-tracking,
slouken@3354
   186
AC_HELP_STRING([--enable-dependency-tracking],
slouken@3354
   187
               [Use gcc -MMD -MT dependency tracking [[default=yes]]]),
slouken@3354
   188
              , enable_dependency_tracking=yes)
slouken@3354
   189
if test x$enable_dependency_tracking = xyes; then
slouken@3354
   190
    have_gcc_mmd_mt=no
slouken@3354
   191
    AC_MSG_CHECKING(for GCC -MMD -MT option)
slouken@3354
   192
    AC_TRY_COMPILE([
slouken@3354
   193
    #if !defined(__GNUC__) || __GNUC__ < 3
slouken@3354
   194
    #error Dependency tracking requires GCC 3.0 or newer
slouken@3354
   195
    #endif
slouken@3354
   196
    ],[
slouken@3354
   197
    ],[
slouken@3354
   198
    have_gcc_mmd_mt=yes
slouken@3354
   199
    ])
slouken@3354
   200
    AC_MSG_RESULT($have_gcc_mmd_mt)
slouken@3354
   201
slouken@3354
   202
    if test x$have_gcc_mmd_mt = xyes; then
slouken@3354
   203
        DEPENDENCY_TRACKING_OPTIONS="-MMD -MT \$@"
slouken@3354
   204
    fi
slouken@3354
   205
fi
slouken@5004
   206
icculus@7988
   207
AC_MSG_CHECKING(for linker option --no-undefined)
icculus@7988
   208
have_no_undefined=no
icculus@8003
   209
case "$host" in
icculus@8003
   210
    dnl Skip this on platforms where it is just simply busted.
icculus@8003
   211
    *-*-openbsd*)
icculus@8003
   212
        ;;
icculus@8003
   213
icculus@8003
   214
    *)
icculus@8003
   215
        save_LDFLAGS="$LDFLAGS"
icculus@8003
   216
        LDFLAGS="$LDFLAGS -Wl,--no-undefined"
icculus@8003
   217
        AC_TRY_LINK([
icculus@8003
   218
        ],[
icculus@8003
   219
        ],[
icculus@8003
   220
        have_no_undefined=yes
icculus@8003
   221
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--no-undefined"
icculus@8003
   222
        ])
icculus@8003
   223
        LDFLAGS="$save_LDFLAGS"
icculus@8003
   224
        ;;
icculus@8003
   225
esac
icculus@7988
   226
AC_MSG_RESULT($have_no_undefined)
slouken@6577
   227
slouken@1361
   228
dnl See whether we are allowed to use the system C library
slouken@1361
   229
AC_ARG_ENABLE(libc,
slouken@1637
   230
AC_HELP_STRING([--enable-libc], [Use the system C library [[default=yes]]]),
slouken@1361
   231
              , enable_libc=yes)
slouken@1361
   232
if test x$enable_libc = xyes; then
icculus@5548
   233
    AC_DEFINE(HAVE_LIBC, 1, [ ])
slouken@1353
   234
slouken@1361
   235
    dnl Check for C library headers
slouken@1361
   236
    AC_HEADER_STDC
slouken@11480
   237
    AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h wchar.h inttypes.h stdint.h limits.h ctype.h math.h float.h iconv.h signal.h)
slouken@1361
   238
slouken@1361
   239
    dnl Check for typedefs, structures, etc.
slouken@1361
   240
    AC_TYPE_SIZE_T
slouken@1361
   241
slouken@3012
   242
    dnl Check for defines
slouken@3012
   243
    AC_CHECK_DEFINE(M_PI, math.h)
slouken@3012
   244
slouken@1361
   245
    dnl Checks for library functions.
icculus@2079
   246
    case "$host" in
icculus@2079
   247
    *-*-cygwin* | *-*-mingw32*)
icculus@2079
   248
        ;;
icculus@2079
   249
    *)
icculus@2079
   250
        AC_FUNC_ALLOCA
icculus@2079
   251
        ;;
icculus@2079
   252
    esac
icculus@2079
   253
slouken@1361
   254
    AC_FUNC_MEMCMP
slouken@1361
   255
    if test x$ac_cv_func_memcmp_working = xyes; then
icculus@5548
   256
        AC_DEFINE(HAVE_MEMCMP, 1, [ ])
slouken@1361
   257
    fi
slouken@1361
   258
    AC_FUNC_STRTOD
slouken@1361
   259
    if test x$ac_cv_func_strtod = xyes; then
icculus@5548
   260
        AC_DEFINE(HAVE_STRTOD, 1, [ ])
slouken@1361
   261
    fi
slouken@3405
   262
    AC_CHECK_FUNC(mprotect,
slouken@3405
   263
        AC_TRY_COMPILE([
slouken@3405
   264
          #include <sys/types.h>
slouken@3405
   265
          #include <sys/mman.h>
slouken@3405
   266
        ],[
slouken@3405
   267
        ],[
icculus@5548
   268
        AC_DEFINE(HAVE_MPROTECT, 1, [ ])
slouken@3405
   269
        ]),
slouken@3405
   270
    )
slouken@11610
   271
    AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcscmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval poll)
slouken@1373
   272
slouken@3014
   273
    AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
slouken@11684
   274
    AC_CHECK_FUNCS(acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf fabs fabsf floor floorf fmod fmodf log logf pow powf scalbn scalbnf sin sinf sqrt sqrtf tan tanf)
slouken@3014
   275
slouken@5040
   276
    AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"])
slouken@3014
   277
    AC_CHECK_FUNCS(iconv)
icculus@5577
   278
slouken@11245
   279
    AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE([HAVE_SA_SIGACTION], 1, [ ])], ,[#include <signal.h>])
slouken@11610
   280
slouken@11610
   281
	dnl Check for additional non-standard headers
slouken@11610
   282
    AC_CHECK_HEADERS(libunwind.h)
slouken@1361
   283
fi
slouken@1361
   284
urkle@7554
   285
dnl AC_CHECK_SIZEOF(void*)
slouken@1341
   286
slouken@5004
   287
dnl See whether we can use gcc atomic operations on this architecture
slouken@5004
   288
AC_ARG_ENABLE(gcc-atomics,
slouken@5004
   289
AC_HELP_STRING([--enable-gcc-atomics],
slouken@5004
   290
               [Use gcc builtin atomics [[default=yes]]]),
slouken@5004
   291
              , enable_gcc_atomics=yes)
slouken@5004
   292
if test x$enable_gcc_atomics = xyes; then
slouken@5004
   293
    have_gcc_atomics=no
slouken@5004
   294
    AC_MSG_CHECKING(for GCC builtin atomic operations)
slouken@5004
   295
    AC_TRY_LINK([
slouken@5004
   296
    ],[
slouken@5004
   297
    int a;
slouken@5004
   298
    void *x, *y, *z;
slouken@5004
   299
    __sync_lock_test_and_set(&a, 4);
slouken@5095
   300
    __sync_lock_test_and_set(&x, y);
slouken@5004
   301
    __sync_fetch_and_add(&a, 1);
slouken@5004
   302
    __sync_bool_compare_and_swap(&a, 5, 10);
slouken@5004
   303
    __sync_bool_compare_and_swap(&x, y, z);
slouken@5004
   304
    ],[
slouken@5004
   305
    have_gcc_atomics=yes
slouken@5004
   306
    ])
slouken@5004
   307
    AC_MSG_RESULT($have_gcc_atomics)
slouken@5004
   308
slouken@5068
   309
    if test x$have_gcc_atomics = xyes; then
icculus@5548
   310
        AC_DEFINE(HAVE_GCC_ATOMICS, 1, [ ])
slouken@5071
   311
    else
slouken@5071
   312
        # See if we have the minimum operation needed for GCC atomics
slouken@5071
   313
        AC_TRY_LINK([
slouken@5071
   314
        ],[
slouken@5071
   315
        int a;
slouken@5071
   316
        __sync_lock_test_and_set(&a, 1);
slouken@5095
   317
        __sync_lock_release(&a);
slouken@5071
   318
        ],[
slouken@5071
   319
        have_gcc_sync_lock_test_and_set=yes
slouken@5071
   320
        ])
slouken@5071
   321
        if test x$have_gcc_sync_lock_test_and_set = xyes; then
icculus@5548
   322
            AC_DEFINE(HAVE_GCC_SYNC_LOCK_TEST_AND_SET, 1, [ ])
slouken@5071
   323
        fi
slouken@5069
   324
    fi
slouken@5004
   325
fi
slouken@5004
   326
slouken@1361
   327
# Standard C sources
slouken@1361
   328
SOURCES="$SOURCES $srcdir/src/*.c"
slouken@5154
   329
SOURCES="$SOURCES $srcdir/src/atomic/*.c"
slouken@1361
   330
SOURCES="$SOURCES $srcdir/src/audio/*.c"
slouken@1361
   331
SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c"
icculus@8094
   332
SOURCES="$SOURCES $srcdir/src/dynapi/*.c"
slouken@1361
   333
SOURCES="$SOURCES $srcdir/src/events/*.c"
slouken@1361
   334
SOURCES="$SOURCES $srcdir/src/file/*.c"
slouken@7307
   335
SOURCES="$SOURCES $srcdir/src/haptic/*.c"
slouken@7307
   336
SOURCES="$SOURCES $srcdir/src/joystick/*.c"
slouken@6594
   337
SOURCES="$SOURCES $srcdir/src/libm/*.c"
slouken@7307
   338
SOURCES="$SOURCES $srcdir/src/power/*.c"
icculus@7667
   339
#SOURCES="$SOURCES $srcdir/src/filesystem/*.c"
slouken@5154
   340
SOURCES="$SOURCES $srcdir/src/render/*.c"
slouken@5154
   341
SOURCES="$SOURCES $srcdir/src/render/*/*.c"
slouken@1361
   342
SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
slouken@1361
   343
SOURCES="$SOURCES $srcdir/src/thread/*.c"
slouken@1361
   344
SOURCES="$SOURCES $srcdir/src/timer/*.c"
slouken@1361
   345
SOURCES="$SOURCES $srcdir/src/video/*.c"
slouken@11702
   346
SOURCES="$SOURCES $srcdir/src/video/yuv2rgb/*.c"
slouken@1361
   347
slouken@0
   348
dnl Enable/disable various subsystems of the SDL library
slouken@0
   349
bob@3199
   350
AC_ARG_ENABLE(atomic,
bob@3199
   351
AC_HELP_STRING([--enable-atomic], [Enable the atomic operations subsystem [[default=yes]]]),
bob@3199
   352
              , enable_atomic=yes)
bob@3199
   353
if test x$enable_atomic != xyes; then
icculus@5548
   354
    AC_DEFINE(SDL_ATOMIC_DISABLED, 1, [ ])
urkle@8124
   355
else
urkle@8124
   356
    SUMMARY_modules="${SUMMARY_modules} atomic"
bob@3199
   357
fi
slouken@0
   358
AC_ARG_ENABLE(audio,
slouken@1637
   359
AC_HELP_STRING([--enable-audio], [Enable the audio subsystem [[default=yes]]]),
slouken@0
   360
              , enable_audio=yes)
slouken@1361
   361
if test x$enable_audio != xyes; then
icculus@5548
   362
    AC_DEFINE(SDL_AUDIO_DISABLED, 1, [ ])
urkle@8124
   363
else
urkle@8124
   364
    SUMMARY_modules="${SUMMARY_modules} audio"
slouken@0
   365
fi
slouken@0
   366
AC_ARG_ENABLE(video,
slouken@1637
   367
AC_HELP_STRING([--enable-video], [Enable the video subsystem [[default=yes]]]),
slouken@0
   368
              , enable_video=yes)
slouken@1361
   369
if test x$enable_video != xyes; then
icculus@5548
   370
    AC_DEFINE(SDL_VIDEO_DISABLED, 1, [ ])
urkle@8124
   371
else
urkle@8124
   372
    SUMMARY_modules="${SUMMARY_modules} video"
slouken@0
   373
fi
slouken@5226
   374
AC_ARG_ENABLE(render,
slouken@5226
   375
AC_HELP_STRING([--enable-render], [Enable the render subsystem [[default=yes]]]),
slouken@5226
   376
              , enable_render=yes)
slouken@5226
   377
if test x$enable_render != xyes; then
icculus@5548
   378
    AC_DEFINE(SDL_RENDER_DISABLED, 1, [ ])
urkle@8124
   379
else
urkle@8124
   380
    SUMMARY_modules="${SUMMARY_modules} render"
slouken@5226
   381
fi
slouken@0
   382
AC_ARG_ENABLE(events,
slouken@1637
   383
AC_HELP_STRING([--enable-events], [Enable the events subsystem [[default=yes]]]),
slouken@0
   384
              , enable_events=yes)
slouken@1361
   385
if test x$enable_events != xyes; then
icculus@5548
   386
    AC_DEFINE(SDL_EVENTS_DISABLED, 1, [ ])
urkle@8124
   387
else
urkle@8124
   388
    SUMMARY_modules="${SUMMARY_modules} events"
slouken@0
   389
fi
slouken@0
   390
AC_ARG_ENABLE(joystick,
slouken@1637
   391
AC_HELP_STRING([--enable-joystick], [Enable the joystick subsystem [[default=yes]]]),
slouken@0
   392
              , enable_joystick=yes)
slouken@1361
   393
if test x$enable_joystick != xyes; then
icculus@5548
   394
    AC_DEFINE(SDL_JOYSTICK_DISABLED, 1, [ ])
urkle@8124
   395
else
urkle@8124
   396
    SUMMARY_modules="${SUMMARY_modules} joystick"
slouken@0
   397
fi
slouken@2713
   398
AC_ARG_ENABLE(haptic,
slouken@2713
   399
AC_HELP_STRING([--enable-haptic], [Enable the haptic (force feedback) subsystem [[default=yes]]]),
slouken@2713
   400
              , enable_haptic=yes)
slouken@2713
   401
if test x$enable_haptic != xyes; then
icculus@5548
   402
    AC_DEFINE(SDL_HAPTIC_DISABLED, 1, [ ])
urkle@8124
   403
else
urkle@8124
   404
    SUMMARY_modules="${SUMMARY_modules} haptic"
slouken@2713
   405
fi
icculus@3170
   406
AC_ARG_ENABLE(power,
icculus@3170
   407
AC_HELP_STRING([--enable-power], [Enable the power subsystem [[default=yes]]]),
icculus@3170
   408
              , enable_power=yes)
icculus@3170
   409
if test x$enable_power != xyes; then
icculus@5548
   410
    AC_DEFINE(SDL_POWER_DISABLED, 1, [ ])
urkle@8124
   411
else
urkle@8124
   412
    SUMMARY_modules="${SUMMARY_modules} power"
icculus@3170
   413
fi
icculus@7667
   414
AC_ARG_ENABLE(filesystem,
icculus@7667
   415
AC_HELP_STRING([--enable-filesystem], [Enable the filesystem subsystem [[default=yes]]]),
icculus@7667
   416
              , enable_filesystem=yes)
icculus@7667
   417
if test x$enable_filesystem != xyes; then
icculus@7667
   418
    AC_DEFINE(SDL_FILESYSTEM_DISABLED, 1, [ ])
urkle@8124
   419
else
urkle@8124
   420
    SUMMARY_modules="${SUMMARY_modules} filesystem"
icculus@7667
   421
fi
slouken@0
   422
AC_ARG_ENABLE(threads,
slouken@1637
   423
AC_HELP_STRING([--enable-threads], [Enable the threading subsystem [[default=yes]]]),
slouken@0
   424
              , enable_threads=yes)
slouken@0
   425
if test x$enable_threads != xyes; then
icculus@5548
   426
    AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ])
urkle@8124
   427
else
urkle@8124
   428
    SUMMARY_modules="${SUMMARY_modules} threads"
slouken@0
   429
fi
slouken@0
   430
AC_ARG_ENABLE(timers,
slouken@1637
   431
AC_HELP_STRING([--enable-timers], [Enable the timer subsystem [[default=yes]]]),
slouken@0
   432
              , enable_timers=yes)
slouken@1361
   433
if test x$enable_timers != xyes; then
icculus@5548
   434
    AC_DEFINE(SDL_TIMERS_DISABLED, 1, [ ])
urkle@8124
   435
else
urkle@8124
   436
    SUMMARY_modules="${SUMMARY_modules} timers"
slouken@0
   437
fi
slouken@0
   438
AC_ARG_ENABLE(file,
slouken@1637
   439
AC_HELP_STRING([--enable-file], [Enable the file subsystem [[default=yes]]]),
slouken@0
   440
              , enable_file=yes)
slouken@1361
   441
if test x$enable_file != xyes; then
icculus@5548
   442
    AC_DEFINE(SDL_FILE_DISABLED, 1, [ ])
urkle@8124
   443
else
urkle@8124
   444
    SUMMARY_modules="${SUMMARY_modules} file"
slouken@1361
   445
fi
slouken@1361
   446
AC_ARG_ENABLE(loadso,
slouken@1637
   447
AC_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [[default=yes]]]),
slouken@1361
   448
              , enable_loadso=yes)
slouken@1361
   449
if test x$enable_loadso != xyes; then
icculus@5548
   450
    AC_DEFINE(SDL_LOADSO_DISABLED, 1, [ ])
urkle@8124
   451
else
urkle@8124
   452
    SUMMARY_modules="${SUMMARY_modules} loadso"
slouken@0
   453
fi
slouken@740
   454
AC_ARG_ENABLE(cpuinfo,
slouken@1637
   455
AC_HELP_STRING([--enable-cpuinfo], [Enable the cpuinfo subsystem [[default=yes]]]),
slouken@740
   456
              , enable_cpuinfo=yes)
slouken@1361
   457
if test x$enable_cpuinfo != xyes; then
icculus@5548
   458
    AC_DEFINE(SDL_CPUINFO_DISABLED, 1, [ ])
urkle@8124
   459
else
urkle@8124
   460
    SUMMARY_modules="${SUMMARY_modules} cpuinfo"
slouken@5225
   461
fi
slouken@1402
   462
AC_ARG_ENABLE(assembly,
slouken@1637
   463
AC_HELP_STRING([--enable-assembly], [Enable assembly routines [[default=yes]]]),
slouken@1402
   464
              , enable_assembly=yes)
slouken@1402
   465
if test x$enable_assembly = xyes; then
urkle@8124
   466
    SUMMARY_modules="${SUMMARY_modules} assembly"
urkle@8124
   467
icculus@5548
   468
    AC_DEFINE(SDL_ASSEMBLY_ROUTINES, 1, [ ])
slouken@2247
   469
slouken@2856
   470
    # Make sure that we don't generate floating point code that would
slouken@2856
   471
    # cause illegal instruction exceptions on older processors
slouken@2856
   472
    case "$host" in
slouken@2856
   473
        *-*-darwin*)
slouken@2856
   474
            # Don't need to worry about Apple hardware, it's all SSE capable
slouken@2856
   475
            default_ssemath=yes
slouken@2856
   476
            ;;
slouken@2856
   477
        *64-*-*)
slouken@2856
   478
            # x86 64-bit architectures all have SSE instructions
slouken@2856
   479
            default_ssemath=yes
slouken@2856
   480
            ;;
slouken@3392
   481
        *)
slouken@2856
   482
            default_ssemath=no
slouken@2856
   483
            ;;
slouken@2856
   484
    esac
slouken@2856
   485
    AC_ARG_ENABLE(ssemath,
icculus@10847
   486
AC_HELP_STRING([--enable-ssemath], [Allow GCC to use SSE floating point math [[default=maybe]]]),
slouken@2856
   487
                  , enable_ssemath=$default_ssemath)
slouken@2856
   488
    if test x$enable_ssemath = xno; then
icculus@10847
   489
        if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes -o x$have_gcc_sse3 = xyes; then
slouken@2856
   490
            EXTRA_CFLAGS="$EXTRA_CFLAGS -mfpmath=387"
slouken@2856
   491
        fi
slouken@2856
   492
    fi
slouken@2856
   493
slouken@2247
   494
    dnl Check for various instruction support
slouken@2247
   495
    AC_ARG_ENABLE(mmx,
slouken@2247
   496
AC_HELP_STRING([--enable-mmx], [use MMX assembly routines [[default=yes]]]),
slouken@2247
   497
                  , enable_mmx=yes)
slouken@2247
   498
    if test x$enable_mmx = xyes; then
slouken@2247
   499
        save_CFLAGS="$CFLAGS"
slouken@2247
   500
        have_gcc_mmx=no
slouken@2247
   501
        AC_MSG_CHECKING(for GCC -mmmx option)
slouken@2247
   502
        mmx_CFLAGS="-mmmx"
slouken@2247
   503
        CFLAGS="$save_CFLAGS $mmx_CFLAGS"
slouken@2247
   504
slouken@2247
   505
        AC_TRY_COMPILE([
slouken@4426
   506
        #ifdef __MINGW32__
slouken@4426
   507
        #include <_mingw.h>
slouken@4426
   508
        #ifdef __MINGW64_VERSION_MAJOR
slouken@4426
   509
        #include <intrin.h>
slouken@4426
   510
        #else
slouken@2247
   511
        #include <mmintrin.h>
slouken@4426
   512
        #endif
slouken@4426
   513
        #else
slouken@4426
   514
        #include <mmintrin.h>
slouken@4426
   515
        #endif
slouken@2261
   516
        #ifndef __MMX__
slouken@2261
   517
        #error Assembler CPP flag not enabled
slouken@2261
   518
        #endif
slouken@2247
   519
        ],[
slouken@2247
   520
        ],[
slouken@2247
   521
        have_gcc_mmx=yes
slouken@2247
   522
        ])
slouken@2247
   523
        AC_MSG_RESULT($have_gcc_mmx)
slouken@2290
   524
        CFLAGS="$save_CFLAGS"
slouken@2247
   525
slouken@2247
   526
        if test x$have_gcc_mmx = xyes; then
slouken@2247
   527
            EXTRA_CFLAGS="$EXTRA_CFLAGS $mmx_CFLAGS"
urkle@8124
   528
            SUMMARY_math="${SUMMARY_math} mmx"
slouken@2247
   529
        fi
slouken@2247
   530
    fi
slouken@2247
   531
slouken@5389
   532
    AC_ARG_ENABLE(3dnow,
slouken@6444
   533
AC_HELP_STRING([--enable-3dnow], [use 3DNow! assembly routines [[default=yes]]]),
slouken@5389
   534
                  , enable_3dnow=yes)
slouken@5389
   535
    if test x$enable_3dnow = xyes; then
slouken@5389
   536
        save_CFLAGS="$CFLAGS"
slouken@5389
   537
        have_gcc_3dnow=no
slouken@5389
   538
        AC_MSG_CHECKING(for GCC -m3dnow option)
slouken@5389
   539
        amd3dnow_CFLAGS="-m3dnow"
slouken@5389
   540
        CFLAGS="$save_CFLAGS $amd3dnow_CFLAGS"
slouken@5389
   541
slouken@6443
   542
        AC_TRY_LINK([
slouken@5389
   543
        #include <mm3dnow.h>
slouken@5389
   544
        #ifndef __3dNOW__
slouken@5389
   545
        #error Assembler CPP flag not enabled
slouken@5389
   546
        #endif
slouken@5389
   547
        ],[
slouken@6443
   548
        void *p = 0;
slouken@6443
   549
        _m_prefetch(p);
slouken@5389
   550
        ],[
slouken@5389
   551
        have_gcc_3dnow=yes
slouken@5389
   552
        ])
slouken@5389
   553
        AC_MSG_RESULT($have_gcc_3dnow)
slouken@5389
   554
        CFLAGS="$save_CFLAGS"
slouken@5389
   555
slouken@5389
   556
        if test x$have_gcc_3dnow = xyes; then
slouken@5389
   557
            EXTRA_CFLAGS="$EXTRA_CFLAGS $amd3dnow_CFLAGS"
urkle@8124
   558
            SUMMARY_math="${SUMMARY_math} 3dnow"
slouken@5389
   559
        fi
slouken@5389
   560
    fi
slouken@5389
   561
slouken@2247
   562
    AC_ARG_ENABLE(sse,
slouken@2247
   563
AC_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]),
slouken@2247
   564
                  , enable_sse=yes)
slouken@2247
   565
    if test x$enable_sse = xyes; then
slouken@2247
   566
        save_CFLAGS="$CFLAGS"
slouken@2247
   567
        have_gcc_sse=no
slouken@2247
   568
        AC_MSG_CHECKING(for GCC -msse option)
slouken@2247
   569
        sse_CFLAGS="-msse"
slouken@2247
   570
        CFLAGS="$save_CFLAGS $sse_CFLAGS"
slouken@2247
   571
slouken@2247
   572
        AC_TRY_COMPILE([
slouken@4426
   573
        #ifdef __MINGW32__
slouken@4426
   574
        #include <_mingw.h>
slouken@4426
   575
        #ifdef __MINGW64_VERSION_MAJOR
slouken@4426
   576
        #include <intrin.h>
slouken@4426
   577
        #else
slouken@2247
   578
        #include <xmmintrin.h>
slouken@4426
   579
        #endif
slouken@4426
   580
        #else
slouken@4426
   581
        #include <xmmintrin.h>
slouken@4426
   582
        #endif
slouken@2261
   583
        #ifndef __SSE__
slouken@2261
   584
        #error Assembler CPP flag not enabled
slouken@2261
   585
        #endif
slouken@2247
   586
        ],[
slouken@2247
   587
        ],[
slouken@2247
   588
        have_gcc_sse=yes
slouken@2247
   589
        ])
slouken@2247
   590
        AC_MSG_RESULT($have_gcc_sse)
slouken@2290
   591
        CFLAGS="$save_CFLAGS"
slouken@2247
   592
slouken@2247
   593
        if test x$have_gcc_sse = xyes; then
slouken@2247
   594
            EXTRA_CFLAGS="$EXTRA_CFLAGS $sse_CFLAGS"
urkle@8124
   595
            SUMMARY_math="${SUMMARY_math} sse"
slouken@2247
   596
        fi
slouken@2247
   597
    fi
slouken@2247
   598
slouken@2264
   599
    AC_ARG_ENABLE(sse2,
icculus@10835
   600
AC_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=maybe]]]),
slouken@2856
   601
                  , enable_sse2=$default_ssemath)
slouken@2264
   602
    if test x$enable_sse2 = xyes; then
slouken@2264
   603
        save_CFLAGS="$CFLAGS"
slouken@2264
   604
        have_gcc_sse2=no
slouken@2264
   605
        AC_MSG_CHECKING(for GCC -msse2 option)
slouken@2264
   606
        sse2_CFLAGS="-msse2"
slouken@2264
   607
        CFLAGS="$save_CFLAGS $sse2_CFLAGS"
slouken@2264
   608
slouken@2264
   609
        AC_TRY_COMPILE([
slouken@4426
   610
        #ifdef __MINGW32__
slouken@4426
   611
        #include <_mingw.h>
slouken@4426
   612
        #ifdef __MINGW64_VERSION_MAJOR
slouken@4426
   613
        #include <intrin.h>
slouken@4426
   614
        #else
slouken@2264
   615
        #include <emmintrin.h>
slouken@4426
   616
        #endif
slouken@4426
   617
        #else
slouken@4426
   618
        #include <emmintrin.h>
slouken@4426
   619
        #endif
slouken@2264
   620
        #ifndef __SSE2__
slouken@2264
   621
        #error Assembler CPP flag not enabled
slouken@2264
   622
        #endif
slouken@2264
   623
        ],[
slouken@2264
   624
        ],[
slouken@2264
   625
        have_gcc_sse2=yes
slouken@2264
   626
        ])
slouken@2264
   627
        AC_MSG_RESULT($have_gcc_sse2)
slouken@2290
   628
        CFLAGS="$save_CFLAGS"
slouken@2264
   629
slouken@2264
   630
        if test x$have_gcc_sse2 = xyes; then
slouken@2264
   631
            EXTRA_CFLAGS="$EXTRA_CFLAGS $sse2_CFLAGS"
urkle@8124
   632
            SUMMARY_math="${SUMMARY_math} sse2"
slouken@2264
   633
        fi
slouken@2264
   634
    fi
slouken@5389
   635
icculus@10835
   636
    AC_ARG_ENABLE(sse3,
icculus@10835
   637
AC_HELP_STRING([--enable-sse3], [use SSE3 assembly routines [[default=maybe]]]),
icculus@10835
   638
                  , enable_sse3=$default_ssemath)
icculus@10835
   639
    if test x$enable_sse3 = xyes; then
icculus@10835
   640
        save_CFLAGS="$CFLAGS"
icculus@10835
   641
        have_gcc_sse3=no
icculus@10835
   642
        AC_MSG_CHECKING(for GCC -msse3 option)
icculus@10835
   643
        sse3_CFLAGS="-msse3"
icculus@10835
   644
        CFLAGS="$save_CFLAGS $sse3_CFLAGS"
icculus@10835
   645
icculus@10835
   646
        AC_TRY_COMPILE([
icculus@10835
   647
        #ifdef __MINGW32__
icculus@10835
   648
        #include <_mingw.h>
icculus@10835
   649
        #ifdef __MINGW64_VERSION_MAJOR
icculus@10835
   650
        #include <intrin.h>
icculus@10835
   651
        #else
icculus@10835
   652
        #include <pmmintrin.h>
icculus@10835
   653
        #endif
icculus@10835
   654
        #else
icculus@10835
   655
        #include <pmmintrin.h>
icculus@10835
   656
        #endif
icculus@10835
   657
        #ifndef __SSE2__
icculus@10835
   658
        #error Assembler CPP flag not enabled
icculus@10835
   659
        #endif
icculus@10835
   660
        ],[
icculus@10835
   661
        ],[
icculus@10835
   662
        have_gcc_sse3=yes
icculus@10835
   663
        ])
icculus@10835
   664
        AC_MSG_RESULT($have_gcc_sse3)
icculus@10835
   665
        CFLAGS="$save_CFLAGS"
icculus@10835
   666
icculus@10835
   667
        if test x$have_gcc_sse3 = xyes; then
icculus@10835
   668
            EXTRA_CFLAGS="$EXTRA_CFLAGS $sse3_CFLAGS"
icculus@10835
   669
            SUMMARY_math="${SUMMARY_math} sse3"
icculus@10835
   670
        fi
icculus@10835
   671
    fi
icculus@10835
   672
slouken@5389
   673
    AC_ARG_ENABLE(altivec,
slouken@5389
   674
AC_HELP_STRING([--enable-altivec], [use Altivec assembly routines [[default=yes]]]),
slouken@5389
   675
                  , enable_altivec=yes)
slouken@5389
   676
    if test x$enable_altivec = xyes; then
slouken@5389
   677
        save_CFLAGS="$CFLAGS"
slouken@5389
   678
        have_gcc_altivec=no
slouken@5389
   679
        have_altivec_h_hdr=no
slouken@5389
   680
        altivec_CFLAGS="-maltivec"
slouken@5389
   681
        CFLAGS="$save_CFLAGS $altivec_CFLAGS"
slouken@5389
   682
slouken@5389
   683
        AC_MSG_CHECKING(for Altivec with GCC altivec.h and -maltivec option)
slouken@5389
   684
        AC_TRY_COMPILE([
slouken@5389
   685
        #include <altivec.h>
slouken@5389
   686
        vector unsigned int vzero() {
slouken@5389
   687
            return vec_splat_u32(0);
slouken@5389
   688
        }
slouken@5389
   689
        ],[
slouken@5389
   690
        ],[
slouken@5389
   691
        have_gcc_altivec=yes
slouken@5389
   692
        have_altivec_h_hdr=yes
slouken@5389
   693
        ])
slouken@5389
   694
        AC_MSG_RESULT($have_gcc_altivec)
slouken@5389
   695
slouken@5389
   696
        if test x$have_gcc_altivec = xno; then
slouken@5389
   697
            AC_MSG_CHECKING(for Altivec with GCC -maltivec option)
slouken@5389
   698
            AC_TRY_COMPILE([
slouken@5389
   699
            vector unsigned int vzero() {
slouken@5389
   700
                return vec_splat_u32(0);
slouken@5389
   701
            }
slouken@5389
   702
            ],[
slouken@5389
   703
            ],[
slouken@5389
   704
            have_gcc_altivec=yes
slouken@5389
   705
            ])
slouken@5389
   706
            AC_MSG_RESULT($have_gcc_altivec)
slouken@5389
   707
        fi
slouken@5389
   708
slouken@5389
   709
        if test x$have_gcc_altivec = xno; then
slouken@5389
   710
            AC_MSG_CHECKING(for Altivec with GCC altivec.h and -faltivec option)
slouken@5389
   711
            altivec_CFLAGS="-faltivec"
slouken@5389
   712
            CFLAGS="$save_CFLAGS $altivec_CFLAGS"
slouken@5389
   713
            AC_TRY_COMPILE([
slouken@5389
   714
            #include <altivec.h>
slouken@5389
   715
            vector unsigned int vzero() {
slouken@5389
   716
                return vec_splat_u32(0);
slouken@5389
   717
            }
slouken@5389
   718
            ],[
slouken@5389
   719
            ],[
slouken@5389
   720
            have_gcc_altivec=yes
slouken@5389
   721
            have_altivec_h_hdr=yes
slouken@5389
   722
            ])
slouken@5389
   723
            AC_MSG_RESULT($have_gcc_altivec)
slouken@5389
   724
        fi
slouken@5389
   725
slouken@5389
   726
        if test x$have_gcc_altivec = xno; then
slouken@5389
   727
            AC_MSG_CHECKING(for Altivec with GCC -faltivec option)
slouken@5389
   728
            AC_TRY_COMPILE([
slouken@5389
   729
            vector unsigned int vzero() {
slouken@5389
   730
                return vec_splat_u32(0);
slouken@5389
   731
            }
slouken@5389
   732
            ],[
slouken@5389
   733
            ],[
slouken@5389
   734
            have_gcc_altivec=yes
slouken@5389
   735
            ])
slouken@5389
   736
            AC_MSG_RESULT($have_gcc_altivec)
slouken@5389
   737
        fi
slouken@5389
   738
        CFLAGS="$save_CFLAGS"
slouken@5389
   739
slouken@5389
   740
        if test x$have_gcc_altivec = xyes; then
icculus@5548
   741
            AC_DEFINE(SDL_ALTIVEC_BLITTERS, 1, [ ])
slouken@5389
   742
            if test x$have_altivec_h_hdr = xyes; then
icculus@5548
   743
              AC_DEFINE(HAVE_ALTIVEC_H, 1, [ ])
slouken@5389
   744
            fi
slouken@5389
   745
            EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS"
urkle@8124
   746
            SUMMARY_math="${SUMMARY_math} altivec"
slouken@5389
   747
        fi
slouken@5389
   748
    fi
slouken@740
   749
fi
slouken@0
   750
slouken@0
   751
dnl See if the OSS audio interface is supported
slouken@0
   752
CheckOSS()
slouken@0
   753
{
slouken@0
   754
    AC_ARG_ENABLE(oss,
icculus@7380
   755
AC_HELP_STRING([--enable-oss], [support the OSS audio API [[default=maybe]]]),
icculus@7380
   756
                  , enable_oss=maybe)
icculus@7380
   757
icculus@7380
   758
    # OpenBSD "has" OSS, but it's not really for app use. They want you to
icculus@7380
   759
    #  use sndio instead. So on there, we default to disabled. You can force
icculus@7380
   760
    #  it on if you really want, though.
icculus@7380
   761
    if test x$enable_oss = xmaybe; then
icculus@7380
   762
        enable_oss=yes
icculus@7380
   763
        case "$host" in
icculus@7380
   764
            *-*-openbsd*)
icculus@7380
   765
                enable_oss=no;;
slouken@7391
   766
        esac
icculus@7380
   767
    fi
icculus@7380
   768
slouken@0
   769
    if test x$enable_audio = xyes -a x$enable_oss = xyes; then
slouken@0
   770
        AC_MSG_CHECKING(for OSS audio support)
slouken@0
   771
        have_oss=no
slouken@94
   772
        if test x$have_oss != xyes; then
slouken@94
   773
            AC_TRY_COMPILE([
slouken@94
   774
              #include <sys/soundcard.h>
slouken@94
   775
            ],[
slouken@94
   776
              int arg = SNDCTL_DSP_SETFRAGMENT;
slouken@94
   777
            ],[
slouken@94
   778
            have_oss=yes
slouken@94
   779
            ])
slouken@94
   780
        fi
slouken@94
   781
        if test x$have_oss != xyes; then
slouken@94
   782
            AC_TRY_COMPILE([
slouken@94
   783
              #include <soundcard.h>
slouken@94
   784
            ],[
slouken@94
   785
              int arg = SNDCTL_DSP_SETFRAGMENT;
slouken@94
   786
            ],[
slouken@94
   787
            have_oss=yes
icculus@5548
   788
            AC_DEFINE(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H, 1, [ ])
slouken@94
   789
            ])
slouken@94
   790
        fi
slouken@0
   791
        AC_MSG_RESULT($have_oss)
slouken@0
   792
        if test x$have_oss = xyes; then
urkle@8124
   793
            SUMMARY_audio="${SUMMARY_audio} oss"
icculus@5548
   794
            AC_DEFINE(SDL_AUDIO_DRIVER_OSS, 1, [ ])
slouken@1361
   795
            SOURCES="$SOURCES $srcdir/src/audio/dsp/*.c"
slouken@1361
   796
            have_audio=yes
slouken@1361
   797
slouken@1565
   798
            # We may need to link with ossaudio emulation library
slouken@1550
   799
            case "$host" in
slouken@1383
   800
                *-*-openbsd*|*-*-netbsd*)
slouken@1521
   801
                    EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";;
slouken@1361
   802
            esac
slouken@0
   803
        fi
slouken@0
   804
    fi
slouken@0
   805
}
slouken@0
   806
slouken@0
   807
dnl See if the ALSA audio interface is supported
slouken@0
   808
CheckALSA()
slouken@0
   809
{
slouken@0
   810
    AC_ARG_ENABLE(alsa,
slouken@1637
   811
AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [[default=yes]]]),
slouken@0
   812
                  , enable_alsa=yes)
slouken@0
   813
    if test x$enable_audio = xyes -a x$enable_alsa = xyes; then
slouken@10490
   814
        AM_PATH_ALSA(1.0.11, have_alsa=yes, have_alsa=no)
slouken@1009
   815
        # Restore all flags from before the ALSA detection runs
slouken@1009
   816
        CFLAGS="$alsa_save_CFLAGS"
slouken@1009
   817
        LDFLAGS="$alsa_save_LDFLAGS"
slouken@1009
   818
        LIBS="$alsa_save_LIBS"
slouken@354
   819
        if test x$have_alsa = xyes; then
slouken@865
   820
            AC_ARG_ENABLE(alsa-shared,
slouken@1637
   821
AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [[default=yes]]]),
slouken@1361
   822
                          , enable_alsa_shared=yes)
slouken@3391
   823
            alsa_lib=[`find_lib "libasound.so.*" "$ALSA_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@1361
   824
icculus@5548
   825
            AC_DEFINE(SDL_AUDIO_DRIVER_ALSA, 1, [ ])
slouken@1361
   826
            SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c"
slouken@1521
   827
            EXTRA_CFLAGS="$EXTRA_CFLAGS $ALSA_CFLAGS"
slouken@1361
   828
            if test x$have_loadso != xyes && \
slouken@1361
   829
               test x$enable_alsa_shared = xyes; then
slouken@1467
   830
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ALSA loading])
slouken@1361
   831
            fi
slouken@1361
   832
            if test x$have_loadso = xyes && \
slouken@1361
   833
               test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
slouken@3392
   834
                echo "-- dynamic libasound -> $alsa_lib"
icculus@5548
   835
                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ALSA_DYNAMIC, "$alsa_lib", [ ])
urkle@8124
   836
                SUMMARY_audio="${SUMMARY_audio} alsa(dynamic)"
slouken@1361
   837
            else
slouken@1521
   838
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ALSA_LIBS"
urkle@8124
   839
                SUMMARY_audio="${SUMMARY_audio} alsa"
slouken@1361
   840
            fi
slouken@1361
   841
            have_audio=yes
slouken@1361
   842
        fi
slouken@1361
   843
    fi
slouken@0
   844
}
slouken@0
   845
icculus@11081
   846
dnl Find JACK Audio
icculus@11081
   847
CheckJACK()
icculus@11081
   848
{
icculus@11081
   849
    AC_ARG_ENABLE(jack,
icculus@11081
   850
AC_HELP_STRING([--enable-jack], [use JACK audio [[default=yes]]]),
icculus@11081
   851
                  , enable_jack=yes)
icculus@11081
   852
    if test x$enable_audio = xyes -a x$enable_jack = xyes; then
icculus@11081
   853
        audio_jack=no
icculus@11081
   854
icculus@11081
   855
        JACK_REQUIRED_VERSION=0.125
icculus@11081
   856
icculus@11081
   857
        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
icculus@11081
   858
        AC_MSG_CHECKING(for JACK $JACK_REQUIRED_VERSION support)
icculus@11081
   859
        if test x$PKG_CONFIG != xno; then
icculus@11081
   860
        if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $JACK_REQUIRED_VERSION jack; then
icculus@11081
   861
                JACK_CFLAGS=`$PKG_CONFIG --cflags jack`
icculus@11081
   862
                JACK_LIBS=`$PKG_CONFIG --libs jack`
icculus@11081
   863
                audio_jack=yes
icculus@11081
   864
            fi
icculus@11081
   865
        fi
icculus@11081
   866
        AC_MSG_RESULT($audio_jack)
icculus@11081
   867
icculus@11081
   868
        if test x$audio_jack = xyes; then
icculus@11081
   869
            AC_ARG_ENABLE(jack-shared,
icculus@11081
   870
AC_HELP_STRING([--enable-jack-shared], [dynamically load JACK audio support [[default=yes]]]),
icculus@11081
   871
                          , enable_jack_shared=yes)
icculus@11081
   872
            jack_lib=[`find_lib "libjack.so.*" "$JACK_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
icculus@11081
   873
icculus@11081
   874
            AC_DEFINE(SDL_AUDIO_DRIVER_JACK, 1, [ ])
icculus@11081
   875
            SOURCES="$SOURCES $srcdir/src/audio/jack/*.c"
icculus@11081
   876
            EXTRA_CFLAGS="$EXTRA_CFLAGS $JACK_CFLAGS"
icculus@11081
   877
            if test x$have_loadso != xyes && \
icculus@11081
   878
               test x$enable_jack_shared = xyes; then
icculus@11081
   879
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic JACK audio loading])
icculus@11081
   880
            fi
icculus@11081
   881
            if test x$have_loadso = xyes && \
icculus@11081
   882
               test x$enable_jack_shared = xyes && test x$jack_lib != x; then
icculus@11081
   883
                echo "-- dynamic libjack -> $jack_lib"
icculus@11081
   884
                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_JACK_DYNAMIC, "$jack_lib", [ ])
icculus@11081
   885
                SUMMARY_audio="${SUMMARY_audio} jack(dynamic)"
icculus@11081
   886
icculus@11081
   887
                case "$host" in
icculus@11081
   888
                    # On Solaris, jack must be linked deferred explicitly
icculus@11081
   889
                    # to prevent undefined symbol failures.
icculus@11081
   890
                    *-*-solaris*)
icculus@11081
   891
                        JACK_LIBS=`echo $JACK_LIBS | sed 's/\-l/-Wl,-l/g'`
icculus@11081
   892
                        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-zdeferred $JACK_LIBS -Wl,-znodeferred"
icculus@11081
   893
                esac
icculus@11081
   894
            else
icculus@11081
   895
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $JACK_LIBS"
icculus@11081
   896
                SUMMARY_audio="${SUMMARY_audio} jack"
icculus@11081
   897
            fi
icculus@11081
   898
            have_audio=yes
icculus@11081
   899
        fi
icculus@11081
   900
    fi
icculus@11081
   901
}
icculus@11081
   902
slouken@0
   903
dnl Find the ESD includes and libraries
slouken@0
   904
CheckESD()
slouken@0
   905
{
slouken@0
   906
    AC_ARG_ENABLE(esd,
slouken@1637
   907
AC_HELP_STRING([--enable-esd], [support the Enlightened Sound Daemon [[default=yes]]]),
slouken@0
   908
                  , enable_esd=yes)
slouken@0
   909
    if test x$enable_audio = xyes -a x$enable_esd = xyes; then
slouken@948
   910
        AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no)
slouken@948
   911
        if test x$have_esd = xyes; then
slouken@294
   912
            AC_ARG_ENABLE(esd-shared,
slouken@1637
   913
AC_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [[default=yes]]]),
slouken@678
   914
                          , enable_esd_shared=yes)
slouken@3391
   915
            esd_lib=[`find_lib "libesd.so.*" "$ESD_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@1467
   916
icculus@5548
   917
            AC_DEFINE(SDL_AUDIO_DRIVER_ESD, 1, [ ])
slouken@1467
   918
            SOURCES="$SOURCES $srcdir/src/audio/esd/*.c"
slouken@1521
   919
            EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS"
icculus@1173
   920
            if test x$have_loadso != xyes && \
slouken@296
   921
               test x$enable_esd_shared = xyes; then
slouken@1467
   922
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ESD loading])
slouken@296
   923
            fi
icculus@1173
   924
            if test x$have_loadso = xyes && \
slouken@294
   925
               test x$enable_esd_shared = xyes && test x$esd_lib != x; then
slouken@3392
   926
                echo "-- dynamic libesd -> $esd_lib"
icculus@5548
   927
                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ESD_DYNAMIC, "$esd_lib", [ ])
urkle@8124
   928
                SUMMARY_audio="${SUMMARY_audio} esd(dynamic)"
slouken@1467
   929
            else
slouken@1521
   930
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ESD_LIBS"
urkle@8124
   931
                SUMMARY_audio="${SUMMARY_audio} esd"
slouken@294
   932
            fi
slouken@1361
   933
            have_audio=yes
slouken@294
   934
        fi
slouken@0
   935
    fi
slouken@0
   936
}
slouken@0
   937
icculus@2271
   938
dnl Find PulseAudio
icculus@2271
   939
CheckPulseAudio()
icculus@2271
   940
{
icculus@2271
   941
    AC_ARG_ENABLE(pulseaudio,
icculus@2271
   942
AC_HELP_STRING([--enable-pulseaudio], [use PulseAudio [[default=yes]]]),
icculus@2271
   943
                  , enable_pulseaudio=yes)
icculus@2271
   944
    if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then
icculus@2271
   945
        audio_pulseaudio=no
icculus@2271
   946
icculus@2271
   947
        PULSEAUDIO_REQUIRED_VERSION=0.9
icculus@2271
   948
icculus@2271
   949
        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
icculus@2271
   950
        AC_MSG_CHECKING(for PulseAudio $PULSEAUDIO_REQUIRED_VERSION support)
icculus@2271
   951
        if test x$PKG_CONFIG != xno; then
icculus@2271
   952
        if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSEAUDIO_REQUIRED_VERSION libpulse-simple; then
icculus@2271
   953
                PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple`
icculus@2271
   954
                PULSEAUDIO_LIBS=`$PKG_CONFIG --libs libpulse-simple`
icculus@2271
   955
                audio_pulseaudio=yes
slouken@3391
   956
            fi
icculus@2271
   957
        fi
icculus@2271
   958
        AC_MSG_RESULT($audio_pulseaudio)
icculus@2271
   959
icculus@2271
   960
        if test x$audio_pulseaudio = xyes; then
icculus@2271
   961
            AC_ARG_ENABLE(pulseaudio-shared,
icculus@2271
   962
AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [[default=yes]]]),
icculus@2271
   963
                          , enable_pulseaudio_shared=yes)
slouken@3391
   964
            pulseaudio_lib=[`find_lib "libpulse-simple.so.*" "$PULSEAUDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
icculus@2271
   965
icculus@5548
   966
            AC_DEFINE(SDL_AUDIO_DRIVER_PULSEAUDIO, 1, [ ])
icculus@2271
   967
            SOURCES="$SOURCES $srcdir/src/audio/pulseaudio/*.c"
icculus@2271
   968
            EXTRA_CFLAGS="$EXTRA_CFLAGS $PULSEAUDIO_CFLAGS"
icculus@2271
   969
            if test x$have_loadso != xyes && \
icculus@2271
   970
               test x$enable_pulseaudio_shared = xyes; then
icculus@2271
   971
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic PulseAudio loading])
icculus@2271
   972
            fi
icculus@2271
   973
            if test x$have_loadso = xyes && \
icculus@2271
   974
               test x$enable_pulseaudio_shared = xyes && test x$pulseaudio_lib != x; then
slouken@3392
   975
                echo "-- dynamic libpulse-simple -> $pulseaudio_lib"
icculus@5548
   976
                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC, "$pulseaudio_lib", [ ])
urkle@8124
   977
                SUMMARY_audio="${SUMMARY_audio} pulse(dynamic)"
eviltypeguy@6967
   978
eviltypeguy@6967
   979
                case "$host" in
eviltypeguy@6967
   980
                    # On Solaris, pulseaudio must be linked deferred explicitly
eviltypeguy@6967
   981
                    # to prevent undefined symbol failures.
eviltypeguy@6967
   982
                    *-*-solaris*)
eviltypeguy@6967
   983
                        PULSEAUDIO_LIBS=`echo $PULSEAUDIO_LIBS | sed 's/\-l/-Wl,-l/g'`
eviltypeguy@6967
   984
                        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-zdeferred $PULSEAUDIO_LIBS -Wl,-znodeferred"
eviltypeguy@6967
   985
                esac
icculus@2271
   986
            else
icculus@2271
   987
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PULSEAUDIO_LIBS"
urkle@8124
   988
                SUMMARY_audio="${SUMMARY_audio} pulse"
icculus@2271
   989
            fi
icculus@2271
   990
            have_audio=yes
icculus@2271
   991
        fi
icculus@2271
   992
    fi
icculus@2271
   993
}
icculus@2271
   994
slouken@0
   995
CheckARTSC()
slouken@0
   996
{
slouken@0
   997
    AC_ARG_ENABLE(arts,
slouken@1637
   998
AC_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [[default=yes]]]),
slouken@0
   999
                  , enable_arts=yes)
slouken@0
  1000
    if test x$enable_audio = xyes -a x$enable_arts = xyes; then
slouken@1361
  1001
        AC_PATH_PROG(ARTSCONFIG, artsc-config)
slouken@1361
  1002
        if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then
slouken@0
  1003
            : # arts isn't installed
slouken@0
  1004
        else
slouken@1361
  1005
            ARTS_CFLAGS=`$ARTSCONFIG --cflags`
slouken@1361
  1006
            ARTS_LIBS=`$ARTSCONFIG --libs`
slouken@0
  1007
            AC_MSG_CHECKING(for aRts development environment)
slouken@0
  1008
            audio_arts=no
slouken@0
  1009
            save_CFLAGS="$CFLAGS"
slouken@1361
  1010
            CFLAGS="$CFLAGS $ARTS_CFLAGS"
slouken@0
  1011
            AC_TRY_COMPILE([
slouken@0
  1012
             #include <artsc.h>
slouken@0
  1013
            ],[
slouken@0
  1014
             arts_stream_t stream;
slouken@0
  1015
            ],[
slouken@0
  1016
            audio_arts=yes
slouken@0
  1017
            ])
slouken@0
  1018
            CFLAGS="$save_CFLAGS"
slouken@0
  1019
            AC_MSG_RESULT($audio_arts)
slouken@0
  1020
            if test x$audio_arts = xyes; then
slouken@294
  1021
                AC_ARG_ENABLE(arts-shared,
slouken@1637
  1022
AC_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [[default=yes]]]),
slouken@678
  1023
                              , enable_arts_shared=yes)
slouken@3391
  1024
                arts_lib=[`find_lib "libartsc.so.*" "$ARTS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@1467
  1025
icculus@5548
  1026
                AC_DEFINE(SDL_AUDIO_DRIVER_ARTS, 1, [ ])
slouken@1467
  1027
                SOURCES="$SOURCES $srcdir/src/audio/arts/*.c"
slouken@1521
  1028
                EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS"
icculus@1173
  1029
                if test x$have_loadso != xyes && \
slouken@296
  1030
                   test x$enable_arts_shared = xyes; then
slouken@1467
  1031
                    AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ARTS loading])
slouken@296
  1032
                fi
icculus@1173
  1033
                if test x$have_loadso = xyes && \
slouken@294
  1034
                   test x$enable_arts_shared = xyes && test x$arts_lib != x; then
slouken@3392
  1035
                    echo "-- dynamic libartsc -> $arts_lib"
icculus@5548
  1036
                    AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ARTS_DYNAMIC, "$arts_lib", [ ])
urkle@8124
  1037
                    SUMMARY_audio="${SUMMARY_audio} arts(dynamic)"
slouken@1467
  1038
                else
slouken@1521
  1039
                    EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS"
urkle@8124
  1040
                    SUMMARY_audio="${SUMMARY_audio} arts"
slouken@294
  1041
                fi
slouken@1361
  1042
                have_audio=yes
slouken@0
  1043
            fi
slouken@0
  1044
        fi
slouken@0
  1045
    fi
slouken@0
  1046
}
slouken@0
  1047
slouken@0
  1048
dnl See if the NAS audio interface is supported
slouken@0
  1049
CheckNAS()
slouken@0
  1050
{
slouken@0
  1051
    AC_ARG_ENABLE(nas,
slouken@1637
  1052
AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]),
slouken@41
  1053
                  , enable_nas=yes)
slouken@0
  1054
    if test x$enable_audio = xyes -a x$enable_nas = xyes; then
icculus@2049
  1055
        AC_CHECK_HEADER(audio/audiolib.h, have_nas_hdr=yes)
icculus@2049
  1056
        AC_CHECK_LIB(audio, AuOpenServer, have_nas_lib=yes)
icculus@2049
  1057
slouken@41
  1058
        AC_MSG_CHECKING(for NAS audio support)
slouken@41
  1059
        have_nas=no
icculus@2049
  1060
icculus@2049
  1061
        if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then
icculus@2049
  1062
            have_nas=yes
icculus@2049
  1063
            NAS_LIBS="-laudio"
icculus@2049
  1064
icculus@2049
  1065
        elif test -r /usr/X11R6/include/audio/audiolib.h; then
slouken@41
  1066
            have_nas=yes
slouken@1361
  1067
            NAS_CFLAGS="-I/usr/X11R6/include/"
slouken@1520
  1068
            NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt"
slouken@605
  1069
slouken@41
  1070
        fi
icculus@2049
  1071
slouken@605
  1072
        AC_MSG_RESULT($have_nas)
icculus@2049
  1073
slouken@1361
  1074
        if test x$have_nas = xyes; then
icculus@2049
  1075
            AC_ARG_ENABLE(nas-shared,
icculus@2049
  1076
AC_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[default=yes]]]),
icculus@2049
  1077
                          , enable_nas_shared=yes)
slouken@3391
  1078
            nas_lib=[`find_lib "libaudio.so.*" "$NAS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
icculus@2049
  1079
icculus@2049
  1080
            if test x$have_loadso != xyes && \
icculus@2049
  1081
               test x$enable_nas_shared = xyes; then
icculus@2049
  1082
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic NAS loading])
icculus@2049
  1083
            fi
icculus@2049
  1084
            if test x$have_loadso = xyes && \
slouken@2163
  1085
               test x$enable_nas_shared = xyes && test x$nas_lib != x; then
slouken@3392
  1086
                echo "-- dynamic libaudio -> $nas_lib"
icculus@5548
  1087
                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_NAS_DYNAMIC, "$nas_lib", [ ])
urkle@8124
  1088
                SUMMARY_audio="${SUMMARY_audio} nas(dynamic)"
icculus@2049
  1089
            else
icculus@2049
  1090
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS"
urkle@8124
  1091
                SUMMARY_audio="${SUMMARY_audio} nas"
icculus@2049
  1092
            fi
icculus@2049
  1093
icculus@5548
  1094
            AC_DEFINE(SDL_AUDIO_DRIVER_NAS, 1, [ ])
slouken@1361
  1095
            SOURCES="$SOURCES $srcdir/src/audio/nas/*.c"
slouken@1521
  1096
            EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS"
slouken@1361
  1097
            have_audio=yes
slouken@1361
  1098
        fi
slouken@0
  1099
    fi
slouken@0
  1100
}
slouken@0
  1101
icculus@7367
  1102
dnl See if the sndio audio interface is supported
icculus@7367
  1103
CheckSNDIO()
icculus@7367
  1104
{
icculus@7367
  1105
    AC_ARG_ENABLE(sndio,
icculus@7367
  1106
AC_HELP_STRING([--enable-sndio], [support the sndio audio API [[default=yes]]]),
icculus@7367
  1107
                  , enable_sndio=yes)
icculus@7367
  1108
    if test x$enable_audio = xyes -a x$enable_sndio = xyes; then
icculus@7367
  1109
        AC_CHECK_HEADER(sndio.h, have_sndio_hdr=yes)
icculus@7367
  1110
        AC_CHECK_LIB(sndio, sio_open, have_sndio_lib=yes)
icculus@7367
  1111
icculus@7367
  1112
        AC_MSG_CHECKING(for sndio audio support)
icculus@7367
  1113
        have_sndio=no
icculus@7367
  1114
icculus@7367
  1115
        if test x$have_sndio_hdr = xyes -a x$have_sndio_lib = xyes; then
icculus@7367
  1116
            have_sndio=yes
icculus@7367
  1117
            SNDIO_LIBS="-lsndio"
icculus@7367
  1118
        fi
icculus@7367
  1119
icculus@7367
  1120
        AC_MSG_RESULT($have_sndio)
icculus@7367
  1121
icculus@7367
  1122
        if test x$have_sndio = xyes; then
icculus@7367
  1123
            AC_ARG_ENABLE(sndio-shared,
icculus@7367
  1124
AC_HELP_STRING([--enable-sndio-shared], [dynamically load sndio audio support [[default=yes]]]),
icculus@7367
  1125
                          , enable_sndio_shared=yes)
icculus@7367
  1126
            sndio_lib=[`find_lib "libsndio.so.*" "$SNDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
icculus@7367
  1127
icculus@7367
  1128
            if test x$have_loadso != xyes && \
icculus@7367
  1129
               test x$enable_sndio_shared = xyes; then
icculus@7367
  1130
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic sndio loading])
icculus@7367
  1131
            fi
icculus@7367
  1132
            if test x$have_loadso = xyes && \
icculus@7367
  1133
               test x$enable_sndio_shared = xyes && test x$sndio_lib != x; then
icculus@7367
  1134
                echo "-- dynamic libsndio -> $sndio_lib"
icculus@7367
  1135
                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC, "$sndio_lib", [ ])
urkle@8124
  1136
                SUMMARY_audio="${SUMMARY_audio} sndio(dynamic)"
icculus@7367
  1137
            else
icculus@7367
  1138
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SNDIO_LIBS"
urkle@8124
  1139
                SUMMARY_audio="${SUMMARY_audio} sndio"
icculus@7367
  1140
            fi
icculus@7367
  1141
icculus@7367
  1142
            AC_DEFINE(SDL_AUDIO_DRIVER_SNDIO, 1, [ ])
icculus@7367
  1143
            SOURCES="$SOURCES $srcdir/src/audio/sndio/*.c"
icculus@7367
  1144
            EXTRA_CFLAGS="$EXTRA_CFLAGS $SNDIO_CFLAGS"
icculus@7367
  1145
            have_audio=yes
icculus@7367
  1146
        fi
icculus@7367
  1147
    fi
icculus@7367
  1148
}
icculus@7367
  1149
slouken@10777
  1150
dnl Find FusionSound
slouken@10777
  1151
CheckFusionSound()
slouken@10777
  1152
{
slouken@10777
  1153
    AC_ARG_ENABLE(fusionsound,
slouken@10777
  1154
AC_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]),
slouken@10777
  1155
                  , enable_fusionsound=no)
slouken@10777
  1156
    if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then
slouken@10777
  1157
        fusionsound=no
slouken@10777
  1158
slouken@10777
  1159
        FUSIONSOUND_REQUIRED_VERSION=1.1.1
slouken@10777
  1160
slouken@10777
  1161
        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
slouken@10777
  1162
        AC_MSG_CHECKING(for FusionSound $FUSIONSOUND_REQUIRED_VERSION support)
slouken@10777
  1163
        if test x$PKG_CONFIG != xno; then
slouken@10777
  1164
            if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then
slouken@10777
  1165
                FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound`
slouken@10777
  1166
                FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound`
slouken@10777
  1167
                fusionsound=yes
slouken@10777
  1168
            fi
slouken@10777
  1169
        fi
slouken@10777
  1170
        AC_MSG_RESULT($fusionsound)
slouken@10777
  1171
slouken@10777
  1172
        if test x$fusionsound = xyes; then
slouken@10777
  1173
            AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND, 1, [ ])
slouken@10777
  1174
            SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c"
slouken@10777
  1175
            EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS"
slouken@10777
  1176
            
slouken@10777
  1177
            AC_ARG_ENABLE(fusionsound-shared,
slouken@10777
  1178
AC_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]),
slouken@10777
  1179
                          , enable_fusionsound_shared=yes)
slouken@10777
  1180
            fusionsound_shared=no
slouken@10777
  1181
            AC_MSG_CHECKING(for FusionSound dynamic loading support)
slouken@10777
  1182
            if test x$have_loadso != xyes && \
slouken@10777
  1183
               test x$enable_fusionsound_shared = xyes; then
slouken@10777
  1184
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading])
slouken@10777
  1185
            fi
slouken@10777
  1186
            if test x$have_loadso = xyes && \
slouken@10777
  1187
               test x$enable_fusionsound_shared = xyes; then
slouken@10777
  1188
                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so", [ ])
slouken@10777
  1189
                fusionsound_shared=yes
slouken@10777
  1190
                SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)"
slouken@10777
  1191
            else
slouken@10777
  1192
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS"
slouken@10777
  1193
                SUMMARY_audio="${SUMMARY_audio} fusionsound"
slouken@10777
  1194
            fi
slouken@10777
  1195
            AC_MSG_RESULT($fusionsound_shared)
slouken@10777
  1196
            
slouken@10777
  1197
            have_audio=yes
slouken@10777
  1198
        fi
slouken@10777
  1199
    fi
slouken@10777
  1200
}
slouken@10777
  1201
slouken@68
  1202
dnl rcg07142001 See if the user wants the disk writer audio driver...
slouken@68
  1203
CheckDiskAudio()
slouken@68
  1204
{
slouken@68
  1205
    AC_ARG_ENABLE(diskaudio,
slouken@1637
  1206
AC_HELP_STRING([--enable-diskaudio], [support the disk writer audio driver [[default=yes]]]),
slouken@86
  1207
                  , enable_diskaudio=yes)
slouken@68
  1208
    if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
icculus@5548
  1209
        AC_DEFINE(SDL_AUDIO_DRIVER_DISK, 1, [ ])
slouken@1361
  1210
        SOURCES="$SOURCES $srcdir/src/audio/disk/*.c"
urkle@8124
  1211
        SUMMARY_audio="${SUMMARY_audio} disk"
slouken@68
  1212
    fi
slouken@68
  1213
}
slouken@68
  1214
icculus@1532
  1215
dnl rcg03142006 See if the user wants the dummy audio driver...
icculus@1532
  1216
CheckDummyAudio()
icculus@1532
  1217
{
icculus@1532
  1218
    AC_ARG_ENABLE(dummyaudio,
slouken@1637
  1219
AC_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [[default=yes]]]),
icculus@1532
  1220
                  , enable_dummyaudio=yes)
icculus@1532
  1221
    if test x$enable_audio = xyes -a x$enable_dummyaudio = xyes; then
icculus@5548
  1222
        AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY, 1, [ ])
icculus@1532
  1223
        SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c"
urkle@8124
  1224
        SUMMARY_audio="${SUMMARY_audio} dummy"
icculus@1532
  1225
    fi
icculus@1532
  1226
}
icculus@1532
  1227
slouken@10777
  1228
dnl See if libsamplerate is available
slouken@10777
  1229
CheckLibSampleRate()
slouken@10777
  1230
{
slouken@10777
  1231
    AC_ARG_ENABLE(libsamplerate,
slouken@10777
  1232
AC_HELP_STRING([--enable-libsamplerate], [use libsamplerate for audio rate conversion [[default=yes]]]),
slouken@10777
  1233
                  , enable_libsamplerate=yes)
slouken@10777
  1234
    if test x$enable_libsamplerate = xyes; then
slouken@10777
  1235
        AC_CHECK_HEADER(samplerate.h,
slouken@10777
  1236
                        have_samplerate_h_hdr=yes,
slouken@10777
  1237
                        have_samplerate_h_hdr=no)
slouken@10777
  1238
        if test x$have_samplerate_h_hdr = xyes; then
slouken@10777
  1239
            AC_DEFINE(HAVE_LIBSAMPLERATE_H, 1, [ ])
slouken@10777
  1240
slouken@10777
  1241
            AC_ARG_ENABLE(libsamplerate-shared,
slouken@10777
  1242
AC_HELP_STRING([--enable-libsamplerate-shared], [dynamically load libsamplerate [[default=yes]]]),
slouken@10777
  1243
                          , enable_libsamplerate_shared=yes)
slouken@10777
  1244
slouken@10787
  1245
            samplerate_lib=[`find_lib "libsamplerate.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@10787
  1246
slouken@10787
  1247
            if test x$have_loadso != xyes && \
slouken@10787
  1248
               test x$enable_libsamplerate_shared = xyes; then
slouken@10787
  1249
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic libsamplerate loading])
slouken@10787
  1250
            fi
slouken@10787
  1251
            if test x$have_loadso = xyes && \
slouken@10787
  1252
               test x$enable_libsamplerate_shared = xyes && test x$samplerate_lib != x; then
slouken@10787
  1253
                echo "-- dynamic libsamplerate -> $samplerate_lib"
slouken@10787
  1254
                AC_DEFINE_UNQUOTED(SDL_LIBSAMPLERATE_DYNAMIC, "$samplerate_lib", [ ])
slouken@10787
  1255
            else
slouken@10787
  1256
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lsamplerate"
slouken@10777
  1257
            fi
slouken@10777
  1258
        fi
slouken@10777
  1259
    fi
slouken@10777
  1260
}
slouken@10777
  1261
icculus@1573
  1262
dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
icculus@1573
  1263
dnl  Details of this flag are here: http://gcc.gnu.org/wiki/Visibility
icculus@1573
  1264
CheckVisibilityHidden()
icculus@1573
  1265
{
icculus@1573
  1266
    AC_MSG_CHECKING(for GCC -fvisibility=hidden option)
icculus@1573
  1267
    have_gcc_fvisibility=no
icculus@1573
  1268
icculus@1573
  1269
    visibility_CFLAGS="-fvisibility=hidden"
icculus@1573
  1270
    save_CFLAGS="$CFLAGS"
slouken@2292
  1271
    CFLAGS="$save_CFLAGS $visibility_CFLAGS -Werror"
icculus@1573
  1272
    AC_TRY_COMPILE([
slouken@1745
  1273
    #if !defined(__GNUC__) || __GNUC__ < 4
slouken@1745
  1274
    #error SDL only uses visibility attributes in GCC 4 or newer
slouken@1745
  1275
    #endif
icculus@1573
  1276
    ],[
icculus@1573
  1277
    ],[
icculus@1573
  1278
    have_gcc_fvisibility=yes
icculus@1573
  1279
    ])
icculus@1573
  1280
    AC_MSG_RESULT($have_gcc_fvisibility)
icculus@1573
  1281
    CFLAGS="$save_CFLAGS"
icculus@1573
  1282
icculus@1573
  1283
    if test x$have_gcc_fvisibility = xyes; then
slouken@1574
  1284
        EXTRA_CFLAGS="$EXTRA_CFLAGS $visibility_CFLAGS"
icculus@1573
  1285
    fi
icculus@1573
  1286
}
icculus@1573
  1287
slouken@6116
  1288
dnl See if GCC's -mpreferred-stack-boundary is supported.
slouken@6116
  1289
dnl  Reference: http://bugzilla.libsdl.org/show_bug.cgi?id=1296
slouken@6116
  1290
CheckStackBoundary()
slouken@6116
  1291
{
slouken@6116
  1292
    AC_MSG_CHECKING(for GCC -mpreferred-stack-boundary option)
slouken@6116
  1293
    have_gcc_preferred_stack_boundary=no
slouken@6116
  1294
slouken@6116
  1295
    save_CFLAGS="$CFLAGS"
slouken@6116
  1296
    CFLAGS="$save_CFLAGS -mpreferred-stack-boundary=2"
slouken@6116
  1297
    AC_TRY_COMPILE([
slouken@6116
  1298
    int x = 0;
slouken@6116
  1299
    ],[
slouken@6116
  1300
    ],[
slouken@6116
  1301
    have_gcc_preferred_stack_boundary=yes
slouken@6116
  1302
    ])
slouken@6116
  1303
    AC_MSG_RESULT($have_gcc_preferred_stack_boundary)
slouken@6116
  1304
    CFLAGS="$save_CFLAGS"
slouken@6116
  1305
slouken@6116
  1306
    if test x$have_gcc_preferred_stack_boundary = xyes; then
slouken@6116
  1307
        EXTRA_CFLAGS="$EXTRA_CFLAGS -mpreferred-stack-boundary=2"
slouken@6116
  1308
    fi
slouken@6116
  1309
}
slouken@6116
  1310
icculus@10009
  1311
dnl See if GCC's -Wdeclaration-after-statement is supported.
icculus@10009
  1312
dnl  This lets us catch things that would fail on a C89 compiler when using
icculus@10009
  1313
dnl  a modern GCC.
icculus@10009
  1314
CheckDeclarationAfterStatement()
icculus@10009
  1315
{
icculus@10009
  1316
    AC_MSG_CHECKING(for GCC -Wdeclaration-after-statement option)
icculus@10009
  1317
    have_gcc_declaration_after_statement=no
icculus@10009
  1318
icculus@10009
  1319
    save_CFLAGS="$CFLAGS"
icculus@10009
  1320
    CFLAGS="$save_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement"
icculus@10009
  1321
    AC_TRY_COMPILE([
icculus@10009
  1322
    int x = 0;
icculus@10009
  1323
    ],[
icculus@10009
  1324
    ],[
icculus@10009
  1325
    have_gcc_declaration_after_statement=yes
icculus@10009
  1326
    ])
icculus@10009
  1327
    AC_MSG_RESULT($have_gcc_declaration_after_statement)
icculus@10009
  1328
    CFLAGS="$save_CFLAGS"
icculus@10009
  1329
icculus@10009
  1330
    if test x$have_gcc_declaration_after_statement = xyes; then
icculus@10009
  1331
        EXTRA_CFLAGS="$EXTRA_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement"
icculus@10009
  1332
    fi
icculus@10009
  1333
}
icculus@10009
  1334
icculus@5975
  1335
dnl See if GCC's -Wall is supported.
icculus@5975
  1336
CheckWarnAll()
icculus@5975
  1337
{
icculus@5975
  1338
    AC_MSG_CHECKING(for GCC -Wall option)
icculus@5975
  1339
    have_gcc_Wall=no
icculus@5975
  1340
icculus@5975
  1341
    save_CFLAGS="$CFLAGS"
icculus@5975
  1342
    CFLAGS="$save_CFLAGS -Wall"
icculus@5975
  1343
    AC_TRY_COMPILE([
icculus@5975
  1344
    int x = 0;
icculus@5975
  1345
    ],[
icculus@5975
  1346
    ],[
icculus@5975
  1347
    have_gcc_Wall=yes
icculus@5975
  1348
    ])
icculus@5975
  1349
    AC_MSG_RESULT($have_gcc_Wall)
icculus@5975
  1350
    CFLAGS="$save_CFLAGS"
icculus@5975
  1351
icculus@5975
  1352
    if test x$have_gcc_Wall = xyes; then
icculus@5975
  1353
        EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall"
icculus@5989
  1354
icculus@5989
  1355
        dnl Haiku headers use multicharacter constants all over the place. Ignore these warnings when using -Wall.
icculus@5989
  1356
        AC_MSG_CHECKING(for necessary GCC -Wno-multichar option)
icculus@5989
  1357
        need_gcc_Wno_multichar=no
icculus@5989
  1358
        case "$host" in
icculus@7981
  1359
            *-*-haiku*)
icculus@5989
  1360
                need_gcc_Wno_multichar=yes
icculus@5989
  1361
                ;;
icculus@5989
  1362
        esac
icculus@5989
  1363
        AC_MSG_RESULT($need_gcc_Wno_multichar)
icculus@5989
  1364
        if test x$need_gcc_Wno_multichar = xyes; then
icculus@5989
  1365
            EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-multichar"
icculus@5989
  1366
        fi
icculus@5975
  1367
    fi
icculus@5975
  1368
}
icculus@5975
  1369
gabomdq@8062
  1370
dnl Check for Wayland
gabomdq@8062
  1371
CheckWayland()
gabomdq@8062
  1372
{
gabomdq@8062
  1373
    AC_ARG_ENABLE(video-wayland,
gabomdq@8062
  1374
AC_HELP_STRING([--enable-video-wayland], [use Wayland video driver [[default=yes]]]),
brandon@8680
  1375
                  ,enable_video_wayland=yes)
gabomdq@8062
  1376
gabomdq@8082
  1377
    AC_ARG_ENABLE(video-wayland-qt-touch,
gabomdq@8082
  1378
AC_HELP_STRING([--enable-video-wayland-qt-touch], [QtWayland server support for Wayland video driver [[default=yes]]]),
gabomdq@8082
  1379
                  ,enable_video_wayland_qt_touch=yes)
gabomdq@8082
  1380
gabomdq@8062
  1381
    if test x$enable_video = xyes -a x$enable_video_wayland = xyes; then
gabomdq@8062
  1382
        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
gabomdq@8062
  1383
        AC_MSG_CHECKING(for Wayland support)
gabomdq@8062
  1384
        video_wayland=no
gabomdq@8774
  1385
        if  test x$PKG_CONFIG != xno && \
gabomdq@8774
  1386
            test x$video_opengl_egl = xyes && \
gabomdq@8774
  1387
            test x$video_opengles_v2 = xyes; then
slouken@10304
  1388
            if $PKG_CONFIG --exists wayland-client wayland-scanner wayland-protocols wayland-egl wayland-cursor egl xkbcommon ; then
gabomdq@8104
  1389
                WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon`
gabomdq@8104
  1390
                WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon`
jadahl@10303
  1391
                WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner`
jadahl@10303
  1392
                WAYLAND_CORE_PROTOCOL_DIR=`$PKG_CONFIG --variable=pkgdatadir wayland-client`
slouken@10304
  1393
                WAYLAND_PROTOCOLS_DIR=`$PKG_CONFIG --variable=pkgdatadir wayland-protocols`
gabomdq@8062
  1394
                video_wayland=yes
gabomdq@8062
  1395
            fi
gabomdq@8062
  1396
        fi
gabomdq@8062
  1397
        AC_MSG_RESULT($video_wayland)
gabomdq@8062
  1398
gabomdq@8062
  1399
        if test x$video_wayland = xyes; then
gabomdq@8062
  1400
            AC_DEFINE(SDL_VIDEO_DRIVER_WAYLAND, 1, [ ])
gabomdq@8082
  1401
            if test x$enable_video_wayland_qt_touch = xyes; then
gabomdq@8082
  1402
                AC_DEFINE(SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH, 1, [ ])
gabomdq@8082
  1403
            fi
slouken@10304
  1404
slouken@10304
  1405
            WAYLAND_PROTOCOLS_UNSTABLE="relative-pointer-unstable-v1 pointer-constraints-unstable-v1"
slouken@10304
  1406
gabomdq@8062
  1407
            SOURCES="$SOURCES $srcdir/src/video/wayland/*.c"
jadahl@10303
  1408
            EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS -I\$(gen)"
gabomdq@8104
  1409
            AC_ARG_ENABLE(wayland-shared,
gabomdq@8104
  1410
AC_HELP_STRING([--enable-wayland-shared], [dynamically load Wayland support [[default=maybe]]]),
gabomdq@8104
  1411
                          , enable_wayland_shared=maybe)
gabomdq@8104
  1412
gabomdq@8104
  1413
            dnl FIXME: Do BSD and OS X need special cases?
gabomdq@8104
  1414
            case "$host" in
gabomdq@8104
  1415
                *)
gabomdq@8104
  1416
                    wayland_client_lib=[`find_lib "libwayland-client.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
gabomdq@8104
  1417
                    wayland_egl_lib=[`find_lib "libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
gabomdq@8104
  1418
                    if test x$wayland_egl_lib = x; then
gabomdq@8104
  1419
                        dnl This works in Ubuntu 13.10, maybe others
gabomdq@8104
  1420
                        wayland_egl_lib=[`find_lib "mesa-egl/libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
gabomdq@8104
  1421
                    fi
gabomdq@8104
  1422
                    wayland_cursor_lib=[`find_lib "libwayland-cursor.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
gabomdq@8104
  1423
                    xkbcommon_lib=[`find_lib "libxkbcommon.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
gabomdq@8104
  1424
                    ;;
gabomdq@8104
  1425
            esac
gabomdq@8104
  1426
gabomdq@8104
  1427
            if test x$enable_wayland_shared = xmaybe; then
gabomdq@8104
  1428
                enable_wayland_shared=yes
gabomdq@8104
  1429
            fi
gabomdq@8104
  1430
            if test x$have_loadso != xyes && \
gabomdq@8104
  1431
               test x$enable_wayland_shared = xyes; then
icculus@8159
  1432
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic Wayland loading])
gabomdq@8104
  1433
                enable_wayland_shared=no
gabomdq@8104
  1434
            fi
gabomdq@8104
  1435
            if test x$have_loadso = xyes && \
gabomdq@8104
  1436
               test x$enable_wayland_shared = xyes && \
gabomdq@8104
  1437
               test x$wayland_client_lib != x && \
gabomdq@8104
  1438
               test x$wayland_egl_lib != x && \
gabomdq@8104
  1439
               test x$wayland_cursor_lib != x && \
gabomdq@8104
  1440
               test x$xkbcommon_lib != x; then
gabomdq@8104
  1441
                echo "-- dynamic libwayland-client -> $wayland_client_lib"
gabomdq@8104
  1442
                echo "-- dynamic libwayland-egl -> $wayland_egl_lib"
gabomdq@8104
  1443
                echo "-- dynamic libwayland-cursor -> $wayland_cursor_lib"
icculus@8159
  1444
                echo "-- dynamic libxkbcommon -> $xkbcommon_lib"
gabomdq@8104
  1445
                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC, "$wayland_client_lib", [ ])
gabomdq@8104
  1446
                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL, "$wayland_egl_lib", [ ])
gabomdq@8104
  1447
                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR, "$wayland_cursor_lib", [ ])
gabomdq@8104
  1448
                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON, "$xkbcommon_lib", [ ])
urkle@8124
  1449
                SUMMARY_video="${SUMMARY_video} wayland(dynamic)"
gabomdq@8104
  1450
            else
gabomdq@8104
  1451
                enable_wayland_shared=no
gabomdq@8104
  1452
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $WAYLAND_LIBS"
urkle@8124
  1453
                SUMMARY_video="${SUMMARY_video} wayland"
gabomdq@8104
  1454
            fi
gabomdq@8062
  1455
            have_video=yes
gabomdq@8062
  1456
        fi
gabomdq@8062
  1457
    fi
gabomdq@8062
  1458
}
icculus@1573
  1459
icculus@8159
  1460
dnl Check for Mir
icculus@8159
  1461
CheckMir()
icculus@8159
  1462
{
icculus@8159
  1463
    AC_ARG_ENABLE(video-mir,
icculus@8159
  1464
AC_HELP_STRING([--enable-video-mir], [use Mir video driver [[default=yes]]]),
brandon@8680
  1465
                  ,enable_video_mir=yes)
icculus@8159
  1466
icculus@8159
  1467
    if test x$enable_video = xyes -a x$enable_video_mir = xyes; then
icculus@8159
  1468
        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
icculus@8159
  1469
        AC_MSG_CHECKING(for Mir support)
icculus@8159
  1470
        video_mir=no
icculus@8159
  1471
        if test x$PKG_CONFIG != xno; then
icculus@8159
  1472
            if $PKG_CONFIG --exists mirclient egl xkbcommon ; then
icculus@8159
  1473
                MIR_CFLAGS=`$PKG_CONFIG --cflags mirclient egl xkbcommon`
icculus@8159
  1474
                MIR_LIBS=`$PKG_CONFIG --libs mirclient egl xkbcommon`
gabomdq@8774
  1475
                save_CFLAGS="$CFLAGS"
gabomdq@8774
  1476
                CFLAGS="$save_CFLAGS $MIR_CFLAGS"
bschaefer@10089
  1477
brandon@10921
  1478
                dnl This will disable Mir if >= v0.26 is not available
gabomdq@8774
  1479
                AC_TRY_COMPILE([
gabomdq@8774
  1480
                #include <mir_toolkit/mir_client_library.h>
gabomdq@8774
  1481
                ],[
brandon@10921
  1482
                    MirWindowAttrib attrib = mir_window_attrib_state
gabomdq@8774
  1483
                ],[
icculus@8159
  1484
                video_mir=yes
gabomdq@8774
  1485
                ])
gabomdq@8774
  1486
                CFLAGS="$save_CFLAGS"
icculus@8159
  1487
            fi
icculus@8159
  1488
        fi
icculus@8159
  1489
        AC_MSG_RESULT($video_mir)
icculus@8159
  1490
icculus@8159
  1491
        if test x$video_mir = xyes; then
icculus@8159
  1492
            AC_DEFINE(SDL_VIDEO_DRIVER_MIR, 1, [ ])
icculus@8159
  1493
            SOURCES="$SOURCES $srcdir/src/video/mir/*.c"
icculus@8159
  1494
            EXTRA_CFLAGS="$EXTRA_CFLAGS $MIR_CFLAGS"
icculus@8159
  1495
            AC_ARG_ENABLE(mir-shared,
icculus@8159
  1496
AC_HELP_STRING([--enable-mir-shared], [dynamically load Mir support [[default=maybe]]]),
icculus@8159
  1497
                          , enable_mir_shared=maybe)
icculus@8159
  1498
icculus@8159
  1499
            dnl FIXME: Do BSD and OS X need special cases?
icculus@8159
  1500
            case "$host" in
icculus@8159
  1501
                *)
icculus@8159
  1502
                    mirclient_lib=[`find_lib "libmirclient.so.*" "$MIR_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
icculus@8159
  1503
                    xkbcommon_lib=[`find_lib "libxkbcommon.so.*" "$MIR_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
icculus@8159
  1504
                    ;;
icculus@8159
  1505
            esac
icculus@8159
  1506
icculus@8159
  1507
            if test x$enable_mir_shared = xmaybe; then
icculus@8159
  1508
                enable_mir_shared=yes
icculus@8159
  1509
            fi
icculus@8159
  1510
            if test x$have_loadso != xyes && \
icculus@8159
  1511
               test x$enable_mir_shared = xyes; then
icculus@8159
  1512
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic Mir loading])
icculus@8159
  1513
                enable_mir_shared=no
icculus@8159
  1514
            fi
icculus@8159
  1515
            if test x$have_loadso = xyes && \
icculus@8159
  1516
               test x$enable_mir_shared = xyes && \
icculus@8159
  1517
               test x$mirclient_lib != x && \
icculus@8159
  1518
               test x$xkbcommon_lib != x; then
icculus@8159
  1519
                echo "-- dynamic libmirclient -> $mirclient_lib"
icculus@8159
  1520
                echo "-- dynamic libxkbcommon -> $xkbcommon_lib"
icculus@8159
  1521
                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_MIR_DYNAMIC, "$mirclient_lib", [ ])
icculus@8159
  1522
                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON, "$xkbcommon_lib", [ ])
icculus@8159
  1523
                SUMMARY_video="${SUMMARY_video} mir(dynamic)"
icculus@8159
  1524
            else
icculus@8159
  1525
                enable_mir_shared=no
icculus@8159
  1526
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MIR_LIBS"
icculus@8159
  1527
                SUMMARY_video="${SUMMARY_video} mir"
icculus@8159
  1528
            fi
icculus@8159
  1529
            have_video=yes
icculus@8159
  1530
        fi
icculus@8159
  1531
    fi
icculus@8159
  1532
}
icculus@8159
  1533
gabomdq@8833
  1534
dnl Check for Native Client stuff
gabomdq@8833
  1535
CheckNativeClient()
gabomdq@8833
  1536
{
gabomdq@8833
  1537
        AC_TRY_COMPILE([
gabomdq@8833
  1538
          #if !defined(__native_client__)
gabomdq@8833
  1539
          #error "NO NACL"
gabomdq@8833
  1540
          #endif
gabomdq@8833
  1541
        ],[
gabomdq@8833
  1542
        ],[
icculus@10984
  1543
        AC_DEFINE(SDL_VIDEO_DRIVER_NACL, 1, [ ])
icculus@10984
  1544
        AC_DEFINE(SDL_AUDIO_DRIVER_NACL, 1, [ ])
gabomdq@8833
  1545
        AC_DEFINE(HAVE_POW, 1, [ ])
gabomdq@8833
  1546
        AC_DEFINE(HAVE_OPENGLES2, 1, [ ])
gabomdq@8833
  1547
        AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
gabomdq@8833
  1548
        AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
gabomdq@8833
  1549
gabomdq@8833
  1550
        SDL_LIBS="-lppapi_simple -lppapi_gles2 $SDL_LIBS"
gabomdq@8833
  1551
gabomdq@8833
  1552
        SDLMAIN_SOURCES="$srcdir/src/main/nacl/*.c"
gabomdq@8833
  1553
        SOURCES="$SOURCES $srcdir/src/audio/nacl/*.c"
gabomdq@8833
  1554
        SUMMARY_audio="${SUMMARY_audio} nacl"
gabomdq@8833
  1555
        SOURCES="$SOURCES $srcdir/src/video/nacl/*.c"
gabomdq@8833
  1556
        SUMMARY_video="${SUMMARY_video} nacl opengles2"
gabomdq@8833
  1557
        ])
gabomdq@8833
  1558
}
gabomdq@8833
  1559
icculus@8159
  1560
slouken@11472
  1561
CheckRPI()
slouken@11472
  1562
{
slouken@11472
  1563
    AC_ARG_ENABLE(video-rpi,
slouken@11472
  1564
AC_HELP_STRING([--enable-video-rpi], [use Raspberry Pi video driver [[default=yes]]]),
slouken@11472
  1565
                  , enable_video_rpi=yes)
slouken@11472
  1566
    if test x$enable_video = xyes -a x$enable_video_rpi = xyes; then
slouken@11472
  1567
        if test x$ARCH = xnetbsd; then
slouken@11472
  1568
            RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux"
slouken@11472
  1569
            RPI_LDFLAGS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host"
slouken@11472
  1570
        else
slouken@11472
  1571
            RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
slouken@11472
  1572
            RPI_LDFLAGS="-L/opt/vc/lib -lbcm_host"
slouken@11472
  1573
        fi
slouken@11472
  1574
slouken@11472
  1575
        # Save the original compiler flags and libraries
slouken@11472
  1576
        ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
slouken@11472
  1577
slouken@11472
  1578
        # Add the Raspberry Pi compiler flags and libraries
slouken@11472
  1579
        CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_LDFLAGS"
slouken@11472
  1580
slouken@11472
  1581
        AC_MSG_CHECKING(for Raspberry Pi)
slouken@11472
  1582
        have_video_rpi=no
slouken@11472
  1583
        AC_TRY_LINK([
slouken@11472
  1584
          #include <bcm_host.h>
slouken@11472
  1585
        ],[
slouken@11472
  1586
          bcm_host_init();
slouken@11472
  1587
        ],[
slouken@11472
  1588
        have_video_rpi=yes
slouken@11472
  1589
        ],[
slouken@11472
  1590
        ])
slouken@11472
  1591
        AC_MSG_RESULT($have_video_rpi)
slouken@11472
  1592
slouken@11472
  1593
        # Restore the compiler flags and libraries
slouken@11472
  1594
        CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
slouken@11472
  1595
        
slouken@11472
  1596
        if test x$have_video_rpi = xyes; then
slouken@11472
  1597
            CFLAGS="$CFLAGS $RPI_CFLAGS"
slouken@11472
  1598
            SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
slouken@11472
  1599
            EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
slouken@11472
  1600
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LDFLAGS"
slouken@11472
  1601
            SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
slouken@11472
  1602
            AC_DEFINE(SDL_VIDEO_DRIVER_RPI, 1, [ ])
slouken@11472
  1603
            SUMMARY_video="${SUMMARY_video} rpi"
slouken@11472
  1604
        fi
slouken@11472
  1605
    fi
slouken@11472
  1606
}
slouken@11472
  1607
slouken@0
  1608
dnl Find the X11 include and library directories
slouken@0
  1609
CheckX11()
slouken@0
  1610
{
slouken@0
  1611
    AC_ARG_ENABLE(video-x11,
slouken@1637
  1612
AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]),
slouken@0
  1613
                  , enable_video_x11=yes)
slouken@0
  1614
    if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
slouken@1806
  1615
        case "$host" in
slouken@1807
  1616
            *-*-darwin*)
slouken@1807
  1617
                # This isn't necessary for X11, but fixes GLX detection
slouken@6445
  1618
                if test "x$x_includes" = xNONE && \
slouken@6445
  1619
                   test "x$x_libraries" = xNONE && \
slouken@6445
  1620
                   test -d /usr/X11R6/include && \
slouken@6445
  1621
                   test -d /usr/X11R6/lib; then
slouken@1806
  1622
                    x_includes="/usr/X11R6/include"
slouken@1806
  1623
                    x_libraries="/usr/X11R6/lib"
slouken@1806
  1624
                fi
slouken@1806
  1625
                ;;
slouken@1806
  1626
        esac
slouken@0
  1627
        AC_PATH_X
slouken@0
  1628
        AC_PATH_XTRA
slouken@0
  1629
        if test x$have_x = xyes; then
icculus@1168
  1630
            AC_ARG_ENABLE(x11-shared,
slouken@1879
  1631
AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=maybe]]]),
slouken@1879
  1632
                          , enable_x11_shared=maybe)
icculus@1168
  1633
slouken@1550
  1634
            case "$host" in
slouken@5471
  1635
                *-*-darwin*)
icculus@1174
  1636
                    x11_lib='/usr/X11R6/lib/libX11.6.dylib'
icculus@1174
  1637
                    x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
slouken@5471
  1638
                    xcursor_lib='/usr/X11R6/lib/libXcursor.1.dylib'
slouken@5408
  1639
                    xinerama_lib='/usr/X11R6/lib/libXinerama.1.dylib'
slouken@5408
  1640
                    xinput_lib='/usr/X11R6/lib/libXi.6.dylib'
slouken@5408
  1641
                    xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
slouken@1592
  1642
                    xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
slouken@5408
  1643
                    xss_lib='/usr/X11R6/lib/libXss.1.dylib'
slouken@5408
  1644
                    xvidmode_lib='/usr/X11R6/lib/libXxf86vm.1.dylib'
icculus@1174
  1645
                    ;;
slouken@6365
  1646
                *-*-openbsd*)
slouken@6365
  1647
                    x11_lib='libX11.so'
slouken@6365
  1648
                    x11ext_lib='libXext.so'
icculus@6385
  1649
                    xcursor_lib='libXcursor.so'
icculus@6385
  1650
                    xinerama_lib='libXinerama.so'
icculus@6385
  1651
                    xinput_lib='libXi.so'
icculus@6385
  1652
                    xrandr_lib='libXrandr.so'
slouken@6365
  1653
                    xrender_lib='libXrender.so'
icculus@6385
  1654
                    xss_lib='libXss.so'
icculus@6385
  1655
                    xvidmode_lib='libXxf86vm.so'
slouken@6365
  1656
                    ;;
icculus@1174
  1657
                *)
slouken@3391
  1658
                    x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@3391
  1659
                    x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@5471
  1660
                    xcursor_lib=[`find_lib "libXcursor.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@5408
  1661
                    xinerama_lib=[`find_lib "libXinerama.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@5408
  1662
                    xinput_lib=[`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@5408
  1663
                    xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@3391
  1664
                    xrender_lib=[`find_lib "libXrender.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@3391
  1665
                    xss_lib=[`find_lib "libXss.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@5408
  1666
                    xvidmode_lib=[`find_lib "libXxf86vm.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
icculus@1174
  1667
                    ;;
icculus@1174
  1668
            esac
icculus@1168
  1669
slouken@1361
  1670
            if test x$ac_cv_func_shmat != xyes; then
slouken@1361
  1671
                X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY"
slouken@1361
  1672
            fi
slouken@1799
  1673
            CFLAGS="$CFLAGS $X_CFLAGS"
slouken@1799
  1674
            LDFLAGS="$LDFLAGS $X_LIBS"
slouken@1468
  1675
slouken@7433
  1676
            AC_CHECK_HEADER(X11/extensions/Xext.h,
slouken@7433
  1677
                            have_xext_h_hdr=yes,
slouken@7433
  1678
                            have_xext_h_hdr=no,
slouken@7433
  1679
                            [#include <X11/Xlib.h>
slouken@7433
  1680
                             #include <X11/Xproto.h>
slouken@7433
  1681
                            ])
slouken@7433
  1682
            if test x$have_xext_h_hdr != xyes; then
slouken@7433
  1683
               AC_MSG_ERROR([
slouken@7433
  1684
*** Missing Xext.h, maybe you need to install the libxext-dev package?
slouken@7433
  1685
               ])
slouken@7433
  1686
            fi
slouken@7433
  1687
icculus@5548
  1688
            AC_DEFINE(SDL_VIDEO_DRIVER_X11, 1, [ ])
slouken@1468
  1689
            SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
slouken@1521
  1690
            EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
slouken@1879
  1691
slouken@7494
  1692
            # Needed so SDL applications can include SDL_syswm.h
slouken@7494
  1693
            SDL_CFLAGS="$SDL_CFLAGS $X_CFLAGS"
slouken@7494
  1694
slouken@1879
  1695
            if test x$enable_x11_shared = xmaybe; then
icculus@8016
  1696
                enable_x11_shared=yes
slouken@1879
  1697
            fi
icculus@1173
  1698
            if test x$have_loadso != xyes && \
icculus@1168
  1699
               test x$enable_x11_shared = xyes; then
slouken@1467
  1700
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic X11 loading])
icculus@1875
  1701
                enable_x11_shared=no
icculus@1168
  1702
            fi
icculus@1173
  1703
            if test x$have_loadso = xyes && \
icculus@1170
  1704
               test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then
icculus@1174
  1705
                echo "-- dynamic libX11 -> $x11_lib"
icculus@1174
  1706
                echo "-- dynamic libX11ext -> $x11ext_lib"
icculus@5548
  1707
                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib", [ ])
icculus@5548
  1708
                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib", [ ])
urkle@8124
  1709
                SUMMARY_video="${SUMMARY_video} x11(dynamic)"
icculus@1168
  1710
            else
icculus@1589
  1711
                enable_x11_shared=no
icculus@2763
  1712
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
urkle@8124
  1713
                SUMMARY_video="${SUMMARY_video} x11"
icculus@1168
  1714
            fi
slouken@1361
  1715
            have_video=yes
slouken@0
  1716
slouken@6313
  1717
            AC_MSG_CHECKING(for const parameter to XextAddDisplay)
slouken@6313
  1718
            have_const_param_XextAddDisplay=no
slouken@6313
  1719
            AC_TRY_COMPILE([
slouken@6313
  1720
              #include <X11/Xlib.h>
slouken@6313
  1721
              #include <X11/Xproto.h>
slouken@6313
  1722
              #include <X11/extensions/Xext.h>
slouken@6313
  1723
              #include <X11/extensions/extutil.h>
gabomdq@6327
  1724
              extern XExtDisplayInfo* XextAddDisplay(XExtensionInfo* a,Display* b,_Xconst char* c,XExtensionHooks* d,int e,XPointer f);
slouken@6313
  1725
            ],[
slouken@6313
  1726
            ],[
slouken@6313
  1727
            have_const_param_XextAddDisplay=yes
icculus@10984
  1728
            AC_DEFINE([SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY], 1, [ ])
slouken@6313
  1729
            ])
slouken@6313
  1730
            AC_MSG_RESULT($have_const_param_XextAddDisplay)
slouken@6313
  1731
slouken@6362
  1732
            dnl AC_CHECK_LIB(X11, XGetEventData, AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS, 1, [Have XGenericEvent]))
slouken@6362
  1733
            AC_MSG_CHECKING([for XGenericEvent])
slouken@6362
  1734
            have_XGenericEvent=no
slouken@6362
  1735
            AC_TRY_COMPILE([
slouken@6362
  1736
              	#include <X11/Xlib.h>
slouken@6362
  1737
            ],[
slouken@6362
  1738
Display *display;
slouken@6362
  1739
XEvent event;
slouken@6362
  1740
XGenericEventCookie *cookie = &event.xcookie;
slouken@6362
  1741
XNextEvent(display, &event);
slouken@6362
  1742
XGetEventData(display, cookie);
slouken@6362
  1743
XFreeEventData(display, cookie);
slouken@6362
  1744
            ],[
slouken@6362
  1745
                have_XGenericEvent=yes
icculus@10984
  1746
                AC_DEFINE([SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS], 1, [ ])
slouken@6362
  1747
            ])
slouken@6362
  1748
            AC_MSG_RESULT($have_XGenericEvent)
slouken@6362
  1749
dimitris@6318
  1750
            AC_CHECK_LIB(X11, XkbKeycodeToKeysym, AC_DEFINE(SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM, 1, [Have XkbKeycodeToKeysym]))
slouken@6311
  1751
slouken@5471
  1752
            AC_ARG_ENABLE(video-x11-xcursor,
slouken@5471
  1753
AC_HELP_STRING([--enable-video-x11-xcursor], [enable X11 Xcursor support [[default=yes]]]),
slouken@5471
  1754
                            , enable_video_x11_xcursor=yes)
slouken@5471
  1755
            if test x$enable_video_x11_xcursor = xyes; then
slouken@5471
  1756
                definitely_enable_video_x11_xcursor=no
slouken@5471
  1757
                AC_CHECK_HEADER(X11/Xcursor/Xcursor.h,
slouken@5471
  1758
                                have_xcursor_h_hdr=yes,
slouken@5471
  1759
                                have_xcursor_h_hdr=no,
slouken@5471
  1760
                                [#include <X11/Xlib.h>
slouken@5471
  1761
                                ])
slouken@5471
  1762
                if test x$have_xcursor_h_hdr = xyes; then
slouken@5471
  1763
                    if test x$enable_x11_shared = xyes && test x$xcursor_lib != x ; then
slouken@5471
  1764
                        echo "-- dynamic libXcursor -> $xcursor_lib"
icculus@5548
  1765
                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR, "$xcursor_lib", [ ])
slouken@5471
  1766
                        definitely_enable_video_x11_xcursor=yes
slouken@5471
  1767
                    else
slouken@5471
  1768
                        AC_CHECK_LIB(Xcursor, XcursorImageCreate, have_xcursor_lib=yes)
slouken@5471
  1769
                        if test x$have_xcursor_lib = xyes ; then
slouken@5471
  1770
                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXcursor"
slouken@5471
  1771
                            definitely_enable_video_x11_xcursor=yes
slouken@5471
  1772
                        fi
slouken@5471
  1773
                    fi
slouken@5471
  1774
                fi
slouken@5471
  1775
            fi
slouken@5471
  1776
            if test x$definitely_enable_video_x11_xcursor = xyes; then
icculus@5548
  1777
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XCURSOR, 1, [ ])
urkle@8124
  1778
                SUMMARY_video_x11="${SUMMARY_video_x11} xcursor"
slouken@5471
  1779
            fi
icculus@9657
  1780
            AC_ARG_ENABLE(video-x11-xdbe,
icculus@9657
  1781
AC_HELP_STRING([--enable-video-x11-xdbe], [enable X11 Xdbe support [[default=yes]]]),
icculus@9657
  1782
                            , enable_video_x11_xdbe=yes)
icculus@9657
  1783
            if test x$enable_video_x11_xdbe = xyes; then
icculus@9657
  1784
                AC_CHECK_HEADER(X11/extensions/Xdbe.h,
icculus@9657
  1785
                                have_dbe_h_hdr=yes,
icculus@9657
  1786
                                have_dbe_h_hdr=no,
icculus@9657
  1787
                                [#include <X11/Xlib.h>
icculus@9657
  1788
                                ])
icculus@9657
  1789
                if test x$have_dbe_h_hdr = xyes; then
icculus@9657
  1790
                    AC_DEFINE(SDL_VIDEO_DRIVER_X11_XDBE, 1, [ ])
icculus@9657
  1791
                    SUMMARY_video_x11="${SUMMARY_video_x11} xdbe"
icculus@9657
  1792
                fi
icculus@9657
  1793
            fi
slouken@227
  1794
            AC_ARG_ENABLE(video-x11-xinerama,
slouken@1637
  1795
AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]),
slouken@227
  1796
                            , enable_video_x11_xinerama=yes)
slouken@227
  1797
            if test x$enable_video_x11_xinerama = xyes; then
slouken@5408
  1798
                definitely_enable_video_x11_xinerama=no
slouken@5408
  1799
                AC_CHECK_HEADER(X11/extensions/Xinerama.h,
slouken@5408
  1800
                                have_xinerama_h_hdr=yes,
slouken@5408
  1801
                                have_xinerama_h_hdr=no,
icculus@4793
  1802
                                [#include <X11/Xlib.h>
icculus@4793
  1803
                                ])
slouken@5408
  1804
                if test x$have_xinerama_h_hdr = xyes; then
slouken@5408
  1805
                    if test x$enable_x11_shared = xyes && test x$xinerama_lib != x ; then
slouken@5408
  1806
                        echo "-- dynamic libXinerama -> $xinerama_lib"
icculus@5548
  1807
                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA, "$xinerama_lib", [ ])
slouken@5408
  1808
                        definitely_enable_video_x11_xinerama=yes
slouken@5408
  1809
                    else
slouken@5408
  1810
                        AC_CHECK_LIB(Xinerama, XineramaQueryExtension, have_xinerama_lib=yes)
slouken@5408
  1811
                        if test x$have_xinerama_lib = xyes ; then
slouken@5408
  1812
                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXinerama"
slouken@5408
  1813
                            definitely_enable_video_x11_xinerama=yes
slouken@5408
  1814
                        fi
slouken@5408
  1815
                    fi
icculus@4793
  1816
                fi
icculus@4793
  1817
            fi
slouken@5408
  1818
            if test x$definitely_enable_video_x11_xinerama = xyes; then
icculus@5548
  1819
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA, 1, [ ])
urkle@8124
  1820
                SUMMARY_video_x11="${SUMMARY_video_x11} xinerama"
slouken@5408
  1821
            fi
slouken@5408
  1822
            AC_ARG_ENABLE(video-x11-xinput,
slouken@5408
  1823
AC_HELP_STRING([--enable-video-x11-xinput], [enable X11 XInput extension for manymouse, tablets, etc [[default=yes]]]),
slouken@5408
  1824
                            , enable_video_x11_xinput=yes)
slouken@5408
  1825
            if test x$enable_video_x11_xinput = xyes; then
slouken@5408
  1826
                definitely_enable_video_x11_xinput=no
slouken@6311
  1827
                AC_CHECK_HEADER(X11/extensions/XInput2.h,
slouken@5408
  1828
                                have_xinput_h_hdr=yes,
slouken@5408
  1829
                                have_xinput_h_hdr=no,
slouken@5408
  1830
                                [#include <X11/Xlib.h>
slouken@5408
  1831
                                ])
slouken@5408
  1832
                if test x$have_xinput_h_hdr = xyes; then
slouken@5408
  1833
                    if test x$enable_x11_shared = xyes && test x$xinput_lib != x ; then
slouken@5408
  1834
                        echo "-- dynamic libXi -> $xinput_lib"
slouken@6311
  1835
                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2, "$xinput_lib", [ ])
slouken@5408
  1836
                        definitely_enable_video_x11_xinput=yes
slouken@5408
  1837
                    else
slouken@5408
  1838
                        AC_CHECK_LIB(Xi, XOpenDevice, have_xinput_lib=yes)
slouken@5408
  1839
                        if test x$have_xinput_lib = xyes ; then
slouken@5408
  1840
                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXi"
slouken@5408
  1841
                            definitely_enable_video_x11_xinput=yes
slouken@5408
  1842
                        fi
slouken@5408
  1843
                    fi
slouken@5408
  1844
                fi
slouken@5408
  1845
            fi
slouken@5408
  1846
            if test x$definitely_enable_video_x11_xinput = xyes; then
urkle@8124
  1847
                SUMMARY_video_x11="${SUMMARY_video_x11} xinput2"
slouken@6311
  1848
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT2, 1, [ ])
dimitris@6316
  1849
                AC_MSG_CHECKING(for xinput2 multitouch)
dimitris@6316
  1850
            	have_xinput2_multitouch=no
dimitris@6316
  1851
            	AC_TRY_COMPILE([
dimitris@6316
  1852
              		#include <X11/Xlib.h>
dimitris@6316
  1853
             		#include <X11/Xproto.h>
dimitris@6316
  1854
			#include <X11/extensions/XInput2.h>
dimitris@6316
  1855
            	],[
gabomdq@6340
  1856
int event_type = XI_TouchBegin;
gabomdq@6340
  1857
XITouchClassInfo *t;
dimitris@6316
  1858
            	],[
dimitris@6316
  1859
            	have_xinput2_multitouch=yes
icculus@10985
  1860
            	AC_DEFINE([SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH], 1, [])
urkle@8124
  1861
                SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch"
dimitris@6316
  1862
            	])
dimitris@6316
  1863
            	AC_MSG_RESULT($have_xinput2_multitouch)
slouken@5408
  1864
            fi
icculus@1589
  1865
            AC_ARG_ENABLE(video-x11-xrandr,
slouken@1637
  1866
AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]),
icculus@1589
  1867
                            , enable_video_x11_xrandr=yes)
icculus@1589
  1868
            if test x$enable_video_x11_xrandr = xyes; then
gabomdq@8146
  1869
                dnl XRRScreenResources is only present in Xrandr >= 1.2, we use that as a test.
icculus@1589
  1870
                definitely_enable_video_x11_xrandr=no
gabomdq@8146
  1871
                have_xrandr_h_hdr=no
gabomdq@8146
  1872
                AC_TRY_COMPILE([
gabomdq@8146
  1873
                #include <X11/Xlib.h>
gabomdq@8146
  1874
                #include <X11/extensions/Xrandr.h>
gabomdq@8146
  1875
                ],[
gabomdq@8146
  1876
                XRRScreenResources *res = NULL;
gabomdq@8146
  1877
                ],[
gabomdq@8146
  1878
                have_xrandr_h_hdr=yes
gabomdq@8146
  1879
                ])
icculus@1589
  1880
                if test x$have_xrandr_h_hdr = xyes; then
icculus@1589
  1881
                    if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then
icculus@1589
  1882
                        echo "-- dynamic libXrandr -> $xrandr_lib"
icculus@5548
  1883
                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib", [ ])
icculus@1589
  1884
                        definitely_enable_video_x11_xrandr=yes
icculus@1589
  1885
                    else
icculus@1589
  1886
                        AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes)
sunnysachanandani@4577
  1887
                        if test x$have_xrandr_lib = xyes ; then
sunnysachanandani@4577
  1888
                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr"
icculus@1589
  1889
                            definitely_enable_video_x11_xrandr=yes
icculus@1589
  1890
                        fi
icculus@1589
  1891
                    fi
icculus@1589
  1892
                fi
icculus@1589
  1893
            fi
icculus@1589
  1894
            if test x$definitely_enable_video_x11_xrandr = xyes; then
icculus@5548
  1895
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR, 1, [ ])
urkle@8124
  1896
                SUMMARY_video_x11="${SUMMARY_video_x11} xrandr"
icculus@1589
  1897
            fi
slouken@3025
  1898
            AC_ARG_ENABLE(video-x11-scrnsaver,
slouken@3025
  1899
AC_HELP_STRING([--enable-video-x11-scrnsaver], [enable X11 screensaver extension [[default=yes]]]),
slouken@3025
  1900
                            , enable_video_x11_scrnsaver=yes)
slouken@3025
  1901
            if test x$enable_video_x11_scrnsaver = xyes; then
slouken@3025
  1902
                AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
slouken@3025
  1903
                                have_scrnsaver_h_hdr=yes,
slouken@3025
  1904
                                have_scrnsaver_h_hdr=no,
slouken@1783
  1905
                                [#include <X11/Xlib.h>
slouken@1783
  1906
                                ])
slouken@3025
  1907
                if test x$have_scrnsaver_h_hdr = xyes; then
slouken@3025
  1908
                    if test x$enable_x11_shared = xyes && test x$xss_lib != x ; then
slouken@3025
  1909
                        echo "-- dynamic libXss -> $xss_lib"
icculus@5548
  1910
                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS, "$xss_lib", [ ])
slouken@3025
  1911
                        definitely_enable_video_x11_scrnsaver=yes
slouken@3025
  1912
                    else
slouken@3025
  1913
                        AC_CHECK_LIB(Xss, XScreenSaverSuspend, have_xss_lib=yes)
slouken@3025
  1914
                        if test x$have_xss_lib = xyes ; then
slouken@3025
  1915
                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXss"
slouken@3025
  1916
                            definitely_enable_video_x11_scrnsaver=yes
slouken@3025
  1917
                        fi
slouken@3025
  1918
                    fi
slouken@1783
  1919
                fi
slouken@1783
  1920
            fi
slouken@3025
  1921
            if test x$definitely_enable_video_x11_scrnsaver = xyes; then
icculus@5548
  1922
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSCRNSAVER, 1, [ ])
urkle@8124
  1923
                SUMMARY_video_x11="${SUMMARY_video_x11} xscrnsaver"
slouken@5408
  1924
            fi
slouken@5408
  1925
            AC_ARG_ENABLE(video-x11-xshape,
slouken@5408
  1926
AC_HELP_STRING([--enable-video-x11-xshape], [enable X11 XShape support [[default=yes]]]),
slouken@5408
  1927
                            , enable_video_x11_xshape=yes)
slouken@5408
  1928
            if test x$enable_video_x11_xshape = xyes; then
slouken@5408
  1929
                AC_CHECK_HEADER(X11/extensions/shape.h,
slouken@5408
  1930
                                have_shape_h_hdr=yes,
slouken@5408
  1931
                                have_shape_h_hdr=no,
slouken@5408
  1932
                                [#include <X11/Xlib.h>
slouken@5408
  1933
                                ])
slouken@5408
  1934
                if test x$have_shape_h_hdr = xyes; then
icculus@5548
  1935
                    AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSHAPE, 1, [ ])
urkle@8124
  1936
                    SUMMARY_video_x11="${SUMMARY_video_x11} xshape"
slouken@5408
  1937
                fi
slouken@5408
  1938
            fi
slouken@5408
  1939
            AC_ARG_ENABLE(video-x11-vm,
slouken@5408
  1940
AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[default=yes]]]),
slouken@5408
  1941
                            , enable_video_x11_vm=yes)
slouken@5408
  1942
            if test x$enable_video_x11_vm = xyes; then
slouken@5408
  1943
                definitely_enable_video_x11_vm=no
slouken@5408
  1944
                AC_CHECK_HEADER(X11/extensions/xf86vmode.h,
slouken@5408
  1945
                                have_vm_h_hdr=yes,
slouken@5408
  1946
                                have_vm_h_hdr=no,
slouken@5408
  1947
                                [#include <X11/Xlib.h>
slouken@5408
  1948
                                ])
slouken@5408
  1949
                if test x$have_vm_h_hdr = xyes; then
slouken@5408
  1950
                    if test x$enable_x11_shared = xyes && test x$xvidmode_lib != x ; then
slouken@5408
  1951
                        echo "-- dynamic libXxf86vm -> $xvidmode_lib"
icculus@5548
  1952
                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE, "$xvidmode_lib", [ ])
slouken@5408
  1953
                        definitely_enable_video_x11_vm=yes
slouken@5408
  1954
                    else
slouken@5408
  1955
                        AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryVersion, have_vm_lib=yes)
slouken@5408
  1956
                        if test x$have_vm_lib = xyes ; then
slouken@5408
  1957
                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXxf86vm"
slouken@5408
  1958
                            definitely_enable_video_x11_vm=yes
slouken@5408
  1959
                        fi
slouken@5408
  1960
                    fi
slouken@5408
  1961
                fi
slouken@5408
  1962
            fi
slouken@5408
  1963
            if test x$definitely_enable_video_x11_vm = xyes; then
icculus@5548
  1964
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XVIDMODE, 1, [ ])
urkle@8124
  1965
                SUMMARY_video_x11="${SUMMARY_video_x11} xvidmode"
slouken@3025
  1966
            fi
slouken@0
  1967
        fi
slouken@0
  1968
    fi
slouken@0
  1969
}
slouken@279
  1970
slouken@9164
  1971
dnl Set up the Vivante video driver if enabled
slouken@9164
  1972
CheckVivanteVideo()
denis@9127
  1973
{
slouken@9164
  1974
    AC_ARG_ENABLE(video-vivante,
slouken@9164
  1975
AC_HELP_STRING([--enable-video-vivante], [use Vivante EGL video driver [[default=yes]]]),
slouken@9164
  1976
                  , enable_video_vivante=yes)
slouken@9164
  1977
    if test x$enable_video = xyes -a x$enable_video_vivante = xyes; then
slouken@9164
  1978
        AC_MSG_CHECKING(for Vivante VDK API)
slouken@9164
  1979
        have_vivante_vdk=no
denis@9127
  1980
        AC_TRY_COMPILE([
slouken@9164
  1981
          #define LINUX
slouken@9164
  1982
          #define EGL_API_FB
slouken@9164
  1983
          #include <gc_vdk.h>
slouken@9164
  1984
        ],[
slouken@9164
  1985
        ],[
slouken@9164
  1986
        have_vivante_vdk=yes
slouken@9164
  1987
        ])
slouken@9164
  1988
        AC_MSG_RESULT($have_vivante_vdk)
slouken@9164
  1989
slouken@9164
  1990
        AC_MSG_CHECKING(for Vivante FB API)
slouken@9164
  1991
        have_vivante_egl=no
slouken@9164
  1992
        AC_TRY_COMPILE([
slouken@9164
  1993
          #define LINUX
denis@9127
  1994
          #define EGL_API_FB
denis@9127
  1995
          #include <EGL/eglvivante.h>
denis@9127
  1996
        ],[
denis@9127
  1997
        ],[
slouken@9164
  1998
        have_vivante_egl=yes
denis@9127
  1999
        ])
slouken@9164
  2000
        AC_MSG_RESULT($have_vivante_egl)
slouken@9164
  2001
slouken@9164
  2002
        if test x$have_vivante_vdk = xyes -o x$have_vivante_egl = xyes; then
slouken@9164
  2003
            AC_DEFINE(SDL_VIDEO_DRIVER_VIVANTE, 1, [ ])
slouken@9164
  2004
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DLINUX -DEGL_API_FB"
slouken@9164
  2005
            if test x$have_vivante_vdk = xyes; then
slouken@9164
  2006
                AC_DEFINE(SDL_VIDEO_DRIVER_VIVANTE_VDK, 1, [ ])
slouken@9164
  2007
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lVDK"
slouken@9164
  2008
            fi
slouken@9164
  2009
            SOURCES="$SOURCES $srcdir/src/video/vivante/*.c"
slouken@9164
  2010
            SUMMARY_video="${SUMMARY_video} vivante"
denis@9127
  2011
            have_video=yes
denis@9127
  2012
        fi
denis@9127
  2013
    fi
denis@9127
  2014
}
denis@9127
  2015
icculus@7981
  2016
dnl Set up the Haiku video driver if enabled
icculus@7981
  2017
CheckHaikuVideo()
slouken@1361
  2018
{
slouken@1361
  2019
    if test x$enable_video = xyes; then
icculus@7981
  2020
        AC_DEFINE(SDL_VIDEO_DRIVER_HAIKU, 1, [ ])
icculus@7981
  2021
        SOURCES="$SOURCES $srcdir/src/video/haiku/*.cc"
slouken@1361
  2022
        have_video=yes
urkle@8124
  2023
        SUMMARY_video="${SUMMARY_video} haiku"
slouken@1361
  2024
    fi
slouken@1361
  2025
}
slouken@1361
  2026
slouken@1931
  2027
dnl Set up the Cocoa video driver for Mac OS X (but not Darwin)
slouken@1361
  2028
CheckCOCOA()
slouken@1361
  2029
{
slouken@1361
  2030
    AC_ARG_ENABLE(video-cocoa,
slouken@1931
  2031
AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]),
slouken@1361
  2032
                  , enable_video_cocoa=yes)
slouken@1361
  2033
    if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
slouken@1361
  2034
        save_CFLAGS="$CFLAGS"
slouken@11408
  2035
        dnl Work around that we don't have Objective-C support in autoconf
slouken@1361
  2036
        CFLAGS="$CFLAGS -x objective-c"
slouken@1361
  2037
        AC_MSG_CHECKING(for Cocoa framework)
slouken@1361
  2038
        have_cocoa=no
slouken@1361
  2039
        AC_TRY_COMPILE([
slouken@1361
  2040
          #import <Cocoa/Cocoa.h>
slouken@1361
  2041
        ],[
slouken@1361
  2042
        ],[
slouken@1361
  2043
        have_cocoa=yes
slouken@1361
  2044
        ])
slouken@1361
  2045
        AC_MSG_RESULT($have_cocoa)
slouken@1361
  2046
        CFLAGS="$save_CFLAGS"
slouken@1361
  2047
        if test x$have_cocoa = xyes; then
icculus@5548
  2048
            AC_DEFINE(SDL_VIDEO_DRIVER_COCOA, 1, [ ])
slouken@1931
  2049
            SOURCES="$SOURCES $srcdir/src/video/cocoa/*.m"
urkle@8124
  2050
            SUMMARY_video="${SUMMARY_video} cocoa"
slouken@1361
  2051
            have_video=yes
slouken@1361
  2052
        fi
slouken@1361
  2053
    fi
slouken@1361
  2054
}
slouken@1361
  2055
icculus@11729
  2056
CheckMETAL()
icculus@11729
  2057
{
icculus@11729
  2058
    AC_ARG_ENABLE(render-metal,
icculus@11729
  2059
AC_HELP_STRING([--enable-render-metal], [enable the Metal render driver [[default=no]]]),
icculus@11729
  2060
                                , enable_render_metal=no)
icculus@11729
  2061
    if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
icculus@11729
  2062
        dnl This should maybe make sure you have a supported SDK version.
icculus@11729
  2063
        AC_DEFINE(SDL_VIDEO_RENDER_METAL, 1, [ ])
icculus@11729
  2064
        SOURCES="$SOURCES $srcdir/src/render/metal/*.m"
icculus@11729
  2065
    fi
icculus@11729
  2066
}
icculus@11729
  2067
icculus@11729
  2068
slouken@167
  2069
dnl Find DirectFB
slouken@167
  2070
CheckDirectFB()
slouken@167
  2071
{
slouken@167
  2072
    AC_ARG_ENABLE(video-directfb,
slouken@2314
  2073
AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=no]]]),
slouken@2314
  2074
                  , enable_video_directfb=no)
slouken@167
  2075
    if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
slouken@167
  2076
        video_directfb=no
slouken@167
  2077
slouken@2998
  2078
        DIRECTFB_REQUIRED_VERSION=1.0.0
slouken@5199
  2079
        AC_PATH_PROGS(DIRECTFBCONFIG, directfb-config, no, [$prefix/bin:$PATH])
slouken@1602
  2080
        if test x$DIRECTFBCONFIG = xno; then
slouken@1588
  2081
            AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
slouken@1602
  2082
            if test x$PKG_CONFIG != xno; then
slouken@1602
  2083
                if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb; then
slouken@1588
  2084
                    DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
slouken@1588
  2085
                    DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
slouken@2998
  2086
                    DIRECTFB_PREFIX=`$PKG_CONFIG --variable=prefix directfb`
slouken@1588
  2087
                    video_directfb=yes
slouken@1588
  2088
                fi
slouken@1588
  2089
            fi
slouken@167
  2090
        else
slouken@1588
  2091
            set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'`
slouken@1588
  2092
            NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
slouken@6986
  2093
            set -- `$DIRECTFBCONFIG --version | sed 's/\./ /g'`
slouken@1588
  2094
            HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
slouken@1588
  2095
            if test $HAVE_VERSION -ge $NEED_VERSION; then
slouken@1588
  2096
                DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags`
slouken@1588
  2097
                DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs`
slouken@2998
  2098
                DIRECTFB_PREFIX=`$DIRECTFBCONFIG --prefix`
slouken@167
  2099
                video_directfb=yes
slouken@167
  2100
            fi
slouken@167
  2101
        fi
slouken@3351
  2102
        if test x$video_directfb = xyes; then
slouken@3351
  2103
            # SuSE 11.1 installs directfb-config without directfb-devel
couriersud@3639
  2104
            save_CPPFLAGS="$CPPFLAGS"
couriersud@3639
  2105
            CPPFLAGS="$CPPFLAGS $DIRECTFB_CFLAGS"
slouken@3351
  2106
            AC_CHECK_HEADER(directfb.h, have_directfb_hdr=yes, have_directfb_hdr=no)
couriersud@3639
  2107
            CPPFLAGS="$save_CPPFLAGS"
slouken@3351
  2108
            video_directfb=$have_directfb_hdr
slouken@3351
  2109
        fi
slouken@3351
  2110
        AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support)
slouken@3351
  2111
        AC_MSG_RESULT($video_directfb)
slouken@167
  2112
slouken@167
  2113
        if test x$video_directfb = xyes; then
slouken@2998
  2114
            AC_ARG_ENABLE(directfb-shared,
slouken@2998
  2115
AC_HELP_STRING([--enable-directfb-shared], [dynamically load directfb support [[default=yes]]]),
slouken@2998
  2116
                              , enable_directfb_shared=yes)
slouken@2998
  2117
icculus@5548
  2118
            AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB, 1, [ ])
slouken@1361
  2119
            SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
slouken@1521
  2120
            EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"
slouken@2998
  2121
slouken@3392
  2122
            AC_MSG_CHECKING(for directfb dynamic loading support)
slouken@3392
  2123
            directfb_shared=no
philipp@11090
  2124
            directfb_lib=[`find_lib "libdirectfb*.so.*" "$DIRECTFB_LIBS"`]
slouken@5199
  2125
            # | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@5199
  2126
AC_MSG_WARN("directfb $directfb_lib")
slouken@2998
  2127
            if test x$have_loadso != xyes && \
slouken@2998
  2128
               test x$enable_directfb_shared = xyes; then
slouken@2998
  2129
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic directfb loading])
slouken@2998
  2130
            fi
slouken@2998
  2131
            if test x$have_loadso = xyes && \
slouken@2998
  2132
               test x$enable_directfb_shared = xyes && test x$directfb_lib != x; then
slouken@3392
  2133
                directfb_shared=yes
slouken@3392
  2134
                echo "-- $directfb_lib_spec -> $directfb_lib"
icculus@5548
  2135
                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC, "$directfb_lib", [ ])
urkle@8124
  2136
                SUMMARY_video="${SUMMARY_video} directfb(dynamic)"
slouken@2998
  2137
            else
slouken@3392
  2138
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
urkle@8124
  2139
                SUMMARY_video="${SUMMARY_video} directfb"
slouken@2998
  2140
            fi
slouken@3392
  2141
            AC_MSG_RESULT($directfb_shared)
brandon@8703
  2142
            SDL_CFLAGS="$SDL_CFLAGS $DIRECTFB_CFLAGS"
slouken@1361
  2143
            have_video=yes
slouken@167
  2144
        fi
slouken@167
  2145
    fi
slouken@167
  2146
}
slouken@167
  2147
slouken@11175
  2148
dnl Find KMSDRM
slouken@11175
  2149
CheckKMSDRM()
slouken@11175
  2150
{
slouken@11175
  2151
    AC_ARG_ENABLE(video-kmsdrm,
slouken@11175
  2152
AC_HELP_STRING([--enable-video-kmsdrm], [use KMSDRM video driver [[default=no]]]),
slouken@11175
  2153
                  , enable_video_kmsdrm=no)
slouken@11175
  2154
slouken@11175
  2155
    if test x$enable_video = xyes -a x$enable_video_kmsdrm = xyes; then
slouken@11175
  2156
        video_kmsdrm=no
slouken@11175
  2157
        libdrm_avail=no
slouken@11175
  2158
        libgbm_avail=no
slouken@11175
  2159
slouken@11175
  2160
        LIBDRM_REQUIRED_VERSION=2.4.46
slouken@11175
  2161
        LIBGBM_REQUIRED_VERSION=9.0.0
slouken@11175
  2162
slouken@11175
  2163
        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
slouken@11175
  2164
        if test x$PKG_CONFIG != xno; then
slouken@11175
  2165
            if $PKG_CONFIG --atleast-pkgconfig-version 0.7; then
slouken@11175
  2166
                if $PKG_CONFIG --atleast-version $LIBDRM_REQUIRED_VERSION libdrm; then
slouken@11175
  2167
                    LIBDRM_CFLAGS=`$PKG_CONFIG --cflags libdrm`
slouken@11175
  2168
                    LIBDRM_LIBS=`$PKG_CONFIG --libs libdrm`
slouken@11175
  2169
                    LIBDRM_PREFIX=`$PKG_CONFIG --variable=prefix libdrm`
slouken@11175
  2170
                    libdrm_avail=yes
slouken@11175
  2171
                fi
slouken@11175
  2172
                if $PKG_CONFIG --atleast-version $LIBGBM_REQUIRED_VERSION gbm; then
slouken@11175
  2173
                    LIBGBM_CFLAGS=`$PKG_CONFIG --cflags gbm`
slouken@11175
  2174
                    LIBGBM_LIBS=`$PKG_CONFIG --libs gbm`
slouken@11175
  2175
                    LIBGBM_PREFIX=`$PKG_CONFIG --variable=prefix gbm`
slouken@11175
  2176
                    libgbm_avail=yes
slouken@11175
  2177
                fi
slouken@11175
  2178
                if test x$libdrm_avail = xyes -a x$libgbm_avail = xyes; then
slouken@11175
  2179
                    video_kmsdrm=yes
slouken@11175
  2180
                fi
slouken@11175
  2181
 
slouken@11175
  2182
                AC_MSG_CHECKING(for libdrm $LIBDRM_REQUIRED_VERSION library for kmsdrm support)
slouken@11175
  2183
                AC_MSG_RESULT($libdrm_avail)
slouken@11175
  2184
                AC_MSG_CHECKING(for libgbm $LIBGBM_REQUIRED_VERSION library for kmsdrm support)
slouken@11175
  2185
                AC_MSG_RESULT($libgbm_avail)
slouken@11175
  2186
slouken@11175
  2187
                if test x$video_kmsdrm = xyes; then
slouken@11175
  2188
                    AC_ARG_ENABLE(kmsdrm-shared,
slouken@11175
  2189
AC_HELP_STRING([--enable-kmsdrm-shared], [dynamically load kmsdrm support [[default=yes]]]),
slouken@11175
  2190
                              , enable_kmsdrm_shared=yes)
slouken@11175
  2191
slouken@11175
  2192
                    AC_DEFINE(SDL_VIDEO_DRIVER_KMSDRM, 1, [ ])
slouken@11175
  2193
                    SOURCES="$SOURCES $srcdir/src/video/kmsdrm/*.c"
slouken@11175
  2194
                    EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBDRM_CFLAGS $LIBGBM_CFLAGS"
slouken@11175
  2195
slouken@11175
  2196
                    AC_MSG_CHECKING(for kmsdrm dynamic loading support)
slouken@11175
  2197
                    kmsdrm_shared=no
slouken@11175
  2198
                    drm_lib=[`find_lib "libdrm.so.*" "$DRM_LIBS"`]
slouken@11175
  2199
                    gbm_lib=[`find_lib "libgbm.so.*" "$DRM_LIBS"`]
slouken@11175
  2200
                    if test x$have_loadso != xyes && \
slouken@11175
  2201
                       test x$enable_kmsdrm_shared = xyes; then
slouken@11175
  2202
                        AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic kmsdrm loading])
slouken@11175
  2203
                    fi
slouken@11175
  2204
                    if test x$have_loadso = xyes && \
slouken@11175
  2205
                       test x$enable_kmsdrm_shared = xyes && test x$drm_lib != x && test x$gbm_lib != x; then
slouken@11175
  2206
                        kmsdrm_shared=yes
slouken@11175
  2207
                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC, "$drm_lib", [ ])
slouken@11175
  2208
                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM, "$gbm_lib", [ ])
slouken@11175
  2209
                        AC_DEFINE_UNQUOTED(HAVE_KMSDRM_SHARED, "TRUE", [ ])
slouken@11175
  2210
                        SUMMARY_video="${SUMMARY_video} kmsdrm(dynamic)"
slouken@11175
  2211
                    else
slouken@11175
  2212
                        EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBDRM_LIBS $LIBGBM_LIBS"
slouken@11175
  2213
                        SUMMARY_video="${SUMMARY_video} kmsdrm"
slouken@11175
  2214
                    fi
slouken@11175
  2215
                    AC_MSG_RESULT($kmsdrm_shared)
slouken@11175
  2216
                    have_video=yes
slouken@11175
  2217
                fi
slouken@11175
  2218
            fi
slouken@11175
  2219
        fi
slouken@11175
  2220
    fi
slouken@11175
  2221
}
slouken@11175
  2222
slouken@1
  2223
dnl rcg04172001 Set up the Null video driver.
slouken@1
  2224
CheckDummyVideo()
slouken@1
  2225
{
slouken@1
  2226
    AC_ARG_ENABLE(video-dummy,
slouken@1637
  2227
AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]),
slouken@86
  2228
                  , enable_video_dummy=yes)
slouken@1
  2229
    if test x$enable_video_dummy = xyes; then
icculus@5548
  2230
        AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY, 1, [ ])
slouken@1361
  2231
        SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
slouken@1361
  2232
        have_video=yes
urkle@8124
  2233
        SUMMARY_video="${SUMMARY_video} dummy"
slouken@1
  2234
    fi
slouken@1
  2235
}
slouken@1
  2236
icculus@11119
  2237
dnl Set up the QNX video driver if enabled
icculus@11119
  2238
CheckQNXVideo()
icculus@11119
  2239
{
icculus@11119
  2240
    if test x$enable_video = xyes; then
icculus@11119
  2241
        AC_DEFINE(SDL_VIDEO_DRIVER_QNX, 1, [ ])
icculus@11119
  2242
        SOURCES="$SOURCES $srcdir/src/video/qnx/*.c"
icculus@11119
  2243
        have_video=yes
icculus@11119
  2244
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lscreen -lEGL -lGLESv2"
icculus@11119
  2245
        SUMMARY_video="${SUMMARY_video} qnx"
icculus@11119
  2246
    fi
icculus@11119
  2247
}
icculus@11119
  2248
icculus@11119
  2249
dnl Set up the QNX audio driver if enabled
icculus@11119
  2250
CheckQNXAudio()
icculus@11119
  2251
{
icculus@11119
  2252
    if test x$enable_audio = xyes; then
icculus@11119
  2253
        AC_DEFINE(SDL_AUDIO_DRIVER_QSA, 1, [ ])
icculus@11119
  2254
        SOURCES="$SOURCES $srcdir/src/audio/qsa/*.c"
philipp@11121
  2255
        have_audio=yes
icculus@11119
  2256
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound"
icculus@11119
  2257
        SUMMARY_audio="${SUMMARY_audio} qsa"
icculus@11119
  2258
    fi
icculus@11119
  2259
}
icculus@11119
  2260
slouken@0
  2261
dnl Check to see if OpenGL support is desired
slouken@0
  2262
AC_ARG_ENABLE(video-opengl,
slouken@1952
  2263
AC_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]),
slouken@0
  2264
              , enable_video_opengl=yes)
slouken@0
  2265
slouken@0
  2266
dnl Find OpenGL
icculus@1191
  2267
CheckOpenGLX11()
slouken@0
  2268
{
slouken@0
  2269
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@0
  2270
        AC_MSG_CHECKING(for OpenGL (GLX) support)
slouken@0
  2271
        video_opengl=no
slouken@0
  2272
        AC_TRY_COMPILE([
slouken@0
  2273
         #include <GL/gl.h>
slouken@0
  2274
         #include <GL/glx.h>
slouken@0
  2275
        ],[
slouken@0
  2276
        ],[
slouken@0
  2277
        video_opengl=yes
slouken@0
  2278
        ])
slouken@0
  2279
        AC_MSG_RESULT($video_opengl)
slouken@0
  2280
        if test x$video_opengl = xyes; then
icculus@5548
  2281
            AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
icculus@5548
  2282
            AC_DEFINE(SDL_VIDEO_OPENGL_GLX, 1, [ ])
icculus@5548
  2283
            AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
urkle@8124
  2284
            SUMMARY_video="${SUMMARY_video} opengl"
slouken@0
  2285
        fi
slouken@0
  2286
    fi
slouken@0
  2287
}
slouken@0
  2288
slouken@6188
  2289
dnl Check to see if OpenGL ES support is desired
slouken@6188
  2290
AC_ARG_ENABLE(video-opengles,
slouken@6188
  2291
AC_HELP_STRING([--enable-video-opengles], [include OpenGL ES support [[default=yes]]]),
slouken@6188
  2292
              , enable_video_opengles=yes)
slouken@9155
  2293
AC_ARG_ENABLE(video-opengles1,
slouken@9155
  2294
AC_HELP_STRING([--enable-video-opengles1], [include OpenGL ES 1.1 support [[default=yes]]]),
slouken@9155
  2295
              , enable_video_opengles1=yes)
slouken@9155
  2296
AC_ARG_ENABLE(video-opengles2,
slouken@9155
  2297
AC_HELP_STRING([--enable-video-opengles2], [include OpenGL ES 2.0 support [[default=yes]]]),
slouken@9155
  2298
              , enable_video_opengles2=yes)
slouken@6188
  2299
slouken@6188
  2300
dnl Find OpenGL ES
slouken@6188
  2301
CheckOpenGLESX11()
slouken@6188
  2302
{
slouken@6188
  2303
    if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
gabomdq@7659
  2304
        AC_MSG_CHECKING(for EGL support)
gabomdq@7659
  2305
        video_opengl_egl=no
slouken@6188
  2306
        AC_TRY_COMPILE([
slouken@9164
  2307
          #define LINUX
slouken@9164
  2308
          #define EGL_API_FB
slouken@9164
  2309
          #include <EGL/egl.h>
slouken@9164
  2310
          #include <EGL/eglext.h>
slouken@6188
  2311
        ],[
slouken@6188
  2312
        ],[
gabomdq@7659
  2313
        video_opengl_egl=yes
slouken@6188
  2314
        ])
gabomdq@7659
  2315
        AC_MSG_RESULT($video_opengl_egl)
gabomdq@7659
  2316
        if test x$video_opengl_egl = xyes; then
gabomdq@7659
  2317
            AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
gabomdq@7659
  2318
        fi
gabomdq@7659
  2319
            
slouken@9155
  2320
        if test x$enable_video_opengles1 = xyes; then
slouken@9155
  2321
            AC_MSG_CHECKING(for OpenGL ES v1 headers)
slouken@9155
  2322
            video_opengles_v1=no
slouken@9155
  2323
            AC_TRY_COMPILE([
slouken@9155
  2324
             #include <GLES/gl.h>
slouken@9155
  2325
             #include <GLES/glext.h>
slouken@9155
  2326
            ],[
slouken@9155
  2327
            ],[
slouken@9155
  2328
            video_opengles_v1=yes
slouken@9155
  2329
            ])
slouken@9155
  2330
            AC_MSG_RESULT($video_opengles_v1)
slouken@9155
  2331
            if test x$video_opengles_v1 = xyes; then
slouken@9155
  2332
                AC_DEFINE(SDL_VIDEO_OPENGL_ES, 1, [ ])
slouken@9155
  2333
                AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES, 1, [ ])
slouken@9155
  2334
                SUMMARY_video="${SUMMARY_video} opengl_es1"
slouken@9155
  2335
            fi
gabomdq@7659
  2336
        fi
gabomdq@7659
  2337
        
slouken@9155
  2338
        if test x$enable_video_opengles2 = xyes; then
slouken@9155
  2339
            AC_MSG_CHECKING(for OpenGL ES v2 headers)
slouken@9155
  2340
            video_opengles_v2=no
slouken@9155
  2341
            AC_TRY_COMPILE([
slouken@9155
  2342
             #include <GLES2/gl2.h>
slouken@9155
  2343
             #include <GLES2/gl2ext.h>
slouken@9155
  2344
            ],[
slouken@9155
  2345
            ],[
slouken@9155
  2346
            video_opengles_v2=yes
slouken@9155
  2347
            ])
slouken@9155
  2348
            AC_MSG_RESULT($video_opengles_v2)
slouken@9155
  2349
            if test x$video_opengles_v2 = xyes; then
slouken@9155
  2350
                AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
slouken@9155
  2351
                AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
slouken@9155
  2352
                SUMMARY_video="${SUMMARY_video} opengl_es2"
slouken@9155
  2353
            fi
slouken@6188
  2354
        fi
slouken@6188
  2355
    fi
slouken@6188
  2356
}
slouken@6188
  2357
slouken@5062
  2358
dnl Check for Windows OpenGL
slouken@5062
  2359
CheckWINDOWSGL()
slouken@1361
  2360
{
slouken@1361
  2361
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
icculus@5548
  2362
        AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
icculus@5548
  2363
        AC_DEFINE(SDL_VIDEO_OPENGL_WGL, 1, [ ])
icculus@5548
  2364
        AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
urkle@8124
  2365
        SUMMARY_video="${SUMMARY_video} opengl"
slouken@1361
  2366
    fi
slouken@1361
  2367
}
slouken@1361
  2368
gabomdq@8022
  2369
dnl Check for Windows OpenGL
gabomdq@8022
  2370
CheckWINDOWSGLES()
gabomdq@8022
  2371
{
gabomdq@8022
  2372
    if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
gabomdq@8022
  2373
gabomdq@8022
  2374
        AC_MSG_CHECKING(for EGL support)
gabomdq@8022
  2375
        video_opengl_egl=no
gabomdq@8022
  2376
        AC_TRY_COMPILE([
gabomdq@8022
  2377
         #include <EGL/egl.h>
gabomdq@8022
  2378
        ],[
gabomdq@8022
  2379
        ],[
gabomdq@8022
  2380
        video_opengl_egl=yes
gabomdq@8022
  2381
        ])
gabomdq@8022
  2382
        AC_MSG_RESULT($video_opengl_egl)
gabomdq@8022
  2383
        if test x$video_opengl_egl = xyes; then
gabomdq@8022
  2384
            AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
gabomdq@8022
  2385
            AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
urkle@8124
  2386
            SUMMARY_video="${SUMMARY_video} opengl_es1"
gabomdq@8022
  2387
        fi
gabomdq@8022
  2388
       
gabomdq@8022
  2389
        AC_MSG_CHECKING(for OpenGL ES v2 headers)
gabomdq@8022
  2390
        video_opengles_v2=no
gabomdq@8022
  2391
        AC_TRY_COMPILE([
gabomdq@8022
  2392
         #include <GLES2/gl2.h>
gabomdq@8022
  2393
         #include <GLES2/gl2ext.h>
gabomdq@8022
  2394
        ],[
gabomdq@8022
  2395
        ],[
gabomdq@8022
  2396
        video_opengles_v2=yes
gabomdq@8022
  2397
        ])
gabomdq@8022
  2398
        AC_MSG_RESULT($video_opengles_v2)
gabomdq@8022
  2399
        if test x$video_opengles_v2 = xyes; then
gabomdq@8022
  2400
            AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
gabomdq@8022
  2401
            AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
gabomdq@8022
  2402
            AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
urkle@8124
  2403
            SUMMARY_video="${SUMMARY_video} opengl_es2"
gabomdq@8022
  2404
        fi
gabomdq@8022
  2405
    fi
gabomdq@8022
  2406
}
gabomdq@8022
  2407
icculus@7981
  2408
dnl Check for Haiku OpenGL
icculus@7981
  2409
CheckHaikuGL()
slouken@0
  2410
{
slouken@0
  2411
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
icculus@5548
  2412
        AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
icculus@7981
  2413
        AC_DEFINE(SDL_VIDEO_OPENGL_HAIKU, 1, [ ])
icculus@5548
  2414
        AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
slouken@1521
  2415
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
urkle@8124
  2416
        SUMMARY_video="${SUMMARY_video} opengl"
slouken@0
  2417
    fi
slouken@0
  2418
}
slouken@0
  2419
slouken@0
  2420
dnl Check for MacOS OpenGL
slouken@0
  2421
CheckMacGL()
slouken@0
  2422
{
slouken@0
  2423
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
icculus@5548
  2424
        AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
icculus@5548
  2425
        AC_DEFINE(SDL_VIDEO_OPENGL_CGL, 1, [ ])
icculus@5548
  2426
        AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
urkle@8124
  2427
        SUMMARY_video="${SUMMARY_video} opengl"
slouken@0
  2428
    fi
slouken@0
  2429
}
slouken@0
  2430
icculus@9278
  2431
CheckEmscriptenGLES()
icculus@9278
  2432
{
icculus@9278
  2433
    if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
icculus@9278
  2434
        AC_MSG_CHECKING(for EGL support)
icculus@9278
  2435
        video_opengl_egl=no
icculus@9278
  2436
        AC_TRY_COMPILE([
icculus@9278
  2437
         #include <EGL/egl.h>
icculus@9278
  2438
        ],[
icculus@9278
  2439
        ],[
icculus@9278
  2440
        video_opengl_egl=yes
icculus@9278
  2441
        ])
icculus@9278
  2442
        AC_MSG_RESULT($video_opengl_egl)
icculus@9278
  2443
        if test x$video_opengl_egl = xyes; then
icculus@9278
  2444
            AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
icculus@9278
  2445
        fi
icculus@9278
  2446
icculus@9278
  2447
        AC_MSG_CHECKING(for OpenGL ES v2 headers)
icculus@9278
  2448
        video_opengles_v2=no
icculus@9278
  2449
        AC_TRY_COMPILE([
icculus@9278
  2450
         #include <GLES2/gl2.h>
icculus@9278
  2451
         #include <GLES2/gl2ext.h>
icculus@9278
  2452
        ],[
icculus@9278
  2453
        ],[
icculus@9278
  2454
        video_opengles_v2=yes
icculus@9278
  2455
        ])
icculus@9278
  2456
        AC_MSG_RESULT($video_opengles_v2)
icculus@9278
  2457
        if test x$video_opengles_v2 = xyes; then
icculus@9278
  2458
            AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
icculus@9278
  2459
            AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
icculus@9278
  2460
            SUMMARY_video="${SUMMARY_video} opengl_es2"
icculus@9278
  2461
        fi
icculus@9278
  2462
    fi
icculus@9278
  2463
}
icculus@9278
  2464
slouken@11408
  2465
dnl Check to see if Vulkan support is desired
icculus@11365
  2466
AC_ARG_ENABLE(video-vulkan,
slouken@11381
  2467
AC_HELP_STRING([--enable-video-vulkan], [include Vulkan support [[default=yes]]]),
icculus@11365
  2468
              , enable_video_vulkan=yes)
icculus@11365
  2469
icculus@11365
  2470
dnl Find Vulkan Header
icculus@11365
  2471
CheckVulkan()
icculus@11365
  2472
{
icculus@11365
  2473
    if test x$enable_video = xyes -a x$enable_video_vulkan = xyes; then
icculus@11365
  2474
        case "$host" in
slouken@11674
  2475
            *-*-android*)
icculus@11365
  2476
                AC_TRY_COMPILE([
slouken@11408
  2477
                  #if defined(__ARM_ARCH) && __ARM_ARCH < 7
icculus@11365
  2478
                  #error Vulkan doesn't work on this configuration
icculus@11365
  2479
                  #endif
slouken@11408
  2480
                ],[
slouken@11408
  2481
                ],[
icculus@11365
  2482
                ],[
icculus@11365
  2483
                    enable_video_vulkan=no
slouken@11408
  2484
                ])
slouken@11408
  2485
                ;;
slouken@11408
  2486
            *-*-darwin*)
slouken@11408
  2487
                save_CFLAGS="$CFLAGS"
slouken@11408
  2488
                dnl Work around that we don't have Objective-C support in autoconf
slouken@11408
  2489
                CFLAGS="$CFLAGS -x objective-c"
slouken@11408
  2490
                AC_TRY_COMPILE([
slouken@11408
  2491
                  #include <Cocoa/Cocoa.h>
slouken@11408
  2492
                  #include <Metal/Metal.h>
slouken@11408
  2493
                  #include <QuartzCore/CAMetalLayer.h>
slouken@11408
  2494
slouken@11408
  2495
                  #if !TARGET_CPU_X86_64
slouken@11408
  2496
                  #error Vulkan doesn't work on this configuration
slouken@11408
  2497
                  #endif
icculus@11365
  2498
                ],[
slouken@11408
  2499
                ],[
slouken@11408
  2500
                ],[
slouken@11408
  2501
                    enable_video_vulkan=no
icculus@11365
  2502
                ])
slouken@11408
  2503
                CFLAGS="$save_CFLAGS"
icculus@11365
  2504
                ;;
icculus@11365
  2505
            *)
icculus@11365
  2506
                ;;
icculus@11365
  2507
        esac
icculus@11365
  2508
        if test x$enable_video_vulkan = xno; then
icculus@11365
  2509
            # For reasons I am totally unable to see, I get an undefined macro error if
icculus@11365
  2510
            # I put this in the AC_TRY_COMPILE.
slouken@11408
  2511
            AC_MSG_WARN([Vulkan does not work on this configuration.])
icculus@11365
  2512
        fi
icculus@11365
  2513
    fi
icculus@11367
  2514
    if test x$enable_video_vulkan = xyes; then
slouken@11381
  2515
        AC_DEFINE(SDL_VIDEO_VULKAN, 1, [ ])
icculus@11365
  2516
        SUMMARY_video="${SUMMARY_video} vulkan"
icculus@11365
  2517
    fi
icculus@11365
  2518
}
icculus@11365
  2519
slouken@0
  2520
dnl See if we can use the new unified event interface in Linux 2.4
slouken@0
  2521
CheckInputEvents()
slouken@0
  2522
{
slouken@0
  2523
    dnl Check for Linux 2.4 unified input event interface support
slouken@0
  2524
        AC_MSG_CHECKING(for Linux 2.4 unified input interface)
slouken@0
  2525
        use_input_events=no
slouken@0
  2526
        AC_TRY_COMPILE([
slouken@0
  2527
          #include <linux/input.h>
slouken@0
  2528
        ],[
slouken@0
  2529
          #ifndef EVIOCGNAME
slouken@0
  2530
          #error EVIOCGNAME() ioctl not available
slouken@0
  2531
          #endif
slouken@0
  2532
        ],[
slouken@0
  2533
        use_input_events=yes
slouken@0
  2534
        ])
slouken@0
  2535
        AC_MSG_RESULT($use_input_events)
slouken@0
  2536
        if test x$use_input_events = xyes; then
icculus@5548
  2537
            AC_DEFINE(SDL_INPUT_LINUXEV, 1, [ ])
urkle@8124
  2538
            SUMMARY_input="${SUMMARY_input} linuxev"
slouken@0
  2539
        fi
slouken@0
  2540
}
slouken@0
  2541
gabomdq@7778
  2542
dnl See if we can use the kernel kd.h header
gabomdq@7778
  2543
CheckInputKD()
gabomdq@7778
  2544
{
gabomdq@7778
  2545
gabomdq@7778
  2546
    AC_MSG_CHECKING(for Linux kd.h)
gabomdq@7778
  2547
    use_input_kd=no
gabomdq@7778
  2548
    AC_TRY_COMPILE([
gabomdq@7778
  2549
      #include <linux/kd.h>
gabomdq@7778
  2550
      #include <linux/keyboard.h>
gabomdq@7778
  2551
    ],[
gabomdq@7778
  2552
        struct kbentry kbe;
gabomdq@7778
  2553
        kbe.kb_table = KG_CTRL;
gabomdq@7778
  2554
        ioctl(0, KDGKBENT, &kbe);
gabomdq@7778
  2555
    ],[
gabomdq@7778
  2556
    use_input_kd=yes
gabomdq@7778
  2557
    ])
gabomdq@7778
  2558
    AC_MSG_RESULT($use_input_kd)
gabomdq@7778
  2559
    if test x$use_input_kd = xyes; then
gabomdq@7778
  2560
        AC_DEFINE(SDL_INPUT_LINUXKD, 1, [ ])
urkle@8124
  2561
        SUMMARY_input="${SUMMARY_input} linuxkd"
gabomdq@7778
  2562
    fi
gabomdq@7778
  2563
}
gabomdq@7778
  2564
icculus@6734
  2565
dnl See if the platform offers libudev for device enumeration and hotplugging.
icculus@6734
  2566
CheckLibUDev()
icculus@6734
  2567
{
icculus@6734
  2568
    AC_ARG_ENABLE(libudev,
icculus@6734
  2569
AC_HELP_STRING([--enable-libudev], [enable libudev support [[default=yes]]]),
icculus@6734
  2570
                        , enable_libudev=yes)
icculus@6734
  2571
    if test x$enable_libudev = xyes; then
icculus@6734
  2572
        AC_CHECK_HEADER(libudev.h,
icculus@6734
  2573
                        have_libudev_h_hdr=yes,
icculus@6734
  2574
                        have_libudev_h_hdr=no)
icculus@6734
  2575
        if test x$have_libudev_h_hdr = xyes; then
icculus@6734
  2576
            AC_DEFINE(HAVE_LIBUDEV_H, 1, [ ])
slouken@10660
  2577
slouken@10660
  2578
            udev_lib=[`find_lib "libudev.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@10660
  2579
            if test x$udev_lib != x; then
slouken@10660
  2580
                echo "-- dynamic udev -> $udev_lib"
slouken@10660
  2581
                AC_DEFINE_UNQUOTED(SDL_UDEV_DYNAMIC, "$udev_lib", [ ])
slouken@10660
  2582
            fi
icculus@6734
  2583
        fi
icculus@6734
  2584
    fi
icculus@6734
  2585
}
icculus@6734
  2586
icculus@6774
  2587
dnl See if the platform offers libdbus for various IPC techniques.
icculus@6774
  2588
CheckDBus()
icculus@6774
  2589
{
icculus@6774
  2590
    AC_ARG_ENABLE(dbus,
icculus@6774
  2591
AC_HELP_STRING([--enable-dbus], [enable D-Bus support [[default=yes]]]),
icculus@6774
  2592
                        , enable_dbus=yes)
icculus@6774
  2593
    if test x$enable_dbus = xyes; then
icculus@6774
  2594
        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
icculus@6774
  2595
        if test x$PKG_CONFIG != xno; then
icculus@6774
  2596
            DBUS_CFLAGS=`$PKG_CONFIG --cflags dbus-1`
icculus@6774
  2597
            save_CFLAGS="$CFLAGS"
icculus@6774
  2598
            CFLAGS="$save_CFLAGS $DBUS_CFLAGS"
icculus@6774
  2599
            AC_CHECK_HEADER(dbus/dbus.h,
icculus@6774
  2600
                            have_dbus_dbus_h_hdr=yes,
icculus@6774
  2601
                            have_dbus_dbus_h_hdr=no)
icculus@6774
  2602
            CFLAGS="$save_CFLAGS"
icculus@6774
  2603
            if test x$have_dbus_dbus_h_hdr = xyes; then
icculus@6774
  2604
                AC_DEFINE(HAVE_DBUS_DBUS_H, 1, [ ])
icculus@6774
  2605
                EXTRA_CFLAGS="$EXTRA_CFLAGS $DBUS_CFLAGS"
alex@8889
  2606
                SOURCES="$SOURCES $srcdir/src/core/linux/SDL_dbus.c"
alex@8889
  2607
            fi
alex@8889
  2608
        fi
alex@8889
  2609
    fi
alex@8889
  2610
}
alex@8889
  2611
slouken@10496
  2612
dnl See if the platform wanna IME support.
slouken@10496
  2613
CheckIME()
slouken@10496
  2614
{
slouken@10496
  2615
    AC_ARG_ENABLE(ime,
slouken@10496
  2616
AC_HELP_STRING([--enable-ime], [enable IME support [[default=yes]]]),
slouken@10496
  2617
                  , enable_ime=yes)
slouken@10496
  2618
    if test x$enable_ime = xyes; then
slouken@10496
  2619
        AC_DEFINE(SDL_USE_IME, 1, [ ])
slouken@10496
  2620
            SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ime.c"
slouken@10496
  2621
    fi
slouken@10496
  2622
}
slouken@10496
  2623
alex@8889
  2624
dnl See if the platform has libibus IME support.
alex@8889
  2625
CheckIBus()
alex@8889
  2626
{
alex@8889
  2627
    AC_ARG_ENABLE(ibus,
alex@8889
  2628
AC_HELP_STRING([--enable-ibus], [enable IBus support [[default=yes]]]),
alex@8889
  2629
                  , enable_ibus=yes)
alex@8889
  2630
    if test x$enable_ibus = xyes; then
alex@8889
  2631
        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
alex@8889
  2632
        if test x$PKG_CONFIG != xno; then
alex@8889
  2633
            IBUS_CFLAGS=`$PKG_CONFIG --cflags ibus-1.0`
alex@8889
  2634
            save_CFLAGS="$CFLAGS"
alex@8889
  2635
            CFLAGS="$save_CFLAGS $IBUS_CFLAGS"
alex@8889
  2636
            AC_CHECK_HEADER(ibus-1.0/ibus.h,
alex@8889
  2637
                            have_ibus_ibus_h_hdr=yes,
alex@8889
  2638
                            have_ibus_ibus_h_hdr=no)
alex@8889
  2639
            AC_CHECK_HEADER(sys/inotify.h,
alex@8889
  2640
                            have_inotify_inotify_h_hdr=yes,
alex@8889
  2641
                            have_inotify_inotify_h_hdr=no)
alex@8889
  2642
            CFLAGS="$save_CFLAGS"
alex@8889
  2643
            if test x$have_ibus_ibus_h_hdr = xyes; then
slouken@10496
  2644
                if test x$enable_ime != xyes; then
slouken@10496
  2645
                    AC_MSG_WARN([IME support is required for IBus.])
slouken@10496
  2646
                    have_ibus_ibus_h_hdr=no
slouken@10496
  2647
                elif test x$enable_dbus != xyes; then
alex@8889
  2648
                    AC_MSG_WARN([DBus support is required for IBus.])
alex@8889
  2649
                    have_ibus_ibus_h_hdr=no
alex@8889
  2650
                elif test x$have_inotify_inotify_h_hdr != xyes; then
alex@8889
  2651
                    AC_MSG_WARN([INotify support is required for IBus.])
alex@8889
  2652
                    have_ibus_ibus_h_hdr=no
alex@8889
  2653
                else
alex@8889
  2654
                    AC_DEFINE(HAVE_IBUS_IBUS_H, 1, [ ])
alex@8889
  2655
                    EXTRA_CFLAGS="$EXTRA_CFLAGS $IBUS_CFLAGS"
alex@8889
  2656
                    SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ibus.c"
alex@8889
  2657
               fi
icculus@6774
  2658
            fi
icculus@6774
  2659
        fi
icculus@6774
  2660
    fi
icculus@6774
  2661
}
icculus@6774
  2662
slouken@10496
  2663
dnl See if the platform has fcitx IME support.
slouken@10496
  2664
CheckFcitx()
slouken@10496
  2665
{
slouken@10496
  2666
    AC_ARG_ENABLE(fcitx,
slouken@10496
  2667
AC_HELP_STRING([--enable-fcitx], [enable fcitx support [[default=yes]]]),
slouken@10496
  2668
                  , enable_fcitx=yes)
slouken@10496
  2669
    if test x$enable_fcitx = xyes; then
slouken@10496
  2670
        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
slouken@10496
  2671
        if test x$PKG_CONFIG != xno; then
slouken@10496
  2672
            FCITX_CFLAGS=`$PKG_CONFIG --cflags fcitx`
slouken@10496
  2673
            CFLAGS="$CFLAGS $FCITX_CFLAGS"
slouken@10496
  2674
            AC_CHECK_HEADER(fcitx/frontend.h,
slouken@10496
  2675
                            have_fcitx_frontend_h_hdr=yes,
slouken@10496
  2676
                            have_fcitx_frontend_h_hdr=no)
slouken@10496
  2677
            CFLAGS="$save_CFLAGS"
slouken@10496