configure.ac
author Ryan C. Gordon
Tue, 19 May 2020 12:30:26 -0400
changeset 13833 9e4cca5c8e62
parent 13832 b65783853022
child 13834 bb68bb2d5ccb
permissions -rw-r--r--
configure: -idirafter needs a space, -I doesn't.

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