casacore
Loading...
Searching...
No Matches
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: casa-feedback@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// this file contains all the compiler specific defines
27
28#ifndef CASA_AIPSENV_H
29#define CASA_AIPSENV_H
30
31namespace casacore { //# NAMESPACE CASACORE - BEGIN
32
33// Set if compiler supports C++11 or newer
34#if __cplusplus >= 201103L
35#define AIPS_CXX11
36#endif
37
38// Set if compiler supports C++14 or newer
39#if __cplusplus >= 201402L
40#define AIPS_CXX11
41#define AIPS_CXX14
42#endif
43
44// Set if GCC compiler is used.
45#if defined(AIPS_GCC)
46#undef AIPS_GCC
47#endif
48#if defined(__GNUC__)
49#define AIPS_GCC
50#endif
51
52/* ONLY USE IF CODE WILL _NOT_ WORK WITH NEWER VERSIONS */
53#if defined(AIPS_GCC2)
54#undef AIPS_GCC2
55#endif
56#if (defined(AIPS_GCC) && __GNUC_CC == 2)
57#define AIPS_GCC2
58#endif
59
60/* ONLY USE IF CODE WILL _NOT_ WORK WITH NEWER VERSIONS */
61#if defined(AIPS_GCC295)
62#undef AIPS_GCC295
63#endif
64#if (defined(AIPS_GCC2) && __GNUC_MINOR__ == 95)
65#define AIPS_GCC295
66#endif
67
68/* ONLY USE IF CODE WILL _NOT_ WORK WITH NEWER VERSIONS */
69#if defined(AIPS_GCC3)
70#undef AIPS_GCC3
71#endif
72#if (defined(AIPS_GCC) && __GNUC__ == 3)
73#define AIPS_GCC3
74#endif
75
76/* ONLY USE IF CODE WILL _NOT_ WORK WITH NEWER VERSIONS */
77#if defined(AIPS_GCC4)
78#undef AIPS_GCC4
79#endif
80#if (defined(AIPS_GCC) && __GNUC__ == 4)
81#define AIPS_GCC4
82#endif
83
84// Alternate project compiler
85#if defined(AIPS_SGI)
86#undef AIPS_SGI
87#endif
88#if defined(__sgi)
89#define AIPS_SGI
90#if defined(_MIPS_SZPTR) && (_MIPS_SZPTR == 64)
91#define AIPS_64B
92#define SGI64
93#endif
94#endif
95
96// Alternate project compiler
97#if defined(AIPS_SUN_NATIVE)
98#undef AIPS_SUN_NATIVE
99#endif
100#if defined(__SUNPRO_CC)
101#define AIPS_SUN_NATIVE
102#endif
103
104#if defined(AIPS_SOLARIS)
105#undef AIPS_SOLARIS
106#endif
107#if defined(__sun)
108#define AIPS_SOLARIS
109#endif
110
111#if defined(AIPS_HP)
112#undef AIPS_HP
113#endif
114#if defined(__hp)
115#define AIPS_HP
116#endif
117
118#if defined(AIPS_ALPHA)
119#undef AIPS_ALPHA
120#endif
121#if defined(__alpha)
122#define AIPS_ALPHA
123#define AIPS_64B
124#endif
125
126#if defined(AIPS_BSD)
127#undef AIPS_BSD
128#endif
129#if defined(__FreeBSD__)
130#define AIPS_BSD
131#define AIPS_NOLARGEFILE
132#endif
133
134#if defined(AIPS_HURD)
135#undef AIPS_HURD
136#endif
137#if defined(__gnu_hurd__)
138#define AIPS_HURD
139#endif
140
141#if defined(AIPS_LINUX)
142#undef AIPS_LINUX
143#endif
144#if defined(__linux__)
145#define AIPS_LINUX
146#endif
147
148#if defined(AIPS_KAI)
149#undef AIPS_KAI
150#endif
151#if defined(__kai)
152#define AIPS_KAI
153#endif
154
155#if defined(AIPS_AIX)
156#undef AIPS_AIX
157#endif
158#if defined(_AIX)
159#define AIPS_AIX
160#endif
161
162#if defined(AIPS_INTELCC)
163#undef AIPS_INTELCC
164#endif
165#if defined(__INTEL_COMPILER)
166#define AIPS_INTELCC
167#endif
168
169#if defined(AIPS_CRAY_PGI)
170#undef AIPS_CRAY_PGI
171#endif
172#if defined(__QK_USER__)
173#define AIPS_CRAY_PGI
174#if !defined(AIPS_NOLARGEFILE)
175#define AIPS_NOLARGEFILE
176#endif
177#if !defined(AIPS_NO_LEA_MALLOC)
178#define AIPS_NO_LEA_MALLOC
179#endif
180#endif
181
182#if defined(AIPS_CRAY_CATAMOUNT)
183#undef AIPS_CRAY_CATAMOUNT
184#endif
185#if defined(__LIB_CATAMOUNT__)
186#define AIPS_CRAY_CATAMOUNT
187#endif
188
189#if (defined(__ia64) || defined(__x86_64__) || defined(__aarch64__))
190# if !defined(AIPS_64B)
191# define AIPS_64B
192# endif
193#endif
194
195#if defined(AIPS_I386)
196#undef AIPS_I386
197#endif
198#if defined(i386)
199#define AIPS_I386
200#endif
201
202#if defined(AIPS_DARWIN)
203#undef AIPS_DARWIN
204#endif
205#if defined(__APPLE__)
206#define AIPS_DARWIN
207// No need for largefile definition as it is the default under DARWIN
208#define AIPS_NOLARGEFILE
209 // Don't use AIPS_LITTLE_ENDIAN as this would prevent universal builds
210 // from working. Auto-detect from AIPS_I386 for intel Macs
211#define AIPS_NO_LEA_MALLOC
212# if defined(AIPS_LITTLE_ENDIAN)
213# undef AIPS_LITTLE_ENDIAN
214# endif
215#endif
216
217// If the compiler specifies endianness, use that
218#if !(defined(AIPS_LITTLE_ENDIAN))
219#if (defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__))
220#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
221#define AIPS_LITTLE_ENDIAN
222#endif
223#else
224// Automatically configure for known LITTLE ENDIAN systems
225#if (defined(AIPS_ALPHA) || defined(AIPS_I386) || defined(__x86_64__) || defined(__ARMEL__) || defined(__AARCH64EL__))
226#define AIPS_LITTLE_ENDIAN
227#endif
228#endif
229#endif
230
231
232// If needed, define the LFS variables (needed in code using cfitsio).
233#ifndef AIPS_NOLARGEFILE
234# undef _FILE_OFFSET_BITS
235# define _FILE_OFFSET_BITS 64
236# ifndef _LARGEFILE_SOURCE
237# define _LARGEFILE_SOURCE
238# endif
239# ifndef _LARGEFILE64_SOURCE
240# define _LARGEFILE64_SOURCE
241# endif
242#endif
243
244
245// Compiler hints for branch prediction (and code layout).
246// Use only after profiling performance critical code,
247// or on checks for exceptional conditions.
248#if defined __GNUC__ || defined __clang__
249#define AIPS_LIKELY(x) __builtin_expect(!!(x), 1)
250#define AIPS_UNLIKELY(x) __builtin_expect(!!(x), 0)
251#else
252#define AIPS_LIKELY(x) (x)
253#define AIPS_UNLIKELY(x) (x)
254#endif
255
256} //# NAMESPACE CASACORE - END
257#endif
this file contains all the compiler specific defines
Definition mainpage.dox:28