casacore
aipsenv.h
Go to the documentation of this file.
1 //# aipsenv.h: Global initialization for special Casacore macros
2 //# Copyright (C) 2000,2001,2002,2003,2004,2016
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 // this file contains all the compiler specific defines
29 
30 #ifndef CASA_AIPSENV_H
31 #define CASA_AIPSENV_H
32 
33 namespace casacore { //# NAMESPACE CASACORE - BEGIN
34 
35 // Set if compiler supports C++11 or newer
36 #if __cplusplus >= 201103L
37 #define AIPS_CXX11
38 #endif
39 
40 // Set if compiler supports C++14 or newer
41 #if __cplusplus >= 201402L
42 #define AIPS_CXX11
43 #define AIPS_CXX14
44 #endif
45 
46 // Set if GCC compiler is used.
47 #if defined(AIPS_GCC)
48 #undef AIPS_GCC
49 #endif
50 #if defined(__GNUC__)
51 #define AIPS_GCC
52 #endif
53 
54 /* ONLY USE IF CODE WILL _NOT_ WORK WITH NEWER VERSIONS */
55 #if defined(AIPS_GCC2)
56 #undef AIPS_GCC2
57 #endif
58 #if (defined(AIPS_GCC) && __GNUC_CC == 2)
59 #define AIPS_GCC2
60 #endif
61 
62 /* ONLY USE IF CODE WILL _NOT_ WORK WITH NEWER VERSIONS */
63 #if defined(AIPS_GCC295)
64 #undef AIPS_GCC295
65 #endif
66 #if (defined(AIPS_GCC2) && __GNUC_MINOR__ == 95)
67 #define AIPS_GCC295
68 #endif
69 
70 /* ONLY USE IF CODE WILL _NOT_ WORK WITH NEWER VERSIONS */
71 #if defined(AIPS_GCC3)
72 #undef AIPS_GCC3
73 #endif
74 #if (defined(AIPS_GCC) && __GNUC__ == 3)
75 #define AIPS_GCC3
76 #endif
77 
78 /* ONLY USE IF CODE WILL _NOT_ WORK WITH NEWER VERSIONS */
79 #if defined(AIPS_GCC4)
80 #undef AIPS_GCC4
81 #endif
82 #if (defined(AIPS_GCC) && __GNUC__ == 4)
83 #define AIPS_GCC4
84 #endif
85 
86 // Alternate project compiler
87 #if defined(AIPS_SGI)
88 #undef AIPS_SGI
89 #endif
90 #if defined(__sgi)
91 #define AIPS_SGI
92 #if defined(_MIPS_SZPTR) && (_MIPS_SZPTR == 64)
93 #define AIPS_64B
94 #define SGI64
95 #endif
96 #endif
97 
98 // Alternate project compiler
99 #if defined(AIPS_SUN_NATIVE)
100 #undef AIPS_SUN_NATIVE
101 #endif
102 #if defined(__SUNPRO_CC)
103 #define AIPS_SUN_NATIVE
104 #endif
105 
106 #if defined(AIPS_SOLARIS)
107 #undef AIPS_SOLARIS
108 #endif
109 #if defined(__sun)
110 #define AIPS_SOLARIS
111 #endif
112 
113 #if defined(AIPS_HP)
114 #undef AIPS_HP
115 #endif
116 #if defined(__hp)
117 #define AIPS_HP
118 #endif
119 
120 #if defined(AIPS_ALPHA)
121 #undef AIPS_ALPHA
122 #endif
123 #if defined(__alpha)
124 #define AIPS_ALPHA
125 #define AIPS_64B
126 #endif
127 
128 #if defined(AIPS_BSD)
129 #undef AIPS_BSD
130 #endif
131 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
132 #define AIPS_BSD
133 #define AIPS_NOLARGEFILE
134 #endif
135 
136 #if defined(AIPS_HURD)
137 #undef AIPS_HURD
138 #endif
139 #if defined(__gnu_hurd__)
140 #define AIPS_HURD
141 #endif
142 
143 #if defined(AIPS_LINUX)
144 #undef AIPS_LINUX
145 #endif
146 #if defined(__linux__)
147 #define AIPS_LINUX
148 #endif
149 
150 #if defined(AIPS_KAI)
151 #undef AIPS_KAI
152 #endif
153 #if defined(__kai)
154 #define AIPS_KAI
155 #endif
156 
157 #if defined(AIPS_AIX)
158 #undef AIPS_AIX
159 #endif
160 #if defined(_AIX)
161 #define AIPS_AIX
162 #endif
163 
164 #if defined(AIPS_INTELCC)
165 #undef AIPS_INTELCC
166 #endif
167 #if defined(__INTEL_COMPILER)
168 #define AIPS_INTELCC
169 #endif
170 
171 #if defined(AIPS_CRAY_PGI)
172 #undef AIPS_CRAY_PGI
173 #endif
174 #if defined(__QK_USER__)
175 #define AIPS_CRAY_PGI
176 #if !defined(AIPS_NOLARGEFILE)
177 #define AIPS_NOLARGEFILE
178 #endif
179 #if !defined(AIPS_NO_LEA_MALLOC)
180 #define AIPS_NO_LEA_MALLOC
181 #endif
182 #endif
183 
184 #if defined(AIPS_CRAY_CATAMOUNT)
185 #undef AIPS_CRAY_CATAMOUNT
186 #endif
187 #if defined(__LIB_CATAMOUNT__)
188 #define AIPS_CRAY_CATAMOUNT
189 #endif
190 
191 #if (defined(__ia64) || defined(__x86_64__) || defined(__aarch64__))
192 # if !defined(AIPS_64B)
193 # define AIPS_64B
194 # endif
195 #endif
196 
197 #if defined(AIPS_I386)
198 #undef AIPS_I386
199 #endif
200 #if defined(i386)
201 #define AIPS_I386
202 #endif
203 
204 #if defined(AIPS_DARWIN)
205 #undef AIPS_DARWIN
206 #endif
207 #if defined(__APPLE__)
208 #define AIPS_DARWIN
209 // No need for largefile definition as it is the default under DARWIN
210 #define AIPS_NOLARGEFILE
211  // Don't use AIPS_LITTLE_ENDIAN as this would prevent universal builds
212  // from working. Auto-detect from AIPS_I386 for intel Macs
213 #define AIPS_NO_LEA_MALLOC
214 # if defined(AIPS_LITTLE_ENDIAN)
215 # undef AIPS_LITTLE_ENDIAN
216 # endif
217 #endif
218 
219 // If the compiler specifies endianness, use that
220 #if !(defined(AIPS_LITTLE_ENDIAN))
221 #if (defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__))
222 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
223 #define AIPS_LITTLE_ENDIAN
224 #endif
225 #else
226 // Automatically configure for known LITTLE ENDIAN systems
227 #if (defined(AIPS_ALPHA) || defined(AIPS_I386) || defined(__x86_64__) || defined(__ARMEL__) || defined(__AARCH64EL__))
228 #define AIPS_LITTLE_ENDIAN
229 #endif
230 #endif
231 #endif
232 
233 
234 // If needed, define the LFS variables (needed in code using cfitsio).
235 #ifndef AIPS_NOLARGEFILE
236 # undef _FILE_OFFSET_BITS
237 # define _FILE_OFFSET_BITS 64
238 # ifndef _LARGEFILE_SOURCE
239 # define _LARGEFILE_SOURCE
240 # endif
241 # ifndef _LARGEFILE64_SOURCE
242 # define _LARGEFILE64_SOURCE
243 # endif
244 #endif
245 
246 
247 // Compiler hints for branch prediction (and code layout).
248 // Use only after profiling performance critical code,
249 // or on checks for exceptional conditions.
250 #if defined __GNUC__ || defined __clang__
251 #define AIPS_LIKELY(x) __builtin_expect(!!(x), 1)
252 #define AIPS_UNLIKELY(x) __builtin_expect(!!(x), 0)
253 #else
254 #define AIPS_LIKELY(x) (x)
255 #define AIPS_UNLIKELY(x) (x)
256 #endif
257 
258 } //# NAMESPACE CASACORE - END
259 #endif
this file contains all the compiler specific defines
Definition: mainpage.dox:28