configure.in
author Sam Lantinga <slouken@libsdl.org>
Sat, 16 Mar 2019 17:47:59 -0700
changeset 12640 b708d2c3fe08
parent 12638 df6da910d4d8
child 12654 cd9fe6a3126c
permissions -rw-r--r--
Fixed bug 4452 - Please replace AC_HELP_STRING with AS_HELP_STRING

Hugh McMaster

AC_HELP_STRING is deprecated and is considered an obsolete macro in autoconf 2.69.

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