From e0f42f7ae4cc6cb95160f3415e00dfebd8650a39 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 17 Feb 2006 08:43:23 +0000 Subject: [PATCH] Fixes for BeOS and Solaris builds --- configure.in | 12 +- include/SDL_config.h | 274 +----------------------------- include/SDL_config.h.in | 1 + include/SDL_stdinc.h | 19 ++- src/audio/baudio/SDL_beaudio.cc | 4 +- src/audio/esd/SDL_esdaudio.c | 5 - src/main/Makefile.am | 45 ----- src/main/arch.c | 4 - src/video/bwindow/SDL_BWin.h | 4 +- src/video/bwindow/SDL_sysvideo.cc | 3 +- test/configure.in | 2 + 11 files changed, 38 insertions(+), 335 deletions(-) delete mode 100644 src/main/Makefile.am delete mode 100644 src/main/arch.c diff --git a/configure.in b/configure.in index 0c51e67f4..2251636e4 100644 --- a/configure.in +++ b/configure.in @@ -107,7 +107,7 @@ if test x$enable_libc = xyes; then if test x$ac_cv_func_strtod = xyes; then AC_DEFINE(HAVE_STRTOD) fi - AC_CHECK_FUNCS(malloc calloc realloc free getenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strcpy strncpy strcat strncat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol _i64toa _ui64toa strtoll atoi atof strcmp strncmp stricmp strcasecmp sscanf snprintf vsnprint sigaction setjmp nanosleep) + AC_CHECK_FUNCS(malloc calloc realloc free getenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strcpy strncpy strcat strncat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol _i64toa _ui64toa strtoll atoi atof strcmp strncmp stricmp strcasecmp sscanf snprintf vsnprintf sigaction setjmp nanosleep) fi if test x$have_inttypes != xyes; then @@ -762,8 +762,10 @@ AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [default=yes x11ext_lib='libXext.so' ;; *) - x11_lib='libX11.so.6' - x11ext_lib='libXext.so.6' + x11_lib_spec=`echo $X_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libX11.so.*/'` + x11_lib=`ls $x11_lib_spec | sed 's/.*\/\(.*\)/\1/; q'` + x11ext_lib_spec=`echo $X_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libXext.so.*/'` + x11ext_lib=`ls $x11ext_lib_spec | sed 's/.*\/\(.*\)/\1/; q'` ;; esac @@ -786,7 +788,6 @@ AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [default=yes X_LIBS="$X_LIBS -lX11 -lXext" fi - AC_DEFINE(SDL_VIDEO_DRIVER_X11) SOURCES="$SOURCES $srcdir/src/video/x11/*.c" BUILD_CFLAGS="$BUILD_CFLAGS $X_CFLAGS" @@ -2184,7 +2185,8 @@ case "$target" in SOURCES="$SOURCES $srcdir/src/loadso/beos/*.c" have_loadso=yes fi - # The BeOS platform requires special libraries + # The BeOS platform requires special setup. + SOURCES="$srcdir/src/main/beos/*.cc $SOURCES" BUILD_LIBS="$BUILD_LIBS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding" ;; *-*-darwin* ) diff --git a/include/SDL_config.h b/include/SDL_config.h index 1dd5d702f..67aaa63cc 100644 --- a/include/SDL_config.h +++ b/include/SDL_config.h @@ -1,4 +1,3 @@ -/* include/SDL_config.h. Generated by configure. */ /* SDL - Simple DirectMedia Layer Copyright (C) 1997-2006 Sam Lantinga @@ -24,272 +23,17 @@ #ifndef _SDL_config_h #define _SDL_config_h -/* This is a set of defines to configure the SDL features */ +/* This is the minimal configuration that can be used to build SDL */ -/* C language features */ -/* #undef const */ -/* #undef inline */ -/* #undef volatile */ - -/* C datatypes */ -/* #undef size_t */ -/* #undef int8_t */ -/* #undef uint8_t */ -/* #undef int16_t */ -/* #undef uint16_t */ -/* #undef int32_t */ -/* #undef uint32_t */ -#define SDL_HAS_64BIT_TYPE 1 -/* #undef int64_t */ -/* #undef uint64_t */ -/* #undef uintptr_t */ - -/* Endianness */ -#define SDL_BYTEORDER 1234 - -/* Comment this if you want to build without any C library requirements */ -#define HAVE_LIBC 1 -#ifdef HAVE_LIBC - -/* Useful headers */ -#define HAVE_SYS_TYPES_H 1 -#define HAVE_STDIO_H 1 -#define STDC_HEADERS 1 -#define HAVE_STDLIB_H 1 -#define HAVE_STDARG_H 1 -#define HAVE_MALLOC_H 1 -#define HAVE_MEMORY_H 1 -#define HAVE_STRING_H 1 -#define HAVE_STRINGS_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_STDINT_H 1 -#define HAVE_CTYPE_H 1 -#define HAVE_MATH_H 1 -#define HAVE_SIGNAL_H 1 -/* #undef HAVE_ALTIVEC_H */ - -/* C library functions */ -#define HAVE_MALLOC 1 -#define HAVE_CALLOC 1 -#define HAVE_REALLOC 1 -#define HAVE_FREE 1 -#define HAVE_ALLOCA 1 -#ifndef _WIN32 /* Don't use C runtime versions of these on Windows */ -#define HAVE_GETENV 1 -#define HAVE_PUTENV 1 -#define HAVE_UNSETENV 1 -#endif -#define HAVE_QSORT 1 -#define HAVE_ABS 1 -#define HAVE_BCOPY 1 -#define HAVE_MEMSET 1 -#define HAVE_MEMCPY 1 -#define HAVE_MEMMOVE 1 -#define HAVE_MEMCMP 1 -#define HAVE_STRLEN 1 -#define HAVE_STRCPY 1 -#define HAVE_STRNCPY 1 -#define HAVE_STRCAT 1 -#define HAVE_STRNCAT 1 -#define HAVE_STRDUP 1 -/* #undef HAVE__STRREV */ -/* #undef HAVE__STRUPR */ -/* #undef HAVE__STRLWR */ -/* #undef HAVE_INDEX */ -/* #undef HAVE_RINDEX */ -#define HAVE_STRCHR 1 -#define HAVE_STRRCHR 1 -#define HAVE_STRSTR 1 -/* #undef HAVE_ITOA */ -/* #undef HAVE__LTOA */ -/* #undef HAVE__UITOA */ -/* #undef HAVE__ULTOA */ -#define HAVE_STRTOL 1 -/* #undef HAVE__I64TOA */ -/* #undef HAVE__UI64TOA */ -#define HAVE_STRTOLL 1 -#define HAVE_STRTOD 1 -#define HAVE_ATOI 1 -#define HAVE_ATOF 1 -#define HAVE_STRCMP 1 -#define HAVE_STRNCMP 1 -/* #undef HAVE_STRICMP */ -#define HAVE_STRCASECMP 1 -#define HAVE_SSCANF 1 -#define HAVE_SNPRINTF 1 -/* #undef HAVE_VSNPRINTF */ -#define HAVE_SIGACTION 1 -#define HAVE_SETJMP 1 -#define HAVE_NANOSLEEP 1 -/* #undef HAVE_CLOCK_GETTIME */ -#define HAVE_DLVSYM 1 - -#else -/* We may need some replacement for stdarg.h here */ #include -#endif /* HAVE_LIBC */ - -/* General platform specific identifiers */ -/* #undef TARGET_API_MAC_CARBON */ -/* #undef TARGET_API_MAC_OSX */ - -/* Allow disabling of core subsystems */ -/* #undef SDL_AUDIO_DISABLED */ -/* #undef SDL_CDROM_DISABLED */ -/* #undef SDL_CPUINFO_DISABLED */ -/* #undef SDL_EVENTS_DISABLED */ -/* #undef SDL_FILE_DISABLED */ -/* #undef SDL_JOYSTICK_DISABLED */ -/* #undef SDL_LOADSO_DISABLED */ -/* #undef SDL_THREADS_DISABLED */ -/* #undef SDL_TIMERS_DISABLED */ -/* #undef SDL_VIDEO_DISABLED */ - -/* Enable various audio drivers */ -/* #undef SDL_AUDIO_DRIVER_AHI */ -#define SDL_AUDIO_DRIVER_ALSA 1 -#define SDL_AUDIO_DRIVER_ALSA_DYNAMIC "libasound.so.2" -/* #undef SDL_AUDIO_DRIVER_ARTS */ -/* #undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC */ -/* #undef SDL_AUDIO_DRIVER_BAUDIO */ -/* #undef SDL_AUDIO_DRIVER_COREAUDIO */ -/* #undef SDL_AUDIO_DRIVER_DART */ -/* #undef SDL_AUDIO_DRIVER_DC */ -#define SDL_AUDIO_DRIVER_DISK 1 -/* #undef SDL_AUDIO_DRIVER_DMEDIA */ -/* #undef SDL_AUDIO_DRIVER_DRENDERER */ -/* #undef SDL_AUDIO_DRIVER_DSOUND */ -/* #undef SDL_AUDIO_DRIVER_ESD */ -/* #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC */ -/* #undef SDL_AUDIO_DRIVER_MINT */ -/* #undef SDL_AUDIO_DRIVER_MMEAUDIO */ -/* #undef SDL_AUDIO_DRIVER_NAS */ -/* #undef SDL_AUDIO_DRIVER_OPENBSD */ -#define SDL_AUDIO_DRIVER_OSS 1 -/* #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H */ -/* #undef SDL_AUDIO_DRIVER_PAUD */ -/* #undef SDL_AUDIO_DRIVER_QNXNTO */ -/* #undef SDL_AUDIO_DRIVER_SNDMGR */ -/* #undef SDL_AUDIO_DRIVER_SUNAUDIO */ -/* #undef SDL_AUDIO_DRIVER_WAVEOUT */ - -/* Enable various cdrom drivers */ -/* #undef SDL_CDROM_AIX */ -/* #undef SDL_CDROM_BEOS */ -/* #undef SDL_CDROM_BSDI */ -/* #undef SDL_CDROM_DC */ -/* #undef SDL_CDROM_DUMMY */ -/* #undef SDL_CDROM_FREEBSD */ -#define SDL_CDROM_LINUX 1 -/* #undef SDL_CDROM_MACOS */ -/* #undef SDL_CDROM_MACOSX */ -/* #undef SDL_CDROM_MINT */ -/* #undef SDL_CDROM_OPENBSD */ -/* #undef SDL_CDROM_OS2 */ -/* #undef SDL_CDROM_OSF */ -/* #undef SDL_CDROM_QNX */ -/* #undef SDL_CDROM_WIN32 */ - -/* Enable various input drivers */ -/* #undef SDL_INPUT_TSLIB */ -/* #undef SDL_JOYSTICK_AMIGA */ -/* #undef SDL_JOYSTICK_BEOS */ -/* #undef SDL_JOYSTICK_DC */ -/* #undef SDL_JOYSTICK_DUMMY */ -/* #undef SDL_JOYSTICK_IOKIT */ -#define SDL_JOYSTICK_LINUX 1 -/* #undef SDL_JOYSTICK_LINUXEV */ -/* #undef SDL_JOYSTICK_MACOS */ -/* #undef SDL_JOYSTICK_MINT */ -/* #undef SDL_JOYSTICK_OS2 */ -/* #undef SDL_JOYSTICK_RISCOS */ -/* #undef SDL_JOYSTICK_WINMM */ -/* #undef SDL_JOYSTICK_USBHID */ - -/* Enable various shared object loading systems */ -/* #undef SDL_LOADSO_BEOS */ -/* #undef SDL_LOADSO_DLCOMPAT */ -#define SDL_LOADSO_DLOPEN 1 -/* #undef SDL_LOADSO_LDG */ -/* #undef SDL_LOADSO_MACOS */ -/* #undef SDL_LOADSO_OS2 */ -/* #undef SDL_LOADSO_WIN32 */ - -/* Enable various threading systems */ -/* #undef SDL_THREAD_AMIGA */ -/* #undef SDL_THREAD_BEOS */ -/* #undef SDL_THREAD_DC */ -/* #undef SDL_THREAD_EPOC */ -/* #undef SDL_THREAD_OS2 */ -/* #undef SDL_THREAD_PTH */ -#define SDL_THREAD_PTHREAD 1 -#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 -/* #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP */ -/* #undef SDL_THREAD_SPROC */ -/* #undef SDL_THREAD_WIN32 */ - -/* Enable various timer systems */ -/* #undef SDL_TIMER_AMIGA */ -/* #undef SDL_TIMER_BEOS */ -/* #undef SDL_TIMER_DC */ -/* #undef SDL_TIMER_EPOC */ -/* #undef SDL_TIMER_MACOS */ -/* #undef SDL_TIMER_MINT */ -/* #undef SDL_TIMER_OS2 */ -/* #undef SDL_TIMER_RISCOS */ -#define SDL_TIMER_UNIX 1 -/* #undef SDL_TIMER_WIN32 */ -/* #undef SDL_TIMER_WINCE */ - -/* Enable various video drivers */ -/* #undef SDL_VIDEO_DRIVER_AALIB */ -/* #undef SDL_VIDEO_DRIVER_BWINDOW */ -/* #undef SDL_VIDEO_DRIVER_CYBERGRAPHICS */ -/* #undef SDL_VIDEO_DRIVER_DC */ -/* #undef SDL_VIDEO_DRIVER_DDRAW */ -#define SDL_VIDEO_DRIVER_DGA 1 -/* #undef SDL_VIDEO_DRIVER_DIRECTFB */ -/* #undef SDL_VIDEO_DRIVER_DRAWSPROCKET */ -#define SDL_VIDEO_DRIVER_DUMMY 1 -/* #undef SDL_VIDEO_DRIVER_EPOC */ -#define SDL_VIDEO_DRIVER_FBCON 1 -/* #undef SDL_VIDEO_DRIVER_GAPI */ -/* #undef SDL_VIDEO_DRIVER_GEM */ -/* #undef SDL_VIDEO_DRIVER_GGI */ -/* #undef SDL_VIDEO_DRIVER_IPOD */ -/* #undef SDL_VIDEO_DRIVER_NANOX */ -/* #undef SDL_VIDEO_DRIVER_OS2FS */ -/* #undef SDL_VIDEO_DRIVER_PHOTON */ -/* #undef SDL_VIDEO_DRIVER_PICOGUI */ -/* #undef SDL_VIDEO_DRIVER_PS2GS */ -/* #undef SDL_VIDEO_DRIVER_QTOPIA */ -/* #undef SDL_VIDEO_DRIVER_QUARTZ */ -/* #undef SDL_VIDEO_DRIVER_RISCOS */ -/* #undef SDL_VIDEO_DRIVER_SVGALIB */ -/* #undef SDL_VIDEO_DRIVER_TOOLBOX */ -/* #undef SDL_VIDEO_DRIVER_VGL */ -/* #undef SDL_VIDEO_DRIVER_WINDIB */ -/* #undef SDL_VIDEO_DRIVER_WSCONS */ -#define SDL_VIDEO_DRIVER_X11 1 -#define SDL_VIDEO_DRIVER_X11_DGAMOUSE 1 -#define SDL_VIDEO_DRIVER_X11_DYNAMIC "libX11.so.6" -#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "libXext.so.6" -#define SDL_VIDEO_DRIVER_X11_VIDMODE 1 -#define SDL_VIDEO_DRIVER_X11_XINERAMA 1 -#define SDL_VIDEO_DRIVER_X11_XME 1 -#define SDL_VIDEO_DRIVER_X11_XV 1 -/* #undef SDL_VIDEO_DRIVER_XBIOS */ - -/* Enable OpenGL support */ -#define SDL_VIDEO_OPENGL 1 -#define SDL_VIDEO_OPENGL_GLX 1 -/* #undef SDL_VIDEO_OPENGL_WGL */ -/* #undef SDL_VIDEO_OPENGL_OSMESA */ -/* #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC */ -/* Enable assembly blit routines */ -#define SDL_ASSEMBLY_BLITTERS 1 -#define SDL_HERMES_BLITTERS 1 -/* #undef SDL_ALTIVEC_BLITTERS */ +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef signed short int16_t; +typedef unsigned short uint16_t; +typedef signed int int32_t; +typedef unsigned int uint32_t; +typedef unsigned int size_t; +typedef unsigned long uintptr_t; #endif /* _SDL_config_h */ diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in index 27ef6fde7..e2d904ab5 100644 --- a/include/SDL_config.h.in +++ b/include/SDL_config.h.in @@ -51,6 +51,7 @@ #ifdef HAVE_LIBC /* Useful headers */ +#undef HAVE_ALLOCA_H #undef HAVE_SYS_TYPES_H #undef HAVE_STDIO_H #undef STDC_HEADERS diff --git a/include/SDL_stdinc.h b/include/SDL_stdinc.h index 517f2fd6d..2e5c5e2c4 100644 --- a/include/SDL_stdinc.h +++ b/include/SDL_stdinc.h @@ -28,15 +28,22 @@ #include "SDL_config.h" /* AIX requires this to be the first thing in the file. */ -#ifndef __GNUC__ -# if HAVE_ALLOCA_H -# include +#ifdef __GNUC__ +# define alloca __builtin_alloca +#else +# ifdef _MSC_VER +# include +# define alloca _alloca # else -# ifdef _AIX - #pragma alloca +# if HAVE_ALLOCA_H +# include # else -# ifndef alloca /* predefined by HP cc +Olibcalls */ +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ char *alloca (); +# endif # endif # endif # endif diff --git a/src/audio/baudio/SDL_beaudio.cc b/src/audio/baudio/SDL_beaudio.cc index 9758bc8ab..e42995615 100644 --- a/src/audio/baudio/SDL_beaudio.cc +++ b/src/audio/baudio/SDL_beaudio.cc @@ -24,14 +24,14 @@ #include -#include "SDL_BeApp.h" +#include "../../main/beos/SDL_BeApp.h" extern "C" { #include "SDL_audio.h" #include "../SDL_audio_c.h" #include "../SDL_sysaudio.h" -#include "../../thread/SDL_systhread_c.h" +#include "../../thread/beos/SDL_systhread_c.h" #include "SDL_beaudio.h" diff --git a/src/audio/esd/SDL_esdaudio.c b/src/audio/esd/SDL_esdaudio.c index bd2d9863e..158285a8e 100644 --- a/src/audio/esd/SDL_esdaudio.c +++ b/src/audio/esd/SDL_esdaudio.c @@ -22,10 +22,7 @@ /* Allow access to an ESD network stream mixing buffer */ -#ifdef ESD_SUPPORT - #include - #include #include "SDL_timer.h" @@ -320,5 +317,3 @@ static int ESD_OpenAudio(_THIS, SDL_AudioSpec *spec) /* We're ready to rock and roll. :-) */ return(0); } - -#endif /* ESD_SUPPORT */ diff --git a/src/main/Makefile.am b/src/main/Makefile.am deleted file mode 100644 index 951093d6c..000000000 --- a/src/main/Makefile.am +++ /dev/null @@ -1,45 +0,0 @@ - -## Makefile.am for the main() function in the SDL library -# -# This is necessary because some platforms have special program -# entry points, which require special application initialization. - -# Build a separate library containing the main() entry point. -lib_LIBRARIES = libSDLmain.a - -if TARGET_WIN32 -MAINLIB_ARCH_SRCS = win32/SDL_win32_main.c -else -if TARGET_MACOSX -if USE_COCOA -MAINLIB_ARCH_SRCS = macosx/SDLMain.m macosx/SDLMain.h -else -if USE_CARBON -MAINLIB_ARCH_SRCS = macos/SDL_main.c -endif # USE_CARBON -endif # USE_COCOA -else -if TARGET_QTOPIA -MAINLIB_ARCH_SRCS = qtopia/SDL_qtopia_main.cc -else -MAINLIB_ARCH_SRCS = dummy/SDL_dummy_main.c -endif # !TARGET_QTOPIA -endif # !TARGET_MACOSX -endif # !TARGET_WIN32 -libSDLmain_a_SOURCES = $(MAINLIB_ARCH_SRCS) - -# Build an internal library of any special app setup functions -noinst_LTLIBRARIES = libarch.la - -if TARGET_BEOS -ARCH_SRCS = beos/SDL_BeApp.cc beos/SDL_BeApp.h -else -ARCH_SRCS = arch.c -endif - -libarch_la_SOURCES = $(ARCH_SRCS) - -exports: - for i in $(srcdir)/*; do if [ -d $$i/exports ]; then (cd $$i/exports; make); fi; done - -EXTRA_DIST = beos dummy epoc linux macos macosx qtopia win32 diff --git a/src/main/arch.c b/src/main/arch.c deleted file mode 100644 index 9db09c376..000000000 --- a/src/main/arch.c +++ /dev/null @@ -1,4 +0,0 @@ - -/* This is needed for automake, so that it can build an empty archive */ - -int pointless_symbol_so_the_archive_doesnt_look_empty; diff --git a/src/video/bwindow/SDL_BWin.h b/src/video/bwindow/SDL_BWin.h index 68d43615a..010eb31ff 100644 --- a/src/video/bwindow/SDL_BWin.h +++ b/src/video/bwindow/SDL_BWin.h @@ -23,6 +23,8 @@ #ifndef _SDL_BWin_h #define _SDL_BWin_h +#include "SDL_config.h" + #include #include #include @@ -32,7 +34,7 @@ #endif #include -#include "SDL_BeApp.h" +#include "../../main/beos/SDL_BeApp.h" #include "SDL_events.h" #include "SDL_BView.h" diff --git a/src/video/bwindow/SDL_sysvideo.cc b/src/video/bwindow/SDL_sysvideo.cc index 2a86f50ca..3b9b21e7c 100644 --- a/src/video/bwindow/SDL_sysvideo.cc +++ b/src/video/bwindow/SDL_sysvideo.cc @@ -24,15 +24,14 @@ #include -#include "SDL_BeApp.h" #include "SDL_BWin.h" #include "SDL_timer.h" extern "C" { #include "../SDL_sysvideo.h" -#include "../../events/SDL_sysevents_c.h" #include "../../events/SDL_events_c.h" +#include "SDL_sysevents_c.h" #include "SDL_sysmouse_c.h" #include "SDL_syswm_c.h" #include "SDL_lowvideo.h" diff --git a/test/configure.in b/test/configure.in index 75f910e47..ccad1fd3a 100644 --- a/test/configure.in +++ b/test/configure.in @@ -18,6 +18,8 @@ dnl Check for compiler environment AC_C_CONST +FIXME: add math library for testsprite + dnl Figure out which math library to use case "$target" in *-*-cygwin* | *-*-mingw32*)