src/cpuinfo/SDL_cpuinfo.c
changeset 9278 8900afb78a19
parent 9047 101109110bf7
child 9300 0293f45e4814
     1.1 --- a/src/cpuinfo/SDL_cpuinfo.c	Sat Dec 13 02:33:52 2014 -0500
     1.2 +++ b/src/cpuinfo/SDL_cpuinfo.c	Thu Dec 18 00:19:52 2014 -0500
     1.3 @@ -79,6 +79,7 @@
     1.4  {
     1.5      int has_CPUID = 0;
     1.6  /* *INDENT-OFF* */
     1.7 +#ifndef SDL_CPUINFO_DISABLED
     1.8  #if defined(__GNUC__) && defined(i386)
     1.9      __asm__ (
    1.10  "        pushfl                      # Get original EFLAGS             \n"
    1.11 @@ -165,6 +166,7 @@
    1.12  "1:                            \n"
    1.13      );
    1.14  #endif
    1.15 +#endif
    1.16  /* *INDENT-ON* */
    1.17      return has_CPUID;
    1.18  }
    1.19 @@ -272,6 +274,7 @@
    1.20  CPU_haveAltiVec(void)
    1.21  {
    1.22      volatile int altivec = 0;
    1.23 +#ifndef SDL_CPUINFO_DISABLED
    1.24  #if (defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))) || (defined(__OpenBSD__) && defined(__powerpc__))
    1.25  #ifdef __OpenBSD__
    1.26      int selectors[2] = { CTL_MACHDEP, CPU_ALTIVEC };
    1.27 @@ -292,6 +295,7 @@
    1.28      }
    1.29      signal(SIGILL, handler);
    1.30  #endif
    1.31 +#endif
    1.32      return altivec;
    1.33  }
    1.34  
    1.35 @@ -418,6 +422,7 @@
    1.36  SDL_GetCPUCount(void)
    1.37  {
    1.38      if (!SDL_CPUCount) {
    1.39 +#ifndef SDL_CPUINFO_DISABLED
    1.40  #if defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_ONLN)
    1.41          if (SDL_CPUCount <= 0) {
    1.42              SDL_CPUCount = (int)sysconf(_SC_NPROCESSORS_ONLN);
    1.43 @@ -436,6 +441,7 @@
    1.44              SDL_CPUCount = info.dwNumberOfProcessors;
    1.45          }
    1.46  #endif
    1.47 +#endif
    1.48          /* There has to be at least 1, right? :) */
    1.49          if (SDL_CPUCount <= 0) {
    1.50              SDL_CPUCount = 1;
    1.51 @@ -723,6 +729,7 @@
    1.52  SDL_GetSystemRAM(void)
    1.53  {
    1.54      if (!SDL_SystemRAM) {
    1.55 +#ifndef SDL_CPUINFO_DISABLED
    1.56  #if defined(HAVE_SYSCONF) && defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE)
    1.57          if (SDL_SystemRAM <= 0) {
    1.58              SDL_SystemRAM = (int)((Sint64)sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE) / (1024*1024));
    1.59 @@ -757,6 +764,7 @@
    1.60              }
    1.61          }
    1.62  #endif
    1.63 +#endif
    1.64      }
    1.65      return SDL_SystemRAM;
    1.66  }