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