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