1 | #ifndef MACHDEFS_SEEN
|
---|
2 | #define MACHDEFS_SEEN
|
---|
3 |
|
---|
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_LDBLE128 : enable support for 128 bits floating point numbers (default NO 128 bits floats)
|
---|
9 | - SO_BOUNDCHECKING : activate bound checking (in accessing array elements)
|
---|
10 | - SOPHYA_DEBUG : debug flag ( --> if set, SO_BOUNDCHECKING is also set)
|
---|
11 | ------------------------------------------------------------------ */
|
---|
12 |
|
---|
13 | #ifdef SOPHYA_DEBUG
|
---|
14 | #define SO_BOUNDCHECKING
|
---|
15 | #endif
|
---|
16 |
|
---|
17 | /***********************************************************************/
|
---|
18 | /* Find hardware, OS and compiler combination */
|
---|
19 | /***********************************************************************/
|
---|
20 |
|
---|
21 | #if defined(OSF1)
|
---|
22 | #define MACH_ALPHA
|
---|
23 | #endif
|
---|
24 |
|
---|
25 | #if defined(_AIX) || defined(AIX)
|
---|
26 | #define MACH_IBMRS
|
---|
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 |
|
---|
41 | #ifdef __APPLE__
|
---|
42 | #ifdef __MACH__
|
---|
43 | #ifdef __POWERPC__
|
---|
44 | #define MACH_POWERPC
|
---|
45 | #else
|
---|
46 | #define MACH_INTEL
|
---|
47 | #endif
|
---|
48 | #endif
|
---|
49 | #endif
|
---|
50 |
|
---|
51 | #if defined(Linux) || defined(linux)
|
---|
52 | #if defined(__alpha__)
|
---|
53 | #define MACH_ALPHA
|
---|
54 | #elif defined(powerpc)
|
---|
55 | #define MACH_POWERPC
|
---|
56 | #elif defined(__i386__)
|
---|
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 */
|
---|
62 | #endif
|
---|
63 | #endif
|
---|
64 |
|
---|
65 | /***********************************************************************/
|
---|
66 | /* Hardware/OS dependent stuff */
|
---|
67 | /***********************************************************************/
|
---|
68 |
|
---|
69 | /* --------------------------------------------------------------- */
|
---|
70 | /* 1/ typedefs for different size integers and floats */
|
---|
71 | /* --------------------------------------------------------------- */
|
---|
72 |
|
---|
73 | /* --- Avr2007: The following typdefs should be OK for most system */
|
---|
74 | /* and compilers: OSF, Linux, AIX, SGI, MacOSX, Sun, HP */
|
---|
75 |
|
---|
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;
|
---|
86 | #ifdef SO_LDBLE128
|
---|
87 | /* 128 bits floating point numbers */
|
---|
88 | typedef long double r_16;
|
---|
89 | #endif
|
---|
90 |
|
---|
91 | /* --------------------------------------------------------------- */
|
---|
92 | /* 2/ Endiannes (/ byteswap for different processors) */
|
---|
93 | /* --------------------------------------------------------------- */
|
---|
94 | /*
|
---|
95 | ==> POWERPC, IBMRS, HP_UX, IRIX64, SunSPARC (?) :
|
---|
96 | BigEndian ( SWAP=SWAPDEFAUT=0)
|
---|
97 | ==> ALPHA, INTEL, AMD :
|
---|
98 | LittleEndian ( SWAP=SWAPDEFAUT=1)
|
---|
99 | */
|
---|
100 |
|
---|
101 | #if defined(MACH_ALPHA) || defined(MACH_INTEL) || defined(MACH_AMD)
|
---|
102 | #define IS_BIG_ENDIAN 0
|
---|
103 | #else
|
---|
104 | #define IS_BIG_ENDIAN 1
|
---|
105 | #endif
|
---|
106 |
|
---|
107 | /* ---- La taille des index des tableaux ---- */
|
---|
108 | #ifdef SO_SASIZET64
|
---|
109 | typedef int_8 sa_size_t ;
|
---|
110 | #else
|
---|
111 | typedef int_4 sa_size_t ;
|
---|
112 | #endif
|
---|
113 |
|
---|
114 |
|
---|
115 | /***********************************************************************/
|
---|
116 | /* Find Compiler */
|
---|
117 | /***********************************************************************/
|
---|
118 |
|
---|
119 | /* __DECCXX : DEC CXX, version >= 6 is required */
|
---|
120 | /* __GNUG__ : GNU C++ 2.8.1, egcs ?? */
|
---|
121 | /* __aCC__ : aCC on HP */
|
---|
122 | /* __KCC__ : KCC, version >= 3.3 is required */
|
---|
123 | /* __SGICC__ : SGI (IRIX64) CC compiler */
|
---|
124 | /* __INTEL_COMPILER : : INTEL compiler */
|
---|
125 | /* __IBMCPP__ : AIX (IBM) xlC c++ compiler */
|
---|
126 |
|
---|
127 | /***********************************************************************/
|
---|
128 | /* Compiler-specific stuff */
|
---|
129 | /***********************************************************************/
|
---|
130 |
|
---|
131 | /* ANSI_TEMPLATES : use ANSI syntax for explicit templates */
|
---|
132 | /* GNUG_TEMPLATES : use GNU syntax for explicit templates */
|
---|
133 | /* PRAGMA_TEMPLATES : use pragma template, a la cxx */
|
---|
134 | /* COMPILER_EXCEPTIONS : knows about exceptions --- required ? */
|
---|
135 | /* STREAMPOS_IS_CLASS : streampos is a real class */
|
---|
136 | /* ITER_TAG : use iter_tag for iterator qualifiers in STL */
|
---|
137 | /* NO_STRSTREAM : does not have strstream */
|
---|
138 | /* HAS_IOS_BIN */
|
---|
139 | /* HAS_IOS_NOCREATE */
|
---|
140 | /* HAS_VEC_NEW : operator new[] */
|
---|
141 | /* CC_HAS_RTTI_SUPPORT has Run Time Type Identification support */
|
---|
142 | /* ANSI_IO : rdbuf()->pubseekoff rather than seekg */
|
---|
143 | /* HAS_STR_NPOS : has string::npos and not a global NPOS */
|
---|
144 | /* NO_IOS_COMPLEX : does not have operator << defined for complex */
|
---|
145 | /* DECL_TEMP_SPEC : Template specialization declaration */
|
---|
146 | /* TSNMLUPG4 : Two stage name look-up scheme (g++>3.4) */
|
---|
147 | /* NEED_EXT_DECL_TEMP : extern declaration for template classes */
|
---|
148 |
|
---|
149 |
|
---|
150 | /* (STREAMPOS_IS_CLASS non-active: ca compile sans sur gcc3.2 et cxx)
|
---|
151 | rz+cmv 11/02/03 */
|
---|
152 |
|
---|
153 | /* The following is true for most compilers */
|
---|
154 |
|
---|
155 | #ifndef HAS_VEC_NEW
|
---|
156 | #define HAS_VEC_NEW
|
---|
157 | #endif
|
---|
158 |
|
---|
159 | #ifndef COMPILER_EXCEPTIONS
|
---|
160 | #define COMPILER_EXCEPTIONS
|
---|
161 | #endif
|
---|
162 |
|
---|
163 | #ifndef CC_HAS_RTTI_SUPPORT
|
---|
164 | #define CC_HAS_RTTI_SUPPORT
|
---|
165 | #endif
|
---|
166 |
|
---|
167 |
|
---|
168 | #ifndef DECL_TEMP_SPEC
|
---|
169 | #define DECL_TEMP_SPEC
|
---|
170 | #endif
|
---|
171 |
|
---|
172 | /* Most compilers dot not implement two level name lookup for templates
|
---|
173 | introduced by gcc >= 3.4
|
---|
174 | */
|
---|
175 | #ifdef TSNMLUPG4
|
---|
176 | #undef TSNMLUPG4
|
---|
177 | #endif
|
---|
178 |
|
---|
179 |
|
---|
180 | /* Dynamic_cast problem encountered on Mac OS X 10.6 for explicitly instanciated classes across
|
---|
181 | dynamic libraries. solved by extern declaration of explicitly instanciated template classes */
|
---|
182 | #ifndef NEED_EXT_DECL_TEMP
|
---|
183 | #define NEED_EXT_DECL_TEMP
|
---|
184 | #endif
|
---|
185 |
|
---|
186 |
|
---|
187 | /* now the specific things */
|
---|
188 |
|
---|
189 | #ifdef __GNUC__
|
---|
190 | #define GCC_VERSION (__GNUC__ * 1000 \
|
---|
191 | + __GNUC_MINOR__ * 100 \
|
---|
192 | + __GNUC_PATCHLEVEL__)
|
---|
193 | #define ANSI_TEMPLATES
|
---|
194 | /*
|
---|
195 | if (__GNUC__ >= 3)
|
---|
196 | define STREAMPOS_IS_CLASS
|
---|
197 | endif
|
---|
198 | */
|
---|
199 | #define GNU_TEMPLATES
|
---|
200 | #define HAS_STR_NPOS
|
---|
201 | #define HAS_IOS_BIN
|
---|
202 | #define HAS_IOS_NOCREATE
|
---|
203 | #if ( GCC_VERSION >= 3000 )
|
---|
204 | #undef DECL_TEMP_SPEC
|
---|
205 | #define DECL_TEMP_SPEC template <>
|
---|
206 | #endif
|
---|
207 | #if ( GCC_VERSION >= 3400 )
|
---|
208 | /* Two level name look-up scheme for templates introduced from gcc 3.4 */
|
---|
209 | #define TSNMLUPG4
|
---|
210 | #endif
|
---|
211 |
|
---|
212 | #endif
|
---|
213 |
|
---|
214 | #ifdef __DECCXX
|
---|
215 | #define HAS_STR_NPOS
|
---|
216 | #define ITER_TAG
|
---|
217 | #define __CXX_PRAGMA_TEMPLATES__
|
---|
218 | #define PRAGMA_TEMPLATES
|
---|
219 | #undef NEED_EXT_DECL_TEMP /* old compiler version cxx 6.5 - we don't activate extern declaration */
|
---|
220 | #endif
|
---|
221 |
|
---|
222 | #if defined (__aCC__)
|
---|
223 | #ifndef ANSI_TEMPLATES
|
---|
224 | #define ANSI_TEMPLATES
|
---|
225 | #endif
|
---|
226 | #endif
|
---|
227 |
|
---|
228 | #if defined(__KCC__)
|
---|
229 | /* KCC V 3.2 ne compile pas i/ostream s ; long p = s.tellg(); OK en V 3.3 */
|
---|
230 | #define HAS_STR_NPOS
|
---|
231 | #ifndef ANSI_TEMPLATES
|
---|
232 | #define ANSI_TEMPLATES
|
---|
233 | #endif
|
---|
234 | #endif
|
---|
235 |
|
---|
236 | #if defined(__SGICC__)
|
---|
237 | #define HAS_STR_NPOS
|
---|
238 | #ifndef ANSI_TEMPLATES
|
---|
239 | #define ANSI_TEMPLATES
|
---|
240 | #endif
|
---|
241 | #undef DECL_TEMP_SPEC
|
---|
242 | #define DECL_TEMP_SPEC template <>
|
---|
243 | #endif
|
---|
244 |
|
---|
245 | #if defined(__IBMCPP__)
|
---|
246 | /* IBM xlC compiler support Added : dec 2005 */
|
---|
247 | #ifndef ANSI_TEMPLATES
|
---|
248 | #define ANSI_TEMPLATES
|
---|
249 | #endif
|
---|
250 | #undef DECL_TEMP_SPEC
|
---|
251 | #define DECL_TEMP_SPEC template <>
|
---|
252 | #endif
|
---|
253 |
|
---|
254 | /* Get things has homogeneous as possible between compilers */
|
---|
255 |
|
---|
256 | #ifdef HAS_STR_NPOS
|
---|
257 | #define NPOS string::npos
|
---|
258 | #else
|
---|
259 | #define NPOS (size_t)-1
|
---|
260 | #endif
|
---|
261 |
|
---|
262 | #ifndef __GNUG__
|
---|
263 | #define __PRETTY_FUNCTION__ __FILE__ " __LINE__ "
|
---|
264 | #ifndef __FUNCTION__
|
---|
265 | #define __FUNCTION__ __FILE__ " __LINE__ "
|
---|
266 | #endif
|
---|
267 | #ifndef __KCC__
|
---|
268 | #define __attribute__(_x_)
|
---|
269 | #endif
|
---|
270 | #endif
|
---|
271 |
|
---|
272 |
|
---|
273 | #ifdef HAS_IOS_BIN
|
---|
274 | #define IOS_BIN ios::binary
|
---|
275 | #else
|
---|
276 | #define IOS_BIN 0
|
---|
277 | #endif
|
---|
278 |
|
---|
279 |
|
---|
280 | #ifdef Darwin
|
---|
281 | #define NO_VALUES_H
|
---|
282 | #include "osx_values.h"
|
---|
283 | #endif
|
---|
284 |
|
---|
285 |
|
---|
286 | #ifdef __cplusplus
|
---|
287 | /* Standard C++ library classes are in the namespace std */
|
---|
288 | namespace std { }
|
---|
289 | using namespace std;
|
---|
290 | /*******************************************/
|
---|
291 | /* SOPHYA classes are in namespace SOPHYA */
|
---|
292 | /* namespace SOPHYA {} */
|
---|
293 | /* using namespace SOPHYA; */
|
---|
294 | /* Please use instead: sopnamsp.h */
|
---|
295 | /*******************************************/
|
---|
296 | #endif
|
---|
297 |
|
---|
298 | #endif
|
---|