- Main Page
- Related Pages
- Data Structures
- Files

- File List
- Globals

# mutils/platform.h

Go to the documentation of this file.

    00001 #ifndef MUTILS_PLATFORM_H
    00002 #define MUTILS_PLATFORM_H
    00003
    00018 #ifdef __cplusplus
    00019 #include <climits>
    00020
    00021 extern "C" {
    00022 namespace MUTILS {
    00023 #else
    00024 #include <limits.h>
    00025 #endif
    00026
    00027 /* ISO C requires at least 8- and 16-bits for these */
    00028 typedef   signed char  int8;
    00029 typedef unsigned char uint8;
    00030 typedef   signed short int  int16;
    00031 typedef unsigned short int uint16;
    00032
    00033 #ifndef INT_MAX
    00034 #define INT_MAX 2147483647L
    00035 #endif
    00036 #if INT_MAX >= 2147483647L
    00037 typedef   signed int  int32;
    00038 typedef unsigned int uint32;
    00039 #else
    00040 typedef   signed long int  int32;
    00041 typedef unsigned long int uint32;
    00042 #endif
    00043
    00044 #ifndef LONG_MAX
    00045 #define LONG_MAX 2147483647L
    00046 #endif
    00047 #if LONG_MAX > 2147483647L
    00048 typedef   signed long int  int64;
    00049 typedef unsigned long int uint64;
    00050 #else
    00051 typedef   signed long long int  int64;
    00052 typedef unsigned long long int uint64;
    00053 #endif
    00054
    00055 #ifdef __cplusplus
    00056 }  // namespace MUTILS
    00057 }  // extern "C" {
    00058 #endif
    00059
    00060
    00061 /*
    00062    Pure preprocessor work below here---CANNOT be confined to a namespace.
    00063 */
    00064 #define MU_MAKESTR(arg) #arg
    00065 #define MU_VERSTR(num) MU_MAKESTR(num)
    00066
    00067 /* Standardized compiler name strings. */
    00068 #define mu_compiler_known
    00069 #if defined(__SUNPRO_C) || defined(__SUNPRO_CC)
    00070 #  define mu_compiler "sunpro"
    00071 #  define mu_compiler_sunpro
    00072 #elif defined(__PGI)
    00073 #  define mu_compiler "pgcc"
    00074 #  define mu_compiler_pgcc
    00075 #elif defined(__ICC)
    00076 #  define mu_compiler "icc"
    00077 #  define mu_compiler_icc
    00078 #elif defined(__DECC)
    00079 #  define mu_compiler "decc"
    00080 #  define mu_compiler_decc
    00081 #elif defined(__xlC__)
    00082 #  define mu_compiler "xlc"
    00083 #  define mu_compiler_xlc
    00084 #elif defined(__GNUC__)
    00085 #  define mu_compiler ("gcc" MU_VERSTR(__GNUC__) "." MU_VERSTR(__GNUC_MINOR__))
    00086 #  define mu_compiler_gcc
    00087 #else
    00088 #  define mu_compiler "unknown"
    00089 #  undef  mu_compiler_known
    00090 #endif
    00091
    00092
    00093 /* OS defines. */
    00094 #define mu_os_known
    00095 #ifdef DJGPP
    00096 #  define mu_os_djgpp
    00097 #elif defined(__UWIN__)
    00098 #  define mu_os_uwin
    00099 #elif defined(__MINGW32__) || defined(__CYGWIN32__) || defined(_MSC_VER) || \
    00100       defined(__WIN32)     || defined(_WIN32)       || defined(WIN32)
    00101 #  define mu_os_mswin
    00102 #elif defined(__APPLE__) && defined(__MACH__)
    00103 #  define mu_os_macx
    00104 #elif defined(aix) || defined(__aix)
    00105 #  define mu_os_aix
    00106 #elif defined(hpux) || defined(__hpux)
    00107 #  define mu_os_hpux
    00108 #elif defined(irix) || defined(sgi) || defined(__sgi) || defined(__irix)
    00109 #  define mu_os_irix
    00110 #elif defined(linx) || defined(linux) || defined(__linux__) || defined(__linx)
    00111 #  define mu_os_linux
    00112 #elif defined(osf1) || defined (__osf__) || \
    00113       (defined(__digital__) && defined(__unix__)) || defined(__osf1)
    00114 #  define mu_os_osf1
    00115 #elif defined(sun4) || defined(__sun4)
    00116 #  define mu_os_sun4
    00117 #elif defined(sun5) || defined(__sun5) || (defined(__PGI) && defined(sun))
    00118 #  define mu_os_sun5
    00119 #elif defined(sun) || defined(__sun) /* Make educated guesses... */
    00120 #  if defined(__SVR4) || defined(__svr4__) || defined(__sun5)
    00121 #    define mu_os_sun5
    00122 #  elif (!defined(__SVR4) && !defined(__svr4__)) || defined(__sun4)
    00123 #    define mu_os_sun4
    00124 #  endif
    00125 #else
    00126 #  undef mu_os_known  /* OS unknown. */
    00127 #endif
    00128
    00129 #ifndef mu_os_known
    00130 #  error "OS not supported in platform.h."
    00131 #endif
    00132
    00133
    00134 /* CPU defines. */
    00135 #define mu_cpu_known
    00136 #if defined(alpha) || defined(__alpha__) || defined(__alpha)
    00137 #  define mu_cpu_alpha
    00138 #elif defined(hppa) || defined(__hppa)
    00139 #  define mu_cpu_hppa
    00140 #elif defined(i386) || defined(i486) || defined(i586)   || \
    00141       defined(i686) || defined(i786) || defined(__i386) || defined(_X86_) || \
    00142       defined(__386__) || defined(__i386__) || defined(_M_IX86)
    00143 #  define mu_cpu_x86
    00144 #elif defined(x86_64) || defined(__x86_64) || defined(__x86_64__) || \
    00145       defined(__amd64) || defined(__amd64__)
    00146 #  define mu_cpu_x86_64
    00147 #elif defined(mips) || defined(host_mips) || \
    00148       defined(__host_mips) || defined(__mips)
    00149 #  define mu_cpu_mips
    00150 #elif defined(__bgq__) && defined(__PPC64__)
    00151 #  define mu_cpu_bgq
    00152 #elif defined(__PPC64__) || defined(__ARCH_PPC64)
    00153 #  define mu_cpu_ppc64
    00154 #elif defined(__ppc__) || defined(__PPC__) || defined(__ppc) || \
    00155       defined(__powerpc__) || defined(__powerpc)
    00156 #  define mu_cpu_ppc
    00157 #elif defined(rs6000) || defined(__rs6000__) || defined(__rs6000)
    00158 #  define mu_cpu_rs6000
    00159 #elif defined(sparc) || defined(__sparc__) || defined(__sparc)
    00160 #  define mu_cpu_sparc
    00161 #else
    00162 #  undef mu_cpu_known  /* CPU unknown. */
    00163 #endif
    00164
    00165 #ifndef mu_cpu_known
    00166 #  error "CPU not supported in platform.h."
    00167 #endif
    00168
    00169
    00170 /* ASM defines. */
    00171 #define mu_asm_known
    00172 #if (defined(mu_compiler_icc) || defined(mu_compiler_gcc) || \
    00173      defined(mu_compiler_sunpro)) && \
    00174      defined(mu_cpu_x86) && !defined(mu_os_macx)
    00175 #  define mu_asm_att_x86
    00176 #elif (defined(mu_compiler_icc) || defined(mu_compiler_gcc) || \
    00177        defined(mu_compiler_sunpro)) && \
    00178        defined(mu_cpu_x86_64) && !defined(mu_os_macx)
    00179 #  define mu_asm_att_x86_64
    00180 #else
    00181 #  undef mu_asm_known  /* ASM variant unknown. */
    00182 #endif
    00183
    00184
    00185 /* Byte order defines. */
    00186 #if defined(mu_cpu_alpha) || defined(mu_cpu_x86) || defined(mu_cpu_x86_64) || \
    00187     defined(mu_cpu_rs6000) || \
    00188    (defined(mu_cpu_mips) && !defined(_MIPSEB) && !defined(MIPSEB)) || \
    00189     defined(L_ENDIAN)
    00190 #  undef  MU_BIGENDIAN
    00191 #elif defined(mu_cpu_bgq) || defined(mu_cpu_hppa)  || defined(mu_cpu_mips) || \
    00192       defined(mu_cpu_ppc) || defined(mu_cpu_ppc64) || defined(mu_cpu_sparc) || \
    00193       defined(B_ENDIAN)
    00194 #  define MU_BIGENDIAN
    00195 #else
    00196 #  error "Byte order unknown in platform.h; CPU type supported??"
    00197 #endif
    00198
    00199
    00200 #if   defined(DLL_EXPORT)
    00201 #  define DLLSPEC __declspec(dllexport)
    00202 #elif defined(DLL_IMPORT)
    00203 #  define DLLSPEC __declspec(dllimport)
    00204 #else
    00205 #  define DLLSPEC
    00206 #endif
    00207
    00208 #endif  /* MUTILS_PLATFORM_H */