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