Fixes for BeOS and Solaris builds
authorSam Lantinga <slouken@libsdl.org>
Fri, 17 Feb 2006 08:43:23 +0000
changeset 1367 e440d5c488c1
parent 1366 34d9df784d84
child 1368 533567cbb576
Fixes for BeOS and Solaris builds
configure.in
include/SDL_config.h
include/SDL_config.h.in
include/SDL_stdinc.h
src/audio/baudio/SDL_beaudio.cc
src/audio/esd/SDL_esdaudio.c
src/main/Makefile.am
src/main/arch.c
src/video/bwindow/SDL_BWin.h
src/video/bwindow/SDL_sysvideo.cc
test/configure.in
--- a/configure.in	Thu Feb 16 23:32:39 2006 +0000
+++ b/configure.in	Fri Feb 17 08:43:23 2006 +0000
@@ -107,7 +107,7 @@
     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 @@
                     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 @@
                 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 @@
             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* )
--- a/include/SDL_config.h	Thu Feb 16 23:32:39 2006 +0000
+++ b/include/SDL_config.h	Fri Feb 17 08:43:23 2006 +0000
@@ -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 */
-
-/* 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 */
+/* This is the minimal configuration that can be used to build SDL */
 
-/* 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 <stdarg.h>
-#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 */
--- a/include/SDL_config.h.in	Thu Feb 16 23:32:39 2006 +0000
+++ b/include/SDL_config.h.in	Fri Feb 17 08:43:23 2006 +0000
@@ -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
--- a/include/SDL_stdinc.h	Thu Feb 16 23:32:39 2006 +0000
+++ b/include/SDL_stdinc.h	Fri Feb 17 08:43:23 2006 +0000
@@ -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 <alloca.h>
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# ifdef _MSC_VER
+#  include <malloc.h>
+#  define alloca _alloca
 # else
-#  ifdef _AIX
- #pragma alloca
+#  if HAVE_ALLOCA_H
+#   include <alloca.h>
 #  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
--- a/src/audio/baudio/SDL_beaudio.cc	Thu Feb 16 23:32:39 2006 +0000
+++ b/src/audio/baudio/SDL_beaudio.cc	Fri Feb 17 08:43:23 2006 +0000
@@ -24,14 +24,14 @@
 
 #include <SoundPlayer.h>
 
-#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"
 
 
--- a/src/audio/esd/SDL_esdaudio.c	Thu Feb 16 23:32:39 2006 +0000
+++ b/src/audio/esd/SDL_esdaudio.c	Fri Feb 17 08:43:23 2006 +0000
@@ -22,10 +22,7 @@
 
 /* Allow access to an ESD network stream mixing buffer */
 
-#ifdef ESD_SUPPORT
-
 #include <errno.h>
-
 #include <esd.h>
 
 #include "SDL_timer.h"
@@ -320,5 +317,3 @@
 	/* We're ready to rock and roll. :-) */
 	return(0);
 }
-
-#endif /* ESD_SUPPORT */
--- a/src/main/Makefile.am	Thu Feb 16 23:32:39 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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
--- a/src/main/arch.c	Thu Feb 16 23:32:39 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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;
--- a/src/video/bwindow/SDL_BWin.h	Thu Feb 16 23:32:39 2006 +0000
+++ b/src/video/bwindow/SDL_BWin.h	Fri Feb 17 08:43:23 2006 +0000
@@ -23,6 +23,8 @@
 #ifndef _SDL_BWin_h
 #define _SDL_BWin_h
 
+#include "SDL_config.h"
+
 #include <stdio.h>
 #include <AppKit.h>
 #include <InterfaceKit.h>
@@ -32,7 +34,7 @@
 #endif
 #include <support/UTF8.h>
 
-#include "SDL_BeApp.h"
+#include "../../main/beos/SDL_BeApp.h"
 #include "SDL_events.h"
 #include "SDL_BView.h"
 
--- a/src/video/bwindow/SDL_sysvideo.cc	Thu Feb 16 23:32:39 2006 +0000
+++ b/src/video/bwindow/SDL_sysvideo.cc	Fri Feb 17 08:43:23 2006 +0000
@@ -24,15 +24,14 @@
 
 #include <unistd.h>
 
-#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"
--- a/test/configure.in	Thu Feb 16 23:32:39 2006 +0000
+++ b/test/configure.in	Fri Feb 17 08:43:23 2006 +0000
@@ -18,6 +18,8 @@
 
 AC_C_CONST
 
+FIXME: add math library for testsprite
+
 dnl Figure out which math library to use
 case "$target" in
     *-*-cygwin* | *-*-mingw32*)