configure.in
author Ryan C. Gordon <icculus@icculus.org>
Wed, 22 Mar 2006 01:28:36 +0000
changeset 1573 2422ca15ba42
parent 1571 0160eb7cccee
child 1574 0fd72308659e
permissions -rw-r--r--
Added support for gcc4's -fvisibility=hidden option.

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