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