configure.in
author Sam Lantinga <slouken@libsdl.org>
Tue, 21 Mar 2006 08:54:50 +0000
changeset 1565 57431b199aed
parent 1556 011b633fa0c9
child 1566 5bc2a95f9dcf
permissions -rw-r--r--
Fixed bug #52

Integrated most of the NetBSD and DragonFly patches at:
ftp://ftp.netbsd.org/pub/NetBSD/packages/pkgsrc/devel/SDL/patches/

Thanks to Thomas Klausner for defailed information on the patches
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@0
     5
slouken@0
     6
dnl Set various version strings - taken gratefully from the GTk sources
slouken@0
     7
#
slouken@0
     8
# Making releases:
slouken@0
     9
# Edit include/SDL/SDL_version.h and change the version, then:
slouken@0
    10
#   SDL_MICRO_VERSION += 1;
slouken@0
    11
#   SDL_INTERFACE_AGE += 1;
slouken@0
    12
#   SDL_BINARY_AGE += 1;
slouken@0
    13
# if any functions have been added, set SDL_INTERFACE_AGE to 0.
slouken@0
    14
# if backwards compatibility has been broken,
slouken@0
    15
# set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0.
slouken@0
    16
#
slouken@0
    17
SDL_MAJOR_VERSION=1
slouken@0
    18
SDL_MINOR_VERSION=2
slouken@1222
    19
SDL_MICRO_VERSION=10
slouken@1222
    20
SDL_INTERFACE_AGE=3
slouken@1222
    21
SDL_BINARY_AGE=10
slouken@0
    22
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
slouken@0
    23
slouken@0
    24
AC_SUBST(SDL_MAJOR_VERSION)
slouken@0
    25
AC_SUBST(SDL_MINOR_VERSION)
slouken@0
    26
AC_SUBST(SDL_MICRO_VERSION)
slouken@0
    27
AC_SUBST(SDL_INTERFACE_AGE)
slouken@0
    28
AC_SUBST(SDL_BINARY_AGE)
slouken@0
    29
AC_SUBST(SDL_VERSION)
slouken@0
    30
slouken@0
    31
# libtool versioning
slouken@0
    32
LT_RELEASE=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION
slouken@0
    33
LT_CURRENT=`expr $SDL_MICRO_VERSION - $SDL_INTERFACE_AGE`
slouken@0
    34
LT_REVISION=$SDL_INTERFACE_AGE
slouken@0
    35
LT_AGE=`expr $SDL_BINARY_AGE - $SDL_INTERFACE_AGE`
slouken@0
    36
slouken@0
    37
AC_SUBST(LT_RELEASE)
slouken@0
    38
AC_SUBST(LT_CURRENT)
slouken@0
    39
AC_SUBST(LT_REVISION)
slouken@0
    40
AC_SUBST(LT_AGE)
slouken@0
    41
slouken@1550
    42
dnl Detect the canonical build and host environments
slouken@1361
    43
AC_CONFIG_AUX_DIRS($srcdir/build-scripts)
slouken@1550
    44
AC_CANONICAL_HOST
slouken@1354
    45
AC_C_BIGENDIAN
slouken@1354
    46
if test x$ac_cv_c_bigendian = xyes; then
slouken@1354
    47
    AC_DEFINE(SDL_BYTEORDER, 4321)
slouken@1354
    48
else
slouken@1354
    49
    AC_DEFINE(SDL_BYTEORDER, 1234)
slouken@1354
    50
fi
slouken@0
    51
slouken@1389
    52
dnl Set up the compiler and linker flags
slouken@1565
    53
INCLUDE="-I$srcdir/include $INCLUDE"
slouken@1373
    54
if test x$srcdir != x.; then
slouken@1373
    55
    INCLUDE="-Iinclude $INCLUDE"
slouken@1373
    56
fi
slouken@1565
    57
if test -d /usr/local/include; then
slouken@1565
    58
    INCLUDE="$INCLUDE -I/usr/local/include"
slouken@1565
    59
fi
slouken@1550
    60
case "$host" in
slouken@1389
    61
    *-*-cygwin*)
slouken@1389
    62
        # We build SDL on cygwin without the UNIX emulation layer
slouken@1521
    63
        BASE_CFLAGS="-I/usr/include/mingw -mno-cygwin"
slouken@1521
    64
        BASE_LDFLAGS="-mno-cygwin"
slouken@1389
    65
        ;;
slouken@1389
    66
    *)
slouken@1521
    67
        BASE_CFLAGS="-D_GNU_SOURCE=1"
slouken@1521
    68
        BASE_LDFLAGS=""
slouken@1389
    69
        ;;
slouken@1389
    70
esac
slouken@1521
    71
BUILD_CFLAGS="$CFLAGS"
slouken@1521
    72
EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS"
slouken@1521
    73
BUILD_LDFLAGS="$LDFLAGS"
slouken@1521
    74
EXTRA_LDFLAGS="$BASE_LDFLAGS"
slouken@1521
    75
SDL_CFLAGS="$BASE_CFLAGS"
slouken@1521
    76
SDL_LIBS="-lSDL $BASE_LDFLAGS"
slouken@1521
    77
CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS"
slouken@1521
    78
CFLAGS="$CFLAGS $EXTRA_CFLAGS"
slouken@1521
    79
LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
slouken@1373
    80
slouken@0
    81
dnl Check for tools
slouken@0
    82
AC_LIBTOOL_WIN32_DLL
slouken@1361
    83
AC_PROG_LIBTOOL
slouken@0
    84
AC_PROG_CC
slouken@200
    85
AC_PROG_CXX
slouken@0
    86
AC_PROG_INSTALL
slouken@1380
    87
AC_PROG_MAKE_SET
slouken@1341
    88
slouken@1353
    89
dnl Check for compiler characteristics
slouken@1341
    90
AC_C_CONST
slouken@1341
    91
AC_C_INLINE
slouken@1353
    92
AC_C_VOLATILE
slouken@1353
    93
slouken@1361
    94
dnl See whether we are allowed to use the system C library
slouken@1361
    95
AC_ARG_ENABLE(libc,
slouken@1361
    96
AC_HELP_STRING([--enable-libc], [Use the system C library [default=yes]]),
slouken@1361
    97
              , enable_libc=yes)
slouken@1361
    98
if test x$enable_libc = xyes; then
slouken@1361
    99
    AC_DEFINE(HAVE_LIBC)
slouken@1353
   100
slouken@1361
   101
    dnl Check for C library headers
slouken@1361
   102
    AC_HEADER_STDC
slouken@1501
   103
    AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h)
slouken@1361
   104
slouken@1361
   105
    dnl Check for typedefs, structures, etc.
slouken@1361
   106
    AC_TYPE_SIZE_T
slouken@1361
   107
    if test x$ac_cv_header_inttypes_h = xyes -o x$ac_cv_header_stdint_h = xyes; then
slouken@1361
   108
        AC_CHECK_TYPE(int64_t)
slouken@1361
   109
        if test x$ac_cv_type_int64_t = xyes; then
slouken@1361
   110
            AC_DEFINE(SDL_HAS_64BIT_TYPE)
slouken@1361
   111
        fi
slouken@1361
   112
        have_inttypes=yes
slouken@1353
   113
    fi
slouken@1361
   114
slouken@1361
   115
    dnl Checks for library functions.
slouken@1361
   116
    AC_FUNC_ALLOCA
slouken@1361
   117
    AC_FUNC_MEMCMP
slouken@1361
   118
    if test x$ac_cv_func_memcmp_working = xyes; then
slouken@1361
   119
        AC_DEFINE(HAVE_MEMCMP)
slouken@1361
   120
    fi
slouken@1361
   121
    AC_FUNC_STRTOD
slouken@1361
   122
    if test x$ac_cv_func_strtod = xyes; then
slouken@1361
   123
        AC_DEFINE(HAVE_STRTOD)
slouken@1361
   124
    fi
slouken@1512
   125
    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 iconv sigaction setjmp nanosleep)
slouken@1373
   126
slouken@1521
   127
    AC_CHECK_LIB(m, pow, [EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
slouken@1361
   128
fi
slouken@1361
   129
slouken@1361
   130
if test x$have_inttypes != xyes; then
slouken@1353
   131
    AC_CHECK_SIZEOF(char, 1)
slouken@1353
   132
    AC_CHECK_SIZEOF(short, 2)
slouken@1353
   133
    AC_CHECK_SIZEOF(int, 4)
slouken@1353
   134
    AC_CHECK_SIZEOF(long, 4)
slouken@1353
   135
    AC_CHECK_SIZEOF(long long, 8)
slouken@1353
   136
    if test x$ac_cv_sizeof_char = x1; then
slouken@1353
   137
        AC_DEFINE(int8_t, signed char)
slouken@1353
   138
        AC_DEFINE(uint8_t, unsigned char)
slouken@1353
   139
    fi
slouken@1353
   140
    if test x$ac_cv_sizeof_short = x2; then
slouken@1353
   141
        AC_DEFINE(int16_t, signed short)
slouken@1353
   142
        AC_DEFINE(uint16_t, unsigned short)
slouken@1353
   143
    else
slouken@1353
   144
        if test x$ac_cv_sizeof_int = x2; then
slouken@1353
   145
            AC_DEFINE(int16_t, signed int)
slouken@1353
   146
            AC_DEFINE(uint16_t, unsigned int)
slouken@1353
   147
        fi
slouken@1353
   148
    fi
slouken@1353
   149
    if test x$ac_cv_sizeof_int = x4; then
slouken@1353
   150
        AC_DEFINE(int32_t, signed int)
slouken@1353
   151
        AC_DEFINE(uint32_t, unsigned int)
slouken@1353
   152
    else
slouken@1353
   153
        if test x$ac_cv_sizeof_long = x4; then
slouken@1353
   154
            AC_DEFINE(int32_t, signed long)
slouken@1353
   155
            AC_DEFINE(uint32_t, unsigned long)
slouken@1353
   156
        fi
slouken@1353
   157
    fi
slouken@1353
   158
    if test x$ac_cv_sizeof_long = x8; then
slouken@1353
   159
        AC_DEFINE(int64_t, signed long)
slouken@1353
   160
        AC_DEFINE(uint64_t, unsigned long)
slouken@1353
   161
        AC_DEFINE(SDL_HAS_64BIT_TYPE)
slouken@1353
   162
    else
slouken@1353
   163
        if test x$ac_cv_sizeof_long_long = x8; then
slouken@1353
   164
            AC_DEFINE(int64_t, signed long long)
slouken@1353
   165
            AC_DEFINE(uint64_t, unsigned long long)
slouken@1353
   166
            AC_DEFINE(SDL_HAS_64BIT_TYPE)
slouken@1353
   167
        fi
slouken@1353
   168
    fi
slouken@1361
   169
    AC_DEFINE(size_t, unsigned int)
slouken@1361
   170
    AC_DEFINE(uintptr_t, unsigned long)
slouken@1353
   171
fi
slouken@1341
   172
slouken@1361
   173
# Standard C sources
slouken@1361
   174
SOURCES="$SOURCES $srcdir/src/*.c"
slouken@1361
   175
SOURCES="$SOURCES $srcdir/src/audio/*.c"
slouken@1361
   176
SOURCES="$SOURCES $srcdir/src/cdrom/*.c"
slouken@1361
   177
SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c"
slouken@1361
   178
SOURCES="$SOURCES $srcdir/src/events/*.c"
slouken@1361
   179
SOURCES="$SOURCES $srcdir/src/file/*.c"
slouken@1361
   180
SOURCES="$SOURCES $srcdir/src/joystick/*.c"
slouken@1361
   181
SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
slouken@1361
   182
SOURCES="$SOURCES $srcdir/src/thread/*.c"
slouken@1361
   183
SOURCES="$SOURCES $srcdir/src/timer/*.c"
slouken@1361
   184
SOURCES="$SOURCES $srcdir/src/video/*.c"
slouken@1361
   185
slouken@0
   186
dnl Enable/disable various subsystems of the SDL library
slouken@0
   187
slouken@0
   188
AC_ARG_ENABLE(audio,
slouken@1361
   189
AC_HELP_STRING([--enable-audio], [Enable the audio subsystem [default=yes]]),
slouken@0
   190
              , enable_audio=yes)
slouken@1361
   191
if test x$enable_audio != xyes; then
slouken@1361
   192
    AC_DEFINE(SDL_AUDIO_DISABLED)
slouken@0
   193
fi
slouken@0
   194
AC_ARG_ENABLE(video,
slouken@1361
   195
AC_HELP_STRING([--enable-video], [Enable the video subsystem [default=yes]]),
slouken@0
   196
              , enable_video=yes)
slouken@1361
   197
if test x$enable_video != xyes; then
slouken@1361
   198
    AC_DEFINE(SDL_VIDEO_DISABLED)
slouken@0
   199
fi
slouken@0
   200
AC_ARG_ENABLE(events,
slouken@1361
   201
AC_HELP_STRING([--enable-events], [Enable the events subsystem [default=yes]]),
slouken@0
   202
              , enable_events=yes)
slouken@1361
   203
if test x$enable_events != xyes; then
slouken@1361
   204
    AC_DEFINE(SDL_EVENTS_DISABLED)
slouken@0
   205
fi
slouken@0
   206
AC_ARG_ENABLE(joystick,
slouken@1361
   207
AC_HELP_STRING([--enable-joystick], [Enable the joystick subsystem [default=yes]]),
slouken@0
   208
              , enable_joystick=yes)
slouken@1361
   209
if test x$enable_joystick != xyes; then
slouken@1361
   210
    AC_DEFINE(SDL_JOYSTICK_DISABLED)
slouken@0
   211
fi
slouken@0
   212
AC_ARG_ENABLE(cdrom,
slouken@1361
   213
AC_HELP_STRING([--enable-cdrom], [Enable the cdrom subsystem [default=yes]]),
slouken@0
   214
              , enable_cdrom=yes)
slouken@1361
   215
if test x$enable_cdrom != xyes; then
slouken@1361
   216
    AC_DEFINE(SDL_CDROM_DISABLED)
slouken@0
   217
fi
slouken@0
   218
AC_ARG_ENABLE(threads,
slouken@1361
   219
AC_HELP_STRING([--enable-threads], [Enable the threading subsystem [default=yes]]),
slouken@0
   220
              , enable_threads=yes)
slouken@0
   221
if test x$enable_threads != xyes; then
slouken@1361
   222
    AC_DEFINE(SDL_THREADS_DISABLED)
slouken@0
   223
fi
slouken@0
   224
AC_ARG_ENABLE(timers,
slouken@1361
   225
AC_HELP_STRING([--enable-timers], [Enable the timer subsystem [default=yes]]),
slouken@0
   226
              , enable_timers=yes)
slouken@1361
   227
if test x$enable_timers != xyes; then
slouken@1361
   228
    AC_DEFINE(SDL_TIMERS_DISABLED)
slouken@0
   229
fi
slouken@0
   230
AC_ARG_ENABLE(file,
slouken@1361
   231
AC_HELP_STRING([--enable-file], [Enable the file subsystem [default=yes]]),
slouken@0
   232
              , enable_file=yes)
slouken@1361
   233
if test x$enable_file != xyes; then
slouken@1361
   234
    AC_DEFINE(SDL_FILE_DISABLED)
slouken@1361
   235
fi
slouken@1361
   236
AC_ARG_ENABLE(loadso,
slouken@1361
   237
AC_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [default=yes]]),
slouken@1361
   238
              , enable_loadso=yes)
slouken@1361
   239
if test x$enable_loadso != xyes; then
slouken@1361
   240
    AC_DEFINE(SDL_LOADSO_DISABLED)
slouken@0
   241
fi
slouken@740
   242
AC_ARG_ENABLE(cpuinfo,
slouken@1361
   243
AC_HELP_STRING([--enable-cpuinfo], [Enable the cpuinfo subsystem [default=yes]]),
slouken@740
   244
              , enable_cpuinfo=yes)
slouken@1361
   245
if test x$enable_cpuinfo != xyes; then
slouken@1361
   246
    AC_DEFINE(SDL_CPUINFO_DISABLED)
slouken@1361
   247
fi
slouken@1402
   248
AC_ARG_ENABLE(assembly,
slouken@1402
   249
AC_HELP_STRING([--enable-assembly], [Enable assembly routines [default=yes]]),
slouken@1402
   250
              , enable_assembly=yes)
slouken@1402
   251
if test x$enable_assembly = xyes; then
slouken@1402
   252
    AC_DEFINE(SDL_ASSEMBLY_ROUTINES)
slouken@740
   253
fi
slouken@0
   254
slouken@0
   255
dnl See if the OSS audio interface is supported
slouken@0
   256
CheckOSS()
slouken@0
   257
{
slouken@0
   258
    AC_ARG_ENABLE(oss,
slouken@1361
   259
AC_HELP_STRING([--enable-oss], [support the OSS audio API [default=yes]]),
slouken@0
   260
                  , enable_oss=yes)
slouken@0
   261
    if test x$enable_audio = xyes -a x$enable_oss = xyes; then
slouken@0
   262
        AC_MSG_CHECKING(for OSS audio support)
slouken@0
   263
        have_oss=no
slouken@94
   264
        if test x$have_oss != xyes; then
slouken@94
   265
            AC_TRY_COMPILE([
slouken@94
   266
              #include <sys/soundcard.h>
slouken@94
   267
            ],[
slouken@94
   268
              int arg = SNDCTL_DSP_SETFRAGMENT;
slouken@94
   269
            ],[
slouken@94
   270
            have_oss=yes
slouken@94
   271
            ])
slouken@94
   272
        fi
slouken@94
   273
        if test x$have_oss != xyes; then
slouken@94
   274
            AC_TRY_COMPILE([
slouken@94
   275
              #include <soundcard.h>
slouken@94
   276
            ],[
slouken@94
   277
              int arg = SNDCTL_DSP_SETFRAGMENT;
slouken@94
   278
            ],[
slouken@94
   279
            have_oss=yes
slouken@1361
   280
            AC_DEFINE(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H)
slouken@94
   281
            ])
slouken@94
   282
        fi
slouken@0
   283
        AC_MSG_RESULT($have_oss)
slouken@0
   284
        if test x$have_oss = xyes; then
slouken@1361
   285
            AC_DEFINE(SDL_AUDIO_DRIVER_OSS)
slouken@1361
   286
            SOURCES="$SOURCES $srcdir/src/audio/dsp/*.c"
slouken@1361
   287
            SOURCES="$SOURCES $srcdir/src/audio/dma/*.c"
slouken@1361
   288
            have_audio=yes
slouken@1361
   289
slouken@1565
   290
            # We may need to link with ossaudio emulation library
slouken@1550
   291
            case "$host" in
slouken@1383
   292
                *-*-openbsd*|*-*-netbsd*)
slouken@1521
   293
                    EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";;
slouken@1361
   294
            esac
slouken@0
   295
        fi
slouken@0
   296
    fi
slouken@0
   297
}
slouken@0
   298
slouken@0
   299
dnl See if the ALSA audio interface is supported
slouken@0
   300
CheckALSA()
slouken@0
   301
{
slouken@0
   302
    AC_ARG_ENABLE(alsa,
slouken@1361
   303
AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [default=yes]]),
slouken@0
   304
                  , enable_alsa=yes)
slouken@0
   305
    if test x$enable_audio = xyes -a x$enable_alsa = xyes; then
slouken@948
   306
        AM_PATH_ALSA(0.9.0, have_alsa=yes, have_alsa=no)
slouken@1009
   307
        # Restore all flags from before the ALSA detection runs
slouken@1009
   308
        CFLAGS="$alsa_save_CFLAGS"
slouken@1009
   309
        LDFLAGS="$alsa_save_LDFLAGS"
slouken@1009
   310
        LIBS="$alsa_save_LIBS"
slouken@354
   311
        if test x$have_alsa = xyes; then
slouken@865
   312
            AC_ARG_ENABLE(alsa-shared,
slouken@1361
   313
AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [default=yes]]),
slouken@1361
   314
                          , enable_alsa_shared=yes)
slouken@1361
   315
            if test "x`echo $ALSA_LIBS | grep -- -L`" = "x"; then
slouken@1361
   316
                if test "x`ls /lib/libasound.so.* 2> /dev/null`" != "x"; then
slouken@1361
   317
                    ALSA_LIBS="-L/lib $ALSA_LIBS"
slouken@1361
   318
                elif test "x`ls /usr/lib/libasound.so.* 2> /dev/null`" != "x"; then
slouken@1361
   319
                    ALSA_LIBS="-L/usr/lib $ALSA_LIBS"
slouken@1361
   320
                elif test "x`ls /usr/local/lib/libasound.so.* 2> /dev/null`" != "x"; then
slouken@1361
   321
                    ALSA_LIBS="-L/usr/local/lib $ALSA_LIBS"
slouken@1361
   322
                fi
slouken@1361
   323
            fi
slouken@1361
   324
            alsa_lib_spec=`echo $ALSA_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libasound.so.*/'`
slouken@1361
   325
            alsa_lib=`ls $alsa_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
slouken@1361
   326
            echo "-- $alsa_lib_spec -> $alsa_lib"
slouken@1361
   327
slouken@1361
   328
            AC_DEFINE(SDL_AUDIO_DRIVER_ALSA)
slouken@1361
   329
            SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c"
slouken@1521
   330
            EXTRA_CFLAGS="$EXTRA_CFLAGS $ALSA_CFLAGS"
slouken@1361
   331
            if test x$have_loadso != xyes && \
slouken@1361
   332
               test x$enable_alsa_shared = xyes; then
slouken@1467
   333
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ALSA loading])
slouken@1361
   334
            fi
slouken@1361
   335
            if test x$have_loadso = xyes && \
slouken@1361
   336
               test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
slouken@1361
   337
                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ALSA_DYNAMIC, "$alsa_lib")
slouken@1361
   338
            else
slouken@1521
   339
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ALSA_LIBS"
slouken@1361
   340
            fi
slouken@1361
   341
            have_audio=yes
slouken@1361
   342
        fi
slouken@1361
   343
    fi
slouken@0
   344
}
slouken@0
   345
slouken@148
   346
dnl Check whether we want to use IRIX 6.5+ native audio or not
slouken@148
   347
CheckDMEDIA()
slouken@148
   348
{
slouken@148
   349
    if test x$enable_audio = xyes; then
slouken@148
   350
        AC_MSG_CHECKING(for dmedia audio support)
slouken@148
   351
        have_dmedia=no
slouken@148
   352
        AC_TRY_COMPILE([
slouken@148
   353
          #include <dmedia/audio.h>
slouken@148
   354
        ],[
slouken@148
   355
          ALport audio_port;
slouken@148
   356
        ],[
slouken@148
   357
        have_dmedia=yes
slouken@148
   358
        ])
slouken@935
   359
        AC_MSG_RESULT($have_dmedia)
slouken@148
   360
        # Set up files for the audio library
slouken@148
   361
        if test x$have_dmedia = xyes; then
slouken@1361
   362
            AC_DEFINE(SDL_AUDIO_DRIVER_DMEDIA)
slouken@1361
   363
            SOURCES="$SOURCES $srcdir/src/audio/dmedia/*.c"
slouken@1521
   364
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -laudio"
slouken@1361
   365
            have_audio=yes
slouken@148
   366
        fi
slouken@148
   367
    fi
slouken@148
   368
}
slouken@148
   369
slouken@1438
   370
dnl Check whether we want to use Tru64 UNIX native audio or not
slouken@1438
   371
CheckMME()
slouken@1438
   372
{
slouken@1438
   373
    dnl Make sure we are running on an Tru64 UNIX
slouken@1438
   374
    case $ARCH in
slouken@1438
   375
        osf)
slouken@1438
   376
            ;;
slouken@1438
   377
        *)
slouken@1438
   378
            return
slouken@1438
   379
            ;;
slouken@1438
   380
    esac
slouken@1438
   381
    if test x$enable_audio = xyes; then
slouken@1438
   382
        AC_MSG_CHECKING(for MME audio support)
slouken@1438
   383
        MME_CFLAGS="-I/usr/include/mme"
slouken@1438
   384
        MME_LIBS="-lmme"
slouken@1438
   385
        have_mme=no
slouken@1438
   386
        save_CFLAGS="$CFLAGS"
slouken@1438
   387
        CFLAGS="$CFLAGS $MME_CFLAGS"
slouken@1438
   388
        AC_TRY_COMPILE([
slouken@1438
   389
          #include <mme_api.h>
slouken@1438
   390
        ],[
slouken@1438
   391
          HWAVEOUT sound;
slouken@1438
   392
        ],[
slouken@1438
   393
        have_mme=yes
slouken@1438
   394
        ])
slouken@1438
   395
        CFLAGS="$save_CFLAGS"
slouken@1438
   396
        AC_MSG_RESULT($have_mme)
slouken@1438
   397
        # Set up files for the audio library
slouken@1438
   398
        if test x$have_mme = xyes; then
slouken@1438
   399
            AC_DEFINE(SDL_AUDIO_DRIVER_MMEAUDIO)
slouken@1438
   400
            SOURCES="$SOURCES $srcdir/src/audio/mme/*.c"
slouken@1521
   401
            EXTRA_CFLAGS="$EXTRA_CFLAGS $MME_CFLAGS"
slouken@1521
   402
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MME_LIBS"
slouken@1438
   403
            have_audio=yes
slouken@1438
   404
        fi
slouken@1438
   405
    fi
slouken@1438
   406
}
slouken@1438
   407
slouken@0
   408
dnl Find the ESD includes and libraries
slouken@0
   409
CheckESD()
slouken@0
   410
{
slouken@0
   411
    AC_ARG_ENABLE(esd,
slouken@1361
   412
AC_HELP_STRING([--enable-esd], [support the Enlightened Sound Daemon [default=yes]]),
slouken@0
   413
                  , enable_esd=yes)
slouken@0
   414
    if test x$enable_audio = xyes -a x$enable_esd = xyes; then
slouken@948
   415
        AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no)
slouken@948
   416
        if test x$have_esd = xyes; then
slouken@294
   417
            AC_ARG_ENABLE(esd-shared,
slouken@1361
   418
AC_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [default=yes]]),
slouken@678
   419
                          , enable_esd_shared=yes)
slouken@294
   420
            esd_lib_spec=`echo $ESD_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libesd.so.*/'`
slouken@868
   421
            esd_lib=`ls $esd_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
slouken@371
   422
            echo "-- $esd_lib_spec -> $esd_lib"
slouken@1467
   423
slouken@1467
   424
            AC_DEFINE(SDL_AUDIO_DRIVER_ESD)
slouken@1467
   425
            SOURCES="$SOURCES $srcdir/src/audio/esd/*.c"
slouken@1521
   426
            EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS"
icculus@1173
   427
            if test x$have_loadso != xyes && \
slouken@296
   428
               test x$enable_esd_shared = xyes; then
slouken@1467
   429
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ESD loading])
slouken@296
   430
            fi
icculus@1173
   431
            if test x$have_loadso = xyes && \
slouken@294
   432
               test x$enable_esd_shared = xyes && test x$esd_lib != x; then
slouken@1361
   433
                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ESD_DYNAMIC, "$esd_lib")
slouken@1467
   434
            else
slouken@1521
   435
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ESD_LIBS"
slouken@294
   436
            fi
slouken@1361
   437
            have_audio=yes
slouken@294
   438
        fi
slouken@0
   439
    fi
slouken@0
   440
}
slouken@0
   441
slouken@0
   442
CheckARTSC()
slouken@0
   443
{
slouken@0
   444
    AC_ARG_ENABLE(arts,
slouken@1361
   445
AC_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [default=yes]]),
slouken@0
   446
                  , enable_arts=yes)
slouken@0
   447
    if test x$enable_audio = xyes -a x$enable_arts = xyes; then
slouken@1361
   448
        AC_PATH_PROG(ARTSCONFIG, artsc-config)
slouken@1361
   449
        if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then
slouken@0
   450
            : # arts isn't installed
slouken@0
   451
        else
slouken@1361
   452
            ARTS_CFLAGS=`$ARTSCONFIG --cflags`
slouken@1361
   453
            ARTS_LIBS=`$ARTSCONFIG --libs`
slouken@1361
   454
            ARTS_PREFIX=`$ARTSCONFIG --arts-prefix`
slouken@0
   455
            AC_MSG_CHECKING(for aRts development environment)
slouken@0
   456
            audio_arts=no
slouken@0
   457
            save_CFLAGS="$CFLAGS"
slouken@1361
   458
            CFLAGS="$CFLAGS $ARTS_CFLAGS"
slouken@0
   459
            AC_TRY_COMPILE([
slouken@0
   460
             #include <artsc.h>
slouken@0
   461
            ],[
slouken@0
   462
             arts_stream_t stream;
slouken@0
   463
            ],[
slouken@0
   464
            audio_arts=yes
slouken@0
   465
            ])
slouken@0
   466
            CFLAGS="$save_CFLAGS"
slouken@0
   467
            AC_MSG_RESULT($audio_arts)
slouken@0
   468
            if test x$audio_arts = xyes; then
slouken@294
   469
                AC_ARG_ENABLE(arts-shared,
slouken@1361
   470
AC_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [default=yes]]),
slouken@678
   471
                              , enable_arts_shared=yes)
slouken@1361
   472
                arts_lib_spec="$ARTS_PREFIX/lib/libartsc.so.*"
slouken@868
   473
                arts_lib=`ls $arts_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
slouken@371
   474
                echo "-- $arts_lib_spec -> $arts_lib"
slouken@1467
   475
slouken@1467
   476
                AC_DEFINE(SDL_AUDIO_DRIVER_ARTS)
slouken@1467
   477
                SOURCES="$SOURCES $srcdir/src/audio/arts/*.c"
slouken@1521
   478
                EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS"
icculus@1173
   479
                if test x$have_loadso != xyes && \
slouken@296
   480
                   test x$enable_arts_shared = xyes; then
slouken@1467
   481
                    AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ARTS loading])
slouken@296
   482
                fi
icculus@1173
   483
                if test x$have_loadso = xyes && \
slouken@294
   484
                   test x$enable_arts_shared = xyes && test x$arts_lib != x; then
slouken@1361
   485
                    AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ARTS_DYNAMIC, "$arts_lib")
slouken@1467
   486
                else
slouken@1521
   487
                    EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS"
slouken@294
   488
                fi
slouken@1361
   489
                have_audio=yes
slouken@0
   490
            fi
slouken@0
   491
        fi
slouken@0
   492
    fi
slouken@0
   493
}
slouken@0
   494
slouken@0
   495
dnl See if the NAS audio interface is supported
slouken@0
   496
CheckNAS()
slouken@0
   497
{
slouken@0
   498
    AC_ARG_ENABLE(nas,
slouken@1361
   499
AC_HELP_STRING([--enable-nas], [support the NAS audio API [default=yes]]),
slouken@41
   500
                  , enable_nas=yes)
slouken@0
   501
    if test x$enable_audio = xyes -a x$enable_nas = xyes; then
slouken@41
   502
        AC_MSG_CHECKING(for NAS audio support)
slouken@41
   503
        have_nas=no
slouken@41
   504
        if test -r /usr/X11R6/include/audio/audiolib.h; then
slouken@41
   505
            have_nas=yes
slouken@1361
   506
            NAS_CFLAGS="-I/usr/X11R6/include/"
slouken@1520
   507
            NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt"
slouken@605
   508
slouken@605
   509
        dnl On IRIX, the NAS includes are in a different directory,
slouken@605
   510
        dnl and libnas must be explicitly linked in
slouken@605
   511
slouken@605
   512
        elif test -r /usr/freeware/include/nas/audiolib.h; then
slouken@605
   513
            have_nas=yes
slouken@1361
   514
            NAS_LIBS="-lnas -lXt"
slouken@41
   515
        fi
slouken@605
   516
        AC_MSG_RESULT($have_nas)
slouken@1361
   517
        if test x$have_nas = xyes; then
slouken@1361
   518
            AC_DEFINE(SDL_AUDIO_DRIVER_NAS)
slouken@1361
   519
            SOURCES="$SOURCES $srcdir/src/audio/nas/*.c"
slouken@1521
   520
            EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS"
slouken@1521
   521
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS"
slouken@1361
   522
            have_audio=yes
slouken@1361
   523
        fi
slouken@0
   524
    fi
slouken@0
   525
}
slouken@0
   526
slouken@68
   527
dnl rcg07142001 See if the user wants the disk writer audio driver...
slouken@68
   528
CheckDiskAudio()
slouken@68
   529
{
slouken@68
   530
    AC_ARG_ENABLE(diskaudio,
slouken@1361
   531
AC_HELP_STRING([--enable-diskaudio], [support the disk writer audio driver [default=yes]]),
slouken@86
   532
                  , enable_diskaudio=yes)
slouken@68
   533
    if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
slouken@1361
   534
        AC_DEFINE(SDL_AUDIO_DRIVER_DISK)
slouken@1361
   535
        SOURCES="$SOURCES $srcdir/src/audio/disk/*.c"
slouken@68
   536
    fi
slouken@68
   537
}
slouken@68
   538
icculus@1532
   539
dnl rcg03142006 See if the user wants the dummy audio driver...
icculus@1532
   540
CheckDummyAudio()
icculus@1532
   541
{
icculus@1532
   542
    AC_ARG_ENABLE(dummyaudio,
icculus@1532
   543
AC_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [default=yes]]),
icculus@1532
   544
                  , enable_dummyaudio=yes)
icculus@1532
   545
    if test x$enable_audio = xyes -a x$enable_dummyaudio = xyes; then
icculus@1532
   546
        AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY)
icculus@1532
   547
        SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c"
icculus@1532
   548
    fi
icculus@1532
   549
}
icculus@1532
   550
slouken@398
   551
dnl Set up the Atari Audio driver
slouken@398
   552
CheckAtariAudio()
slouken@398
   553
{
slouken@398
   554
    AC_ARG_ENABLE(mintaudio,
slouken@1361
   555
AC_HELP_STRING([--enable-mintaudio], [support Atari audio driver [default=yes]]),
slouken@398
   556
                  , enable_mintaudio=yes)
slouken@398
   557
    if test x$enable_audio = xyes -a x$enable_mintaudio = xyes; then
slouken@398
   558
        mintaudio=no
slouken@398
   559
        AC_CHECK_HEADER(mint/falcon.h, have_mint_falcon_hdr=yes)
slouken@398
   560
        if test x$have_mint_falcon_hdr = xyes; then
slouken@398
   561
            mintaudio=yes
slouken@1361
   562
            AC_DEFINE(SDL_AUDIO_DRIVER_MINT)
patmandin@1364
   563
            SOURCES="$SOURCES $srcdir/src/audio/mint/*.c"
patmandin@1477
   564
            SOURCES="$SOURCES $srcdir/src/audio/mint/*.S"
slouken@1361
   565
            have_audio=yes
slouken@398
   566
        fi
slouken@398
   567
    fi
slouken@398
   568
}
slouken@398
   569
slouken@0
   570
dnl See if we can use x86 assembly blitters
slouken@1361
   571
# NASM is available from: http://nasm.sourceforge.net
slouken@0
   572
CheckNASM()
slouken@0
   573
{
slouken@0
   574
    dnl Make sure we are running on an x86 platform
slouken@1550
   575
    case $host in
slouken@0
   576
        i?86*)
slouken@0
   577
            ;;
slouken@0
   578
        *)
slouken@0
   579
        # Nope, bail early.
slouken@0
   580
            return
slouken@0
   581
            ;;
slouken@0
   582
    esac
slouken@0
   583
    dnl Check for NASM (for assembly blit routines)
slouken@0
   584
    AC_ARG_ENABLE(nasm,
slouken@1361
   585
AC_HELP_STRING([--enable-nasm], [use nasm assembly blitters on x86 [default=yes]]),
slouken@0
   586
                  , enable_nasm=yes)
slouken@1402
   587
    if test x$enable_video = xyes -a x$enable_assembly = xyes -a x$enable_nasm = xyes; then
slouken@0
   588
        AC_PATH_PROG(NASM, nasm)
slouken@1361
   589
        if test x$NASM != x -a x$NASM != x'"$NASM"'; then
slouken@1361
   590
            AC_DEFINE(SDL_HERMES_BLITTERS)
slouken@1361
   591
            SOURCES="$SOURCES $srcdir/src/hermes/*.asm"
slouken@0
   592
            case $ARCH in
slouken@0
   593
              win32)
slouken@0
   594
                  NASMFLAGS="-f win32"
slouken@0
   595
                  ;;
slouken@360
   596
              openbsd)
slouken@360
   597
                  NASMFLAGS="-f aoutb"
slouken@360
   598
                  ;;
slouken@0
   599
              *)
slouken@754
   600
                  NASMFLAGS="-f elf"
slouken@0
   601
                  ;;
slouken@0
   602
            esac
slouken@1361
   603
            AC_SUBST(NASM)
slouken@0
   604
            AC_SUBST(NASMFLAGS)
slouken@1361
   605
slouken@1550
   606
            case "$host" in
slouken@886
   607
                # this line is needed for QNX, because it's not defined the __ELF__
slouken@1361
   608
                *-*-qnx*)
slouken@1521
   609
                     EXTRA_CFLAGS="$EXTRA_CFLAGS -D__ELF__";;
slouken@1361
   610
                *-*-solaris*)
slouken@1521
   611
                     EXTRA_CFLAGS="$EXTRA_CFLAGS -D__ELF__";;
slouken@1361
   612
            esac
slouken@1361
   613
        fi
slouken@1361
   614
    fi
slouken@1361
   615
}
slouken@886
   616
slouken@1361
   617
dnl Check for altivec instruction support using gas syntax
slouken@1361
   618
CheckAltivec()
slouken@1361
   619
{
slouken@1361
   620
    AC_ARG_ENABLE(altivec,
slouken@1361
   621
AC_HELP_STRING([--enable-altivec], [use altivec assembly blitters on PPC [default=yes]]),
slouken@1361
   622
                  , enable_altivec=yes)
slouken@1402
   623
    if test x$enable_video = xyes -a x$enable_assembly = xyes -a x$enable_altivec = xyes; then
slouken@1361
   624
        have_altivec_h_hdr=no
slouken@1361
   625
        AC_CHECK_HEADER(altivec.h, have_altivec_h_hdr=yes)
slouken@886
   626
slouken@1361
   627
        save_CFLAGS="$CFLAGS"
slouken@1361
   628
        have_gcc_altivec=no
slouken@1361
   629
        AC_MSG_CHECKING(for Altivec with GCC -maltivec option)
slouken@1361
   630
        altivec_CFLAGS="-maltivec"
slouken@1361
   631
        CFLAGS="$save_CFLAGS $altivec_CFLAGS"
slouken@1361
   632
slouken@1361
   633
        if test x$have_altivec_h_hdr = xyes; then
slouken@1361
   634
          AC_TRY_COMPILE([
slouken@1361
   635
          #include <altivec.h>
slouken@1361
   636
          vector unsigned int vzero() {
slouken@1361
   637
              return vec_splat_u32(0);
slouken@1361
   638
          }
slouken@1361
   639
          ],[
slouken@1361
   640
          ],[
slouken@1361
   641
          have_gcc_altivec=yes
slouken@1361
   642
          ])
slouken@1361
   643
          AC_MSG_RESULT($have_gcc_altivec)
slouken@1361
   644
        else
slouken@1361
   645
          AC_TRY_COMPILE([
slouken@1361
   646
          vector unsigned int vzero() {
slouken@1361
   647
              return vec_splat_u32(0);
slouken@1361
   648
          }
slouken@1361
   649
          ],[
slouken@1361
   650
          ],[
slouken@1361
   651
          have_gcc_altivec=yes
slouken@1361
   652
          ])
slouken@1361
   653
          AC_MSG_RESULT($have_gcc_altivec)
slouken@1361
   654
        fi
slouken@1361
   655
slouken@1361
   656
        if test x$have_gcc_altivec = xno; then
slouken@1361
   657
            AC_MSG_CHECKING(for Altivec with GCC -faltivec option)
slouken@1361
   658
            altivec_CFLAGS="-faltivec"
slouken@1361
   659
            CFLAGS="$save_CFLAGS $altivec_CFLAGS"
slouken@1361
   660
            if test x$have_altivec_h_hdr = xyes; then
slouken@1361
   661
              AC_TRY_COMPILE([
slouken@1361
   662
              #include <altivec.h>
slouken@1361
   663
              vector unsigned int vzero() {
slouken@1361
   664
                  return vec_splat_u32(0);
slouken@1361
   665
              }
slouken@1361
   666
              ],[
slouken@1361
   667
              ],[
slouken@1361
   668
              have_gcc_altivec=yes
slouken@1361
   669
              ])
slouken@1361
   670
              AC_MSG_RESULT($have_gcc_altivec)
slouken@1361
   671
            else
slouken@1361
   672
              AC_TRY_COMPILE([
slouken@1361
   673
              vector unsigned int vzero() {
slouken@1361
   674
                  return vec_splat_u32(0);
slouken@1361
   675
              }
slouken@1361
   676
              ],[
slouken@1361
   677
              ],[
slouken@1361
   678
              have_gcc_altivec=yes
slouken@1361
   679
              ])
slouken@1361
   680
              AC_MSG_RESULT($have_gcc_altivec)
slouken@1361
   681
            fi
slouken@1361
   682
        fi
slouken@1361
   683
        CFLAGS="$save_CFLAGS"
slouken@1361
   684
slouken@1361
   685
        if test x$have_gcc_altivec = xyes; then
slouken@1361
   686
            AC_DEFINE(SDL_ALTIVEC_BLITTERS)
slouken@1361
   687
            if test x$have_altivec_h_hdr = xyes; then
slouken@1361
   688
              AC_DEFINE(HAVE_ALTIVEC_H)
slouken@1361
   689
            fi
slouken@1521
   690
            EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS"
slouken@0
   691
        fi
slouken@0
   692
    fi
slouken@0
   693
}
slouken@0
   694
icculus@1140
   695
dnl Do the iPod thing
icculus@1140
   696
CheckIPod()
icculus@1140
   697
{
icculus@1140
   698
    AC_ARG_ENABLE(ipod,
slouken@1361
   699
AC_HELP_STRING([--enable-ipod], [configure SDL to work with iPodLinux [default=yes on arm-elf]]),
slouken@1361
   700
        , enable_ipod=yes)
icculus@1140
   701
icculus@1140
   702
    if test x$enable_ipod = xyes; then
slouken@1521
   703
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DIPOD"
slouken@1361
   704
        AC_DEFINE(SDL_VIDEO_DRIVER_IPOD)
slouken@1361
   705
        SOURCES="$SOURCES $srcdir/src/video/ipod/*.c"
icculus@1140
   706
    fi
slouken@1361
   707
}
icculus@1140
   708
slouken@30
   709
dnl Find the nanox include and library directories
slouken@30
   710
CheckNANOX()
slouken@30
   711
{
slouken@292
   712
    AC_ARG_ENABLE(video-nanox,
slouken@1361
   713
        AC_HELP_STRING([--enable-video-nanox], [use nanox video driver [default=no]]),
slouken@292
   714
        , enable_video_nanox=no)
slouken@30
   715
slouken@292
   716
    if test x$enable_video = xyes -a x$enable_video_nanox = xyes; then
slouken@1361
   717
        AC_ARG_ENABLE(nanox-debug,  
slouken@1361
   718
            AC_HELP_STRING([--enable-nanox-debug], [print debug messages [default=no]]),
slouken@1361
   719
            , enable_nanox_debug=no)
slouken@292
   720
        if test x$enable_nanox_debug = xyes; then
slouken@1521
   721
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DENABLE_NANOX_DEBUG"
slouken@292
   722
        fi
slouken@30
   723
slouken@1361
   724
        AC_ARG_ENABLE(nanox-share-memory,  
slouken@1361
   725
            AC_HELP_STRING([--enable-nanox-share-memory], [use share memory [default=no]]),
slouken@1361
   726
            , enable_nanox_share_memory=no)
slouken@292
   727
        if test x$enable_nanox_share_memory = xyes; then
slouken@1521
   728
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DNANOX_SHARE_MEMORY"
slouken@292
   729
        fi
slouken@30
   730
slouken@1361
   731
        AC_ARG_ENABLE(nanox_direct_fb, 
slouken@1361
   732
            AC_HELP_STRING([--enable-nanox-direct-fb], [use direct framebuffer access [default=no]]),
slouken@1361
   733
            , enable_nanox_direct_fb=no)
slouken@471
   734
        if test x$enable_nanox_direct_fb = xyes; then
slouken@1521
   735
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DENABLE_NANOX_DIRECT_FB"
slouken@471
   736
        fi
slouken@30
   737
slouken@1361
   738
        AC_DEFINE(SDL_VIDEO_DRIVER_NANOX)
slouken@1361
   739
        SOURCES="$SOURCES $srcdir/src/video/nanox/*.c"
slouken@1521
   740
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lnano-X"
slouken@1361
   741
        have_video=yes
slouken@292
   742
    fi
slouken@30
   743
}
slouken@30
   744
slouken@0
   745
dnl Find the X11 include and library directories
slouken@0
   746
CheckX11()
slouken@0
   747
{
slouken@0
   748
    AC_ARG_ENABLE(video-x11,
slouken@1361
   749
AC_HELP_STRING([--enable-video-x11], [use X11 video driver [default=yes]]),
slouken@0
   750
                  , enable_video_x11=yes)
slouken@0
   751
    if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
slouken@0
   752
        AC_PATH_X
slouken@0
   753
        AC_PATH_XTRA
slouken@0
   754
        if test x$have_x = xyes; then
icculus@1168
   755
            AC_ARG_ENABLE(x11-shared,
slouken@1361
   756
AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [default=yes]]),
icculus@1168
   757
                          , enable_x11_shared=yes)
icculus@1168
   758
slouken@1550
   759
            case "$host" in
slouken@1384
   760
                *-*-darwin*)
icculus@1174
   761
                    x11_lib='/usr/X11R6/lib/libX11.6.dylib'
icculus@1174
   762
                    x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
icculus@1174
   763
                    ;;
slouken@1384
   764
                *-*-osf*)
slouken@1384
   765
                    x11_lib='libX11.so'
slouken@1384
   766
                    x11ext_lib='libXext.so'
slouken@1384
   767
                    ;;
slouken@1384
   768
                *-*-irix*) # IRIX 6.5 requires that we use /usr/lib32
icculus@1299
   769
                    x11_lib='libX11.so'
icculus@1299
   770
                    x11ext_lib='libXext.so'
icculus@1299
   771
                    ;;
icculus@1174
   772
                *)
slouken@1452
   773
                    if test "x$X_LIBS" = "x"; then X_LIBS="-L/usr/lib"; fi
slouken@1389
   774
                    x11_lib_spec=[`echo $X_LIBS | sed 's/.*-L\([^ ]*\).*/\1\/libX11.so.[0-9]/'`]
slouken@1384
   775
                    x11_lib=`ls $x11_lib_spec 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`
slouken@1389
   776
                    x11ext_lib_spec=[`echo $X_LIBS | sed 's/.*-L\([^ ]*\).*/\1\/libXext.so.[0-9]/'`]
slouken@1384
   777
                    x11ext_lib=`ls $x11ext_lib_spec 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`
icculus@1174
   778
                    ;;
icculus@1174
   779
            esac
icculus@1168
   780
slouken@1361
   781
            X_CFLAGS="$X_CFLAGS -DXTHREADS"
slouken@1361
   782
            if test x$ac_cv_func_shmat != xyes; then
slouken@1361
   783
                X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY"
slouken@1361
   784
            fi
slouken@1468
   785
slouken@1468
   786
            AC_DEFINE(SDL_VIDEO_DRIVER_X11)
slouken@1468
   787
            SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
slouken@1521
   788
            EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
icculus@1173
   789
            if test x$have_loadso != xyes && \
icculus@1168
   790
               test x$enable_x11_shared = xyes; then
slouken@1467
   791
                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic X11 loading])
icculus@1168
   792
            fi
icculus@1173
   793
            if test x$have_loadso = xyes && \
icculus@1170
   794
               test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then
icculus@1174
   795
                echo "-- dynamic libX11 -> $x11_lib"
icculus@1174
   796
                echo "-- dynamic libX11ext -> $x11ext_lib"
slouken@1361
   797
                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib")
slouken@1361
   798
                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib")
icculus@1168
   799
            else
slouken@1521
   800
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
icculus@1168
   801
            fi
slouken@1361
   802
            have_video=yes
slouken@0
   803
slouken@1307
   804
            AC_ARG_ENABLE(dga,
slouken@1361
   805
AC_HELP_STRING([--enable-dga], [allow use of X11 DGA code [default=yes]]),
slouken@1307
   806
                          , enable_dga=yes)
slouken@1307
   807
            if test x$enable_dga = xyes; then
slouken@1361
   808
                SOURCES="$SOURCES $srcdir/src/video/Xext/Xxf86dga/*.c"
slouken@1307
   809
            fi
slouken@1307
   810
            AC_ARG_ENABLE(video-dga,
slouken@1361
   811
AC_HELP_STRING([--enable-video-dga], [use DGA 2.0 video driver [default=yes]]),
slouken@1307
   812
                  , enable_video_dga=yes)
slouken@1307
   813
            if test x$enable_dga = xyes -a x$enable_video_dga = xyes; then
slouken@1361
   814
                AC_DEFINE(SDL_VIDEO_DRIVER_DGA)
slouken@1361
   815
                SOURCES="$SOURCES $srcdir/src/video/dga/*.c"
slouken@1307
   816
            fi
slouken@1307
   817
            AC_ARG_ENABLE(video-x11-dgamouse,
slouken@1361
   818
AC_HELP_STRING([--enable-video-x11-dgamouse], [use X11 DGA for mouse events [default=yes]]),
slouken@1307
   819
                          , enable_video_x11_dgamouse=yes)
slouken@1307
   820
            if test x$enable_dga = xyes -a x$enable_video_x11_dgamouse = xyes; then
slouken@1361
   821
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_DGAMOUSE)
slouken@1307
   822
            fi
slouken@0
   823
            AC_ARG_ENABLE(video-x11-vm,
slouken@1361
   824
AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [default=yes]]),
slouken@0
   825
                          , enable_video_x11_vm=yes)
slouken@0
   826
            if test x$enable_video_x11_vm = xyes; then
slouken@1361
   827
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_VIDMODE)
slouken@1361
   828
                SOURCES="$SOURCES $srcdir/src/video/Xext/Xxf86vm/*.c"
slouken@0
   829
            fi
slouken@0
   830
            AC_ARG_ENABLE(video-x11-xv,
slouken@1361
   831
AC_HELP_STRING([--enable-video-x11-xv], [use X11 XvImage extension for video [default=yes]]),
slouken@0
   832
                          , enable_video_x11_xv=yes)
slouken@0
   833
            if test x$enable_video_x11_xv = xyes; then
slouken@1361
   834
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XV)
slouken@1361
   835
                SOURCES="$SOURCES $srcdir/src/video/Xext/Xv/*.c"
slouken@0
   836
            fi
slouken@227
   837
            AC_ARG_ENABLE(video-x11-xinerama,
slouken@1361
   838
AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [default=yes]]),
slouken@227
   839
                            , enable_video_x11_xinerama=yes)
slouken@227
   840
            if test x$enable_video_x11_xinerama = xyes; then
slouken@1361
   841
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA)
slouken@1361
   842
                SOURCES="$SOURCES $srcdir/src/video/Xext/Xinerama/*.c"
slouken@227
   843
            fi
slouken@242
   844
            AC_ARG_ENABLE(video-x11-xme,
slouken@1361
   845
AC_HELP_STRING([--enable-video-x11-xme], [enable Xi Graphics XME for fullscreen [default=yes]]),
slouken@242
   846
                            , enable_video_x11_xme=yes)
slouken@242
   847
            if test x$enable_video_x11_xme = xyes; then
slouken@1361
   848
                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XME)
slouken@1361
   849
                SOURCES="$SOURCES $srcdir/src/video/Xext/XME/*.c"
slouken@242
   850
            fi
slouken@0
   851
        fi
slouken@0
   852
    fi
slouken@0
   853
}
slouken@279
   854
slouken@1361
   855
dnl Check for QNX photon video driver
slouken@0
   856
CheckPHOTON()
slouken@0
   857
{
slouken@0
   858
    AC_ARG_ENABLE(video-photon,
slouken@1361
   859
AC_HELP_STRING([--enable-video-photon], [use QNX Photon video driver [default=yes]]),
slouken@0
   860
                  , enable_video_photon=yes)
slouken@0
   861
    if test x$enable_video = xyes -a x$enable_video_photon = xyes; then
slouken@0
   862
        AC_MSG_CHECKING(for QNX Photon support)
slouken@0
   863
        video_photon=no
slouken@0
   864
        AC_TRY_COMPILE([
slouken@0
   865
          #include <Ph.h>
slouken@0
   866
          #include <Pt.h>
slouken@0
   867
          #include <photon/Pg.h>
slouken@0
   868
          #include <photon/PdDirect.h>
slouken@0
   869
        ],[
slouken@0
   870
         PgDisplaySettings_t *visual;
slouken@0
   871
        ],[
slouken@0
   872
        video_photon=yes
slouken@0
   873
        ])
slouken@0
   874
        AC_MSG_RESULT($video_photon)
slouken@0
   875
        if test x$video_photon = xyes; then
slouken@1361
   876
            AC_DEFINE(SDL_VIDEO_DRIVER_PHOTON)
slouken@1361
   877
            SOURCES="$SOURCES $srcdir/src/video/photon/*.c"
slouken@1521
   878
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lph"
slouken@1361
   879
            have_video=yes
slouken@1361
   880
slouken@279
   881
            CheckOpenGLQNX
slouken@0
   882
        fi
slouken@0
   883
    fi
slouken@0
   884
}
slouken@0
   885
slouken@1361
   886
dnl Set up the BWindow video driver if enabled
slouken@1361
   887
CheckBWINDOW()
slouken@1361
   888
{
slouken@1361
   889
    if test x$enable_video = xyes; then
slouken@1361
   890
        AC_DEFINE(SDL_VIDEO_DRIVER_BWINDOW)
slouken@1361
   891
        SOURCES="$SOURCES $srcdir/src/video/bwindow/*.cc"
slouken@1361
   892
        have_video=yes
slouken@1361
   893
    fi
slouken@1361
   894
}
slouken@1361
   895
slouken@1361
   896
dnl Set up the Carbon/QuickDraw video driver for Mac OS X (but not Darwin)
slouken@1361
   897
CheckCARBON()
slouken@1361
   898
{
slouken@1361
   899
    AC_ARG_ENABLE(video-carbon,
slouken@1361
   900
AC_HELP_STRING([--enable-video-carbon], [use Carbon/QuickDraw video driver [default=no]]),
slouken@1361
   901
                  , enable_video_carbon=no)
slouken@1361
   902
    if test x$enable_video = xyes -a x$enable_video_carbon = xyes; then
slouken@1361
   903
        AC_MSG_CHECKING(for Carbon framework)
slouken@1361
   904
        have_carbon=no
slouken@1361
   905
        AC_TRY_COMPILE([
slouken@1361
   906
          #include <Carbon/Carbon.h>
slouken@1361
   907
        ],[
slouken@1361
   908
        ],[
slouken@1361
   909
        have_carbon=yes
slouken@1361
   910
        ])
slouken@1361
   911
        AC_MSG_RESULT($have_carbon)
slouken@1361
   912
        if test x$have_carbon = xyes; then
slouken@1361
   913
            AC_DEFINE(SDL_VIDEO_DRIVER_TOOLBOX)
slouken@1361
   914
            SOURCES="$SOURCES $srcdir/src/video/maccommon/*.c"
slouken@1361
   915
            SOURCES="$SOURCES $srcdir/src/video/macrom/*.c"
slouken@1361
   916
            have_video=yes
slouken@1361
   917
        fi
slouken@1361
   918
    fi
slouken@1361
   919
}
slouken@1361
   920
slouken@1361
   921
dnl Set up the Cocoa/Quartz video driver for Mac OS X (but not Darwin)
slouken@1361
   922
CheckCOCOA()
slouken@1361
   923
{
slouken@1361
   924
    AC_ARG_ENABLE(video-cocoa,
slouken@1361
   925
AC_HELP_STRING([--enable-video-cocoa], [use Cocoa/Quartz video driver [default=yes]]),
slouken@1361
   926
                  , enable_video_cocoa=yes)
slouken@1361
   927
    if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
slouken@1361
   928
        save_CFLAGS="$CFLAGS"
slouken@1361
   929
        dnl work around that we don't have Objective-C support in autoconf
slouken@1361
   930
        CFLAGS="$CFLAGS -x objective-c"
slouken@1361
   931
        AC_MSG_CHECKING(for Cocoa framework)
slouken@1361
   932
        have_cocoa=no
slouken@1361
   933
        AC_TRY_COMPILE([
slouken@1361
   934
          #import <Cocoa/Cocoa.h>
slouken@1361
   935
        ],[
slouken@1361
   936
        ],[
slouken@1361
   937
        have_cocoa=yes
slouken@1361
   938
        ])
slouken@1361
   939
        AC_MSG_RESULT($have_cocoa)
slouken@1361
   940
        CFLAGS="$save_CFLAGS"
slouken@1361
   941
        if test x$have_cocoa = xyes; then
slouken@1361
   942
            AC_DEFINE(SDL_VIDEO_DRIVER_QUARTZ)
slouken@1361
   943
            SOURCES="$SOURCES $srcdir/src/video/quartz/*.m"
slouken@1361
   944
            have_video=yes
slouken@1361
   945
        fi
slouken@1361
   946
    fi
slouken@1361
   947
}
slouken@1361
   948
slouken@0
   949
dnl Find the framebuffer console includes
slouken@0
   950
CheckFBCON()
slouken@0
   951
{
slouken@0
   952
    AC_ARG_ENABLE(video-fbcon,
slouken@1361
   953
AC_HELP_STRING([--enable-video-fbcon], [use framebuffer console video driver [default=yes]]),
slouken@0
   954
                  , enable_video_fbcon=yes)
slouken@0
   955
    if test x$enable_video = xyes -a x$enable_video_fbcon = xyes; then
slouken@0
   956
        AC_MSG_CHECKING(for framebuffer console support)
slouken@0
   957
        video_fbcon=no
slouken@0
   958
        AC_TRY_COMPILE([
slouken@0
   959
         #include <linux/fb.h>
slouken@0
   960
         #include <linux/kd.h>
slouken@0
   961
         #include <linux/keyboard.h>
slouken@0
   962
        ],[
slouken@0
   963
        ],[
slouken@0
   964
        video_fbcon=yes
slouken@0
   965
        ])
slouken@0
   966
        AC_MSG_RESULT($video_fbcon)
slouken@0
   967
        if test x$video_fbcon = xyes; then
slouken@1361
   968
            AC_DEFINE(SDL_VIDEO_DRIVER_FBCON)
slouken@1361
   969
            SOURCES="$SOURCES $srcdir/src/video/fbcon/*.c"
slouken@1361
   970
            have_video=yes
slouken@0
   971
        fi
slouken@0
   972
    fi
slouken@0
   973
}
slouken@0
   974
slouken@167
   975
dnl Find DirectFB
slouken@167
   976
CheckDirectFB()
slouken@167
   977
{
slouken@167
   978
    AC_ARG_ENABLE(video-directfb,
slouken@1361
   979
AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [default=no]]),
slouken@678
   980
                  , enable_video_directfb=no)
slouken@167
   981
    if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
slouken@167
   982
        video_directfb=no
slouken@167
   983
slouken@167
   984
        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
slouken@167
   985
        if test x$PKG_CONFIG = xno ; then
slouken@167
   986
            AC_MSG_WARN([*** pkg-config is required to build the DirectFB video driver.])
slouken@167
   987
        else
slouken@167
   988
            AC_MSG_CHECKING(for DirectFB support)
slouken@167
   989
slouken@477
   990
            if ! $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then
slouken@477
   991
                AC_MSG_ERROR([*** pkg-config too old; version 0.7 or better required.])
slouken@167
   992
            fi
slouken@167
   993
slouken@546
   994
            DIRECTFB_REQUIRED_VERSION=0.9.15
slouken@167
   995
slouken@167
   996
            if $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb ; then
slouken@167
   997
                DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
slouken@167
   998
                DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
slouken@167
   999
                video_directfb=yes
slouken@167
  1000
            fi
slouken@167
  1001
        fi
slouken@167
  1002
slouken@167
  1003
        AC_MSG_RESULT($video_directfb)
slouken@167
  1004
        if test x$video_directfb = xyes; then
slouken@1361
  1005
            AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB)
slouken@1361
  1006
            SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
slouken@1521
  1007
            EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"
slouken@1521
  1008
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
slouken@1361
  1009
            have_video=yes
slouken@167
  1010
        fi
slouken@167
  1011
    fi
slouken@167
  1012
}
slouken@167
  1013
slouken@70
  1014
dnl See if we're running on PlayStation 2 hardware
slouken@70
  1015
CheckPS2GS()
slouken@70
  1016
{
slouken@72
  1017
    AC_ARG_ENABLE(video-ps2gs,
slouken@1361
  1018
AC_HELP_STRING([--enable-video-ps2gs], [use PlayStation 2 GS video driver [default=yes]]),
slouken@72
  1019
                  , enable_video_ps2gs=yes)
slouken@70
  1020
    if test x$enable_video = xyes -a x$enable_video_ps2gs = xyes; then
slouken@72
  1021
        AC_MSG_CHECKING(for PlayStation 2 GS support)
slouken@70
  1022
        video_ps2gs=no
slouken@70
  1023
        AC_TRY_COMPILE([
slouken@70
  1024
         #include <linux/ps2/dev.h>
slouken@70
  1025
         #include <linux/ps2/gs.h>
slouken@70
  1026
        ],[
slouken@70
  1027
        ],[
slouken@70
  1028
        video_ps2gs=yes
slouken@70
  1029
        ])
slouken@72
  1030
        AC_MSG_RESULT($video_ps2gs)
slouken@70
  1031
        if test x$video_ps2gs = xyes; then
slouken@1361
  1032
            AC_DEFINE(SDL_VIDEO_DRIVER_PS2GS)
slouken@1361
  1033
            SOURCES="$SOURCES $srcdir/src/video/ps2gs/*.c"
slouken@1361
  1034
            have_video=yes
slouken@70
  1035
        fi
slouken@70
  1036
    fi
slouken@70
  1037
}
slouken@70
  1038
slouken@0
  1039
dnl Find the GGI includes
slouken@0
  1040
CheckGGI()
slouken@0
  1041
{
slouken@0
  1042
    AC_ARG_ENABLE(video-ggi,
slouken@1361
  1043
AC_HELP_STRING([--enable-video-ggi], [use GGI video driver [default=no]]),
slouken@0
  1044
                  , enable_video_ggi=no)
slouken@0
  1045
    if test x$enable_video = xyes -a x$enable_video_ggi = xyes; then
slouken@0
  1046
        AC_MSG_CHECKING(for GGI support)
slouken@0
  1047
        video_ggi=no
slouken@0
  1048
        AC_TRY_COMPILE([
slouken@0
  1049
         #include <ggi/ggi.h>
slouken@0
  1050
         #include <ggi/gii.h>
slouken@0
  1051
        ],[
slouken@0
  1052
        ],[
slouken@0
  1053
        video_ggi=yes
slouken@0
  1054
        ])
slouken@0
  1055
        AC_MSG_RESULT($video_ggi)
slouken@0
  1056
        if test x$video_ggi = xyes; then
slouken@1361
  1057
            AC_DEFINE(SDL_VIDEO_DRIVER_GGI)
slouken@1361
  1058
            SOURCES="$SOURCES $srcdir/src/video/ggi/*.c"
slouken@1521
  1059
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lggi -lgii -lgg"
slouken@1361
  1060
            have_video=yes
slouken@0
  1061
        fi
slouken@0
  1062
    fi
slouken@0
  1063
}
slouken@0
  1064
slouken@0
  1065
dnl Find the SVGAlib includes and libraries
slouken@0
  1066
CheckSVGA()
slouken@0
  1067
{
slouken@0
  1068
    AC_ARG_ENABLE(video-svga,
slouken@1361
  1069
AC_HELP_STRING([--enable-video-svga], [use SVGAlib video driver [default=no]]),
slouken@1555
  1070
                  , enable_video_svga=yes)
slouken@0
  1071
    if test x$enable_video = xyes -a x$enable_video_svga = xyes; then
slouken@0
  1072
        AC_MSG_CHECKING(for SVGAlib (1.4.0+) support)
slouken@0
  1073
        video_svga=no
slouken@0
  1074
        AC_TRY_COMPILE([
slouken@0
  1075
         #include <vga.h>
slouken@0
  1076
         #include <vgamouse.h>
slouken@0
  1077
         #include <vgakeyboard.h>
slouken@0
  1078
        ],[
slouken@0
  1079
         if ( SCANCODE_RIGHTWIN && SCANCODE_LEFTWIN ) {
slouken@0
  1080
             exit(0);
slouken@0
  1081
         }
slouken@0
  1082
        ],[
slouken@0
  1083
        video_svga=yes
slouken@0
  1084
        ])
slouken@0
  1085
        AC_MSG_RESULT($video_svga)
slouken@0
  1086
        if test x$video_svga = xyes; then
slouken@1361
  1087
            AC_DEFINE(SDL_VIDEO_DRIVER_SVGALIB)
slouken@1361
  1088
            SOURCES="$SOURCES $srcdir/src/video/svga/*.c"
slouken@1556
  1089
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvga"
slouken@1361
  1090
            have_video=yes
slouken@0
  1091
        fi
slouken@0
  1092
    fi
slouken@0
  1093
}
slouken@0
  1094
slouken@75
  1095
dnl Find the VGL includes and libraries
slouken@75
  1096
CheckVGL()
slouken@75
  1097
{
slouken@75
  1098
    AC_ARG_ENABLE(video-vgl,
slouken@1361
  1099
AC_HELP_STRING([--enable-video-vgl], [use VGL video driver [default=no]]),
slouken@75
  1100
                  , enable_video_vgl=no)
slouken@75
  1101
    if test x$enable_video = xyes -a x$enable_video_vgl = xyes; then
slouken@75
  1102
        AC_MSG_CHECKING(for libVGL support)
slouken@75
  1103
        video_vgl=no
slouken@75
  1104
        AC_TRY_COMPILE([
slouken@75
  1105
         #include <sys/fbio.h>
slouken@75
  1106
         #include <sys/consio.h>
slouken@75
  1107
         #include <sys/kbio.h>
slouken@75
  1108
         #include <vgl.h>
slouken@75
  1109
        ],[
slouken@75
  1110
         VGLBitmap bitmap;
slouken@144
  1111
         exit(bitmap.Bitmap);
slouken@75
  1112
        ],[
slouken@75
  1113
        video_vgl=yes
slouken@75
  1114
        ])
slouken@75
  1115
        AC_MSG_RESULT($video_vgl)
slouken@75
  1116
        if test x$video_vgl = xyes; then
slouken@1361
  1117
            AC_DEFINE(SDL_VIDEO_DRIVER_VGL)
slouken@1361
  1118
            SOURCES="$SOURCES $srcdir/src/video/vgl/*.c"
slouken@1521
  1119
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvgl"
slouken@1361
  1120
            have_video=yes
slouken@75
  1121
        fi
slouken@75
  1122
    fi
slouken@75
  1123
}
slouken@75
  1124
slouken@1361
  1125
dnl Set up the wscons video driver if enabled
slouken@1361
  1126
CheckWscons()
slouken@1361
  1127
{
slouken@1361
  1128
    AC_ARG_ENABLE(video-wscons,
slouken@1361
  1129
AC_HELP_STRING([--enable-video-wscons], [use wscons video driver [default=yes]]),
slouken@1361
  1130
                  , enable_video_wscons=yes)
slouken@1361
  1131
    if test x$enable_video = xyes -a x$enable_video_wscons = xyes; then
slouken@1361
  1132
        AC_MSG_CHECKING(for wscons support)
slouken@1361
  1133
        video_wscons=no
slouken@1361
  1134
        AC_TRY_COMPILE([
slouken@1361
  1135
       #include <sys/time.h>
slouken@1361
  1136
       #include <dev/wscons/wsconsio.h>
slouken@1361
  1137
        ],[
slouken@1361
  1138
        ],[
slouken@1361
  1139
        video_wscons=yes
slouken@1361
  1140
        ])
slouken@1361
  1141
        AC_MSG_RESULT($video_wscons)
slouken@1361
  1142
        if test x$video_wscons = xyes; then
slouken@1361
  1143
            AC_DEFINE(SDL_VIDEO_DRIVER_WSCONS)
slouken@1361
  1144
            SOURCES="$SOURCES $srcdir/src/video/wscons/*.c"
slouken@1361
  1145
            have_video=yes
slouken@1361
  1146
        fi
slouken@1361
  1147
    fi
slouken@1361
  1148
}
slouken@1361
  1149
slouken@1361
  1150
slouken@0
  1151
dnl Find the AAlib includes
slouken@0
  1152
CheckAAlib()
slouken@0
  1153
{
slouken@0
  1154
    AC_ARG_ENABLE(video-aalib,
slouken@1361
  1155
AC_HELP_STRING([--enable-video-aalib], [use AAlib video driver [default=no]]),
slouken@0
  1156
                  , enable_video_aalib=no)
slouken@0
  1157
    if test x$enable_video = xyes -a x$enable_video_aalib = xyes; then
slouken@0
  1158
        AC_MSG_CHECKING(for AAlib support)
slouken@0
  1159
        video_aalib=no
slouken@0
  1160
        AC_TRY_COMPILE([
slouken@0
  1161
         #include <aalib.h>
slouken@0
  1162
        ],[
slouken@0
  1163
        ],[
slouken@0
  1164
        video_aalib=yes
slouken@0
  1165
        ])
slouken@0
  1166
        AC_MSG_RESULT($video_aalib)
slouken@0
  1167
        if test x$video_aalib = xyes; then
slouken@1361
  1168
            AC_DEFINE(SDL_VIDEO_DRIVER_AALIB)
slouken@1361
  1169
            SOURCES="$SOURCES $srcdir/src/video/aalib/*.c"
slouken@1521
  1170
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -laa"
slouken@1361
  1171
            have_video=yes
slouken@0
  1172
        fi
slouken@0
  1173
    fi
slouken@0
  1174
}
slouken@0
  1175
slouken@1361
  1176
dnl Set up the QTopia video driver if enabled
slouken@1361
  1177
CheckQtopia()
slouken@1361
  1178
{
slouken@1361
  1179
    AC_ARG_ENABLE(video-qtopia,
slouken@1361
  1180
AC_HELP_STRING([--enable-video-qtopia], [use Qtopia video driver [default=no]]),
slouken@1361
  1181
                  , enable_video_qtopia=no)
slouken@1361
  1182
    if test x$enable_video = xyes -a x$enable_video_qtopia = xyes; then
slouken@1361
  1183
        AC_MSG_CHECKING(for Qtopia support)
slouken@1361
  1184
        video_qtopia=no
slouken@1361
  1185
        QTOPIA_FLAGS="-DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -I${QPEDIR}/include -I${QTDIR}/include/ -DNO_DEBUG -fno-rtti -fno-exceptions"
slouken@1361
  1186
        AC_LANG_CPLUSPLUS
slouken@1361
  1187
        OLD_CXX="$CXXFLAGS"
slouken@1361
  1188
        CXXFLAGS="$QTOPIA_FLAGS"
slouken@1361
  1189
        AC_TRY_COMPILE([
slouken@1361
  1190
         #include <qpe/qpeapplication.h>
slouken@1361
  1191
        ],[
slouken@1361
  1192
        ],[
slouken@1361
  1193
        video_qtopia=yes
slouken@1361
  1194
        ])
slouken@1361
  1195
        CXXFLAGS="$OLD_CXX"
slouken@1361
  1196
        AC_MSG_RESULT($video_qtopia)
slouken@1361
  1197
        if test x$video_qtopia = xyes; then
slouken@1361
  1198
            AC_DEFINE(SDL_VIDEO_DRIVER_QTOPIA)
slouken@1361
  1199
            SOURCES="$SOURCES $srcdir/src/video/qtopia/*.cc"
slouken@1397
  1200
            SDLMAIN_SOURCES="$srcdir/src/main/qtopia/*.cc"
slouken@1521
  1201
            EXTRA_CFLAGS="$EXTRA_CFLAGS $QTOPIA_FLAGS"
slouken@1361
  1202
            SDL_CFLAGS="$SDL_CFLAGS -DQWS -Dmain=SDL_main"
slouken@1361
  1203
            SDL_LIBS="-lSDLmain $SDL_LIBS -L${QPEDIR}/lib -L${QTDIR}/lib/ -lqpe -lqte"
slouken@1361
  1204
            have_video=yes
slouken@1361
  1205
        fi
slouken@1361
  1206
        AC_LANG_C
slouken@1361
  1207
    fi
slouken@1361
  1208
}
slouken@1361
  1209
slouken@1361
  1210
dnl Set up the PicoGUI video driver if enabled
slouken@1361
  1211
CheckPicoGUI()
slouken@1361
  1212
{
slouken@1361
  1213
    AC_ARG_ENABLE(video-picogui,
slouken@1361
  1214
AC_HELP_STRING([--enable-video-picogui], [use PicoGUI video driver [default=no]]),
slouken@1361
  1215
                  , enable_video_picogui=no)
slouken@1361
  1216
    if test x$enable_video = xyes -a x$enable_video_picogui = xyes; then
slouken@1361
  1217
        AC_MSG_CHECKING(for PicoGUI support)
slouken@1361
  1218
        video_picogui=no
slouken@1361
  1219
        AC_TRY_COMPILE([
slouken@1361
  1220
         #include <picogui.h>
slouken@1361
  1221
        ],[
slouken@1361
  1222
        ],[
slouken@1361
  1223
        video_picogui=yes
slouken@1361
  1224
        ])
slouken@1361
  1225
        AC_MSG_RESULT($video_picogui)
slouken@1361
  1226
        if test x$video_picogui = xyes; then
slouken@1361
  1227
            AC_DEFINE(SDL_VIDEO_DRIVER_PICOGUI)
slouken@1361
  1228
            SOURCES="$SOURCES $srcdir/src/video/picogui/*.c"
slouken@1361
  1229
            SDL_LIBS="$SDL_LIBS -lpgui"
slouken@1361
  1230
            have_video=yes
slouken@1361
  1231
        fi
slouken@1361
  1232
    fi
slouken@1361
  1233
}
slouken@1361
  1234
slouken@1361
  1235
dnl Set up the Atari Bios keyboard driver
slouken@1361
  1236
CheckAtariBiosEvent()
slouken@1361
  1237
{
slouken@1361
  1238
    SOURCES="$SOURCES $srcdir/src/video/ataricommon/*.c"
patmandin@1477
  1239
    SOURCES="$SOURCES $srcdir/src/video/ataricommon/*.S"
slouken@1361
  1240
}
slouken@1361
  1241
slouken@281
  1242
dnl Set up the Atari Xbios driver
slouken@281
  1243
CheckAtariXbiosVideo()
slouken@281
  1244
{
slouken@281
  1245
    AC_ARG_ENABLE(xbios,
slouken@1361
  1246
AC_HELP_STRING([--enable-video-xbios], [use Atari Xbios video driver [default=yes]]),
slouken@281
  1247
                  , enable_video_xbios=yes)
slouken@281
  1248
    video_xbios=no
slouken@281
  1249
    if test x$enable_video = xyes -a x$enable_video_xbios = xyes; then
slouken@281
  1250
        video_xbios=yes
slouken@1361
  1251
        AC_DEFINE(SDL_VIDEO_DRIVER_XBIOS)
slouken@1361
  1252
        SOURCES="$SOURCES $srcdir/src/video/xbios/*.c"
slouken@1361
  1253
        have_video=yes
slouken@281
  1254
    fi
slouken@281
  1255
}
slouken@281
  1256
slouken@281
  1257
dnl Set up the Atari Gem driver
slouken@281
  1258
CheckAtariGemVideo()
slouken@281
  1259
{
slouken@281
  1260
    AC_ARG_ENABLE(gem,
slouken@1361
  1261
AC_HELP_STRING([--enable-video-gem], [use Atari Gem video driver [default=yes]]),
slouken@281
  1262
                  , enable_video_gem=yes)
slouken@281
  1263
    if test x$enable_video = xyes -a x$enable_video_gem = xyes; then
slouken@281
  1264
        video_gem=no
slouken@281
  1265
        AC_CHECK_HEADER(gem.h, have_gem_hdr=yes)
slouken@281
  1266
        AC_CHECK_LIB(gem, appl_init, have_gem_lib=yes)
slouken@281
  1267
        if test x$have_gem_hdr = xyes -a x$have_gem_lib = xyes; then
slouken@1366
  1268
            video_gem=yes
slouken@1361
  1269
            AC_DEFINE(SDL_VIDEO_DRIVER_GEM)
slouken@1361
  1270
            SOURCES="$SOURCES $srcdir/src/video/gem/*.c"
slouken@1521
  1271
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lgem"
slouken@1361
  1272
            have_video=yes
slouken@281
  1273
        fi
slouken@281
  1274
    fi
slouken@281
  1275
}
slouken@281
  1276
slouken@1
  1277
dnl rcg04172001 Set up the Null video driver.
slouken@1
  1278
CheckDummyVideo()
slouken@1
  1279
{
slouken@1
  1280
    AC_ARG_ENABLE(video-dummy,
slouken@1361
  1281
AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [default=yes]]),
slouken@86
  1282
                  , enable_video_dummy=yes)
slouken@1
  1283
    if test x$enable_video_dummy = xyes; then
slouken@1361
  1284
        AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY)
slouken@1361
  1285
        SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
slouken@1361
  1286
        have_video=yes
slouken@1
  1287
    fi
slouken@1
  1288
}
slouken@1
  1289
slouken@0
  1290
dnl Check to see if OpenGL support is desired
slouken@0
  1291
AC_ARG_ENABLE(video-opengl,
slouken@1361
  1292
AC_HELP_STRING([--enable-video-opengl], [include OpenGL context creation [default=yes]]),
slouken@0
  1293
              , enable_video_opengl=yes)
slouken@0
  1294
slouken@0
  1295
dnl Find OpenGL
icculus@1191
  1296
CheckOpenGLX11()
slouken@0
  1297
{
slouken@0
  1298
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@0
  1299
        AC_MSG_CHECKING(for OpenGL (GLX) support)
slouken@0
  1300
        video_opengl=no
slouken@0
  1301
        AC_TRY_COMPILE([
slouken@0
  1302
         #include <GL/gl.h>
slouken@0
  1303
         #include <GL/glx.h>
slouken@0
  1304
        ],[
slouken@0
  1305
        ],[
slouken@0
  1306
        video_opengl=yes
slouken@0
  1307
        ])
slouken@0
  1308
        AC_MSG_RESULT($video_opengl)
slouken@0
  1309
        if test x$video_opengl = xyes; then
slouken@1361
  1310
            AC_DEFINE(SDL_VIDEO_OPENGL)
slouken@1361
  1311
            AC_DEFINE(SDL_VIDEO_OPENGL_GLX)
slouken@0
  1312
        fi
slouken@0
  1313
    fi
slouken@0
  1314
}
slouken@0
  1315
slouken@279
  1316
dnl Find QNX RtP OpenGL
slouken@279
  1317
CheckOpenGLQNX()
slouken@279
  1318
{
slouken@279
  1319
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@279
  1320
        AC_MSG_CHECKING(for OpenGL (Photon) support)
slouken@279
  1321
        video_opengl=no
slouken@279
  1322
        AC_TRY_COMPILE([
slouken@279
  1323
         #include <GL/gl.h>
slouken@279
  1324
        ],[
slouken@279
  1325
        ],[
slouken@279
  1326
        video_opengl=yes
slouken@279
  1327
        ])
slouken@279
  1328
        AC_MSG_RESULT($video_opengl)
slouken@279
  1329
        if test x$video_opengl = xyes; then
slouken@1361
  1330
            AC_DEFINE(SDL_VIDEO_OPENGL)
slouken@1521
  1331
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
slouken@279
  1332
        fi
slouken@279
  1333
    fi
slouken@279
  1334
}
slouken@279
  1335
slouken@1361
  1336
dnl Check for Win32 OpenGL
slouken@1361
  1337
CheckWIN32GL()
slouken@1361
  1338
{
slouken@1361
  1339
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@1361
  1340
        AC_DEFINE(SDL_VIDEO_OPENGL)
slouken@1361
  1341
        AC_DEFINE(SDL_VIDEO_OPENGL_WGL)
slouken@1361
  1342
    fi
slouken@1361
  1343
}
slouken@1361
  1344
slouken@0
  1345
dnl Check for BeOS OpenGL
slouken@0
  1346
CheckBeGL()
slouken@0
  1347
{
slouken@0
  1348
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@1361
  1349
        AC_DEFINE(SDL_VIDEO_OPENGL)
slouken@1521
  1350
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
slouken@0
  1351
    fi
slouken@0
  1352
}
slouken@0
  1353
slouken@0
  1354
dnl Check for MacOS OpenGL
slouken@0
  1355
CheckMacGL()
slouken@0
  1356
{
slouken@0
  1357
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@1361
  1358
        AC_DEFINE(SDL_VIDEO_OPENGL)
slouken@1550
  1359
        case "$host" in
slouken@0
  1360
            *-*-darwin*)
slouken@1521
  1361
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -framework OpenGL"
icculus@1133
  1362
                # The following is probably not available in Darwin:
slouken@1521
  1363
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -framework AGL"
slouken@0
  1364
        esac
slouken@0
  1365
    fi
slouken@0
  1366
}
slouken@0
  1367
patmandin@978
  1368
dnl Check for Mesa offscreen rendering
patmandin@989
  1369
CheckAtariOSMesa()
patmandin@978
  1370
{
patmandin@989
  1371
    if test "x$enable_video" = "xyes" -a "x$enable_video_opengl" = "xyes"; then
patmandin@991
  1372
        AC_CHECK_HEADER(GL/osmesa.h, have_osmesa_hdr=yes)
patmandin@991
  1373
        AC_CHECK_LIB(OSMesa, OSMesaCreateContext, have_osmesa_lib=yes, have_osmesa_lib=no, -lm)
patmandin@991
  1374
patmandin@991
  1375
        # Static linking to -lOSMesa
patmandin@989
  1376
        AC_PATH_PROG(OSMESA_CONFIG, osmesa-config, no)
patmandin@989
  1377
        if test "x$OSMESA_CONFIG" = "xno" -o "x$enable_atari_ldg" = "xno"; then
patmandin@991
  1378
            # -lOSMesa is really the static library
patmandin@989
  1379
            if test "x$have_osmesa_hdr" = "xyes" -a "x$have_osmesa_lib" = "xyes"; then
slouken@1361
  1380
                OSMESA_LIBS="-lOSMesa"
patmandin@989
  1381
            fi
patmandin@989
  1382
        else
patmandin@991
  1383
            # -lOSMesa is a loader for OSMesa.ldg
patmandin@989
  1384
            OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags`
patmandin@989
  1385
            OSMESA_LIBS=`$OSMESA_CONFIG --libs`
patmandin@978
  1386
        fi
slouken@1361
  1387
        AC_DEFINE(SDL_VIDEO_OPENGL)
slouken@1361
  1388
        AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA)
slouken@1521
  1389
        EXTRA_CFLAGS="$EXTRA_CFLAGS $OSMESA_CFLAGS"
slouken@1521
  1390
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS $OSMESA_LIBS"
patmandin@991
  1391
patmandin@991
  1392
        AC_ARG_ENABLE(osmesa-shared,
slouken@1361
  1393
AC_HELP_STRING([--enable-osmesa-shared], [dynamically load OSMesa OpenGL support [default=yes]]),
patmandin@991
  1394
                              , enable_osmesa_shared=yes)
patmandin@991
  1395
        if test "x$enable_osmesa_shared" = "xyes" -a "x$enable_atari_ldg" = "xyes"; then
patmandin@991
  1396
            # Dynamic linking
patmandin@991
  1397
            if test "x$have_osmesa_hdr" = "xyes"; then
slouken@1361
  1398
                AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA_DYNAMIC)
patmandin@991
  1399
            fi
slouken@1361
  1400
        fi
patmandin@978
  1401
    fi
patmandin@978
  1402
}
patmandin@978
  1403
slouken@0
  1404
dnl See if we can use the new unified event interface in Linux 2.4
slouken@0
  1405
CheckInputEvents()
slouken@0
  1406
{
slouken@0
  1407
    dnl Check for Linux 2.4 unified input event interface support
slouken@0
  1408
    AC_ARG_ENABLE(input-events,
slouken@1361
  1409
AC_HELP_STRING([--enable-input-events], [use Linux 2.4 unified input interface [default=yes]]),
slouken@211
  1410
                  , enable_input_events=yes)
slouken@0
  1411
    if test x$enable_input_events = xyes; then
slouken@0
  1412
        AC_MSG_CHECKING(for Linux 2.4 unified input interface)
slouken@0
  1413
        use_input_events=no
slouken@0
  1414
        AC_TRY_COMPILE([
slouken@0
  1415
          #include <linux/input.h>
slouken@0
  1416
        ],[
slouken@0
  1417
          #ifndef EVIOCGNAME
slouken@0
  1418
          #error EVIOCGNAME() ioctl not available
slouken@0
  1419
          #endif
slouken@0
  1420
        ],[
slouken@0
  1421
        use_input_events=yes
slouken@0
  1422
        ])
slouken@0
  1423
        AC_MSG_RESULT($use_input_events)
slouken@0
  1424
        if test x$use_input_events = xyes; then
slouken@1361
  1425
            AC_DEFINE(SDL_INPUT_LINUXEV)
slouken@0
  1426
        fi
slouken@0
  1427
    fi
slouken@0
  1428
}
slouken@0
  1429
icculus@1201
  1430
dnl See if we can use the Touchscreen input library
icculus@1201
  1431
CheckTslib()
icculus@1201
  1432
{
icculus@1201
  1433
    AC_ARG_ENABLE(input-tslib,
slouken@1361
  1434
AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [default=yes]]),
icculus@1201
  1435
                  , enable_input_tslib=yes)
icculus@1201
  1436
    if test x$enable_input_tslib = xyes; then
icculus@1201
  1437
        AC_MSG_CHECKING(for Touchscreen library support)
icculus@1201
  1438
        enable_input_tslib=no
icculus@1201
  1439
        AC_TRY_COMPILE([
icculus@1201
  1440
          #include "tslib.h"
icculus@1201
  1441
        ],[
icculus@1201
  1442
        ],[
icculus@1201
  1443
        enable_input_tslib=yes
icculus@1201
  1444
        ])
icculus@1201
  1445
        AC_MSG_RESULT($enable_input_tslib)
icculus@1201
  1446
        if test x$enable_input_tslib = xyes; then
slouken@1361
  1447
            AC_DEFINE(SDL_INPUT_TSLIB)
slouken@1521
  1448
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
icculus@1201
  1449
        fi
icculus@1201
  1450
    fi
icculus@1201
  1451
}
icculus@1201
  1452
slouken@399
  1453
dnl See if we can use GNU pth library for threads
slouken@399
  1454
CheckPTH()
slouken@399
  1455
{
slouken@399
  1456
    dnl Check for pth support
slouken@399
  1457
    AC_ARG_ENABLE(pth,
slouken@1361
  1458
AC_HELP_STRING([--enable-pth], [use GNU pth library for multi-threading [default=yes]]),
slouken@399
  1459
                  , enable_pth=yes)
slouken@399
  1460
    if test x$enable_threads = xyes -a x$enable_pth = xyes; then
slouken@399
  1461
        AC_PATH_PROG(PTH_CONFIG, pth-config, no)
slouken@399
  1462
        if test "$PTH_CONFIG" = "no"; then
slouken@399
  1463
            use_pth=no
slouken@399
  1464
        else
slouken@399
  1465
            use_pth=yes
slouken@399
  1466
        fi
slouken@399
  1467
        AC_MSG_CHECKING(pth)
slouken@1361
  1468
        AC_MSG_RESULT($use_pth)
slouken@399
  1469
        if test "x$use_pth" = xyes; then
slouken@1361
  1470
            AC_DEFINE(SDL_THREAD_PTH)
slouken@1361
  1471
            SOURCES="$SOURCES $srcdir/src/thread/pth/*.c"
slouken@1361
  1472
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
slouken@1361
  1473
            SDL_CFLAGS="$SDL_CFLAGS `$PTH_CONFIG --cflags`"
slouken@1361
  1474
            SDL_LIBS="$SDL_LIBS `$PTH_CONFIG --libs --all`"
slouken@1361
  1475
            have_threads=yes
slouken@399
  1476
        fi
slouken@399
  1477
    fi
slouken@399
  1478
}
slouken@399
  1479
slouken@0
  1480
dnl See what type of thread model to use on Linux and Solaris
slouken@0
  1481
CheckPTHREAD()
slouken@0
  1482
{
slouken@0
  1483
    dnl Check for pthread support
slouken@0
  1484
    AC_ARG_ENABLE(pthreads,
slouken@1361
  1485
AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [default=yes]]),
slouken@0
  1486
                  , enable_pthreads=yes)
slouken@0
  1487
    dnl This is used on Linux for glibc binary compatibility (Doh!)
slouken@0
  1488
    AC_ARG_ENABLE(pthread-sem,
slouken@1361
  1489
AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [default=yes]]),
slouken@0
  1490
                  , enable_pthread_sem=yes)
slouken@1550
  1491
    case "$host" in
slouken@1324
  1492
        *-*-linux*)
slouken@1361
  1493
            pthread_cflags="-D_REENTRANT"
slouken@1324
  1494
            pthread_lib="-lpthread"
slouken@1324
  1495
            ;;
slouken@0
  1496
        *-*-bsdi*)
slouken@0
  1497
            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
slouken@0
  1498
            pthread_lib=""
slouken@0
  1499
            ;;
slouken@0
  1500
        *-*-darwin*)
slouken@0
  1501
            pthread_cflags="-D_THREAD_SAFE"
slouken@0
  1502
# causes Carbon.p complaints?
slouken@0
  1503
#            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
slouken@0
  1504
            ;;
slouken@1565
  1505
        *-*-freebsd*|*-*-dragonfly*)
slouken@0
  1506
            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
slouken@0
  1507
            pthread_lib="-pthread"
slouken@0
  1508
            ;;
slouken@43
  1509
        *-*-netbsd*)
slouken@1383
  1510
            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
icculus@1200
  1511
            pthread_lib="-L/usr/lib -lpthread"
slouken@43
  1512
            ;;
slouken@0
  1513
        *-*-openbsd*)
slouken@0
  1514
            pthread_cflags="-D_REENTRANT"
slouken@0
  1515
            pthread_lib="-pthread"
slouken@0
  1516
            ;;
slouken@0
  1517
        *-*-solaris*)
slouken@0
  1518
            pthread_cflags="-D_REENTRANT"
slouken@0
  1519
            pthread_lib="-lpthread -lposix4"
slouken@0
  1520
            ;;
slouken@0
  1521
        *-*-sysv5*)
slouken@0
  1522
            pthread_cflags="-D_REENTRANT -Kthread"
slouken@0
  1523
            pthread_lib=""
slouken@0
  1524
            ;;
slouken@0
  1525
        *-*-irix*)
slouken@0
  1526
            pthread_cflags="-D_SGI_MP_SOURCE"
slouken@0
  1527
            pthread_lib="-lpthread"
slouken@0
  1528
            ;;
slouken@0
  1529
        *-*-aix*)
slouken@0
  1530
            pthread_cflags="-D_REENTRANT -mthreads"
slouken@0
  1531
            pthread_lib="-lpthread"
slouken@0
  1532
            ;;
icculus@425
  1533
        *-*-hpux11*)
icculus@425
  1534
            pthread_cflags="-D_REENTRANT"
icculus@425
  1535
            pthread_lib="-L/usr/lib -lpthread"
icculus@425
  1536
            ;;
slouken@0
  1537
        *-*-qnx*)
slouken@0
  1538
            pthread_cflags=""
slouken@0
  1539
            pthread_lib=""
slouken@0
  1540
            ;;
slouken@873
  1541
        *-*-osf*)
slouken@1019
  1542
            pthread_cflags="-D_REENTRANT"
slouken@873
  1543
            if test x$ac_cv_prog_gcc = xyes; then
slouken@873
  1544
                pthread_lib="-lpthread -lrt"
slouken@873
  1545
            else
slouken@1019
  1546
                pthread_lib="-lpthread -lexc -lrt"
slouken@873
  1547
            fi
slouken@873
  1548
            ;;
slouken@0
  1549
        *)
slouken@0
  1550
            pthread_cflags="-D_REENTRANT"
slouken@0
  1551
            pthread_lib="-lpthread"
slouken@0
  1552
            ;;
slouken@0
  1553
    esac
icculus@1140
  1554
    if test x$enable_threads = xyes -a x$enable_pthreads = xyes -a x$enable_ipod != xyes; then
slouken@415
  1555
        # Save the original compiler flags and libraries
slouken@415
  1556
        ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
slouken@415
  1557
        # Add the pthread compiler flags and libraries
slouken@415
  1558
        CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
slouken@415
  1559
        # Check to see if we have pthread support on this system
slouken@0
  1560
        AC_MSG_CHECKING(for pthreads)
slouken@0
  1561
        use_pthreads=no
slouken@0
  1562
        AC_TRY_LINK([
slouken@0
  1563
         #include <pthread.h>
slouken@0
  1564
        ],[
slouken@0
  1565
         pthread_attr_t type;
slouken@0
  1566
         pthread_attr_init(&type);
slouken@0
  1567
        ],[
slouken@0
  1568
        use_pthreads=yes
slouken@0
  1569
        ])
slouken@0
  1570
        AC_MSG_RESULT($use_pthreads)
slouken@415
  1571
        # Restore the compiler flags and libraries
slouken@415
  1572
        CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
slouken@1361
  1573
slouken@415
  1574
        # Do futher testing if we have pthread support...
slouken@0
  1575
        if test x$use_pthreads = xyes; then
slouken@1361
  1576
            AC_DEFINE(SDL_THREAD_PTHREAD)
slouken@1521
  1577
            EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
slouken@1521
  1578
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
slouken@0
  1579
            SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
slouken@0
  1580
            SDL_LIBS="$SDL_LIBS $pthread_lib"
slouken@0
  1581
slouken@1438
  1582
            # Save the original compiler flags and libraries
slouken@1438
  1583
            ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
slouken@1438
  1584
            # Add the pthread compiler flags and libraries
slouken@1438
  1585
            CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
slouken@1438
  1586
slouken@0
  1587
            # Check to see if recursive mutexes are available
slouken@0
  1588
            AC_MSG_CHECKING(for recursive mutexes)
slouken@0
  1589
            has_recursive_mutexes=no
slouken@1324
  1590
            if test x$has_recursive_mutexes = xno; then
slouken@1324
  1591
                AC_TRY_COMPILE([
slouken@1324
  1592
                  #include <pthread.h>
slouken@1324
  1593
                ],[
slouken@1324
  1594
                  pthread_mutexattr_t attr;
slouken@1324
  1595
                  pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
slouken@1324
  1596
                ],[
slouken@1324
  1597
                has_recursive_mutexes=yes
slouken@1361
  1598
                AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX)
slouken@1324
  1599
                ])
slouken@1324
  1600
            fi
slouken@1324
  1601
            if test x$has_recursive_mutexes = xno; then
slouken@1324
  1602
                AC_TRY_COMPILE([
slouken@1324
  1603
                  #include <pthread.h>
slouken@1324
  1604
                ],[
slouken@1324
  1605
                  pthread_mutexattr_t attr;
slouken@1324
  1606
                  pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
slouken@1324
  1607
                ],[
slouken@1324
  1608
                has_recursive_mutexes=yes
slouken@1361
  1609
                AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP)
slouken@1324
  1610
                ])
slouken@1324
  1611
            fi
slouken@0
  1612
            AC_MSG_RESULT($has_recursive_mutexes)
slouken@0
  1613
slouken@94
  1614
            # Check to see if pthread semaphore support is missing
slouken@94
  1615
            if test x$enable_pthread_sem = xyes; then
slouken@94
  1616
                AC_MSG_CHECKING(for pthread semaphores)
slouken@94
  1617
                have_pthread_sem=no
slouken@94
  1618
                AC_TRY_COMPILE([
slouken@94
  1619
                  #include <pthread.h>
slouken@94
  1620
                  #include <semaphore.h>
slouken@94
  1621
                ],[
slouken@94
  1622
                ],[
slouken@94
  1623
                have_pthread_sem=yes
slouken@94
  1624
                ])
slouken@94
  1625
                AC_MSG_RESULT($have_pthread_sem)
slouken@94
  1626
            fi
slouken@94
  1627
slouken@1438
  1628
            # Restore the compiler flags and libraries
slouken@1438
  1629
            CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
slouken@1438
  1630
slouken@1361
  1631
            # Basic thread creation functions
slouken@1361
  1632
            SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
slouken@0
  1633
slouken@1361
  1634
            # Semaphores
slouken@1361
  1635
            # We can fake these with mutexes and condition variables if necessary
slouken@1361
  1636
            if test x$have_pthread_sem = xyes; then
slouken@1361
  1637
                SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
slouken@1361
  1638
            else
slouken@1361
  1639
                SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
slouken@1361
  1640
            fi
slouken@0
  1641
slouken@1361
  1642
            # Mutexes
slouken@1361
  1643
            # We can fake these with semaphores if necessary
slouken@1361
  1644
            SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
slouken@0
  1645
slouken@1361
  1646
            # Condition variables
slouken@1361
  1647
            # We can fake these with semaphores and mutexes if necessary
slouken@1361
  1648
            SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
slouken@399
  1649
slouken@1361
  1650
            have_threads=yes
slouken@185
  1651
        else
slouken@1361
  1652
            CheckPTH
slouken@814
  1653
        fi
slouken@814
  1654
    fi
slouken@814
  1655
}
slouken@814
  1656
slouken@0
  1657
dnl Determine whether the compiler can produce Win32 executables
slouken@0
  1658
CheckWIN32()
slouken@0
  1659
{
slouken@0
  1660
    AC_MSG_CHECKING(Win32 compiler)
slouken@0
  1661
    have_win32_gcc=no
slouken@0
  1662
    AC_TRY_COMPILE([
slouken@0
  1663
     #include <windows.h>
slouken@0
  1664
    ],[
slouken@0
  1665
    ],[
slouken@0
  1666
    have_win32_gcc=yes
slouken@0
  1667
    ])
slouken@0
  1668
    AC_MSG_RESULT($have_win32_gcc)
slouken@0
  1669
    if test x$have_win32_gcc != xyes; then
slouken@0
  1670
       AC_MSG_ERROR([
slouken@0
  1671
*** Your compiler ($CC) does not produce Win32 executables!
slouken@0
  1672
       ])
slouken@0
  1673
    fi
slouken@0
  1674
slouken@0
  1675
    dnl See if the user wants to redirect standard output to files
slouken@0
  1676
    AC_ARG_ENABLE(stdio-redirect,
slouken@1361
  1677
AC_HELP_STRING([--enable-stdio-redirect], [Redirect STDIO to files on Win32 [default=yes]]),
slouken@0
  1678
                  , enable_stdio_redirect=yes)
slouken@0
  1679
    if test x$enable_stdio_redirect != xyes; then
slouken@1521
  1680
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DNO_STDIO_REDIRECT"
slouken@1361
  1681
    fi
slouken@1361
  1682
slouken@1361
  1683
    if test x$enable_video = xyes; then
slouken@1361
  1684
        AC_DEFINE(SDL_VIDEO_DRIVER_WINDIB)
slouken@1361
  1685
        SOURCES="$SOURCES $srcdir/src/video/wincommon/*.c"
slouken@1361
  1686
        SOURCES="$SOURCES $srcdir/src/video/windib/*.c"
slouken@1361
  1687
        have_video=yes
slouken@0
  1688
    fi
slouken@0
  1689
}
slouken@0
  1690
slouken@0
  1691
dnl Find the DirectX includes and libraries
slouken@0
  1692
CheckDIRECTX()
slouken@0
  1693
{
slouken@0
  1694
    AC_ARG_ENABLE(directx,
slouken@1361
  1695
AC_HELP_STRING([--enable-directx], [use DirectX for Win32 audio/video [default=yes]]),
slouken@0
  1696
                  , enable_directx=yes)
slouken@0
  1697
    if test x$enable_directx = xyes; then
slouken@1361
  1698
        have_directx=no
slouken@1361
  1699
        AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
slouken@1361
  1700
        AC_CHECK_HEADER(dsound.h, have_dsound=yes)
slouken@1361
  1701
        AC_CHECK_HEADER(dinput.h, use_dinput=yes)
slouken@1361
  1702
        if test x$have_ddraw = xyes -a x$have_dsound = xyes -a x$use_dinput = xyes; then
slouken@1361
  1703
            have_directx=yes
slouken@1361
  1704
        fi
slouken@1361
  1705
        if test x$enable_video = xyes -a x$have_directx = xyes; then
slouken@1361
  1706
            AC_DEFINE(SDL_VIDEO_DRIVER_DDRAW)
slouken@1361
  1707
            SOURCES="$SOURCES $srcdir/src/video/windx5/*.c"
slouken@1361
  1708
            have_video=yes
slouken@1361
  1709
        fi
slouken@0
  1710
    fi
slouken@158
  1711
}
slouken@158
  1712
slouken@294
  1713
dnl Check for the dlfcn.h interface for dynamically loading objects
slouken@294
  1714
CheckDLOPEN()
slouken@294
  1715
{
slouken@731
  1716
    AC_ARG_ENABLE(sdl-dlopen,
slouken@1361
  1717
AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [default=yes]]),
slouken@731
  1718
                  , enable_sdl_dlopen=yes)
slouken@731
  1719
    if test x$enable_sdl_dlopen = xyes; then
slouken@294
  1720
        AC_MSG_CHECKING(for dlopen)
slouken@1361
  1721
        have_dlopen=no
slouken@294
  1722
        AC_TRY_COMPILE([
slouken@294
  1723
         #include <dlfcn.h>
slouken@294
  1724
        ],[
slouken@294
  1725
        ],[
slouken@1361
  1726
        have_dlopen=yes
slouken@294
  1727
        ])
slouken@1361
  1728
        AC_MSG_RESULT($have_dlopen)
slouken@294
  1729
slouken@1361
  1730
        if test x$have_dlopen = xyes; then
slouken@1521
  1731
            AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
slouken@1521
  1732
               AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
slouken@1521
  1733
                  AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
slouken@1361
  1734
            AC_CHECK_LIB(dl, dlvsym, have_dlvsym=yes)
slouken@1361
  1735
            if test x$have_dlvsym = xyes; then
slouken@1361
  1736
                AC_DEFINE(HAVE_DLVSYM)
slouken@1361
  1737
            fi
slouken@1361
  1738
            AC_DEFINE(SDL_LOADSO_DLOPEN)
slouken@1361
  1739
            SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
slouken@1361
  1740
            have_loadso=yes
slouken@294
  1741
        fi
slouken@294
  1742
    fi
slouken@294
  1743
}
slouken@294
  1744
patmandin@651
  1745
dnl Set up the Atari LDG (shared object loader)
patmandin@651
  1746
CheckAtariLdg()
patmandin@651
  1747
{
patmandin@651
  1748
    AC_ARG_ENABLE(atari-ldg,
slouken@1361
  1749
AC_HELP_STRING([--enable-atari-ldg], [use Atari LDG for shared object loading [default=yes]]),
patmandin@651
  1750
                  , enable_atari_ldg=yes)
patmandin@651
  1751
    if test x$video_gem = xyes -a x$enable_atari_ldg = xyes; then
patmandin@651
  1752
        AC_CHECK_HEADER(ldg.h, have_ldg_hdr=yes)
patmandin@651
  1753
        AC_CHECK_LIB(ldg, ldg_open, have_ldg_lib=yes, have_ldg_lib=no, -lgem)
patmandin@651
  1754
        if test x$have_ldg_hdr = xyes -a x$have_ldg_lib = xyes; then
slouken@1361
  1755
            AC_DEFINE(SDL_LOADSO_LDG)
slouken@1361
  1756
            SOURCES="$SOURCES $srcdir/src/loadso/mint/*.c"
slouken@1521
  1757
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lldg -lgem"
icculus@1173
  1758
            have_loadso=yes
patmandin@651
  1759
        fi
patmandin@651
  1760
    fi
patmandin@651
  1761
}
patmandin@651
  1762
slouken@381
  1763
dnl Check for the usbhid(3) library on *BSD
slouken@381
  1764
CheckUSBHID()
slouken@381
  1765
{
slouken@381
  1766
    if test x$enable_joystick = xyes; then
slouken@1565
  1767
        AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
slouken@1565
  1768
        if test x$have_libusbhid = xyes; then
slouken@1565
  1769
            AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
slouken@1565
  1770
            AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
slouken@1565
  1771
            USB_LIBS="$USB_LIBS -lusbhid"
slouken@1565
  1772
        else
slouken@1565
  1773
            AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
slouken@1565
  1774
            AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
slouken@1565
  1775
            AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
slouken@1565
  1776
        fi
slouken@1361
  1777
            
slouken@1361
  1778
        save_CFLAGS="$CFLAGS"
slouken@1361
  1779
        CFLAGS="$CFLAGS $USB_CFLAGS"
slouken@381
  1780
slouken@381
  1781
        AC_MSG_CHECKING(for usbhid)
slouken@381
  1782
        have_usbhid=no
slouken@381
  1783
        AC_TRY_COMPILE([
slouken@404
  1784
          #include <sys/types.h>
slouken@403
  1785
          #if defined(HAVE_USB_H)
slouken@403
  1786
          #include <usb.h>
slouken@403
  1787
          #endif
slouken@1565
  1788
          #ifdef __DragonFly__
slouken@1565
  1789
          # include <bus/usb/usb.h>
slouken@1565
  1790
          # include <bus/usb/usbhid.h>
slouken@1565
  1791
          #else
slouken@1565
  1792
          # include <dev/usb/usb.h>
slouken@1565
  1793
          # include <dev/usb/usbhid.h>
slouken@1565
  1794
          #endif
slouken@381
  1795
          #if defined(HAVE_USBHID_H)
slouken@381
  1796
          #include <usbhid.h>
slouken@381
  1797
          #elif defined(HAVE_LIBUSB_H)
slouken@381
  1798
          #include <libusb.h>
slouken@381
  1799
          #elif defined(HAVE_LIBUSBHID_H)
slouken@381
  1800
          #include <libusbhid.h>
slouken@404
  1801
          #endif
slouken@381
  1802
        ],[
slouken@381
  1803
          struct report_desc *repdesc;
slouken@381
  1804
          struct usb_ctl_report *repbuf;
slouken@402
  1805
          hid_kind_t hidkind;
slouken@381
  1806
        ],[
slouken@381
  1807
        have_usbhid=yes
slouken@381
  1808
        ])
slouken@381
  1809
        AC_MSG_RESULT($have_usbhid)
slouken@381
  1810
slouken@381
  1811
        if test x$have_usbhid = xyes; then
slouken@381
  1812
            AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
slouken@381
  1813
            have_usbhid_ucr_data=no
slouken@381
  1814
            AC_TRY_COMPILE([
slouken@404
  1815
              #include <sys/types.h>
slouken@404
  1816
              #if defined(HAVE_USB_H)
slouken@404
  1817
              #include <usb.h>
slouken@404
  1818
              #endif
slouken@1565
  1819
              #ifdef __DragonFly__
slouken@1565
  1820
              # include <bus/usb/usb.h>
slouken@1565
  1821
              # include <bus/usb/usbhid.h>
slouken@1565
  1822
              #else
slouken@1565
  1823
              # include <dev/usb/usb.h>
slouken@1565
  1824
              # include <dev/usb/usbhid.h>
slouken@1565
  1825
              #endif
slouken@381
  1826
              #if defined(HAVE_USBHID_H)
slouken@381
  1827
              #include <usbhid.h>
slouken@381
  1828
              #elif defined(HAVE_LIBUSB_H)
slouken@381
  1829
              #include <libusb.h>
slouken@381
  1830
              #elif defined(HAVE_LIBUSBHID_H)
slouken@381
  1831
              #include <libusbhid.h>
slouken@381
  1832
              #endif
slouken@381
  1833
            ],[
slouken@381
  1834
              struct usb_ctl_report buf;
slouken@381
  1835
              if (buf.ucr_data) { }
slouken@381
  1836
            ],[
slouken@381
  1837
            have_usbhid_ucr_data=yes
slouken@381
  1838
            ])
slouken@381
  1839
            if test x$have_usbhid_ucr_data = xyes; then
slouken@1361
  1840
                USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
slouken@381
  1841
            fi
slouken@381
  1842
            AC_MSG_RESULT($have_usbhid_ucr_data)
slouken@407
  1843
            
slouken@1361
  1844
            AC_MSG_CHECKING(for new usbhid API)
slouken@407
  1845
            have_usbhid_new=no
slouken@407
  1846
            AC_TRY_COMPILE([
slouken@407
  1847
              #include <sys/types.h>
slouken@407
  1848
              #if defined(HAVE_USB_H)
slouken@407
  1849
              #include <usb.h>
slouken@407
  1850
              #endif
slouken@407
  1851
              #include <dev/usb/usb.h>
slouken@407
  1852
              #include <dev/usb/usbhid.h>
slouken@407
  1853
              #if defined(HAVE_USBHID_H)
slouken@407
  1854
              #include <usbhid.h>
slouken@407
  1855
              #elif defined(HAVE_LIBUSB_H)
slouken@407
  1856
              #include <libusb.h>
slouken@407
  1857
              #elif defined(HAVE_LIBUSBHID_H)
slouken@407
  1858
              #include <libusbhid.h>
slouken@407
  1859
              #endif
slouken@407
  1860
            ],[
slouken@407
  1861
              report_desc_t d;
slouken@1361
  1862
              hid_start_parse(d, 1, 1);
slouken@407
  1863
            ],[
slouken@407
  1864
            have_usbhid_new=yes
slouken@407
  1865
            ])
slouken@407
  1866
            if test x$have_usbhid_new = xyes; then
slouken@1361
  1867
                USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
slouken@407
  1868
            fi
slouken@407
  1869
            AC_MSG_RESULT($have_usbhid_new)
slouken@381
  1870
slouken@1565
  1871
            AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
slouken@1565
  1872
            have_machine_joystick=no
slouken@1565
  1873
            AC_TRY_COMPILE([
slouken@1565
  1874
              #include <machine/joystick.h>
slouken@1565
  1875
            ],[
slouken@1565
  1876
              struct joystick t;
slouken@1565
  1877
            ],[
slouken@1565
  1878
            have_machine_joystick=yes
slouken@1565
  1879
            ])
slouken@1565
  1880
            if test x$have_machine_joystick = xyes; then
slouken@1565
  1881
                AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H)
slouken@1565
  1882
            fi
slouken@1565
  1883
            AC_MSG_RESULT($have_machine_joystick)
slouken@1565
  1884
slouken@1361
  1885
            AC_DEFINE(SDL_JOYSTICK_USBHID)
slouken@1361
  1886
            SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
slouken@1521
  1887
            EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
slouken@1521
  1888
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
slouken@1361
  1889
            have_joystick=yes
slouken@381
  1890
        fi
slouken@1361
  1891
        CFLAGS="$save_CFLAGS"
slouken@381
  1892
    fi
slouken@381
  1893
}
slouken@381
  1894
slouken@1565
  1895
slouken@1361
  1896
dnl Check for clock_gettime()
slouken@1361
  1897
CheckClockGettime()
slouken@795
  1898
{
slouken@1361
  1899
    AC_ARG_ENABLE(clock_gettime,
slouken@1361
  1900
AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [default=no]]),
slouken@1361
  1901
                  , enable_clock_gettime=no)
slouken@1361
  1902
    if test x$enable_clock_gettime = xyes; then
slouken@1361
  1903
        AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
slouken@1361
  1904
        if test x$have_clock_gettime = xyes; then
slouken@1361
  1905
            AC_DEFINE(HAVE_CLOCK_GETTIME)
slouken@1521
  1906
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
icculus@1175
  1907
        fi
slouken@795
  1908
    fi
slouken@795
  1909
}
slouken@795
  1910
slouken@1062
  1911
dnl Check for a valid linux/version.h
slouken@1062
  1912
CheckLinuxVersion()
slouken@1062
  1913
{
slouken@1062
  1914
    AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
slouken@1062
  1915
    if test x$have_linux_version_h = xyes; then
slouken@1521
  1916
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
slouken@1062
  1917
    fi
slouken@1062
  1918
}
slouken@1062
  1919
slouken@1127
  1920
dnl Check if we want to use RPATH
slouken@1127
  1921
CheckRPATH()
slouken@1127
  1922
{
slouken@1127
  1923
    AC_ARG_ENABLE(rpath,
slouken@1361
  1924
AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [default=yes]]),
slouken@1127
  1925
                  , enable_rpath=yes)
slouken@1127
  1926
}
slouken@1127
  1927
slouken@1550
  1928
dnl Set up the configuration based on the host platform!
slouken@1550
  1929
case "$host" in
slouken@1361
  1930
    arm-*-elf*) # FIXME: Can we get more specific for iPodLinux?
slouken@1361
  1931
        ARCH=linux
slouken@1361
  1932
        CheckDummyVideo
slouken@1361
  1933
        CheckIPod
slouken@1361
  1934
        # Set up files for the timer library
icculus@1140
  1935
        if test x$enable_timers = xyes; then
slouken@1361
  1936
            AC_DEFINE(SDL_TIMER_UNIX)
slouken@1361
  1937
            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
slouken@1361
  1938
            have_timers=yes
icculus@1140
  1939
        fi
slouken@1361
  1940
        ;;
slouken@1565
  1941
    *-*-linux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-irix*|*-*-aix*|*-*-osf*)
slouken@1550
  1942
        case "$host" in
slouken@1361
  1943
            *-*-linux*)         ARCH=linux ;;
slouken@1361
  1944
            *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
slouken@1361
  1945
            *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
slouken@1361
  1946
            *-*-kopenbsd*-gnu)  ARCH=kopenbsd-gnu ;;
slouken@1361
  1947
            *-*-gnu*)           ARCH=gnu ;; # must be last of the gnu variants
slouken@1361
  1948
            *-*-bsdi*)          ARCH=bsdi ;;
slouken@1361
  1949
            *-*-freebsd*)       ARCH=freebsd ;;
slouken@1565
  1950
            *-*-dragonfly*)     ARCH=freebsd ;;
slouken@1361
  1951
            *-*-netbsd*)        ARCH=netbsd ;;
slouken@1361
  1952
            *-*-openbsd*)       ARCH=openbsd ;;
slouken@1361
  1953
            *-*-sysv5*)         ARCH=sysv5 ;;
slouken@1361
  1954
            *-*-solaris*)       ARCH=solaris ;;
slouken@1361
  1955
            *-*-hpux*)          ARCH=hpux ;;
slouken@1361
  1956
            *-*-irix*)          ARCH=irix ;;
slouken@1361
  1957
            *-*-aix*)           ARCH=aix ;;
slouken@1361
  1958
            *-*-osf*)           ARCH=osf ;;
slouken@795
  1959
        esac
slouken@1
  1960
        CheckDummyVideo
slouken@68
  1961
        CheckDiskAudio
icculus@1532
  1962
        CheckDummyAudio
slouken@371
  1963
        CheckDLOPEN
slouken@0
  1964
        CheckNASM
slouken@1361
  1965
        CheckAltivec
slouken@0
  1966
        CheckOSS
slouken@1361
  1967
        CheckDMEDIA
slouken@1438
  1968
        CheckMME
slouken@0
  1969
        CheckALSA
slouken@0
  1970
        CheckARTSC
slouken@0
  1971
        CheckESD
slouken@0
  1972
        CheckNAS
slouken@0
  1973
        CheckX11
slouken@30
  1974
        CheckNANOX
slouken@0
  1975
        CheckFBCON
slouken@167
  1976
        CheckDirectFB
slouken@70
  1977
        CheckPS2GS
slouken@0
  1978
        CheckGGI
slouken@0
  1979
        CheckSVGA
slouken@1361
  1980
        CheckVGL
slouken@1361
  1981
        CheckWscons
slouken@0
  1982
        CheckAAlib
slouken@371
  1983
        CheckQtopia
slouken@433
  1984
        CheckPicoGUI
icculus@1191
  1985
        CheckOpenGLX11
slouken@0
  1986
        CheckInputEvents
icculus@1201
  1987
        CheckTslib
slouken@1361
  1988
        CheckUSBHID
slouken@0
  1989
        CheckPTHREAD
slouken@1361
  1990
        CheckClockGettime
slouken@1062
  1991
        CheckLinuxVersion
slouken@1127
  1992
        CheckRPATH
slouken@1361
  1993
        # Set up files for the audio library
slouken@1361
  1994
        if test x$enable_audio = xyes; then
slouken@1361
  1995
          case $ARCH in
slouken@1565
  1996
            sysv5|solaris|hpux)
slouken@1361
  1997
                AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
slouken@1361
  1998
                SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
slouken@1361
  1999
                have_audio=yes
slouken@1361
  2000
            ;;
slouken@1565
  2001
            netbsd|openbsd)
slouken@1361
  2002
                AC_DEFINE(SDL_AUDIO_DRIVER_OPENBSD)
slouken@1361
  2003
                SOURCES="$SOURCES $srcdir/src/audio/openbsd/*.c"
slouken@1361
  2004
                have_audio=yes
slouken@1361
  2005
            ;;
slouken@1361
  2006
            aix)
slouken@1361
  2007
                AC_DEFINE(SDL_AUDIO_DRIVER_PAUD)
slouken@1361
  2008
                SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
slouken@1361
  2009
                have_audio=yes
slouken@1361
  2010
            ;;
slouken@1361
  2011
          esac
slouken@371
  2012
        fi
slouken@0
  2013
        # Set up files for the joystick library
slouken@0
  2014
        if test x$enable_joystick = xyes; then
slouken@1361
  2015
          case $ARCH in
slouken@1361
  2016
            linux)
slouken@1361
  2017
                AC_DEFINE(SDL_JOYSTICK_LINUX)
slouken@1361
  2018
                SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
slouken@1361
  2019
                have_joystick=yes
slouken@1361
  2020
            ;;
slouken@1361
  2021
          esac
slouken@0
  2022
        fi
slouken@0
  2023
        # Set up files for the cdrom library
slouken@0
  2024
        if test x$enable_cdrom = xyes; then
slouken@1361
  2025
          case $ARCH in
slouken@1361
  2026
            linux|solaris)
slouken@1361
  2027
                AC_DEFINE(SDL_CDROM_LINUX)
slouken@1361
  2028
                SOURCES="$SOURCES $srcdir/src/cdrom/linux/*.c"
slouken@1361
  2029
                have_cdrom=yes
slouken@1361
  2030
            ;;
slouken@1361
  2031
            *freebsd*)
slouken@1361
  2032
                AC_DEFINE(SDL_CDROM_FREEBSD)
slouken@1361
  2033
                SOURCES="$SOURCES $srcdir/src/cdrom/freebsd/*.c"
slouken@1361
  2034
                have_cdrom=yes
slouken@1361
  2035
            ;;
slouken@1383
  2036
            *openbsd*|*netbsd*)
slouken@1361
  2037
                AC_DEFINE(SDL_CDROM_OPENBSD)
slouken@1361
  2038
                SOURCES="$SOURCES $srcdir/src/cdrom/openbsd/*.c"
slouken@1361
  2039
                have_cdrom=yes
slouken@1361
  2040
            ;;
slouken@1361
  2041
            bsdi)
slouken@1361
  2042
                AC_DEFINE(SDL_CDROM_BSDI)
slouken@1361
  2043
                SOURCES="$SOURCES $srcdir/src/cdrom/bsdi/*.c"
slouken@1361
  2044
                have_cdrom=yes
slouken@1361
  2045
            ;;
slouken@1361
  2046
            aix)
slouken@1361
  2047
                AC_DEFINE(SDL_CDROM_AIX)
slouken@1361
  2048
                SOURCES="$SOURCES $srcdir/src/cdrom/aix/*.c"
slouken@1361
  2049
                have_cdrom=yes
slouken@1361
  2050
            ;;
slouken@1361
  2051
            osf)
slouken@1361
  2052
                AC_DEFINE(SDL_CDROM_OSF)
slouken@1361
  2053
                SOURCES="$SOURCES $srcdir/src/cdrom/osf/*.c"
slouken@1361
  2054
                have_cdrom=yes
slouken@1361
  2055
            ;;
slouken@1361
  2056
          esac
slouken@0
  2057
        fi
slouken@0
  2058
        # Set up files for the thread library
slouken@1361
  2059
        if test x$enable_threads = xyes -a x$use_pthreads != xyes -a x$use_pth != xyes -a x$ARCH = xirix; then
slouken@1361
  2060
            AC_DEFINE(SDL_THREAD_SPROC)
slouken@1361
  2061
            SOURCES="$SOURCES $srcdir/src/thread/irix/*.c"
slouken@1361
  2062
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
slouken@1361
  2063
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
slouken@1361
  2064
            have_threads=yes
slouken@0
  2065
        fi
slouken@0
  2066
        # Set up files for the timer library
slouken@0
  2067
        if test x$enable_timers = xyes; then
slouken@1361
  2068
            AC_DEFINE(SDL_TIMER_UNIX)
slouken@1361
  2069
            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
slouken@1361
  2070
            have_timers=yes
slouken@0
  2071
        fi
slouken@0
  2072
        ;;
slouken@0
  2073
    *-*-qnx*)
slouken@0
  2074
        ARCH=qnx
slouken@1
  2075
        CheckDummyVideo
slouken@68
  2076
        CheckDiskAudio
icculus@1532
  2077
        CheckDummyAudio
slouken@886
  2078
        # CheckNASM
slouken@371
  2079
        CheckDLOPEN
slouken@0
  2080
        CheckNAS
slouken@0
  2081
        CheckPHOTON
slouken@0
  2082
        CheckX11
icculus@1191
  2083
        CheckOpenGLX11
slouken@0
  2084
        CheckPTHREAD
slouken@0
  2085
        # Set up files for the audio library
slouken@0
  2086
        if test x$enable_audio = xyes; then
slouken@1361
  2087
            AC_DEFINE(SDL_AUDIO_DRIVER_QNXNTO)
slouken@1361
  2088
            SOURCES="$SOURCES $srcdir/src/audio/nto/*.c"
slouken@1521
  2089
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound"
slouken@1361
  2090
            have_audio=yes
slouken@0
  2091
        fi
slouken@0
  2092
        # Set up files for the cdrom library
slouken@0
  2093
        if test x$enable_cdrom = xyes; then
slouken@1361
  2094
            AC_DEFINE(SDL_CDROM_QNX)
slouken@1361
  2095
            SOURCES="$SOURCES $srcdir/src/cdrom/qnx/*.c"
slouken@1361
  2096
            have_cdrom=yes
slouken@0
  2097
        fi
slouken@0
  2098
        # Set up files for the timer library
slouken@0
  2099
        if test x$enable_timers = xyes; then
slouken@1361
  2100
            AC_DEFINE(SDL_TIMER_UNIX)
slouken@1361
  2101
            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
slouken@1361
  2102
            have_timers=yes
slouken@0
  2103
        fi
slouken@0
  2104
        ;;
slouken@0
  2105
    *-*-cygwin* | *-*-mingw32*)
slouken@0
  2106
        ARCH=win32
slouken@1550
  2107
        if test "$build" != "$host"; then # cross-compiling
slouken@0
  2108
            # Default cross-compile location
slouken@0
  2109
            ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc
slouken@0
  2110
        else
slouken@0
  2111
            # Look for the location of the tools and install there
slouken@750
  2112
            if test "$BUILD_PREFIX" != ""; then
slouken@1
  2113
                ac_default_prefix=$BUILD_PREFIX
slouken@1
  2114
            fi
slouken@0
  2115
        fi
slouken@1
  2116
        CheckDummyVideo
slouken@68
  2117
        CheckDiskAudio
icculus@1532
  2118
        CheckDummyAudio
slouken@0
  2119
        CheckWIN32
slouken@1361
  2120
        CheckWIN32GL
slouken@0
  2121
        CheckDIRECTX
slouken@0
  2122
        CheckNASM
slouken@0
  2123
        # Set up files for the audio library
slouken@0
  2124
        if test x$enable_audio = xyes; then
slouken@1361
  2125
            AC_DEFINE(SDL_AUDIO_DRIVER_WAVEOUT)
slouken@1361
  2126
            SOURCES="$SOURCES $srcdir/src/audio/windib/*.c"
slouken@1361
  2127
            if test x$have_directx = xyes; then
slouken@1361
  2128
                AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND)
slouken@1361
  2129
                SOURCES="$SOURCES $srcdir/src/audio/windx5/*.c"
slouken@0
  2130
            fi
slouken@1361
  2131
            have_audio=yes
slouken@0
  2132
        fi
slouken@0
  2133
        # Set up files for the joystick library
slouken@0
  2134
        if test x$enable_joystick = xyes; then
slouken@1361
  2135
            AC_DEFINE(SDL_JOYSTICK_WINMM)
slouken@1361
  2136
            SOURCES="$SOURCES $srcdir/src/joystick/win32/*.c"
slouken@1361
  2137
            have_joystick=yes
slouken@0
  2138
        fi
slouken@0
  2139
        # Set up files for the cdrom library
slouken@0
  2140
        if test x$enable_cdrom = xyes; then
slouken@1361
  2141
            AC_DEFINE(SDL_CDROM_WIN32)
slouken@1361
  2142
            SOURCES="$SOURCES $srcdir/src/cdrom/win32/*.c"
slouken@1361
  2143
            have_cdrom=yes
slouken@0
  2144
        fi
slouken@0
  2145
        # Set up files for the thread library
slouken@0
  2146
        if test x$enable_threads = xyes; then
slouken@1361
  2147
            AC_DEFINE(SDL_THREAD_WIN32)
slouken@1361
  2148
            SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_sysmutex.c"
slouken@1361
  2149
            SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_syssem.c"
slouken@1361
  2150
            SOURCES="$SOURCES $srcdir/src/thread/win32/SDL_systhread.c"
slouken@1361
  2151
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
slouken@1361
  2152
            have_threads=yes
slouken@0
  2153
        fi
slouken@0
  2154
        # Set up files for the timer library
slouken@0
  2155
        if test x$enable_timers = xyes; then
slouken@1361
  2156
            AC_DEFINE(SDL_TIMER_WIN32)
slouken@1361
  2157
            SOURCES="$SOURCES $srcdir/src/timer/win32/*.c"
slouken@1361
  2158
            have_timers=yes
slouken@1361
  2159
        fi
slouken@1361
  2160
        # Set up files for the shared object loading library
slouken@1361
  2161
        if test x$enable_loadso = xyes; then
slouken@1361
  2162
            AC_DEFINE(SDL_LOADSO_WIN32)
slouken@1361
  2163
            SOURCES="$SOURCES $srcdir/src/loadso/win32/*.c"
slouken@1361
  2164
            have_loadso=yes
slouken@1361
  2165
        fi
slouken@1361
  2166
        # Set up the system libraries we need
slouken@1521
  2167
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm"
slouken@1361
  2168
        if test x$have_directx = xyes; then
slouken@1521
  2169
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldxguid"
slouken@0
  2170
        fi
slouken@0
  2171
        # The Win32 platform requires special setup
slouken@1397
  2172
        SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
slouken@0
  2173
        SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
slouken@1363
  2174
        SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
slouken@0
  2175
        ;;
slouken@0
  2176
    *-*-beos*)
slouken@0
  2177
        ARCH=beos
slouken@0
  2178
        ac_default_prefix=/boot/develop/tools/gnupro
slouken@1
  2179
        CheckDummyVideo
slouken@68
  2180
        CheckDiskAudio
icculus@1532
  2181
        CheckDummyAudio
slouken@0
  2182
        CheckNASM
slouken@0
  2183
        CheckBWINDOW
slouken@0
  2184
        CheckBeGL
slouken@0
  2185
        # Set up files for the audio library
slouken@0
  2186
        if test x$enable_audio = xyes; then
slouken@1361
  2187
            AC_DEFINE(SDL_AUDIO_DRIVER_BAUDIO)
slouken@1361
  2188
            SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc"
slouken@1361
  2189
            have_audio=yes
slouken@0
  2190
        fi
slouken@0
  2191
        # Set up files for the joystick library
slouken@0
  2192
        if test x$enable_joystick = xyes; then
slouken@1361
  2193
            AC_DEFINE(SDL_JOYSTICK_BEOS)
slouken@1361
  2194
            SOURCES="$SOURCES $srcdir/src/joystick/beos/*.cc"
slouken@1361
  2195
            have_joystick=yes
slouken@0
  2196
        fi
slouken@0
  2197
        # Set up files for the cdrom library
slouken@0
  2198
        if test x$enable_cdrom = xyes; then
slouken@1361
  2199
            AC_DEFINE(SDL_CDROM_BEOS)
slouken@1361
  2200
            SOURCES="$SOURCES $srcdir/src/cdrom/beos/*.cc"
slouken@1361
  2201
            have_cdrom=yes
slouken@0
  2202
        fi
slouken@0
  2203
        # Set up files for the thread library
slouken@0
  2204
        if test x$enable_threads = xyes; then
slouken@1361
  2205
            AC_DEFINE(SDL_THREAD_BEOS)
slouken@1361
  2206
            SOURCES="$SOURCES $srcdir/src/thread/beos/*.c"
slouken@1361
  2207
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_sysmutex.c"
slouken@1361
  2208
            SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
slouken@1361
  2209
            have_threads=yes
slouken@0
  2210
        fi
slouken@0
  2211
        # Set up files for the timer library
slouken@0
  2212
        if test x$enable_timers = xyes; then
slouken@1361
  2213
            AC_DEFINE(SDL_TIMER_BEOS)
slouken@1361
  2214
            SOURCES="$SOURCES $srcdir/src/timer/beos/*.c"
slouken@1361
  2215
            have_timers=yes
slouken@1361
  2216
        fi
slouken@1361
  2217
        # Set up files for the shared object loading library
slouken@1361
  2218
        if test x$enable_loadso = xyes; then
slouken@1361
  2219
            AC_DEFINE(SDL_LOADSO_BEOS)
slouken@1361
  2220
            SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c"
slouken@1361
  2221
            have_loadso=yes
slouken@0
  2222
        fi
slouken@1367
  2223
        # The BeOS platform requires special setup.
slouken@1367
  2224
        SOURCES="$srcdir/src/main/beos/*.cc $SOURCES"
slouken@1521
  2225
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
slouken@0
  2226
        ;;
slouken@0
  2227
    *-*-darwin* )
icculus@1133
  2228
        # This could be either full "Mac OS X", or plain "Darwin" which is
slouken@158
  2229
        # just the OS X kernel sans upper layers like Carbon and Cocoa.
icculus@1133
  2230
        # Next line is broken, and a few files below require Mac OS X (full)
slouken@158
  2231
        ARCH=macosx
slouken@1
  2232
        CheckDummyVideo
slouken@68
  2233
        CheckDiskAudio
icculus@1532
  2234
        CheckDummyAudio
slouken@1361
  2235
        CheckDLOPEN
icculus@1133
  2236
        CheckCOCOA
icculus@1133
  2237
        CheckCARBON
icculus@1174
  2238
        CheckX11
slouken@0
  2239
        CheckMacGL
icculus@1191
  2240
        CheckOpenGLX11
slouken@0
  2241
        CheckPTHREAD
icculus@1047
  2242
        CheckAltivec
icculus@1445
  2243
icculus@1445
  2244
        # Need this or things might misbuild on a G3.
slouken@1521
  2245
        EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"
icculus@1445
  2246
slouken@0
  2247
        # Set up files for the audio library
slouken@0
  2248
        if test x$enable_audio = xyes; then
slouken@1361
  2249
            AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO)
slouken@1361
  2250
            SOURCES="$SOURCES $srcdir/src/audio/macosx/*.c"
slouken@1361
  2251
            AC_DEFINE(SDL_AUDIO_DRIVER_SNDMGR)
slouken@1361
  2252
            SOURCES="$SOURCES $srcdir/src/audio/macrom/*.c"
slouken@1361
  2253
            have_audio=yes
slouken@0
  2254
        fi
slouken@0
  2255
        # Set up files for the joystick library
slouken@0
  2256
        if test x$enable_joystick = xyes; then
slouken@1361
  2257
            AC_DEFINE(SDL_JOYSTICK_IOKIT)
slouken@1361
  2258
            SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
slouken@1521
  2259
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -framework IOKit"
slouken@1361
  2260
            have_joystick=yes
slouken@0
  2261
        fi
slouken@0
  2262
        # Set up files for the cdrom library
slouken@0
  2263
        if test x$enable_cdrom = xyes; then
slouken@1361
  2264
            AC_DEFINE(SDL_CDROM_MACOSX)
slouken@1361
  2265
            SOURCES="$SOURCES $srcdir/src/cdrom/macosx/*.c"
slouken@1361
  2266
            have_cdrom=yes
slouken@0
  2267
        fi
slouken@0
  2268
        # Set up files for the timer library
slouken@0
  2269
        if test x$enable_timers = xyes; then
slouken@1361
  2270
            AC_DEFINE(SDL_TIMER_UNIX)
slouken@1361
  2271
            SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
slouken@1361
  2272
            have_timers=yes
slouken@1361
  2273
        fi
slouken@1361
  2274
        # Set up files for the shared object loading library
slouken@1361
  2275
        if test x$enable_loadso = xyes -a x$have_dlopen != xyes; then
slouken@1361
  2276
            AC_DEFINE(SDL_LOADSO_DLCOMPAT)
slouken@1361
  2277
            SOURCES="$SOURCES $srcdir/src/loadso/macosx/*.c"
slouken@1361
  2278
            have_loadso=yes
slouken@0
  2279
        fi
slouken@387
  2280
        # The MacOS X platform requires special setup.
slouken@1397
  2281
        SDLMAIN_SOURCES="$srcdir/src/main/macosx/*.m"
slouken@1521
  2282
        EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
slouken@387
  2283
        SDL_LIBS="-lSDLmain $SDL_LIBS"
icculus@1133
  2284
        if test x$enable_video_cocoa = xyes; then
slouken@1521
  2285
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -framework Cocoa"
icculus@1133
  2286
        fi
icculus@1133
  2287
        if test x$enable_video_carbon = xyes -o x$enable_video_cocoa = xyes; then
icculus@1133
  2288
            # The Cocoa backend still needs Carbon, and the YUV code QuickTime
slouken@1521
  2289
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -framework QuickTime -framework ApplicationServices"
slouken@1521
  2290
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -framework Carbon"
icculus@1133
  2291
        fi
slouken@1361
  2292
        # If either the audio or CD driver is used, add the AudioUnit framework
slouken@1361
  2293
        if test x$enable_audio = xyes -o x$enable_cdrom = xyes; then
slouken@1521
  2294
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -framework AudioToolbox -framework AudioUnit"
slouken@1361
  2295
        fi
slouken@0
  2296
        ;;
slouken@281
  2297
    *-*-mint*)
slouken@281
  2298
        ARCH=mint
slouken@281
  2299
        CheckDummyVideo
slouken@281
  2300
        CheckDiskAudio
icculus@1532
  2301
        CheckDummyAudio
slouken@281
  2302
        CheckAtariBiosEvent
slouken@281
  2303
        CheckAtariXbiosVideo
slouken@281
  2304
        CheckAtariGemVideo
slouken@398
  2305
        CheckAtariAudio
patmandin@651
  2306
        CheckAtariLdg
slouken@1361
  2307
        CheckAtariOSMesa
slouken@281
  2308
        CheckPTH
slouken@281
  2309
        # Set up files for the audio library
slouken@398
  2310
        if test x$enable_threads = xyes -a x$enable_pth = xyes; then
slouken@398
  2311
            if test x$enable_audio = xyes; then
slouken@1361
  2312
                AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO)
slouken@1361
  2313
                SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
slouken@1361
  2314
                have_audio=yes
slouken@398
  2315
            fi
slouken@281
  2316
        fi
slouken@281
  2317
        # Set up files for the joystick library
slouken@281
  2318
        if test x$enable_joystick = xyes; then
slouken@1361
  2319
            AC_DEFINE(SDL_JOYSTICK_MINT)
slouken@1361
  2320
            SOURCES="$SOURCES $srcdir/src/joystick/mint/*.c"
slouken@1361
  2321
            have_joystick=yes
slouken@281
  2322
        fi
slouken@281
  2323
        # Set up files for the cdrom library
slouken@281
  2324
        if test x$enable_cdrom = xyes; then
slouken@1361
  2325
            AC_DEFINE(SDL_CDROM_MINT)
slouken@1361
  2326
            SOURCES="$SOURCES $srcdir/src/cdrom/mint/*.c"
slouken@1361
  2327
            have_cdrom=yes
slouken@281
  2328
        fi
slouken@281
  2329
        # Set up files for the timer library
slouken@281
  2330
        if test x$enable_timers = xyes; then
slouken@557
  2331
            if test x$enable_threads = xyes -a x$enable_pth = xyes; then
slouken@1361
  2332
                AC_DEFINE(SDL_TIMER_UNIX)
slouken@1361
  2333
                SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
slouken@557
  2334
            else
slouken@1361
  2335
                AC_DEFINE(SDL_TIMER_MINT)
slouken@1361
  2336
                SOURCES="$SOURCES $srcdir/src/timer/mint/*.c"
patmandin@1477
  2337
                SOURCES="$SOURCES $srcdir/src/timer/mint/*.S"
slouken@557
  2338
            fi
slouken@1361
  2339
            have_timers=yes
slouken@281
  2340
        fi
slouken@281
  2341
        ;;
slouken@1035
  2342
    *-riscos)
slouken@687
  2343
        ARCH=riscos
slouken@1361
  2344
        CheckOSS
slouken@1361
  2345
        CheckPTHREAD
slouken@955
  2346
        # Set up files for the video library
slouken@955
  2347
        if test x$enable_video = xyes; then
slouken@1361
  2348
            AC_DEFINE(SDL_VIDEO_DRIVER_RISCOS)
slouken@1361
  2349
            SOURCES="$SOURCES $srcdir/src/video/riscos/*.c"
slouken@1459
  2350
            SOURCES="$SOURCES $srcdir/src/video/riscos/*.S"
slouken@1361
  2351
            have_video=yes
slouken@955
  2352
        fi
slouken@955
  2353
        # Set up files for the joystick library
slouken@955
  2354
        if test x$enable_joystick = xyes; then
slouken@1361
  2355
            AC_DEFINE(SDL_JOYSTICK_RISCOS)
slouken@1361
  2356
            SOURCES="$SOURCES $srcdir/src/joystick/riscos/*.c"
slouken@1361
  2357
            have_joystick=yes
slouken@955
  2358
        fi
slouken@955
  2359
        # Set up files for the timer library
slouken@955
  2360
        if test x$enable_timers = xyes; then
slouken@1361
  2361
            AC_DEFINE(SDL_TIMER_RISCOS)
slouken@1361
  2362
            SOURCES="$SOURCES $srcdir/src/timer/riscos/*.c"
slouken@1361
  2363
            have_timers=yes
slouken@955
  2364
        fi
slouken@1361
  2365
        # The RISC OS platform requires special setup.
slouken@1521
  2366
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ljpeg -ltiff -lpng -lz"
slouken@687
  2367
        ;;
slouken@0
  2368
    *)
slouken@1361
  2369
        AC_MSG_ERROR([
slouken@1550
  2370
*** Unsupported host:  Please add to configure.in
slouken@1361
  2371
        ])
slouken@0
  2372
        ;;
slouken@0
  2373
esac
slouken@0
  2374
slouken@1361
  2375
# Verify that we have all the platform specific files we need
slouken@1361
  2376
if test x$have_joystick != xyes; then
slouken@1361
  2377
    if test x$enable_joystick = xyes; then
slouken@1361
  2378
        AC_DEFINE(SDL_JOYSTICK_DISABLED)
slouken@1361
  2379
    fi
slouken@1361
  2380
    SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
slouken@1361
  2381
fi
slouken@1361
  2382
if test x$have_cdrom != xyes; then
slouken@1361
  2383
    if test x$enable_cdrom = xyes; then
slouken@1361
  2384
        AC_DEFINE(SDL_CDROM_DISABLED)
slouken@1361
  2385
    fi
slouken@1361
  2386
    SOURCES="$SOURCES $srcdir/src/cdrom/dummy/*.c"
slouken@1361
  2387
fi
slouken@1361
  2388
if test x$have_threads != xyes; then
slouken@1361
  2389
    if test x$enable_threads = xyes; then
slouken@1361
  2390
        AC_DEFINE(SDL_THREADS_DISABLED)
slouken@1361
  2391
    fi
slouken@1361
  2392
    SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
slouken@1361
  2393
fi
slouken@1361
  2394
if test x$have_timers != xyes; then
slouken@1361
  2395
    if test x$enable_timers = xyes; then
slouken@1361
  2396
        AC_DEFINE(SDL_TIMERS_DISABLED)
slouken@1361
  2397
    fi
slouken@1361
  2398
    SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
slouken@1361
  2399
fi
slouken@1361
  2400
if test x$have_loadso != xyes; then
slouken@1361
  2401
    if test x$enable_loadso = xyes; then
slouken@1361
  2402
        AC_DEFINE(SDL_LOADSO_DISABLED)
slouken@1361
  2403
    fi
slouken@1361
  2404
    SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
slouken@1361
  2405
fi
slouken@1397
  2406
if test x$SDLMAIN_SOURCES = x; then
slouken@1397
  2407
    SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
slouken@1397
  2408
fi
slouken@0
  2409
slouken@1361
  2410
OBJECTS=`echo $SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.asm,$(objects)/\1.lo,g'`
slouken@1361
  2411
OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.lo,g'`
slouken@1361
  2412
OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.lo,g'`
slouken@1361
  2413
OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
slouken@1459
  2414
OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.S,$(objects)/\1.lo,g'`
slouken@0
  2415
slouken@1397
  2416
SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.o,g'`
slouken@1397
  2417
SDLMAIN_OBJECTS=`echo $SDLMAIN_OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.o,g'`
slouken@1397
  2418
SDLMAIN_OBJECTS=`echo $SDLMAIN_OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
slouken@1397
  2419
slouken@0
  2420
# Set runtime shared library paths as needed
slouken@0
  2421
slouken@1127
  2422
if test "x$enable_rpath" = "xyes"; then
slouken@1565
  2423
  if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = irix -o $ARCH = linux -o $ARCH = netbsd; then
slouken@1127
  2424
    SDL_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib"
slouken@1127
  2425
  fi
slouken@1127
  2426
  if test $ARCH = solaris; then
slouken@1127
  2427
    SDL_RLD_FLAGS="-R\${exec_prefix}/lib"
slouken@1127
  2428
  fi
slouken@1127
  2429
else
slouken@1127
  2430
  SDL_RLD_FLAGS=""
slouken@0
  2431
fi
slouken@387
  2432
slouken@387
  2433
case "$ARCH" in
slouken@387
  2434
  macosx)
icculus@1133
  2435
    if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
slouken@1548
  2436
      SDL_LIBS="$SDL_LIBS -framework Cocoa"
icculus@1133
  2437
    fi
icculus@1133
  2438
    if test x$enable_video = xyes -a x$enable_video_carbon = xyes; then
slouken@1548
  2439
      SDL_LIBS="$SDL_LIBS -framework Carbon"
icculus@1133
  2440
    fi
slouken@387
  2441
    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
slouken@1548
  2442
      SDL_LIBS="$SDL_LIBS -framework OpenGL"
slouken@387
  2443
    fi
slouken@807
  2444
    # Evil hack to allow static linking on Mac OS X
slouken@807
  2445
    SDL_STATIC_LIBS="\${exec_prefix}/lib/libSDLmain.a \${exec_prefix}/lib/libSDL.a"
slouken@807
  2446
    ;;
slouken@807
  2447
  *)
slouken@807
  2448
    SDL_STATIC_LIBS="$SDL_LIBS"
slouken@807
  2449
    ;;
slouken@807
  2450
esac
slouken@807
  2451
slouken@0
  2452
dnl Expand the cflags and libraries needed by apps using SDL
slouken@0
  2453
AC_SUBST(SDL_CFLAGS)
slouken@0
  2454
AC_SUBST(SDL_LIBS)
slouken@807
  2455
AC_SUBST(SDL_STATIC_LIBS)
slouken@0
  2456
AC_SUBST(SDL_RLD_FLAGS)
slouken@1361
  2457
if test x$enable_shared = xyes; then
slouken@1361
  2458
    ENABLE_SHARED_TRUE=
slouken@1361
  2459
    ENABLE_SHARED_FALSE="#"
slouken@1361
  2460
else
slouken@1361
  2461
    ENABLE_SHARED_TRUE="#"
slouken@1361
  2462
    ENABLE_SHARED_FALSE=
slouken@1361
  2463
fi
slouken@1361
  2464
if test x$enable_static = xyes; then
slouken@1361
  2465
    ENABLE_STATIC_TRUE=
slouken@1361
  2466
    ENABLE_STATIC_FALSE="#"
slouken@1361
  2467
else
slouken@1361
  2468
    ENABLE_STATIC_TRUE="#"
slouken@1361
  2469
    ENABLE_STATIC_FALSE=
slouken@1361
  2470
fi
slouken@1361
  2471
AC_SUBST(ENABLE_SHARED_TRUE)
slouken@1361
  2472
AC_SUBST(ENABLE_SHARED_FALSE)
slouken@1361
  2473
AC_SUBST(ENABLE_STATIC_TRUE)
slouken@1361
  2474
AC_SUBST(ENABLE_STATIC_FALSE)
slouken@0
  2475
slouken@1361
  2476
dnl Expand the sources and objects needed to build the library
slouken@1361
  2477
AC_SUBST(ac_aux_dir)
slouken@1361
  2478
AC_SUBST(INCLUDE)
slouken@1361
  2479
AC_SUBST(SOURCES)
slouken@1361
  2480
AC_SUBST(OBJECTS)
slouken@1397
  2481
AC_SUBST(SDLMAIN_SOURCES)
slouken@1397
  2482
AC_SUBST(SDLMAIN_OBJECTS)
slouken@1361
  2483
AC_SUBST(BUILD_CFLAGS)
slouken@1521
  2484
AC_SUBST(EXTRA_CFLAGS)
slouken@1393
  2485
AC_SUBST(BUILD_LDFLAGS)
slouken@1521
  2486
AC_SUBST(EXTRA_LDFLAGS)
slouken@0
  2487
slouken@0
  2488
AC_OUTPUT([
slouken@1361
  2489
    Makefile sdl-config SDL.spec SDL.qpg
slouken@1361
  2490
], [
slouken@1361
  2491
    : >build-deps
slouken@1361
  2492
    make depend
slouken@1361
  2493
])