configure.in
author Sam Lantinga <slouken@libsdl.org>
Fri, 02 Nov 2018 18:07:11 -0700
changeset 12390 60f322c5984f
parent 12258 231245d461a2
child 12391 ca6e41ade79a
permissions -rw-r--r--
Fixed bug 4308 - Prebuilt SDL.dll files not compiled with ASLR support (DYNAMICBASE)

Cameron Gutman

The current SDL 2.0.8 and the prerelease SDL 2.0.9 are compiled without the DYNAMICBASE flag to indicate that ASLR may relocate the DLL at load-time. https://docs.microsoft.com/en-us/cpp/build/reference/dynamicbase-use-address-space-layout-randomization?view=vs-2017

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