configure.ac
author Sam Lantinga <slouken@libsdl.org>
Sat, 08 Jun 2019 18:32:29 -0700
changeset 12804 1a330416800d
parent 12762 0fa532733f3f
child 12869 2b56cef46971
permissions -rw-r--r--
Temporary fix for bug 4254 - a _lot_ of strict aliasing warnings

Ozkan Sezer

A horde of strict aliasing violation warnings are emitted from joystick
layer, and also from a few other places. This happens with gcc-4.4.7 on
Linux CentOS 6.10. Some other sysjoystick would possibly have the same
warnings.

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