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