Commit ee5429fd authored by Sam Lantinga's avatar Sam Lantinga

Fixed Solaris nitpicks (thanks Mattias!)

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40167
parent b29480bd
...@@ -1196,20 +1196,14 @@ CheckQUARTZ() ...@@ -1196,20 +1196,14 @@ CheckQUARTZ()
# and what runs on older Macs - while in theory "Carbon" defns # and what runs on older Macs - while in theory "Carbon" defns
# are consistent between the two, in practice Carbon is still # are consistent between the two, in practice Carbon is still
# changing. -sts Aug 2000 # changing. -sts Aug 2000
mac_autoconf_target_workaround="MAC"
CFLAGS="$CFLAGS -I/System/Library/Frameworks/Carbon.framework/Headers \ CFLAGS="$CFLAGS -I/System/Library/Frameworks/Carbon.framework/Headers \
-I/System/Library/Frameworks/Cocoa.framework/Headers -fpascal-strings \ -I/System/Library/Frameworks/Cocoa.framework/Headers -fpascal-strings \
-DENABLE_QUARTZ -DMACOSX -DTARGET_API_MAC_CARBON=1 -I\$(top_srcdir)/src/video/quartz" -DENABLE_QUARTZ -DMACOSX -DTARGET_API_${mac_autoconf_target_workaround}_CARBON=1 -I\$(top_srcdir)/src/video/quartz"
VIDEO_SUBDIRS="$VIDEO_SUBDIRS quartz" VIDEO_SUBDIRS="$VIDEO_SUBDIRS quartz"
VIDEO_DRIVERS="$VIDEO_DRIVERS quartz/libvideo_quartz.la" VIDEO_DRIVERS="$VIDEO_DRIVERS quartz/libvideo_quartz.la"
} }
dnl Set up the kernel statistics library for Solaris
CheckKSTAT()
{
CFLAGS="$CFLAGS -DHAVE_KSTAT"
SYSTEM_LIBS="$SYSTEM_LIBS -lkstat"
}
case "$target" in case "$target" in
*-*-linux*) *-*-linux*)
ARCH=linux ARCH=linux
...@@ -1516,7 +1510,6 @@ case "$target" in ...@@ -1516,7 +1510,6 @@ case "$target" in
CheckAAlib CheckAAlib
CheckOpenGL CheckOpenGL
CheckPTHREAD CheckPTHREAD
CheckKSTAT
# Set up files for the main() stub # Set up files for the main() stub
COPY_ARCH_SRC(src/main, linux, SDL_main.c) COPY_ARCH_SRC(src/main, linux, SDL_main.c)
# Set up files for the audio library # Set up files for the audio library
...@@ -1566,7 +1559,6 @@ case "$target" in ...@@ -1566,7 +1559,6 @@ case "$target" in
CheckAAlib CheckAAlib
CheckOpenGL CheckOpenGL
CheckPTHREAD CheckPTHREAD
CheckKSTAT
# Set up files for the main() stub # Set up files for the main() stub
COPY_ARCH_SRC(src/main, linux, SDL_main.c) COPY_ARCH_SRC(src/main, linux, SDL_main.c)
# Set up files for the audio library # Set up files for the audio library
......
...@@ -47,7 +47,7 @@ typedef signed int Sint32; ...@@ -47,7 +47,7 @@ typedef signed int Sint32;
/* Figure out how to support 64-bit datatypes */ /* Figure out how to support 64-bit datatypes */
#if !defined(__STRICT_ANSI__) #if !defined(__STRICT_ANSI__)
#if defined(__GNUC__) || defined(__MWERKS__) /* MJS */ #if defined(__GNUC__) || defined(__MWERKS__) || defined(__SUNPRO_C)
#define SDL_HAS_64BIT_TYPE long long #define SDL_HAS_64BIT_TYPE long long
#elif defined(_MSC_VER) /* VC++ */ #elif defined(_MSC_VER) /* VC++ */
#define SDL_HAS_64BIT_TYPE __int64 #define SDL_HAS_64BIT_TYPE __int64
......
...@@ -46,11 +46,11 @@ static char rcsid = ...@@ -46,11 +46,11 @@ static char rcsid =
/* The following defines should really be determined at configure time */ /* The following defines should really be determined at configure time */
#ifdef linux #if defined(linux)
/* Linux select() changes its timeout parameter upon return to contain /* Linux select() changes its timeout parameter upon return to contain
the remaining time. Most other unixen leave it unchanged or undefined. */ the remaining time. Most other unixen leave it unchanged or undefined. */
#define SELECT_SETS_REMAINING #define SELECT_SETS_REMAINING
#elif defined(__bsdi__) || defined(__FreeBSD__) || defined(__sun__) #elif defined(__bsdi__) || defined(__FreeBSD__) || defined(__sun)
#define USE_NANOSLEEP #define USE_NANOSLEEP
#endif #endif
......
...@@ -26,23 +26,13 @@ static char rcsid = ...@@ -26,23 +26,13 @@ static char rcsid =
#endif #endif
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h>
#include "SDL_error.h" #include "SDL_error.h"
#include "SDL_endian.h" #include "SDL_endian.h"
#include "SDL_events_c.h" #include "SDL_events_c.h"
#include "SDL_x11image_c.h" #include "SDL_x11image_c.h"
#if defined(__USLC__)
#ifdef HAVE_KSTAT
#undef HAVE_KSTAT
#endif
#include <unistd.h>
#endif
#ifdef HAVE_KSTAT
#include <kstat.h>
#endif
#ifndef NO_SHARED_MEMORY #ifndef NO_SHARED_MEMORY
/* Shared memory information */ /* Shared memory information */
...@@ -177,13 +167,13 @@ void X11_DestroyImage(_THIS, SDL_Surface *screen) ...@@ -177,13 +167,13 @@ void X11_DestroyImage(_THIS, SDL_Surface *screen)
} }
} }
/* This is a hack to see whether this system has more than 1 CPU */ /* Determine the number of CPUs in the system */
static int num_CPU(void) static int num_CPU(void)
{ {
static int num_cpus = 0; static int num_cpus = 0;
if(!num_cpus) { if(!num_cpus) {
#ifdef linux #if defined(__linux)
char line[BUFSIZ]; char line[BUFSIZ];
FILE *pstat = fopen("/proc/stat", "r"); FILE *pstat = fopen("/proc/stat", "r");
if ( pstat ) { if ( pstat ) {
...@@ -194,23 +184,12 @@ static int num_CPU(void) ...@@ -194,23 +184,12 @@ static int num_CPU(void)
} }
fclose(pstat); fclose(pstat);
} }
#elif defined(HAVE_KSTAT) #elif defined(_SC_NPROCESSORS_ONLN)
kstat_ctl_t *kc = kstat_open(); /* number of processors online (SVR4.0MP compliant machines) */
kstat_t *ks; num_cpus = sysconf(_SC_NPROCESSORS_ONLN);
kstat_named_t *kn; #elif defined(_SC_NPROCESSORS_CONF)
if(kc) { /* number of processors configured (SVR4.0MP compliant machines) */
if((ks = kstat_lookup(kc, "unix", -1, "system_misc")) num_cpus = sysconf(_SC_NPROCESSORS_CONF);
&& kstat_read(kc, ks, NULL) != -1
&& (kn = kstat_data_lookup(ks, "ncpus")))
#ifdef KSTAT_DATA_UINT32
num_cpus = kn->value.ui32;
#else
num_cpus = kn->value.ul; /* needed in solaris <2.6 */
#endif
kstat_close(kc);
}
#elif defined(__USLC__)
num_cpus = (int)sysconf(_SC_NPROCESSORS_CONF);
#endif #endif
if ( num_cpus <= 0 ) { if ( num_cpus <= 0 ) {
num_cpus = 1; num_cpus = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment