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