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