//  Boost config.hpp configuration header file  ------------------------------//

//  (C) Copyright John Maddock 2001 - 2003.
//  (C) Copyright Darin Adler 2001.
//  (C) Copyright Peter Dimov 2001.
//  (C) Copyright Bill Kempf 2002.
//  (C) Copyright Jens Maurer 2002.
//  (C) Copyright David Abrahams 2002 - 2003.
//  (C) Copyright Gennaro Prota 2003.
//  (C) Copyright Eric Friedman 2003.
//  Use, modification and distribution are subject to the
//  Boost Software License, Version 1.0. (See accompanying file
//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

//  See http://www.boost.org for most recent version.

//  Boost config.hpp policy and rationale documentation has been moved to
//  http://www.boost.org/libs/config
//
//  This file is intended to be stable, and relatively unchanging.
//  It should contain boilerplate code only - no compiler specific
//  code unless it is unavoidable - no changes unless unavoidable.

#ifndef SC_BOOST_CONFIG_SUFFIX_HPP
#define SC_BOOST_CONFIG_SUFFIX_HPP

//
// look for long long by looking for the appropriate macros in <limits.h>.
// Note that we use limits.h rather than climits for maximal portability,
// remember that since these just declare a bunch of macros, there should be
// no namespace issues from this.
//
#include <limits.h>
# if !defined(SC_BOOST_HAS_LONG_LONG)                                              \
   && !defined(SC_BOOST_MSVC) && !defined(__BORLANDC__)     \
   && (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX))
#  define SC_BOOST_HAS_LONG_LONG
#endif

// TODO: Remove the following lines after the 1.33 release because the presence
// of an integral 64 bit type has nothing to do with support for long long.

#if !defined(SC_BOOST_HAS_LONG_LONG) && !defined(SC_BOOST_NO_INTEGRAL_INT64_T) && !defined(__DECCXX_VER)
#  define SC_BOOST_NO_INTEGRAL_INT64_T
#endif

// GCC 3.x will clean up all of those nasty macro definitions that
// SC_BOOST_NO_CTYPE_FUNCTIONS is intended to help work around, so undefine
// it under GCC 3.x.
#if defined(__GNUC__) && (__GNUC__ >= 3) && defined(SC_BOOST_NO_CTYPE_FUNCTIONS)
#  undef SC_BOOST_NO_CTYPE_FUNCTIONS
#endif


//
// Assume any extensions are in namespace std:: unless stated otherwise:
//
#  ifndef SC_BOOST_STD_EXTENSION_NAMESPACE
#    define SC_BOOST_STD_EXTENSION_NAMESPACE std
#  endif

//
// If cv-qualified specializations are not allowed, then neither are cv-void ones:
//
#  if defined(SC_BOOST_NO_CV_SPECIALIZATIONS) \
      && !defined(SC_BOOST_NO_CV_VOID_SPECIALIZATIONS)
#     define SC_BOOST_NO_CV_VOID_SPECIALIZATIONS
#  endif

//
// If there is no numeric_limits template, then it can't have any compile time
// constants either!
//
#  if defined(SC_BOOST_NO_LIMITS) \
      && !defined(SC_BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS)
#     define SC_BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
#     define SC_BOOST_NO_MS_INT64_NUMERIC_LIMITS
#     define SC_BOOST_NO_LONG_LONG_NUMERIC_LIMITS
#  endif

//
// if there is no long long then there is no specialisation
// for numeric_limits<long long> either:
//
#if !defined(SC_BOOST_HAS_LONG_LONG) && !defined(SC_BOOST_NO_LONG_LONG_NUMERIC_LIMITS)
#  define SC_BOOST_NO_LONG_LONG_NUMERIC_LIMITS
#endif

//
// if there is no __int64 then there is no specialisation
// for numeric_limits<__int64> either:
//
#if !defined(SC_BOOST_HAS_MS_INT64) && !defined(SC_BOOST_NO_MS_INT64_NUMERIC_LIMITS)
#  define SC_BOOST_NO_MS_INT64_NUMERIC_LIMITS
#endif

//
// if member templates are supported then so is the
// VC6 subset of member templates:
//
#  if !defined(SC_BOOST_NO_MEMBER_TEMPLATES) \
       && !defined(SC_BOOST_MSVC6_MEMBER_TEMPLATES)
#     define SC_BOOST_MSVC6_MEMBER_TEMPLATES
#  endif

//
// Without partial specialization, can't test for partial specialisation bugs:
//
#  if defined(SC_BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
      && !defined(SC_BOOST_BCB_PARTIAL_SPECIALIZATION_BUG)
#     define SC_BOOST_BCB_PARTIAL_SPECIALIZATION_BUG
#  endif

//
// Without partial specialization, we can't have array-type partial specialisations:
//
#  if defined(SC_BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
      && !defined(SC_BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS)
#     define SC_BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS
#  endif

//
// Without partial specialization, std::iterator_traits can't work:
//
#  if defined(SC_BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
      && !defined(SC_BOOST_NO_STD_ITERATOR_TRAITS)
#     define SC_BOOST_NO_STD_ITERATOR_TRAITS
#  endif

//
// Without member template support, we can't have template constructors
// in the standard library either:
//
#  if defined(SC_BOOST_NO_MEMBER_TEMPLATES) \
      && !defined(SC_BOOST_MSVC6_MEMBER_TEMPLATES) \
      && !defined(SC_BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
#     define SC_BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
#  endif

//
// Without member template support, we can't have a conforming
// std::allocator template either:
//
#  if defined(SC_BOOST_NO_MEMBER_TEMPLATES) \
      && !defined(SC_BOOST_MSVC6_MEMBER_TEMPLATES) \
      && !defined(SC_BOOST_NO_STD_ALLOCATOR)
#     define SC_BOOST_NO_STD_ALLOCATOR
#  endif

//
// without ADL support then using declarations will break ADL as well:
//
#if defined(SC_BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) && !defined(SC_BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL)
#  define SC_BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
#endif

//
// If we have a standard allocator, then we have a partial one as well:
//
#if !defined(SC_BOOST_NO_STD_ALLOCATOR)
#  define SC_BOOST_HAS_PARTIAL_STD_ALLOCATOR
#endif

//
// We can't have a working std::use_facet if there is no std::locale:
//
#  if defined(SC_BOOST_NO_STD_LOCALE) && !defined(SC_BOOST_NO_STD_USE_FACET)
#     define SC_BOOST_NO_STD_USE_FACET
#  endif

//
// We can't have a std::messages facet if there is no std::locale:
//
#  if defined(SC_BOOST_NO_STD_LOCALE) && !defined(SC_BOOST_NO_STD_MESSAGES)
#     define SC_BOOST_NO_STD_MESSAGES
#  endif

//
// We can't have a working std::wstreambuf if there is no std::locale:
//
#  if defined(SC_BOOST_NO_STD_LOCALE) && !defined(SC_BOOST_NO_STD_WSTREAMBUF)
#     define SC_BOOST_NO_STD_WSTREAMBUF
#  endif

//
// We can't have a <cwctype> if there is no <cwchar>:
//
#  if defined(SC_BOOST_NO_CWCHAR) && !defined(SC_BOOST_NO_CWCTYPE)
#     define SC_BOOST_NO_CWCTYPE
#  endif

//
// We can't have a swprintf if there is no <cwchar>:
//
#  if defined(SC_BOOST_NO_CWCHAR) && !defined(SC_BOOST_NO_SWPRINTF)
#     define SC_BOOST_NO_SWPRINTF
#  endif

//
// If Win32 support is turned off, then we must turn off
// threading support also, unless there is some other
// thread API enabled:
//
#if defined(SC_BOOST_DISABLE_WIN32) && defined(_WIN32) \
   && !defined(SC_BOOST_DISABLE_THREADS) && !defined(SC_BOOST_HAS_PTHREADS)
#  define SC_BOOST_DISABLE_THREADS
#endif

//
// Turn on threading support if the compiler thinks that it's in
// multithreaded mode.  We put this here because there are only a
// limited number of macros that identify this (if there's any missing
// from here then add to the appropriate compiler section):
//
#if (defined(__MT__) || defined(_MT) || defined(_REENTRANT) \
    || defined(_PTHREADS)) && !defined(SC_BOOST_HAS_THREADS)
#  define SC_BOOST_HAS_THREADS
#endif

//
// Turn threading support off if SC_BOOST_DISABLE_THREADS is defined:
//
#if defined(SC_BOOST_DISABLE_THREADS) && defined(SC_BOOST_HAS_THREADS)
#  undef SC_BOOST_HAS_THREADS
#endif

//
// Turn threading support off if we don't recognise the threading API:
//
#if defined(SC_BOOST_HAS_THREADS) && !defined(SC_BOOST_HAS_PTHREADS)\
      && !defined(SC_BOOST_HAS_WINTHREADS) && !defined(SC_BOOST_HAS_BETHREADS)\
      && !defined(SC_BOOST_HAS_MPTASKS)
#  undef SC_BOOST_HAS_THREADS
#endif

//
// Turn threading detail macros off if we don't (want to) use threading
//
#ifndef SC_BOOST_HAS_THREADS
#  undef SC_BOOST_HAS_PTHREADS
#  undef SC_BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
#  undef SC_BOOST_HAS_WINTHREADS
#  undef SC_BOOST_HAS_BETHREADS
#  undef SC_BOOST_HAS_MPTASKS
#endif

//
// If the compiler claims to be C99 conformant, then it had better
// have a <stdint.h>:
//
#  if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)
#     define SC_BOOST_HAS_STDINT_H
#  endif

//
// Define SC_BOOST_NO_SLIST and SC_BOOST_NO_HASH if required.
// Note that this is for backwards compatibility only.
//
#  ifndef SC_BOOST_HAS_SLIST
#     define SC_BOOST_NO_SLIST
#  endif

#  ifndef SC_BOOST_HAS_HASH
#     define SC_BOOST_NO_HASH
#  endif

//  SC_BOOST_HAS_ABI_HEADERS
//  This macro gets set if we have headers that fix the ABI,
//  and prevent ODR violations when linking to external libraries:
#if defined(SC_BOOST_ABI_PREFIX) && defined(SC_BOOST_ABI_SUFFIX) && !defined(SC_BOOST_HAS_ABI_HEADERS)
#  define SC_BOOST_HAS_ABI_HEADERS
#endif

#if defined(SC_BOOST_HAS_ABI_HEADERS) && defined(SC_BOOST_DISABLE_ABI_HEADERS)
#  undef SC_BOOST_HAS_ABI_HEADERS
#endif

//  SC_BOOST_NO_STDC_NAMESPACE workaround  --------------------------------------//
//  Because std::size_t usage is so common, even in boost headers which do not
//  otherwise use the C library, the <cstddef> workaround is included here so
//  that ugly workaround code need not appear in many other boost headers.
//  NOTE WELL: This is a workaround for non-conforming compilers; <cstddef>
//  must still be #included in the usual places so that <cstddef> inclusion
//  works as expected with standard conforming compilers.  The resulting
//  double inclusion of <cstddef> is harmless.

# ifdef SC_BOOST_NO_STDC_NAMESPACE
#   include <cstddef>
    namespace std { using ::ptrdiff_t; using ::size_t; }
# endif

//  Workaround for the unfortunate min/max macros defined by some platform headers

#define SC_BOOST_PREVENT_MACRO_SUBSTITUTION

#ifndef SC_BOOST_USING_STD_MIN
#  define SC_BOOST_USING_STD_MIN() using std::min
#endif

#ifndef SC_BOOST_USING_STD_MAX
#  define SC_BOOST_USING_STD_MAX() using std::max
#endif

//  SC_BOOST_NO_STD_MIN_MAX workaround  -----------------------------------------//

#  ifdef SC_BOOST_NO_STD_MIN_MAX

namespace std {
  template <class _Tp>
  inline const _Tp& min SC_BOOST_PREVENT_MACRO_SUBSTITUTION (const _Tp& __a, const _Tp& __b) {
    return __b < __a ? __b : __a;
  }
  template <class _Tp>
  inline const _Tp& max SC_BOOST_PREVENT_MACRO_SUBSTITUTION (const _Tp& __a, const _Tp& __b) {
    return  __a < __b ? __b : __a;
  }
}

#  endif

// SC_BOOST_STATIC_CONSTANT workaround --------------------------------------- //
// On compilers which don't allow in-class initialization of static integral
// constant members, we must use enums as a workaround if we want the constants
// to be available at compile-time. This macro gives us a convenient way to
// declare such constants.

#  ifdef SC_BOOST_NO_INCLASS_MEMBER_INITIALIZATION
#       define SC_BOOST_STATIC_CONSTANT(type, assignment) enum { assignment }
#  else
#     define SC_BOOST_STATIC_CONSTANT(type, assignment) static const type assignment
#  endif

// SC_BOOST_USE_FACET / HAS_FACET workaround ----------------------------------//
// When the standard library does not have a conforming std::use_facet there
// are various workarounds available, but they differ from library to library.
// The same problem occurs with has_facet.
// These macros provide a consistent way to access a locale's facets.
// Usage:
//    replace
//       std::use_facet<Type>(loc);
//    with
//       SC_BOOST_USE_FACET(Type, loc);
//    Note do not add a std:: prefix to the front of SC_BOOST_USE_FACET!
//  Use for SC_BOOST_HAS_FACET is analagous.

#if defined(SC_BOOST_NO_STD_USE_FACET)
#  ifdef SC_BOOST_HAS_TWO_ARG_USE_FACET
#     define SC_BOOST_USE_FACET(Type, loc) std::use_facet(loc, static_cast<Type*>(0))
#     define SC_BOOST_HAS_FACET(Type, loc) std::has_facet(loc, static_cast<Type*>(0))
#  elif defined(SC_BOOST_HAS_MACRO_USE_FACET)
#     define SC_BOOST_USE_FACET(Type, loc) std::_USE(loc, Type)
#     define SC_BOOST_HAS_FACET(Type, loc) std::_HAS(loc, Type)
#  elif defined(SC_BOOST_HAS_STLP_USE_FACET)
#     define SC_BOOST_USE_FACET(Type, loc) (*std::_Use_facet<Type >(loc))
#     define SC_BOOST_HAS_FACET(Type, loc) std::has_facet< Type >(loc)
#  endif
#else
#  define SC_BOOST_USE_FACET(Type, loc) std::use_facet< Type >(loc)
#  define SC_BOOST_HAS_FACET(Type, loc) std::has_facet< Type >(loc)
#endif

// SC_BOOST_NESTED_TEMPLATE workaround ------------------------------------------//
// Member templates are supported by some compilers even though they can't use
// the A::template member<U> syntax, as a workaround replace:
//
// typedef typename A::template rebind<U> binder;
//
// with:
//
// typedef typename A::SC_BOOST_NESTED_TEMPLATE rebind<U> binder;

#ifndef SC_BOOST_NO_MEMBER_TEMPLATE_KEYWORD
#  define SC_BOOST_NESTED_TEMPLATE template
#else
#  define SC_BOOST_NESTED_TEMPLATE
#endif

// SC_BOOST_UNREACHABLE_RETURN(x) workaround -------------------------------------//
// Normally evaluates to nothing, unless SC_BOOST_NO_UNREACHABLE_RETURN_DETECTION
// is defined, in which case it evaluates to return x; Use when you have a return
// statement that can never be reached.

#ifdef SC_BOOST_NO_UNREACHABLE_RETURN_DETECTION
#  define SC_BOOST_UNREACHABLE_RETURN(x) return x;
#else
#  define SC_BOOST_UNREACHABLE_RETURN(x)
#endif

// SC_BOOST_DEDUCED_TYPENAME workaround ------------------------------------------//
//
// Some compilers don't support the use of `typename' for dependent
// types in deduced contexts, e.g.
//
//     template <class T> void f(T, typename T::type);
//                                  ^^^^^^^^
// Replace these declarations with:
//
//     template <class T> void f(T, SC_BOOST_DEDUCED_TYPENAME T::type);

#ifndef SC_BOOST_NO_DEDUCED_TYPENAME
#  define SC_BOOST_DEDUCED_TYPENAME typename
#else
#  define SC_BOOST_DEDUCED_TYPENAME
#endif

// long long workaround ------------------------------------------//
// On gcc (and maybe other compilers?) long long is alway supported
// but it's use may generate either warnings (with -ansi), or errors
// (with -pedantic -ansi) unless it's use is prefixed by __extension__
//
#if defined(SC_BOOST_HAS_LONG_LONG)
namespace sc_boost{
#  ifdef __GNUC__
   __extension__ typedef long long long_long_type;
   __extension__ typedef unsigned long long ulong_long_type;
#  else
   typedef long long long_long_type;
   typedef unsigned long long ulong_long_type;
#  endif
}
#endif

// SC_BOOST_[APPEND_]EXPLICIT_TEMPLATE_[NON_]TYPE macros --------------------------//
//
// Some compilers have problems with function templates whose
// template parameters don't appear in the function parameter
// list (basically they just link one instantiation of the
// template in the final executable). These macros provide a
// uniform way to cope with the problem with no effects on the
// calling syntax.

// Example:
//
//  #include <iostream>
//  #include <ostream>
//  #include <typeinfo>
//
//  template <int n>
//  void f() { std::cout << n << ' '; }
//
//  template <typename T>
//  void g() { std::cout << typeid(T).name() << ' '; }
//
//  int main() {
//    f<1>();
//    f<2>();
//
//    g<int>();
//    g<double>();
//  }
//
// With VC++ 6.0 the output is:
//
//   2 2 double double
//
// To fix it, write
//
//   template <int n>
//   void f(SC_BOOST_EXPLICIT_TEMPLATE_NON_TYPE(int, n)) { ... }
//
//   template <typename T>
//   void g(SC_BOOST_EXPLICIT_TEMPLATE_TYPE(T)) { ... }
//


#if defined SC_BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS

#  include "sysc/packages/boost/type.hpp"
#  include "sysc/packages/boost/non_type.hpp"

#  define SC_BOOST_EXPLICIT_TEMPLATE_TYPE(t)         sc_boost::type<t>* = 0
#  define SC_BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t)    sc_boost::type<t>*
#  define SC_BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v)  sc_boost::non_type<t, v>* = 0
#  define SC_BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)  sc_boost::non_type<t, v>*

#  define SC_BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(t)         \
             , SC_BOOST_EXPLICIT_TEMPLATE_TYPE(t)
#  define SC_BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t)    \
             , SC_BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t)
#  define SC_BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v)  \
             , SC_BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
#  define SC_BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)  \
             , SC_BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)

#else

// no workaround needed: expand to nothing

#  define SC_BOOST_EXPLICIT_TEMPLATE_TYPE(t)
#  define SC_BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t)
#  define SC_BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
#  define SC_BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)

#  define SC_BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(t)
#  define SC_BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t)
#  define SC_BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
#  define SC_BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)


#endif // defined SC_BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS


// ---------------------------------------------------------------------------//

//
// Helper macro SC_BOOST_STRINGIZE:
// Converts the parameter X to a string after macro replacement
// on X has been performed.
//
#define SC_BOOST_STRINGIZE(X) SC_BOOST_DO_STRINGIZE(X)
#define SC_BOOST_DO_STRINGIZE(X) #X

//
// Helper macro SC_BOOST_JOIN:
// The following piece of macro magic joins the two
// arguments together, even when one of the arguments is
// itself a macro (see 16.3.1 in C++ standard).  The key
// is that macro expansion of macro arguments does not
// occur in SC_BOOST_DO_JOIN2 but does in SC_BOOST_DO_JOIN.
//
#define SC_BOOST_JOIN( X, Y ) SC_BOOST_DO_JOIN( X, Y )
#define SC_BOOST_DO_JOIN( X, Y ) SC_BOOST_DO_JOIN2(X,Y)
#define SC_BOOST_DO_JOIN2( X, Y ) X##Y

//
// Set some default values for compiler/library/platform names.
// These are for debugging config setup only:
//
#  ifndef SC_BOOST_COMPILER
#     define SC_BOOST_COMPILER "Unknown ISO C++ Compiler"
#  endif
#  ifndef SC_BOOST_STDLIB
#     define SC_BOOST_STDLIB "Unknown ISO standard library"
#  endif
#  ifndef SC_BOOST_PLATFORM
#     if defined(unix) || defined(__unix) || defined(_XOPEN_SOURCE) \
         || defined(_POSIX_SOURCE)
#        define SC_BOOST_PLATFORM "Generic Unix"
#     else
#        define SC_BOOST_PLATFORM "Unknown"
#     endif
#  endif

#endif



