Logo ROOT   6.07/09
Reference Guide
RConfig.h
Go to the documentation of this file.
1 /* @(#)root/base:$Id$ */
2 
3 /*************************************************************************
4  * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers. *
5  * All rights reserved. *
6  * *
7  * For the licensing terms see $ROOTSYS/LICENSE. *
8  * For the list of contributors see $ROOTSYS/README/CREDITS. *
9  *************************************************************************/
10 
11 #ifndef ROOT_RConfig
12 #define ROOT_RConfig
13 
14 /*************************************************************************
15  * *
16  * RConfig *
17  * *
18  * Defines used by ROOT. *
19  * *
20  *************************************************************************/
21 
22 #ifndef ROOT_RVersion
23 #include "RVersion.h"
24 #endif
25 
26 
27 /*---- new C++ features ------------------------------------------------------*/
28 
29 #define R__USE_SHADOW_CLASS
30 
31 /* Now required, thus defined by default for backward compatibility */
32 #define R__ANSISTREAM /* ANSI C++ Standard Library conformant */
33 #define R__SSTREAM /* use sstream or strstream header */
34 
35 /* Do not #define nullptr if the code is compiled in c++11 mode. */
36 #if __cplusplus > 199711L
37 #define R__NULLPTR
38 #endif
39 
40 #if defined(__cplusplus) && (__cplusplus < 201103L)
41 # error "ROOT requires support for C++11 or higher."
42 # if defined(__GNUC__) || defined(__clang__)
43 # error "Pass `-std=c++11` as compiler argument."
44 # endif
45 #endif
46 
47 /*---- machines --------------------------------------------------------------*/
48 
49 #ifdef __hpux
50  /* R__HPUX10 or R__HPUX11 is determined in the Makefile */
51 # define R__HPUX
52 # define R__UNIX
53 # define ANSICPP
54 # ifdef __LP64__
55 # define R__B64
56 # endif
57 # ifdef R__HPUX10
58 # define NEED_SNPRINTF
59 # endif
60 #endif
61 
62 #ifdef _AIX
63 # define R__AIX
64 # define R__UNIX
65 # define ANSICPP
66 # define R__SEEK64
67 # define R__PLACEMENTINLINE /* placement new/delete is inline in <new> */
68 # define NEED_STRCASECMP
69 #endif
70 
71 #if defined(__linux) || defined(__linux__)
72 # ifndef linux
73 # define linux
74 # endif
75 #endif
76 
77 #if defined(__CYGWIN__) && defined(__GNUC__)
78 # ifndef linux
79 # define linux
80 # endif
81 # ifndef R__WINGCC
82 # define R__WINGCC
83 # endif
84 #endif
85 
86 #if defined(__sun) && !(defined(linux) || defined(__FCC_VERSION))
87 # ifdef __SVR4
88 # define R__SOLARIS
89 # define R__SEEK64
90 # define ANSICPP
91 # ifdef __i386
92 # define R__BYTESWAP
93 # endif
94 # ifdef __x86_64
95 # define R__B64
96 # define R__BYTESWAP
97 # endif
98 # else
99 # define R__SUN
100 # include <stdlib.h>
101 # endif
102 # define R__UNIX
103 # define NEED_STRING
104 # define NEED_SIGJMP
105 # if __SUNPRO_CC > 0x420
106 # define R__SOLARIS_CC50
107 # define R__PLACEMENTINLINE /* placement new/delete is inline in <new> */
108 # endif
109 # if __SUNPRO_CC >= 0x420
110 # define R__SUNCCBUG /* to work around a compiler bug */
111 # endif
112 # if __SUNPRO_CC >= 0x5110
113 # define R__THROWNEWDELETE
114 # endif
115 # if __GNUC__ >= 3 || __GNUC_MINOR__ >= 90 /* modern egcs/gcc */
116 # define R__SUNGCC3
117 # endif
118 #endif
119 
120 #if defined(__FCC_VERSION) /* Solaris with Fujitsu compiler */
121 # define R__SOLARIS
122 # define R__SEEK64
123 # define ANSICPP
124 # define R__UNIX
125 # define NEED_STRING
126 # define NEED_SIGJMP
127 #endif
128 
129 #if defined(linux)
130 # ifndef _LARGEFILE64_SOURCE
131 # define _LARGEFILE64_SOURCE
132 # endif
133 # include <features.h>
134 # if __GNU_LIBRARY__ == 6
135 # ifndef R__GLIBC
136 # define R__GLIBC
137 # endif
138 # endif
139 # if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 2
140 # define R__NONSCALARFPOS2
141 # define R__USESTHROW
142 # define R__SEEK64
143 # endif
144 #endif
145 
146 #if defined(linux) && defined(__i386__)
147 # define R__LINUX
148 # define R__UNIX
149 # define R__BYTESWAP
150 # ifndef __i486__
151 # define __i486__ /* turn off if you really want to run on an i386 */
152 # endif
153 # define NEED_SIGJMP
154 #endif
155 
156 #if defined(linux) && defined(__ia64__)
157 # define R__LINUX
158 # define R__UNIX
159 # define R__BYTESWAP
160 # define R__B64
161 # define NEED_SIGJMP
162 #endif
163 
164 #if defined(linux) && defined(__x86_64__)
165 # define R__LINUX
166 # define R__UNIX
167 # define R__BYTESWAP
168 # define R__B64
169 # define NEED_SIGJMP
170 #endif
171 
172 #if defined(linux) && defined(__arm__)
173 # define R__LINUX
174 # define R__UNIX
175 # define R__BYTESWAP
176 # define NEED_SIGJMP
177 #endif
178 
179 #if defined(linux) && defined(__sparc__)
180 # define R__LINUX
181 # define R__UNIX
182 # define NEED_SIGJMP
183 /*# define R__B64 */ /* enable when 64 bit machine */
184 #endif
185 
186 #if defined(linux) && defined(__hppa)
187 # define R__LINUX
188 # define R__UNIX
189 # define NEED_SIGJMP
190 #endif
191 
192 #if defined(linux) && defined(__powerpc__)
193 # define R__LINUX
194 # define R__UNIX
195 # define NEED_SIGJMP
196 # if defined(R__ppc64)
197 # define R__B64
198 # endif
199 # if defined(_LITTLE_ENDIAN)
200 # define R__BYTESWAP
201 # endif
202 #endif
203 
204 #if defined(linux) && defined(__aarch64__)
205 # define R__LINUX
206 # define R__UNIX
207 # define R__BYTESWAP
208 # define R__B64
209 # define NEED_SIGJMP
210 #endif
211 
212 #if defined(linux) && defined(__s390__)
213 # define R__LINUX
214 # define R__UNIX
215 # define NEED_SIGJMP
216 #endif
217 
218 #if defined(linux) && defined(__s390x__)
219 # define R__LINUX
220 # define R__UNIX
221 # define R__B64
222 # define NEED_SIGJMP
223 #endif
224 
225 #if defined(__MACH__) && defined(__i386__) && !defined(__APPLE__)
226 # define R__HURD
227 # define f2cFortran /* cfortran.h does not know HURD - sigh */
228 # define R__UNIX
229 # define R__BYTESWAP
230 # define R__GLIBC /* GNU/Hurd always use GLIBC 2.x :-) */
231 # define NEED_SIGJMP
232 #endif
233 
234 #if defined(__Lynx__) && defined(__powerpc__)
235 # define R__LYNXOS
236 # define R__UNIX
237 # define ANSICPP
238 # define NEED_SIGJMP
239 # define NEED_STRCASECMP
240 # define NEED_SNPRINTF
241 #endif
242 
243 #if defined(__FreeBSD__)
244 # define R__FBSD
245 # define R__UNIX
246 # define R__BYTESWAP
247 # if defined(__i386__)
248 # ifndef __i486__
249 # define __i486__ /* turn off if you really want to run on an i386 */
250 # endif
251 # endif
252 # if defined(__amd64__)
253 # define R__B64
254 # endif
255 # define R__THROWNEWDELETE /* new/delete throw exceptions */
256 # define HAS_STRLCPY
257 #endif
258 
259 #if defined(__OpenBSD__)
260 # define R__OBSD
261 # define R__UNIX
262 # define R__BYTESWAP
263 # if defined(__i386__)
264 # ifndef __i486__
265 # define __i486__ /* turn off if you really want to run on an i386 */
266 # endif
267 # endif
268 # if defined(__amd64__)
269 # define R__B64
270 # endif
271 # define R__THROWNEWDELETE /* new/delete throw exceptions */
272 # define HAS_STRLCPY
273 #endif
274 
275 #if defined(__APPLE__) /* MacOS X support, initially following FreeBSD */
276 # include <AvailabilityMacros.h>
277 # ifndef __CINT__
278 # include <TargetConditionals.h>
279 # endif
280 # define R__MACOSX
281 # define R__UNIX
282 # if defined(__xlC__) || defined(__xlc__)
283 # define ANSICPP
284 # define R__PLACEMENTINLINE /* placement new/delete is inline in <new> */
285 # endif
286 # if defined(__ppc64__)
287 # define R__B64 /* enable when 64 bit machine */
288 # endif
289 # if defined(__i386__)
290 # define R__BYTESWAP
291 # endif
292 # if defined(__arm__)
293 # define R__BYTESWAP
294 # endif
295 # if defined(__x86_64__)
296 # define R__BYTESWAP
297 # define R__B64 /* enable when 64 bit machine */
298 # endif
299 # define HAS_STRLCPY
300 #endif
301 
302 #ifdef _HIUX_SOURCE
303 # define R__HIUX
304 # define R__UNIX
305 # define NEED_SIGJMP
306 # define NEED_SNPRINTF
307 # define ANSICPP
308 #endif
309 
310 #ifdef __GNUC__
311 # define R__GNU
312 # define ANSICPP
313 # if __GNUC__ >= 3 || __GNUC_MINOR__ >= 90 /* egcs 1.0.3 */
314 # define R__VECNEWDELETE /* supports overloading of new[] and delete[] */
315 # define R__PLACEMENTDELETE /* supports overloading placement delete */
316 # endif
317 # if __GNUC__ >= 3 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 95)
318 # define R__PLACEMENTINLINE /* placement new/delete is inline in <new> */
319 # endif
320 # if defined(__ia64__) && __GNUC__ < 3 /* gcc 2.9x (MINOR is 9!) */
321 # define R__VECNEWDELETE /* supports overloading of new[] and delete[] */
322 # define R__PLACEMENTDELETE /* supports overloading placement delete */
323 # endif
324 # if __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ > 1)
325 # define R__PRAGMA_DIAGNOSTIC
326 # endif
327 #endif
328 
329 /* allows symbols to be hidden from the shared library export symbol table */
330 /* use typically on file statics and private methods */
331 #if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
332 # define R__HIDDEN __attribute__((__visibility__("hidden")))
333 #else
334 # define R__HIDDEN
335 #endif
336 
337 #ifdef __INTEL_COMPILER
338 # define R__INTEL_COMPILER
339 # define R__VECNEWDELETE /* supports overloading of new[] and delete[] */
340 # define R__PLACEMENTDELETE /* supports overloading placement delete */
341 # define R__PLACEMENTINLINE /* placement new/delete is inline in <new> */
342 # define ANSICPP
343 #endif
344 
345 #ifdef __HP_aCC
346 # define R__ACC
347 # define R__VECNEWDELETE /* supports overloading of new[] and delete[] */
348 # define R__PLACEMENTINLINE /* placement new/delete is inline in <new> */
349 # define R__THROWNEWDELETE /* new/delete throw exceptions */
350 # if __HP_aCC <= 015000
351 # define R__OLDHPACC
352 # define R__TEMPLATE_OVERLOAD_BUG
353 # define R__GLOBALSTL /* STL in global name space */
354 # else
355 # define R__PLACEMENTDELETE /* supports overloading placement delete */
356 # define R__TMPLTSTREAM /* std::iostream implemented with templates */
357 # endif
358 # ifndef _INCLUDE_LONGLONG
359 # define _INCLUDE_LONGLONG
360 # endif
361 #endif
362 
363 #ifdef _WIN32
364 # define R__WIN32
365 # ifndef WIN32
366 # define WIN32
367 # endif
368 # define R__BYTESWAP
369 # define R__ACCESS_IN_SYMBOL
370 # define thread_local static __declspec(thread)
371 #endif
372 
373 #ifdef __SC__
374 # define SC
375 # define R__SC
376 # if defined(WIN32)
377 # define NEED_STRING
378 # define NEED_STRCASECMP
379 # define NEED_SNPRINTF
380 # define ANSICPP
381 # else
382 # define MSDOS
383 # define NEED_STRCASECMP
384 # define R__BYTESWAP
385 # endif
386 #endif
387 
388 #ifdef _MSC_VER
389 # define R__VISUAL_CPLUSPLUS
390 # define NEED_STRING
391 # define NEED_STRCASECMP
392 # if _MSC_VER < 1900
393 # define NEED_SNPRINTF
394 # endif
395 # define ANSICPP
396 # define R__VECNEWDELETE /* supports overloading of new[] and delete[] */
397 # define R__PLACEMENTDELETE /* supports overloading placement delete */
398 # define R__PLACEMENTINLINE /* placement new/delete is inline in <new> */
399 # define R__NULLPTR
400 # if _MSC_VER >= 1400
401 # define DONTNEED_VSNPRINTF
402 # endif
403 # if _MSC_VER < 1310
404 # define R__NO_CLASS_TEMPLATE_SPECIALIZATION
405 # endif
406 # if _MSC_VER <= 1800
407 # define R__NO_ATOMIC_FUNCTION_POINTER
408 # endif
409 #endif
410 
411 /*--- memory and object statistics -------------------------------------------*/
412 
413 /* #define R__NOSTATS */
414 
415 /*--- cpp --------------------------------------------------------------------*/
416 
417 #ifdef ANSICPP
418  /* symbol concatenation operator */
419 # define _NAME1_(name) name
420 # define _NAME2_(name1,name2) name1##name2
421 # define _NAME3_(name1,name2,name3) name1##name2##name3
422 
423  /* stringizing */
424 # define _QUOTE_(name) #name
425 
426 #else
427 
428 # define _NAME1_(name) name
429 # define _NAME2_(name1,name2) _NAME1_(name1)name2
430 # define _NAME3_(name1,name2,name3) _NAME2_(name1,name2)name3
431 
432 # define _QUOTE_(name) "name"
433 
434 #endif
435 
436 /* produce an identifier that is almost unique inside a file */
437 #ifndef __CINT__
438 # define _R__JOIN_(X,Y) _NAME2_(X,Y)
439 # define _R__JOIN3_(F,X,Y) _NAME3_(F,X,Y)
440 #ifdef R__DICTIONARY_FILENAME
441 # define _R__UNIQUE_(X) _R__JOIN3_(R__DICTIONARY_FILENAME,X,__LINE__)
442 #else
443 # define _R__UNIQUE_(X) _R__JOIN_(X,__LINE__)
444 #endif
445 #else
446  /* Currently CINT does not really mind to have duplicates and */
447  /* does not work correctly as far as merging tokens is concerned. */
448 # define _R__UNIQUE_(X) X
449 #endif
450 
451 /*---- deprecation -----------------------------------------------------------*/
452 #if defined(__GNUC__) || defined(__clang__) || defined(__INTEL_COMPILER)
453 # if __GNUC__ == 5 && (__GNUC_MINOR__ == 1 || __GNUC_MINOR__ == 2)
454 /* GCC 5.1, 5.2: false positives due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=15269 */
455 # define _R__DEPRECATED_LATER(REASON)
456 # else
457 # define _R__DEPRECATED_LATER(REASON) __attribute__((deprecated(REASON)))
458 # endif
459 #elif defined(_MSC_VER)
460 # define _R__DEPRECATED_LATER(REASON) __declspec(deprecated(REASON))
461 #else
462 /* Deprecation not supported for this compiler. */
463 # define _R__DEPRECATED_LATER(REASON)
464 #endif
465 #define _R_DEPRECATED_REMOVE_NOW(REASON) __attribute__((REMOVE_THIS_NOW))
466 
467 /* To be removed by 6.10 */
468 #if ROOT_VERSION_CODE < ROOT_VERSION(6,9,0)
469 # define _R__DEPRECATED_610(REASON) _R__DEPRECATED_LATER(REASON)
470 #else
471 # define _R__DEPRECATED_610(REASON) _R_DEPRECATED_REMOVE_NOW(REASON)
472 #endif
473 
474 
475 /* To be removed by 6.12 */
476 #if ROOT_VERSION_CODE < ROOT_VERSION(6,11,0)
477 # define _R__DEPRECATED_612(REASON) _R__DEPRECATED_LATER(REASON)
478 #else
479 # define _R__DEPRECATED_612(REASON) _R_DEPRECATED_REMOVE_NOW(REASON)
480 #endif
481 
482 /* To be removed by 7.00 */
483 #if ROOT_VERSION_CODE < ROOT_VERSION(6,99,0)
484 # define _R__DEPRECATED_700(REASON) _R__DEPRECATED_LATER(REASON)
485 #else
486 # define _R__DEPRECATED_700(REASON) _R_DEPRECATED_REMOVE_NOW(REASON)
487 #endif
488 
489 
490 /* Spell as R__DEPRECATED(6,04, "Not threadsafe; use TFoo::Bar().") */
491 #define R__DEPRECATED(MAJOR, MINOR, REASON) \
492  _R__JOIN3_(_R__DEPRECATED_,MAJOR,MINOR)("will be removed in ROOT v" #MAJOR "." #MINOR ": " REASON)
493 
494 /*---- misc ------------------------------------------------------------------*/
495 
496 #ifdef R__GNU
497 # define SafeDelete(p) { if (p) { delete p; p = 0; } }
498 #else
499 # define SafeDelete(p) { delete p; p = 0; }
500 #endif
501 
502 #ifdef __FAST_MATH__
503 #define R__FAST_MATH
504 #endif
505 
506 /*---- unlikely / likely expressions -----------------------------------------*/
507 // These are meant to use in cases like:
508 // if (R__unlikely(expression)) { ... }
509 // in performance-critical sessions. R__unlikely / R__likely provide hints to
510 // the compiler code generation to heavily optimize one side of a conditional,
511 // causing the other branch to have a heavy performance cost.
512 //
513 // It is best to use this for conditionals that test for rare error cases or
514 // backward compatibility code.
515 
516 #if (__GNUC__ >= 3) || defined(__INTEL_COMPILER)
517 #if !defined(R__unlikely)
518  #define R__unlikely(expr) __builtin_expect(!!(expr), 0)
519 #endif
520 #if !defined(R__likely)
521  #define R__likely(expr) __builtin_expect(!!(expr), 1)
522 #endif
523 #else
524  #define R__unlikely(expr) expr
525  #define R__likely(expr) expr
526 #endif
527 
528 
529 #endif