configure.in
author Sam Lantinga
Mon, 21 Sep 2009 10:23:19 +0000
changeset 3293 0d60bdebed39
parent 3292 245a7d79577c
child 3298 94f22808d19e
permissions -rw-r--r--
Fixed bug #674

Matej 2009-01-08 09:25:34 PST

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