configure.in
author Sam Lantinga <slouken@libsdl.org>
Fri, 18 Feb 2011 11:19:34 -0800
changeset 5345 0202f62906ca
parent 5314 ead9bbbdcaf3
child 5389 24903690f48a
permissions -rw-r--r--
Added a better way to include build rules in the Makefile
Cleaned up dependencies on generating SDL_revision.h
Fixed 'make install' if you are not building from a Mercurial repository
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@5154
   333
SOURCES="$SOURCES $srcdir/src/atomic/*.c"
slouken@1361
   334
SOURCES="$SOURCES $srcdir/src/audio/*.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@5154
   338
SOURCES="$SOURCES $srcdir/src/render/*.c"
slouken@5154
   339
SOURCES="$SOURCES $srcdir/src/render/*/*.c"
slouken@1361
   340
SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
slouken@1361
   341
SOURCES="$SOURCES $srcdir/src/thread/*.c"
slouken@1361
   342
SOURCES="$SOURCES $srcdir/src/timer/*.c"
slouken@1361
   343
SOURCES="$SOURCES $srcdir/src/video/*.c"
slouken@1361
   344
slouken@0
   345
dnl Enable/disable various subsystems of the SDL library
slouken@0
   346
bob@3199
   347
AC_ARG_ENABLE(atomic,
bob@3199
   348
AC_HELP_STRING([--enable-atomic], [Enable the atomic operations subsystem [[default=yes]]]),
bob@3199
   349
              , enable_atomic=yes)
bob@3199
   350
if test x$enable_atomic != xyes; then
bob@3199
   351
    AC_DEFINE(SDL_ATOMIC_DISABLED)
bob@3199
   352
fi
slouken@0
   353
AC_ARG_ENABLE(audio,
slouken@1637
   354
AC_HELP_STRING([--enable-audio], [Enable the audio subsystem [[default=yes]]]),
slouken@0
   355
              , enable_audio=yes)
slouken@1361
   356
if test x$enable_audio != xyes; then
slouken@1361
   357
    AC_DEFINE(SDL_AUDIO_DISABLED)
slouken@0
   358
fi
slouken@0
   359
AC_ARG_ENABLE(video,
slouken@1637
   360
AC_HELP_STRING([--enable-video], [Enable the video subsystem [[default=yes]]]),
slouken@0
   361
              , enable_video=yes)
slouken@1361
   362
if test x$enable_video != xyes; then
slouken@1361
   363
    AC_DEFINE(SDL_VIDEO_DISABLED)
slouken@0
   364
fi
slouken@5226
   365
AC_ARG_ENABLE(render,
slouken@5226
   366
AC_HELP_STRING([--enable-render], [Enable the render subsystem [[default=yes]]]),
slouken@5226
   367
              , enable_render=yes)
slouken@5226
   368
if test x$enable_render != xyes; then
slouken@5226
   369
    AC_DEFINE(SDL_RENDER_DISABLED)
slouken@5226
   370
fi
slouken@0
   371
AC_ARG_ENABLE(events,
slouken@1637
   372
AC_HELP_STRING([--enable-events], [Enable the events subsystem [[default=yes]]]),
slouken@0
   373
              , enable_events=yes)
slouken@1361
   374
if test x$enable_events != xyes; then
slouken@1361
   375
    AC_DEFINE(SDL_EVENTS_DISABLED)
slouken@0
   376
fi
slouken@0
   377
AC_ARG_ENABLE(joystick,
slouken@1637
   378
AC_HELP_STRING([--enable-joystick], [Enable the joystick subsystem [[default=yes]]]),
slouken@0
   379
              , enable_joystick=yes)
slouken@1361
   380
if test x$enable_joystick != xyes; then
slouken@1361
   381
    AC_DEFINE(SDL_JOYSTICK_DISABLED)
icculus@2103
   382
else
icculus@2103
   383
    SOURCES="$SOURCES $srcdir/src/joystick/*.c"
slouken@0
   384
fi
slouken@2713
   385
AC_ARG_ENABLE(haptic,
slouken@2713
   386
AC_HELP_STRING([--enable-haptic], [Enable the haptic (force feedback) subsystem [[default=yes]]]),
slouken@2713
   387
              , enable_haptic=yes)
slouken@2713
   388
if test x$enable_haptic != xyes; then
slouken@2713
   389
    AC_DEFINE(SDL_HAPTIC_DISABLED)
slouken@2713
   390
else
slouken@2713
   391
    SOURCES="$SOURCES $srcdir/src/haptic/*.c"
slouken@2713
   392
fi
icculus@3170
   393
AC_ARG_ENABLE(power,
icculus@3170
   394
AC_HELP_STRING([--enable-power], [Enable the power subsystem [[default=yes]]]),
icculus@3170
   395
              , enable_power=yes)
icculus@3170
   396
if test x$enable_power != xyes; then
icculus@3170
   397
    AC_DEFINE(SDL_POWER_DISABLED)
icculus@3170
   398
else
icculus@3170
   399
    SOURCES="$SOURCES $srcdir/src/power/*.c"
icculus@3170
   400
fi
slouken@0
   401
AC_ARG_ENABLE(threads,
slouken@1637
   402
AC_HELP_STRING([--enable-threads], [Enable the threading subsystem [[default=yes]]]),
slouken@0
   403
              , enable_threads=yes)
slouken@0
   404
if test x$enable_threads != xyes; then
slouken@1361
   405
    AC_DEFINE(SDL_THREADS_DISABLED)
slouken@0
   406
fi
slouken@0
   407
AC_ARG_ENABLE(timers,
slouken@1637
   408
AC_HELP_STRING([--enable-timers], [Enable the timer subsystem [[default=yes]]]),
slouken@0
   409
              , enable_timers=yes)
slouken@1361
   410
if test x$enable_timers != xyes; then
slouken@1361
   411
    AC_DEFINE(SDL_TIMERS_DISABLED)
slouken@0
   412
fi
slouken@0
   413
AC_ARG_ENABLE(file,
slouken@1637
   414
AC_HELP_STRING([--enable-file], [Enable the file subsystem [[default=yes]]]),
slouken@0
   415
              , enable_file=yes)
slouken@1361
   416
if test x$enable_file != xyes; then
slouken@1361
   417
    AC_DEFINE(SDL_FILE_DISABLED)
slouken@1361
   418
fi
slouken@1361
   419
AC_ARG_ENABLE(loadso,
slouken@1637
   420
AC_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [[default=yes]]]),
slouken@1361
   421
              , enable_loadso=yes)
slouken@1361
   422
if test x$enable_loadso != xyes; then
slouken@1361
   423
    AC_DEFINE(SDL_LOADSO_DISABLED)
slouken@0
   424
fi
slouken@740
   425
AC_ARG_ENABLE(cpuinfo,
slouken@1637
   426
AC_HELP_STRING([--enable-cpuinfo], [Enable the cpuinfo subsystem [[default=yes]]]),
slouken@740
   427
              , enable_cpuinfo=yes)
slouken@1361
   428
if test x$enable_cpuinfo != xyes; then
slouken@1361
   429
    AC_DEFINE(SDL_CPUINFO_DISABLED)
slouken@1361
   430
fi
slouken@5225
   431
AC_ARG_ENABLE(atomic,
slouken@5225
   432
AC_HELP_STRING([--enable-atomic], [Enable the atomic operations [[default=yes]]]),
slouken@5225
   433
              , enable_atomic=yes)
slouken@5225
   434
if test x$enable_atomic != xyes; then
slouken@5225
   435
    AC_DEFINE(SDL_ATOMIC_DISABLED)
slouken@5225
   436
fi
slouken@1402
   437
AC_ARG_ENABLE(assembly,
slouken@1637
   438
AC_HELP_STRING([--enable-assembly], [Enable assembly routines [[default=yes]]]),
slouken@1402
   439
              , enable_assembly=yes)
slouken@1402
   440
if test x$enable_assembly = xyes; then
slouken@1402
   441
    AC_DEFINE(SDL_ASSEMBLY_ROUTINES)
slouken@2247
   442
slouken@2856
   443
    # Make sure that we don't generate floating point code that would
slouken@2856
   444
    # cause illegal instruction exceptions on older processors
slouken@2856
   445
    case "$host" in
slouken@2856
   446
        *-*-darwin*)
slouken@2856
   447
            # Don't need to worry about Apple hardware, it's all SSE capable
slouken@2856
   448
            default_ssemath=yes
slouken@2856
   449
            ;;
slouken@2856
   450
        *64-*-*)
slouken@2856
   451
            # x86 64-bit architectures all have SSE instructions
slouken@2856
   452
            default_ssemath=yes
slouken@2856
   453
            ;;
slouken@3392
   454
        *)
slouken@2856
   455
            default_ssemath=no
slouken@2856
   456
            ;;
slouken@2856
   457
    esac
slouken@2856
   458
    AC_ARG_ENABLE(ssemath,
slouken@2856
   459
AC_HELP_STRING([--enable-ssemath], [Allow GCC to use SSE floating point math [[default=no]]]),
slouken@2856
   460
                  , enable_ssemath=$default_ssemath)
slouken@2856
   461
    if test x$enable_ssemath = xno; then
slouken@2856
   462
        if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes; then
slouken@2856
   463
            EXTRA_CFLAGS="$EXTRA_CFLAGS -mfpmath=387"
slouken@2856
   464
        fi
slouken@2856
   465
    fi
slouken@2856
   466
slouken@2247
   467
    dnl Check for various instruction support
slouken@2247
   468
    AC_ARG_ENABLE(mmx,
slouken@2247
   469
AC_HELP_STRING([--enable-mmx], [use MMX assembly routines [[default=yes]]]),
slouken@2247
   470
                  , enable_mmx=yes)
slouken@2247
   471
    if test x$enable_mmx = xyes; then
slouken@2247
   472
        save_CFLAGS="$CFLAGS"
slouken@2247
   473
        have_gcc_mmx=no
slouken@2247
   474
        AC_MSG_CHECKING(for GCC -mmmx option)
slouken@2247
   475
        mmx_CFLAGS="-mmmx"
slouken@2247
   476
        CFLAGS="$save_CFLAGS $mmx_CFLAGS"
slouken@2247
   477
slouken@2247
   478
        AC_TRY_COMPILE([
slouken@4426
   479
        #ifdef __MINGW32__
slouken@4426
   480
        #include <_mingw.h>
slouken@4426
   481
        #ifdef __MINGW64_VERSION_MAJOR
slouken@4426
   482
        #include <intrin.h>
slouken@4426
   483
        #else
slouken@2247
   484
        #include <mmintrin.h>
slouken@4426
   485
        #endif
slouken@4426
   486
        #else
slouken@4426
   487
        #include <mmintrin.h>
slouken@4426
   488
        #endif
slouken@2261
   489
        #ifndef __MMX__
slouken@2261
   490
        #error Assembler CPP flag not enabled
slouken@2261
   491
        #endif
slouken@2247
   492
        ],[
slouken@2247
   493
        ],[
slouken@2247
   494
        have_gcc_mmx=yes
slouken@2247
   495
        ])
slouken@2247
   496
        AC_MSG_RESULT($have_gcc_mmx)
slouken@2290
   497
        CFLAGS="$save_CFLAGS"
slouken@2247
   498
slouken@2247
   499
        if test x$have_gcc_mmx = xyes; then
slouken@2247
   500
            EXTRA_CFLAGS="$EXTRA_CFLAGS $mmx_CFLAGS"
slouken@2247
   501
        fi
slouken@2247
   502
    fi
slouken@2247
   503
slouken@2247
   504
    AC_ARG_ENABLE(sse,
slouken@2247
   505
AC_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]),
slouken@2247
   506
                  , enable_sse=yes)
slouken@2247
   507
    if test x$enable_sse = xyes; then
slouken@2247
   508
        save_CFLAGS="$CFLAGS"
slouken@2247
   509
        have_gcc_sse=no
slouken@2247
   510
        AC_MSG_CHECKING(for GCC -msse option)
slouken@2247
   511
        sse_CFLAGS="-msse"
slouken@2247
   512
        CFLAGS="$save_CFLAGS $sse_CFLAGS"
slouken@2247
   513
slouken@2247
   514
        AC_TRY_COMPILE([
slouken@4426
   515
        #ifdef __MINGW32__
slouken@4426
   516
        #include <_mingw.h>
slouken@4426
   517
        #ifdef __MINGW64_VERSION_MAJOR
slouken@4426
   518
        #include <intrin.h>
slouken@4426
   519
        #else
slouken@2247
   520
        #include <xmmintrin.h>
slouken@4426
   521
        #endif
slouken@4426
   522
        #else
slouken@4426
   523
        #include <xmmintrin.h>
slouken@4426
   524
        #endif
slouken@2261
   525
        #ifndef __SSE__
slouken@2261
   526
        #error Assembler CPP flag not enabled
slouken@2261
   527
        #endif
slouken@2247
   528
        ],[
slouken@2247
   529
        ],[
slouken@2247
   530
        have_gcc_sse=yes
slouken@2247
   531
        ])
slouken@2247
   532
        AC_MSG_RESULT($have_gcc_sse)
slouken@2290
   533
        CFLAGS="$save_CFLAGS"
slouken@2247
   534
slouken@2247
   535
        if test x$have_gcc_sse = xyes; then
slouken@2247
   536
            EXTRA_CFLAGS="$EXTRA_CFLAGS $sse_CFLAGS"
slouken@2247
   537
        fi
slouken@2247
   538
    fi
slouken@2247
   539
slouken@2264
   540
    AC_ARG_ENABLE(sse2,
slouken@2856
   541
AC_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=no]]]),
slouken@2856
   542
                  , enable_sse2=$default_ssemath)
slouken@2264
   543
    if test x$enable_sse2 = xyes; then
slouken@2264
   544
        save_CFLAGS="$CFLAGS"
slouken@2264
   545
        have_gcc_sse2=no
slouken@2264
   546
        AC_MSG_CHECKING(for GCC -msse2 option)
slouken@2264
   547
        sse2_CFLAGS="-msse2"
slouken@2264
   548
        CFLAGS="$save_CFLAGS $sse2_CFLAGS"
slouken@2264
   549
slouken@2264
   550
        AC_TRY_COMPILE([
slouken@4426
   551
        #ifdef __MINGW32__
slouken@4426
   552
        #include <_mingw.h>
slouken@4426
   553
        #ifdef __MINGW64_VERSION_MAJOR
slouken@4426
   554
        #include <intrin.h>
slouken@4426
   555
        #else
slouken@2264
   556
        #include <emmintrin.h>
slouken@4426
   557
        #endif
slouken@4426
   558
        #else
slouken@4426
   559
        #include <emmintrin.h>
slouken@4426
   560
        #endif
slouken@2264
   561
        #ifndef __SSE2__
slouken@2264
   562
        #error Assembler CPP flag not enabled
slouken@2264
   563
        #endif
slouken@2264
   564
        ],[
slouken@2264
   565
        ],[
slouken@2264
   566
        have_gcc_sse2=yes
slouken@2264
   567
        ])
slouken@2264
   568
        AC_MSG_RESULT($have_gcc_sse2)
slouken@2290
   569
        CFLAGS="$save_CFLAGS"
slouken@2264
   570
slouken@2264
   571
        if test x$have_gcc_sse2 = xyes; then
slouken@2264
   572
            EXTRA_CFLAGS="$EXTRA_CFLAGS $sse2_CFLAGS"
slouken@2264
   573
        fi
slouken@2264
   574
    fi
slouken@740
   575
fi
slouken@0
   576
slouken@0
   577
dnl See if the OSS audio interface is supported
slouken@0
   578
CheckOSS()
slouken@0
   579
{
slouken@0
   580
    AC_ARG_ENABLE(oss,
slouken@1637
   581
AC_HELP_STRING([--enable-oss], [support the OSS audio API [[default=yes]]]),
slouken@0
   582
                  , enable_oss=yes)
slouken@0
   583
    if test x$enable_audio = xyes -a x$enable_oss = xyes; then
slouken@0
   584
        AC_MSG_CHECKING(for OSS audio support)
slouken@0
   585
        have_oss=no
slouken@94
   586
        if test x$have_oss != xyes; then
slouken@94
   587
            AC_TRY_COMPILE([
slouken@94
   588
              #include <sys/soundcard.h>
slouken@94
   589
            ],[
slouken@94
   590
              int arg = SNDCTL_DSP_SETFRAGMENT;
slouken@94
   591
            ],[
slouken@94
   592
            have_oss=yes
slouken@94
   593
            ])
slouken@94
   594
        fi
slouken@94
   595
        if test x$have_oss != xyes; then
slouken@94
   596
            AC_TRY_COMPILE([
slouken@94
   597
              #include <soundcard.h>
slouken@94
   598
            ],[
slouken@94
   599
              int arg = SNDCTL_DSP_SETFRAGMENT;
slouken@94
   600
            ],[
slouken@94
   601
            have_oss=yes
slouken@1361
   602
            AC_DEFINE(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H)
slouken@94
   603
            ])
slouken@94
   604
        fi
slouken@0
   605
        AC_MSG_RESULT($have_oss)
slouken@0
   606
        if test x$have_oss = xyes; then
slouken@1361
   607
            AC_DEFINE(SDL_AUDIO_DRIVER_OSS)
slouken@1361
   608
            SOURCES="$SOURCES $srcdir/src/audio/dsp/*.c"
slouken@1361
   609
            SOURCES="$SOURCES $srcdir/src/audio/dma/*.c"
slouken@1361
   610
            have_audio=yes
slouken@1361
   611
slouken@1565
   612
            # We may need to link with ossaudio emulation library
slouken@1550
   613
            case "$host" in
slouken@1383
   614
                *-*-openbsd*|*-*-netbsd*)
slouken@1521
   615
                    EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";;
slouken@1361
   616
            esac
slouken@0
   617
        fi
slouken@0
   618
    fi
slouken@0
   619
}
slouken@0
   620
slouken@0
   621
dnl See if the ALSA audio interface is supported
slouken@0
   622
CheckALSA()
slouken@0
   623
{
slouken@0
   624
    AC_ARG_ENABLE(alsa,
slouken@1637
   625
AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [[default=yes]]]),
slouken@0
   626
                  , enable_alsa=yes)
slouken@0
   627
    if test x$enable_audio = xyes -a x$enable_alsa = xyes; then
slouken@948
   628
        AM_PATH_ALSA(0.9.0, have_alsa=yes, have_alsa=no)
slouken@1009
   629
        # Restore all flags from before the ALSA detection runs
slouken@1009
   630
        CFLAGS="$alsa_save_CFLAGS"
slouken@1009
   631
        LDFLAGS="$alsa_save_LDFLAGS"
slouken@1009
   632
        LIBS="$alsa_save_LIBS"
slouken@354
   633
        if test x$have_alsa = xyes; then
slouken@865
   634
            AC_ARG_ENABLE(alsa-shared,
slouken@1637
   635
AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [[default=yes]]]),
slouken@1361
   636
                          , enable_alsa_shared=yes)
slouken@3391
   637
            alsa_lib=[`find_lib "libasound.so.*" "$ALSA_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@1361
   638
slouken@1361
   639
            AC_DEFINE(SDL_AUDIO_DRIVER_ALSA)
slouken@1361
   640
            SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c"
slouken@1521
   641
            EXTRA_CFLAGS="$EXTRA_CFLAGS $ALSA_CFLAGS"
slouken@1361
   642
            if test x$have_loadso != xyes && \
slouken@1361
   643
               test x$enable_alsa_shared = xyes; then
slouken@1467
   644
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ALSA loading])
slouken@1361
   645
            fi
slouken@1361
   646
            if test x$have_loadso = xyes && \
slouken@1361
   647
               test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
slouken@3392
   648
                echo "-- dynamic libasound -> $alsa_lib"
slouken@1361
   649
                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ALSA_DYNAMIC, "$alsa_lib")
slouken@1361
   650
            else
slouken@1521
   651
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ALSA_LIBS"
slouken@1361
   652
            fi
slouken@1361
   653
            have_audio=yes
slouken@1361
   654
        fi
slouken@1361
   655
    fi
slouken@0
   656
}
slouken@0
   657
slouken@148
   658
dnl Check whether we want to use IRIX 6.5+ native audio or not
slouken@148
   659
CheckDMEDIA()
slouken@148
   660
{
slouken@148
   661
    if test x$enable_audio = xyes; then
slouken@148
   662
        AC_MSG_CHECKING(for dmedia audio support)
slouken@148
   663
        have_dmedia=no
slouken@148
   664
        AC_TRY_COMPILE([
slouken@148
   665
          #include <dmedia/audio.h>
slouken@148
   666
        ],[
slouken@148
   667
          ALport audio_port;
slouken@148
   668
        ],[
slouken@148
   669
        have_dmedia=yes
slouken@148
   670
        ])
slouken@935
   671
        AC_MSG_RESULT($have_dmedia)
slouken@148
   672
        # Set up files for the audio library
slouken@148
   673
        if test x$have_dmedia = xyes; then
slouken@1361
   674
            AC_DEFINE(SDL_AUDIO_DRIVER_DMEDIA)
slouken@1361
   675
            SOURCES="$SOURCES $srcdir/src/audio/dmedia/*.c"
slouken@1521
   676
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -laudio"
slouken@1361
   677
            have_audio=yes
slouken@148
   678
        fi
slouken@148
   679
    fi
slouken@148
   680
}
slouken@148
   681
slouken@1438
   682
dnl Check whether we want to use Tru64 UNIX native audio or not
slouken@1438
   683
CheckMME()
slouken@1438
   684
{
slouken@1438
   685
    dnl Make sure we are running on an Tru64 UNIX
slouken@1438
   686
    case $ARCH in
slouken@1438
   687
        osf)
slouken@1438
   688
            ;;
slouken@1438
   689
        *)
slouken@1438
   690
            return
slouken@1438
   691
            ;;
slouken@1438
   692
    esac
slouken@1438
   693
    if test x$enable_audio = xyes; then
slouken@1438
   694
        AC_MSG_CHECKING(for MME audio support)
slouken@1438
   695
        MME_CFLAGS="-I/usr/include/mme"
slouken@1438
   696
        MME_LIBS="-lmme"
slouken@1438
   697
        have_mme=no
slouken@1438
   698
        save_CFLAGS="$CFLAGS"
slouken@1438
   699
        CFLAGS="$CFLAGS $MME_CFLAGS"
slouken@1438
   700
        AC_TRY_COMPILE([
slouken@1438
   701
          #include <mme_api.h>
slouken@1438
   702
        ],[
slouken@1438
   703
          HWAVEOUT sound;
slouken@1438
   704
        ],[
slouken@1438
   705
        have_mme=yes
slouken@1438
   706
        ])
slouken@1438
   707
        CFLAGS="$save_CFLAGS"
slouken@1438
   708
        AC_MSG_RESULT($have_mme)
slouken@1438
   709
        # Set up files for the audio library
slouken@1438
   710
        if test x$have_mme = xyes; then
slouken@1438
   711
            AC_DEFINE(SDL_AUDIO_DRIVER_MMEAUDIO)
slouken@1438
   712
            SOURCES="$SOURCES $srcdir/src/audio/mme/*.c"
slouken@1521
   713
            EXTRA_CFLAGS="$EXTRA_CFLAGS $MME_CFLAGS"
slouken@1521
   714
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MME_LIBS"
slouken@1438
   715
            have_audio=yes
slouken@1438
   716
        fi
slouken@1438
   717
    fi
slouken@1438
   718
}
slouken@1438
   719
slouken@0
   720
dnl Find the ESD includes and libraries
slouken@0
   721
CheckESD()
slouken@0
   722
{
slouken@0
   723
    AC_ARG_ENABLE(esd,
slouken@1637
   724
AC_HELP_STRING([--enable-esd], [support the Enlightened Sound Daemon [[default=yes]]]),
slouken@0
   725
                  , enable_esd=yes)
slouken@0
   726
    if test x$enable_audio = xyes -a x$enable_esd = xyes; then
slouken@948
   727
        AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no)
slouken@948
   728
        if test x$have_esd = xyes; then
slouken@294
   729
            AC_ARG_ENABLE(esd-shared,
slouken@1637
   730
AC_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [[default=yes]]]),
slouken@678
   731
                          , enable_esd_shared=yes)
slouken@3391
   732
            esd_lib=[`find_lib "libesd.so.*" "$ESD_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@1467
   733
slouken@1467
   734
            AC_DEFINE(SDL_AUDIO_DRIVER_ESD)
slouken@1467
   735
            SOURCES="$SOURCES $srcdir/src/audio/esd/*.c"
slouken@1521
   736
            EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS"
icculus@1173
   737
            if test x$have_loadso != xyes && \
slouken@296
   738
               test x$enable_esd_shared = xyes; then
slouken@1467
   739
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ESD loading])
slouken@296
   740
            fi
icculus@1173
   741
            if test x$have_loadso = xyes && \
slouken@294
   742
               test x$enable_esd_shared = xyes && test x$esd_lib != x; then
slouken@3392
   743
                echo "-- dynamic libesd -> $esd_lib"
slouken@1361
   744
                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ESD_DYNAMIC, "$esd_lib")
slouken@1467
   745
            else
slouken@1521
   746
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ESD_LIBS"
slouken@294
   747
            fi
slouken@1361
   748
            have_audio=yes
slouken@294
   749
        fi
slouken@0
   750
    fi
slouken@0
   751
}
slouken@0
   752
icculus@2271
   753
dnl Find PulseAudio
icculus@2271
   754
CheckPulseAudio()
icculus@2271
   755
{
icculus@2271
   756
    AC_ARG_ENABLE(pulseaudio,
icculus@2271
   757
AC_HELP_STRING([--enable-pulseaudio], [use PulseAudio [[default=yes]]]),
icculus@2271
   758
                  , enable_pulseaudio=yes)
icculus@2271
   759
    if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then
icculus@2271
   760
        audio_pulseaudio=no
icculus@2271
   761
icculus@2271
   762
        PULSEAUDIO_REQUIRED_VERSION=0.9
icculus@2271
   763
icculus@2271
   764
        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
icculus@2271
   765
        AC_MSG_CHECKING(for PulseAudio $PULSEAUDIO_REQUIRED_VERSION support)
icculus@2271
   766
        if test x$PKG_CONFIG != xno; then
icculus@2271
   767
        if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSEAUDIO_REQUIRED_VERSION libpulse-simple; then
icculus@2271
   768
                PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple`
icculus@2271
   769
                PULSEAUDIO_LIBS=`$PKG_CONFIG --libs libpulse-simple`
icculus@2271
   770
                audio_pulseaudio=yes
slouken@3391
   771
            fi
icculus@2271
   772
        fi
icculus@2271
   773
        AC_MSG_RESULT($audio_pulseaudio)
icculus@2271
   774
icculus@2271
   775
        if test x$audio_pulseaudio = xyes; then
icculus@2271
   776
            AC_ARG_ENABLE(pulseaudio-shared,
icculus@2271
   777
AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [[default=yes]]]),
icculus@2271
   778
                          , enable_pulseaudio_shared=yes)
slouken@3391
   779
            pulseaudio_lib=[`find_lib "libpulse-simple.so.*" "$PULSEAUDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
icculus@2271
   780
icculus@2271
   781
            AC_DEFINE(SDL_AUDIO_DRIVER_PULSEAUDIO)
icculus@2271
   782
            SOURCES="$SOURCES $srcdir/src/audio/pulseaudio/*.c"
icculus@2271
   783
            EXTRA_CFLAGS="$EXTRA_CFLAGS $PULSEAUDIO_CFLAGS"
icculus@2271
   784
            if test x$have_loadso != xyes && \
icculus@2271
   785
               test x$enable_pulseaudio_shared = xyes; then
icculus@2271
   786
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic PulseAudio loading])
icculus@2271
   787
            fi
icculus@2271
   788
            if test x$have_loadso = xyes && \
icculus@2271
   789
               test x$enable_pulseaudio_shared = xyes && test x$pulseaudio_lib != x; then
slouken@3392
   790
                echo "-- dynamic libpulse-simple -> $pulseaudio_lib"
icculus@2271
   791
                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC, "$pulseaudio_lib")
icculus@2271
   792
            else
icculus@2271
   793
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PULSEAUDIO_LIBS"
icculus@2271
   794
            fi
icculus@2271
   795
            have_audio=yes
icculus@2271
   796
        fi
icculus@2271
   797
    fi
icculus@2271
   798
}
icculus@2271
   799
slouken@0
   800
CheckARTSC()
slouken@0
   801
{
slouken@0
   802
    AC_ARG_ENABLE(arts,
slouken@1637
   803
AC_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [[default=yes]]]),
slouken@0
   804
                  , enable_arts=yes)
slouken@0
   805
    if test x$enable_audio = xyes -a x$enable_arts = xyes; then
slouken@1361
   806
        AC_PATH_PROG(ARTSCONFIG, artsc-config)
slouken@1361
   807
        if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then
slouken@0
   808
            : # arts isn't installed
slouken@0
   809
        else
slouken@1361
   810
            ARTS_CFLAGS=`$ARTSCONFIG --cflags`
slouken@1361
   811
            ARTS_LIBS=`$ARTSCONFIG --libs`
slouken@0
   812
            AC_MSG_CHECKING(for aRts development environment)
slouken@0
   813
            audio_arts=no
slouken@0
   814
            save_CFLAGS="$CFLAGS"
slouken@1361
   815
            CFLAGS="$CFLAGS $ARTS_CFLAGS"
slouken@0
   816
            AC_TRY_COMPILE([
slouken@0
   817
             #include <artsc.h>
slouken@0
   818
            ],[
slouken@0
   819
             arts_stream_t stream;
slouken@0
   820
            ],[
slouken@0
   821
            audio_arts=yes
slouken@0
   822
            ])
slouken@0
   823
            CFLAGS="$save_CFLAGS"
slouken@0
   824
            AC_MSG_RESULT($audio_arts)
slouken@0
   825
            if test x$audio_arts = xyes; then
slouken@294
   826
                AC_ARG_ENABLE(arts-shared,
slouken@1637
   827
AC_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [[default=yes]]]),
slouken@678
   828
                              , enable_arts_shared=yes)
slouken@3391
   829
                arts_lib=[`find_lib "libartsc.so.*" "$ARTS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@1467
   830
slouken@1467
   831
                AC_DEFINE(SDL_AUDIO_DRIVER_ARTS)
slouken@1467
   832
                SOURCES="$SOURCES $srcdir/src/audio/arts/*.c"
slouken@1521
   833
                EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS"
icculus@1173
   834
                if test x$have_loadso != xyes && \
slouken@296
   835
                   test x$enable_arts_shared = xyes; then
slouken@1467
   836
                    AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ARTS loading])
slouken@296
   837
                fi
icculus@1173
   838
                if test x$have_loadso = xyes && \
slouken@294
   839
                   test x$enable_arts_shared = xyes && test x$arts_lib != x; then
slouken@3392
   840
                    echo "-- dynamic libartsc -> $arts_lib"
slouken@1361
   841
                    AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ARTS_DYNAMIC, "$arts_lib")
slouken@1467
   842
                else
slouken@1521
   843
                    EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS"
slouken@294
   844
                fi
slouken@1361
   845
                have_audio=yes
slouken@0
   846
            fi
slouken@0
   847
        fi
slouken@0
   848
    fi
slouken@0
   849
}
slouken@0
   850
slouken@0
   851
dnl See if the NAS audio interface is supported
slouken@0
   852
CheckNAS()
slouken@0
   853
{
slouken@0
   854
    AC_ARG_ENABLE(nas,
slouken@1637
   855
AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]),
slouken@41
   856
                  , enable_nas=yes)
slouken@0
   857
    if test x$enable_audio = xyes -a x$enable_nas = xyes; then
icculus@2049
   858
        AC_CHECK_HEADER(audio/audiolib.h, have_nas_hdr=yes)
icculus@2049
   859
        AC_CHECK_LIB(audio, AuOpenServer, have_nas_lib=yes)
icculus@2049
   860
slouken@41
   861
        AC_MSG_CHECKING(for NAS audio support)
slouken@41
   862
        have_nas=no
icculus@2049
   863
icculus@2049
   864
        if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then
icculus@2049
   865
            have_nas=yes
icculus@2049
   866
            NAS_LIBS="-laudio"
icculus@2049
   867
icculus@2049
   868
        elif test -r /usr/X11R6/include/audio/audiolib.h; then
slouken@41
   869
            have_nas=yes
slouken@1361
   870
            NAS_CFLAGS="-I/usr/X11R6/include/"
slouken@1520
   871
            NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt"
slouken@605
   872
slouken@605
   873
        dnl On IRIX, the NAS includes are in a different directory,
slouken@605
   874
        dnl and libnas must be explicitly linked in
slouken@605
   875
slouken@605
   876
        elif test -r /usr/freeware/include/nas/audiolib.h; then
slouken@605
   877
            have_nas=yes
slouken@1361
   878
            NAS_LIBS="-lnas -lXt"
slouken@41
   879
        fi
icculus@2049
   880
slouken@605
   881
        AC_MSG_RESULT($have_nas)
icculus@2049
   882
slouken@1361
   883
        if test x$have_nas = xyes; then
icculus@2049
   884
            AC_ARG_ENABLE(nas-shared,
icculus@2049
   885
AC_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[default=yes]]]),
icculus@2049
   886
                          , enable_nas_shared=yes)
slouken@3391
   887
            nas_lib=[`find_lib "libaudio.so.*" "$NAS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
icculus@2049
   888
icculus@2049
   889
            if test x$have_loadso != xyes && \
icculus@2049
   890
               test x$enable_nas_shared = xyes; then
icculus@2049
   891
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic NAS loading])
icculus@2049
   892
            fi
icculus@2049
   893
            if test x$have_loadso = xyes && \
slouken@2163
   894
               test x$enable_nas_shared = xyes && test x$nas_lib != x; then
slouken@3392
   895
                echo "-- dynamic libaudio -> $nas_lib"
icculus@2049
   896
                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_NAS_DYNAMIC, "$nas_lib")
icculus@2049
   897
            else
icculus@2049
   898
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS"
icculus@2049
   899
            fi
icculus@2049
   900
slouken@1361
   901
            AC_DEFINE(SDL_AUDIO_DRIVER_NAS)
slouken@1361
   902
            SOURCES="$SOURCES $srcdir/src/audio/nas/*.c"
slouken@1521
   903
            EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS"
slouken@1361
   904
            have_audio=yes
slouken@1361
   905
        fi
slouken@0
   906
    fi
slouken@0
   907
}
slouken@0
   908
slouken@68
   909
dnl rcg07142001 See if the user wants the disk writer audio driver...
slouken@68
   910
CheckDiskAudio()
slouken@68
   911
{
slouken@68
   912
    AC_ARG_ENABLE(diskaudio,
slouken@1637
   913
AC_HELP_STRING([--enable-diskaudio], [support the disk writer audio driver [[default=yes]]]),
slouken@86
   914
                  , enable_diskaudio=yes)
slouken@68
   915
    if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
slouken@1361
   916
        AC_DEFINE(SDL_AUDIO_DRIVER_DISK)
slouken@1361
   917
        SOURCES="$SOURCES $srcdir/src/audio/disk/*.c"
slouken@68
   918
    fi
slouken@68
   919
}
slouken@68
   920
icculus@1532
   921
dnl rcg03142006 See if the user wants the dummy audio driver...
icculus@1532
   922
CheckDummyAudio()
icculus@1532
   923
{
icculus@1532
   924
    AC_ARG_ENABLE(dummyaudio,
slouken@1637
   925
AC_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [[default=yes]]]),
icculus@1532
   926
                  , enable_dummyaudio=yes)
icculus@1532
   927
    if test x$enable_audio = xyes -a x$enable_dummyaudio = xyes; then
icculus@1532
   928
        AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY)
icculus@1532
   929
        SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c"
icculus@1532
   930
    fi
icculus@1532
   931
}
icculus@1532
   932
icculus@1573
   933
dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
icculus@1573
   934
dnl  Details of this flag are here: http://gcc.gnu.org/wiki/Visibility
icculus@1573
   935
CheckVisibilityHidden()
icculus@1573
   936
{
icculus@1573
   937
    AC_MSG_CHECKING(for GCC -fvisibility=hidden option)
icculus@1573
   938
    have_gcc_fvisibility=no
icculus@1573
   939
icculus@1573
   940
    visibility_CFLAGS="-fvisibility=hidden"
icculus@1573
   941
    save_CFLAGS="$CFLAGS"
slouken@2292
   942
    CFLAGS="$save_CFLAGS $visibility_CFLAGS -Werror"
icculus@1573
   943
    AC_TRY_COMPILE([
slouken@1745
   944
    #if !defined(__GNUC__) || __GNUC__ < 4
slouken@1745
   945
    #error SDL only uses visibility attributes in GCC 4 or newer
slouken@1745
   946
    #endif
icculus@1573
   947
    ],[
icculus@1573
   948
    ],[
icculus@1573
   949
    have_gcc_fvisibility=yes
icculus@1573
   950
    ])
icculus@1573
   951
    AC_MSG_RESULT($have_gcc_fvisibility)
icculus@1573
   952
    CFLAGS="$save_CFLAGS"
icculus@1573
   953
icculus@1573
   954
    if test x$have_gcc_fvisibility = xyes; then
slouken@1574
   955
        EXTRA_CFLAGS="$EXTRA_CFLAGS $visibility_CFLAGS"
icculus@1573
   956
    fi
icculus@1573
   957
}
icculus@1573
   958
icculus@1573
   959
slouken@0
   960
dnl Find the X11 include and library directories
slouken@0
   961
CheckX11()
slouken@0
   962
{
jim@4681
   963
jim@4681
   964
slouken@0
   965
    AC_ARG_ENABLE(video-x11,
slouken@1637
   966
AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]),
slouken@0
   967
                  , enable_video_x11=yes)
slouken@0
   968
    if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
slouken@1806
   969
        case "$host" in
slouken@1807
   970
            *-*-darwin*)
slouken@1807
   971
                # This isn't necessary for X11, but fixes GLX detection
slouken@1808
   972
                if test "x$x_includes" = xNONE && test "x$x_libraries" = xNONE; then
slouken@1806
   973
                    x_includes="/usr/X11R6/include"
slouken@1806
   974
                    x_libraries="/usr/X11R6/lib"
slouken@1806
   975
                fi
slouken@1806
   976
                ;;
slouken@1806
   977
        esac
slouken@0
   978
        AC_PATH_X
slouken@0
   979
        AC_PATH_XTRA
slouken@0
   980
        if test x$have_x = xyes; then
slouken@1879
   981
            # Only allow dynamically loaded X11 if the X11 function pointers
slouken@1879
   982
            # will not end up in the global namespace, which causes problems
slouken@1879
   983
            # with other libraries calling X11 functions.
slouken@1879
   984
            x11_symbols_private=$have_gcc_fvisibility
slouken@1879
   985
icculus@1168
   986
            AC_ARG_ENABLE(x11-shared,
slouken@1879
   987
AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=maybe]]]),
slouken@1879
   988
                          , enable_x11_shared=maybe)
icculus@1168
   989
slouken@1550
   990
            case "$host" in
icculus@1589
   991
                *-*-darwin*) # Latest Mac OS X actually ships with Xrandr/Xrender libs...
slouken@1879
   992
                    x11_symbols_private=yes
icculus@1174
   993
                    x11_lib='/usr/X11R6/lib/libX11.6.dylib'
icculus@1174
   994
                    x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
slouken@1592
   995
                    xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
icculus@1589
   996
                    xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
icculus@2763
   997
                    xinput_lib='/usr/X11R6/lib/libXi.6.dylib'
slouken@3025
   998
                    xss_lib='/usr/X11R6/lib/libXss.6.dylib'
slouken@4626
   999
                    xdamage_lib='/usr/X11R6/lib/libXdamage.1.dylib'
slouken@4625
  1000
                    xfixes_lib='/usr/X11R6/lib/libXfixes.3.dylib'
icculus@1174
  1001
                    ;;
slouken@1384
  1002
                *-*-osf*)
slouken@1384
  1003
                    x11_lib='libX11.so'
slouken@1384
  1004
                    x11ext_lib='libXext.so'
slouken@1384
  1005
                    ;;
slouken@1384
  1006
                *-*-irix*) # IRIX 6.5 requires that we use /usr/lib32
icculus@1299
  1007
                    x11_lib='libX11.so'
icculus@1299
  1008
                    x11ext_lib='libXext.so'
icculus@1299
  1009
                    ;;
icculus@1174
  1010
                *)
slouken@3391
  1011
                    x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@3391
  1012
                    x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@3391
  1013
                    xrender_lib=[`find_lib "libXrender.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@3391
  1014
                    xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@3391
  1015
                    xinput_lib=[`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@3391
  1016
                    xss_lib=[`find_lib "libXss.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
sunnysachanandani@4604
  1017
                    xdamage_lib=[`find_lib "libXdamage.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
sunnysachanandani@4604
  1018
                    xfixes_lib=[`find_lib "libXfixes.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
icculus@1174
  1019
                    ;;
icculus@1174
  1020
            esac
icculus@1168
  1021
slouken@1361
  1022
            if test x$ac_cv_func_shmat != xyes; then
slouken@1361
  1023
                X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY"
slouken@1361
  1024
            fi
slouken@1799
  1025
            CFLAGS="$CFLAGS $X_CFLAGS"
slouken@1799
  1026
            LDFLAGS="$LDFLAGS $X_LIBS"
slouken@1468
  1027
slouken@1468
  1028
            AC_DEFINE(SDL_VIDEO_DRIVER_X11)
slouken@1468
  1029
            SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
slouken@1521
  1030
            EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
slouken@1879
  1031
slouken@1879
  1032
            if test x$enable_x11_shared = xmaybe; then
slouken@1879
  1033
                enable_x11_shared=$x11_symbols_private
slouken@1879
  1034
            fi
icculus@1173
  1035
            if test x$have_loadso != xyes && \
icculus@1168
  1036
               test x$enable_x11_shared = xyes; then
slouken@1467
  1037
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic X11 loading])
icculus@1875
  1038
                enable_x11_shared=no
icculus@1168
  1039
            fi
slouken@1879
  1040
            if test x$x11_symbols_private != xyes && \
icculus@1875
  1041
               test x$enable_x11_shared = xyes; then
icculus@1875
  1042
                AC_MSG_WARN([You must have gcc4 (-fvisibility=hidden) for dynamic X11 loading])
icculus@1875
  1043
                enable_x11_shared=no
icculus@1875
  1044
            fi
icculus@1875
  1045
icculus@1173
  1046
            if test x$have_loadso = xyes && \
icculus@1170
  1047
               test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then
icculus@1174
  1048
                echo "-- dynamic libX11 -> $x11_lib"
icculus@1174
  1049
                echo "-- dynamic libX11ext -> $x11ext_lib"
slouken@1361
  1050
                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib")
slouken@1361
  1051
                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib")
icculus@1168
  1052
            else
icculus@1589
  1053
                enable_x11_shared=no
icculus@2763
  1054
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
icculus@1168
  1055
            fi
slouken@1361
  1056
            have_video=yes
slouken@0
  1057
slouken@0
  1058
            AC_ARG_ENABLE(video-x11-vm,
slouken@1637
  1059
AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[default=yes]]]),
slouken@0
  1060
                          , enable_video_x11_vm=yes)
slouken@0
  1061
            if test x$enable_video_x11_vm = xyes; then
slouken@1361
  1062
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_VIDMODE)
slouken@1361
  1063
                SOURCES="$SOURCES $srcdir/src/video/Xext/Xxf86vm/*.c"
slouken@0
  1064
            fi
slouken@0
  1065
            AC_ARG_ENABLE(video-x11-xv,
slouken@1637
  1066
AC_HELP_STRING([--enable-video-x11-xv], [use X11 XvImage extension for video [[default=yes]]]),
slouken@0
  1067
                          , enable_video_x11_xv=yes)
slouken@0
  1068
            if test x$enable_video_x11_xv = xyes; then
slouken@1361
  1069
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XV)
slouken@1361
  1070
                SOURCES="$SOURCES $srcdir/src/video/Xext/Xv/*.c"
slouken@0
  1071
            fi
slouken@227
  1072
            AC_ARG_ENABLE(video-x11-xinerama,
slouken@1637
  1073
AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]),
slouken@227
  1074
                            , enable_video_x11_xinerama=yes)
slouken@227
  1075
            if test x$enable_video_x11_xinerama = xyes; then
slouken@1361
  1076
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA)
slouken@1361
  1077
                SOURCES="$SOURCES $srcdir/src/video/Xext/Xinerama/*.c"
slouken@227
  1078
            fi
icculus@4793
  1079
            AC_ARG_ENABLE(video-x11-xshape,
icculus@4793
  1080
AC_HELP_STRING([--enable-video-x11-xshape], [enable X11 XShape support [[default=yes]]]),
icculus@4793
  1081
                            , enable_video_x11_xshape=yes)
icculus@4793
  1082
            if test x$enable_video_x11_xshape = xyes; then
icculus@4793
  1083
                AC_CHECK_HEADER(X11/extensions/shape.h,
icculus@4793
  1084
                                have_shape_h_hdr=yes,
icculus@4793
  1085
                                have_shape_h_hdr=no,
icculus@4793
  1086
                                [#include <X11/Xlib.h>
icculus@4793
  1087
                                ])
icculus@4793
  1088
                if test x$have_shape_h_hdr = xyes; then
icculus@4793
  1089
                    AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSHAPE)
icculus@4793
  1090
                fi
icculus@4793
  1091
            fi
icculus@1589
  1092
            AC_ARG_ENABLE(video-x11-xrandr,
slouken@1637
  1093
AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]),
icculus@1589
  1094
                            , enable_video_x11_xrandr=yes)
icculus@1589
  1095
            if test x$enable_video_x11_xrandr = xyes; then
icculus@1589
  1096
                definitely_enable_video_x11_xrandr=no
icculus@1589
  1097
                AC_CHECK_HEADER(X11/extensions/Xrandr.h,
icculus@1589
  1098
                                have_xrandr_h_hdr=yes,
icculus@1589
  1099
                                have_xrandr_h_hdr=no,
icculus@1589
  1100
                                [#include <X11/Xlib.h>
icculus@1589
  1101
                                ])
icculus@1589
  1102
                if test x$have_xrandr_h_hdr = xyes; then
icculus@1589
  1103
                    if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then
icculus@1589
  1104
                        echo "-- dynamic libXrandr -> $xrandr_lib"
icculus@1589
  1105
                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib")
icculus@1589
  1106
                        definitely_enable_video_x11_xrandr=yes
icculus@1589
  1107
                    else
icculus@1589
  1108
                        AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes)
sunnysachanandani@4577
  1109
                        if test x$have_xrandr_lib = xyes ; then
sunnysachanandani@4577
  1110
                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr"
icculus@1589
  1111
                            definitely_enable_video_x11_xrandr=yes
icculus@1589
  1112
                        fi
icculus@1589
  1113
                    fi
icculus@1589
  1114
                fi
icculus@1589
  1115
            fi
icculus@1589
  1116
            if test x$definitely_enable_video_x11_xrandr = xyes; then
icculus@1589
  1117
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR)
icculus@1589
  1118
            fi
icculus@2763
  1119
            AC_ARG_ENABLE(video-x11-xinput,
icculus@2763
  1120
AC_HELP_STRING([--enable-video-x11-xinput], [enable X11 XInput extension for manymouse, tablets, etc [[default=yes]]]),
icculus@2763
  1121
                            , enable_video_x11_xinput=yes)
icculus@2763
  1122
            if test x$enable_video_x11_xinput = xyes; then
icculus@2763
  1123
                definitely_enable_video_x11_xinput=no
icculus@2763
  1124
                AC_CHECK_HEADER(X11/extensions/XInput.h,
icculus@2763
  1125
                                have_xinput_h_hdr=yes,
icculus@2763
  1126
                                have_xinput_h_hdr=no,
icculus@2763
  1127
                                [#include <X11/Xlib.h>
icculus@2763
  1128
                                ])
icculus@2763
  1129
                if test x$have_xinput_h_hdr = xyes; then
icculus@2763
  1130
                    if test x$enable_x11_shared = xyes && test x$xinput_lib != x ; then
icculus@2763
  1131
                        echo "-- dynamic libXi -> $xinput_lib"
icculus@2763
  1132
                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT, "$xinput_lib")
icculus@2763
  1133
                        definitely_enable_video_x11_xinput=yes
icculus@2763
  1134
                    else
icculus@2763
  1135
                        AC_CHECK_LIB(Xi, XOpenDevice, have_xinput_lib=yes)
icculus@2763
  1136
                        if test x$have_xinput_lib = xyes ; then
icculus@2763
  1137
                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXi"
icculus@2763
  1138
                            definitely_enable_video_x11_xinput=yes
icculus@2763
  1139
                        fi
icculus@2763
  1140
                    fi
icculus@2763
  1141
                fi
icculus@2763
  1142
            fi
icculus@2763
  1143
            if test x$definitely_enable_video_x11_xinput = xyes; then
icculus@2763
  1144
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT)
icculus@2763
  1145
            fi
slouken@3025
  1146
            AC_ARG_ENABLE(video-x11-scrnsaver,
slouken@3025
  1147
AC_HELP_STRING([--enable-video-x11-scrnsaver], [enable X11 screensaver extension [[default=yes]]]),
slouken@3025
  1148
                            , enable_video_x11_scrnsaver=yes)
slouken@3025
  1149
            if test x$enable_video_x11_scrnsaver = xyes; then
slouken@3025
  1150
                AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
slouken@3025
  1151
                                have_scrnsaver_h_hdr=yes,
slouken@3025
  1152
                                have_scrnsaver_h_hdr=no,
slouken@1783
  1153
                                [#include <X11/Xlib.h>
slouken@1783
  1154
                                ])
slouken@3025
  1155
                if test x$have_scrnsaver_h_hdr = xyes; then
slouken@3025
  1156
                    if test x$enable_x11_shared = xyes && test x$xss_lib != x ; then
slouken@3025
  1157
                        echo "-- dynamic libXss -> $xss_lib"
slouken@3025
  1158
                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS, "$xss_lib")
slouken@3025
  1159
                        definitely_enable_video_x11_scrnsaver=yes
slouken@3025
  1160
                    else
slouken@3025
  1161
                        AC_CHECK_LIB(Xss, XScreenSaverSuspend, have_xss_lib=yes)
slouken@3025
  1162
                        if test x$have_xss_lib = xyes ; then
slouken@3025
  1163
                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXss"
slouken@3025
  1164
                            definitely_enable_video_x11_scrnsaver=yes
slouken@3025
  1165
                        fi
slouken@3025
  1166
                    fi
slouken@1783
  1167
                fi
slouken@1783
  1168
            fi
slouken@3025
  1169
            if test x$definitely_enable_video_x11_scrnsaver = xyes; then
slouken@3025
  1170
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_SCRNSAVER)
slouken@3025
  1171
            fi
slouken@0
  1172
        fi
slouken@0
  1173
    fi
slouken@0
  1174
}
slouken@279
  1175
slouken@1361
  1176
dnl Set up the BWindow video driver if enabled
slouken@1361
  1177
CheckBWINDOW()
slouken@1361
  1178
{
slouken@1361
  1179
    if test x$enable_video = xyes; then
slouken@1361
  1180
        AC_DEFINE(SDL_VIDEO_DRIVER_BWINDOW)
slouken@1361
  1181
        SOURCES="$SOURCES $srcdir/src/video/bwindow/*.cc"
slouken@1361
  1182
        have_video=yes
slouken@1361
  1183
    fi
slouken@1361
  1184
}
slouken@1361
  1185
slouken@1931
  1186
dnl Set up the Cocoa video driver for Mac OS X (but not Darwin)
slouken@1361
  1187
CheckCOCOA()
slouken@1361
  1188
{
slouken@1361
  1189
    AC_ARG_ENABLE(video-cocoa,
slouken@1931
  1190
AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]),
slouken@1361
  1191
                  , enable_video_cocoa=yes)
slouken@1361
  1192
    if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
slouken@1361
  1193
        save_CFLAGS="$CFLAGS"
slouken@1361
  1194
        dnl work around that we don't have Objective-C support in autoconf
slouken@1361
  1195
        CFLAGS="$CFLAGS -x objective-c"
slouken@1361
  1196
        AC_MSG_CHECKING(for Cocoa framework)
slouken@1361
  1197
        have_cocoa=no
slouken@1361
  1198
        AC_TRY_COMPILE([
slouken@1361
  1199
          #import <Cocoa/Cocoa.h>
slouken@1361
  1200
        ],[
slouken@1361
  1201
        ],[
slouken@1361
  1202
        have_cocoa=yes
slouken@1361
  1203
        ])
slouken@1361
  1204
        AC_MSG_RESULT($have_cocoa)
slouken@1361
  1205
        CFLAGS="$save_CFLAGS"
slouken@1361
  1206
        if test x$have_cocoa = xyes; then
slouken@1931
  1207
            AC_DEFINE(SDL_VIDEO_DRIVER_COCOA)
slouken@1931
  1208
            SOURCES="$SOURCES $srcdir/src/video/cocoa/*.m"
slouken@1361
  1209
            have_video=yes
slouken@1361
  1210
        fi
slouken@1361
  1211
    fi
slouken@1361
  1212
}
slouken@1361
  1213
slouken@167
  1214
dnl Find DirectFB
slouken@167
  1215
CheckDirectFB()
slouken@167
  1216
{
slouken@167
  1217
    AC_ARG_ENABLE(video-directfb,
slouken@2314
  1218
AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=no]]]),
slouken@2314
  1219
                  , enable_video_directfb=no)
slouken@167
  1220
    if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
slouken@167
  1221
        video_directfb=no
slouken@167
  1222
slouken@2998
  1223
        DIRECTFB_REQUIRED_VERSION=1.0.0
slouken@5199
  1224
        AC_PATH_PROGS(DIRECTFBCONFIG, directfb-config, no, [$prefix/bin:$PATH])
slouken@1602
  1225
        if test x$DIRECTFBCONFIG = xno; then
slouken@1588
  1226
            AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
slouken@1602
  1227
            if test x$PKG_CONFIG != xno; then
slouken@1602
  1228
                if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb; then
slouken@1588
  1229
                    DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
slouken@1588
  1230
                    DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
slouken@2998
  1231
                    DIRECTFB_PREFIX=`$PKG_CONFIG --variable=prefix directfb`
slouken@1588
  1232
                    video_directfb=yes
slouken@1588
  1233
                fi
slouken@1588
  1234
            fi
slouken@167
  1235
        else
slouken@1588
  1236
            set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'`
slouken@1588
  1237
            NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
slouken@1588
  1238
            set -- `directfb-config --version | sed 's/\./ /g'`
slouken@1588
  1239
            HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
slouken@1588
  1240
            if test $HAVE_VERSION -ge $NEED_VERSION; then
slouken@1588
  1241
                DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags`
slouken@1588
  1242
                DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs`
slouken@2998
  1243
                DIRECTFB_PREFIX=`$DIRECTFBCONFIG --prefix`
slouken@167
  1244
                video_directfb=yes
slouken@167
  1245
            fi
slouken@167
  1246
        fi
slouken@3351
  1247
        if test x$video_directfb = xyes; then
slouken@3351
  1248
            # SuSE 11.1 installs directfb-config without directfb-devel
couriersud@3639
  1249
            save_CPPFLAGS="$CPPFLAGS"
couriersud@3639
  1250
            CPPFLAGS="$CPPFLAGS $DIRECTFB_CFLAGS"
slouken@3351
  1251
            AC_CHECK_HEADER(directfb.h, have_directfb_hdr=yes, have_directfb_hdr=no)
couriersud@3639
  1252
            CPPFLAGS="$save_CPPFLAGS"
slouken@3351
  1253
            video_directfb=$have_directfb_hdr
slouken@3351
  1254
        fi
slouken@3351
  1255
        AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support)
slouken@3351
  1256
        AC_MSG_RESULT($video_directfb)
slouken@167
  1257
slouken@167
  1258
        if test x$video_directfb = xyes; then
slouken@2998
  1259
            AC_ARG_ENABLE(directfb-shared,
slouken@2998
  1260
AC_HELP_STRING([--enable-directfb-shared], [dynamically load directfb support [[default=yes]]]),
slouken@2998
  1261
                              , enable_directfb_shared=yes)
slouken@2998
  1262
slouken@1361
  1263
            AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB)
slouken@5199
  1264
            AC_DEFINE(SDL_VIDEO_RENDER_DIRECTFB)
slouken@1361
  1265
            SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
slouken@1521
  1266
            EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"
slouken@2998
  1267
slouken@3392
  1268
            AC_MSG_CHECKING(for directfb dynamic loading support)
slouken@3392
  1269
            directfb_shared=no
slouken@5199
  1270
            directfb_lib=[`find_lib "libdirectfb.so.*" "$DIRECTFB_LIBS"`]
slouken@5199
  1271
            # | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@5199
  1272
AC_MSG_WARN("directfb $directfb_lib")
slouken@2998
  1273
            if test x$have_loadso != xyes && \
slouken@2998
  1274
               test x$enable_directfb_shared = xyes; then
slouken@2998
  1275
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic directfb loading])
slouken@2998
  1276
            fi
slouken@2998
  1277
            if test x$have_loadso = xyes && \
slouken@2998
  1278
               test x$enable_directfb_shared = xyes && test x$directfb_lib != x; then
slouken@3392
  1279
                directfb_shared=yes
slouken@3392
  1280
                echo "-- $directfb_lib_spec -> $directfb_lib"
slouken@2998
  1281
                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC, "$directfb_lib")
slouken@2998
  1282
            else
slouken@3392
  1283
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
slouken@2998
  1284
            fi
slouken@3392
  1285
            AC_MSG_RESULT($directfb_shared)
slouken@1361
  1286
            have_video=yes
slouken@167
  1287
        fi
slouken@167
  1288
    fi
slouken@167
  1289
}
slouken@167
  1290
slouken@2947
  1291
dnl Find FusionSound
slouken@2947
  1292
CheckFusionSound()
slouken@2947
  1293
{
slouken@2947
  1294
    AC_ARG_ENABLE(fusionsound,
slouken@2947
  1295
AC_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]),
slouken@2947
  1296
                  , enable_fusionsound=no)
slouken@2947
  1297
    if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then
slouken@2947
  1298
        fusionsound=no
slouken@2947
  1299
slouken@2947
  1300
        FUSIONSOUND_REQUIRED_VERSION=1.1.1
slouken@2947
  1301
slouken@2947
  1302
        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
slouken@2947
  1303
        AC_MSG_CHECKING(for FusionSound $FUSIONSOUND_REQUIRED_VERSION support)
slouken@2947
  1304
        if test x$PKG_CONFIG != xno; then
slouken@2947
  1305
            if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then
slouken@2947
  1306
                FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound`
slouken@2947
  1307
                FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound`
slouken@2947
  1308
                fusionsound=yes
slouken@2947
  1309
            fi
slouken@2947
  1310
        fi
slouken@2947
  1311
        AC_MSG_RESULT($fusionsound)
slouken@2947
  1312
slouken@2947
  1313
        if test x$fusionsound = xyes; then
slouken@2947
  1314
            AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND)
slouken@2947
  1315
            SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c"
slouken@2947
  1316
            EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS"
slouken@2947
  1317
            
slouken@2947
  1318
            AC_ARG_ENABLE(fusionsound-shared,
slouken@2947
  1319
AC_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]),
slouken@2947
  1320
                          , enable_fusionsound_shared=yes)
slouken@2947
  1321
            fusionsound_shared=no
slouken@3392
  1322
            AC_MSG_CHECKING(for FusionSound dynamic loading support)
slouken@2947
  1323
            if test x$have_loadso != xyes && \
slouken@2947
  1324
               test x$enable_fusionsound_shared = xyes; then
slouken@2947
  1325
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading])
slouken@2947
  1326
            fi
slouken@2947
  1327
            if test x$have_loadso = xyes && \
slouken@2947
  1328
               test x$enable_fusionsound_shared = xyes; then
slouken@2947
  1329
                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so")
slouken@3392
  1330
                fusionsound_shared=yes
slouken@2947
  1331
            else
slouken@3392
  1332
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS"
slouken@2947
  1333
            fi
slouken@3392
  1334
            AC_MSG_RESULT($fusionsound_shared)
slouken@2947
  1335
            
slouken@2947
  1336
            have_audio=yes
slouken@2947
  1337
        fi
slouken@2947
  1338
    fi
slouken@2947
  1339
}
slouken@2947
  1340
slouken@1
  1341
dnl rcg04172001 Set up the Null video driver.
slouken@1
  1342
CheckDummyVideo()
slouken@1
  1343
{
slouken@1
  1344
    AC_ARG_ENABLE(video-dummy,
slouken@1637
  1345
AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]),
slouken@86
  1346
                  , enable_video_dummy=yes)
slouken@1
  1347
    if test x$enable_video_dummy = xyes; then
slouken@1361
  1348
        AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY)
slouken@1361
  1349
        SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
slouken@1361
  1350
        have_video=yes
slouken@1
  1351
    fi
slouken@1
  1352
}
slouken@1
  1353
slouken@0
  1354
dnl Check to see if OpenGL support is desired
slouken@0
  1355
AC_ARG_ENABLE(video-opengl,
slouken@1952
  1356
AC_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]),
slouken@0
  1357
              , enable_video_opengl=yes)
slouken@0
  1358
slouken@0
  1359
dnl Find OpenGL
icculus@1191
  1360
CheckOpenGLX11()
slouken@0
  1361
{
slouken@0
  1362
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@0
  1363
        AC_MSG_CHECKING(for OpenGL (GLX) support)
slouken@0
  1364
        video_opengl=no
slouken@0
  1365
        AC_TRY_COMPILE([
slouken@0
  1366
         #include <GL/gl.h>
slouken@0
  1367
         #include <GL/glx.h>
slouken@0
  1368
        ],[
slouken@0
  1369
        ],[
slouken@0
  1370
        video_opengl=yes
slouken@0
  1371
        ])
slouken@0
  1372
        AC_MSG_RESULT($video_opengl)
slouken@0
  1373
        if test x$video_opengl = xyes; then
slouken@1361
  1374
            AC_DEFINE(SDL_VIDEO_OPENGL)
slouken@1361
  1375
            AC_DEFINE(SDL_VIDEO_OPENGL_GLX)
slouken@1952
  1376
            AC_DEFINE(SDL_VIDEO_RENDER_OGL)
slouken@0
  1377
        fi
slouken@0
  1378
    fi
slouken@0
  1379
}
slouken@0
  1380
slouken@5062
  1381
dnl Check for Windows OpenGL
slouken@5062
  1382
CheckWINDOWSGL()
slouken@1361
  1383
{
slouken@1361
  1384
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@1361
  1385
        AC_DEFINE(SDL_VIDEO_OPENGL)
slouken@1361
  1386
        AC_DEFINE(SDL_VIDEO_OPENGL_WGL)
slouken@1952
  1387
        AC_DEFINE(SDL_VIDEO_RENDER_OGL)
slouken@1361
  1388
    fi
slouken@1361
  1389
}
slouken@1361
  1390
slouken@0
  1391
dnl Check for BeOS OpenGL
slouken@0
  1392
CheckBeGL()
slouken@0
  1393
{
slouken@0
  1394
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@1361
  1395
        AC_DEFINE(SDL_VIDEO_OPENGL)
slouken@1952
  1396
        AC_DEFINE(SDL_VIDEO_OPENGL_BGL)
slouken@1952
  1397
        AC_DEFINE(SDL_VIDEO_RENDER_OGL)
slouken@1521
  1398
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
slouken@0
  1399
    fi
slouken@0
  1400
}
slouken@0
  1401
slouken@0
  1402
dnl Check for MacOS OpenGL
slouken@0
  1403
CheckMacGL()
slouken@0
  1404
{
slouken@0
  1405
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@1361
  1406
        AC_DEFINE(SDL_VIDEO_OPENGL)
slouken@1952
  1407
        AC_DEFINE(SDL_VIDEO_OPENGL_CGL)
slouken@1952
  1408
        AC_DEFINE(SDL_VIDEO_RENDER_OGL)
slouken@1550
  1409
        case "$host" in
slouken@0
  1410
            *-*-darwin*)
slouken@1625
  1411
                if test x$enable_video_cocoa = xyes; then
icculus@3623
  1412
                    EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGL"
slouken@1625
  1413
                fi
slouken@0
  1414
        esac
slouken@0
  1415
    fi
slouken@0
  1416
}
slouken@0
  1417
slouken@0
  1418
dnl See if we can use the new unified event interface in Linux 2.4
slouken@0
  1419
CheckInputEvents()
slouken@0
  1420
{
slouken@0
  1421
    dnl Check for Linux 2.4 unified input event interface support
slouken@0
  1422
    AC_ARG_ENABLE(input-events,
slouken@1637
  1423
AC_HELP_STRING([--enable-input-events], [use Linux 2.4 unified input interface [[default=yes]]]),
slouken@211
  1424
                  , enable_input_events=yes)
slouken@0
  1425
    if test x$enable_input_events = xyes; then
slouken@0
  1426
        AC_MSG_CHECKING(for Linux 2.4 unified input interface)
slouken@0
  1427
        use_input_events=no
slouken@0
  1428
        AC_TRY_COMPILE([
slouken@0
  1429
          #include <linux/input.h>
slouken@0
  1430
        ],[
slouken@0
  1431
          #ifndef EVIOCGNAME
slouken@0
  1432
          #error EVIOCGNAME() ioctl not available
slouken@0
  1433
          #endif
slouken@0
  1434
        ],[
slouken@0
  1435
        use_input_events=yes
slouken@0
  1436
        ])
slouken@0
  1437
        AC_MSG_RESULT($use_input_events)
slouken@0
  1438
        if test x$use_input_events = xyes; then
slouken@1361
  1439
            AC_DEFINE(SDL_INPUT_LINUXEV)
slouken@0
  1440
        fi
slouken@0
  1441
    fi
slouken@0
  1442
}
slouken@0
  1443
icculus@1201
  1444
dnl See if we can use the Touchscreen input library
icculus@1201
  1445
CheckTslib()
icculus@1201
  1446
{
icculus@1201
  1447
    AC_ARG_ENABLE(input-tslib,
slouken@1637
  1448
AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]),
icculus@1201
  1449
                  , enable_input_tslib=yes)
icculus@1201
  1450
    if test x$enable_input_tslib = xyes; then
icculus@1201
  1451
        AC_MSG_CHECKING(for Touchscreen library support)
icculus@1201
  1452
        enable_input_tslib=no
icculus@1201
  1453
        AC_TRY_COMPILE([
icculus@1201
  1454
          #include "tslib.h"
icculus@1201
  1455
        ],[
icculus@1201
  1456
        ],[
icculus@1201
  1457
        enable_input_tslib=yes
icculus@1201
  1458
        ])
icculus@1201
  1459
        AC_MSG_RESULT($enable_input_tslib)
icculus@1201
  1460
        if test x$enable_input_tslib = xyes; then
slouken@1361
  1461
            AC_DEFINE(SDL_INPUT_TSLIB)
slouken@1521
  1462
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
icculus@1201
  1463
        fi
icculus@1201
  1464
    fi
icculus@1201
  1465
}
icculus@1201
  1466
slouken@0
  1467
dnl See what type of thread model to use on Linux and Solaris
slouken@0
  1468
CheckPTHREAD()
slouken@0
  1469
{
slouken@0
  1470
    dnl Check for pthread support
slouken@0
  1471
    AC_ARG_ENABLE(pthreads,
slouken@1637
  1472
AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]),
slouken@0
  1473
                  , enable_pthreads=yes)
slouken@0
  1474
    dnl This is used on Linux for glibc binary compatibility (Doh!)
slouken@0
  1475
    AC_ARG_ENABLE(pthread-sem,
slouken@1637
  1476
AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
slouken@0
  1477
                  , enable_pthread_sem=yes)
slouken@1550
  1478
    case "$host" in
slouken@1820
  1479
        *-*-linux*|*-*-uclinux*)
slouken@1361
  1480
            pthread_cflags="-D_REENTRANT"
slouken@1324
  1481
            pthread_lib="-lpthread"
slouken@1324
  1482
            ;;
slouken@0
  1483
        *-*-bsdi*)
slouken@0
  1484
            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
slouken@0
  1485
            pthread_lib=""
slouken@0
  1486
            ;;
slouken@0
  1487
        *-*-darwin*)
slouken@0
  1488
            pthread_cflags="-D_THREAD_SAFE"
slouken@0
  1489
# causes Carbon.p complaints?
slouken@0
  1490
#            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
slouken@0
  1491
            ;;
slouken@1565
  1492
        *-*-freebsd*|*-*-dragonfly*)
slouken@0
  1493
            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
slouken@0
  1494
            pthread_lib="-pthread"
slouken@0
  1495
            ;;
slouken@43
  1496
        *-*-netbsd*)
slouken@1383
  1497
            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
slouken@2158
  1498
            pthread_lib="-lpthread"
slouken@43
  1499
            ;;
slouken@0
  1500
        *-*-openbsd*)
slouken@0
  1501
            pthread_cflags="-D_REENTRANT"
slouken@0
  1502
            pthread_lib="-pthread"
slouken@0
  1503
            ;;
slouken@0
  1504
        *-*-solaris*)
slouken@0
  1505
            pthread_cflags="-D_REENTRANT"
slouken@0
  1506
            pthread_lib="-lpthread -lposix4"
slouken@0
  1507
            ;;
slouken@0
  1508
        *-*-sysv5*)
slouken@0
  1509
            pthread_cflags="-D_REENTRANT -Kthread"
slouken@0
  1510
            pthread_lib=""
slouken@0
  1511
            ;;
slouken@0
  1512
        *-*-irix*)
slouken@0
  1513
            pthread_cflags="-D_SGI_MP_SOURCE"
slouken@0
  1514
            pthread_lib="-lpthread"
slouken@0
  1515
            ;;
slouken@0
  1516
        *-*-aix*)
slouken@0
  1517
            pthread_cflags="-D_REENTRANT -mthreads"
slouken@0
  1518
            pthread_lib="-lpthread"
slouken@0
  1519
            ;;
icculus@425
  1520
        *-*-hpux11*)
icculus@425
  1521
            pthread_cflags="-D_REENTRANT"
icculus@425
  1522
            pthread_lib="-L/usr/lib -lpthread"
icculus@425
  1523
            ;;
slouken@873
  1524
        *-*-osf*)
slouken@1019
  1525
            pthread_cflags="-D_REENTRANT"
slouken@873
  1526
            if test x$ac_cv_prog_gcc = xyes; then
slouken@873
  1527
                pthread_lib="-lpthread -lrt"
slouken@873
  1528
            else
slouken@1019
  1529
                pthread_lib="-lpthread -lexc -lrt"
slouken@873
  1530
            fi
slouken@873
  1531
            ;;
slouken@0
  1532
        *)
slouken@0
  1533
            pthread_cflags="-D_REENTRANT"
slouken@0
  1534
            pthread_lib="-lpthread"
slouken@0
  1535
            ;;
slouken@0
  1536
    esac
slouken@3268
  1537
    if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
slouken@415
  1538
        # Save the original compiler flags and libraries
slouken@415
  1539
        ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
slouken@415
  1540
        # Add the pthread compiler flags and libraries
slouken@415
  1541
        CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
slouken@415
  1542
        # Check to see if we have pthread support on this system
slouken@0
  1543
        AC_MSG_CHECKING(for pthreads)
slouken@0
  1544
        use_pthreads=no
slouken@0
  1545
        AC_TRY_LINK([
slouken@0
  1546
         #include <pthread.h>
slouken@0
  1547
        ],[
slouken@0
  1548
         pthread_attr_t type;
slouken@0
  1549
         pthread_attr_init(&type);
slouken@0
  1550
        ],[
slouken@0
  1551
        use_pthreads=yes
slouken@0
  1552
        ])
slouken@0
  1553
        AC_MSG_RESULT($use_pthreads)
slouken@415
  1554
        # Restore the compiler flags and libraries
slouken@415
  1555
        CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
slouken@1361
  1556
slouken@415
  1557
        # Do futher testing if we have pthread support...
slouken@0
  1558
        if test x$use_pthreads = xyes; then
slouken@1361
  1559
            AC_DEFINE(SDL_THREAD_PTHREAD)
slouken@1521
  1560
            EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
slouken@1521
  1561
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
slouken@0
  1562
            SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
slouken@0
  1563
            SDL_LIBS="$SDL_LIBS $pthread_lib"
slouken@0
  1564
slouken@1438
  1565
            # Save the original compiler flags and libraries
slouken@1438
  1566
            ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
slouken@1438
  1567
            # Add the pthread compiler flags and libraries
slouken@1438
  1568
            CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
slouken@1438
  1569
slouken@0
  1570
            # Check to see if recursive mutexes are available
slouken@0
  1571
            AC_MSG_CHECKING(for recursive mutexes)
slouken@0
  1572
            has_recursive_mutexes=no
slouken@1324
  1573
            if test x$has_recursive_mutexes = xno; then
slouken@1324
  1574
                AC_TRY_COMPILE([
slouken@1324
  1575
                  #include <pthread.h>
slouken@1324
  1576
                ],[
slouken@1324
  1577
                  pthread_mutexattr_t attr;
slouken@1324
  1578
                  pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
slouken@1324
  1579
                ],[
slouken@1324
  1580
                has_recursive_mutexes=yes
slouken@1361
  1581
                AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX)
slouken@1324
  1582
                ])
slouken@1324
  1583
            fi
slouken@1324
  1584
            if test x$has_recursive_mutexes = xno; then
slouken@1324
  1585
                AC_TRY_COMPILE([
slouken@1324
  1586
                  #include <pthread.h>
slouken@1324
  1587
                ],[
slouken@1324
  1588
                  pthread_mutexattr_t attr;
slouken@1324
  1589
                  pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
slouken@1324
  1590
                ],[
slouken@1324
  1591
                has_recursive_mutexes=yes
slouken@1361
  1592
                AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP)
slouken@1324
  1593
                ])
slouken@1324
  1594
            fi
slouken@0
  1595
            AC_MSG_RESULT($has_recursive_mutexes)
slouken@0
  1596
slouken@94
  1597
            # Check to see if pthread semaphore support is missing
slouken@94
  1598
            if test x$enable_pthread_sem = xyes; then
slouken@94
  1599
                AC_MSG_CHECKING(for pthread semaphores)
slouken@94
  1600
                have_pthread_sem=no
slouken@94
  1601
                AC_TRY_COMPILE([
slouken@94
  1602
                  #include <pthread.h>
slouken@94
  1603
                  #include <semaphore.h>
slouken@94
  1604
                ],[
slouken@94
  1605
                ],[
slouken@94
  1606
                have_pthread_sem=yes
slouken@94
  1607
                ])
slouken@94
  1608
                AC_MSG_RESULT($have_pthread_sem)
slouken@94
  1609
            fi
slouken@94
  1610
slouken@1438
  1611
            # Restore the compiler flags and libraries
slouken@1438
  1612
            CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
slouken@1438
  1613
slouken@1361
  1614
            # Basic thread creation functions
slouken@1361
  1615
            SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
slouken@0
  1616
slouken@1361
  1617
            # Semaphores
slouken@1361
  1618
            # We can fake these with mutexes and condition variables if necessary
slouken@1361
  1619
            if test x$have_pthread_sem = xyes; then
slouken@1361
  1620
                SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
slouken@1361
  1621
            else
slouken@1361
  1622
                SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
slouken@1361
  1623
            fi
slouken@0
  1624
slouken@1361
  1625
            # Mutexes
slouken@1361
  1626
            # We can fake these with semaphores if necessary
slouken@1361
  1627
            SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
slouken@0
  1628
slouken@1361
  1629
            # Condition variables
slouken@1361
  1630
            # We can fake these with semaphores and mutexes if necessary
slouken@1361
  1631
            SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
slouken@399
  1632
slouken@1361
  1633
            have_threads=yes
slouken@814
  1634
        fi
slouken@814
  1635
    fi
slouken@814
  1636
}
slouken@814
  1637
slouken@5062
  1638
dnl Determine whether the compiler can produce Windows executables
slouken@5062
  1639
CheckWINDOWS()
slouken@0
  1640
{
slouken@5062
  1641
    AC_MSG_CHECKING(Windows compiler)
slouken@0
  1642
    have_win32_gcc=no
slouken@0
  1643
    AC_TRY_COMPILE([
slouken@0
  1644
     #include <windows.h>
slouken@0
  1645
    ],[
slouken@0
  1646
    ],[
slouken@0
  1647
    have_win32_gcc=yes
slouken@0
  1648
    ])
slouken@0
  1649
    AC_MSG_RESULT($have_win32_gcc)
slouken@0
  1650
    if test x$have_win32_gcc != xyes; then
slouken@0
  1651
       AC_MSG_ERROR([
slouken@5062
  1652
*** Your compiler ($CC) does not produce Windows executables!
slouken@0
  1653
       ])
slouken@0
  1654
    fi
slouken@0
  1655
slouken@3168
  1656
    AC_MSG_CHECKING(Windows CE)
slouken@3168
  1657
    have_wince=no
slouken@3168
  1658
    AC_TRY_COMPILE([
slouken@4569
  1659
#if !defined(_WIN32_WCE) && !defined(__MINGW32CE__)
slouken@3168
  1660
#error This is not Windows CE
slouken@3168
  1661
#endif
slouken@3168
  1662
    ],[
slouken@3168
  1663
    ],[
slouken@3168
  1664
    have_wince=yes
slouken@3168
  1665
    ])
slouken@3168
  1666
    AC_MSG_RESULT($have_wince)
slouken@0
  1667
}
slouken@0
  1668
slouken@0
  1669
dnl Find the DirectX includes and libraries
slouken@0
  1670
CheckDIRECTX()
slouken@0
  1671
{
slouken@0
  1672
    AC_ARG_ENABLE(directx,
slouken@5062
  1673
AC_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[default=yes]]]),
slouken@0
  1674
                  , enable_directx=yes)
slouken@0
  1675
    if test x$enable_directx = xyes; then
slouken@1895
  1676
        AC_CHECK_HEADER(d3d9.h, have_d3d=yes)
slouken@3168
  1677
        AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
slouken@1361
  1678
        AC_CHECK_HEADER(dsound.h, have_dsound=yes)
slouken@2714
  1679
        AC_CHECK_HEADER(dinput.h, have_dinput=yes)
slouken@0
  1680
    fi
slouken@158
  1681
}
slouken@158
  1682
slouken@294
  1683
dnl Check for the dlfcn.h interface for dynamically loading objects
slouken@294
  1684
CheckDLOPEN()
slouken@294
  1685
{
slouken@731
  1686
    AC_ARG_ENABLE(sdl-dlopen,
slouken@1637
  1687
AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]),
slouken@731
  1688
                  , enable_sdl_dlopen=yes)
slouken@731
  1689
    if test x$enable_sdl_dlopen = xyes; then
slouken@294
  1690
        AC_MSG_CHECKING(for dlopen)
slouken@1361
  1691
        have_dlopen=no
slouken@294
  1692
        AC_TRY_COMPILE([
slouken@294
  1693
         #include <dlfcn.h>
slouken@294
  1694
        ],[
slouken@1638
  1695
         #if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED <= 1020
slouken@1638
  1696
         #error Use dlcompat for Mac OS X 10.2 compatibility
slouken@1638
  1697
         #endif
slouken@294
  1698
        ],[
slouken@1361
  1699
        have_dlopen=yes
slouken@294
  1700
        ])
slouken@1361
  1701
        AC_MSG_RESULT($have_dlopen)
slouken@294
  1702
slouken@1361
  1703
        if test x$have_dlopen = xyes; then
slouken@1521
  1704
            AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
slouken@1521
  1705
               AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
slouken@1521
  1706
                  AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
slouken@1361
  1707
            AC_DEFINE(SDL_LOADSO_DLOPEN)
slouken@1361
  1708
            SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
slouken@1361
  1709
            have_loadso=yes
slouken@294
  1710
        fi
slouken@294
  1711
    fi
slouken@294
  1712
}
slouken@294
  1713
slouken@381
  1714
dnl Check for the usbhid(3) library on *BSD
slouken@381
  1715
CheckUSBHID()
slouken@381
  1716
{
slouken@381
  1717
    if test x$enable_joystick = xyes; then
slouken@1565
  1718
        AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
slouken@1565
  1719
        if test x$have_libusbhid = xyes; then
slouken@1565
  1720
            AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
slouken@1565
  1721
            AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
slouken@1565
  1722
            USB_LIBS="$USB_LIBS -lusbhid"
slouken@1565
  1723
        else
slouken@1565
  1724
            AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
slouken@1565
  1725
            AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
slouken@1565
  1726
            AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
slouken@1565
  1727
        fi
slouken@1361
  1728
            
slouken@1361
  1729
        save_CFLAGS="$CFLAGS"
slouken@1361
  1730
        CFLAGS="$CFLAGS $USB_CFLAGS"
slouken@381
  1731
slouken@381
  1732
        AC_MSG_CHECKING(for usbhid)
slouken@381
  1733
        have_usbhid=no
slouken@381
  1734
        AC_TRY_COMPILE([
slouken@404
  1735
          #include <sys/types.h>
slouken@403
  1736
          #if defined(HAVE_USB_H)
slouken@403
  1737
          #include <usb.h>
slouken@403
  1738
          #endif
slouken@1565
  1739
          #ifdef __DragonFly__
slouken@1565
  1740
          # include <bus/usb/usb.h>
slouken@1565
  1741
          # include <bus/usb/usbhid.h>
slouken@1565
  1742
          #else
slouken@1565
  1743
          # include <dev/usb/usb.h>
slouken@1565
  1744
          # include <dev/usb/usbhid.h>
slouken@1565
  1745
          #endif
slouken@381
  1746
          #if defined(HAVE_USBHID_H)
slouken@381
  1747
          #include <usbhid.h>
slouken@381
  1748
          #elif defined(HAVE_LIBUSB_H)
slouken@381
  1749
          #include <libusb.h>
slouken@381
  1750
          #elif defined(HAVE_LIBUSBHID_H)
slouken@381
  1751
          #include <libusbhid.h>
slouken@404
  1752
          #endif
slouken@381
  1753
        ],[
slouken@381
  1754
          struct report_desc *repdesc;
slouken@381
  1755
          struct usb_ctl_report *repbuf;
slouken@402
  1756
          hid_kind_t hidkind;
slouken@381
  1757
        ],[
slouken@381
  1758
        have_usbhid=yes
slouken@381
  1759
        ])
slouken@381
  1760
        AC_MSG_RESULT($have_usbhid)
slouken@381
  1761
slouken@381
  1762
        if test x$have_usbhid = xyes; then
slouken@381
  1763
            AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
slouken@381
  1764
            have_usbhid_ucr_data=no
slouken@381
  1765
            AC_TRY_COMPILE([
slouken@404
  1766
              #include <sys/types.h>
slouken@404
  1767
              #if defined(HAVE_USB_H)
slouken@404
  1768
              #include <usb.h>
slouken@404
  1769
              #endif
slouken@1565
  1770
              #ifdef __DragonFly__
slouken@1565
  1771
              # include <bus/usb/usb.h>
slouken@1565
  1772
              # include <bus/usb/usbhid.h>
slouken@1565
  1773
              #else
slouken@1565
  1774
              # include <dev/usb/usb.h>
slouken@1565
  1775
              # include <dev/usb/usbhid.h>
slouken@1565
  1776
              #endif
slouken@381
  1777
              #if defined(HAVE_USBHID_H)
slouken@381
  1778
              #include <usbhid.h>
slouken@381
  1779
              #elif defined(HAVE_LIBUSB_H)
slouken@381
  1780
              #include <libusb.h>
slouken@381
  1781
              #elif defined(HAVE_LIBUSBHID_H)
slouken@381
  1782
              #include <libusbhid.h>
slouken@381
  1783
              #endif
slouken@381
  1784
            ],[
slouken@381
  1785
              struct usb_ctl_report buf;
slouken@381
  1786
              if (buf.ucr_data) { }
slouken@381
  1787
            ],[
slouken@381
  1788
            have_usbhid_ucr_data=yes
slouken@381
  1789
            ])
slouken@381
  1790
            if test x$have_usbhid_ucr_data = xyes; then
slouken@1361
  1791
                USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
slouken@381
  1792
            fi
slouken@381
  1793
            AC_MSG_RESULT($have_usbhid_ucr_data)
slouken@407
  1794
            
slouken@1361
  1795
            AC_MSG_CHECKING(for new usbhid API)
slouken@407
  1796
            have_usbhid_new=no
slouken@407
  1797
            AC_TRY_COMPILE([
slouken@407
  1798
              #include <sys/types.h>
slouken@407
  1799
              #if defined(HAVE_USB_H)
slouken@407
  1800
              #include <usb.h>
slouken@407
  1801
              #endif
slouken@3392
  1802
              #ifdef __DragonFly__
slouken@2158
  1803
              #include <bus/usb/usb.h>
slouken@2158
  1804
              #include <bus/usb/usbhid.h>
slouken@3392
  1805
              #else
slouken@407
  1806
              #include <dev/usb/usb.h>
slouken@407
  1807
              #include <dev/usb/usbhid.h>
slouken@3392
  1808
              #endif
slouken@407
  1809
              #if defined(HAVE_USBHID_H)
slouken@407
  1810
              #include <usbhid.h>
slouken@407
  1811
              #elif defined(HAVE_LIBUSB_H)
slouken@407
  1812
              #include <libusb.h>
slouken@407
  1813
              #elif defined(HAVE_LIBUSBHID_H)
slouken@407
  1814
              #include <libusbhid.h>
slouken@407
  1815
              #endif
slouken@407
  1816
            ],[
slouken@407
  1817
              report_desc_t d;
slouken@1361
  1818
              hid_start_parse(d, 1, 1);
slouken@407
  1819
            ],[
slouken@407
  1820
            have_usbhid_new=yes
slouken@407
  1821
            ])
slouken@407
  1822
            if test x$have_usbhid_new = xyes; then
slouken@1361
  1823
                USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
slouken@407
  1824
            fi
slouken@407
  1825
            AC_MSG_RESULT($have_usbhid_new)
slouken@381
  1826
slouken@1565
  1827
            AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
slouken@1565
  1828
            have_machine_joystick=no
slouken@1565
  1829
            AC_TRY_COMPILE([
slouken@1565
  1830
              #include <machine/joystick.h>
slouken@1565
  1831
            ],[
slouken@1565
  1832
              struct joystick t;
slouken@1565
  1833
            ],[
slouken@1565
  1834
            have_machine_joystick=yes
slouken@1565
  1835
            ])
slouken@1565
  1836
            if test x$have_machine_joystick = xyes; then
slouken@1565
  1837
                AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H)
slouken@1565
  1838
            fi
slouken@1565
  1839
            AC_MSG_RESULT($have_machine_joystick)
slouken@1565
  1840
slouken@1361
  1841
            AC_DEFINE(SDL_JOYSTICK_USBHID)
slouken@1361
  1842
            SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
slouken@1521
  1843
            EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
slouken@1521
  1844
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
slouken@1361
  1845
            have_joystick=yes
slouken@381
  1846
        fi
slouken@1361
  1847
        CFLAGS="$save_CFLAGS"
slouken@381
  1848
    fi
slouken@381
  1849
}
slouken@381
  1850
slouken@1361
  1851
dnl Check for clock_gettime()
slouken@1361
  1852
CheckClockGettime()
slouken@795
  1853
{
slouken@1361
  1854
    AC_ARG_ENABLE(clock_gettime,
slouken@1637
  1855
AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=no]]]),
slouken@1361
  1856
                  , enable_clock_gettime=no)
slouken@1361
  1857
    if test x$enable_clock_gettime = xyes; then
slouken@1361
  1858
        AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
slouken@1361
  1859
        if test x$have_clock_gettime = xyes; then
slouken@1361
  1860
            AC_DEFINE(HAVE_CLOCK_GETTIME)
slouken@1521
  1861
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
slouken@3087
  1862
        else
slouken@3087
  1863
            AC_CHECK_LIB(c, clock_gettime, have_clock_gettime=yes)
slouken@3087
  1864
            if test x$have_clock_gettime = xyes; then
slouken@3087
  1865
               AC_DEFINE(HAVE_CLOCK_GETTIME)
slouken@3087
  1866
               EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
slouken@3087
  1867
            fi
icculus@1175
  1868
        fi
slouken@795
  1869
    fi
slouken@795
  1870
}
slouken@795
  1871
slouken@1062
  1872
dnl Check for a valid linux/version.h
slouken@1062
  1873
CheckLinuxVersion()
slouken@1062
  1874
{
slouken@1062
  1875
    AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
slouken@1062
  1876
    if test x$have_linux_version_h = xyes; then
slouken@1521
  1877
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
slouken@1062
  1878
    fi
slouken@1062
  1879
}
slouken@1062
  1880
slouken@1127
  1881
dnl Check if we want to use RPATH
slouken@1127
  1882
CheckRPATH()
slouken@1127
  1883
{
slouken@1127
  1884
    AC_ARG_ENABLE(rpath,
slouken@1637
  1885
AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]),
slouken@1127
  1886
                  , enable_rpath=yes)
slouken@1127
  1887
}
slouken@1127
  1888
slouken@1550
  1889
dnl Set up the configuration based on the host platform!
slouken@1550
  1890
case "$host" in
slouken@2775
  1891
    *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-irix*|*-*-aix*|*-*-osf*|*-*-minix*)
slouken@1550
  1892
        case "$host" in
slouken@1361
  1893
            *-*-linux*)         ARCH=linux ;;
slouken@1820
  1894
            *-*-uclinux*)       ARCH=linux ;;
slouken@1361
  1895
            *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
slouken@1361
  1896
            *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
slouken@1361
  1897
            *-*-kopenbsd*-gnu)  ARCH=kopenbsd-gnu ;;
slouken@1361
  1898
            *-*-gnu*)           ARCH=gnu ;; # must be last of the gnu variants
slouken@1361
  1899
            *-*-bsdi*)          ARCH=bsdi ;;
slouken@1361
  1900
            *-*-freebsd*)       ARCH=freebsd ;;
slouken@1565
  1901
            *-*-dragonfly*)     ARCH=freebsd ;;
slouken@1361
  1902
            *-*-netbsd*)        ARCH=netbsd ;;
slouken@1361
  1903
            *-*-openbsd*)       ARCH=openbsd ;;
slouken@1361
  1904
            *-*-sysv5*)         ARCH=sysv5 ;;
slouken@1361
  1905
            *-*-solaris*)       ARCH=solaris ;;
slouken@1361
  1906
            *-*-hpux*)          ARCH=hpux ;;
slouken@1361
  1907
            *-*-irix*)          ARCH=irix ;;
slouken@1361
  1908
            *-*-aix*)           ARCH=aix ;;
slouken@1361
  1909
            *-*-osf*)           ARCH=osf ;;
slouken@2775
  1910
            *-*-minix*)         ARCH=minix ;;
slouken@795
  1911
        esac
icculus@1573
  1912
        CheckVisibilityHidden
slouken@1
  1913
        CheckDummyVideo
slouken@68
  1914
        CheckDiskAudio
icculus@1532
  1915
        CheckDummyAudio
slouken@371
  1916
        CheckDLOPEN
slouken@0
  1917
        CheckOSS
slouken@1361
  1918
        CheckDMEDIA
slouken@1438
  1919
        CheckMME
slouken@0
  1920
        CheckALSA
icculus@2271
  1921
        CheckPulseAudio
slouken@0
  1922
        CheckARTSC
slouken@0
  1923
        CheckESD
slouken@0
  1924
        CheckNAS
slouken@0
  1925
        CheckX11
slouken@167
  1926
        CheckDirectFB
slouken@2947
  1927
        CheckFusionSound
icculus@1191
  1928
        CheckOpenGLX11
slouken@0
  1929
        CheckInputEvents
icculus@1201
  1930
        CheckTslib
slouken@1361
  1931
        CheckUSBHID
slouken@0
  1932
        CheckPTHREAD
slouken@1361
  1933
        CheckClockGettime
slouken@1062
  1934
        CheckLinuxVersion
slouken@1127
  1935
        CheckRPATH
slouken@1361
  1936
        # Set up files for the audio library
slouken@1361
  1937
        if test x$enable_audio = xyes; then
slouken@1361
  1938
          case $ARCH in
slouken@1565
  1939
            sysv5|solaris|hpux)
slouken@1361
  1940
                AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
slouken@1361
  1941
                SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
slouken@1361
  1942
                have_audio=yes
slouken@1361
  1943
            ;;
slouken@1565
  1944
            netbsd|openbsd)
slouken@1567
  1945
                AC_DEFINE(SDL_AUDIO_DRIVER_BSD)
slouken@1567
  1946
                SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c"
slouken@1361
  1947
                have_audio=yes
slouken@1361
  1948
            ;;
slouken@1361
  1949
            aix)
icculus@2049
  1950
                AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO)
slouken@1361
  1951
                SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
slouken@1361
  1952
                have_audio=yes
slouken@1361
  1953
            ;;
slouken@1361
  1954
          esac
slouken@371
  1955
        fi
slouken@0
  1956
        # Set up files for the joystick library
slouken@0
  1957
        if test x$enable_joystick = xyes; then
slouken@1361
  1958
          case $ARCH in
slouken@1361
  1959
            linux)
slouken@1361
  1960
                AC_DEFINE(SDL_JOYSTICK_LINUX)
slouken@1361
  1961
                SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
slouken@1361
  1962
                have_joystick=yes
slouken@1361
  1963
            ;;
slouken@1361
  1964
          esac
slouken@0
  1965
        fi
slouken@2713
  1966
        # Set up files for the haptic library
slouken@2713
  1967
        if test x$enable_haptic = xyes; then
slouken@2713
  1968
           if test x$use_input_events = xyes; then
slouken@2713
  1969
             case $ARCH in
slouken@2713
  1970
               linux)
slouken@2713
  1971
                   AC_DEFINE(SDL_HAPTIC_LINUX)
slouken@2713
  1972
                   SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c"
slouken@2713
  1973
                   have_haptic=yes
slouken@2713
  1974
               ;;
slouken@2713
  1975
             esac
slouken@2713
  1976
           fi
slouken@2713
  1977
        fi
icculus@3170
  1978
        # Set up files for the power library
icculus@3170
  1979
        if test x$enable_power = xyes; then
icculus@3170
  1980
             case $ARCH in
icculus@3170
  1981
               linux)
icculus@3170
  1982
                   AC_DEFINE(SDL_POWER_LINUX)
icculus@3170
  1983
                   SOURCES="$SOURCES $srcdir/src/power/linux/*.c"
icculus@3170
  1984
                   have_power=yes
icculus@3170
  1985
               ;;
icculus@3170
  1986
             esac
icculus@3170
  1987
        fi
slouken@0
  1988
        # Set up files for the thread library
slouken@1361
  1989
        if test x$enable_threads = xyes -a x$use_pthreads != xyes -a x$use_pth != xyes -a x$ARCH = xirix; then
slouken@1361
  1990
            AC_DEFINE(SDL_THREAD_SPROC)
slouken@1361
  1991
            SOURCES="$SOURCES $srcdir/src/thread/irix/*.c"
slouken@1361
  1992
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
slouken@1361
  1993
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
slouken@1361
  1994
            have_threads=yes
slouken@0
  1995
        fi
slouken@0
  1996
        # Set up files for the timer library
slouken@0
  1997
        if test x$enable_timers = xyes; then
slouken@1361
  1998
            AC_DEFINE(SDL_TIMER_UNIX)
slouken@1361
  1999
            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
slouken@1361
  2000
            have_timers=yes
slouken@0
  2001
        fi
slouken@0
  2002
        ;;
slouken@3097
  2003
    *-wince* | *-mingw32ce)
slouken@3097
  2004
        ARCH=win32
slouken@3097
  2005
        CheckDummyVideo
slouken@3097
  2006
        CheckDiskAudio
slouken@3097
  2007
        CheckDummyAudio
slouken@5062
  2008
        CheckWINDOWS
slouken@3097
  2009
        if test x$enable_video = xyes; then
slouken@5062
  2010
            AC_DEFINE(SDL_VIDEO_DRIVER_WINDOWS)
slouken@5062
  2011
            SOURCES="$SOURCES $srcdir/src/video/windows/*.c"
slouken@3097
  2012
            have_video=yes
slouken@3097
  2013
            AC_ARG_ENABLE(render-d3d,
slouken@3097
  2014
AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
slouken@3097
  2015
                                , enable_render_d3d=yes)
slouken@3097
  2016
            enable_render_d3d=no
slouken@3097
  2017
            if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
slouken@3097
  2018
                AC_DEFINE(SDL_VIDEO_RENDER_D3D)
slouken@3097
  2019
            fi
slouken@3097
  2020
        fi
slouken@3097
  2021
        # Set up files for the audio library
slouken@3097
  2022
        if test x$enable_audio = xyes; then
slouken@3097
  2023
            AC_DEFINE(SDL_AUDIO_DRIVER_WINWAVEOUT)
slouken@3097
  2024
            SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
slouken@3097
  2025
            if test x$have_dsound = xyes; then
slouken@3097
  2026
                AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
slouken@3097
  2027
                SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
slouken@3097
  2028
            fi
slouken@3097
  2029
            have_audio=yes
slouken@3097
  2030
        fi
slouken@4569
  2031
        # Set up dummy files for the joystick for now
slouken@4569
  2032
        if test x$enable_joystick = xyes; then
slouken@4569
  2033
            AC_DEFINE(SDL_JOYSTICK_DUMMY)
slouken@4569
  2034
            SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
slouken@4569
  2035
            have_joystick=yes
slouken@4569
  2036
        fi
slouken@3097
  2037
        # Set up files for the thread library
slouken@3097
  2038
        if test x$enable_threads = xyes; then
slouken@5062
  2039
            AC_DEFINE(SDL_THREAD_WINDOWS)
slouken@5062
  2040
            SOURCES="$SOURCES $srcdir/src/thread/windows/SDL_sysmutex.c"
slouken@5062
  2041
            SOURCES="$SOURCES $srcdir/src/thread/windows/SDL_syssem.c"
slouken@5062
  2042
            SOURCES="$SOURCES $srcdir/src/thread/windows/SDL_systhread.c"
slouken@3097
  2043
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
slouken@3097
  2044
            have_threads=yes
slouken@3097
  2045
        fi
slouken@3097
  2046
        # Set up files for the timer library
slouken@3097
  2047
        if test x$enable_timers = xyes; then
slouken@3097
  2048
            AC_DEFINE(SDL_TIMER_WINCE)
slouken@3097
  2049
            SOURCES="$SOURCES $srcdir/src/timer/wince/*.c"
slouken@3097
  2050
            have_timers=yes
slouken@3097
  2051
        fi
slouken@3097
  2052
        # Set up files for the shared object loading library
slouken@3097
  2053
        if test x$enable_loadso = xyes; then
slouken@5062
  2054
            AC_DEFINE(SDL_LOADSO_WINDOWS)
slouken@5062
  2055
            SOURCES="$SOURCES $srcdir/src/loadso/windows/*.c"
slouken@3097
  2056
            have_loadso=yes
slouken@3097
  2057
        fi
slouken@3097
  2058
        # Set up the system libraries we need
slouken@3097
  2059
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lcoredll -lcommctrl -lmmtimer"
slouken@4569
  2060
slouken@4569
  2061
	# mingw32ce library
slouken@4569
  2062
	case "$host" in
slouken@4569
  2063
    	    *-mingw32ce)
slouken@4569
  2064
    		EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmingwex"
slouken@4569
  2065
    		;;
slouken@4569
  2066
    	    *)
slouken@4569
  2067
        	;;
slouken@4569
  2068
	esac
slouken@4569
  2069
slouken@5062
  2070
        # The Windows platform requires special setup
slouken@5062
  2071
        SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c"
slouken@4569
  2072
        EXTRA_CFLAGS="$EXTRA_CFLAGS -Dmain=SDL_main -D_WIN32_WCE=0x420"
slouken@4569
  2073
        EXTRA_LDFLAGS="-lSDLmain $EXTRA_LDFLAGS"
slouken@3097
  2074
        ;;
slouken@0
  2075
    *-*-cygwin* | *-*-mingw32*)
slouken@0
  2076
        ARCH=win32
slouken@1550
  2077
        if test "$build" != "$host"; then # cross-compiling
slouken@0
  2078
            # Default cross-compile location
slouken@4476
  2079
            ac_default_prefix=/usr/local/cross-tools/$host
slouken@0
  2080
        else
slouken@0
  2081
            # Look for the location of the tools and install there
slouken@750
  2082
            if test "$BUILD_PREFIX" != ""; then
slouken@1
  2083
                ac_default_prefix=$BUILD_PREFIX
slouken@1
  2084
            fi
slouken@0
  2085
        fi
slouken@1
  2086
        CheckDummyVideo
slouken@68
  2087
        CheckDiskAudio
icculus@1532
  2088
        CheckDummyAudio
slouken@5062
  2089
        CheckWINDOWS
slouken@5062
  2090
        CheckWINDOWSGL
slouken@0
  2091
        CheckDIRECTX
slouken@5093
  2092
slouken@5093
  2093
        # Set up the core platform files
slouken@5093
  2094
        SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
slouken@5093
  2095
slouken@1895
  2096
        # Set up files for the video library
slouken@1895
  2097
        if test x$enable_video = xyes; then
slouken@5062
  2098
            AC_DEFINE(SDL_VIDEO_DRIVER_WINDOWS)
slouken@5062
  2099
            SOURCES="$SOURCES $srcdir/src/video/windows/*.c"
slouken@1895
  2100
            have_video=yes
slouken@1895
  2101
            AC_ARG_ENABLE(render-d3d,
slouken@1895
  2102
AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
slouken@1895
  2103
                                , enable_render_d3d=yes)
slouken@1895
  2104
            if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
slouken@1895
  2105
                AC_DEFINE(SDL_VIDEO_RENDER_D3D)
slouken@1895
  2106
            fi
slouken@1895
  2107
        fi
slouken@0
  2108
        # Set up files for the audio library
slouken@0
  2109
        if test x$enable_audio = xyes; then
icculus@2070
  2110
            AC_DEFINE(SDL_AUDIO_DRIVER_WINWAVEOUT)
slouken@1361
  2111
            SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
slouken@1895
  2112
            if test x$have_dsound = xyes; then
slouken@1361
  2113
                AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
slouken@1361
  2114
                SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
slouken@0
  2115
            fi
slouken@1361
  2116
            have_audio=yes
slouken@0
  2117
        fi
slouken@0
  2118
        # Set up files for the joystick library
slouken@0
  2119
        if test x$enable_joystick = xyes; then
slouken@1895
  2120
            if test x$have_dinput = xyes; then
slouken@1895
  2121
                AC_DEFINE(SDL_JOYSTICK_DINPUT)
slouken@5062
  2122
                SOURCES="$SOURCES $srcdir/src/joystick/windows/SDL_dxjoystick.c"
slouken@4894
  2123
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8"
slouken@1895
  2124
            else
slouken@1895
  2125
                AC_DEFINE(SDL_JOYSTICK_WINMM)
slouken@5062
  2126
                SOURCES="$SOURCES $srcdir/src/joystick/windows/SDL_mmjoystick.c"
slouken@1895
  2127
            fi
slouken@1361
  2128
            have_joystick=yes
slouken@0
  2129
        fi
slouken@2713
  2130
        if test x$enable_haptic = xyes; then
slouken@2713
  2131
            if test x$have_dinput = xyes; then
slouken@2713
  2132
                AC_DEFINE(SDL_HAPTIC_DINPUT)
slouken@5062
  2133
                SOURCES="$SOURCES $srcdir/src/haptic/windows/SDL_syshaptic.c"
slouken@2713
  2134
                have_haptic=yes
slouken@2713
  2135
            fi
slouken@2713
  2136
        fi
icculus@3170
  2137
        if test x$enable_power = xyes; then
icculus@3170
  2138
            AC_DEFINE(SDL_POWER_WINDOWS)
icculus@3170
  2139
            SOURCES="$SOURCES $srcdir/src/power/windows/SDL_syspower.c"
icculus@3170
  2140
            have_power=yes
icculus@3170
  2141
        fi
slouken@0
  2142
        # Set up files for the thread library
slouken@0
  2143
        if test x$enable_threads = xyes; then
slouken@5062
  2144
            AC_DEFINE(SDL_THREAD_WINDOWS)
slouken@5062
  2145
            SOURCES="$SOURCES $srcdir/src/thread/windows/SDL_sysmutex.c"
slouken@5062
  2146
            SOURCES="$SOURCES $srcdir/src/thread/windows/SDL_syssem.c"
slouken@5062
  2147
            SOURCES="$SOURCES $srcdir/src/thread/windows/SDL_systhread.c"
slouken@1361
  2148
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
slouken@1361
  2149
            have_threads=yes
slouken@0
  2150
        fi
slouken@0
  2151
        # Set up files for the timer library
slouken@0
  2152
        if test x$enable_timers = xyes; then
slouken@5062
  2153
            AC_DEFINE(SDL_TIMER_WINDOWS)
slouken@5062
  2154
            SOURCES="$SOURCES $srcdir/src/timer/windows/*.c"
slouken@1361
  2155
            have_timers=yes
slouken@1361
  2156
        fi
slouken@1361
  2157
        # Set up files for the shared object loading library
slouken@1361
  2158
        if test x$enable_loadso = xyes; then
slouken@5062
  2159
            AC_DEFINE(SDL_LOADSO_WINDOWS)
slouken@5062
  2160
            SOURCES="$SOURCES $srcdir/src/loadso/windows/*.c"
slouken@1361
  2161
            have_loadso=yes
slouken@1361
  2162
        fi
slouken@1361
  2163
        # Set up the system libraries we need
slouken@3082
  2164
        # SDL 1.3 is unicode, and unicows emulates this on Windows 98/ME
slouken@3082
  2165
        # You can get this here: http://libunicows.sourceforge.net/
slouken@3082
  2166
        #EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lunicows"
slouken@4894
  2167
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lmsimg32 -lwinmm -limm32 -lole32 -loleaut32 -lversion -luuid"
slouken@5062
  2168
        # The Windows platform requires special setup
slouken@5062
  2169
        VERSION_SOURCES="$srcdir/src/main/windows/*.rc"
slouken@5062
  2170
        SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c"
slouken@0
  2171
        SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
slouken@1363
  2172
        SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
slouken@0
  2173
        ;;
slouken@3292
  2174
    *-*-beos* | *-*-haiku*)
slouken@0
  2175
        ARCH=beos
slouken@0
  2176
        ac_default_prefix=/boot/develop/tools/gnupro
slouken@1
  2177
        CheckDummyVideo
slouken@68
  2178
        CheckDiskAudio
icculus@1532
  2179
        CheckDummyAudio
slouken@0
  2180
        CheckBWINDOW
slouken@0
  2181
        CheckBeGL
slouken@0
  2182
        # Set up files for the audio library
slouken@0
  2183
        if test x$enable_audio = xyes; then
icculus@2049
  2184
            AC_DEFINE(SDL_AUDIO_DRIVER_BEOSAUDIO)
slouken@1361
  2185
            SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc"
slouken@1361
  2186
            have_audio=yes
slouken@0
  2187
        fi
slouken@0
  2188
        # Set up files for the joystick library
slouken@0
  2189
        if test x$enable_joystick = xyes; then
slouken@1361
  2190
            AC_DEFINE(SDL_JOYSTICK_BEOS)
slouken@1361
  2191
            SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc"
slouken@1361
  2192
            have_joystick=yes
slouken@0
  2193
        fi
slouken@0
  2194
        # Set up files for the thread library
slouken@0
  2195
        if test x$enable_threads = xyes; then
slouken@1361
  2196
            AC_DEFINE(SDL_THREAD_BEOS)
slouken@1361
  2197
            SOURCES="$SOURCES $srcdir/src/thread/beos/*.c"
slouken@1361
  2198
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
slouken@1361
  2199
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
slouken@1361
  2200
            have_threads=yes
slouken@0
  2201
        fi
slouken@0
  2202
        # Set up files for the timer library
slouken@0
  2203
        if test x$enable_timers = xyes; then
slouken@1361
  2204
            AC_DEFINE(SDL_TIMER_BEOS)
slouken@1361
  2205
            SOURCES="$SOURCES $srcdir/src/timer/beos/*.c"
slouken@1361
  2206
            have_timers=yes
slouken@1361
  2207
        fi
slouken@1361
  2208
        # Set up files for the shared object loading library
slouken@1361
  2209
        if test x$enable_loadso = xyes; then
slouken@1361
  2210
            AC_DEFINE(SDL_LOADSO_BEOS)
slouken@1361
  2211
            SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
slouken@1361
  2212
            have_loadso=yes
slouken@0
  2213
        fi
icculus@3173
  2214
        # Set up files for the system power library
icculus@3173
  2215
        if test x$enable_power = xyes; then
icculus@3173
  2216
            AC_DEFINE(SDL_POWER_BEOS)
icculus@3173
  2217
            SOURCES="$SOURCES $srcdir/src/power/beos/*.c"
icculus@3173
  2218
            have_power=yes
icculus@3173
  2219
        fi
slouken@1367
  2220
        # The BeOS platform requires special setup.
slouken@1367
  2221
        SOURCES="$srcdir/src/main/beos/*.cc $SOURCES"
slouken@1521
  2222
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
slouken@0
  2223
        ;;
slouken@0
  2224
    *-*-darwin* )
icculus@1133
  2225
        # This could be either full "Mac OS X", or plain "Darwin" which is
slouken@158
  2226
        # just the OS X kernel sans upper layers like Carbon and Cocoa.
icculus@1133
  2227
        # Next line is broken, and a few files below require Mac OS X (full)
slouken@158
  2228
        ARCH=macosx
slouken@1624
  2229
slouken@1628
  2230
        # Mac OS X builds with both the Carbon and OSX APIs at the moment
slouken@1638
  2231
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
slouken@1638
  2232
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
slouken@1628
  2233
slouken@1742
  2234
        CheckVisibilityHidden
slouken@1
  2235
        CheckDummyVideo
slouken@68
  2236
        CheckDiskAudio
icculus@1532
  2237
        CheckDummyAudio
slouken@1638
  2238
        CheckDLOPEN
slouken@1889
  2239
slouken@1648
  2240
        # Set up files for the shared object loading library
slouken@1648
  2241
        # (this needs to be done before the dynamic X11 check)
slouken@1648
  2242
        if test x$enable_loadso = xyes -a x$have_dlopen != xyes; then
slouken@1648
  2243
            AC_DEFINE(SDL_LOADSO_DLCOMPAT)
slouken@1648
  2244
            SOURCES="$SOURCES $srcdir/src/loadso/macosx/*.c"
slouken@1648
  2245
            have_loadso=yes
slouken@1648
  2246
        fi
slouken@1648
  2247
icculus@1133
  2248
        CheckCOCOA
icculus@1174
  2249
        CheckX11
slouken@0
  2250
        CheckMacGL
icculus@1191
  2251
        CheckOpenGLX11
slouken@0
  2252
        CheckPTHREAD
icculus@1445
  2253
slouken@2238
  2254
        # Good optimization on Mac OS X, yes...
slouken@2238
  2255
        EXTRA_CFLAGS="$EXTRA_CFLAGS -falign-loops=16"
slouken@2238
  2256
icculus@1445
  2257
        # Need this or things might misbuild on a G3.
slouken@1521
  2258
        EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"
icculus@1445
  2259
slouken@0
  2260
        # Set up files for the audio library
slouken@0
  2261
        if test x$enable_audio = xyes; then
slouken@1361
  2262
            AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO)
slouken@1361
  2263
            SOURCES="$SOURCES $srcdir/src/audio/macosx/*.c"
slouken@1361
  2264
            have_audio=yes
slouken@0
  2265
        fi
slouken@0
  2266
        # Set up files for the joystick library
slouken@0
  2267
        if test x$enable_joystick = xyes; then
slouken@1361
  2268
            AC_DEFINE(SDL_JOYSTICK_IOKIT)
slouken@1361
  2269
            SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
slouken@1361
  2270
            have_joystick=yes
slouken@0
  2271
        fi
slouken@2713
  2272
        # Set up files for the haptic library
slouken@2713
  2273
        if test x$enable_haptic = xyes; then
slouken@2713
  2274
            AC_DEFINE(SDL_HAPTIC_IOKIT)
slouken@2713
  2275
            SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
slouken@2713
  2276
            have_haptic=yes
icculus@3623
  2277
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
slouken@2713
  2278
        fi
icculus@3170
  2279
        # Set up files for the power library
icculus@3170
  2280
        if test x$enable_power = xyes; then
icculus@3170
  2281
            AC_DEFINE(SDL_POWER_MACOSX)
icculus@3170
  2282
            SOURCES="$SOURCES $srcdir/src/power/macosx/*.c"
icculus@3170
  2283
            have_power=yes
icculus@3170
  2284
        fi
slouken@0
  2285
        # Set up files for the timer library
slouken@0
  2286
        if test x$enable_timers = xyes; then
slouken@1361
  2287
            AC_DEFINE(SDL_TIMER_UNIX)
slouken@1361
  2288
            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
slouken@1361
  2289
            have_timers=yes
slouken@1361
  2290
        fi
slouken@4454
  2291
        # Set up additional files for the file library
slouken@4454
  2292
        if test x$enable_file = xyes; then
slouken@4454
  2293
            SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
slouken@4454
  2294
        fi
slouken@1621
  2295
        # The Mac OS X platform requires special setup.
slouken@1521
  2296
        EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
slouken@3049
  2297
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc"
icculus@3623
  2298
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
icculus@3623
  2299
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
icculus@3623
  2300
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
slouken@3621
  2301
        # If audio is used, add the AudioUnit framework
slouken@3243
  2302
        if test x$enable_audio = xyes; then
icculus@3623
  2303
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit"
slouken@1361
  2304
        fi
slouken@0
  2305
        ;;
slouken@0
  2306
    *)
slouken@1361
  2307
        AC_MSG_ERROR([
slouken@1550
  2308
*** Unsupported host:  Please add to configure.in
slouken@1361
  2309
        ])
slouken@0
  2310
        ;;
slouken@0
  2311
esac
slouken@0
  2312
slouken@1361
  2313
# Verify that we have all the platform specific files we need
icculus@2066
  2314
slouken@3104
  2315
if test x$have_joystick != xyes; then
slouken@3104
  2316
    if test x$enable_joystick = xyes; then
slouken@3097
  2317
        AC_DEFINE(SDL_JOYSTICK_DISABLED)
slouken@3097
  2318
    fi
slouken@1361
  2319
    SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
slouken@1361
  2320
fi
slouken@2713
  2321
if test x$have_haptic != xyes; then
slouken@2713
  2322
    if test x$enable_haptic = xyes; then
slouken@2713
  2323
        AC_DEFINE(SDL_HAPTIC_DISABLED)
slouken@2713
  2324
    fi
slouken@2713
  2325
    SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
slouken@2713
  2326
fi
slouken@1361
  2327
if test x$have_threads != xyes; then
slouken@1361
  2328
    if test x$enable_threads = xyes; then
slouken@1361
  2329
        AC_DEFINE(SDL_THREADS_DISABLED)
slouken@1361
  2330
    fi
slouken@1361
  2331
    SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
slouken@1361
  2332
fi
slouken@1361
  2333
if test x$have_timers != xyes; then
slouken@1361
  2334
    if test x$enable_timers = xyes; then
slouken@1361
  2335
        AC_DEFINE(SDL_TIMERS_DISABLED)
slouken@1361
  2336
    fi
slouken@1361
  2337
    SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
slouken@1361
  2338
fi
slouken@1361
  2339
if test x$have_loadso != xyes; then
slouken@1361
  2340
    if test x$enable_loadso = xyes; then
slouken@1361
  2341
        AC_DEFINE(SDL_LOADSO_DISABLED)
slouken@1361
  2342
    fi
slouken@1361
  2343
    SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
slouken@1361
  2344
fi
slouken@1397
  2345
if test x$SDLMAIN_SOURCES = x; then
slouken@1397
  2346
    SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
slouken@1397
  2347
fi
slouken@0
  2348
slouken@3334
  2349
OBJECTS=`echo $SOURCES`
slouken@5112
  2350
DEPENDS=`echo $SOURCES | tr ' ' '\n'`
slouken@3334
  2351
for EXT in asm cc m c S; do
slouken@3334
  2352
    OBJECTS=`echo "$OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.'$EXT',$(objects)/\1.lo,g'`
slouken@5112
  2353
    DEPENDS=`echo "$DEPENDS" | sed "s,^\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.$EXT\\$,\\\\
slouken@3415
  2354
\\$(objects)/\\2.lo: \\1/\\2.$EXT\\\\
slouken@3415
  2355
	\\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
slouken@3334
  2356
done
slouken@0
  2357
slouken@3334
  2358
VERSION_OBJECTS=`echo $VERSION_SOURCES`
slouken@3334
  2359
VERSION_DEPENDS=`echo $VERSION_SOURCES`
slouken@3334
  2360
VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
slouken@3415
  2361
VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.rc,\\\\
slouken@3415
  2362
\\$(objects)/\\2.o: \\1/\\2.rc\\\\
slouken@3415
  2363
	\\$(WINDRES) \\$< \\$@,g"`
slouken@3334
  2364
slouken@3334
  2365
SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES`
slouken@3334
  2366
SDLMAIN_DEPENDS=`echo $SDLMAIN_SOURCES`
slouken@3334
  2367
SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
slouken@3415
  2368
SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
slouken@3415
  2369
\\$(objects)/\\2.o: \\1/\\2.c\\\\
slouken@3415
  2370
	\\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
slouken@1397
  2371
slouken@0
  2372
# Set runtime shared library paths as needed
slouken@0
  2373
slouken@1127
  2374
if test "x$enable_rpath" = "xyes"; then
slouken@1565
  2375
  if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = irix -o $ARCH = linux -o $ARCH = netbsd; then
slouken@2040
  2376
    SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
slouken@1127
  2377
  fi
slouken@1127
  2378
  if test $ARCH = solaris; then
slouken@2040
  2379
    SDL_RLD_FLAGS="-R\${libdir}"
slouken@1127
  2380
  fi
slouken@1127
  2381
else
slouken@1127
  2382
  SDL_RLD_FLAGS=""
slouken@0
  2383
fi
slouken@387
  2384
slouken@387
  2385
case "$ARCH" in
slouken@387
  2386
  macosx)
slouken@807
  2387
    # Evil hack to allow static linking on Mac OS X
slouken@2040
  2388
    SDL_STATIC_LIBS="\${libdir}/libSDL.a $EXTRA_LDFLAGS"
slouken@807
  2389
    ;;
slouken@807
  2390
  *)
slouken@2293
  2391
    SDL_STATIC_LIBS="$SDL_LIBS $EXTRA_LDFLAGS"
slouken@807
  2392
    ;;
slouken@807
  2393
esac
slouken@807
  2394
slouken@0
  2395
dnl Expand the cflags and libraries needed by apps using SDL
slouken@0
  2396
AC_SUBST(SDL_CFLAGS)
slouken@0
  2397
AC_SUBST(SDL_LIBS)
slouken@807
  2398
AC_SUBST(SDL_STATIC_LIBS)
slouken@0
  2399
AC_SUBST(SDL_RLD_FLAGS)
slouken@1361
  2400
if test x$enable_shared = xyes; then
slouken@1361
  2401
    ENABLE_SHARED_TRUE=
slouken@1361
  2402
    ENABLE_SHARED_FALSE="#"
slouken@1361
  2403
else
slouken@1361
  2404
    ENABLE_SHARED_TRUE="#"
slouken@1361
  2405
    ENABLE_SHARED_FALSE=
slouken@1361
  2406
fi
slouken@1361
  2407
if test x$enable_static = xyes; then
slouken@1361
  2408
    ENABLE_STATIC_TRUE=
slouken@1361
  2409
    ENABLE_STATIC_FALSE="#"
slouken@1361
  2410
else
slouken@1361
  2411
    ENABLE_STATIC_TRUE="#"
slouken@1361
  2412
    ENABLE_STATIC_FALSE=
slouken@1361
  2413
fi
slouken@1361
  2414
AC_SUBST(ENABLE_SHARED_TRUE)
slouken@1361
  2415
AC_SUBST(ENABLE_SHARED_FALSE)
slouken@1361
  2416
AC_SUBST(ENABLE_STATIC_TRUE)
slouken@1361
  2417
AC_SUBST(ENABLE_STATIC_FALSE)
slouken@0
  2418
slouken@1361
  2419
dnl Expand the sources and objects needed to build the library
slouken@1361
  2420
AC_SUBST(ac_aux_dir)
slouken@1361
  2421
AC_SUBST(INCLUDE)
slouken@1361
  2422
AC_SUBST(OBJECTS)
slouken@3334
  2423
AC_SUBST(VERSION_OBJECTS)
slouken@1397
  2424
AC_SUBST(SDLMAIN_OBJECTS)
slouken@1361
  2425
AC_SUBST(BUILD_CFLAGS)
slouken@1521
  2426
AC_SUBST(EXTRA_CFLAGS)
slouken@1393
  2427
AC_SUBST(BUILD_LDFLAGS)
slouken@1521
  2428
AC_SUBST(EXTRA_LDFLAGS)
slouken@2204
  2429
AC_SUBST(WINDRES)
slouken@0
  2430
slouken@5345
  2431
cat >Makefile.rules <<__EOF__
slouken@5066
  2432
slouken@5066
  2433
# Build rules for objects
slouken@5066
  2434
-include \$(OBJECTS:.lo=.d)
slouken@5345
  2435
slouken@5345
  2436
# Special dependency for SDL.c, since it depends on SDL_revision.h
slouken@5345
  2437
$srcdir/src/SDL.c: update-revision
slouken@5066
  2438
$DEPENDS
slouken@5066
  2439
$VERSION_DEPENDS
slouken@5066
  2440
$SDLMAIN_DEPENDS
slouken@5345
  2441
__EOF__
slouken@5345
  2442
slouken@5345
  2443
AC_CONFIG_FILES([
slouken@5345
  2444
    Makefile:Makefile.in:Makefile.rules sdl-config SDL.spec sdl.pc
slouken@5066
  2445
])
slouken@5066
  2446
AC_OUTPUT