blob: c2d51304ccdcd084e72d7d5a1676396f73d41fd1 [file] [log] [blame]
Jeff Thompsonf7d49942013-08-01 16:47:40 -07001// (C) Copyright John Maddock 2001 - 2003.
2// (C) Copyright Darin Adler 2001 - 2002.
3// (C) Copyright Jens Maurer 2001 - 2002.
4// (C) Copyright Beman Dawes 2001 - 2003.
5// (C) Copyright Douglas Gregor 2002.
6// (C) Copyright David Abrahams 2002 - 2003.
7// (C) Copyright Synge Todo 2003.
8// Use, modification and distribution are subject to the
9// Boost Software License, Version 1.0. (See accompanying file
10// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11
12// See http://www.boost.org for most recent version.
13
Jeff Thompsona28eed82013-08-22 16:21:10 -070014// GNU C++ compiler setup.
15
16//
Jeff Thompson3d613fd2013-10-15 15:39:04 -070017// Define NDNBOOST_GCC so we know this is "real" GCC and not some pretender:
Jeff Thompsona28eed82013-08-22 16:21:10 -070018//
19#if !defined(__CUDACC__)
Jeff Thompson3d613fd2013-10-15 15:39:04 -070020#define NDNBOOST_GCC (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
Jeff Thompsona28eed82013-08-22 16:21:10 -070021#endif
Jeff Thompsonf7d49942013-08-01 16:47:40 -070022
23#if __GNUC__ < 3
24# if __GNUC_MINOR__ == 91
25 // egcs 1.1 won't parse shared_ptr.hpp without this:
Jeff Thompson3d613fd2013-10-15 15:39:04 -070026# define NDNBOOST_NO_AUTO_PTR
Jeff Thompsonf7d49942013-08-01 16:47:40 -070027# endif
28# if __GNUC_MINOR__ < 95
29 //
30 // Prior to gcc 2.95 member templates only partly
Jeff Thompson3d613fd2013-10-15 15:39:04 -070031 // work - define NDNBOOST_MSVC6_MEMBER_TEMPLATES
Jeff Thompsonf7d49942013-08-01 16:47:40 -070032 // instead since inline member templates mostly work.
33 //
Jeff Thompson3d613fd2013-10-15 15:39:04 -070034# define NDNBOOST_NO_MEMBER_TEMPLATES
Jeff Thompsonf7d49942013-08-01 16:47:40 -070035# if __GNUC_MINOR__ >= 9
Jeff Thompson3d613fd2013-10-15 15:39:04 -070036# define NDNBOOST_MSVC6_MEMBER_TEMPLATES
Jeff Thompsonf7d49942013-08-01 16:47:40 -070037# endif
38# endif
39
40# if __GNUC_MINOR__ < 96
Jeff Thompson3d613fd2013-10-15 15:39:04 -070041# define NDNBOOST_NO_SFINAE
Jeff Thompsonf7d49942013-08-01 16:47:40 -070042# endif
43
44# if __GNUC_MINOR__ <= 97
Jeff Thompson3d613fd2013-10-15 15:39:04 -070045# define NDNBOOST_NO_MEMBER_TEMPLATE_FRIENDS
46# define NDNBOOST_NO_OPERATORS_IN_NAMESPACE
Jeff Thompsonf7d49942013-08-01 16:47:40 -070047# endif
48
Jeff Thompson3d613fd2013-10-15 15:39:04 -070049# define NDNBOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE
50# define NDNBOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
51# define NDNBOOST_NO_IS_ABSTRACT
52# define NDNBOOST_NO_CXX11_EXTERN_TEMPLATE
Jeff Thompsonf7d49942013-08-01 16:47:40 -070053// Variadic macros do not exist for gcc versions before 3.0
Jeff Thompson3d613fd2013-10-15 15:39:04 -070054# define NDNBOOST_NO_CXX11_VARIADIC_MACROS
Jeff Thompsonf7d49942013-08-01 16:47:40 -070055#elif __GNUC__ == 3
56# if defined (__PATHSCALE__)
Jeff Thompson3d613fd2013-10-15 15:39:04 -070057# define NDNBOOST_NO_TWO_PHASE_NAME_LOOKUP
58# define NDNBOOST_NO_IS_ABSTRACT
Jeff Thompsonf7d49942013-08-01 16:47:40 -070059# endif
60 //
61 // gcc-3.x problems:
62 //
63 // Bug specific to gcc 3.1 and 3.2:
64 //
65# if ((__GNUC_MINOR__ == 1) || (__GNUC_MINOR__ == 2))
Jeff Thompson3d613fd2013-10-15 15:39:04 -070066# define NDNBOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
Jeff Thompsonf7d49942013-08-01 16:47:40 -070067# endif
68# if __GNUC_MINOR__ < 4
Jeff Thompson3d613fd2013-10-15 15:39:04 -070069# define NDNBOOST_NO_IS_ABSTRACT
Jeff Thompsonf7d49942013-08-01 16:47:40 -070070# endif
Jeff Thompson3d613fd2013-10-15 15:39:04 -070071# define NDNBOOST_NO_CXX11_EXTERN_TEMPLATE
Jeff Thompsonf7d49942013-08-01 16:47:40 -070072#endif
73#if __GNUC__ < 4
74//
75// All problems to gcc-3.x and earlier here:
76//
Jeff Thompson3d613fd2013-10-15 15:39:04 -070077#define NDNBOOST_NO_TWO_PHASE_NAME_LOOKUP
Jeff Thompsonf7d49942013-08-01 16:47:40 -070078# ifdef __OPEN64__
Jeff Thompson3d613fd2013-10-15 15:39:04 -070079# define NDNBOOST_NO_IS_ABSTRACT
Jeff Thompsonf7d49942013-08-01 16:47:40 -070080# endif
81#endif
82
83#if __GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ < 4 )
84// Previous versions of GCC did not completely implement value-initialization:
85// GCC Bug 30111, "Value-initialization of POD base class doesn't initialize
86// members", reported by Jonathan Wakely in 2006,
87// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30111 (fixed for GCC 4.4)
88// GCC Bug 33916, "Default constructor fails to initialize array members",
89// reported by Michael Elizabeth Chastain in 2007,
90// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33916 (fixed for GCC 4.2.4)
91// See also: http://www.boost.org/libs/utility/value_init.htm#compiler_issues
Jeff Thompson3d613fd2013-10-15 15:39:04 -070092#define NDNBOOST_NO_COMPLETE_VALUE_INITIALIZATION
Jeff Thompsonf7d49942013-08-01 16:47:40 -070093#endif
94
Jeff Thompson3d613fd2013-10-15 15:39:04 -070095#if !defined(__EXCEPTIONS) && !defined(NDNBOOST_NO_EXCEPTIONS)
96# define NDNBOOST_NO_EXCEPTIONS
Jeff Thompsonf7d49942013-08-01 16:47:40 -070097#endif
98
99
100//
101// Threading support: Turn this on unconditionally here (except for
102// those platforms where we can know for sure). It will get turned off again
103// later if no threading API is detected.
104//
105#if !defined(__MINGW32__) && !defined(linux) && !defined(__linux) && !defined(__linux__)
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700106# define NDNBOOST_HAS_THREADS
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700107#endif
108
109//
110// gcc has "long long"
111//
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700112#define NDNBOOST_HAS_LONG_LONG
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700113
114//
115// gcc implements the named return value optimization since version 3.1
116//
117#if __GNUC__ > 3 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 1 )
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700118#define NDNBOOST_HAS_NRVO
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700119#endif
120
121//
122// Dynamic shared object (DSO) and dynamic-link library (DLL) support
123//
124#if __GNUC__ >= 4
125# if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) && !defined(__CYGWIN__)
126 // All Win32 development environments, including 64-bit Windows and MinGW, define
127 // _WIN32 or one of its variant spellings. Note that Cygwin is a POSIX environment,
128 // so does not define _WIN32 or its variants.
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700129# define NDNBOOST_HAS_DECLSPEC
130# define NDNBOOST_SYMBOL_EXPORT __attribute__((dllexport))
131# define NDNBOOST_SYMBOL_IMPORT __attribute__((dllimport))
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700132# else
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700133# define NDNBOOST_SYMBOL_EXPORT __attribute__((visibility("default")))
134# define NDNBOOST_SYMBOL_IMPORT
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700135# endif
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700136# define NDNBOOST_SYMBOL_VISIBLE __attribute__((visibility("default")))
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700137#else
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700138// config/platform/win32.hpp will define NDNBOOST_SYMBOL_EXPORT, etc., unless already defined
139# define NDNBOOST_SYMBOL_EXPORT
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700140#endif
141
142//
143// RTTI and typeinfo detection is possible post gcc-4.3:
144//
145#if __GNUC__ * 100 + __GNUC_MINOR__ >= 403
146# ifndef __GXX_RTTI
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700147# ifndef NDNBOOST_NO_TYPEID
148# define NDNBOOST_NO_TYPEID
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700149# endif
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700150# ifndef NDNBOOST_NO_RTTI
151# define NDNBOOST_NO_RTTI
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700152# endif
153# endif
154#endif
155
156//
Jeff Thompsona28eed82013-08-22 16:21:10 -0700157// Recent GCC versions have __int128 when in 64-bit mode.
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700158//
Jeff Thompsona28eed82013-08-22 16:21:10 -0700159// We disable this if the compiler is really nvcc as it
160// doesn't actually support __int128 as of CUDA_VERSION=5000
161// even though it defines __SIZEOF_INT128__.
162// See https://svn.boost.org/trac/boost/ticket/8048
163// Only re-enable this for nvcc if you're absolutely sure
164// of the circumstances under which it's supported:
165//
166#if defined(__SIZEOF_INT128__) && !defined(__CUDACC__)
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700167# define NDNBOOST_HAS_INT128
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700168#endif
169
170// C++0x features in 4.3.n and later
171//
172#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)) && defined(__GXX_EXPERIMENTAL_CXX0X__)
173// C++0x features are only enabled when -std=c++0x or -std=gnu++0x are
174// passed on the command line, which in turn defines
175// __GXX_EXPERIMENTAL_CXX0X__.
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700176# define NDNBOOST_HAS_DECLTYPE
177# define NDNBOOST_HAS_RVALUE_REFS
178# define NDNBOOST_HAS_STATIC_ASSERT
179# define NDNBOOST_HAS_VARIADIC_TMPL
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700180#else
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700181# define NDNBOOST_NO_CXX11_DECLTYPE
182# define NDNBOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
183# define NDNBOOST_NO_CXX11_RVALUE_REFERENCES
184# define NDNBOOST_NO_CXX11_STATIC_ASSERT
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700185
186// Variadic templates compiler:
187// http://www.generic-programming.org/~dgregor/cpp/variadic-templates.html
188# if defined(__VARIADIC_TEMPLATES) || (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4) && defined(__GXX_EXPERIMENTAL_CXX0X__))
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700189# define NDNBOOST_HAS_VARIADIC_TMPL
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700190# else
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700191# define NDNBOOST_NO_CXX11_VARIADIC_TEMPLATES
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700192# endif
193#endif
194
195// C++0x features in 4.4.n and later
196//
197#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4) || !defined(__GXX_EXPERIMENTAL_CXX0X__)
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700198# define NDNBOOST_NO_CXX11_AUTO_DECLARATIONS
199# define NDNBOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
200# define NDNBOOST_NO_CXX11_CHAR16_T
201# define NDNBOOST_NO_CXX11_CHAR32_T
202# define NDNBOOST_NO_CXX11_HDR_INITIALIZER_LIST
203# define NDNBOOST_NO_CXX11_DEFAULTED_FUNCTIONS
204# define NDNBOOST_NO_CXX11_DELETED_FUNCTIONS
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700205#endif
206
207#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700208# define NDNBOOST_NO_SFINAE_EXPR
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700209#endif
210
211// C++0x features in 4.5.0 and later
212//
213#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) || !defined(__GXX_EXPERIMENTAL_CXX0X__)
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700214# define NDNBOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
215# define NDNBOOST_NO_CXX11_LAMBDAS
216# define NDNBOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
217# define NDNBOOST_NO_CXX11_RAW_LITERALS
218# define NDNBOOST_NO_CXX11_UNICODE_LITERALS
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700219#endif
220
221// C++0x features in 4.5.1 and later
222//
223#if (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__ < 40501) || !defined(__GXX_EXPERIMENTAL_CXX0X__)
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700224// scoped enums have a serious bug in 4.4.0, so define NDNBOOST_NO_CXX11_SCOPED_ENUMS before 4.5.1
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700225// See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38064
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700226# define NDNBOOST_NO_CXX11_SCOPED_ENUMS
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700227#endif
228
229// C++0x features in 4.6.n and later
230//
231#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6) || !defined(__GXX_EXPERIMENTAL_CXX0X__)
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700232#define NDNBOOST_NO_CXX11_CONSTEXPR
233#define NDNBOOST_NO_CXX11_NOEXCEPT
234#define NDNBOOST_NO_CXX11_NULLPTR
235#define NDNBOOST_NO_CXX11_RANGE_BASED_FOR
236#define NDNBOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700237#endif
238
Jeff Thompsona28eed82013-08-22 16:21:10 -0700239// C++0x features in 4.7.n and later
240//
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700241#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7) || !defined(__GXX_EXPERIMENTAL_CXX0X__)
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700242# define NDNBOOST_NO_CXX11_TEMPLATE_ALIASES
243# define NDNBOOST_NO_CXX11_USER_DEFINED_LITERALS
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700244#endif
Jeff Thompsona28eed82013-08-22 16:21:10 -0700245
246// C++0x features in 4.8.1 and later
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700247//
Jeff Thompsona28eed82013-08-22 16:21:10 -0700248#if (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__ < 40801) || !defined(__GXX_EXPERIMENTAL_CXX0X__)
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700249# define NDNBOOST_NO_CXX11_DECLTYPE_N3276
Jeff Thompsona28eed82013-08-22 16:21:10 -0700250#endif
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700251
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700252#ifndef NDNBOOST_COMPILER
253# define NDNBOOST_COMPILER "GNU C++ version " __VERSION__
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700254#endif
255
256// ConceptGCC compiler:
257// http://www.generic-programming.org/software/ConceptGCC/
258#ifdef __GXX_CONCEPTS__
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700259# define NDNBOOST_HAS_CONCEPTS
260# define NDNBOOST_COMPILER "ConceptGCC version " __VERSION__
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700261#endif
262
263// versions check:
264// we don't know gcc prior to version 2.90:
265#if (__GNUC__ == 2) && (__GNUC_MINOR__ < 90)
266# error "Compiler not configured - please reconfigure"
267#endif
268//
269// last known and checked version is 4.6 (Pre-release):
270#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 6))
Jeff Thompson3d613fd2013-10-15 15:39:04 -0700271# if defined(NDNBOOST_ASSERT_CONFIG)
Jeff Thompsonf7d49942013-08-01 16:47:40 -0700272# error "Unknown compiler version - please run the configure tests and report the results"
273# else
274// we don't emit warnings here anymore since there are no defect macros defined for
275// gcc post 3.4, so any failures are gcc regressions...
276//# warning "Unknown compiler version - please run the configure tests and report the results"
277# endif
278#endif
279
280