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