Fix building and testing libc++ with GCC.

The changes in src/exception.cpp and cmake/Modules/HandleLibCXXABI.cmake fix a
bug when building libc++ with GCC. Because GCC does not support __has_include
we need to explicitly tell it that we are building against libc++abi via the
preprocessor definition `LIBCXX_BUILDING_LIBCXXABI`.

The changes in include/ratio are to work around CWG defect
1712 (constexpr variable template declarations). GCC 4.8 and before has not
adopted the resolution to this defect.

The changes in include/exception work around an issue where is_final is used
without it being defined in type_traits.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237767 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/exception b/include/exception
index 2d8c0f5..ef2b969 100644
--- a/include/exception
+++ b/include/exception
@@ -193,7 +193,7 @@
 throw_with_nested(_Tp&& __t, typename enable_if<
                   is_class<typename remove_reference<_Tp>::type>::value &&
                   !is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
-#if _LIBCPP_STD_VER > 11
+#if _LIBCPP_STD_VER > 11 && __has_feature(is_final)
                   && !is_final<typename remove_reference<_Tp>::type>::value
 #endif
                                     >::type* = 0)
@@ -215,7 +215,7 @@
 throw_with_nested(_Tp&& __t, typename enable_if<
                   !is_class<typename remove_reference<_Tp>::type>::value ||
                   is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
-#if _LIBCPP_STD_VER > 11
+#if _LIBCPP_STD_VER > 11 && __has_feature(is_final)
                   || is_final<typename remove_reference<_Tp>::type>::value
 #endif
                                     >::type* = 0)