source: Sophya/trunk/SophyaLib/BaseTools/machdefs_mkmf.h@ 3007

Last change on this file since 3007 was 2884, checked in by ansari, 20 years ago

Modifs pour compilation avec g++ 4 (V >= 3.4) - Reza 4 Jan 2006

File size: 10.7 KB
RevLine 
[1261]1#ifndef MACHDEFS_SEEN
2#define MACHDEFS_SEEN
3
4/***********************************************************************/
5/* Find hardware, OS and compiler combination */
6/***********************************************************************/
7
8#if defined(OSF1)
9#define MACH_ALPHA
10#define OS_OSF1
11#endif
12
13#if defined(_AIX) || defined(AIX)
14#define MACH_IBMRS
15#define OS_AIX
16#endif
17
18#if defined(__hpux__) || defined(HPUX)
19#define MACH_HP
20#define OS_HPUX
21#endif
22
23#ifdef __MWERKS__
24#define MACH_POWERMAC
25#define OS_MACOS
26#endif
27
28#if defined(SunOS) || defined ( sun )
29#define MACH_SUN
30#define OS_SOLARIS
31#endif
32
33#ifdef IRIX64
34#define MACH_SGI
35#define OS_IRIX64
36#endif
37
[1783]38#ifdef __APPLE__
39#ifdef __MACH__
40#define MACH_POWERPC
41#define OS_MACOSX
42#endif
43#endif
44
[1261]45#if defined(Linux) || defined(linux)
46#if defined(__alpha__)
47#define MACH_ALPHA
48#elif defined(powerpc)
49#define MACH_POWERPC
50#elif defined(__i386__)
51#define MACH_INTEL
52#else
53#error Undefined Platform (machine) type with linux in machdefs.h
54#endif
55#define OS_LINUX
56#endif
57
58
59/***********************************************************************/
60/* Hardware/OS dependent stuff */
61/***********************************************************************/
62
63#if defined(OS_OSF1)
64
65 typedef signed char int_1;
66 typedef unsigned char uint_1;
67 typedef int int_4;
68 typedef unsigned int uint_4;
69 typedef short int_2;
70 typedef unsigned short uint_2;
71 typedef float r_4;
72 typedef double r_8;
73 typedef long long int_8;
74 typedef unsigned long long uint_8;
75
76#define SWAP 1
77#define SWAPDEFAUT 1
78
79#elif defined(OS_HPUX)
80
81 typedef signed char int_1;
82 typedef unsigned char uint_1;
83 typedef int int_4 ;
84 typedef unsigned int uint_4;
85 typedef short int_2;
86 typedef unsigned short uint_2;
87 typedef float r_4;
88 typedef double r_8;
89 typedef long long int_8;
90 typedef unsigned long long uint_8;
91
92#define SWAP 0
93#define SWAPDEFAUT 0
94
95
96#elif defined( OS_AIX )
97
98 typedef signed char int_1;
99 typedef unsigned char uint_1;
100 typedef int int_4;
101 typedef unsigned int uint_4;
102 typedef short int_2;
103 typedef unsigned short uint_2;
104 typedef float r_4;
105 typedef double r_8;
106 typedef long long int_8;
107 typedef unsigned long long uint_8;
108
109#define SWAP 0
110#define SWAPDEFAUT 0
111
112/* Check for solaris on intel... */
113#elif defined( OS_SOLARIS ) && defined( MACH_SUN )
114
115 typedef signed char int_1;
116 typedef unsigned char uint_1;
117 typedef int int_4;
118 typedef unsigned int uint_4;
119 typedef short int_2;
120 typedef unsigned short uint_2;
121 typedef float r_4;
122 typedef double r_8;
123 typedef long long int_8;
124 typedef unsigned long long uint_8;
125
126#define SWAP 0
127#define SWAPDEFAUT 0
128
129#elif defined( OS_IRIX64 )
130
131 typedef signed char int_1;
132 typedef unsigned char uint_1;
133 typedef int int_4;
134 typedef unsigned int uint_4;
135 typedef short int_2;
136 typedef unsigned short uint_2;
137 typedef float r_4;
138 typedef double r_8;
139 typedef long long int_8;
140 typedef unsigned long long uint_8;
141
142#define SWAP 0
143#define SWAPDEFAUT 0
144
145/* Check linux on other machines than Intel */
146#elif defined(OS_LINUX)
147/* Sizes OK for PowerPC, Alpha, Intel */
148/* On Alpha, long is 8 bytes */
149 typedef signed char int_1;
150 typedef unsigned char uint_1;
151 typedef int int_4;
152 typedef unsigned int uint_4;
153 typedef short int_2;
154 typedef unsigned short uint_2;
155 typedef float r_4;
156 typedef double r_8;
157 typedef long long int_8;
158 typedef unsigned long long uint_8;
159
160#if defined(powerpc) || (__alpha__)
161#define SWAP 0
162#define SWAPDEFAUT 0
163#else
164#define SWAP 1
165#define SWAPDEFAUT 1
166#endif
167
168#elif defined(OS_MACOS)
169
170 typedef signed char int_1;
171 typedef unsigned char uint_1;
172 typedef long int_4;
173 typedef unsigned long uint_4;
174 typedef short int_2;
175 typedef unsigned short uint_2;
176 typedef float r_4;
177 typedef double r_8;
178 typedef long long int_8;
179 typedef unsigned long long uint_8;
180
181#define SWAP 0
182#define SWAPDEFAUT 0
183
[1783]184#elif defined(OS_MACOSX)
185
186 typedef signed char int_1;
187 typedef unsigned char uint_1;
188 typedef int int_4;
189 typedef unsigned int uint_4;
190 typedef short int_2;
191 typedef unsigned short uint_2;
192 typedef float r_4;
193 typedef double r_8;
194 typedef long long int_8;
195 typedef unsigned long long uint_8;
196
197#define SWAP 0
198#define SWAPDEFAUT 0
199
200
[1261]201#else
202#error Undefined Machine/OS type in machdefs.h
203#endif
204
205
206
207#if SWAP==1
208#define IS_BIG_ENDIAN 0
209#else
210#define IS_BIG_ENDIAN 1
211#endif
212
213
214/***********************************************************************/
215/* Find Compiler */
216/***********************************************************************/
217
218/* __MWERKS__ : Metrowerks Codewarrior (>= PRO 4) */
219/* __DECCXX : DEC CXX, version >= 6 is required */
220/* __GNUG__ : GNU C++ 2.8.1, egcs ?? */
221/* __aCC__ : aCC on HP */
222/* __KCC__ : KCC, version >= 3.3 is required */
223/* __SGICC__ : SGI (IRIX64) CC compiler */
[2884]224/* __INTEL_COMPILER : : INTEL compiler */
225/* __IBMCPP__ : AIX (IBM) xlC c++ compiler */
[1261]226
227/***********************************************************************/
228/* Compiler-specific stuff */
229/***********************************************************************/
230
231/* ANSI_TEMPLATES : use ANSI syntax for explicit templates */
232/* GNUG_TEMPLATES : use GNU syntax for explicit templates */
233/* PRAGMA_TEMPLATES : use pragma template, a la cxx */
234/* COMPILER_EXCEPTIONS : knows about exceptions --- required ? */
235/* STREAMPOS_IS_CLASS : streampos is a real class */
236/* ITER_TAG : use iter_tag for iterator qualifiers in STL */
237/* NO_STRSTREAM : does not have strstream */
[1889]238/* NO_EXPLICIT : does not know about explicit keyword */
[1261]239/* HAS_IOS_BIN */
240/* HAS_IOS_NOCREATE */
241/* HAS_VEC_NEW : operator new[] */
242/* CC_HAS_RTTI_SUPPORT has Run Time Type Identification support */
243/* ANSI_IO : rdbuf()->pubseekoff rather than seekg */
244/* HAS_STR_NPOS : has string::npos and not a global NPOS */
245/* NO_IOS_COMPLEX : does not have operator << defined for complex */
[2339]246/* DECL_TEMP_SPEC : Template specialization declaration */
[2884]247/* TSNMLUPG4 : Two stage name look-up scheme (g++>3.4) */
[1261]248
249
[2322]250/* (STREAMPOS_IS_CLASS non-active: ca compile sans sur gcc3.2 et cxx)
251 rz+cmv 11/02/03 */
252
[1261]253/* The following is true for most compilers */
254
255#ifndef HAS_VEC_NEW
256#define HAS_VEC_NEW
257#endif
258
259#ifndef COMPILER_EXCEPTIONS
260#define COMPILER_EXCEPTIONS
261#endif
262
263#ifndef CC_HAS_RTTI_SUPPORT
264#define CC_HAS_RTTI_SUPPORT
265#endif
266
[2339]267
268#ifndef DECL_TEMP_SPEC
269#define DECL_TEMP_SPEC
270#endif
271
[2884]272/* Most compilers dot not implement two level name lookup for templates
273 introduced by gcc >= 3.4
274*/
275#ifdef TSNMLUPG4
276#undef TSNMLUPG4
277#endif
[2339]278
[1261]279/* now the specific things */
280
281#ifdef __MWERKS__
282#define ANSI_TEMPLATES
283#undef HAS_VEC_NEW
284#define NO_STRSTREAM
285//#define STREAMPOS_IS_CLASS
286#define ITER_TAG
287#define HAS_IOS_BIN
288#define HAS_IOS_NOCREATE
289#define HAS_STR_NPOS
290#endif
291
292#ifdef __GNUG__
[2884]293#define GCC_VERSION (__GNUC__ * 10000 \
294 + __GNUC_MINOR__ * 100 \
295 + __GNUC_PATCHLEVEL__)
[1261]296#define ANSI_TEMPLATES
[2322]297/*
298if (__GNUC__ >= 3)
299define STREAMPOS_IS_CLASS
300endif
301*/
302#define GNU_TEMPLATES
[1261]303#define HAS_STR_NPOS
304#define HAS_IOS_BIN
305#define HAS_IOS_NOCREATE
[2884]306#if ( GCC_VERSION >= 30000 )
307#undef DECL_TEMP_SPEC
308#define DECL_TEMP_SPEC template <>
[1261]309#endif
[2884]310#if ( GCC_VERSION >= 34000 )
311/* Two level name look-up scheme for templates introduced from gcc 3.4 */
312#define TSNMLUPG4
313#endif
[1261]314
[2884]315#endif
316
[1261]317#ifdef __DECCXX
318#define HAS_STR_NPOS
319#define ITER_TAG
320#define __CXX_PRAGMA_TEMPLATES__
321#define PRAGMA_TEMPLATES
322#endif
323
324#if defined (__aCC__)
325#ifndef ANSI_TEMPLATES
326#define ANSI_TEMPLATES
327#endif
328#endif
329
330#if defined(__KCC__)
331/* KCC V 3.2 ne compile pas i/ostream s ; long p = s.tellg(); OK en V 3.3 */
332#define HAS_STR_NPOS
333#ifndef ANSI_TEMPLATES
334#define ANSI_TEMPLATES
335#endif
336#endif
337
338#if defined(__SGICC__)
339#define HAS_STR_NPOS
340#ifndef ANSI_TEMPLATES
341#define ANSI_TEMPLATES
[2867]342#endif
[2339]343#undef DECL_TEMP_SPEC
344#define DECL_TEMP_SPEC template <>
[1261]345#endif
[2867]346
347#if defined(__IBMCPP__)
348/* IBM xlC compiler support Added : dec 2005 */
349#ifndef ANSI_TEMPLATES
350#define ANSI_TEMPLATES
[1261]351#endif
[2867]352#undef DECL_TEMP_SPEC
353#define DECL_TEMP_SPEC template <>
354#endif
[1261]355
356/* Get things has homogeneous as possible between compilers */
357
358#ifdef HAS_STR_NPOS
359#define NPOS string::npos
360#else
361#define NPOS (size_t)-1
362#endif
363
364#ifndef __GNUG__
365#define __PRETTY_FUNCTION__ __FILE__ " __LINE__ "
366#ifndef __FUNCTION__
367#define __FUNCTION__ __FILE__ " __LINE__ "
368#endif
369#ifndef __KCC__
370#define __attribute__(_x_)
371#endif
372#endif
373
[1889]374#ifdef NO_EXPLICIT
[1261]375#define explicit
376#endif
377
378#ifdef HAS_IOS_BIN
379#define IOS_BIN ios::binary
380#else
381#define IOS_BIN 0
382#endif
383
[2322]384/* Commente par Reza+CMV - Fev 2003
385 ifdef ANSI_IO
386 define seekg(p_, m_) rdbuf()->pubseekoff(p_,m_)
387 define seekp(p_, m_) rdbuf()->pubseekoff(p_,m_)
388 endif
389*/
[1261]390
391#ifdef __MWERKS__
392//#define hypot(_x_,_y_) sqrt((_x_)*(_x_) + (_y_)*(_y_))
393#define random() (rand()*65538.0 + rand()*2. + rand())
394#define srandom srand
395#define initstate(seed, tab, n) srand(seed)
396#define nice(_x)
397
398#ifdef __cplusplus
399#include <string.h>
400#include <string>
401inline bool operator< (string const& s1, string const& s2)
402{ return (strcmp(s1.c_str(), s2.c_str()) < 0); }
403#endif
404#endif
405
[1783]406#ifdef OS_MACOSX
407#define NO_VALUES_H
408#include "osx_values.h"
409#endif
[1261]410
[1783]411
[1261]412/********************************************************/
413/* Outil d'impressions pour debug */
414#define PR(_data_) {cout<<" "<<#_data_<<" "<<_data_;}
415#define CR {cout<<"\n"<<flush;}
416/* ********************************************************/
417
418/* ---- Activation des flags de debug/bound checking ----- */
419#ifdef SOPHYA_DEBUG
420#define SO_BOUNDCHECKING
421#endif
422
423/* ---- La taille et les index des tableaux ---- */
424#ifdef SGI_ARCH64
425typedef int_8 sa_size_t ;
426#else
427typedef int_4 sa_size_t ;
428#endif
429
430/* Compatibilite, avant de migrer tout le code en "PLANCK" */
431
432#ifdef __cplusplus
[1870]433/* Standard C++ library classes are in the namespace std */
434namespace std { }
435using namespace std;
[2615]436/*******************************************/
437/* SOPHYA classes are in namespace SOPHYA */
438/* namespace SOPHYA {} */
439/* using namespace SOPHYA; */
440/* Please use instead: sopnamsp.h */
441/*******************************************/
[1261]442#define EXPLICIT explicit
443#endif
444
445#endif
Note: See TracBrowser for help on using the repository browser.