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