configure.in
author Sam Lantinga <slouken@libsdl.org>
Sat, 15 Jan 2011 12:41:59 -0800
changeset 5003 3a95a2b93eb3
parent 4944 921637675f2c
child 5004 0c72ae7b7cb2
permissions -rw-r--r--
Updated the atomic API for better use cases
slouken@0
     1
dnl Process this file with autoconf to produce a configure script.
slouken@0
     2
AC_INIT(README)
slouken@1341
     3
AC_CONFIG_HEADER(include/SDL_config.h)
slouken@1353
     4
AC_GNU_SOURCE
slouken@3085
     5
AC_CONFIG_AUX_DIRS($srcdir/build-scripts)
slouken@0
     6
slouken@3382
     7
dnl Save the CFLAGS to see whether they were passed in or generated
slouken@3382
     8
orig_CFLAGS="$CFLAGS"
slouken@3382
     9
slouken@0
    10
dnl Set various version strings - taken gratefully from the GTk sources
slouken@0
    11
#
slouken@0
    12
# Making releases:
slouken@0
    13
# Edit include/SDL/SDL_version.h and change the version, then:
slouken@0
    14
#   SDL_MICRO_VERSION += 1;
slouken@0
    15
#   SDL_INTERFACE_AGE += 1;
slouken@0
    16
#   SDL_BINARY_AGE += 1;
slouken@0
    17
# if any functions have been added, set SDL_INTERFACE_AGE to 0.
slouken@0
    18
# if backwards compatibility has been broken,
slouken@0
    19
# set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0.
slouken@0
    20
#
slouken@0
    21
SDL_MAJOR_VERSION=1
slouken@1895
    22
SDL_MINOR_VERSION=3
slouken@1895
    23
SDL_MICRO_VERSION=0
slouken@1886
    24
SDL_INTERFACE_AGE=0
slouken@1895
    25
SDL_BINARY_AGE=0
slouken@0
    26
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
slouken@0
    27
slouken@0
    28
AC_SUBST(SDL_MAJOR_VERSION)
slouken@0
    29
AC_SUBST(SDL_MINOR_VERSION)
slouken@0
    30
AC_SUBST(SDL_MICRO_VERSION)
slouken@0
    31
AC_SUBST(SDL_INTERFACE_AGE)
slouken@0
    32
AC_SUBST(SDL_BINARY_AGE)
slouken@0
    33
AC_SUBST(SDL_VERSION)
slouken@0
    34
slouken@0
    35
# libtool versioning
slouken@3085
    36
LT_INIT([win32-dll])
slouken@3085
    37
slouken@0
    38
LT_RELEASE=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION
slouken@0
    39
LT_CURRENT=`expr $SDL_MICRO_VERSION - $SDL_INTERFACE_AGE`
slouken@0
    40
LT_REVISION=$SDL_INTERFACE_AGE
slouken@0
    41
LT_AGE=`expr $SDL_BINARY_AGE - $SDL_INTERFACE_AGE`
slouken@3368
    42
m4_pattern_allow([^LT_])
slouken@0
    43
slouken@0
    44
AC_SUBST(LT_RELEASE)
slouken@0
    45
AC_SUBST(LT_CURRENT)
slouken@0
    46
AC_SUBST(LT_REVISION)
slouken@0
    47
AC_SUBST(LT_AGE)
slouken@0
    48
slouken@1550
    49
dnl Detect the canonical build and host environments
slouken@3368
    50
dnl AC_CANONICAL_HOST
slouken@0
    51
slouken@3332
    52
dnl Check for tools
slouken@3332
    53
AC_PROG_LIBTOOL
slouken@3332
    54
AC_PROG_CC
slouken@3332
    55
AC_PROG_CXX
slouken@3332
    56
AC_PROG_INSTALL
slouken@3332
    57
AC_PROG_MAKE_SET
slouken@3332
    58
if test -z "$host_alias"; then
slouken@3332
    59
    hostaliaswindres=
slouken@3332
    60
else
slouken@3332
    61
    hostaliaswindres="$host_alias-windres"
slouken@3332
    62
fi
slouken@3332
    63
AC_CHECK_PROGS(WINDRES, [windres $hostaliaswindres $host_os-windres])
slouken@3332
    64
slouken@1389
    65
dnl Set up the compiler and linker flags
slouken@1571
    66
INCLUDE="-I$srcdir/include"
slouken@1373
    67
if test x$srcdir != x.; then
slouken@1742
    68
    # Remove SDL_config.h from the source directory, since it's the
slouken@1742
    69
    # default one, and we want to include the one that we generate.
slouken@1742
    70
    if test -f $srcdir/include/SDL_config.h; then
slouken@1742
    71
        rm $srcdir/include/SDL_config.h
slouken@1742
    72
    fi
slouken@1571
    73
    INCLUDE="-Iinclude $INCLUDE"
slouken@1373
    74
fi
slouken@1550
    75
case "$host" in
slouken@1389
    76
    *-*-cygwin*)
slouken@1389
    77
        # We build SDL on cygwin without the UNIX emulation layer
slouken@1521
    78
        BASE_CFLAGS="-I/usr/include/mingw -mno-cygwin"
slouken@1521
    79
        BASE_LDFLAGS="-mno-cygwin"
slouken@1389
    80
        ;;
slouken@1389
    81
    *)
slouken@3604
    82
        BASE_CFLAGS=""
slouken@1521
    83
        BASE_LDFLAGS=""
slouken@1389
    84
        ;;
slouken@1389
    85
esac
slouken@1648
    86
BUILD_CFLAGS="$CFLAGS $CPPFLAGS"
slouken@3382
    87
# The default optimization for SDL 1.3 is -O3 (Bug #31)
slouken@3382
    88
if test x$orig_CFLAGS = x; then
slouken@3382
    89
    BUILD_CFLAGS=`echo $BUILD_CFLAGS | sed 's/-O2/-O3/'`
slouken@3382
    90
fi
slouken@1521
    91
EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS"
slouken@1521
    92
BUILD_LDFLAGS="$LDFLAGS"
slouken@1521
    93
EXTRA_LDFLAGS="$BASE_LDFLAGS"
slouken@2163
    94
## These are common directories to find software packages
slouken@2163
    95
#for path in /usr/freeware /usr/pkg /usr/X11R6 /usr/local; do
slouken@1823
    96
#    if test -d $path/include; then
slouken@1823
    97
#        EXTRA_CFLAGS="$EXTRA_CFLAGS -I$path/include"
slouken@1823
    98
#    fi
slouken@1823
    99
#    if test -d $path/lib; then
slouken@1823
   100
#        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$path/lib"
slouken@1823
   101
#    fi
slouken@1823
   102
#done
slouken@1521
   103
SDL_CFLAGS="$BASE_CFLAGS"
slouken@1521
   104
SDL_LIBS="-lSDL $BASE_LDFLAGS"
slouken@1521
   105
CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS"
slouken@1521
   106
CFLAGS="$CFLAGS $EXTRA_CFLAGS"
slouken@1521
   107
LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
slouken@1373
   108
slouken@3391
   109
dnl set this to use on systems that use lib64 instead of lib
slouken@3391
   110
base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
slouken@3391
   111
slouken@3391
   112
dnl Function to find a library in the compiler search path
slouken@3391
   113
find_lib()
slouken@3391
   114
{
slouken@3391
   115
    gcc_bin_path=[`$CC -print-search-dirs 2>/dev/null | fgrep programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
slouken@3391
   116
    gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
slouken@3391
   117
    env_lib_path=[`echo $LIBS $LDFLAGS $* | sed 's/-L[ ]*//g'`]
slouken@3391
   118
    if test "$cross_compiling" = yes; then
slouken@3391
   119
        host_lib_path=""
slouken@3391
   120
    else
slouken@3391
   121
        host_lib_path="/usr/$base_libdir /usr/local/$base_libdir"
slouken@3391
   122
    fi
slouken@3391
   123
    for path in $gcc_bin_path $gcc_lib_path $env_lib_path $host_lib_path; do
slouken@3391
   124
        lib=[`ls -- $path/$1 2>/dev/null | sort | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@3391
   125
        if test x$lib != x; then
slouken@3391
   126
            echo $lib
slouken@3391
   127
            return
slouken@3391
   128
        fi
slouken@3391
   129
    done
slouken@3391
   130
}
slouken@3391
   131
slouken@1353
   132
dnl Check for compiler characteristics
slouken@1341
   133
AC_C_CONST
slouken@1341
   134
AC_C_INLINE
slouken@1353
   135
AC_C_VOLATILE
slouken@1353
   136
slouken@3647
   137
dnl See whether we want assertions for debugging/sanity checking SDL itself.
slouken@3647
   138
AC_ARG_ENABLE(assertions,
slouken@3647
   139
AC_HELP_STRING([--enable-assertions],
slouken@3654
   140
               [Enable internal sanity checks (auto/disabled/release/enabled/paranoid) [[default=auto]]]),
slouken@3654
   141
              , enable_assertions=auto)
slouken@3654
   142
case "$enable_assertions" in
slouken@3654
   143
    auto) # Use optimization settings to determine assertion level
slouken@3654
   144
        ;;
slouken@3654
   145
    disabled)
slouken@3654
   146
        AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 0)
slouken@3654
   147
        ;;
slouken@3654
   148
    release)
slouken@3654
   149
        AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 1)
slouken@3654
   150
        ;;
slouken@3654
   151
    enabled)
slouken@3654
   152
        AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 2)
slouken@3654
   153
        ;;
slouken@3654
   154
    paranoid)
slouken@3654
   155
        AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 3)
slouken@3654
   156
        ;;
slouken@3654
   157
    *)
slouken@3654
   158
        AC_MSG_ERROR([*** unknown assertion level. stop.])
slouken@3654
   159
        ;;
slouken@3654
   160
esac
slouken@3647
   161
slouken@3354
   162
dnl See whether we can use gcc style dependency tracking
slouken@3354
   163
AC_ARG_ENABLE(dependency-tracking,
slouken@3354
   164
AC_HELP_STRING([--enable-dependency-tracking],
slouken@3354
   165
               [Use gcc -MMD -MT dependency tracking [[default=yes]]]),
slouken@3354
   166
              , enable_dependency_tracking=yes)
slouken@3354
   167
if test x$enable_dependency_tracking = xyes; then
slouken@3354
   168
    have_gcc_mmd_mt=no
slouken@3354
   169
    AC_MSG_CHECKING(for GCC -MMD -MT option)
slouken@3354
   170
    AC_TRY_COMPILE([
slouken@3354
   171
    #if !defined(__GNUC__) || __GNUC__ < 3
slouken@3354
   172
    #error Dependency tracking requires GCC 3.0 or newer
slouken@3354
   173
    #endif
slouken@3354
   174
    ],[
slouken@3354
   175
    ],[
slouken@3354
   176
    have_gcc_mmd_mt=yes
slouken@3354
   177
    ])
slouken@3354
   178
    AC_MSG_RESULT($have_gcc_mmd_mt)
slouken@3354
   179
slouken@3354
   180
    if test x$have_gcc_mmd_mt = xyes; then
slouken@3354
   181
        DEPENDENCY_TRACKING_OPTIONS="-MMD -MT \$@"
slouken@3354
   182
    fi
slouken@3354
   183
fi
slouken@3354
   184
    
slouken@1361
   185
dnl See whether we are allowed to use the system C library
slouken@1361
   186
AC_ARG_ENABLE(libc,
slouken@1637
   187
AC_HELP_STRING([--enable-libc], [Use the system C library [[default=yes]]]),
slouken@1361
   188
              , enable_libc=yes)
slouken@1361
   189
if test x$enable_libc = xyes; then
slouken@1361
   190
    AC_DEFINE(HAVE_LIBC)
slouken@1361
   191
slouken@1361
   192
    dnl Check for C library headers
slouken@1361
   193
    AC_HEADER_STDC
slouken@1501
   194
    AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h)
slouken@1353
   195
slouken@1361
   196
    dnl Check for typedefs, structures, etc.
slouken@1361
   197
    AC_TYPE_SIZE_T
slouken@1361
   198
    if test x$ac_cv_header_inttypes_h = xyes -o x$ac_cv_header_stdint_h = xyes; then
slouken@1361
   199
        AC_CHECK_TYPE(int64_t)
slouken@1361
   200
        if test x$ac_cv_type_int64_t = xyes; then
slouken@1361
   201
            AC_DEFINE(SDL_HAS_64BIT_TYPE)
slouken@1361
   202
        fi
slouken@1361
   203
        have_inttypes=yes
slouken@1353
   204
    fi
slouken@1361
   205
slouken@3012
   206
    dnl Check for defines
slouken@3012
   207
    AC_CHECK_DEFINE(M_PI, math.h)
slouken@3012
   208
slouken@1361
   209
    dnl Checks for library functions.
icculus@2079
   210
    case "$host" in
icculus@2079
   211
    *-*-cygwin* | *-*-mingw32*)
icculus@2079
   212
        ;;
icculus@2079
   213
    *)
icculus@2079
   214
        AC_FUNC_ALLOCA
icculus@2079
   215
        ;;
icculus@2079
   216
    esac
icculus@2079
   217
slouken@1361
   218
    AC_FUNC_MEMCMP
slouken@1361
   219
    if test x$ac_cv_func_memcmp_working = xyes; then
slouken@1361
   220
        AC_DEFINE(HAVE_MEMCMP)
slouken@1361
   221
    fi
slouken@1361
   222
    AC_FUNC_STRTOD
slouken@1361
   223
    if test x$ac_cv_func_strtod = xyes; then
slouken@1361
   224
        AC_DEFINE(HAVE_STRTOD)
slouken@1361
   225
    fi
slouken@3405
   226
    AC_CHECK_FUNC(mprotect,
slouken@3405
   227
        AC_TRY_COMPILE([
slouken@3405
   228
          #include <sys/types.h>
slouken@3405
   229
          #include <sys/mman.h>
slouken@3405
   230
        ],[
slouken@3405
   231
        ],[
slouken@3405
   232
        AC_DEFINE(HAVE_MPROTECT)
slouken@3405
   233
        ]),
slouken@3405
   234
    )
slouken@3586
   235
    AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp sscanf snprintf vsnprintf sigaction setjmp nanosleep sysconf sysctlbyname)
slouken@1373
   236
slouken@3014
   237
    AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
slouken@4873
   238
    AC_CHECK_FUNCS(atan atan2 ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt)
slouken@3014
   239
slouken@3014
   240
    AC_CHECK_LIB(iconv, libiconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"])
slouken@3014
   241
    AC_CHECK_FUNCS(iconv)
slouken@1361
   242
fi
slouken@1361
   243
bob@3180
   244
AC_CHECK_SIZEOF(void*)
slouken@1361
   245
if test x$have_inttypes != xyes; then
slouken@1353
   246
    AC_CHECK_SIZEOF(char, 1)
slouken@1353
   247
    AC_CHECK_SIZEOF(short, 2)
slouken@1353
   248
    AC_CHECK_SIZEOF(int, 4)
slouken@1353
   249
    AC_CHECK_SIZEOF(long, 4)
slouken@1353
   250
    AC_CHECK_SIZEOF(long long, 8)
slouken@1353
   251
    if test x$ac_cv_sizeof_char = x1; then
slouken@1353
   252
        AC_DEFINE(int8_t, signed char)
slouken@1353
   253
        AC_DEFINE(uint8_t, unsigned char)
slouken@1353
   254
    fi
slouken@1353
   255
    if test x$ac_cv_sizeof_short = x2; then
slouken@1353
   256
        AC_DEFINE(int16_t, signed short)
slouken@1353
   257
        AC_DEFINE(uint16_t, unsigned short)
slouken@1353
   258
    else
slouken@1353
   259
        if test x$ac_cv_sizeof_int = x2; then
slouken@1353
   260
            AC_DEFINE(int16_t, signed int)
slouken@1353
   261
            AC_DEFINE(uint16_t, unsigned int)
slouken@1353
   262
        fi
slouken@1353
   263
    fi
slouken@1353
   264
    if test x$ac_cv_sizeof_int = x4; then
slouken@1353
   265
        AC_DEFINE(int32_t, signed int)
slouken@1353
   266
        AC_DEFINE(uint32_t, unsigned int)
slouken@1353
   267
    else
slouken@1353
   268
        if test x$ac_cv_sizeof_long = x4; then
slouken@1353
   269
            AC_DEFINE(int32_t, signed long)
slouken@1353
   270
            AC_DEFINE(uint32_t, unsigned long)
slouken@1353
   271
        fi
slouken@1353
   272
    fi
slouken@1353
   273
    if test x$ac_cv_sizeof_long = x8; then
slouken@1353
   274
        AC_DEFINE(int64_t, signed long)
slouken@1353
   275
        AC_DEFINE(uint64_t, unsigned long)
slouken@1353
   276
        AC_DEFINE(SDL_HAS_64BIT_TYPE)
slouken@1353
   277
    else
slouken@1353
   278
        if test x$ac_cv_sizeof_long_long = x8; then
slouken@1353
   279
            AC_DEFINE(int64_t, signed long long)
slouken@1353
   280
            AC_DEFINE(uint64_t, unsigned long long)
slouken@1353
   281
            AC_DEFINE(SDL_HAS_64BIT_TYPE)
slouken@1353
   282
        fi
slouken@1353
   283
    fi
slouken@1361
   284
    AC_DEFINE(size_t, unsigned int)
slouken@1361
   285
    AC_DEFINE(uintptr_t, unsigned long)
slouken@1353
   286
fi
slouken@1341
   287
slouken@1361
   288
# Standard C sources
slouken@1361
   289
SOURCES="$SOURCES $srcdir/src/*.c"
slouken@1361
   290
SOURCES="$SOURCES $srcdir/src/audio/*.c"
slouken@5003
   291
SOURCES="$SOURCES $srcdir/src/atomic/*.c"
slouken@1361
   292
SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c"
slouken@1361
   293
SOURCES="$SOURCES $srcdir/src/events/*.c"
slouken@1361
   294
SOURCES="$SOURCES $srcdir/src/file/*.c"
slouken@1361
   295
SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
slouken@1361
   296
SOURCES="$SOURCES $srcdir/src/thread/*.c"
slouken@1361
   297
SOURCES="$SOURCES $srcdir/src/timer/*.c"
slouken@1361
   298
SOURCES="$SOURCES $srcdir/src/video/*.c"
slouken@1361
   299
slouken@0
   300
dnl Enable/disable various subsystems of the SDL library
slouken@0
   301
bob@3199
   302
AC_ARG_ENABLE(atomic,
bob@3199
   303
AC_HELP_STRING([--enable-atomic], [Enable the atomic operations subsystem [[default=yes]]]),
bob@3199
   304
              , enable_atomic=yes)
bob@3199
   305
if test x$enable_atomic != xyes; then
bob@3199
   306
    AC_DEFINE(SDL_ATOMIC_DISABLED)
bob@3199
   307
fi
slouken@0
   308
AC_ARG_ENABLE(audio,
slouken@1637
   309
AC_HELP_STRING([--enable-audio], [Enable the audio subsystem [[default=yes]]]),
slouken@0
   310
              , enable_audio=yes)
slouken@1361
   311
if test x$enable_audio != xyes; then
slouken@1361
   312
    AC_DEFINE(SDL_AUDIO_DISABLED)
slouken@0
   313
fi
slouken@0
   314
AC_ARG_ENABLE(video,
slouken@1637
   315
AC_HELP_STRING([--enable-video], [Enable the video subsystem [[default=yes]]]),
slouken@0
   316
              , enable_video=yes)
slouken@1361
   317
if test x$enable_video != xyes; then
slouken@1361
   318
    AC_DEFINE(SDL_VIDEO_DISABLED)
slouken@0
   319
fi
slouken@0
   320
AC_ARG_ENABLE(events,
slouken@1637
   321
AC_HELP_STRING([--enable-events], [Enable the events subsystem [[default=yes]]]),
slouken@0
   322
              , enable_events=yes)
slouken@1361
   323
if test x$enable_events != xyes; then
slouken@1361
   324
    AC_DEFINE(SDL_EVENTS_DISABLED)
slouken@0
   325
fi
slouken@0
   326
AC_ARG_ENABLE(joystick,
slouken@1637
   327
AC_HELP_STRING([--enable-joystick], [Enable the joystick subsystem [[default=yes]]]),
slouken@0
   328
              , enable_joystick=yes)
slouken@1361
   329
if test x$enable_joystick != xyes; then
slouken@1361
   330
    AC_DEFINE(SDL_JOYSTICK_DISABLED)
icculus@2103
   331
else
icculus@2103
   332
    SOURCES="$SOURCES $srcdir/src/joystick/*.c"
slouken@0
   333
fi
slouken@2713
   334
AC_ARG_ENABLE(haptic,
slouken@2713
   335
AC_HELP_STRING([--enable-haptic], [Enable the haptic (force feedback) subsystem [[default=yes]]]),
slouken@2713
   336
              , enable_haptic=yes)
slouken@2713
   337
if test x$enable_haptic != xyes; then
slouken@2713
   338
    AC_DEFINE(SDL_HAPTIC_DISABLED)
slouken@2713
   339
else
slouken@2713
   340
    SOURCES="$SOURCES $srcdir/src/haptic/*.c"
slouken@2713
   341
fi
icculus@3170
   342
AC_ARG_ENABLE(power,
icculus@3170
   343
AC_HELP_STRING([--enable-power], [Enable the power subsystem [[default=yes]]]),
icculus@3170
   344
              , enable_power=yes)
icculus@3170
   345
if test x$enable_power != xyes; then
icculus@3170
   346
    AC_DEFINE(SDL_POWER_DISABLED)
icculus@3170
   347
else
icculus@3170
   348
    SOURCES="$SOURCES $srcdir/src/power/*.c"
icculus@3170
   349
fi
slouken@0
   350
AC_ARG_ENABLE(threads,
slouken@1637
   351
AC_HELP_STRING([--enable-threads], [Enable the threading subsystem [[default=yes]]]),
slouken@0
   352
              , enable_threads=yes)
slouken@0
   353
if test x$enable_threads != xyes; then
slouken@1361
   354
    AC_DEFINE(SDL_THREADS_DISABLED)
slouken@0
   355
fi
slouken@0
   356
AC_ARG_ENABLE(timers,
slouken@1637
   357
AC_HELP_STRING([--enable-timers], [Enable the timer subsystem [[default=yes]]]),
slouken@0
   358
              , enable_timers=yes)
slouken@1361
   359
if test x$enable_timers != xyes; then
slouken@1361
   360
    AC_DEFINE(SDL_TIMERS_DISABLED)
slouken@0
   361
fi
slouken@0
   362
AC_ARG_ENABLE(file,
slouken@1637
   363
AC_HELP_STRING([--enable-file], [Enable the file subsystem [[default=yes]]]),
slouken@0
   364
              , enable_file=yes)
slouken@1361
   365
if test x$enable_file != xyes; then
slouken@1361
   366
    AC_DEFINE(SDL_FILE_DISABLED)
slouken@1361
   367
fi
slouken@1361
   368
AC_ARG_ENABLE(loadso,
slouken@1637
   369
AC_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [[default=yes]]]),
slouken@1361
   370
              , enable_loadso=yes)
slouken@1361
   371
if test x$enable_loadso != xyes; then
slouken@1361
   372
    AC_DEFINE(SDL_LOADSO_DISABLED)
slouken@0
   373
fi
slouken@740
   374
AC_ARG_ENABLE(cpuinfo,
slouken@1637
   375
AC_HELP_STRING([--enable-cpuinfo], [Enable the cpuinfo subsystem [[default=yes]]]),
slouken@740
   376
              , enable_cpuinfo=yes)
slouken@1361
   377
if test x$enable_cpuinfo != xyes; then
slouken@1361
   378
    AC_DEFINE(SDL_CPUINFO_DISABLED)
slouken@1361
   379
fi
slouken@1402
   380
AC_ARG_ENABLE(assembly,
slouken@1637
   381
AC_HELP_STRING([--enable-assembly], [Enable assembly routines [[default=yes]]]),
slouken@1402
   382
              , enable_assembly=yes)
slouken@1402
   383
if test x$enable_assembly = xyes; then
slouken@1402
   384
    AC_DEFINE(SDL_ASSEMBLY_ROUTINES)
slouken@2247
   385
slouken@2856
   386
    # Make sure that we don't generate floating point code that would
slouken@2856
   387
    # cause illegal instruction exceptions on older processors
slouken@2856
   388
    case "$host" in
slouken@2856
   389
        *-*-darwin*)
slouken@2856
   390
            # Don't need to worry about Apple hardware, it's all SSE capable
slouken@2856
   391
            default_ssemath=yes
slouken@2856
   392
            ;;
slouken@2856
   393
        *64-*-*)
slouken@2856
   394
            # x86 64-bit architectures all have SSE instructions
slouken@2856
   395
            default_ssemath=yes
slouken@2856
   396
            ;;
slouken@3392
   397
        *)
slouken@2856
   398
            default_ssemath=no
slouken@2856
   399
            ;;
slouken@2856
   400
    esac
slouken@2856
   401
    AC_ARG_ENABLE(ssemath,
slouken@2856
   402
AC_HELP_STRING([--enable-ssemath], [Allow GCC to use SSE floating point math [[default=no]]]),
slouken@2856
   403
                  , enable_ssemath=$default_ssemath)
slouken@2856
   404
    if test x$enable_ssemath = xno; then
slouken@2856
   405
        if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes; then
slouken@2856
   406
            EXTRA_CFLAGS="$EXTRA_CFLAGS -mfpmath=387"
slouken@2856
   407
        fi
slouken@2856
   408
    fi
slouken@2856
   409
slouken@2247
   410
    dnl Check for various instruction support
slouken@2247
   411
    AC_ARG_ENABLE(mmx,
slouken@2247
   412
AC_HELP_STRING([--enable-mmx], [use MMX assembly routines [[default=yes]]]),
slouken@2247
   413
                  , enable_mmx=yes)
slouken@2247
   414
    if test x$enable_mmx = xyes; then
slouken@2247
   415
        save_CFLAGS="$CFLAGS"
slouken@2247
   416
        have_gcc_mmx=no
slouken@2247
   417
        AC_MSG_CHECKING(for GCC -mmmx option)
slouken@2247
   418
        mmx_CFLAGS="-mmmx"
slouken@2247
   419
        CFLAGS="$save_CFLAGS $mmx_CFLAGS"
slouken@2247
   420
slouken@2247
   421
        AC_TRY_COMPILE([
slouken@4426
   422
        #ifdef __MINGW32__
slouken@4426
   423
        #include <_mingw.h>
slouken@4426
   424
        #ifdef __MINGW64_VERSION_MAJOR
slouken@4426
   425
        #include <intrin.h>
slouken@4426
   426
        #else
slouken@2247
   427
        #include <mmintrin.h>
slouken@4426
   428
        #endif
slouken@4426
   429
        #else
slouken@4426
   430
        #include <mmintrin.h>
slouken@4426
   431
        #endif
slouken@2261
   432
        #ifndef __MMX__
slouken@2261
   433
        #error Assembler CPP flag not enabled
slouken@2261
   434
        #endif
slouken@2247
   435
        ],[
slouken@2247
   436
        ],[
slouken@2247
   437
        have_gcc_mmx=yes
slouken@2247
   438
        ])
slouken@2247
   439
        AC_MSG_RESULT($have_gcc_mmx)
slouken@2290
   440
        CFLAGS="$save_CFLAGS"
slouken@2247
   441
slouken@2247
   442
        if test x$have_gcc_mmx = xyes; then
slouken@2247
   443
            EXTRA_CFLAGS="$EXTRA_CFLAGS $mmx_CFLAGS"
slouken@2247
   444
        fi
slouken@2247
   445
    fi
slouken@2247
   446
slouken@2261
   447
    AC_ARG_ENABLE(3dnow,
slouken@2261
   448
AC_HELP_STRING([--enable-3dnow], [use MMX assembly routines [[default=yes]]]),
slouken@2261
   449
                  , enable_3dnow=yes)
slouken@2261
   450
    if test x$enable_3dnow = xyes; then
slouken@2261
   451
        save_CFLAGS="$CFLAGS"
slouken@2261
   452
        have_gcc_3dnow=no
slouken@2261
   453
        AC_MSG_CHECKING(for GCC -m3dnow option)
slouken@2261
   454
        amd3dnow_CFLAGS="-m3dnow"
slouken@2261
   455
        CFLAGS="$save_CFLAGS $amd3dnow_CFLAGS"
slouken@2261
   456
slouken@2261
   457
        AC_TRY_COMPILE([
slouken@2261
   458
        #include <mm3dnow.h>
slouken@2261
   459
        #ifndef __3dNOW__
slouken@2261
   460
        #error Assembler CPP flag not enabled
slouken@2261
   461
        #endif
slouken@2261
   462
        ],[
slouken@2261
   463
        ],[
slouken@2261
   464
        have_gcc_3dnow=yes
slouken@2261
   465
        ])
slouken@2261
   466
        AC_MSG_RESULT($have_gcc_3dnow)
slouken@2290
   467
        CFLAGS="$save_CFLAGS"
slouken@2261
   468
slouken@2261
   469
        if test x$have_gcc_3dnow = xyes; then
slouken@2261
   470
            EXTRA_CFLAGS="$EXTRA_CFLAGS $amd3dnow_CFLAGS"
slouken@2261
   471
        fi
slouken@2261
   472
    fi
slouken@2261
   473
slouken@2247
   474
    AC_ARG_ENABLE(sse,
slouken@2247
   475
AC_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]),
slouken@2247
   476
                  , enable_sse=yes)
slouken@2247
   477
    if test x$enable_sse = xyes; then
slouken@2247
   478
        save_CFLAGS="$CFLAGS"
slouken@2247
   479
        have_gcc_sse=no
slouken@2247
   480
        AC_MSG_CHECKING(for GCC -msse option)
slouken@2247
   481
        sse_CFLAGS="-msse"
slouken@2247
   482
        CFLAGS="$save_CFLAGS $sse_CFLAGS"
slouken@2247
   483
slouken@2247
   484
        AC_TRY_COMPILE([
slouken@4426
   485
        #ifdef __MINGW32__
slouken@4426
   486
        #include <_mingw.h>
slouken@4426
   487
        #ifdef __MINGW64_VERSION_MAJOR
slouken@4426
   488
        #include <intrin.h>
slouken@4426
   489
        #else
slouken@2247
   490
        #include <xmmintrin.h>
slouken@4426
   491
        #endif
slouken@4426
   492
        #else
slouken@4426
   493
        #include <xmmintrin.h>
slouken@4426
   494
        #endif
slouken@2261
   495
        #ifndef __SSE__
slouken@2261
   496
        #error Assembler CPP flag not enabled
slouken@2261
   497
        #endif
slouken@2247
   498
        ],[
slouken@2247
   499
        ],[
slouken@2247
   500
        have_gcc_sse=yes
slouken@2247
   501
        ])
slouken@2247
   502
        AC_MSG_RESULT($have_gcc_sse)
slouken@2290
   503
        CFLAGS="$save_CFLAGS"
slouken@2247
   504
slouken@2247
   505
        if test x$have_gcc_sse = xyes; then
slouken@2247
   506
            EXTRA_CFLAGS="$EXTRA_CFLAGS $sse_CFLAGS"
slouken@2247
   507
        fi
slouken@2247
   508
    fi
slouken@2247
   509
slouken@2264
   510
    AC_ARG_ENABLE(sse2,
slouken@2856
   511
AC_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=no]]]),
slouken@2856
   512
                  , enable_sse2=$default_ssemath)
slouken@2264
   513
    if test x$enable_sse2 = xyes; then
slouken@2264
   514
        save_CFLAGS="$CFLAGS"
slouken@2264
   515
        have_gcc_sse2=no
slouken@2264
   516
        AC_MSG_CHECKING(for GCC -msse2 option)
slouken@2264
   517
        sse2_CFLAGS="-msse2"
slouken@2264
   518
        CFLAGS="$save_CFLAGS $sse2_CFLAGS"
slouken@2264
   519
slouken@2264
   520
        AC_TRY_COMPILE([
slouken@4426
   521
        #ifdef __MINGW32__
slouken@4426
   522
        #include <_mingw.h>
slouken@4426
   523
        #ifdef __MINGW64_VERSION_MAJOR
slouken@4426
   524
        #include <intrin.h>
slouken@4426
   525
        #else
slouken@2264
   526
        #include <emmintrin.h>
slouken@4426
   527
        #endif
slouken@4426
   528
        #else
slouken@4426
   529
        #include <emmintrin.h>
slouken@4426
   530
        #endif
slouken@2264
   531
        #ifndef __SSE2__
slouken@2264
   532
        #error Assembler CPP flag not enabled
slouken@2264
   533
        #endif
slouken@2264
   534
        ],[
slouken@2264
   535
        ],[
slouken@2264
   536
        have_gcc_sse2=yes
slouken@2264
   537
        ])
slouken@2264
   538
        AC_MSG_RESULT($have_gcc_sse2)
slouken@2290
   539
        CFLAGS="$save_CFLAGS"
slouken@2264
   540
slouken@2264
   541
        if test x$have_gcc_sse2 = xyes; then
slouken@2264
   542
            EXTRA_CFLAGS="$EXTRA_CFLAGS $sse2_CFLAGS"
slouken@2264
   543
        fi
slouken@2264
   544
    fi
slouken@2264
   545
slouken@2247
   546
    AC_ARG_ENABLE(altivec,
slouken@2247
   547
AC_HELP_STRING([--enable-altivec], [use Altivec assembly routines [[default=yes]]]),
slouken@2247
   548
                  , enable_altivec=yes)
slouken@2247
   549
    if test x$enable_altivec = xyes; then
slouken@2247
   550
        save_CFLAGS="$CFLAGS"
slouken@2247
   551
        have_gcc_altivec=no
slouken@3390
   552
        have_altivec_h_hdr=no
slouken@2247
   553
        altivec_CFLAGS="-maltivec"
slouken@2247
   554
        CFLAGS="$save_CFLAGS $altivec_CFLAGS"
slouken@2247
   555
slouken@3390
   556
        AC_MSG_CHECKING(for Altivec with GCC altivec.h and -maltivec option)
slouken@3390
   557
        AC_TRY_COMPILE([
slouken@3390
   558
        #include <altivec.h>
slouken@3390
   559
        vector unsigned int vzero() {
slouken@3390
   560
            return vec_splat_u32(0);
slouken@3390
   561
        }
slouken@3390
   562
        ],[
slouken@3390
   563
        ],[
slouken@3390
   564
        have_gcc_altivec=yes
slouken@3390
   565
        have_altivec_h_hdr=yes
slouken@3390
   566
        ])
slouken@3390
   567
        AC_MSG_RESULT($have_gcc_altivec)
slouken@3390
   568
slouken@3390
   569
        if test x$have_gcc_altivec = xno; then
slouken@3390
   570
            AC_MSG_CHECKING(for Altivec with GCC -maltivec option)
slouken@3390
   571
            AC_TRY_COMPILE([
slouken@3390
   572
            vector unsigned int vzero() {
slouken@3390
   573
                return vec_splat_u32(0);
slouken@3390
   574
            }
slouken@3390
   575
            ],[
slouken@3390
   576
            ],[
slouken@3390
   577
            have_gcc_altivec=yes
slouken@3390
   578
            ])
slouken@3390
   579
            AC_MSG_RESULT($have_gcc_altivec)
slouken@2247
   580
        fi
slouken@2247
   581
slouken@2247
   582
        if test x$have_gcc_altivec = xno; then
slouken@3390
   583
            AC_MSG_CHECKING(for Altivec with GCC altivec.h and -faltivec option)
slouken@3390
   584
            altivec_CFLAGS="-faltivec"
slouken@3390
   585
            CFLAGS="$save_CFLAGS $altivec_CFLAGS"
slouken@3390
   586
            AC_TRY_COMPILE([
slouken@3390
   587
            #include <altivec.h>
slouken@3390
   588
            vector unsigned int vzero() {
slouken@3390
   589
                return vec_splat_u32(0);
slouken@3390
   590
            }
slouken@3390
   591
            ],[
slouken@3390
   592
            ],[
slouken@3390
   593
            have_gcc_altivec=yes
slouken@3390
   594
            have_altivec_h_hdr=yes
slouken@3390
   595
            ])
slouken@3390
   596
            AC_MSG_RESULT($have_gcc_altivec)
slouken@3392
   597
        fi
slouken@3390
   598
slouken@3390
   599
        if test x$have_gcc_altivec = xno; then
slouken@2247
   600
            AC_MSG_CHECKING(for Altivec with GCC -faltivec option)
slouken@3390
   601
            AC_TRY_COMPILE([
slouken@3390
   602
            vector unsigned int vzero() {
slouken@3390
   603
                return vec_splat_u32(0);
slouken@3390
   604
            }
slouken@3390
   605
            ],[
slouken@3390
   606
            ],[
slouken@3390
   607
            have_gcc_altivec=yes
slouken@3390
   608
            ])
slouken@3390
   609
            AC_MSG_RESULT($have_gcc_altivec)
slouken@2247
   610
        fi
slouken@2247
   611
        CFLAGS="$save_CFLAGS"
slouken@2247
   612
slouken@2247
   613
        if test x$have_gcc_altivec = xyes; then
slouken@2247
   614
            AC_DEFINE(SDL_ALTIVEC_BLITTERS)
slouken@2247
   615
            if test x$have_altivec_h_hdr = xyes; then
slouken@2247
   616
              AC_DEFINE(HAVE_ALTIVEC_H)
slouken@2247
   617
            fi
slouken@2247
   618
            EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS"
slouken@2247
   619
        fi
slouken@2247
   620
    fi
slouken@740
   621
fi
slouken@0
   622
slouken@0
   623
dnl See if the OSS audio interface is supported
slouken@0
   624
CheckOSS()
slouken@0
   625
{
slouken@0
   626
    AC_ARG_ENABLE(oss,
slouken@1637
   627
AC_HELP_STRING([--enable-oss], [support the OSS audio API [[default=yes]]]),
slouken@0
   628
                  , enable_oss=yes)
slouken@0
   629
    if test x$enable_audio = xyes -a x$enable_oss = xyes; then
slouken@0
   630
        AC_MSG_CHECKING(for OSS audio support)
slouken@0
   631
        have_oss=no
slouken@94
   632
        if test x$have_oss != xyes; then
slouken@94
   633
            AC_TRY_COMPILE([
slouken@94
   634
              #include <sys/soundcard.h>
slouken@94
   635
            ],[
slouken@94
   636
              int arg = SNDCTL_DSP_SETFRAGMENT;
slouken@94
   637
            ],[
slouken@94
   638
            have_oss=yes
slouken@94
   639
            ])
slouken@94
   640
        fi
slouken@94
   641
        if test x$have_oss != xyes; then
slouken@94
   642
            AC_TRY_COMPILE([
slouken@94
   643
              #include <soundcard.h>
slouken@94
   644
            ],[
slouken@94
   645
              int arg = SNDCTL_DSP_SETFRAGMENT;
slouken@94
   646
            ],[
slouken@94
   647
            have_oss=yes
slouken@1361
   648
            AC_DEFINE(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H)
slouken@94
   649
            ])
slouken@94
   650
        fi
slouken@0
   651
        AC_MSG_RESULT($have_oss)
slouken@0
   652
        if test x$have_oss = xyes; then
slouken@1361
   653
            AC_DEFINE(SDL_AUDIO_DRIVER_OSS)
slouken@1361
   654
            SOURCES="$SOURCES $srcdir/src/audio/dsp/*.c"
slouken@1361
   655
            SOURCES="$SOURCES $srcdir/src/audio/dma/*.c"
slouken@1361
   656
            have_audio=yes
slouken@1361
   657
slouken@1565
   658
            # We may need to link with ossaudio emulation library
slouken@1550
   659
            case "$host" in
slouken@1383
   660
                *-*-openbsd*|*-*-netbsd*)
slouken@1521
   661
                    EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";;
slouken@1361
   662
            esac
slouken@0
   663
        fi
slouken@0
   664
    fi
slouken@0
   665
}
slouken@0
   666
slouken@0
   667
dnl See if the ALSA audio interface is supported
slouken@0
   668
CheckALSA()
slouken@0
   669
{
slouken@0
   670
    AC_ARG_ENABLE(alsa,
slouken@1637
   671
AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [[default=yes]]]),
slouken@0
   672
                  , enable_alsa=yes)
slouken@0
   673
    if test x$enable_audio = xyes -a x$enable_alsa = xyes; then
slouken@948
   674
        AM_PATH_ALSA(0.9.0, have_alsa=yes, have_alsa=no)
slouken@1009
   675
        # Restore all flags from before the ALSA detection runs
slouken@1009
   676
        CFLAGS="$alsa_save_CFLAGS"
slouken@1009
   677
        LDFLAGS="$alsa_save_LDFLAGS"
slouken@1009
   678
        LIBS="$alsa_save_LIBS"
slouken@354
   679
        if test x$have_alsa = xyes; then
slouken@865
   680
            AC_ARG_ENABLE(alsa-shared,
slouken@1637
   681
AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [[default=yes]]]),
slouken@1361
   682
                          , enable_alsa_shared=yes)
slouken@3391
   683
            alsa_lib=[`find_lib "libasound.so.*" "$ALSA_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@1361
   684
slouken@1361
   685
            AC_DEFINE(SDL_AUDIO_DRIVER_ALSA)
slouken@1361
   686
            SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c"
slouken@1521
   687
            EXTRA_CFLAGS="$EXTRA_CFLAGS $ALSA_CFLAGS"
slouken@1361
   688
            if test x$have_loadso != xyes && \
slouken@1361
   689
               test x$enable_alsa_shared = xyes; then
slouken@1467
   690
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ALSA loading])
slouken@1361
   691
            fi
slouken@1361
   692
            if test x$have_loadso = xyes && \
slouken@1361
   693
               test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
slouken@3392
   694
                echo "-- dynamic libasound -> $alsa_lib"
slouken@1361
   695
                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ALSA_DYNAMIC, "$alsa_lib")
slouken@1361
   696
            else
slouken@1521
   697
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ALSA_LIBS"
slouken@1361
   698
            fi
slouken@1361
   699
            have_audio=yes
slouken@1361
   700
        fi
slouken@1361
   701
    fi
slouken@0
   702
}
slouken@0
   703
slouken@148
   704
dnl Check whether we want to use IRIX 6.5+ native audio or not
slouken@148
   705
CheckDMEDIA()
slouken@148
   706
{
slouken@148
   707
    if test x$enable_audio = xyes; then
slouken@148
   708
        AC_MSG_CHECKING(for dmedia audio support)
slouken@148
   709
        have_dmedia=no
slouken@148
   710
        AC_TRY_COMPILE([
slouken@148
   711
          #include <dmedia/audio.h>
slouken@148
   712
        ],[
slouken@148
   713
          ALport audio_port;
slouken@148
   714
        ],[
slouken@148
   715
        have_dmedia=yes
slouken@148
   716
        ])
slouken@935
   717
        AC_MSG_RESULT($have_dmedia)
slouken@148
   718
        # Set up files for the audio library
slouken@148
   719
        if test x$have_dmedia = xyes; then
slouken@1361
   720
            AC_DEFINE(SDL_AUDIO_DRIVER_DMEDIA)
slouken@1361
   721
            SOURCES="$SOURCES $srcdir/src/audio/dmedia/*.c"
slouken@1521
   722
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -laudio"
slouken@1361
   723
            have_audio=yes
slouken@148
   724
        fi
slouken@148
   725
    fi
slouken@148
   726
}
slouken@148
   727
slouken@1438
   728
dnl Check whether we want to use Tru64 UNIX native audio or not
slouken@1438
   729
CheckMME()
slouken@1438
   730
{
slouken@1438
   731
    dnl Make sure we are running on an Tru64 UNIX
slouken@1438
   732
    case $ARCH in
slouken@1438
   733
        osf)
slouken@1438
   734
            ;;
slouken@1438
   735
        *)
slouken@1438
   736
            return
slouken@1438
   737
            ;;
slouken@1438
   738
    esac
slouken@1438
   739
    if test x$enable_audio = xyes; then
slouken@1438
   740
        AC_MSG_CHECKING(for MME audio support)
slouken@1438
   741
        MME_CFLAGS="-I/usr/include/mme"
slouken@1438
   742
        MME_LIBS="-lmme"
slouken@1438
   743
        have_mme=no
slouken@1438
   744
        save_CFLAGS="$CFLAGS"
slouken@1438
   745
        CFLAGS="$CFLAGS $MME_CFLAGS"
slouken@1438
   746
        AC_TRY_COMPILE([
slouken@1438
   747
          #include <mme_api.h>
slouken@1438
   748
        ],[
slouken@1438
   749
          HWAVEOUT sound;
slouken@1438
   750
        ],[
slouken@1438
   751
        have_mme=yes
slouken@1438
   752
        ])
slouken@1438
   753
        CFLAGS="$save_CFLAGS"
slouken@1438
   754
        AC_MSG_RESULT($have_mme)
slouken@1438
   755
        # Set up files for the audio library
slouken@1438
   756
        if test x$have_mme = xyes; then
slouken@1438
   757
            AC_DEFINE(SDL_AUDIO_DRIVER_MMEAUDIO)
slouken@1438
   758
            SOURCES="$SOURCES $srcdir/src/audio/mme/*.c"
slouken@1521
   759
            EXTRA_CFLAGS="$EXTRA_CFLAGS $MME_CFLAGS"
slouken@1521
   760
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MME_LIBS"
slouken@1438
   761
            have_audio=yes
slouken@1438
   762
        fi
slouken@1438
   763
    fi
slouken@1438
   764
}
slouken@1438
   765
slouken@0
   766
dnl Find the ESD includes and libraries
slouken@0
   767
CheckESD()
slouken@0
   768
{
slouken@0
   769
    AC_ARG_ENABLE(esd,
slouken@1637
   770
AC_HELP_STRING([--enable-esd], [support the Enlightened Sound Daemon [[default=yes]]]),
slouken@0
   771
                  , enable_esd=yes)
slouken@0
   772
    if test x$enable_audio = xyes -a x$enable_esd = xyes; then
slouken@948
   773
        AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no)
slouken@948
   774
        if test x$have_esd = xyes; then
slouken@294
   775
            AC_ARG_ENABLE(esd-shared,
slouken@1637
   776
AC_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [[default=yes]]]),
slouken@678
   777
                          , enable_esd_shared=yes)
slouken@3391
   778
            esd_lib=[`find_lib "libesd.so.*" "$ESD_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@1467
   779
slouken@1467
   780
            AC_DEFINE(SDL_AUDIO_DRIVER_ESD)
slouken@1467
   781
            SOURCES="$SOURCES $srcdir/src/audio/esd/*.c"
slouken@1521
   782
            EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS"
icculus@1173
   783
            if test x$have_loadso != xyes && \
slouken@296
   784
               test x$enable_esd_shared = xyes; then
slouken@1467
   785
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ESD loading])
slouken@296
   786
            fi
icculus@1173
   787
            if test x$have_loadso = xyes && \
slouken@294
   788
               test x$enable_esd_shared = xyes && test x$esd_lib != x; then
slouken@3392
   789
                echo "-- dynamic libesd -> $esd_lib"
slouken@1361
   790
                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ESD_DYNAMIC, "$esd_lib")
slouken@1467
   791
            else
slouken@1521
   792
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ESD_LIBS"
slouken@294
   793
            fi
slouken@1361
   794
            have_audio=yes
slouken@294
   795
        fi
slouken@0
   796
    fi
slouken@0
   797
}
slouken@0
   798
icculus@2271
   799
dnl Find PulseAudio
icculus@2271
   800
CheckPulseAudio()
icculus@2271
   801
{
icculus@2271
   802
    AC_ARG_ENABLE(pulseaudio,
icculus@2271
   803
AC_HELP_STRING([--enable-pulseaudio], [use PulseAudio [[default=yes]]]),
icculus@2271
   804
                  , enable_pulseaudio=yes)
icculus@2271
   805
    if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then
icculus@2271
   806
        audio_pulseaudio=no
icculus@2271
   807
icculus@2271
   808
        PULSEAUDIO_REQUIRED_VERSION=0.9
icculus@2271
   809
icculus@2271
   810
        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
icculus@2271
   811
        AC_MSG_CHECKING(for PulseAudio $PULSEAUDIO_REQUIRED_VERSION support)
icculus@2271
   812
        if test x$PKG_CONFIG != xno; then
icculus@2271
   813
        if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSEAUDIO_REQUIRED_VERSION libpulse-simple; then
icculus@2271
   814
                PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple`
icculus@2271
   815
                PULSEAUDIO_LIBS=`$PKG_CONFIG --libs libpulse-simple`
icculus@2271
   816
                audio_pulseaudio=yes
slouken@3391
   817
            fi
icculus@2271
   818
        fi
icculus@2271
   819
        AC_MSG_RESULT($audio_pulseaudio)
icculus@2271
   820
icculus@2271
   821
        if test x$audio_pulseaudio = xyes; then
icculus@2271
   822
            AC_ARG_ENABLE(pulseaudio-shared,
icculus@2271
   823
AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [[default=yes]]]),
icculus@2271
   824
                          , enable_pulseaudio_shared=yes)
slouken@3391
   825
            pulseaudio_lib=[`find_lib "libpulse-simple.so.*" "$PULSEAUDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
icculus@2271
   826
icculus@2271
   827
            AC_DEFINE(SDL_AUDIO_DRIVER_PULSEAUDIO)
icculus@2271
   828
            SOURCES="$SOURCES $srcdir/src/audio/pulseaudio/*.c"
icculus@2271
   829
            EXTRA_CFLAGS="$EXTRA_CFLAGS $PULSEAUDIO_CFLAGS"
icculus@2271
   830
            if test x$have_loadso != xyes && \
icculus@2271
   831
               test x$enable_pulseaudio_shared = xyes; then
icculus@2271
   832
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic PulseAudio loading])
icculus@2271
   833
            fi
icculus@2271
   834
            if test x$have_loadso = xyes && \
icculus@2271
   835
               test x$enable_pulseaudio_shared = xyes && test x$pulseaudio_lib != x; then
slouken@3392
   836
                echo "-- dynamic libpulse-simple -> $pulseaudio_lib"
icculus@2271
   837
                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC, "$pulseaudio_lib")
icculus@2271
   838
            else
icculus@2271
   839
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PULSEAUDIO_LIBS"
icculus@2271
   840
            fi
icculus@2271
   841
            have_audio=yes
icculus@2271
   842
        fi
icculus@2271
   843
    fi
icculus@2271
   844
}
icculus@2271
   845
slouken@0
   846
CheckARTSC()
slouken@0
   847
{
slouken@0
   848
    AC_ARG_ENABLE(arts,
slouken@1637
   849
AC_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [[default=yes]]]),
slouken@0
   850
                  , enable_arts=yes)
slouken@0
   851
    if test x$enable_audio = xyes -a x$enable_arts = xyes; then
slouken@1361
   852
        AC_PATH_PROG(ARTSCONFIG, artsc-config)
slouken@1361
   853
        if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then
slouken@0
   854
            : # arts isn't installed
slouken@0
   855
        else
slouken@1361
   856
            ARTS_CFLAGS=`$ARTSCONFIG --cflags`
slouken@1361
   857
            ARTS_LIBS=`$ARTSCONFIG --libs`
slouken@0
   858
            AC_MSG_CHECKING(for aRts development environment)
slouken@0
   859
            audio_arts=no
slouken@0
   860
            save_CFLAGS="$CFLAGS"
slouken@1361
   861
            CFLAGS="$CFLAGS $ARTS_CFLAGS"
slouken@0
   862
            AC_TRY_COMPILE([
slouken@0
   863
             #include <artsc.h>
slouken@0
   864
            ],[
slouken@0
   865
             arts_stream_t stream;
slouken@0
   866
            ],[
slouken@0
   867
            audio_arts=yes
slouken@0
   868
            ])
slouken@0
   869
            CFLAGS="$save_CFLAGS"
slouken@0
   870
            AC_MSG_RESULT($audio_arts)
slouken@0
   871
            if test x$audio_arts = xyes; then
slouken@294
   872
                AC_ARG_ENABLE(arts-shared,
slouken@1637
   873
AC_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [[default=yes]]]),
slouken@678
   874
                              , enable_arts_shared=yes)
slouken@3391
   875
                arts_lib=[`find_lib "libartsc.so.*" "$ARTS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@1467
   876
slouken@1467
   877
                AC_DEFINE(SDL_AUDIO_DRIVER_ARTS)
slouken@1467
   878
                SOURCES="$SOURCES $srcdir/src/audio/arts/*.c"
slouken@1521
   879
                EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS"
icculus@1173
   880
                if test x$have_loadso != xyes && \
slouken@296
   881
                   test x$enable_arts_shared = xyes; then
slouken@1467
   882
                    AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ARTS loading])
slouken@296
   883
                fi
icculus@1173
   884
                if test x$have_loadso = xyes && \
slouken@294
   885
                   test x$enable_arts_shared = xyes && test x$arts_lib != x; then
slouken@3392
   886
                    echo "-- dynamic libartsc -> $arts_lib"
slouken@1361
   887
                    AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ARTS_DYNAMIC, "$arts_lib")
slouken@1467
   888
                else
slouken@1521
   889
                    EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS"
slouken@294
   890
                fi
slouken@1361
   891
                have_audio=yes
slouken@0
   892
            fi
slouken@0
   893
        fi
slouken@0
   894
    fi
slouken@0
   895
}
slouken@0
   896
slouken@0
   897
dnl See if the NAS audio interface is supported
slouken@0
   898
CheckNAS()
slouken@0
   899
{
slouken@0
   900
    AC_ARG_ENABLE(nas,
slouken@1637
   901
AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]),
slouken@41
   902
                  , enable_nas=yes)
slouken@0
   903
    if test x$enable_audio = xyes -a x$enable_nas = xyes; then
icculus@2049
   904
        AC_CHECK_HEADER(audio/audiolib.h, have_nas_hdr=yes)
icculus@2049
   905
        AC_CHECK_LIB(audio, AuOpenServer, have_nas_lib=yes)
icculus@2049
   906
slouken@41
   907
        AC_MSG_CHECKING(for NAS audio support)
slouken@41
   908
        have_nas=no
icculus@2049
   909
icculus@2049
   910
        if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then
icculus@2049
   911
            have_nas=yes
icculus@2049
   912
            NAS_LIBS="-laudio"
icculus@2049
   913
icculus@2049
   914
        elif test -r /usr/X11R6/include/audio/audiolib.h; then
slouken@41
   915
            have_nas=yes
slouken@1361
   916
            NAS_CFLAGS="-I/usr/X11R6/include/"
slouken@1520
   917
            NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt"
slouken@605
   918
slouken@605
   919
        dnl On IRIX, the NAS includes are in a different directory,
slouken@605
   920
        dnl and libnas must be explicitly linked in
slouken@605
   921
slouken@605
   922
        elif test -r /usr/freeware/include/nas/audiolib.h; then
slouken@605
   923
            have_nas=yes
slouken@1361
   924
            NAS_LIBS="-lnas -lXt"
slouken@41
   925
        fi
icculus@2049
   926
slouken@605
   927
        AC_MSG_RESULT($have_nas)
icculus@2049
   928
slouken@1361
   929
        if test x$have_nas = xyes; then
icculus@2049
   930
            AC_ARG_ENABLE(nas-shared,
icculus@2049
   931
AC_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[default=yes]]]),
icculus@2049
   932
                          , enable_nas_shared=yes)
slouken@3391
   933
            nas_lib=[`find_lib "libaudio.so.*" "$NAS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
icculus@2049
   934
icculus@2049
   935
            if test x$have_loadso != xyes && \
icculus@2049
   936
               test x$enable_nas_shared = xyes; then
icculus@2049
   937
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic NAS loading])
icculus@2049
   938
            fi
icculus@2049
   939
            if test x$have_loadso = xyes && \
slouken@2163
   940
               test x$enable_nas_shared = xyes && test x$nas_lib != x; then
slouken@3392
   941
                echo "-- dynamic libaudio -> $nas_lib"
icculus@2049
   942
                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_NAS_DYNAMIC, "$nas_lib")
icculus@2049
   943
            else
icculus@2049
   944
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS"
icculus@2049
   945
            fi
icculus@2049
   946
slouken@1361
   947
            AC_DEFINE(SDL_AUDIO_DRIVER_NAS)
slouken@1361
   948
            SOURCES="$SOURCES $srcdir/src/audio/nas/*.c"
slouken@1521
   949
            EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS"
slouken@1361
   950
            have_audio=yes
slouken@1361
   951
        fi
slouken@0
   952
    fi
slouken@0
   953
}
slouken@0
   954
slouken@68
   955
dnl rcg07142001 See if the user wants the disk writer audio driver...
slouken@68
   956
CheckDiskAudio()
slouken@68
   957
{
slouken@68
   958
    AC_ARG_ENABLE(diskaudio,
slouken@1637
   959
AC_HELP_STRING([--enable-diskaudio], [support the disk writer audio driver [[default=yes]]]),
slouken@86
   960
                  , enable_diskaudio=yes)
slouken@68
   961
    if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
slouken@1361
   962
        AC_DEFINE(SDL_AUDIO_DRIVER_DISK)
slouken@1361
   963
        SOURCES="$SOURCES $srcdir/src/audio/disk/*.c"
slouken@68
   964
    fi
slouken@68
   965
}
slouken@68
   966
icculus@1532
   967
dnl rcg03142006 See if the user wants the dummy audio driver...
icculus@1532
   968
CheckDummyAudio()
icculus@1532
   969
{
icculus@1532
   970
    AC_ARG_ENABLE(dummyaudio,
slouken@1637
   971
AC_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [[default=yes]]]),
icculus@1532
   972
                  , enable_dummyaudio=yes)
icculus@1532
   973
    if test x$enable_audio = xyes -a x$enable_dummyaudio = xyes; then
icculus@1532
   974
        AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY)
icculus@1532
   975
        SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c"
icculus@1532
   976
    fi
icculus@1532
   977
}
icculus@1532
   978
icculus@1573
   979
dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
icculus@1573
   980
dnl  Details of this flag are here: http://gcc.gnu.org/wiki/Visibility
icculus@1573
   981
CheckVisibilityHidden()
icculus@1573
   982
{
icculus@1573
   983
    AC_MSG_CHECKING(for GCC -fvisibility=hidden option)
icculus@1573
   984
    have_gcc_fvisibility=no
icculus@1573
   985
icculus@1573
   986
    visibility_CFLAGS="-fvisibility=hidden"
icculus@1573
   987
    save_CFLAGS="$CFLAGS"
slouken@2292
   988
    CFLAGS="$save_CFLAGS $visibility_CFLAGS -Werror"
icculus@1573
   989
    AC_TRY_COMPILE([
slouken@1745
   990
    #if !defined(__GNUC__) || __GNUC__ < 4
slouken@1745
   991
    #error SDL only uses visibility attributes in GCC 4 or newer
slouken@1745
   992
    #endif
icculus@1573
   993
    ],[
icculus@1573
   994
    ],[
icculus@1573
   995
    have_gcc_fvisibility=yes
icculus@1573
   996
    ])
icculus@1573
   997
    AC_MSG_RESULT($have_gcc_fvisibility)
icculus@1573
   998
    CFLAGS="$save_CFLAGS"
icculus@1573
   999
icculus@1573
  1000
    if test x$have_gcc_fvisibility = xyes; then
slouken@1574
  1001
        EXTRA_CFLAGS="$EXTRA_CFLAGS $visibility_CFLAGS"
icculus@1573
  1002
    fi
icculus@1573
  1003
}
icculus@1573
  1004
icculus@1573
  1005
slouken@0
  1006
dnl Find the X11 include and library directories
slouken@0
  1007
CheckX11()
slouken@0
  1008
{
jim@4681
  1009
jim@4681
  1010
slouken@0
  1011
    AC_ARG_ENABLE(video-x11,
slouken@1637
  1012
AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]),
slouken@0
  1013
                  , enable_video_x11=yes)
slouken@0
  1014
    if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
slouken@1806
  1015
        case "$host" in
slouken@1807
  1016
            *-*-darwin*)
slouken@1807
  1017
                # This isn't necessary for X11, but fixes GLX detection
slouken@1808
  1018
                if test "x$x_includes" = xNONE && test "x$x_libraries" = xNONE; then
slouken@1806
  1019
                    x_includes="/usr/X11R6/include"
slouken@1806
  1020
                    x_libraries="/usr/X11R6/lib"
slouken@1806
  1021
                fi
slouken@1806
  1022
                ;;
slouken@1806
  1023
        esac
slouken@0
  1024
        AC_PATH_X
slouken@0
  1025
        AC_PATH_XTRA
slouken@0
  1026
        if test x$have_x = xyes; then
slouken@1879
  1027
            # Only allow dynamically loaded X11 if the X11 function pointers
slouken@1879
  1028
            # will not end up in the global namespace, which causes problems
slouken@1879
  1029
            # with other libraries calling X11 functions.
slouken@1879
  1030
            x11_symbols_private=$have_gcc_fvisibility
slouken@1879
  1031
icculus@1168
  1032
            AC_ARG_ENABLE(x11-shared,
slouken@1879
  1033
AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=maybe]]]),
slouken@1879
  1034
                          , enable_x11_shared=maybe)
icculus@1168
  1035
slouken@1550
  1036
            case "$host" in
icculus@1589
  1037
                *-*-darwin*) # Latest Mac OS X actually ships with Xrandr/Xrender libs...
slouken@1879
  1038
                    x11_symbols_private=yes
icculus@1174
  1039
                    x11_lib='/usr/X11R6/lib/libX11.6.dylib'
icculus@1174
  1040
                    x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
slouken@1592
  1041
                    xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
icculus@1589
  1042
                    xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
icculus@2763
  1043
                    xinput_lib='/usr/X11R6/lib/libXi.6.dylib'
slouken@3025
  1044
                    xss_lib='/usr/X11R6/lib/libXss.6.dylib'
slouken@4626
  1045
                    xdamage_lib='/usr/X11R6/lib/libXdamage.1.dylib'
slouken@4625
  1046
                    xfixes_lib='/usr/X11R6/lib/libXfixes.3.dylib'
icculus@1174
  1047
                    ;;
slouken@1384
  1048
                *-*-osf*)
slouken@1384
  1049
                    x11_lib='libX11.so'
slouken@1384
  1050
                    x11ext_lib='libXext.so'
slouken@1384
  1051
                    ;;
slouken@1384
  1052
                *-*-irix*) # IRIX 6.5 requires that we use /usr/lib32
icculus@1299
  1053
                    x11_lib='libX11.so'
icculus@1299
  1054
                    x11ext_lib='libXext.so'
icculus@1299
  1055
                    ;;
icculus@1174
  1056
                *)
slouken@3391
  1057
                    x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@3391
  1058
                    x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@3391
  1059
                    xrender_lib=[`find_lib "libXrender.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@3391
  1060
                    xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@3391
  1061
                    xinput_lib=[`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@3391
  1062
                    xss_lib=[`find_lib "libXss.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
sunnysachanandani@4604
  1063
                    xdamage_lib=[`find_lib "libXdamage.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
sunnysachanandani@4604
  1064
                    xfixes_lib=[`find_lib "libXfixes.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
icculus@1174
  1065
                    ;;
icculus@1174
  1066
            esac
icculus@1168
  1067
slouken@1361
  1068
            if test x$ac_cv_func_shmat != xyes; then
slouken@1361
  1069
                X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY"
slouken@1361
  1070
            fi
slouken@1799
  1071
            CFLAGS="$CFLAGS $X_CFLAGS"
slouken@1799
  1072
            LDFLAGS="$LDFLAGS $X_LIBS"
slouken@1468
  1073
slouken@1468
  1074
            AC_DEFINE(SDL_VIDEO_DRIVER_X11)
slouken@1468
  1075
            SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
bob@2185
  1076
            SOURCES="$SOURCES $srcdir/src/video/Xext/XmuStdCmap/*.c"
slouken@1521
  1077
            EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
slouken@1879
  1078
slouken@1879
  1079
            if test x$enable_x11_shared = xmaybe; then
slouken@1879
  1080
                enable_x11_shared=$x11_symbols_private
slouken@1879
  1081
            fi
icculus@1173
  1082
            if test x$have_loadso != xyes && \
icculus@1168
  1083
               test x$enable_x11_shared = xyes; then
slouken@1467
  1084
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic X11 loading])
icculus@1875
  1085
                enable_x11_shared=no
icculus@1168
  1086
            fi
slouken@1879
  1087
            if test x$x11_symbols_private != xyes && \
icculus@1875
  1088
               test x$enable_x11_shared = xyes; then
icculus@1875
  1089
                AC_MSG_WARN([You must have gcc4 (-fvisibility=hidden) for dynamic X11 loading])
icculus@1875
  1090
                enable_x11_shared=no
icculus@1875
  1091
            fi
icculus@1875
  1092
icculus@1173
  1093
            if test x$have_loadso = xyes && \
icculus@1170
  1094
               test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then
icculus@1174
  1095
                echo "-- dynamic libX11 -> $x11_lib"
icculus@1174
  1096
                echo "-- dynamic libX11ext -> $x11ext_lib"
slouken@1361
  1097
                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib")
slouken@1361
  1098
                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib")
icculus@1168
  1099
            else
icculus@1589
  1100
                enable_x11_shared=no
icculus@2763
  1101
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
slouken@0
  1102
            fi
slouken@1361
  1103
            have_video=yes
slouken@0
  1104
slouken@0
  1105
            AC_ARG_ENABLE(video-x11-vm,
slouken@1637
  1106
AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[default=yes]]]),
slouken@0
  1107
                          , enable_video_x11_vm=yes)
slouken@0
  1108
            if test x$enable_video_x11_vm = xyes; then
slouken@1361
  1109
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_VIDMODE)
slouken@1361
  1110
                SOURCES="$SOURCES $srcdir/src/video/Xext/Xxf86vm/*.c"
slouken@0
  1111
            fi
slouken@0
  1112
            AC_ARG_ENABLE(video-x11-xv,
slouken@1637
  1113
AC_HELP_STRING([--enable-video-x11-xv], [use X11 XvImage extension for video [[default=yes]]]),
slouken@0
  1114
                          , enable_video_x11_xv=yes)
slouken@0
  1115
            if test x$enable_video_x11_xv = xyes; then
slouken@1361
  1116
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XV)
slouken@1361
  1117
                SOURCES="$SOURCES $srcdir/src/video/Xext/Xv/*.c"
slouken@0
  1118
            fi
slouken@227
  1119
            AC_ARG_ENABLE(video-x11-xinerama,
slouken@1637
  1120
AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]),
slouken@227
  1121
                            , enable_video_x11_xinerama=yes)
slouken@227
  1122
            if test x$enable_video_x11_xinerama = xyes; then
slouken@1361
  1123
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA)
slouken@1361
  1124
                SOURCES="$SOURCES $srcdir/src/video/Xext/Xinerama/*.c"
slouken@227
  1125
            fi
icculus@4793
  1126
            AC_ARG_ENABLE(video-x11-xshape,
icculus@4793
  1127
AC_HELP_STRING([--enable-video-x11-xshape], [enable X11 XShape support [[default=yes]]]),
icculus@4793
  1128
                            , enable_video_x11_xshape=yes)
icculus@4793
  1129
            if test x$enable_video_x11_xshape = xyes; then
icculus@4793
  1130
                AC_CHECK_HEADER(X11/extensions/shape.h,
icculus@4793
  1131
                                have_shape_h_hdr=yes,
icculus@4793
  1132
                                have_shape_h_hdr=no,
icculus@4793
  1133
                                [#include <X11/Xlib.h>
icculus@4793
  1134
                                ])
icculus@4793
  1135
                if test x$have_shape_h_hdr = xyes; then
icculus@4793
  1136
                    AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSHAPE)
icculus@4793
  1137
                fi
icculus@4793
  1138
            fi
icculus@1589
  1139
            AC_ARG_ENABLE(video-x11-xrandr,
slouken@1637
  1140
AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]),
icculus@1589
  1141
                            , enable_video_x11_xrandr=yes)
icculus@1589
  1142
            if test x$enable_video_x11_xrandr = xyes; then
icculus@1589
  1143
                definitely_enable_video_x11_xrandr=no
icculus@1589
  1144
                AC_CHECK_HEADER(X11/extensions/Xrandr.h,
icculus@1589
  1145
                                have_xrandr_h_hdr=yes,
icculus@1589
  1146
                                have_xrandr_h_hdr=no,
icculus@1589
  1147
                                [#include <X11/Xlib.h>
icculus@1589
  1148
                                ])
icculus@1589
  1149
                if test x$have_xrandr_h_hdr = xyes; then
icculus@1589
  1150
                    if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then
icculus@1589
  1151
                        echo "-- dynamic libXrandr -> $xrandr_lib"
icculus@1589
  1152
                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib")
icculus@1589
  1153
                        definitely_enable_video_x11_xrandr=yes
icculus@1589
  1154
                    else
icculus@1589
  1155
                        AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes)
sunnysachanandani@4577
  1156
                        if test x$have_xrandr_lib = xyes ; then
sunnysachanandani@4577
  1157
                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr"
icculus@1589
  1158
                            definitely_enable_video_x11_xrandr=yes
icculus@1589
  1159
                        fi
icculus@1589
  1160
                    fi
icculus@1589
  1161
                fi
icculus@1589
  1162
            fi
icculus@1589
  1163
            if test x$definitely_enable_video_x11_xrandr = xyes; then
icculus@1589
  1164
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR)
icculus@1589
  1165
            fi
icculus@2763
  1166
            AC_ARG_ENABLE(video-x11-xinput,
icculus@2763
  1167
AC_HELP_STRING([--enable-video-x11-xinput], [enable X11 XInput extension for manymouse, tablets, etc [[default=yes]]]),
icculus@2763
  1168
                            , enable_video_x11_xinput=yes)
icculus@2763
  1169
            if test x$enable_video_x11_xinput = xyes; then
icculus@2763
  1170
                definitely_enable_video_x11_xinput=no
icculus@2763
  1171
                AC_CHECK_HEADER(X11/extensions/XInput.h,
icculus@2763
  1172
                                have_xinput_h_hdr=yes,
icculus@2763
  1173
                                have_xinput_h_hdr=no,
icculus@2763
  1174
                                [#include <X11/Xlib.h>
icculus@2763
  1175
                                ])
icculus@2763
  1176
                if test x$have_xinput_h_hdr = xyes; then
icculus@2763
  1177
                    if test x$enable_x11_shared = xyes && test x$xinput_lib != x ; then
icculus@2763
  1178
                        echo "-- dynamic libXi -> $xinput_lib"
icculus@2763
  1179
                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT, "$xinput_lib")
icculus@2763
  1180
                        definitely_enable_video_x11_xinput=yes
icculus@2763
  1181
                    else
icculus@2763
  1182
                        AC_CHECK_LIB(Xi, XOpenDevice, have_xinput_lib=yes)
icculus@2763
  1183
                        if test x$have_xinput_lib = xyes ; then
icculus@2763
  1184
                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXi"
icculus@2763
  1185
                            definitely_enable_video_x11_xinput=yes
icculus@2763
  1186
                        fi
icculus@2763
  1187
                    fi
icculus@2763
  1188
                fi
icculus@2763
  1189
            fi
icculus@2763
  1190
            if test x$definitely_enable_video_x11_xinput = xyes; then
icculus@2763
  1191
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT)
icculus@2763
  1192
            fi
slouken@3025
  1193
            AC_ARG_ENABLE(video-x11-scrnsaver,
slouken@3025
  1194
AC_HELP_STRING([--enable-video-x11-scrnsaver], [enable X11 screensaver extension [[default=yes]]]),
slouken@3025
  1195
                            , enable_video_x11_scrnsaver=yes)
slouken@3025
  1196
            if test x$enable_video_x11_scrnsaver = xyes; then
slouken@3025
  1197
                AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
slouken@3025
  1198
                                have_scrnsaver_h_hdr=yes,
slouken@3025
  1199
                                have_scrnsaver_h_hdr=no,
slouken@1783
  1200
                                [#include <X11/Xlib.h>
slouken@1783
  1201
                                ])
slouken@3025
  1202
                if test x$have_scrnsaver_h_hdr = xyes; then
slouken@3025
  1203
                    if test x$enable_x11_shared = xyes && test x$xss_lib != x ; then
slouken@3025
  1204
                        echo "-- dynamic libXss -> $xss_lib"
slouken@3025
  1205
                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS, "$xss_lib")
slouken@3025
  1206
                        definitely_enable_video_x11_scrnsaver=yes
slouken@3025
  1207
                    else
slouken@3025
  1208
                        AC_CHECK_LIB(Xss, XScreenSaverSuspend, have_xss_lib=yes)
slouken@3025
  1209
                        if test x$have_xss_lib = xyes ; then
slouken@3025
  1210
                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXss"
slouken@3025
  1211
                            definitely_enable_video_x11_scrnsaver=yes
slouken@3025
  1212
                        fi
slouken@3025
  1213
                    fi
slouken@1783
  1214
                fi
slouken@1783
  1215
            fi
slouken@3025
  1216
            if test x$definitely_enable_video_x11_scrnsaver = xyes; then
slouken@3025
  1217
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_SCRNSAVER)
slouken@3025
  1218
            fi
sunnysachanandani@4577
  1219
            AC_ARG_ENABLE(video-x11-xrender,
sunnysachanandani@4577
  1220
AC_HELP_STRING([--enable-video-x11-xrender], [enable X11 Xrender extension [[default=yes]]]),
sunnysachanandani@4577
  1221
                            , enable_video_x11_xrender=yes)
sunnysachanandani@4577
  1222
            if test x$enable_video_x11_xrender = xyes; then
sunnysachanandani@4577
  1223
                AC_CHECK_HEADER(X11/extensions/Xrender.h,
sunnysachanandani@4577
  1224
                                have_xrender_h_hdr=yes,
sunnysachanandani@4577
  1225
                                have_xrender_h_hdr=no,
sunnysachanandani@4577
  1226
                                [#include <X11/Xlib.h>
sunnysachanandani@4577
  1227
                                ])
sunnysachanandani@4577
  1228
                if test x$have_xrender_h_hdr = xyes; then
sunnysachanandani@4577
  1229
                    if test x$enable_x11_shared = xyes && test x$xrender_lib != x ; then
sunnysachanandani@4577
  1230
                        echo "-- dynamic libXrender -> $xrender_lib"
sunnysachanandani@4577
  1231
                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER, "$xrender_lib")
sunnysachanandani@4577
  1232
                        definitely_enable_video_x11_xrender=yes
sunnysachanandani@4577
  1233
                    else
sunnysachanandani@4577
  1234
                        AC_CHECK_LIB(Xrender, XRenderQueryExtension, have_xrender_lib=yes)
sunnysachanandani@4577
  1235
                        if test x$have_xrender_lib = xyes ; then
sunnysachanandani@4577
  1236
                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrender"
sunnysachanandani@4577
  1237
                            definitely_enable_video_x11_xrender=yes
sunnysachanandani@4577
  1238
                        fi
sunnysachanandani@4577
  1239
                    fi
sunnysachanandani@4577
  1240
                fi
sunnysachanandani@4577
  1241
            fi
sunnysachanandani@4577
  1242
            if test x$definitely_enable_video_x11_xrender = xyes; then
sunnysachanandani@4577
  1243
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRENDER)
sunnysachanandani@4577
  1244
            fi
sunnysachanandani@4604
  1245
            AC_ARG_ENABLE(video-x11-xdamage-xfixes,
sunnysachanandani@4604
  1246
AC_HELP_STRING([--enable-video-x11-xdamage-xfixes], [enable X11 Xdamage and Xfixes extensions [[default=yes]]]),
sunnysachanandani@4604
  1247
                            , enable_video_x11_xdamage=yes)
sunnysachanandani@4604
  1248
            if test x$enable_video_x11_xdamage = xyes && test x$definitely_enable_video_x11_xrender = xyes ; then
sunnysachanandani@4604
  1249
                AC_CHECK_HEADER(X11/extensions/Xdamage.h,
sunnysachanandani@4604
  1250
                                have_xdamage_h_hdr=yes,
sunnysachanandani@4604
  1251
                                have_xdamage_h_hdr=no,
sunnysachanandani@4604
  1252
                                [#include <X11/Xlib.h>
sunnysachanandani@4604
  1253
                                ])
sunnysachanandani@4604
  1254
                AC_CHECK_HEADER(X11/extensions/Xfixes.h,
sunnysachanandani@4604
  1255
                                have_xfixes_h_hdr=yes,
sunnysachanandani@4604
  1256
                                have_xfixes_h_hdr=no,
sunnysachanandani@4604
  1257
                                [#include <X11/Xlib.h>
sunnysachanandani@4604
  1258
                                ])
sunnysachanandani@4604
  1259
                if test x$have_xdamage_h_hdr = xyes && test x$have_xfixes_h_hdr = xyes ; then
sunnysachanandani@4604
  1260
                    if test x$enable_x11_shared = xyes && test x$xdamage_lib != x && test x$xfixes_lib != x ; then
sunnysachanandani@4604
  1261
                        echo "-- dynamic libXdamage -> $xdamage_lib"
sunnysachanandani@4604
  1262
                        echo "-- dynamic libXfixes -> $xfixes_lib"
sunnysachanandani@4604
  1263
                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XDAMAGE, "$xdamage_lib")
sunnysachanandani@4604
  1264
                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES, "$xfixes_lib")
sunnysachanandani@4604
  1265
                        definitely_enable_video_x11_xdamage=yes
sunnysachanandani@4604
  1266
                        definitely_enable_video_x11_xfixes=yes
sunnysachanandani@4604
  1267
                    else
sunnysachanandani@4604
  1268
                        AC_CHECK_LIB(Xdamage, XDamageQueryExtension, have_xdamage_lib=yes)
sunnysachanandani@4604
  1269
                        AC_CHECK_LIB(Xfixes, XFixesQueryExtension, have_xfixes_lib=yes)
sunnysachanandani@4604
  1270
                        if test x$have_xdamage_lib = xyes && test x$have_xfixes_lib = xyes ; then
sunnysachanandani@4604
  1271
                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXdamage -lXfixes"
sunnysachanandani@4604
  1272
                            definitely_enable_video_x11_xdamage=yes
sunnysachanandani@4604
  1273
                            definitely_enable_video_x11_xfixes=yes
sunnysachanandani@4604
  1274
                        fi
sunnysachanandani@4604
  1275
                    fi
sunnysachanandani@4604
  1276
                fi
sunnysachanandani@4604
  1277
            fi
sunnysachanandani@4604
  1278
            if test x$definitely_enable_video_x11_xdamage = xyes && test x$definitely_enable_video_x11_xfixes = xyes ; then
sunnysachanandani@4604
  1279
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XDAMAGE)
sunnysachanandani@4604
  1280
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XFIXES)
sunnysachanandani@4604
  1281
            fi
slouken@2810
  1282
            AC_ARG_ENABLE(render-x11,
slouken@2810
  1283
AC_HELP_STRING([--enable-render-x11], [enable the X11 render driver [[default=yes]]]),
slouken@2810
  1284
                                , enable_render_x11=yes)
slouken@2810
  1285
            if test x$enable_render_x11 = xyes; then
slouken@2810
  1286
                AC_DEFINE(SDL_VIDEO_RENDER_X11)
slouken@2810
  1287
            fi
slouken@0
  1288
        fi
slouken@0
  1289
    fi
slouken@0
  1290
}
slouken@279
  1291
slouken@1361
  1292
dnl Check for QNX photon video driver
slouken@0
  1293
CheckPHOTON()
slouken@0
  1294
{
slouken@0
  1295
    AC_ARG_ENABLE(video-photon,
slouken@1637
  1296
AC_HELP_STRING([--enable-video-photon], [use QNX Photon video driver [[default=yes]]]),
slouken@0
  1297
                  , enable_video_photon=yes)
slouken@0
  1298
    if test x$enable_video = xyes -a x$enable_video_photon = xyes; then
slouken@0
  1299
        AC_MSG_CHECKING(for QNX Photon support)
slouken@0
  1300
        video_photon=no
slouken@0
  1301
        AC_TRY_COMPILE([
slouken@0
  1302
          #include <Ph.h>
slouken@0
  1303
          #include <Pt.h>
slouken@0
  1304
          #include <photon/Pg.h>
slouken@0
  1305
          #include <photon/PdDirect.h>
slouken@0
  1306
        ],[
slouken@0
  1307
         PgDisplaySettings_t *visual;
slouken@0
  1308
        ],[
slouken@0
  1309
        video_photon=yes
slouken@0
  1310
        ])
slouken@0
  1311
        AC_MSG_RESULT($video_photon)
slouken@0
  1312
        if test x$video_photon = xyes; then
slouken@1361
  1313
            AC_DEFINE(SDL_VIDEO_DRIVER_PHOTON)
slouken@1361
  1314
            SOURCES="$SOURCES $srcdir/src/video/photon/*.c"
lestat@3372
  1315
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lph -lphrender"
slouken@1361
  1316
            have_video=yes
slouken@1361
  1317
slouken@279
  1318
            CheckOpenGLQNX
slouken@0
  1319
        fi
slouken@0
  1320
    fi
slouken@0
  1321
}
slouken@0
  1322
slouken@3083
  1323
dnl Check for QNX photon video driver
slouken@3083
  1324
CheckQNXGF()
slouken@3083
  1325
{
slouken@3083
  1326
    AC_ARG_ENABLE(video-qnxgf,
slouken@3083
  1327
                  AC_HELP_STRING([--enable-video-qnxgf], [use QNX GF video driver [[default=yes]]]),
slouken@3083
  1328
                  , enable_video_qnxgf=yes)
slouken@3083
  1329
    if test x$enable_video = xyes -a x$enable_video_qnxgf = xyes; then
slouken@3083
  1330
        AC_MSG_CHECKING(for QNX GF support)
slouken@3083
  1331
        video_qnxgf=no
slouken@3083
  1332
        AC_TRY_COMPILE([
slouken@3083
  1333
          #include <gf/gf.h>
slouken@3083
  1334
          #include <gf/gf3d.h>
slouken@3083
  1335
        ],[
slouken@3083
  1336
         gf_3d_config_info_t* gfinfo;
slouken@3083
  1337
        ],[
slouken@3083
  1338
        video_qnxgf=yes
slouken@3083
  1339
        ])
slouken@3083
  1340
        AC_MSG_RESULT($video_qnxgf)
slouken@3083
  1341
        if test x$video_qnxgf = xyes; then
slouken@3083
  1342
            AC_DEFINE(SDL_VIDEO_DRIVER_QNXGF)
slouken@3083
  1343
            SOURCES="$SOURCES $srcdir/src/video/qnxgf/*.c"
slouken@3083
  1344
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lgf"
lestat@3113
  1345
lestat@3113
  1346
            # Add HIDDI library for HID support using GF
lestat@3113
  1347
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lhiddi"
lestat@3113
  1348
slouken@3083
  1349
            have_video=yes
slouken@3083
  1350
slouken@3083
  1351
            CheckOpenGLESQNX
slouken@3083
  1352
        fi
slouken@3083
  1353
    fi
slouken@3083
  1354
}
slouken@3083
  1355
slouken@1361
  1356
dnl Set up the BWindow video driver if enabled
slouken@1361
  1357
CheckBWINDOW()
slouken@1361
  1358
{
slouken@1361
  1359
    if test x$enable_video = xyes; then
slouken@1361
  1360
        AC_DEFINE(SDL_VIDEO_DRIVER_BWINDOW)
slouken@1361
  1361
        SOURCES="$SOURCES $srcdir/src/video/bwindow/*.cc"
slouken@1361
  1362
        have_video=yes
slouken@1361
  1363
    fi
slouken@1361
  1364
}
slouken@1361
  1365
slouken@1931
  1366
dnl Set up the Cocoa video driver for Mac OS X (but not Darwin)
slouken@1361
  1367
CheckCOCOA()
slouken@1361
  1368
{
slouken@1361
  1369
    AC_ARG_ENABLE(video-cocoa,
slouken@1931
  1370
AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]),
slouken@1361
  1371
                  , enable_video_cocoa=yes)
slouken@1361
  1372
    if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
slouken@1361
  1373
        save_CFLAGS="$CFLAGS"
slouken@1361
  1374
        dnl work around that we don't have Objective-C support in autoconf
slouken@1361
  1375
        CFLAGS="$CFLAGS -x objective-c"
slouken@1361
  1376
        AC_MSG_CHECKING(for Cocoa framework)
slouken@1361
  1377
        have_cocoa=no
slouken@1361
  1378
        AC_TRY_COMPILE([
slouken@1361
  1379
          #import <Cocoa/Cocoa.h>
slouken@1361
  1380
        ],[
slouken@1361
  1381
        ],[
slouken@1361
  1382
        have_cocoa=yes
slouken@1361
  1383
        ])
slouken@1361
  1384
        AC_MSG_RESULT($have_cocoa)
slouken@1361
  1385
        CFLAGS="$save_CFLAGS"
slouken@1361
  1386
        if test x$have_cocoa = xyes; then
slouken@1931
  1387
            AC_DEFINE(SDL_VIDEO_DRIVER_COCOA)
slouken@1931
  1388
            SOURCES="$SOURCES $srcdir/src/video/cocoa/*.m"
slouken@1361
  1389
            have_video=yes
slouken@1361
  1390
        fi
slouken@1361
  1391
    fi
slouken@1361
  1392
}
slouken@1361
  1393
slouken@0
  1394
dnl Find the framebuffer console includes
slouken@0
  1395
CheckFBCON()
slouken@0
  1396
{
slouken@0
  1397
    AC_ARG_ENABLE(video-fbcon,
slouken@2021
  1398
AC_HELP_STRING([--enable-video-fbcon], [use framebuffer console video driver [[default=no]]]),
slouken@2021
  1399
                  , enable_video_fbcon=no)
slouken@0
  1400
    if test x$enable_video = xyes -a x$enable_video_fbcon = xyes; then
slouken@0
  1401
        AC_MSG_CHECKING(for framebuffer console support)
slouken@0
  1402
        video_fbcon=no
slouken@0
  1403
        AC_TRY_COMPILE([
slouken@0
  1404
         #include <linux/fb.h>
slouken@0
  1405
         #include <linux/kd.h>
slouken@0
  1406
         #include <linux/keyboard.h>
slouken@0
  1407
        ],[
slouken@0
  1408
        ],[
slouken@0
  1409
        video_fbcon=yes
slouken@0
  1410
        ])
slouken@0
  1411
        AC_MSG_RESULT($video_fbcon)
slouken@0
  1412
        if test x$video_fbcon = xyes; then
icculus@2093
  1413
            AC_CHECK_FUNCS(getpagesize)
slouken@1361
  1414
            AC_DEFINE(SDL_VIDEO_DRIVER_FBCON)
slouken@1361
  1415
            SOURCES="$SOURCES $srcdir/src/video/fbcon/*.c"
slouken@1361
  1416
            have_video=yes
slouken@0
  1417
        fi
slouken@0
  1418
    fi
slouken@0
  1419
}
slouken@0
  1420
slouken@167
  1421
dnl Find DirectFB
slouken@167
  1422
CheckDirectFB()
slouken@167
  1423
{
slouken@167
  1424
    AC_ARG_ENABLE(video-directfb,
slouken@2314
  1425
AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=no]]]),
slouken@2314
  1426
                  , enable_video_directfb=no)
slouken@167
  1427
    if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
slouken@167
  1428
        video_directfb=no
slouken@167
  1429
slouken@2998
  1430
        DIRECTFB_REQUIRED_VERSION=1.0.0
slouken@1588
  1431
slouken@1602
  1432
        AC_PATH_PROG(DIRECTFBCONFIG, directfb-config, no)
slouken@1602
  1433
        if test x$DIRECTFBCONFIG = xno; then
slouken@1588
  1434
            AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
slouken@1602
  1435
            if test x$PKG_CONFIG != xno; then
slouken@1602
  1436
                if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb; then
slouken@1588
  1437
                    DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
slouken@1588
  1438
                    DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
slouken@2998
  1439
                    DIRECTFB_PREFIX=`$PKG_CONFIG --variable=prefix directfb`
slouken@1588
  1440
                    video_directfb=yes
slouken@1588
  1441
                fi
slouken@167
  1442
            fi
slouken@1588
  1443
        else
slouken@1588
  1444
            set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'`
slouken@1588
  1445
            NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
slouken@1588
  1446
            set -- `directfb-config --version | sed 's/\./ /g'`
slouken@1588
  1447
            HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
slouken@1588
  1448
            if test $HAVE_VERSION -ge $NEED_VERSION; then
slouken@1588
  1449
                DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags`
slouken@1588
  1450
                DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs`
slouken@2998
  1451
                DIRECTFB_PREFIX=`$DIRECTFBCONFIG --prefix`
slouken@167
  1452
                video_directfb=yes
slouken@167
  1453
            fi
slouken@167
  1454
        fi
slouken@3351
  1455
        if test x$video_directfb = xyes; then
slouken@3351
  1456
            # SuSE 11.1 installs directfb-config without directfb-devel
couriersud@3639
  1457
            save_CPPFLAGS="$CPPFLAGS"
couriersud@3639
  1458
            CPPFLAGS="$CPPFLAGS $DIRECTFB_CFLAGS"
slouken@3351
  1459
            AC_CHECK_HEADER(directfb.h, have_directfb_hdr=yes, have_directfb_hdr=no)
couriersud@3639
  1460
            CPPFLAGS="$save_CPPFLAGS"
slouken@3351
  1461
            video_directfb=$have_directfb_hdr
slouken@3351
  1462
        fi
slouken@3351
  1463
        AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support)
slouken@3351
  1464
        AC_MSG_RESULT($video_directfb)
slouken@167
  1465
slouken@167
  1466
        if test x$video_directfb = xyes; then
slouken@2998
  1467
            AC_ARG_ENABLE(directfb-shared,
slouken@2998
  1468
AC_HELP_STRING([--enable-directfb-shared], [dynamically load directfb support [[default=yes]]]),
slouken@2998
  1469
                              , enable_directfb_shared=yes)
slouken@2998
  1470
slouken@1361
  1471
            AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB)
slouken@1361
  1472
            SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
slouken@1521
  1473
            EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"
slouken@2998
  1474
slouken@3392
  1475
            AC_MSG_CHECKING(for directfb dynamic loading support)
slouken@3392
  1476
            directfb_shared=no
slouken@3392
  1477
            directfb_lib=[`find_lib "libdirectfb.so.*" "$DIRECTFB_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@2998
  1478
slouken@2998
  1479
            if test x$have_loadso != xyes && \
slouken@2998
  1480
               test x$enable_directfb_shared = xyes; then
slouken@2998
  1481
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic directfb loading])
slouken@2998
  1482
            fi
slouken@2998
  1483
            if test x$have_loadso = xyes && \
slouken@2998
  1484
               test x$enable_directfb_shared = xyes && test x$directfb_lib != x; then
slouken@3392
  1485
                directfb_shared=yes
slouken@3392
  1486
                echo "-- $directfb_lib_spec -> $directfb_lib"
slouken@2998
  1487
                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC, "$directfb_lib")
slouken@2998
  1488
            else
slouken@3392
  1489
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
slouken@2998
  1490
            fi
slouken@3392
  1491
            AC_MSG_RESULT($directfb_shared)
slouken@1361
  1492
            have_video=yes
slouken@167
  1493
        fi
slouken@167
  1494
    fi
slouken@167
  1495
}
slouken@167
  1496
slouken@2947
  1497
dnl Find FusionSound
slouken@2947
  1498
CheckFusionSound()
slouken@2947
  1499
{
slouken@2947
  1500
    AC_ARG_ENABLE(fusionsound,
slouken@2947
  1501
AC_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]),
slouken@2947
  1502
                  , enable_fusionsound=no)
slouken@2947
  1503
    if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then
slouken@2947
  1504
        fusionsound=no
slouken@2947
  1505
slouken@2947
  1506
        FUSIONSOUND_REQUIRED_VERSION=1.1.1
slouken@2947
  1507
slouken@2947
  1508
        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
slouken@2947
  1509
        AC_MSG_CHECKING(for FusionSound $FUSIONSOUND_REQUIRED_VERSION support)
slouken@2947
  1510
        if test x$PKG_CONFIG != xno; then
slouken@2947
  1511
            if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then
slouken@2947
  1512
                FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound`
slouken@2947
  1513
                FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound`
slouken@2947
  1514
                fusionsound=yes
slouken@2947
  1515
            fi
slouken@2947
  1516
        fi
slouken@2947
  1517
        AC_MSG_RESULT($fusionsound)
slouken@2947
  1518
slouken@2947
  1519
        if test x$fusionsound = xyes; then
slouken@2947
  1520
            AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND)
slouken@2947
  1521
            SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c"
slouken@2947
  1522
            EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS"
slouken@2947
  1523
            
slouken@2947
  1524
            AC_ARG_ENABLE(fusionsound-shared,
slouken@2947
  1525
AC_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]),
slouken@2947
  1526
                          , enable_fusionsound_shared=yes)
slouken@2947
  1527
            fusionsound_shared=no
slouken@3392
  1528
            AC_MSG_CHECKING(for FusionSound dynamic loading support)
slouken@2947
  1529
            if test x$have_loadso != xyes && \
slouken@2947
  1530
               test x$enable_fusionsound_shared = xyes; then
slouken@2947
  1531
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading])
slouken@2947
  1532
            fi
slouken@2947
  1533
            if test x$have_loadso = xyes && \
slouken@2947
  1534
               test x$enable_fusionsound_shared = xyes; then
slouken@2947
  1535
                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so")
slouken@3392
  1536
                fusionsound_shared=yes
slouken@2947
  1537
            else
slouken@3392
  1538
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS"
slouken@2947
  1539
            fi
slouken@3392
  1540
            AC_MSG_RESULT($fusionsound_shared)
slouken@2947
  1541
            
slouken@2947
  1542
            have_audio=yes
slouken@2947
  1543
        fi
slouken@2947
  1544
    fi
slouken@2947
  1545
}
slouken@2947
  1546
slouken@3257
  1547
dnl See if we're running on PlayStation 3 Cell hardware
slouken@3257
  1548
CheckPS3()
slouken@3257
  1549
{
slouken@3257
  1550
  AC_ARG_ENABLE(video-ps3,
slouken@3257
  1551
                AC_HELP_STRING([--enable-video-ps3], [use PlayStation 3 Cell driver [[default=yes]]]),
slouken@3257
  1552
                , enable_video_ps3=yes)
slouken@3257
  1553
  if test x$enable_video = xyes -a x$enable_video_ps3 = xyes; then 
slouken@3257
  1554
    video_ps3=no
slouken@3257
  1555
    AC_CHECK_HEADER([linux/fb.h])
slouken@3257
  1556
    AC_CHECK_HEADER([asm/ps3fb.h], [have_ps3fb_hdr=yes], [],
slouken@3392
  1557
            [#ifndef _LINUX_TYPES_H
slouken@3392
  1558
                #include <linux/types.h>
slouken@3392
  1559
            #endif])
slouken@3257
  1560
    AC_CHECK_HEADER([libspe2.h], have_libspe2_hdr=yes)
slouken@3257
  1561
    AC_CHECK_LIB([spe2], spe_context_create, have_spe2_lib=yes)
slouken@3257
  1562
slouken@3257
  1563
    AC_CHECK_PROGS(SPU_GCC, [spu-gcc])
slouken@3257
  1564
    AC_CHECK_PROGS(EMBEDSPU, [embedspu])
slouken@3257
  1565
slouken@3257
  1566
    have_spu_libs=yes
slouken@3257
  1567
    AC_CHECK_LIB([fb_writer_spu], [main], [], [have_spu_libs=no])
slouken@3257
  1568
    AC_CHECK_LIB([yuv2rgb_spu], [main], [], [have_spu_libs=no])
slouken@3257
  1569
    AC_CHECK_LIB([bilin_scaler_spu], [main], [], [have_spu_libs=no])
slouken@3257
  1570
    if test x$have_ps3fb_hdr = xyes -a x$have_libspe2_hdr = xyes -a x$have_spe2_lib = xyes -a "$SPU_GCC" -a "$EMBEDSPU"; then
slouken@3257
  1571
        AC_DEFINE(SDL_VIDEO_DRIVER_PS3)
slouken@3257
  1572
        video_ps3=yes
slouken@3257
  1573
        have_video=yes
slouken@3257
  1574
        SOURCES="$SOURCES $srcdir/src/video/ps3/*.c"
slouken@3257
  1575
        EXTRA_CFLAGS="$EXTRA_CFLAGS -I/opt/cell/sdk/usr/include"
slouken@3257
  1576
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L/opt/cell/sdk/usr/lib -lspe2 -lfb_writer_spu -lyuv2rgb_spu -lbilin_scaler_spu"
slouken@3257
  1577
slouken@3257
  1578
        if test x$have_spu_libs = xno; then 
slouken@3257
  1579
              AC_MSG_WARN([ps3libs missing, please run make ps3libs])
slouken@3257
  1580
        fi
slouken@3257
  1581
    fi
slouken@3257
  1582
    AC_MSG_CHECKING([for PlayStation 3 Cell support])
slouken@3257
  1583
    AC_MSG_RESULT([$video_ps3])
slouken@3257
  1584
  fi
slouken@3257
  1585
}
slouken@3257
  1586
slouken@0
  1587
dnl Find the SVGAlib includes and libraries
slouken@0
  1588
CheckSVGA()
slouken@0
  1589
{
slouken@0
  1590
    AC_ARG_ENABLE(video-svga,
slouken@2793
  1591
AC_HELP_STRING([--enable-video-svga], [use SVGAlib video driver [[default=no]]]),
slouken@2793
  1592
                  , enable_video_svga=no)
slouken@0
  1593
    if test x$enable_video = xyes -a x$enable_video_svga = xyes; then
slouken@0
  1594
        AC_MSG_CHECKING(for SVGAlib (1.4.0+) support)
slouken@0
  1595
        video_svga=no
slouken@0
  1596
        AC_TRY_COMPILE([
slouken@0
  1597
         #include <vga.h>
slouken@0
  1598
         #include <vgamouse.h>
slouken@0
  1599
         #include <vgakeyboard.h>
slouken@0
  1600
        ],[
slouken@0
  1601
         if ( SCANCODE_RIGHTWIN && SCANCODE_LEFTWIN ) {
slouken@0
  1602
             exit(0);
slouken@0
  1603
         }
slouken@0
  1604
        ],[
slouken@0
  1605
        video_svga=yes
slouken@0
  1606
        ])
slouken@0
  1607
        AC_MSG_RESULT($video_svga)
slouken@0
  1608
        if test x$video_svga = xyes; then
slouken@1361
  1609
            AC_DEFINE(SDL_VIDEO_DRIVER_SVGALIB)
slouken@1361
  1610
            SOURCES="$SOURCES $srcdir/src/video/svga/*.c"
slouken@1556
  1611
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvga"
slouken@1361
  1612
            have_video=yes
slouken@0
  1613
        fi
slouken@0
  1614
    fi
slouken@0
  1615
}
slouken@0
  1616
slouken@1
  1617
dnl rcg04172001 Set up the Null video driver.
slouken@1
  1618
CheckDummyVideo()
slouken@1
  1619
{
slouken@1
  1620
    AC_ARG_ENABLE(video-dummy,
slouken@1637
  1621
AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]),
slouken@86
  1622
                  , enable_video_dummy=yes)
slouken@1
  1623
    if test x$enable_video_dummy = xyes; then
slouken@1361
  1624
        AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY)
slouken@1361
  1625
        SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
slouken@1361
  1626
        have_video=yes
slouken@1
  1627
    fi
slouken@1
  1628
}
slouken@1
  1629
slouken@0
  1630
dnl Check to see if OpenGL support is desired
slouken@0
  1631
AC_ARG_ENABLE(video-opengl,
slouken@1952
  1632
AC_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]),
slouken@0
  1633
              , enable_video_opengl=yes)
slouken@0
  1634
slouken@0
  1635
dnl Find OpenGL
icculus@1191
  1636
CheckOpenGLX11()
slouken@0
  1637
{
slouken@0
  1638
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@0
  1639
        AC_MSG_CHECKING(for OpenGL (GLX) support)
slouken@0
  1640
        video_opengl=no
slouken@0
  1641
        AC_TRY_COMPILE([
slouken@0
  1642
         #include <GL/gl.h>
slouken@0
  1643
         #include <GL/glx.h>
icculus@2125
  1644
         #include <GL/glu.h>
slouken@0
  1645
        ],[
slouken@0
  1646
        ],[
slouken@0
  1647
        video_opengl=yes
slouken@0
  1648
        ])
slouken@0
  1649
        AC_MSG_RESULT($video_opengl)
slouken@0
  1650
        if test x$video_opengl = xyes; then
slouken@1361
  1651
            AC_DEFINE(SDL_VIDEO_OPENGL)
slouken@1361
  1652
            AC_DEFINE(SDL_VIDEO_OPENGL_GLX)
slouken@1952
  1653
            AC_DEFINE(SDL_VIDEO_RENDER_OGL)
slouken@0
  1654
        fi
slouken@0
  1655
    fi
slouken@0
  1656
}
slouken@0
  1657
slouken@3083
  1658
dnl Find QNX 6.x Software OpenGL
slouken@279
  1659
CheckOpenGLQNX()
slouken@279
  1660
{
slouken@279
  1661
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@3083
  1662
        AC_MSG_CHECKING(for QNX 6.x Photon OpenGL support)
slouken@279
  1663
        video_opengl=no
slouken@279
  1664
        AC_TRY_COMPILE([
slouken@279
  1665
         #include <GL/gl.h>
slouken@279
  1666
        ],[
slouken@279
  1667
        ],[
slouken@279
  1668
        video_opengl=yes
slouken@279
  1669
        ])
slouken@279
  1670
        AC_MSG_RESULT($video_opengl)
slouken@279
  1671
        if test x$video_opengl = xyes; then
slouken@1361
  1672
            AC_DEFINE(SDL_VIDEO_OPENGL)
slouken@1952
  1673
            AC_DEFINE(SDL_VIDEO_RENDER_OGL)
slouken@1521
  1674
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
slouken@279
  1675
        fi
slouken@279
  1676
    fi
slouken@279
  1677
}
slouken@279
  1678
slouken@3083
  1679
dnl Find QNX 6.3 and above OpenGL ES implementation
slouken@3083
  1680
CheckOpenGLESQNX()
slouken@3083
  1681
{
slouken@3083
  1682
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@3083
  1683
        AC_MSG_CHECKING(for QNX OpenGL ES (CM) support)
slouken@3083
  1684
        video_opengl=no
slouken@3083
  1685
        AC_TRY_COMPILE([
slouken@3083
  1686
         #include <GLES/egl.h>
slouken@3083
  1687
        ],[
slouken@3083
  1688
        ],[
slouken@3083
  1689
        video_opengl=yes
slouken@3083
  1690
        ])
slouken@3083
  1691
        AC_MSG_RESULT($video_opengl)
slouken@3083
  1692
        if test x$video_opengl = xyes; then
slouken@3083
  1693
            AC_DEFINE(SDL_VIDEO_OPENGL_ES)
slouken@3099
  1694
            AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES)
slouken@3083
  1695
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGLES_CM"
slouken@3083
  1696
        else
slouken@3083
  1697
            AC_MSG_CHECKING(for QNX OpenGL ES (CL) support)
slouken@3083
  1698
            video_opengl=no
slouken@3083
  1699
            AC_TRY_COMPILE([
slouken@3087
  1700
             #define COMMON_LITE
slouken@3083
  1701
             #include <GLES/egl.h>
slouken@3083
  1702
            ],[
slouken@3083
  1703
            ],[
slouken@3083
  1704
            video_opengl=yes
slouken@3083
  1705
            ])
slouken@3083
  1706
            AC_MSG_RESULT($video_opengl)
slouken@3083
  1707
            if test x$video_opengl = xyes; then
slouken@3083
  1708
                AC_DEFINE(SDL_VIDEO_OPENGL_ES)
slouken@3099
  1709
                AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES)
slouken@3099
  1710
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGLES_CLS"
slouken@3083
  1711
            fi
slouken@3083
  1712
        fi
slouken@3083
  1713
    fi
slouken@3083
  1714
}
slouken@3083
  1715
slouken@3083
  1716
slouken@1361
  1717
dnl Check for Win32 OpenGL
slouken@1361
  1718
CheckWIN32GL()
slouken@1361
  1719
{
slouken@1361
  1720
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@1361
  1721
        AC_DEFINE(SDL_VIDEO_OPENGL)
slouken@1361
  1722
        AC_DEFINE(SDL_VIDEO_OPENGL_WGL)
slouken@1952
  1723
        AC_DEFINE(SDL_VIDEO_RENDER_OGL)
slouken@1361
  1724
    fi
slouken@1361
  1725
}
slouken@1361
  1726
slouken@0
  1727
dnl Check for BeOS OpenGL
slouken@0
  1728
CheckBeGL()
slouken@0
  1729
{
slouken@0
  1730
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@1361
  1731
        AC_DEFINE(SDL_VIDEO_OPENGL)
slouken@1952
  1732
        AC_DEFINE(SDL_VIDEO_OPENGL_BGL)
slouken@1952
  1733
        AC_DEFINE(SDL_VIDEO_RENDER_OGL)
slouken@1521
  1734
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
slouken@0
  1735
    fi
slouken@0
  1736
}
slouken@0
  1737
slouken@0
  1738
dnl Check for MacOS OpenGL
slouken@0
  1739
CheckMacGL()
slouken@0
  1740
{
slouken@0
  1741
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@1361
  1742
        AC_DEFINE(SDL_VIDEO_OPENGL)
slouken@1952
  1743
        AC_DEFINE(SDL_VIDEO_OPENGL_CGL)
slouken@1952
  1744
        AC_DEFINE(SDL_VIDEO_RENDER_OGL)
slouken@1550
  1745
        case "$host" in
slouken@0
  1746
            *-*-darwin*)
slouken@1625
  1747
                if test x$enable_video_cocoa = xyes; then
icculus@3623
  1748
                    EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGL"
slouken@1625
  1749
                fi
slouken@0
  1750
        esac
slouken@0
  1751
    fi
slouken@0
  1752
}
slouken@0
  1753
slouken@0
  1754
dnl See if we can use the new unified event interface in Linux 2.4
slouken@0
  1755
CheckInputEvents()
slouken@0
  1756
{
slouken@0
  1757
    dnl Check for Linux 2.4 unified input event interface support
slouken@0
  1758
    AC_ARG_ENABLE(input-events,
slouken@1637
  1759
AC_HELP_STRING([--enable-input-events], [use Linux 2.4 unified input interface [[default=yes]]]),
slouken@211
  1760
                  , enable_input_events=yes)
slouken@0
  1761
    if test x$enable_input_events = xyes; then
slouken@0
  1762
        AC_MSG_CHECKING(for Linux 2.4 unified input interface)
slouken@0
  1763
        use_input_events=no
slouken@0
  1764
        AC_TRY_COMPILE([
slouken@0
  1765
          #include <linux/input.h>
slouken@0
  1766
        ],[
slouken@0
  1767
          #ifndef EVIOCGNAME
slouken@0
  1768
          #error EVIOCGNAME() ioctl not available
slouken@0
  1769
          #endif
slouken@0
  1770
        ],[
slouken@0
  1771
        use_input_events=yes
slouken@0
  1772
        ])
slouken@0
  1773
        AC_MSG_RESULT($use_input_events)
slouken@0
  1774
        if test x$use_input_events = xyes; then
slouken@1361
  1775
            AC_DEFINE(SDL_INPUT_LINUXEV)
slouken@0
  1776
        fi
slouken@0
  1777
    fi
slouken@0
  1778
}
slouken@0
  1779
icculus@1201
  1780
dnl See if we can use the Touchscreen input library
icculus@1201
  1781
CheckTslib()
icculus@1201
  1782
{
icculus@1201
  1783
    AC_ARG_ENABLE(input-tslib,
slouken@1637
  1784
AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]),
icculus@1201
  1785
                  , enable_input_tslib=yes)
icculus@1201
  1786
    if test x$enable_input_tslib = xyes; then
icculus@1201
  1787
        AC_MSG_CHECKING(for Touchscreen library support)
icculus@1201
  1788
        enable_input_tslib=no
icculus@1201
  1789
        AC_TRY_COMPILE([
icculus@1201
  1790
          #include "tslib.h"
icculus@1201
  1791
        ],[
icculus@1201
  1792
        ],[
icculus@1201
  1793
        enable_input_tslib=yes
icculus@1201
  1794
        ])
icculus@1201
  1795
        AC_MSG_RESULT($enable_input_tslib)
icculus@1201
  1796
        if test x$enable_input_tslib = xyes; then
slouken@1361
  1797
            AC_DEFINE(SDL_INPUT_TSLIB)
slouken@1521
  1798
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
icculus@1201
  1799
        fi
icculus@1201
  1800
    fi
icculus@1201
  1801
}
icculus@1201
  1802
slouken@0
  1803
dnl See what type of thread model to use on Linux and Solaris
slouken@0
  1804
CheckPTHREAD()
slouken@0
  1805
{
slouken@0
  1806
    dnl Check for pthread support
slouken@0
  1807
    AC_ARG_ENABLE(pthreads,
slouken@1637
  1808
AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]),
slouken@0
  1809
                  , enable_pthreads=yes)
slouken@0
  1810
    dnl This is used on Linux for glibc binary compatibility (Doh!)
slouken@0
  1811
    AC_ARG_ENABLE(pthread-sem,
slouken@1637
  1812
AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
slouken@0
  1813
                  , enable_pthread_sem=yes)
slouken@1550
  1814
    case "$host" in
slouken@1820
  1815
        *-*-linux*|*-*-uclinux*)
slouken@1361
  1816
            pthread_cflags="-D_REENTRANT"
slouken@1324
  1817
            pthread_lib="-lpthread"
slouken@1324
  1818
            ;;
slouken@0
  1819
        *-*-bsdi*)
slouken@0
  1820
            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
slouken@0
  1821
            pthread_lib=""
slouken@0
  1822
            ;;
slouken@0
  1823
        *-*-darwin*)
slouken@0
  1824
            pthread_cflags="-D_THREAD_SAFE"
slouken@0
  1825
# causes Carbon.p complaints?
slouken@0
  1826
#            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
slouken@0
  1827
            ;;
slouken@1565
  1828
        *-*-freebsd*|*-*-dragonfly*)
slouken@0
  1829
            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
slouken@0
  1830
            pthread_lib="-pthread"
slouken@0
  1831
            ;;
slouken@43
  1832
        *-*-netbsd*)
slouken@1383
  1833
            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
slouken@2158
  1834
            pthread_lib="-lpthread"
slouken@43
  1835
            ;;
slouken@0
  1836
        *-*-openbsd*)
slouken@0
  1837
            pthread_cflags="-D_REENTRANT"
slouken@0
  1838
            pthread_lib="-pthread"
slouken@0
  1839
            ;;
slouken@0
  1840
        *-*-solaris*)
slouken@0
  1841
            pthread_cflags="-D_REENTRANT"
slouken@0
  1842
            pthread_lib="-lpthread -lposix4"
slouken@0
  1843
            ;;
slouken@0
  1844
        *-*-sysv5*)
slouken@0
  1845
            pthread_cflags="-D_REENTRANT -Kthread"
slouken@0
  1846
            pthread_lib=""
slouken@0
  1847
            ;;
slouken@0
  1848
        *-*-irix*)
slouken@0
  1849
            pthread_cflags="-D_SGI_MP_SOURCE"
slouken@0
  1850
            pthread_lib="-lpthread"
slouken@0
  1851
            ;;
slouken@0
  1852
        *-*-aix*)
slouken@0
  1853
            pthread_cflags="-D_REENTRANT -mthreads"
slouken@0
  1854
            pthread_lib="-lpthread"
slouken@0
  1855
            ;;
icculus@425
  1856
        *-*-hpux11*)
icculus@425
  1857
            pthread_cflags="-D_REENTRANT"
icculus@425
  1858
            pthread_lib="-L/usr/lib -lpthread"
icculus@425
  1859
            ;;
slouken@0
  1860
        *-*-qnx*)
slouken@0
  1861
            pthread_cflags=""
slouken@0
  1862
            pthread_lib=""
slouken@0
  1863
            ;;
slouken@873
  1864
        *-*-osf*)
slouken@1019
  1865
            pthread_cflags="-D_REENTRANT"
slouken@873
  1866
            if test x$ac_cv_prog_gcc = xyes; then
slouken@873
  1867
                pthread_lib="-lpthread -lrt"
slouken@873
  1868
            else
slouken@1019
  1869
                pthread_lib="-lpthread -lexc -lrt"
slouken@873
  1870
            fi
slouken@873
  1871
            ;;
slouken@0
  1872
        *)
slouken@0
  1873
            pthread_cflags="-D_REENTRANT"
slouken@0
  1874
            pthread_lib="-lpthread"
slouken@0
  1875
            ;;
slouken@0
  1876
    esac
slouken@3268
  1877
    if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
slouken@415
  1878
        # Save the original compiler flags and libraries
slouken@415
  1879
        ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
slouken@415
  1880
        # Add the pthread compiler flags and libraries
slouken@415
  1881
        CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
slouken@415
  1882
        # Check to see if we have pthread support on this system
slouken@0
  1883
        AC_MSG_CHECKING(for pthreads)
slouken@0
  1884
        use_pthreads=no
slouken@0
  1885
        AC_TRY_LINK([
slouken@0
  1886
         #include <pthread.h>
slouken@0
  1887
        ],[
slouken@0
  1888
         pthread_attr_t type;
slouken@0
  1889
         pthread_attr_init(&type);
slouken@0
  1890
        ],[
slouken@0
  1891
        use_pthreads=yes
slouken@0
  1892
        ])
slouken@0
  1893
        AC_MSG_RESULT($use_pthreads)
slouken@415
  1894
        # Restore the compiler flags and libraries
slouken@415
  1895
        CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
slouken@1361
  1896
slouken@415
  1897
        # Do futher testing if we have pthread support...
slouken@0
  1898
        if test x$use_pthreads = xyes; then
slouken@1361
  1899
            AC_DEFINE(SDL_THREAD_PTHREAD)
slouken@1521
  1900
            EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
slouken@1521
  1901
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
slouken@0
  1902
            SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
slouken@0
  1903
            SDL_LIBS="$SDL_LIBS $pthread_lib"
slouken@0
  1904
slouken@1438
  1905
            # Save the original compiler flags and libraries
slouken@1438
  1906
            ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
slouken@1438
  1907
            # Add the pthread compiler flags and libraries
slouken@1438
  1908
            CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
slouken@1438
  1909
slouken@0
  1910
            # Check to see if recursive mutexes are available
slouken@0
  1911
            AC_MSG_CHECKING(for recursive mutexes)
slouken@0
  1912
            has_recursive_mutexes=no
slouken@1324
  1913
            if test x$has_recursive_mutexes = xno; then
slouken@1324
  1914
                AC_TRY_COMPILE([
slouken@1324
  1915
                  #include <pthread.h>
slouken@1324
  1916
                ],[
slouken@1324
  1917
                  pthread_mutexattr_t attr;
slouken@1324
  1918
                  pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
slouken@1324
  1919
                ],[
slouken@1324
  1920
                has_recursive_mutexes=yes
slouken@1361
  1921
                AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX)
slouken@1324
  1922
                ])
slouken@1324
  1923
            fi
slouken@1324
  1924
            if test x$has_recursive_mutexes = xno; then
slouken@1324
  1925
                AC_TRY_COMPILE([
slouken@1324
  1926
                  #include <pthread.h>
slouken@1324
  1927
                ],[
slouken@1324
  1928
                  pthread_mutexattr_t attr;
slouken@1324
  1929
                  pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
slouken@1324
  1930
                ],[
slouken@1324
  1931
                has_recursive_mutexes=yes
slouken@1361
  1932
                AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP)
slouken@1324
  1933
                ])
slouken@1324
  1934
            fi
slouken@0
  1935
            AC_MSG_RESULT($has_recursive_mutexes)
slouken@0
  1936
slouken@94
  1937
            # Check to see if pthread semaphore support is missing
slouken@94
  1938
            if test x$enable_pthread_sem = xyes; then
slouken@94
  1939
                AC_MSG_CHECKING(for pthread semaphores)
slouken@94
  1940
                have_pthread_sem=no
slouken@94
  1941
                AC_TRY_COMPILE([
slouken@94
  1942
                  #include <pthread.h>
slouken@94
  1943
                  #include <semaphore.h>
slouken@94
  1944
                ],[
slouken@94
  1945
                ],[
slouken@94
  1946
                have_pthread_sem=yes
slouken@94
  1947
                ])
slouken@94
  1948
                AC_MSG_RESULT($have_pthread_sem)
slouken@94
  1949
            fi
slouken@94
  1950
slouken@1438
  1951
            # Restore the compiler flags and libraries
slouken@1438
  1952
            CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
slouken@1438
  1953
slouken@1361
  1954
            # Basic thread creation functions
slouken@1361
  1955
            SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
slouken@0
  1956
slouken@1361
  1957
            # Semaphores
slouken@1361
  1958
            # We can fake these with mutexes and condition variables if necessary
slouken@1361
  1959
            if test x$have_pthread_sem = xyes; then
slouken@1361
  1960
                SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
slouken@1361
  1961
            else
slouken@1361
  1962
                SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
slouken@1361
  1963
            fi
slouken@399
  1964
slouken@1361
  1965
            # Mutexes
slouken@1361
  1966
            # We can fake these with semaphores if necessary
slouken@1361
  1967
            SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
slouken@399
  1968
slouken@1361
  1969
            # Condition variables
slouken@1361
  1970
            # We can fake these with semaphores and mutexes if necessary
slouken@1361
  1971
            SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
slouken@185
  1972
slouken@1361
  1973
            have_threads=yes
slouken@814
  1974
        fi
slouken@814
  1975
    fi
slouken@814
  1976
}
slouken@814
  1977
slouken@0
  1978
dnl Determine whether the compiler can produce Win32 executables
slouken@0
  1979
CheckWIN32()
slouken@0
  1980
{
slouken@0
  1981
    AC_MSG_CHECKING(Win32 compiler)
slouken@0
  1982
    have_win32_gcc=no
slouken@0
  1983
    AC_TRY_COMPILE([
slouken@0
  1984
     #include <windows.h>
slouken@0
  1985
    ],[
slouken@0
  1986
    ],[
slouken@0
  1987
    have_win32_gcc=yes
slouken@0
  1988
    ])
slouken@0
  1989
    AC_MSG_RESULT($have_win32_gcc)
slouken@0
  1990
    if test x$have_win32_gcc != xyes; then
slouken@0
  1991
       AC_MSG_ERROR([
slouken@0
  1992
*** Your compiler ($CC) does not produce Win32 executables!
slouken@0
  1993
       ])
slouken@0
  1994
    fi
slouken@0
  1995
slouken@3168
  1996
    AC_MSG_CHECKING(Windows CE)
slouken@3168
  1997
    have_wince=no
slouken@3168
  1998
    AC_TRY_COMPILE([
slouken@4569
  1999
#if !defined(_WIN32_WCE) && !defined(__MINGW32CE__)
slouken@3168
  2000
#error This is not Windows CE
slouken@3168
  2001
#endif
slouken@3168
  2002
    ],[
slouken@3168
  2003
    ],[
slouken@3168
  2004
    have_wince=yes
slouken@3168
  2005
    ])
slouken@3168
  2006
    AC_MSG_RESULT($have_wince)
slouken@3168
  2007
slouken@0
  2008
    dnl See if the user wants to redirect standard output to files
slouken@0
  2009
    AC_ARG_ENABLE(stdio-redirect,
slouken@1637
  2010
AC_HELP_STRING([--enable-stdio-redirect], [Redirect STDIO to files on Win32 [[default=yes]]]),
slouken@0
  2011
                  , enable_stdio_redirect=yes)
slouken@0
  2012
    if test x$enable_stdio_redirect != xyes; then
slouken@1521
  2013
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DNO_STDIO_REDIRECT"
slouken@1361
  2014
    fi
slouken@0
  2015
}
slouken@0
  2016
slouken@0
  2017
dnl Find the DirectX includes and libraries
slouken@0
  2018
CheckDIRECTX()
slouken@0
  2019
{
slouken@0
  2020
    AC_ARG_ENABLE(directx,
slouken@1637
  2021
AC_HELP_STRING([--enable-directx], [use DirectX for Win32 audio/video [[default=yes]]]),
slouken@0
  2022
                  , enable_directx=yes)
slouken@0
  2023
    if test x$enable_directx = xyes; then
slouken@1895
  2024
        AC_CHECK_HEADER(d3d9.h, have_d3d=yes)
slouken@3168
  2025
        AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
slouken@1361
  2026
        AC_CHECK_HEADER(dsound.h, have_dsound=yes)
slouken@2714
  2027
        AC_CHECK_HEADER(dinput.h, have_dinput=yes)
icculus@1187
  2028
    fi
icculus@1187
  2029
}
icculus@1187
  2030
slouken@294
  2031
dnl Check for the dlfcn.h interface for dynamically loading objects
slouken@294
  2032
CheckDLOPEN()
slouken@294
  2033
{
slouken@731
  2034
    AC_ARG_ENABLE(sdl-dlopen,
slouken@1637
  2035
AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]),
slouken@731
  2036
                  , enable_sdl_dlopen=yes)
slouken@731
  2037
    if test x$enable_sdl_dlopen = xyes; then
slouken@294
  2038
        AC_MSG_CHECKING(for dlopen)
slouken@1361
  2039
        have_dlopen=no
slouken@294
  2040
        AC_TRY_COMPILE([
slouken@294
  2041
         #include <dlfcn.h>
slouken@294
  2042
        ],[
slouken@1638
  2043
         #if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED <= 1020
slouken@1638
  2044
         #error Use dlcompat for Mac OS X 10.2 compatibility
slouken@1638
  2045
         #endif
slouken@294
  2046
        ],[
slouken@1361
  2047
        have_dlopen=yes
slouken@294
  2048
        ])
slouken@1361
  2049
        AC_MSG_RESULT($have_dlopen)
slouken@294
  2050
slouken@1361
  2051
        if test x$have_dlopen = xyes; then
slouken@1521
  2052
            AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
slouken@1521
  2053
               AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
slouken@1521
  2054
                  AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
slouken@1361
  2055
            AC_DEFINE(SDL_LOADSO_DLOPEN)
slouken@1361
  2056
            SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
slouken@1361
  2057
            have_loadso=yes
slouken@294
  2058
        fi
slouken@294
  2059
    fi
slouken@294
  2060
}
slouken@294
  2061
slouken@381
  2062
dnl Check for the usbhid(3) library on *BSD
slouken@381
  2063
CheckUSBHID()
slouken@381
  2064
{
slouken@381
  2065
    if test x$enable_joystick = xyes; then
slouken@1565
  2066
        AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
slouken@1565
  2067
        if test x$have_libusbhid = xyes; then
slouken@1565
  2068
            AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
slouken@1565
  2069
            AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
slouken@1565
  2070
            USB_LIBS="$USB_LIBS -lusbhid"
slouken@1565
  2071
        else
slouken@1565
  2072
            AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
slouken@1565
  2073
            AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
slouken@1565
  2074
            AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
slouken@1565
  2075
        fi
slouken@1361
  2076
            
slouken@1361
  2077
        save_CFLAGS="$CFLAGS"
slouken@1361
  2078
        CFLAGS="$CFLAGS $USB_CFLAGS"
slouken@381
  2079
slouken@381
  2080
        AC_MSG_CHECKING(for usbhid)
slouken@381
  2081
        have_usbhid=no
slouken@381
  2082
        AC_TRY_COMPILE([
slouken@404
  2083
          #include <sys/types.h>
slouken@403
  2084
          #if defined(HAVE_USB_H)
slouken@403
  2085
          #include <usb.h>
slouken@403
  2086
          #endif
slouken@1565
  2087
          #ifdef __DragonFly__
slouken@1565
  2088
          # include <bus/usb/usb.h>
slouken@1565
  2089
          # include <bus/usb/usbhid.h>
slouken@1565
  2090
          #else
slouken@1565
  2091
          # include <dev/usb/usb.h>
slouken@1565
  2092
          # include <dev/usb/usbhid.h>
slouken@1565
  2093
          #endif
slouken@381
  2094
          #if defined(HAVE_USBHID_H)
slouken@381
  2095
          #include <usbhid.h>
slouken@381
  2096
          #elif defined(HAVE_LIBUSB_H)
slouken@381
  2097
          #include <libusb.h>
slouken@381
  2098
          #elif defined(HAVE_LIBUSBHID_H)
slouken@381
  2099
          #include <libusbhid.h>
slouken@404
  2100
          #endif
slouken@381
  2101
        ],[
slouken@381
  2102
          struct report_desc *repdesc;
slouken@381
  2103
          struct usb_ctl_report *repbuf;
slouken@402
  2104
          hid_kind_t hidkind;
slouken@381
  2105
        ],[
slouken@381
  2106
        have_usbhid=yes
slouken@381
  2107
        ])
slouken@381
  2108
        AC_MSG_RESULT($have_usbhid)
slouken@381
  2109
slouken@381
  2110
        if test x$have_usbhid = xyes; then
slouken@381
  2111
            AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
slouken@381
  2112
            have_usbhid_ucr_data=no
slouken@381
  2113
            AC_TRY_COMPILE([
slouken@404
  2114
              #include <sys/types.h>
slouken@404
  2115
              #if defined(HAVE_USB_H)
slouken@404
  2116
              #include <usb.h>
slouken@404
  2117
              #endif
slouken@1565
  2118
              #ifdef __DragonFly__
slouken@1565
  2119
              # include <bus/usb/usb.h>
slouken@1565
  2120
              # include <bus/usb/usbhid.h>
slouken@1565
  2121
              #else
slouken@1565
  2122
              # include <dev/usb/usb.h>
slouken@1565
  2123
              # include <dev/usb/usbhid.h>
slouken@1565
  2124
              #endif
slouken@381
  2125
              #if defined(HAVE_USBHID_H)
slouken@381
  2126
              #include <usbhid.h>
slouken@381
  2127
              #elif defined(HAVE_LIBUSB_H)
slouken@381
  2128
              #include <libusb.h>
slouken@381
  2129
              #elif defined(HAVE_LIBUSBHID_H)
slouken@381
  2130
              #include <libusbhid.h>
slouken@381
  2131
              #endif
slouken@381
  2132
            ],[
slouken@381
  2133
              struct usb_ctl_report buf;
slouken@381
  2134
              if (buf.ucr_data) { }
slouken@381
  2135
            ],[
slouken@381
  2136
            have_usbhid_ucr_data=yes
slouken@381
  2137
            ])
slouken@381
  2138
            if test x$have_usbhid_ucr_data = xyes; then
slouken@1361
  2139
                USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
slouken@381
  2140
            fi
slouken@381
  2141
            AC_MSG_RESULT($have_usbhid_ucr_data)
slouken@407
  2142
            
slouken@1361
  2143
            AC_MSG_CHECKING(for new usbhid API)
slouken@407
  2144
            have_usbhid_new=no
slouken@407
  2145
            AC_TRY_COMPILE([
slouken@407
  2146
              #include <sys/types.h>
slouken@407
  2147
              #if defined(HAVE_USB_H)
slouken@407
  2148
              #include <usb.h>
slouken@407
  2149
              #endif
slouken@3392
  2150
              #ifdef __DragonFly__
slouken@2158
  2151
              #include <bus/usb/usb.h>
slouken@2158
  2152
              #include <bus/usb/usbhid.h>
slouken@3392
  2153
              #else
slouken@407
  2154
              #include <dev/usb/usb.h>
slouken@407
  2155
              #include <dev/usb/usbhid.h>
slouken@3392
  2156
              #endif
slouken@407
  2157
              #if defined(HAVE_USBHID_H)
slouken@407
  2158
              #include <usbhid.h>
slouken@407
  2159
              #elif defined(HAVE_LIBUSB_H)
slouken@407
  2160
              #include <libusb.h>
slouken@407
  2161
              #elif defined(HAVE_LIBUSBHID_H)
slouken@407
  2162
              #include <libusbhid.h>
slouken@407
  2163
              #endif
slouken@407
  2164
            ],[
slouken@407
  2165
              report_desc_t d;
slouken@1361
  2166
              hid_start_parse(d, 1, 1);
slouken@407
  2167
            ],[
slouken@407
  2168
            have_usbhid_new=yes
slouken@407
  2169
            ])
slouken@407
  2170
            if test x$have_usbhid_new = xyes; then
slouken@1361
  2171
                USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
slouken@407
  2172
            fi
slouken@407
  2173
            AC_MSG_RESULT($have_usbhid_new)
slouken@381
  2174
slouken@1565
  2175
            AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
slouken@1565
  2176
            have_machine_joystick=no
slouken@1565
  2177
            AC_TRY_COMPILE([
slouken@1565
  2178
              #include <machine/joystick.h>
slouken@1565
  2179
            ],[
slouken@1565
  2180
              struct joystick t;
slouken@1565
  2181
            ],[
slouken@1565
  2182
            have_machine_joystick=yes
slouken@1565
  2183
            ])
slouken@1565
  2184
            if test x$have_machine_joystick = xyes; then
slouken@1565
  2185
                AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H)
slouken@1565
  2186
            fi
slouken@1565
  2187
            AC_MSG_RESULT($have_machine_joystick)
slouken@1565
  2188
slouken@1361
  2189
            AC_DEFINE(SDL_JOYSTICK_USBHID)
slouken@1361
  2190
            SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
slouken@1521
  2191
            EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
slouken@1521
  2192
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
slouken@1361
  2193
            have_joystick=yes
slouken@381
  2194
        fi
slouken@1361
  2195
        CFLAGS="$save_CFLAGS"
slouken@381
  2196
    fi
slouken@381
  2197
}
slouken@381
  2198
slouken@1361
  2199
dnl Check for clock_gettime()
slouken@1361
  2200
CheckClockGettime()
slouken@795
  2201
{
slouken@1361
  2202
    AC_ARG_ENABLE(clock_gettime,
slouken@1637
  2203
AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=no]]]),
slouken@1361
  2204
                  , enable_clock_gettime=no)
slouken@1361
  2205
    if test x$enable_clock_gettime = xyes; then
slouken@1361
  2206
        AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
slouken@1361
  2207
        if test x$have_clock_gettime = xyes; then
slouken@1361
  2208
            AC_DEFINE(HAVE_CLOCK_GETTIME)
slouken@1521
  2209
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
slouken@3087
  2210
        else
slouken@3087
  2211
            AC_CHECK_LIB(c, clock_gettime, have_clock_gettime=yes)
slouken@3087
  2212
            if test x$have_clock_gettime = xyes; then
slouken@3087
  2213
               AC_DEFINE(HAVE_CLOCK_GETTIME)
slouken@3087
  2214
               EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
slouken@3087
  2215
            fi
icculus@1175
  2216
        fi
slouken@795
  2217
    fi
slouken@795
  2218
}
slouken@795
  2219
slouken@1062
  2220
dnl Check for a valid linux/version.h
slouken@1062
  2221
CheckLinuxVersion()
slouken@1062
  2222
{
slouken@1062
  2223
    AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
slouken@1062
  2224
    if test x$have_linux_version_h = xyes; then
slouken@1521
  2225
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
slouken@1062
  2226
    fi
slouken@1062
  2227
}
slouken@1062
  2228
slouken@1127
  2229
dnl Check if we want to use RPATH
slouken@1127
  2230
CheckRPATH()
slouken@1127
  2231
{
slouken@1127
  2232
    AC_ARG_ENABLE(rpath,
slouken@1637
  2233
AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]),
slouken@1127
  2234
                  , enable_rpath=yes)
slouken@1127
  2235
}
slouken@1127
  2236
slouken@1550
  2237
dnl Set up the configuration based on the host platform!
slouken@1550
  2238
case "$host" in
slouken@2775
  2239
    *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-irix*|*-*-aix*|*-*-osf*|*-*-minix*)
slouken@1550
  2240
        case "$host" in
slouken@1361
  2241
            *-*-linux*)         ARCH=linux ;;
slouken@1820
  2242
            *-*-uclinux*)       ARCH=linux ;;
slouken@1361
  2243
            *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
slouken@1361
  2244
            *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
slouken@1361
  2245
            *-*-kopenbsd*-gnu)  ARCH=kopenbsd-gnu ;;
slouken@1361
  2246
            *-*-gnu*)           ARCH=gnu ;; # must be last of the gnu variants
slouken@1361
  2247
            *-*-bsdi*)          ARCH=bsdi ;;
slouken@1361
  2248
            *-*-freebsd*)       ARCH=freebsd ;;
slouken@1565
  2249
            *-*-dragonfly*)     ARCH=freebsd ;;
slouken@1361
  2250
            *-*-netbsd*)        ARCH=netbsd ;;
slouken@1361
  2251
            *-*-openbsd*)       ARCH=openbsd ;;
slouken@1361
  2252
            *-*-sysv5*)         ARCH=sysv5 ;;
slouken@1361
  2253
            *-*-solaris*)       ARCH=solaris ;;
slouken@1361
  2254
            *-*-hpux*)          ARCH=hpux ;;
slouken@1361
  2255
            *-*-irix*)          ARCH=irix ;;
slouken@1361
  2256
            *-*-aix*)           ARCH=aix ;;
slouken@1361
  2257
            *-*-osf*)           ARCH=osf ;;
slouken@2775
  2258
            *-*-minix*)         ARCH=minix ;;
slouken@795
  2259
        esac
icculus@1573
  2260
        CheckVisibilityHidden
slouken@1
  2261
        CheckDummyVideo
slouken@68
  2262
        CheckDiskAudio
icculus@1532
  2263
        CheckDummyAudio
slouken@371
  2264
        CheckDLOPEN
slouken@0
  2265
        CheckOSS
slouken@1361
  2266
        CheckDMEDIA
slouken@1438
  2267
        CheckMME
slouken@0
  2268
        CheckALSA
icculus@2271
  2269
        CheckPulseAudio
slouken@0
  2270
        CheckARTSC
slouken@0
  2271
        CheckESD
slouken@0
  2272
        CheckNAS
slouken@0
  2273
        CheckX11
slouken@0
  2274
        CheckFBCON
slouken@167
  2275
        CheckDirectFB
slouken@2947
  2276
        CheckFusionSound
slouken@3257
  2277
        CheckPS3
slouken@0
  2278
        CheckSVGA
icculus@1191
  2279
        CheckOpenGLX11
slouken@0
  2280
        CheckInputEvents
icculus@1201
  2281
        CheckTslib
slouken@1361
  2282
        CheckUSBHID
slouken@0
  2283
        CheckPTHREAD
slouken@1361
  2284
        CheckClockGettime
slouken@1062
  2285
        CheckLinuxVersion
slouken@1127
  2286
        CheckRPATH
slouken@1361
  2287
        # Set up files for the audio library
slouken@1361
  2288
        if test x$enable_audio = xyes; then
slouken@1361
  2289
          case $ARCH in
slouken@1565
  2290
            sysv5|solaris|hpux)
slouken@1361
  2291
                AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
slouken@1361
  2292
                SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
slouken@1361
  2293
                have_audio=yes
slouken@1361
  2294
            ;;
slouken@1565
  2295
            netbsd|openbsd)
slouken@1567
  2296
                AC_DEFINE(SDL_AUDIO_DRIVER_BSD)
slouken@1567
  2297
                SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c"
slouken@1361
  2298
                have_audio=yes
slouken@1361
  2299
            ;;
slouken@1361
  2300
            aix)
icculus@2049
  2301
                AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO)
slouken@1361
  2302
                SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
slouken@1361
  2303
                have_audio=yes
slouken@1361
  2304
            ;;
slouken@1361
  2305
          esac
slouken@371
  2306
        fi
slouken@0
  2307
        # Set up files for the joystick library
slouken@0
  2308
        if test x$enable_joystick = xyes; then
slouken@1361
  2309
          case $ARCH in
slouken@1361
  2310
            linux)
slouken@1361
  2311
                AC_DEFINE(SDL_JOYSTICK_LINUX)
slouken@1361
  2312
                SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
slouken@1361
  2313
                have_joystick=yes
slouken@1361
  2314
            ;;
slouken@1361
  2315
          esac
slouken@0
  2316
        fi
slouken@2713
  2317
        # Set up files for the haptic library
slouken@2713
  2318
        if test x$enable_haptic = xyes; then
slouken@2713
  2319
           if test x$use_input_events = xyes; then
slouken@2713
  2320
             case $ARCH in
slouken@2713
  2321
               linux)
slouken@2713
  2322
                   AC_DEFINE(SDL_HAPTIC_LINUX)
slouken@2713
  2323
                   SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c"
slouken@2713
  2324
                   have_haptic=yes
slouken@2713
  2325
               ;;
slouken@2713
  2326
             esac
slouken@2713
  2327
           fi
slouken@2713
  2328
        fi
icculus@3170
  2329
        # Set up files for the power library
icculus@3170
  2330
        if test x$enable_power = xyes; then
icculus@3170
  2331
             case $ARCH in
icculus@3170
  2332
               linux)
icculus@3170
  2333
                   AC_DEFINE(SDL_POWER_LINUX)
icculus@3170
  2334
                   SOURCES="$SOURCES $srcdir/src/power/linux/*.c"
icculus@3170
  2335
                   have_power=yes
icculus@3170
  2336
               ;;
icculus@3170
  2337
             esac
icculus@3170
  2338
        fi
slouken@0
  2339
        # Set up files for the thread library
slouken@1361
  2340
        if test x$enable_threads = xyes -a x$use_pthreads != xyes -a x$use_pth != xyes -a x$ARCH = xirix; then
slouken@1361
  2341
            AC_DEFINE(SDL_THREAD_SPROC)
slouken@1361
  2342
            SOURCES="$SOURCES $srcdir/src/thread/irix/*.c"
slouken@1361
  2343
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
slouken@1361
  2344
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
slouken@1361
  2345
            have_threads=yes
slouken@0
  2346
        fi
slouken@0
  2347
        # Set up files for the timer library
slouken@0
  2348
        if test x$enable_timers = xyes; then
slouken@1361
  2349
            AC_DEFINE(SDL_TIMER_UNIX)
slouken@1361
  2350
            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
slouken@1361
  2351
            have_timers=yes
slouken@0
  2352
        fi
slouken@0
  2353
        ;;
slouken@0
  2354
    *-*-qnx*)
slouken@3083
  2355
slouken@3083
  2356
        EXTRA_CFLAGS="-I/usr/include $CFLAGS"
slouken@3083
  2357
        EXTRA_LDLAGS="-L/usr/lib $LDFLAGS"
slouken@3083
  2358
slouken@0
  2359
        ARCH=qnx
slouken@3083
  2360
        CheckVisibilityHidden
slouken@1
  2361
        CheckDummyVideo
slouken@68
  2362
        CheckDiskAudio
icculus@1532
  2363
        CheckDummyAudio
slouken@371
  2364
        CheckDLOPEN
slouken@3083
  2365
        CheckPulseAudio
slouken@3083
  2366
        CheckESD
slouken@0
  2367
        CheckNAS
slouken@0
  2368
        CheckPHOTON
slouken@3083
  2369
        CheckQNXGF
slouken@0
  2370
        CheckX11
icculus@1191
  2371
        CheckOpenGLX11
slouken@0
  2372
        CheckPTHREAD
slouken@3083
  2373
        CheckClockGettime
slouken@3083
  2374
slouken@3083
  2375
slouken@0
  2376
        # Set up files for the audio library
slouken@0
  2377
        if test x$enable_audio = xyes; then
slouken@3099
  2378
            AC_DEFINE(SDL_AUDIO_DRIVER_QSA)
slouken@3099
  2379
            SOURCES="$SOURCES $srcdir/src/audio/qsa/*.c"
slouken@1521
  2380
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound"
slouken@1361
  2381
            have_audio=yes
slouken@0
  2382
        fi
slouken@0
  2383
        # Set up files for the timer library
slouken@0
  2384
        if test x$enable_timers = xyes; then
slouken@1361
  2385
            AC_DEFINE(SDL_TIMER_UNIX)
slouken@1361
  2386
            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
slouken@1361
  2387
            have_timers=yes
slouken@0
  2388
        fi
slouken@3083
  2389
        # Set up dummy files for the joystick for now
slouken@3083
  2390
        if test x$enable_joystick = xyes; then
slouken@3083
  2391
            AC_DEFINE(SDL_JOYSTICK_DUMMY)
slouken@3083
  2392
            SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
slouken@3083
  2393
            have_joystick=yes
slouken@3083
  2394
        fi
slouken@3083
  2395
        # Set up dummy files for the haptic for now
slouken@3083
  2396
        if test x$enable_haptic = xyes; then
slouken@3083
  2397
            AC_DEFINE(SDL_HAPTIC_DUMMY)
slouken@3083
  2398
            SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
slouken@3083
  2399
            have_haptic=yes
slouken@3083
  2400
        fi
slouken@0
  2401
        ;;
slouken@3097
  2402
    *-wince* | *-mingw32ce)
slouken@3097
  2403
        ARCH=win32
slouken@3097
  2404
        CheckDummyVideo
slouken@3097
  2405
        CheckDiskAudio
slouken@3097
  2406
        CheckDummyAudio
slouken@3097
  2407
        CheckWIN32
slouken@3097
  2408
        if test x$enable_video = xyes; then
slouken@3097
  2409
            AC_DEFINE(SDL_VIDEO_DRIVER_WIN32)
slouken@3097
  2410
            SOURCES="$SOURCES $srcdir/src/video/win32/*.c"
slouken@3097
  2411
            have_video=yes
slouken@3097
  2412
            AC_ARG_ENABLE(render-gdi,
slouken@3097
  2413
AC_HELP_STRING([--enable-render-gdi], [enable the GDI render driver [[default=yes]]]),
slouken@3097
  2414
                                , enable_render_gdi=yes)
slouken@3097
  2415
            if test x$enable_render_gdi = xyes; then
slouken@3097
  2416
                AC_DEFINE(SDL_VIDEO_RENDER_GDI)
slouken@3097
  2417
            fi
slouken@3168
  2418
            AC_ARG_ENABLE(render-gapi,
slouken@3168
  2419
AC_HELP_STRING([--enable-render-gapi], [enable the GAPI/RAWFRAMEBUFFER render driver [[default=yes]]]),
slouken@3168
  2420
                                , enable_render_gapi=yes)
slouken@3168
  2421
            if test x$enable_render_gapi = xyes -a x$have_wince = xyes; then
slouken@3168
  2422
                AC_DEFINE(SDL_VIDEO_RENDER_GAPI)
slouken@3168
  2423
            fi
slouken@3168
  2424
            AC_ARG_ENABLE(render-ddraw,
slouken@3168
  2425
AC_HELP_STRING([--enable-render-ddraw], [enable the Mobile DirectDraw render driver [[default=yes]]]),
slouken@3168
  2426
                                , enable_render_ddraw=yes)
slouken@3168
  2427
            if test x$enable_render_ddraw = xyes -a x$have_wince = xyes -a x$have_ddraw = xyes; then
slouken@3168
  2428
                AC_DEFINE(SDL_VIDEO_RENDER_DDRAW)
slouken@3168
  2429
            fi
slouken@3097
  2430
            AC_ARG_ENABLE(render-d3d,
slouken@3097
  2431
AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
slouken@3097
  2432
                                , enable_render_d3d=yes)
slouken@3097
  2433
            enable_render_d3d=no
slouken@3097
  2434
            if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
slouken@3097
  2435
                AC_DEFINE(SDL_VIDEO_RENDER_D3D)
slouken@3097
  2436
            fi
slouken@3097
  2437
        fi
slouken@3097
  2438
        # Set up files for the audio library
slouken@3097
  2439
        if test x$enable_audio = xyes; then
slouken@3097
  2440
            AC_DEFINE(SDL_AUDIO_DRIVER_WINWAVEOUT)
slouken@3097
  2441
            SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
slouken@3097
  2442
            if test x$have_dsound = xyes; then
slouken@3097
  2443
                AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
slouken@3097
  2444
                SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
slouken@3097
  2445
            fi
slouken@3097
  2446
            have_audio=yes
slouken@3097
  2447
        fi
slouken@4569
  2448
        # Set up dummy files for the joystick for now
slouken@4569
  2449
        if test x$enable_joystick = xyes; then
slouken@4569
  2450
            AC_DEFINE(SDL_JOYSTICK_DUMMY)
slouken@4569
  2451
            SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
slouken@4569
  2452
            have_joystick=yes
slouken@4569
  2453
        fi
slouken@3097
  2454
        # Set up files for the thread library
slouken@3097
  2455
        if test x$enable_threads = xyes; then
slouken@3097
  2456
            AC_DEFINE(SDL_THREAD_WIN32)
slouken@3097
  2457
            SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
slouken@3097
  2458
            SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
slouken@3097
  2459
            SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
slouken@3097
  2460
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
slouken@3097
  2461
            have_threads=yes
slouken@3097
  2462
        fi
slouken@3097
  2463
        # Set up files for the timer library
slouken@3097
  2464
        if test x$enable_timers = xyes; then
slouken@3097
  2465
            AC_DEFINE(SDL_TIMER_WINCE)
slouken@3097
  2466
            SOURCES="$SOURCES $srcdir/src/timer/wince/*.c"
slouken@3097
  2467
            have_timers=yes
slouken@3097
  2468
        fi
slouken@3097
  2469
        # Set up files for the shared object loading library
slouken@3097
  2470
        if test x$enable_loadso = xyes; then
slouken@3097
  2471
            AC_DEFINE(SDL_LOADSO_WIN32)
slouken@3097
  2472
            SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
slouken@3097
  2473
            have_loadso=yes
slouken@3097
  2474
        fi
slouken@3097
  2475
        # Set up the system libraries we need
slouken@3097
  2476
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lcoredll -lcommctrl -lmmtimer"
slouken@4569
  2477
slouken@4569
  2478
	# mingw32ce library
slouken@4569
  2479
	case "$host" in
slouken@4569
  2480
    	    *-mingw32ce)
slouken@4569
  2481
    		EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmingwex"
slouken@4569
  2482
    		;;
slouken@4569
  2483
    	    *)
slouken@4569
  2484
        	;;
slouken@4569
  2485
	esac
slouken@4569
  2486
slouken@3097
  2487
        # The Win32 platform requires special setup
slouken@3097
  2488
        SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
slouken@4569
  2489
        EXTRA_CFLAGS="$EXTRA_CFLAGS -Dmain=SDL_main -D_WIN32_WCE=0x420"
slouken@4569
  2490
        EXTRA_LDFLAGS="-lSDLmain $EXTRA_LDFLAGS"
slouken@3097
  2491
        ;;
slouken@0
  2492
    *-*-cygwin* | *-*-mingw32*)
slouken@0
  2493
        ARCH=win32
slouken@1550
  2494
        if test "$build" != "$host"; then # cross-compiling
slouken@0
  2495
            # Default cross-compile location
slouken@4476
  2496
            ac_default_prefix=/usr/local/cross-tools/$host
slouken@0
  2497
        else
slouken@0
  2498
            # Look for the location of the tools and install there
slouken@750
  2499
            if test "$BUILD_PREFIX" != ""; then
slouken@1
  2500
                ac_default_prefix=$BUILD_PREFIX
slouken@1
  2501
            fi
slouken@0
  2502
        fi
slouken@1
  2503
        CheckDummyVideo
slouken@68
  2504
        CheckDiskAudio
icculus@1532
  2505
        CheckDummyAudio
slouken@0
  2506
        CheckWIN32
slouken@1361
  2507
        CheckWIN32GL
slouken@0
  2508
        CheckDIRECTX
slouken@1895
  2509
        # Set up files for the video library
slouken@1895
  2510
        if test x$enable_video = xyes; then
slouken@1895
  2511
            AC_DEFINE(SDL_VIDEO_DRIVER_WIN32)
slouken@1895
  2512
            SOURCES="$SOURCES $srcdir/src/video/win32/*.c"
slouken@1895
  2513
            have_video=yes
slouken@1895
  2514
            AC_ARG_ENABLE(render-gdi,
slouken@1895
  2515
AC_HELP_STRING([--enable-render-gdi], [enable the GDI render driver [[default=yes]]]),
slouken@1895
  2516
                                , enable_render_gdi=yes)
slouken@1895
  2517
            if test x$enable_render_gdi = xyes; then
slouken@1895
  2518
                AC_DEFINE(SDL_VIDEO_RENDER_GDI)
slouken@1895
  2519
            fi
slouken@1895
  2520
            AC_ARG_ENABLE(render-d3d,
slouken@1895
  2521
AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
slouken@1895
  2522
                                , enable_render_d3d=yes)
slouken@1895
  2523
            if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
slouken@1895
  2524
                AC_DEFINE(SDL_VIDEO_RENDER_D3D)
slouken@1895
  2525
            fi
slouken@1895
  2526
        fi
slouken@0
  2527
        # Set up files for the audio library
slouken@0
  2528
        if test x$enable_audio = xyes; then
icculus@2070
  2529
            AC_DEFINE(SDL_AUDIO_DRIVER_WINWAVEOUT)
slouken@1361
  2530
            SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
slouken@1895
  2531
            if test x$have_dsound = xyes; then
slouken@1361
  2532
                AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
slouken@1361
  2533
                SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
slouken@0
  2534
            fi
slouken@1361
  2535
            have_audio=yes
slouken@0
  2536
        fi
slouken@0
  2537
        # Set up files for the joystick library
slouken@0
  2538
        if test x$enable_joystick = xyes; then
slouken@1895
  2539
            if test x$have_dinput = xyes; then
slouken@1895
  2540
                AC_DEFINE(SDL_JOYSTICK_DINPUT)
slouken@1895
  2541
                SOURCES="$SOURCES $srcdir/src/joystick/win32/SDL_dxjoystick.c"
slouken@4894
  2542
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8"
slouken@1895
  2543
            else
slouken@1895
  2544
                AC_DEFINE(SDL_JOYSTICK_WINMM)
slouken@1895
  2545
                SOURCES="$SOURCES $srcdir/src/joystick/win32/SDL_mmjoystick.c"
slouken@1895
  2546
            fi
slouken@1361
  2547
            have_joystick=yes
slouken@0
  2548
        fi
slouken@2713
  2549
        if test x$enable_haptic = xyes; then
slouken@2713
  2550
            if test x$have_dinput = xyes; then
slouken@2713
  2551
                AC_DEFINE(SDL_HAPTIC_DINPUT)
slouken@2713
  2552
                SOURCES="$SOURCES $srcdir/src/haptic/win32/SDL_syshaptic.c"
slouken@2713
  2553
                have_haptic=yes
slouken@2713
  2554
            fi
slouken@2713
  2555
        fi
icculus@3170
  2556
        if test x$enable_power = xyes; then
icculus@3170
  2557
            AC_DEFINE(SDL_POWER_WINDOWS)
icculus@3170
  2558
            SOURCES="$SOURCES $srcdir/src/power/windows/SDL_syspower.c"
icculus@3170
  2559
            have_power=yes
icculus@3170
  2560
        fi
slouken@0
  2561
        # Set up files for the thread library
slouken@0
  2562
        if test x$enable_threads = xyes; then
slouken@1361
  2563
            AC_DEFINE(SDL_THREAD_WIN32)
slouken@1361
  2564
            SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
slouken@1361
  2565
            SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
slouken@1361
  2566
            SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
slouken@1361
  2567
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
slouken@1361
  2568
            have_threads=yes
slouken@0
  2569
        fi
slouken@0
  2570
        # Set up files for the timer library
slouken@0
  2571
        if test x$enable_timers = xyes; then
slouken@1361
  2572
            AC_DEFINE(SDL_TIMER_WIN32)
slouken@1361
  2573
            SOURCES="$SOURCES $srcdir/src/timer/win32/*.c"
slouken@1361
  2574
            have_timers=yes
slouken@1361
  2575
        fi
slouken@1361
  2576
        # Set up files for the shared object loading library
slouken@1361
  2577
        if test x$enable_loadso = xyes; then
slouken@1361
  2578
            AC_DEFINE(SDL_LOADSO_WIN32)
slouken@1361
  2579
            SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
slouken@1361
  2580
            have_loadso=yes
slouken@1361
  2581
        fi
slouken@1361
  2582
        # Set up the system libraries we need
slouken@3082
  2583
        # SDL 1.3 is unicode, and unicows emulates this on Windows 98/ME
slouken@3082
  2584
        # You can get this here: http://libunicows.sourceforge.net/
slouken@3082
  2585
        #EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lunicows"
slouken@4894
  2586
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lmsimg32 -lwinmm -limm32 -lole32 -loleaut32 -lversion -luuid"
slouken@0
  2587
        # The Win32 platform requires special setup
slouken@3334
  2588
        VERSION_SOURCES="$srcdir/src/main/win32/*.rc"
slouken@1397
  2589
        SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
slouken@0
  2590
        SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
slouken@1363
  2591
        SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
slouken@0
  2592
        ;;
slouken@3292
  2593
    *-*-beos* | *-*-haiku*)
slouken@0
  2594
        ARCH=beos
slouken@0
  2595
        ac_default_prefix=/boot/develop/tools/gnupro
slouken@1
  2596
        CheckDummyVideo
slouken@68
  2597
        CheckDiskAudio
icculus@1532
  2598
        CheckDummyAudio
slouken@0
  2599
        CheckBWINDOW
slouken@0
  2600
        CheckBeGL
slouken@0
  2601
        # Set up files for the audio library
slouken@0
  2602
        if test x$enable_audio = xyes; then
icculus@2049
  2603
            AC_DEFINE(SDL_AUDIO_DRIVER_BEOSAUDIO)
slouken@1361
  2604
            SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc"
slouken@1361
  2605
            have_audio=yes
slouken@0
  2606
        fi
slouken@0
  2607
        # Set up files for the joystick library
slouken@0
  2608
        if test x$enable_joystick = xyes; then
slouken@1361
  2609
            AC_DEFINE(SDL_JOYSTICK_BEOS)
slouken@1361
  2610
            SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc"
slouken@1361
  2611
            have_joystick=yes
slouken@0
  2612
        fi
slouken@0
  2613
        # Set up files for the thread library
slouken@0
  2614
        if test x$enable_threads = xyes; then
slouken@1361
  2615
            AC_DEFINE(SDL_THREAD_BEOS)
slouken@1361
  2616
            SOURCES="$SOURCES $srcdir/src/thread/beos/*.c"
slouken@1361
  2617
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
slouken@1361
  2618
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
slouken@1361
  2619
            have_threads=yes
slouken@0
  2620
        fi
slouken@0
  2621
        # Set up files for the timer library
slouken@0
  2622
        if test x$enable_timers = xyes; then
slouken@1361
  2623
            AC_DEFINE(SDL_TIMER_BEOS)
slouken@1361
  2624
            SOURCES="$SOURCES $srcdir/src/timer/beos/*.c"
slouken@1361
  2625
            have_timers=yes
slouken@1361
  2626
        fi
slouken@1361
  2627
        # Set up files for the shared object loading library
slouken@1361
  2628
        if test x$enable_loadso = xyes; then
slouken@1361
  2629
            AC_DEFINE(SDL_LOADSO_BEOS)
slouken@1361
  2630
            SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
slouken@1361
  2631
            have_loadso=yes
slouken@0
  2632
        fi
icculus@3173
  2633
        # Set up files for the system power library
icculus@3173
  2634
        if test x$enable_power = xyes; then
icculus@3173
  2635
            AC_DEFINE(SDL_POWER_BEOS)
icculus@3173
  2636
            SOURCES="$SOURCES $srcdir/src/power/beos/*.c"
icculus@3173
  2637
            have_power=yes
icculus@3173
  2638
        fi
slouken@1367
  2639
        # The BeOS platform requires special setup.
slouken@1367
  2640
        SOURCES="$srcdir/src/main/beos/*.cc $SOURCES"
slouken@1521
  2641
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
slouken@0
  2642
        ;;
slouken@0
  2643
    *-*-darwin* )
icculus@1133
  2644
        # This could be either full "Mac OS X", or plain "Darwin" which is
slouken@158
  2645
        # just the OS X kernel sans upper layers like Carbon and Cocoa.
icculus@1133
  2646
        # Next line is broken, and a few files below require Mac OS X (full)
slouken@158
  2647
        ARCH=macosx
slouken@1624
  2648
slouken@1628
  2649
        # Mac OS X builds with both the Carbon and OSX APIs at the moment
slouken@1638
  2650
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
slouken@1638
  2651
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
slouken@1628
  2652
slouken@1628
  2653
        # HACK: Reset EXTRA_LDFLAGS; the only thing it contains at this point
slouken@1628
  2654
        # is -lm which is not needed under Mac OS X. But for some reasons it
slouken@1628
  2655
        # also tends to contain spurious -L switches, which we don't want to
slouken@1628
  2656
        # use here or in sdl-config. Hence we reset it.
slouken@1624
  2657
        EXTRA_LDFLAGS=""
slouken@1624
  2658
slouken@1742
  2659
        CheckVisibilityHidden
slouken@1
  2660
        CheckDummyVideo
slouken@68
  2661
        CheckDiskAudio
icculus@1532
  2662
        CheckDummyAudio
slouken@1638
  2663
        CheckDLOPEN
slouken@1889
  2664
slouken@1648
  2665
        # Set up files for the shared object loading library
slouken@1648
  2666
        # (this needs to be done before the dynamic X11 check)
slouken@1648
  2667
        if test x$enable_loadso = xyes -a x$have_dlopen != xyes; then
slouken@1648
  2668
            AC_DEFINE(SDL_LOADSO_DLCOMPAT)
slouken@1648
  2669
            SOURCES="$SOURCES $srcdir/src/loadso/macosx/*.c"
slouken@1648
  2670
            have_loadso=yes
slouken@1648
  2671
        fi
slouken@1648
  2672
icculus@1133
  2673
        CheckCOCOA
icculus@1174
  2674
        CheckX11
slouken@0
  2675
        CheckMacGL
icculus@1191
  2676
        CheckOpenGLX11
slouken@0
  2677
        CheckPTHREAD
icculus@1445
  2678
slouken@2238
  2679
        # Good optimization on Mac OS X, yes...
slouken@2238
  2680
        EXTRA_CFLAGS="$EXTRA_CFLAGS -falign-loops=16"
slouken@2238
  2681
icculus@1445
  2682
        # Need this or things might misbuild on a G3.
slouken@1521
  2683
        EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"
icculus@1445
  2684
slouken@0
  2685
        # Set up files for the audio library
slouken@0
  2686
        if test x$enable_audio = xyes; then
slouken@1361
  2687
            AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO)
slouken@1361
  2688
            SOURCES="$SOURCES $srcdir/src/audio/macosx/*.c"
slouken@1361
  2689
            have_audio=yes
slouken@0
  2690
        fi
slouken@0
  2691
        # Set up files for the joystick library
slouken@0
  2692
        if test x$enable_joystick = xyes; then
slouken@1361
  2693
            AC_DEFINE(SDL_JOYSTICK_IOKIT)
slouken@1361
  2694
            SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
slouken@1361
  2695
            have_joystick=yes
slouken@0
  2696
        fi
slouken@2713
  2697
        # Set up files for the haptic library
slouken@2713
  2698
        if test x$enable_haptic = xyes; then
slouken@2713
  2699
            AC_DEFINE(SDL_HAPTIC_IOKIT)
slouken@2713
  2700
            SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
slouken@2713
  2701
            have_haptic=yes
icculus@3623
  2702
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
slouken@2713
  2703
        fi
icculus@3170
  2704
        # Set up files for the power library
icculus@3170
  2705
        if test x$enable_power = xyes; then
icculus@3170
  2706
            AC_DEFINE(SDL_POWER_MACOSX)
icculus@3170
  2707
            SOURCES="$SOURCES $srcdir/src/power/macosx/*.c"
icculus@3170
  2708
            have_power=yes
icculus@3170
  2709
        fi
slouken@0
  2710
        # Set up files for the timer library
slouken@0
  2711
        if test x$enable_timers = xyes; then
slouken@1361
  2712
            AC_DEFINE(SDL_TIMER_UNIX)
slouken@1361
  2713
            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
slouken@1361
  2714
            have_timers=yes
slouken@1361
  2715
        fi
slouken@4454
  2716
        # Set up additional files for the file library
slouken@4454
  2717
        if test x$enable_file = xyes; then
slouken@4454
  2718
            SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
slouken@4454
  2719
        fi
slouken@1621
  2720
        # The Mac OS X platform requires special setup.
slouken@1521
  2721
        EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
slouken@3049
  2722
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc"
icculus@3623
  2723
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
icculus@3623
  2724
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"