blob: 3e12cc4cf8eb64df846a59638729c755510a3b0d [file] [log] [blame]
Bjorn Reese45029602001-08-21 09:23:53 +00001/*************************************************************************
2 *
3 * $Id$
4 *
5 * Copyright (C) 2001 Bjorn Reese <breese@users.sourceforge.net>
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
12 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
13 * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
14 * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
15 *
16 ************************************************************************/
17
Bjorn Reese026d29f2002-01-19 15:40:18 +000018#ifndef TRIO_TRIODEF_H
19#define TRIO_TRIODEF_H
Bjorn Reese45029602001-08-21 09:23:53 +000020
21/*************************************************************************
22 * Platform and compiler support detection
23 */
24#if defined(__GNUC__)
25# define TRIO_COMPILER_GCC
26#elif defined(__SUNPRO_C)
27# define TRIO_COMPILER_SUNPRO
28#elif defined(__SUNPRO_CC)
29# define TRIO_COMPILER_SUNPRO
30# define __SUNPRO_C __SUNPRO_CC
31#elif defined(__xlC__) || defined(__IBMC__) || defined(__IBMCPP__)
32# define TRIO_COMPILER_XLC
33#elif defined(_AIX) && !defined(__GNUC__)
34# define TRIO_COMPILER_XLC /* Workaround for old xlc */
35#elif defined(__DECC) || defined(__DECCXX)
36# define TRIO_COMPILER_DECC
37#elif defined(_MSC_VER)
38# define TRIO_COMPILER_MSVC
39#endif
40
41#if defined(unix) || defined(__unix) || defined(__unix__)
42# define TRIO_PLATFORM_UNIX
43#elif defined(TRIO_COMPILER_XLC) || defined(_AIX)
44# define TRIO_PLATFORM_UNIX
45#elif defined(TRIO_COMPILER_DECC) || defined(__osf__)
46# define TRIO_PLATFORM_UNIX
47#elif defined(__NetBSD__)
48# define TRIO_PLATFORM_UNIX
49#elif defined(__QNX__)
50# define TRIO_PLATFORM_UNIX
Bjorn Reese026d29f2002-01-19 15:40:18 +000051# define TRIO_PLATFORM_QNX
Daniel Veillard3c5ed912002-01-08 10:36:16 +000052#elif defined(__CYGWIN__)
53# define TRIO_PLATFORM_UNIX
Bjorn Reese45029602001-08-21 09:23:53 +000054#elif defined(AMIGA) && defined(TRIO_COMPILER_GCC)
55# define TRIO_PLATFORM_UNIX
56#elif defined(TRIO_COMPILER_MSVC) || defined(WIN32) || defined(_WIN32)
57# define TRIO_PLATFORM_WIN32
Bjorn Reese026d29f2002-01-19 15:40:18 +000058#elif defined(VMS) || defined(__VMS)
59# define TRIO_PLATFORM_VMS
60#elif defined(mpeix) || defined(__mpexl)
61# define TRIO_PLATFORM_MPEIX
Bjorn Reese45029602001-08-21 09:23:53 +000062#endif
63
64#if defined(__STDC__)
65# define TRIO_COMPILER_SUPPORTS_C90
66# if defined(__STDC_VERSION__)
67# if (__STDC_VERSION__ >= 199409L)
68# define TRIO_COMPILER_SUPPORTS_C94
69# endif
70# if (__STDC_VERSION__ >= 199901L)
71# define TRIO_COMPILER_SUPPORTS_C99
72# endif
73# elif defined(TRIO_COMPILER_SUNPRO)
74# if (__SUNPRO_C >= 0x420)
75# define TRIO_COMPILER_SUPPORTS_C94
76# endif
77# endif
78#endif
79
80#if defined(_XOPEN_SOURCE)
81# if defined(_XOPEN_SOURCE_EXTENDED)
82# define TRIO_COMPILER_SUPPORTS_UNIX95
83# endif
84# if (_XOPEN_VERSION >= 500)
85# define TRIO_COMPILER_SUPPORTS_UNIX98
86# endif
87#endif
88
Bjorn Reese026d29f2002-01-19 15:40:18 +000089/*************************************************************************
90 * Generic defines
91 */
92
93#if !defined(TRIO_PUBLIC)
94# define TRIO_PUBLIC
95#endif
96#if !defined(TRIO_PRIVATE)
97# define TRIO_PRIVATE static
98#endif
99
100#if defined(TRIO_COMPILER_SUPPORTS_C90) || defined(__cplusplus)
101# define TRIO_CONST const
102# define TRIO_VOLATILE volatile
103# define TRIO_POINTER void *
104# define TRIO_PROTO(x) x
105#else
106# define TRIO_CONST
107# define TRIO_VOLATILE
108# define TRIO_POINTER char *
109# define TRIO_PROTO(x) ()
110#endif
111
112#if defined(TRIO_COMPILER_SUPPORTS_C99) || defined(__cplusplus)
113# define TRIO_INLINE inline
114#elif defined(TRIO_COMPILER_GCC)
115# define TRIO_INLINE __inline__
116#else
117# define TRIO_INLINE
118#endif
119
120#endif /* TRIO_TRIODEF_H */