Fixed Solaris nitpicks (thanks Mattias!)
authorSam Lantinga <slouken@libsdl.org>
Tue, 04 Sep 2001 22:48:09 +0000
changeset 16639877400bd1e
parent 165 6a4e09bbbbc0
child 167 cb384ef627f6
Fixed Solaris nitpicks (thanks Mattias!)
configure.in
include/SDL_types.h
src/timer/linux/SDL_systimer.c
src/video/x11/SDL_x11image.c
     1.1 --- a/configure.in	Tue Sep 04 22:38:01 2001 +0000
     1.2 +++ b/configure.in	Tue Sep 04 22:48:09 2001 +0000
     1.3 @@ -1196,20 +1196,14 @@
     1.4      # and what runs on older Macs - while in theory "Carbon" defns
     1.5      # are consistent between the two, in practice Carbon is still
     1.6      # changing. -sts Aug 2000
     1.7 +    mac_autoconf_target_workaround="MAC"
     1.8      CFLAGS="$CFLAGS -I/System/Library/Frameworks/Carbon.framework/Headers \
     1.9        -I/System/Library/Frameworks/Cocoa.framework/Headers -fpascal-strings \
    1.10 -      -DENABLE_QUARTZ -DMACOSX -DTARGET_API_MAC_CARBON=1 -I\$(top_srcdir)/src/video/quartz"
    1.11 +      -DENABLE_QUARTZ -DMACOSX -DTARGET_API_${mac_autoconf_target_workaround}_CARBON=1 -I\$(top_srcdir)/src/video/quartz"
    1.12      VIDEO_SUBDIRS="$VIDEO_SUBDIRS quartz"
    1.13      VIDEO_DRIVERS="$VIDEO_DRIVERS quartz/libvideo_quartz.la"
    1.14  }
    1.15  
    1.16 -dnl Set up the kernel statistics library for Solaris
    1.17 -CheckKSTAT()
    1.18 -{
    1.19 -    CFLAGS="$CFLAGS -DHAVE_KSTAT"
    1.20 -    SYSTEM_LIBS="$SYSTEM_LIBS -lkstat"
    1.21 -}
    1.22 -
    1.23  case "$target" in
    1.24      *-*-linux*)
    1.25          ARCH=linux
    1.26 @@ -1516,7 +1510,6 @@
    1.27          CheckAAlib
    1.28          CheckOpenGL
    1.29          CheckPTHREAD
    1.30 -        CheckKSTAT
    1.31          # Set up files for the main() stub
    1.32          COPY_ARCH_SRC(src/main, linux, SDL_main.c)
    1.33          # Set up files for the audio library
    1.34 @@ -1566,7 +1559,6 @@
    1.35          CheckAAlib
    1.36          CheckOpenGL
    1.37          CheckPTHREAD
    1.38 -        CheckKSTAT
    1.39          # Set up files for the main() stub
    1.40          COPY_ARCH_SRC(src/main, linux, SDL_main.c)
    1.41          # Set up files for the audio library
     2.1 --- a/include/SDL_types.h	Tue Sep 04 22:38:01 2001 +0000
     2.2 +++ b/include/SDL_types.h	Tue Sep 04 22:48:09 2001 +0000
     2.3 @@ -47,7 +47,7 @@
     2.4  
     2.5  /* Figure out how to support 64-bit datatypes */
     2.6  #if !defined(__STRICT_ANSI__)
     2.7 -#if defined(__GNUC__) || defined(__MWERKS__) /* MJS */
     2.8 +#if defined(__GNUC__) || defined(__MWERKS__) || defined(__SUNPRO_C)
     2.9  #define SDL_HAS_64BIT_TYPE	long long
    2.10  #elif defined(_MSC_VER) /* VC++ */
    2.11  #define SDL_HAS_64BIT_TYPE	__int64
     3.1 --- a/src/timer/linux/SDL_systimer.c	Tue Sep 04 22:38:01 2001 +0000
     3.2 +++ b/src/timer/linux/SDL_systimer.c	Tue Sep 04 22:48:09 2001 +0000
     3.3 @@ -46,11 +46,11 @@
     3.4  
     3.5  /* The following defines should really be determined at configure time */
     3.6  
     3.7 -#ifdef linux
     3.8 +#if defined(linux)
     3.9  /* Linux select() changes its timeout parameter upon return to contain
    3.10     the remaining time. Most other unixen leave it unchanged or undefined. */
    3.11  #define SELECT_SETS_REMAINING
    3.12 -#elif defined(__bsdi__) || defined(__FreeBSD__) || defined(__sun__)
    3.13 +#elif defined(__bsdi__) || defined(__FreeBSD__) || defined(__sun)
    3.14  #define USE_NANOSLEEP
    3.15  #endif
    3.16  
     4.1 --- a/src/video/x11/SDL_x11image.c	Tue Sep 04 22:38:01 2001 +0000
     4.2 +++ b/src/video/x11/SDL_x11image.c	Tue Sep 04 22:48:09 2001 +0000
     4.3 @@ -26,23 +26,13 @@
     4.4  #endif
     4.5  
     4.6  #include <stdlib.h>
     4.7 +#include <unistd.h>
     4.8  
     4.9  #include "SDL_error.h"
    4.10  #include "SDL_endian.h"
    4.11  #include "SDL_events_c.h"
    4.12  #include "SDL_x11image_c.h"
    4.13  
    4.14 -#if defined(__USLC__)
    4.15 -#ifdef HAVE_KSTAT
    4.16 -#undef HAVE_KSTAT
    4.17 -#endif
    4.18 -#include <unistd.h>
    4.19 -#endif
    4.20 -
    4.21 -#ifdef HAVE_KSTAT
    4.22 -#include <kstat.h>
    4.23 -#endif
    4.24 -
    4.25  #ifndef NO_SHARED_MEMORY
    4.26  
    4.27  /* Shared memory information */
    4.28 @@ -177,13 +167,13 @@
    4.29  	}
    4.30  }
    4.31  
    4.32 -/* This is a hack to see whether this system has more than 1 CPU */
    4.33 +/* Determine the number of CPUs in the system */
    4.34  static int num_CPU(void)
    4.35  {
    4.36         static int num_cpus = 0;
    4.37  
    4.38         if(!num_cpus) {
    4.39 -#ifdef linux
    4.40 +#if defined(__linux)
    4.41             char line[BUFSIZ];
    4.42             FILE *pstat = fopen("/proc/stat", "r");
    4.43             if ( pstat ) {
    4.44 @@ -194,23 +184,12 @@
    4.45                 }
    4.46                 fclose(pstat);
    4.47             }
    4.48 -#elif defined(HAVE_KSTAT)
    4.49 -           kstat_ctl_t *kc = kstat_open();
    4.50 -           kstat_t *ks;
    4.51 -           kstat_named_t *kn;
    4.52 -           if(kc) {
    4.53 -               if((ks = kstat_lookup(kc, "unix", -1, "system_misc"))
    4.54 -                  && kstat_read(kc, ks, NULL) != -1
    4.55 -                  && (kn = kstat_data_lookup(ks, "ncpus")))
    4.56 -#ifdef KSTAT_DATA_UINT32
    4.57 -                   num_cpus = kn->value.ui32;
    4.58 -#else
    4.59 -                   num_cpus = kn->value.ul; /* needed in solaris <2.6 */
    4.60 -#endif
    4.61 -               kstat_close(kc);
    4.62 -           }
    4.63 -#elif defined(__USLC__)
    4.64 -           num_cpus = (int)sysconf(_SC_NPROCESSORS_CONF);
    4.65 +#elif defined(_SC_NPROCESSORS_ONLN)
    4.66 +	   /* number of processors online (SVR4.0MP compliant machines) */
    4.67 +           num_cpus = sysconf(_SC_NPROCESSORS_ONLN);
    4.68 +#elif defined(_SC_NPROCESSORS_CONF)
    4.69 +	   /* number of processors configured (SVR4.0MP compliant machines) */
    4.70 +           num_cpus = sysconf(_SC_NPROCESSORS_CONF);
    4.71  #endif
    4.72             if ( num_cpus <= 0 ) {
    4.73                 num_cpus = 1;