📄 configure.in
字号:
;;
*-*-freebsd*)
pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
pthread_lib="-pthread"
;;
*-*-netbsd*)
pthread_cflags="-I/usr/pkg/include -D_REENTRANT"
pthread_lib="-L/usr/pkg/lib -lpthread -lsem"
;;
*-*-openbsd*)
pthread_cflags="-D_REENTRANT"
pthread_lib="-pthread"
;;
*-*-solaris*)
pthread_cflags="-D_REENTRANT"
pthread_lib="-lpthread -lposix4"
;;
*-*-sysv5*)
pthread_cflags="-D_REENTRANT -Kthread"
pthread_lib=""
;;
*-*-irix*)
pthread_cflags="-D_SGI_MP_SOURCE"
pthread_lib="-lpthread"
;;
*-*-aix*)
pthread_cflags="-D_REENTRANT -mthreads"
pthread_lib="-lpthread"
;;
*-*-qnx*)
pthread_cflags=""
pthread_lib=""
;;
*)
pthread_cflags="-D_REENTRANT"
pthread_lib="-lpthread"
;;
esac
LIBS="$LIBS $pthread_lib"
if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
AC_MSG_CHECKING(for pthreads)
use_pthreads=no
AC_TRY_LINK([
#include <pthread.h>
],[
pthread_attr_t type;
pthread_attr_init(&type);
],[
use_pthreads=yes
])
AC_MSG_RESULT($use_pthreads)
if test x$use_pthreads = xyes; then
CFLAGS="$CFLAGS $pthread_cflags -DSDL_USE_PTHREADS"
SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
SDL_LIBS="$SDL_LIBS $pthread_lib"
# Check to see if recursive mutexes are available
AC_MSG_CHECKING(for recursive mutexes)
has_recursive_mutexes=no
AC_TRY_LINK([
#include <pthread.h>
],[
pthread_mutexattr_t attr;
#ifdef linux
pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
#else
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
#endif
],[
has_recursive_mutexes=yes
])
# Some systems have broken recursive mutex implementations
case "$target" in
*-*-solaris*)
has_recursive_mutexes=no
;;
esac
AC_MSG_RESULT($has_recursive_mutexes)
if test x$has_recursive_mutexes != xyes; then
CFLAGS="$CFLAGS -DPTHREAD_NO_RECURSIVE_MUTEX"
fi
# Check to see if pthread semaphore support is missing
if test x$enable_pthread_sem = xyes; then
AC_MSG_CHECKING(for pthread semaphores)
have_pthread_sem=no
AC_TRY_COMPILE([
#include <pthread.h>
#include <semaphore.h>
],[
],[
have_pthread_sem=yes
])
AC_MSG_RESULT($have_pthread_sem)
fi
# Check to see if this is broken glibc 2.0 pthreads
case "$target" in
*-*-linux*)
AC_MSG_CHECKING(for broken glibc 2.0 pthreads)
glibc20_pthreads=no
AC_TRY_COMPILE([
#include <features.h>
#if (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0)
#warning Working around a bug in glibc 2.0 pthreads
#else
#error pthread implementation okay
#endif /* glibc 2.0 */
],[
],[
glibc20_pthreads=yes
])
AC_MSG_RESULT($glibc20_pthreads)
esac
fi
fi
LIBS="$ac_save_libs"
AC_MSG_CHECKING(whether semun is defined in /usr/include/sys/sem.h)
have_semun=no
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/sem.h>
],[
union semun t;
],[
have_semun=yes
])
AC_MSG_RESULT($have_semun)
if test x$have_semun = xyes; then
CFLAGS="$CFLAGS -DHAVE_SEMUN"
fi
# See if we can use clone() on Linux directly
use_clone=no
if test x$enable_threads = xyes -a x$use_pthreads != xyes; then
case "$target" in
*-*-linux*)
use_clone=yes
;;
*)
CFLAGS="$CFLAGS -DFORK_HACK"
;;
esac
fi
AM_CONDITIONAL(USE_CLONE, test x$use_clone = xyes)
}
dnl See if we can use GNU pth library for threads
CheckPTH()
{
dnl Check for pth support
AC_ARG_ENABLE(pth,
[ --enable-pth use GNU pth library for multi-threading [default=yes]],
, enable_pth=yes)
if test x$enable_threads = xyes -a x$enable_pth = xyes; then
AC_PATH_PROG(PTH_CONFIG, pth-config, no)
if test "$PTH_CONFIG" = "no"; then
use_pth=no
else
PTH_CFLAGS=`$PTH_CONFIG --cflags`
PTH_LIBS=`$PTH_CONFIG --libs --all`
SDL_CFLAGS="$SDL_CFLAGS $PTH_CFLAGS"
SDL_LIBS="$SDL_LIBS $PTH_LIBS"
CFLAGS="$CFLAGS -DENABLE_PTH"
use_pth=yes
fi
AC_MSG_CHECKING(pth)
if test "x$use_pth" = xyes; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
fi
}
dnl Determine whether the compiler can produce Win32 executables
CheckWIN32()
{
AC_MSG_CHECKING(Win32 compiler)
have_win32_gcc=no
AC_TRY_COMPILE([
#include <windows.h>
],[
],[
have_win32_gcc=yes
])
AC_MSG_RESULT($have_win32_gcc)
if test x$have_win32_gcc != xyes; then
AC_MSG_ERROR([
*** Your compiler ($CC) does not produce Win32 executables!
])
fi
dnl See if the user wants to redirect standard output to files
AC_ARG_ENABLE(stdio-redirect,
[ --enable-stdio-redirect Redirect STDIO to files on Win32 [default=yes]],
, enable_stdio_redirect=yes)
if test x$enable_stdio_redirect != xyes; then
CFLAGS="$CFLAGS -DNO_STDIO_REDIRECT"
fi
}
dnl Find the DirectX includes and libraries
CheckDIRECTX()
{
AC_ARG_ENABLE(directx,
[ --enable-directx use DirectX for Win32 audio/video [default=yes]],
, enable_directx=yes)
if test x$enable_directx = xyes; then
AC_MSG_CHECKING(for DirectX headers and libraries)
use_directx=no
AC_TRY_COMPILE([
#include "src/video/windx5/directx.h"
],[
],[
use_directx=yes
])
AC_MSG_RESULT($use_directx)
fi
AM_CONDITIONAL(USE_DIRECTX, test x$use_directx = xyes)
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video/wincommon"
SYSTEM_LIBS="$SYSTEM_LIBS -luser32 -lgdi32 -lwinmm"
VIDEO_SUBDIRS="$VIDEO_SUBDIRS wincommon"
VIDEO_DRIVERS="$VIDEO_DRIVERS wincommon/libvideo_wincommon.la"
# Enable the DIB driver
CFLAGS="$CFLAGS -DENABLE_WINDIB"
VIDEO_SUBDIRS="$VIDEO_SUBDIRS windib"
VIDEO_DRIVERS="$VIDEO_DRIVERS windib/libvideo_windib.la"
# See if we should enable the DirectX driver
if test x$use_directx = xyes; then
CFLAGS="$CFLAGS -DENABLE_DIRECTX"
SYSTEM_LIBS="$SYSTEM_LIBS -ldxguid"
VIDEO_SUBDIRS="$VIDEO_SUBDIRS windx5"
VIDEO_DRIVERS="$VIDEO_DRIVERS windx5/libvideo_windx5.la"
fi
}
dnl Set up the BWindow video driver on BeOS
CheckBWINDOW()
{
CFLAGS="$CFLAGS -DENABLE_BWINDOW"
VIDEO_SUBDIRS="$VIDEO_SUBDIRS bwindow"
VIDEO_DRIVERS="$VIDEO_DRIVERS bwindow/libvideo_bwindow.la"
}
dnl Set up the Mac toolbox video driver for Mac OS 7-9
CheckTOOLBOX()
{
VIDEO_SUBDIRS="$VIDEO_SUBDIRS maccommon"
VIDEO_DRIVERS="$VIDEO_DRIVERS maccommon/libvideo_maccommon.la"
VIDEO_SUBDIRS="$VIDEO_SUBDIRS macrom"
VIDEO_DRIVERS="$VIDEO_DRIVERS macrom/libvideo_macrom.la"
}
dnl Set up the Mac toolbox video driver for Mac OS X
CheckCARBON()
{
# "MACOSX" is not an official definition, but it's commonly
# accepted as a way to differentiate between what runs on X
# and what runs on older Macs - while in theory "Carbon" defns
# are consistent between the two, in practice Carbon is still
# changing. -sts Aug 2000
mac_autoconf_target_workaround="MAC"
CFLAGS="$CFLAGS -I/System/Library/Frameworks/Carbon.framework/Headers \
-fpascal-strings -DENABLE_TOOLBOX -DMACOSX -DTARGET_API_${mac_autoconf_target_workaround}_CARBON=1 -I\$(top_srcdir)/src/video/maccommon -I\$(top_srcdir)/src/video/macrom -I\$(top_srcdir)/src/video/macdsp"
VIDEO_SUBDIRS="$VIDEO_SUBDIRS maccommon"
VIDEO_DRIVERS="$VIDEO_DRIVERS maccommon/libvideo_maccommon.la"
VIDEO_SUBDIRS="$VIDEO_SUBDIRS macrom"
VIDEO_DRIVERS="$VIDEO_DRIVERS macrom/libvideo_macrom.la"
}
dnl Set up the Mac toolbox video driver for Mac OS X
CheckQUARTZ()
{
# "MACOSX" is not an official definition, but it's commonly
# accepted as a way to differentiate between what runs on X
# and what runs on older Macs - while in theory "Carbon" defns
# are consistent between the two, in practice Carbon is still
# changing. -sts Aug 2000
mac_autoconf_target_workaround="MAC"
CFLAGS="$CFLAGS -I/System/Library/Frameworks/Carbon.framework/Headers \
-I/System/Library/Frameworks/Cocoa.framework/Headers -fpascal-strings \
-DENABLE_QUARTZ -DMACOSX -DTARGET_API_${mac_autoconf_target_workaround}_CARBON=1 -I\$(top_srcdir)/src/video/quartz"
VIDEO_SUBDIRS="$VIDEO_SUBDIRS quartz"
VIDEO_DRIVERS="$VIDEO_DRIVERS quartz/libvideo_quartz.la"
}
dnl Check for the dlfcn.h interface for dynamically loading objects
CheckDLOPEN()
{
AC_ARG_ENABLE(dlopen,
[ --enable-dlopen use dlopen for shared object loading [default=no]],
, enable_dlopen=no)
if test x$enable_dlopen = xyes; then
AC_MSG_CHECKING(for dlopen)
use_dlopen=no
AC_TRY_COMPILE([
#include <dlfcn.h>
],[
],[
use_dlopen=yes
])
AC_MSG_RESULT($use_dlopen)
if test x$use_dlopen = xyes; then
CFLAGS="$CFLAGS -DUSE_DLOPEN"
AC_CHECK_LIB(dl, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS -ldl")
fi
fi
}
case "$target" in
*-*-linux*)
ARCH=linux
CheckDummyVideo
CheckDiskAudio
CheckDLOPEN
CheckNASM
CheckOSS
CheckALSA
CheckARTSC
CheckESD
CheckNAS
CheckX11
CheckNANOX
CheckDGA
CheckFBCON
CheckDirectFB
CheckPS2GS
CheckGGI
CheckSVGA
CheckAAlib
CheckOpenGL
CheckInputEvents
CheckPTHREAD
# Set up files for the main() stub
COPY_ARCH_SRC(src/main, linux, SDL_main.c)
# Set up files for the audio library
# We use the OSS and ALSA API's, not the Sun audio API
#if test x$enable_audio = xyes; then
# CFLAGS="$CFLAGS -DSUNAUDIO_SUPPORT"
# AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun"
# AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la"
#fi
# Set up files for the joystick library
if test x$enable_joystick = xyes; then
JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS linux"
JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS linux/libjoystick_linux.la"
fi
# Set up files for the cdrom library
if test x$enable_cdrom = xyes; then
CDROM_SUBDIRS="$CDROM_SUBDIRS linux"
CDROM_DRIVERS="$CDROM_DRIVERS linux/libcdrom_linux.la"
fi
# Set up files for the thread library
if test x$enable_threads = xyes; then
if test x$use_pthreads != xyes; then
COPY_ARCH_SRC(src/thread, linux, clone.S)
fi
COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c)
COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h)
if test x$use_pthreads = xyes -a x$have_pthread_sem != xyes; then
COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c)
else
COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c)
fi
COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h)
if test x$glibc20_pthreads = xyes; then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -