Add CMake build and fix major Linux blockers.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@121510 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/__config b/include/__config
index f246066..4af9bec 100644
--- a/include/__config
+++ b/include/__config
@@ -214,6 +214,7 @@
 #endif  // !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
 
 #if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
+#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
 #define _LIBCPP_HAS_NO_NULLPTR
 #endif
 
diff --git a/include/__split_buffer b/include/__split_buffer
index 88e2c83..718fd88 100644
--- a/include/__split_buffer
+++ b/include/__split_buffer
@@ -85,12 +85,14 @@
     void shrink_to_fit();
     void push_front(const_reference __x);
     void push_back(const_reference __x);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
     void push_front(value_type&& __x);
     void push_back(value_type&& __x);
+#if !defined(_LIBCPP_HAS_NO_VARIADICS)
     template <class... _Args>
         void emplace_back(_Args&&... __args);
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif  // !defined(_LIBCPP_HAS_NO_VARIADICS)
+#endif  // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
 
     _LIBCPP_INLINE_VISIBILITY void pop_front() {__destruct_at_begin(__begin_+1);}
     _LIBCPP_INLINE_VISIBILITY void pop_back() {__destruct_at_end(__end_-1);}
diff --git a/include/locale b/include/locale
index 6e807fb..60aab1d 100644
--- a/include/locale
+++ b/include/locale
@@ -265,7 +265,10 @@
 }
 
 #else  // __APPLE__
-inline _LIBCPP_INLINE_VISIBILITY
+inline
+#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
+_LIBCPP_INLINE_VISIBILITY
+#endif
 int
 __nolocale_sprintf(char* __restrict __str,
                    const char* __restrict __format, ...)
@@ -276,7 +279,10 @@
     va_end(__ap);
     return __result;
 }
-inline _LIBCPP_INLINE_VISIBILITY
+inline
+#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
+_LIBCPP_INLINE_VISIBILITY
+#endif
 int
 __nolocale_snprintf(char* __restrict __str, size_t __size,
                     const char* __restrict __format, ...)
@@ -287,7 +293,10 @@
     va_end(__ap);
     return __result;
 }
-inline _LIBCPP_INLINE_VISIBILITY
+inline
+#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
+_LIBCPP_INLINE_VISIBILITY
+#endif
 int
 __nolocale_asprintf(char** __ret,
                     const char* __restrict __format, ...)
@@ -298,7 +307,10 @@
     va_end(__ap);
     return __result;
 }
-inline _LIBCPP_INLINE_VISIBILITY
+inline
+#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
+_LIBCPP_INLINE_VISIBILITY
+#endif
 int
 __nolocale_sscanf(const char* __restrict __str,
                   const char* __restrict __format, ...)
diff --git a/include/memory b/include/memory
index c20e1a0..90cf3e6 100644
--- a/include/memory
+++ b/include/memory
@@ -1487,7 +1487,7 @@
 {
 };
 
-#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
 
 // uses-allocator construction
 
@@ -1505,7 +1505,7 @@
     : integral_constant<int, __uses_alloc_ctor_imp<_Tp, _Alloc, _Args...>::value>
     {};
 
-#endif  // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+#endif  // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
 
 // allocator
 
@@ -1546,6 +1546,7 @@
         {
             ::new((void*)__p) _Tp();
         }
+# if defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
     template <class _A0>
         _LIBCPP_INLINE_VISIBILITY
         typename enable_if
@@ -1579,6 +1580,7 @@
         {
             ::new((void*)__p) _Tp(_STD::move(__a0));
         }
+# endif  // defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
     template <class _A0, class _A1>
         _LIBCPP_INLINE_VISIBILITY
         void
diff --git a/include/utility b/include/utility
index f8a8fc5..c65b59e 100644
--- a/include/utility
+++ b/include/utility
@@ -222,6 +222,8 @@
               second(_STD::forward<_U2>(__u2))
             {}
 
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
     template<class _Tuple,
              class = typename enable_if<__tuple_convertible<_Tuple, pair>::value>::type>
         _LIBCPP_INLINE_VISIBILITY
@@ -232,7 +234,7 @@
                                    typename __make_tuple_types<_Tuple>::type>::type>(get<1>(__p)))
             {}
 
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+
 
     template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
         _LIBCPP_INLINE_VISIBILITY
@@ -243,8 +245,6 @@
                    typename __make_tuple_indices<sizeof...(_Args2) >::type())
             {}
 
-#endif  // _LIBCPP_HAS_NO_VARIADICS
-
     template <class _Tuple,
               class = typename enable_if<__tuple_assignable<_Tuple, pair>::value>::type>
         _LIBCPP_INLINE_VISIBILITY
@@ -259,6 +259,8 @@
             return *this;
         }
 
+#endif  // _LIBCPP_HAS_NO_VARIADICS
+
 #else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
     template<class _U1, class _U2>
         _LIBCPP_INLINE_VISIBILITY pair(const pair<_U1, _U2>& __p)