1 // -*- Mode: C++; -*-
2 //                            Package   : omniORB2
3 // CORBA_sysdep.h             Created on: 30/1/96
4 //                            Author    : Sai Lai Lo (sll)
5 //
6 //    Copyright (C) 2002-2012 Apasphere Ltd
7 //    Copyright (C) 1996-1999 AT&T Laboratories Cambridge
8 //
9 //    This file is part of the omniORB library
10 //
11 //    The omniORB library is free software; you can redistribute it and/or
12 //    modify it under the terms of the GNU Lesser General Public
13 //    License as published by the Free Software Foundation; either
14 //    version 2.1 of the License, or (at your option) any later version.
15 //
16 //    This library is distributed in the hope that it will be useful,
17 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
18 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 //    Lesser General Public License for more details.
20 //
21 //    You should have received a copy of the GNU Lesser General Public
22 //    License along with this library. If not, see http://www.gnu.org/licenses/
23 //
24 //
25 // Description:
26 //	*** PROPRIETARY INTERFACE ***
27 //
28 //      Traditional-style hard-coded system dependencies.
29 
30 #ifndef __CORBA_SYSDEP_TRAD_H__
31 #define __CORBA_SYSDEP_TRAD_H__
32 
33 
34 #ifndef _CORBA_WCHAR_DECL
35 #  define _CORBA_WCHAR_DECL wchar_t
36 #endif
37 
38 
39 #define HAS_Cplusplus_const_cast
40 // Unset this define if the compiler does not support const_cast<T*>
41 
42 #define HAS_Cplusplus_reinterpret_cast
43 // Unset this define if the compiler does not support reinterpret_cast<T>
44 
45 #define HAS_Cplusplus_catch_exception_by_base
46 // Unset this define if the compiler does not support catching
47 // exceptions by base class.
48 
49 #define HAVE_STRDUP 1
50 // Unset if no strdup()
51 
52 #define HAVE_GETOPT 1
53 // Unset if no getopt()
54 
55 #define HAVE_UNISTD_H 1
56 // Unset if no unistd.h header
57 
58 #ifndef HAVE_GETPID
59 #  define HAVE_GETPID 1
60 #endif
61 // Unset if no getpid() function
62 
63 #define HAVE_LOCALTIME 1
64 // Unset if no localtime() function
65 
66 #ifndef HAVE_STRFTIME
67 #  define HAVE_STRFTIME 1
68 #endif
69 // Unset if no strftime() function
70 
71 #define HAVE_GETTIMEOFDAY 1
72 // Unset if no gettimeofday() function
73 
74 #define GETTIMEOFDAY_TIMEZONE
75 // Unset if gettimeofday() doesn't take a timezone argument
76 
77 #define HAVE_SIGNAL_H 1
78 // Unset if no signal.h header
79 
80 #define HAVE_SIGACTION 1
81 // Unset if no sigaction() function
82 
83 #define HAVE_SIG_IGN
84 // Unset if have sigaction() but have no SIG_IGN define
85 
86 #define HAVE_STRCASECMP 1
87 // Unset if no strcasecmp() function
88 
89 #define HAVE_STRNCASECMP 1
90 // Unset if no strncasecmp() function
91 
92 #define HAVE_UNAME  1
93 // Unset if no uname() function
94 
95 #define HAVE_GETHOSTNAME 1
96 // Unset if no gethostname() function
97 
98 #define HAVE_VSNPRINTF 1
99 // Unset if no vsnprintf() function
100 
101 #define HAVE_STRTOUL 1
102 // Unset if no strtoul() function
103 
104 
105 
106 //
107 // Compiler dependencies
108 //
109 
110 #if defined(__GNUG__)
111 // GNU G++ compiler
112 
113 #  if __GNUG__ == 2 && __GNUC_MINOR__ == 7
114 #     undef HAS_Cplusplus_catch_exception_by_base
115 #  endif
116 
117 // Minor version number 91 is for egcs version 1.*  Some older
118 // versions of 1.* may not support namespaces properly - this is
119 // only tested for egcs 1.1.1
120 #  if (__GNUG__ == 2 && (__GNUC_MINOR__ >= 91 || __GNUC_MINOR__ == 9)) || \
121       (__GNUG__ >= 3)
122 #     define HAS_Cplusplus_Namespace
123 #     define HAS_Cplusplus_Bool
124 #  endif
125 
126 // Since gcc 3.3 old IOstream's are considered deprecated.
127 #  if (__GNUG__ > 3 || (__GNUG__ == 3 && __GNUC_MINOR__ >= 3))
128 #     define HAS_Cplusplus_Namespace
129 #     define HAS_Std_Namespace
130 #     ifndef HAVE_STD
131 #         define HAVE_STD 1
132 #     endif
133 #  endif
134 
135 // GCC claims to support long long on all platforms
136 #  define HAS_LongLong
137 #  define HAS_LongDouble
138 #  define _CORBA_LONGLONG_DECL   long long
139 #  define _CORBA_ULONGLONG_DECL  unsigned long long
140 #  define _CORBA_LONGDOUBLE_DECL long double
141 #  define _CORBA_LONGLONG_CONST(x) (x##LL)
142 
143 #elif defined(__DECCXX)
144 // DEC C++ compiler
145 
146 #  if __DECCXX_VER >= 60000000
147 #     define HAS_LongLong
148 //#     define HAS_LongDouble
149 #     define _CORBA_LONGLONG_DECL   long long
150 #     define _CORBA_ULONGLONG_DECL  unsigned long long
151 #     define _CORBA_LONGDOUBLE_DECL long double
152 #     define _CORBA_LONGLONG_CONST(x) (x##LL)
153 #     ifndef NO_Cplusplus_Bool
154 #       define HAS_Cplusplus_Bool
155 #     endif
156 #     define HAS_Cplusplus_Namespace
157 #     define HAS_Std_Namespace
158 #     define HAS_pch
159 #     if __DECCXX_VER < 70390009
160 #       define OMNI_REQUIRES_FQ_BASE_CTOR
161 #     endif
162 // Uncomment the following lines to enable the use of namespace with cxx v5.6
163 // Notice that the source code may have to be patched to compile.
164 //#  elif __DECCXX_VER >= 50600000
165 //#     define HAS_Cplusplus_Namespace
166 //#     define NEED_DUMMY_RETURN
167 #  else
168 //    Compaq C++ 5.x
169 #     undef  HAS_Cplusplus_const_cast
170 #     undef  HAS_Cplusplus_reinterpret_cast
171 #     define OMNI_REQUIRES_FQ_BASE_CTOR
172 
173 #  endif
174 
175 #elif defined(__SUNPRO_CC)
176 // SUN C++ compiler
177 #  if __SUNPRO_CC >= 0x500
178 #    if __SUNPRO_CC_COMPAT >= 5
179 #      define HAS_Cplusplus_Namespace
180 #      define HAS_Std_Namespace
181 #      define HAS_Cplusplus_Bool
182 #    endif
183 #  endif
184 
185 #  define HAS_LongLong
186 #  define _CORBA_LONGLONG_DECL   long long
187 #  define _CORBA_ULONGLONG_DECL  unsigned long long
188 #  define _CORBA_LONGDOUBLE_DECL long double
189 #  define _CORBA_LONGLONG_CONST(x) (x##LL)
190 
191 #  define HAS_LongDouble
192 
193 
194 #elif defined(_MSC_VER)
195 //  Microsoft Visual C++ compiler
196 #  if _MSC_VER >= 1000
197 #    ifndef NO_Cplusplus_Bool
198 #      define HAS_Cplusplus_Bool
199 #    endif
200 #    define HAS_Cplusplus_Namespace
201 #    define HAS_Std_Namespace
202 #    ifndef HAVE_STD
203 #        define HAVE_STD 1
204 #    endif
205 #  endif
206 
207 #  if defined(_WIN64)
208 #    define SIZEOF_PTR  8
209 #  endif
210 
211 #  define HAS_LongLong
212 #  define _CORBA_LONGLONG_DECL   __int64
213 #  define _CORBA_ULONGLONG_DECL  unsigned __int64
214 #  define _CORBA_LONGLONG_CONST(x) (x)
215 
216 #elif defined(__DMC__)
217 //  Digital Mars C++
218 #  define HAS_Cplusplus_Bool
219 #  define HAS_Cplusplus_Namespace
220 #  define HAS_Std_Namespace
221 
222 #  define HAVE_STRTOULL
223 
224 #  define HAS_LongDouble
225 #  define HAS_LongLong
226 #  define _CORBA_LONGDOUBLE_DECL long double
227 #  define _CORBA_LONGLONG_DECL   long long
228 #  define _CORBA_ULONGLONG_DECL  unsigned long long
229 #  define _CORBA_LONGLONG_CONST(x) (x##LL)
230 
231 #  define OMNI_REQUIRES_FQ_BASE_CTOR
232 
233 #elif defined(__BCPLUSPLUS__)
234 // Borland C++ Builder
235 #  define HAS_Cplusplus_Namespace
236 #  define HAS_Std_Namespace
237 
238 #  define HAS_LongLong
239 #  define _CORBA_LONGLONG_DECL   __int64
240 #  define _CORBA_ULONGLONG_DECL  unsigned __int64
241 #  define _CORBA_LONGLONG_CONST(x) (x)
242 
243 #  define OMNI_REQUIRES_FQ_BASE_CTOR
244 
245 #elif defined(__KCC)
246 // Kai C++
247 #  define HAS_Cplusplus_Namespace
248 #  define HAS_Std_Namespace
249 #  define HAS_Cplusplus_Bool
250 
251 #elif defined(__sgi)
252 
253 #  if _COMPILER_VERSION >= 721
254 #    define HAS_Cplusplus_Namespace
255 #    define HAS_Cplusplus_Bool
256 #    define HAS_Cplusplus_const_cast
257 #    define OMNI_REQUIRES_FQ_BASE_CTOR
258 #    define HAS_LongLong
259 #    define HAS_LongDouble
260 #    define _CORBA_LONGLONG_DECL long long
261 #    define _CORBA_ULONGLONG_DECL unsigned long long
262 #    define _CORBA_LONGDOUBLE_DECL long double
263 #    define _CORBA_LONGLONG_CONST(x) (x##LL)
264 #  endif
265 #  if  _MIPS_SZINT == 64
266 #    define SIZEOF_INT 8
267 #  endif
268 #  if _MIPS_SZLONG == 64
269 #    define SIZEOF_LONG 8
270 #  endif
271 #  if _MIPS_SZPTR == 64
272 #    define SIZEOF_PTR 8
273 #  endif
274 
275 #elif defined(__xlC__)
276 #  if (__xlC__ <= 0x0306)
277 #    undef HAS_Cplusplus_const_cast
278 #    undef HAS_Cplusplus_reinterpret_cast
279 #  elif (__xlC__ >= 0x0500) // added in xlC 5.0 (a.k.a. Visual Age 5.0)
280 #    define HAS_Cplusplus_Bool
281 #    define HAS_Cplusplus_Namespace
282 #    define HAS_Std_Namespace
283 #    define HAS_LongLong
284 #    define HAS_LongDouble
285 #    define _CORBA_LONGLONG_DECL long long
286 #    define _CORBA_ULONGLONG_DECL unsigned long long
287 #    define _CORBA_LONGDOUBLE_DECL long double
288 #    define _CORBA_LONGLONG_CONST(x) (x##LL)
289 #  endif
290 
291 #elif defined(__hpux__)
292 // Recent versions of HP aCC (A01.18 and A.03.13) have an identifying macro.
293 // In the future, we should be able to remove the gcc test.
294 // In case this is an older compiler aCC, test if this is gcc, if not assume
295 // it is aCC.
296 #  if defined(__HP_aCC) || !defined(__GNUG__)
297 #    define HAS_Cplusplus_Namespace
298 #    define HAS_Cplusplus_Bool
299 #    define HAS_LongLong
300 #    define _CORBA_LONGLONG_DECL   long long
301 #    define _CORBA_ULONGLONG_DECL  unsigned long long
302 #    define _CORBA_LONGLONG_CONST(x) (x##LL)
303 #    if defined(_FPWIDETYPES)
304 #      define HAS_LongDouble
305 #      define _CORBA_LONGDOUBLE_DECL long double
306 #    endif
307 #    ifndef HAVE_STD
308 #        define HAVE_STD 1
309 #    endif
310 // ia64 in 64-bit mode
311 #    if defined(__LP64__)
312 #      define SIZEOF_CHAR 1
313 #      define SIZEOF_DOUBLE 8
314 #      define SIZEOF_FLOAT 4
315 #      define SIZEOF_INT 4
316 #      define SIZEOF_LONG 8
317 #      define SIZEOF_LONG_LONG 8
318 #      define SIZEOF_PTR 8
319 #    endif
320 #  endif
321 
322 #elif defined(__MWERKS__)
323 // Metrowerks CodeWarrior Pro 8 or later for Mac OS Classic or Carbon
324 #  define HAS_Cplusplus_Bool
325 #  define HAS_Cplusplus_Namespace
326 #  define HAS_Std_Namespace
327 #  define HAS_LongLong
328 #  define _CORBA_LONGLONG_DECL long long
329 #  define _CORBA_ULONGLONG_DECL unsigned long long
330 #  define _CORBA_LONGLONG_CONST(x) (x##LL)
331 
332 #endif
333 
334 
335 //
336 // Processor dependencies
337 //
338 
339 #if defined(__x86__)
340 #  define _OMNIORB_HOST_BYTE_ORDER_ 1
341 #  define SIZEOF_LONG_DOUBLE 12
342 
343 #elif defined(__sparc__)
344 #  define _OMNIORB_HOST_BYTE_ORDER_ 0
345 
346 #elif defined(__alpha__)
347 #  define _OMNIORB_HOST_BYTE_ORDER_ 1
348 #  ifndef __VMS
349 #    define SIZEOF_LONG 8
350 #    define SIZEOF_INT  4
351 #    define SIZEOF_PTR  8
352 #  endif
353 
354 #elif defined(__hppa__)
355 #  define _OMNIORB_HOST_BYTE_ORDER_ 0
356 
357 #elif defined(__ia64__)
358 // IA64 is big-endian on HPUX, little endian on everything else
359 #  if defined(__hpux__)
360 #    define _OMNIORB_HOST_BYTE_ORDER_ 0
361 #  else
362 #    define _OMNIORB_HOST_BYTE_ORDER_ 1
363 #  endif
364 
365 #elif defined(__powerpc__)
366 #  define _OMNIORB_HOST_BYTE_ORDER_ 0
367 
368 #elif defined(__mips__)
369 #  define _OMNIORB_HOST_BYTE_ORDER_ 0
370 
371 #elif defined(__s390__)
372 #  define _OMNIORB_HOST_BYTE_ORDER_ 0
373 
374 #elif defined(__arm__)
375 // armv5teb is big-endian
376 #  if defined(__armv5teb__)
377 #    define _OMNIORB_HOST_BYTE_ORDER_ 0
378 #  else
379 #    define _OMNIORB_HOST_BYTE_ORDER_ 1
380 #  endif
381 
382 #elif defined(__m68k__)
383 #  define _OMNIORB_HOST_BYTE_ORDER_ 0
384 
385 #elif defined(__vax__)
386 #  define _OMNIORB_HOST_BYTE_ORDER_ 1
387 
388 #endif
389 
390 
391 //
392 // OS dependencies
393 //
394 
395 #if defined(__linux__)
396 #  define OMNI_SOCKNAME_SIZE_T socklen_t
397 #  define HAVE_STRTOULL 1
398 #  ifndef HAVE_STD
399 #    define HAVE_STD 1
400 #  endif
401 
402 #elif defined(__sunos__)
403 #  ifndef HAVE_STD
404 #    define HAVE_STD 1
405 #  endif
406 #  define HAVE_STRTOULL 1
407 #  define HAVE_ISNANORINF
408 #  define HAVE_NAN_H
409 #  if __OSVERSION__ == 4
410 #    define OMNI_SOCKNAME_SIZE_T int
411 #  elif __OSVERSION__ == 5 || __OSVERSION__ == 6
412 #    define OMNI_SOCKNAME_SIZE_T size_t
413 #  else
414 #    define OMNI_SOCKNAME_SIZE_T socklen_t
415 #  endif
416 #  if __OSVERSION__ == 5 && (!defined(__GNUG__) || __GNUG__ < 3)
417 #    define NEED_GETHOSTNAME_PROTOTYPE
418 #  endif
419 
420 #elif defined(__hpux__)
421 
422 #elif defined(__irix__)
423 #  undef HAVE_GETHOSTNAME
424 
425 #elif defined(__freebsd__)
426 #  define HAVE_STRTOUQ 1
427 #  if __OSVERSION__ >= 4
428 #    define OMNI_SOCKNAME_SIZE_T socklen_t
429 #  endif
430 
431 #elif defined(__aix__)
432 #  define OMNI_SOCKNAME_SIZE_T size_t
433 
434 #elif defined(__SINIX__)
435 #  undef GETTIMEOFDAY_TIMEZONE
436 #  define OMNI_SOCKNAME_SIZE_T size_t
437 
438 #elif defined(__uw7__)
439 #  define OMNI_SOCKNAME_SIZE_T size_t
440 
441 #elif defined(__darwin__)
442 #  define HAVE_STRTOUQ 1
443 #  define OMNI_SOCKNAME_SIZE_T socklen_t
444 #  define HAVE_STRUCT_SOCKADDR_IN_SIN_ZERO 1
445 #  define HAVE_STRUCT_SOCKADDR_IN_SIN_LEN 1
446 
447 #elif defined(__nextstep__)
448 #  undef HAVE_STRDUP
449 #  undef HAVE_UNAME
450 #  undef HAVE_SIGACTION
451 #  define HAVE_SIGVEC
452 
453 #elif defined(__atmos__)
454 #  define NO_FLOAT
455 
456 #elif defined(__VMS)
457 #  define OMNI_SOCKNAME_SIZE_T size_t
458 #  undef HAVE_STRDUP
459 #  if __VMS_VER < 70000000
460 #    undef HAVE_GETOPT
461 #    undef HAVE_STRCASECMP
462 #    undef HAVE_STRNCASECMP
463 #    undef HAVE_GETTIMEOFDAY
464 #  endif
465 #  if __CRTL_VER >= 70311000
466 #    define HAVE_POLL
467 #  endif
468 
469 #elif defined(__WIN32__)
470 #  define SIZEOF_WCHAR 2
471 #  undef HAVE_UNISTD_H
472 #  undef HAVE_GETOPT
473 #  undef HAVE_GETTIMEOFDAY
474 #  undef HAVE_GETPID
475 #  undef HAVE_SIGNAL_H
476 #  undef HAVE_SIGACTION
477 #  undef HAVE_STRCASECMP
478 #  undef HAVE_STRNCASECMP
479 #  undef HAVE_UNAME
480 #  undef HAVE_GETHOSTNAME
481 #  undef HAVE_POLL
482 
483 #if defined(_MSC_VER) && _MSC_VER >= 1300  // VC++ 7 or greater
484 #  define HAVE_GETADDRINFO 1
485 #  define HAVE_GETNAMEINFO 1
486 #  define HAVE_STRUCT_SOCKADDR_IN6 1
487 #  define HAVE_STRUCT_SOCKADDR_STORAGE 1
488 #endif
489 
490 #ifdef __MINGW32__
491 #  define HAVE_STRCASECMP
492 #  define HAVE_STRNCASECMP
493 #  define HAVE_VPRINTF
494 #endif
495 
496 #elif defined(__vxWorks__)
497 #  undef HAVE_GETTIMEOFDAY
498 #  undef HAVE_STRCASECMP
499 #  undef HAVE_STRNCASECMP
500 
501 #elif defined(__macos__)
502 #  define SIZEOF_WCHAR 2
503 #  define OMNI_SOCKNAME_SIZE_T socklen_t
504 #  define HAVE_STRTOULL 1
505 
506 #endif
507 
508 
509 
510 //
511 // Default flag values if not already overridden above
512 //
513 
514 #ifndef SIZEOF_BOOL
515 #define SIZEOF_BOOL 1
516 #endif
517 
518 #ifndef SIZEOF_LONG
519 #define SIZEOF_LONG 4
520 #endif
521 
522 #ifndef SIZEOF_INT
523 #define SIZEOF_INT 4
524 #endif
525 
526 #ifndef SIZEOF_PTR
527 #define SIZEOF_PTR  4
528 #endif
529 
530 #ifndef SIZEOF_LONG_DOUBLE
531 #define SIZEOF_LONG_DOUBLE 16
532 #endif
533 
534 #ifndef SIZEOF_WCHAR
535 #  define SIZEOF_WCHAR 4
536 #endif
537 
538 #ifndef OMNI_SOCKNAME_SIZE_T
539 #  define OMNI_SOCKNAME_SIZE_T int
540 #endif
541 
542 #ifndef _OMNIORB_HOST_BYTE_ORDER_
543 # error "The byte order of this platform is unknown"
544 #endif
545 
546 
547 
548 
549 #endif // __CORBA_SYSDEP_TRAD_H__
550