[1261] | 1 | #ifndef MACHDEFS_SEEN
|
---|
| 2 | #define MACHDEFS_SEEN
|
---|
| 3 |
|
---|
[3203] | 4 | /* -------------- List of flags (and description) -------------------
|
---|
| 5 | - SO_ARCH64 : select 64 bits architecture (default 32 bits)
|
---|
| 6 | - SO_NOFPIC : disable fPIC flag (Position Independent Code) default fPIC enabled
|
---|
| 7 | - SO_SASIZET64 : select 64 bits size for array indices (default 32 bits)
|
---|
| 8 | - SO_BOUNDCHECKING : activate bound checking (in accessing array elements)
|
---|
| 9 | - SOPHYA_DEBUG : debug flag ( --> if set, SO_BOUNDCHECKING is also set)
|
---|
| 10 | ------------------------------------------------------------------ */
|
---|
| 11 |
|
---|
| 12 | #ifdef SOPHYA_DEBUG
|
---|
| 13 | #define SO_BOUNDCHECKING
|
---|
| 14 | #endif
|
---|
| 15 |
|
---|
[1261] | 16 | /***********************************************************************/
|
---|
| 17 | /* Find hardware, OS and compiler combination */
|
---|
| 18 | /***********************************************************************/
|
---|
| 19 |
|
---|
| 20 | #if defined(OSF1)
|
---|
| 21 | #define MACH_ALPHA
|
---|
| 22 | #endif
|
---|
| 23 |
|
---|
| 24 | #if defined(_AIX) || defined(AIX)
|
---|
| 25 | #define MACH_IBMRS
|
---|
| 26 | #define OS_AIX
|
---|
| 27 | #endif
|
---|
| 28 |
|
---|
| 29 | #if defined(__hpux__) || defined(HPUX)
|
---|
| 30 | #define MACH_HP
|
---|
| 31 | #endif
|
---|
| 32 |
|
---|
| 33 | #if defined(SunOS) || defined ( sun )
|
---|
| 34 | #define MACH_SUN
|
---|
| 35 | #endif
|
---|
| 36 |
|
---|
| 37 | #ifdef IRIX64
|
---|
| 38 | #define MACH_SGI
|
---|
| 39 | #endif
|
---|
| 40 |
|
---|
[1783] | 41 | #ifdef __APPLE__
|
---|
| 42 | #ifdef __MACH__
|
---|
[3070] | 43 | #ifdef __POWERPC__
|
---|
[1783] | 44 | #define MACH_POWERPC
|
---|
[3070] | 45 | #else
|
---|
| 46 | #define MACH_INTEL
|
---|
| 47 | #endif
|
---|
[1783] | 48 | #endif
|
---|
| 49 | #endif
|
---|
| 50 |
|
---|
[1261] | 51 | #if defined(Linux) || defined(linux)
|
---|
| 52 | #if defined(__alpha__)
|
---|
| 53 | #define MACH_ALPHA
|
---|
| 54 | #elif defined(powerpc)
|
---|
| 55 | #define MACH_POWERPC
|
---|
[3240] | 56 | #elif defined(__i386__)
|
---|
[3203] | 57 | #define MACH_INTEL
|
---|
| 58 | #else
|
---|
| 59 | #define MACH_AMD
|
---|
| 60 | /* $CHECK$ (Reza Avril 2007): Il faut affiner ce test pour
|
---|
| 61 | determiner correctement le type de processeur */
|
---|
[1261] | 62 | #endif
|
---|
| 63 | #endif
|
---|
| 64 |
|
---|
| 65 | /***********************************************************************/
|
---|
| 66 | /* Hardware/OS dependent stuff */
|
---|
| 67 | /***********************************************************************/
|
---|
| 68 |
|
---|
[3203] | 69 | /* --------------------------------------------------------------- */
|
---|
| 70 | /* 1/ typedefs for different size integers and floats */
|
---|
| 71 | /* --------------------------------------------------------------- */
|
---|
[1261] | 72 |
|
---|
[3203] | 73 | /* --- Avr2007: The following typdefs should be OK for most system */
|
---|
| 74 | /* and compilers: OSF, Linux, AIX, SGI, MacOSX, Sun, HP */
|
---|
[1261] | 75 |
|
---|
[3203] | 76 | typedef signed char int_1;
|
---|
| 77 | typedef unsigned char uint_1;
|
---|
| 78 | typedef short int_2;
|
---|
| 79 | typedef unsigned short uint_2;
|
---|
| 80 | typedef int int_4;
|
---|
| 81 | typedef unsigned int uint_4;
|
---|
| 82 | typedef long long int_8;
|
---|
| 83 | typedef unsigned long long uint_8;
|
---|
| 84 | typedef float r_4;
|
---|
| 85 | typedef double r_8;
|
---|
[1261] | 86 |
|
---|
[3203] | 87 | /* --------------------------------------------------------------- */
|
---|
| 88 | /* 2/ Endiannes (/ byteswap for different processors) */
|
---|
| 89 | /* --------------------------------------------------------------- */
|
---|
| 90 | /*
|
---|
| 91 | ==> POWERPC, IBMRS, HP_UX, IRIX64, SunSPARC (?) :
|
---|
| 92 | BigEndian ( SWAP=SWAPDEFAUT=0)
|
---|
| 93 | ==> ALPHA, INTEL, AMD :
|
---|
| 94 | LittleEndian ( SWAP=SWAPDEFAUT=1)
|
---|
| 95 | */
|
---|
[1261] | 96 |
|
---|
[3203] | 97 | #if defined(MACH_ALPHA) || defined(MACH_INTEL) || defined(MACH_AMD)
|
---|
| 98 | #define IS_BIG_ENDIAN 0
|
---|
| 99 | #else
|
---|
| 100 | #define IS_BIG_ENDIAN 1
|
---|
[1261] | 101 | #endif
|
---|
| 102 |
|
---|
[3203] | 103 | /* ---- La taille des index des tableaux ---- */
|
---|
| 104 | #ifdef SO_SASIZET64
|
---|
| 105 | typedef int_8 sa_size_t ;
|
---|
[3070] | 106 | #else
|
---|
[3203] | 107 | typedef int_4 sa_size_t ;
|
---|
[3070] | 108 | #endif
|
---|
[1783] | 109 |
|
---|
[1261] | 110 |
|
---|
| 111 | /***********************************************************************/
|
---|
| 112 | /* Find Compiler */
|
---|
| 113 | /***********************************************************************/
|
---|
| 114 |
|
---|
| 115 | /* __DECCXX : DEC CXX, version >= 6 is required */
|
---|
| 116 | /* __GNUG__ : GNU C++ 2.8.1, egcs ?? */
|
---|
| 117 | /* __aCC__ : aCC on HP */
|
---|
| 118 | /* __KCC__ : KCC, version >= 3.3 is required */
|
---|
| 119 | /* __SGICC__ : SGI (IRIX64) CC compiler */
|
---|
[2884] | 120 | /* __INTEL_COMPILER : : INTEL compiler */
|
---|
| 121 | /* __IBMCPP__ : AIX (IBM) xlC c++ compiler */
|
---|
[1261] | 122 |
|
---|
| 123 | /***********************************************************************/
|
---|
| 124 | /* Compiler-specific stuff */
|
---|
| 125 | /***********************************************************************/
|
---|
| 126 |
|
---|
| 127 | /* ANSI_TEMPLATES : use ANSI syntax for explicit templates */
|
---|
| 128 | /* GNUG_TEMPLATES : use GNU syntax for explicit templates */
|
---|
| 129 | /* PRAGMA_TEMPLATES : use pragma template, a la cxx */
|
---|
| 130 | /* COMPILER_EXCEPTIONS : knows about exceptions --- required ? */
|
---|
| 131 | /* STREAMPOS_IS_CLASS : streampos is a real class */
|
---|
| 132 | /* ITER_TAG : use iter_tag for iterator qualifiers in STL */
|
---|
| 133 | /* NO_STRSTREAM : does not have strstream */
|
---|
| 134 | /* HAS_IOS_BIN */
|
---|
| 135 | /* HAS_IOS_NOCREATE */
|
---|
| 136 | /* HAS_VEC_NEW : operator new[] */
|
---|
| 137 | /* CC_HAS_RTTI_SUPPORT has Run Time Type Identification support */
|
---|
| 138 | /* ANSI_IO : rdbuf()->pubseekoff rather than seekg */
|
---|
| 139 | /* HAS_STR_NPOS : has string::npos and not a global NPOS */
|
---|
| 140 | /* NO_IOS_COMPLEX : does not have operator << defined for complex */
|
---|
[2339] | 141 | /* DECL_TEMP_SPEC : Template specialization declaration */
|
---|
[2884] | 142 | /* TSNMLUPG4 : Two stage name look-up scheme (g++>3.4) */
|
---|
[1261] | 143 |
|
---|
| 144 |
|
---|
[2322] | 145 | /* (STREAMPOS_IS_CLASS non-active: ca compile sans sur gcc3.2 et cxx)
|
---|
| 146 | rz+cmv 11/02/03 */
|
---|
| 147 |
|
---|
[1261] | 148 | /* The following is true for most compilers */
|
---|
| 149 |
|
---|
| 150 | #ifndef HAS_VEC_NEW
|
---|
| 151 | #define HAS_VEC_NEW
|
---|
| 152 | #endif
|
---|
| 153 |
|
---|
| 154 | #ifndef COMPILER_EXCEPTIONS
|
---|
| 155 | #define COMPILER_EXCEPTIONS
|
---|
| 156 | #endif
|
---|
| 157 |
|
---|
| 158 | #ifndef CC_HAS_RTTI_SUPPORT
|
---|
| 159 | #define CC_HAS_RTTI_SUPPORT
|
---|
| 160 | #endif
|
---|
| 161 |
|
---|
[2339] | 162 |
|
---|
| 163 | #ifndef DECL_TEMP_SPEC
|
---|
| 164 | #define DECL_TEMP_SPEC
|
---|
| 165 | #endif
|
---|
| 166 |
|
---|
[2884] | 167 | /* Most compilers dot not implement two level name lookup for templates
|
---|
| 168 | introduced by gcc >= 3.4
|
---|
| 169 | */
|
---|
| 170 | #ifdef TSNMLUPG4
|
---|
| 171 | #undef TSNMLUPG4
|
---|
| 172 | #endif
|
---|
[2339] | 173 |
|
---|
[1261] | 174 | /* now the specific things */
|
---|
| 175 |
|
---|
[3131] | 176 | #ifdef __GNUC__
|
---|
| 177 | #define GCC_VERSION (__GNUC__ * 1000 \
|
---|
[2884] | 178 | + __GNUC_MINOR__ * 100 \
|
---|
| 179 | + __GNUC_PATCHLEVEL__)
|
---|
[1261] | 180 | #define ANSI_TEMPLATES
|
---|
[2322] | 181 | /*
|
---|
| 182 | if (__GNUC__ >= 3)
|
---|
| 183 | define STREAMPOS_IS_CLASS
|
---|
| 184 | endif
|
---|
| 185 | */
|
---|
| 186 | #define GNU_TEMPLATES
|
---|
[1261] | 187 | #define HAS_STR_NPOS
|
---|
| 188 | #define HAS_IOS_BIN
|
---|
| 189 | #define HAS_IOS_NOCREATE
|
---|
[3131] | 190 | #if ( GCC_VERSION >= 3000 )
|
---|
[2884] | 191 | #undef DECL_TEMP_SPEC
|
---|
| 192 | #define DECL_TEMP_SPEC template <>
|
---|
[1261] | 193 | #endif
|
---|
[3131] | 194 | #if ( GCC_VERSION >= 3400 )
|
---|
[2884] | 195 | /* Two level name look-up scheme for templates introduced from gcc 3.4 */
|
---|
| 196 | #define TSNMLUPG4
|
---|
| 197 | #endif
|
---|
[1261] | 198 |
|
---|
[2884] | 199 | #endif
|
---|
| 200 |
|
---|
[1261] | 201 | #ifdef __DECCXX
|
---|
| 202 | #define HAS_STR_NPOS
|
---|
| 203 | #define ITER_TAG
|
---|
| 204 | #define __CXX_PRAGMA_TEMPLATES__
|
---|
| 205 | #define PRAGMA_TEMPLATES
|
---|
| 206 | #endif
|
---|
| 207 |
|
---|
| 208 | #if defined (__aCC__)
|
---|
| 209 | #ifndef ANSI_TEMPLATES
|
---|
| 210 | #define ANSI_TEMPLATES
|
---|
| 211 | #endif
|
---|
| 212 | #endif
|
---|
| 213 |
|
---|
| 214 | #if defined(__KCC__)
|
---|
| 215 | /* KCC V 3.2 ne compile pas i/ostream s ; long p = s.tellg(); OK en V 3.3 */
|
---|
| 216 | #define HAS_STR_NPOS
|
---|
| 217 | #ifndef ANSI_TEMPLATES
|
---|
| 218 | #define ANSI_TEMPLATES
|
---|
| 219 | #endif
|
---|
| 220 | #endif
|
---|
| 221 |
|
---|
| 222 | #if defined(__SGICC__)
|
---|
| 223 | #define HAS_STR_NPOS
|
---|
| 224 | #ifndef ANSI_TEMPLATES
|
---|
| 225 | #define ANSI_TEMPLATES
|
---|
[2867] | 226 | #endif
|
---|
[2339] | 227 | #undef DECL_TEMP_SPEC
|
---|
| 228 | #define DECL_TEMP_SPEC template <>
|
---|
[1261] | 229 | #endif
|
---|
[2867] | 230 |
|
---|
| 231 | #if defined(__IBMCPP__)
|
---|
| 232 | /* IBM xlC compiler support Added : dec 2005 */
|
---|
| 233 | #ifndef ANSI_TEMPLATES
|
---|
| 234 | #define ANSI_TEMPLATES
|
---|
[1261] | 235 | #endif
|
---|
[2867] | 236 | #undef DECL_TEMP_SPEC
|
---|
| 237 | #define DECL_TEMP_SPEC template <>
|
---|
| 238 | #endif
|
---|
[1261] | 239 |
|
---|
| 240 | /* Get things has homogeneous as possible between compilers */
|
---|
| 241 |
|
---|
| 242 | #ifdef HAS_STR_NPOS
|
---|
| 243 | #define NPOS string::npos
|
---|
| 244 | #else
|
---|
| 245 | #define NPOS (size_t)-1
|
---|
| 246 | #endif
|
---|
| 247 |
|
---|
| 248 | #ifndef __GNUG__
|
---|
| 249 | #define __PRETTY_FUNCTION__ __FILE__ " __LINE__ "
|
---|
| 250 | #ifndef __FUNCTION__
|
---|
| 251 | #define __FUNCTION__ __FILE__ " __LINE__ "
|
---|
| 252 | #endif
|
---|
| 253 | #ifndef __KCC__
|
---|
| 254 | #define __attribute__(_x_)
|
---|
| 255 | #endif
|
---|
| 256 | #endif
|
---|
| 257 |
|
---|
| 258 |
|
---|
| 259 | #ifdef HAS_IOS_BIN
|
---|
| 260 | #define IOS_BIN ios::binary
|
---|
| 261 | #else
|
---|
| 262 | #define IOS_BIN 0
|
---|
| 263 | #endif
|
---|
| 264 |
|
---|
| 265 |
|
---|
[3525] | 266 | #ifdef Darwin
|
---|
[1783] | 267 | #define NO_VALUES_H
|
---|
| 268 | #include "osx_values.h"
|
---|
| 269 | #endif
|
---|
[1261] | 270 |
|
---|
[1783] | 271 |
|
---|
[1261] | 272 | #ifdef __cplusplus
|
---|
[1870] | 273 | /* Standard C++ library classes are in the namespace std */
|
---|
| 274 | namespace std { }
|
---|
| 275 | using namespace std;
|
---|
[2615] | 276 | /*******************************************/
|
---|
| 277 | /* SOPHYA classes are in namespace SOPHYA */
|
---|
| 278 | /* namespace SOPHYA {} */
|
---|
| 279 | /* using namespace SOPHYA; */
|
---|
| 280 | /* Please use instead: sopnamsp.h */
|
---|
| 281 | /*******************************************/
|
---|
[1261] | 282 | #endif
|
---|
| 283 |
|
---|
| 284 | #endif
|
---|