configure.in
author Sam Lantinga <slouken@libsdl.org>
Sun, 19 Mar 2006 05:27:22 +0000
changeset 1550 31c2b8e4885e
parent 1548 a77c022733fe
child 1555 780fd5b61df1
permissions -rw-r--r--
Fixed bug #166

From the autoconf obsolete macros documentation:
Macro: AC_CANONICAL_SYSTEM

Determine the system type and set output variables to the names of the canonical system types. See section Getting the Canonical System Type, for details about the variables this macro sets.

The user is encouraged to use either AC_CANONICAL_BUILD, or AC_CANONICAL_HOST, or AC_CANONICAL_TARGET, depending on the needs. Using AC_CANONICAL_TARGET is enough to run the two other macros.

From the documentation for the canonical environments:
case $target in
i386-*-mach* | i386-*-gnu*)
obj_format=aout emulation=mach bfd_gas=yes ;;
i960-*-bout) obj_format=bout ;;
esac

Note that the above example uses $target because it's taken from a tool which can be built on some architecture ($build), run on another ($host), but yet handle data for a third architecture ($target). Such tools are usually part of a compiler suite, they generate code for a specific $target.

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