--- bits/random.h
+++ bits/random.h
@@ -101,10 +101,12 @@
       { typedef unsigned long long type; };
 
 #ifdef _GLIBCXX_USE_INT128
+#ifndef __clang__
     template<int __s>
       struct _Select_uint_least_t<__s, 1>
       { typedef unsigned __int128 type; };
 #endif
+#endif
 
     // Assume a != 0, a < m, c < m, x < m.
     template<typename _Tp, _Tp __m, _Tp __a, _Tp __c,
--- cstddef
+++ cstddef
@@ -45,11 +45,13 @@
 #include <stddef.h>
 
 #if __cplusplus >= 201103L
+#ifndef __clang__
 namespace std
 {
   // We handle size_t, ptrdiff_t, and nullptr_t in c++config.h.
   using ::max_align_t;
 }
 #endif
+#endif
 
 #endif // _GLIBCXX_CSTDDEF
--- x86_64-apple-darwin13/bits/c++config.h
+++ x86_64-apple-darwin13/bits/c++config.h
@@ -913,7 +913,9 @@
 #define _GLIBCXX_HAVE_TGMATH_H 1
 
 /* Define to 1 if the target supports thread-local storage. */
+#if !defined(__clang__) || __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1070
 #define _GLIBCXX_HAVE_TLS 1
+#endif
 
 /* Define to 1 if you have the <unistd.h> header file. */
 #define _GLIBCXX_HAVE_UNISTD_H 1
--- x86_64-apple-darwin13/i386/bits/c++config.h
+++ x86_64-apple-darwin13/i386/bits/c++config.h
@@ -913,7 +913,9 @@
 #define _GLIBCXX_HAVE_TGMATH_H 1
 
 /* Define to 1 if the target supports thread-local storage. */
+#if !defined(__clang__) || __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1070
 #define _GLIBCXX_HAVE_TLS 1
+#endif
 
 /* Define to 1 if you have the <unistd.h> header file. */
 #define _GLIBCXX_HAVE_UNISTD_H 1
