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