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