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