--- Rcpp/inst/include/RcppCommon.h	2012-11-23 01:07:34.000000000 +0000
+++ ../Downloads/Rcpp/inst/include/RcppCommon.h	2012-12-01 12:43:25.000000000 +0000
@@ -107,14 +107,31 @@
 //     #endif
 // #endif
 
+#ifdef __clang__
+    #if !__has_include(<tr1/unordered_map>)
+        #undef HAS_TR1
+        #undef HAS_TR1_UNORDERED_MAP
+    #endif
+    #if !__has_include(<tr1/unordered_set>)
+        #undef HAS_TR1
+        #undef HAS_TR1_UNORDERED_SET
+    #endif
+    #if __has_feature(cxx_variadic_templates)
+        #define HAS_VARIADIC_TEMPLATES
+    #endif
+#endif
+
 #ifdef __INTEL_COMPILER
     // This is based on an email by Alexey Stukalov who tested 
     // Intel Compiler 12.0 and states that is does support Cxx0x 
     // or even TR1 (by default; maybe there are options?)
     #undef HAS_VARIADIC_TEMPLATES
+    #include <cmath>
+    #ifndef __GLIBCXX__
     #undef HAS_TR1
     #undef HAS_TR1_UNORDERED_MAP
     #undef HAS_TR1_UNORDERED_SET
+    #endif
 #endif
 
 
@@ -149,6 +166,21 @@
 #include <tr1/unordered_set>
 #endif
 
+
+#if __cplusplus >= 201103L
+    #if defined(__GLIBCXX__) && __GLIBCXX__ > 20090421
+    #include <unordered_map>
+    #include <unordered_set>
+    #elif defined(__clang__)
+        #if __has_include(<unordered_map>)
+        #include <unordered_map>
+        #endif
+        #if __has_include(<unordered_set>)
+        #include <unordered_set>
+        #endif
+    #endif
+#endif
+
 std::string demangle( const std::string& name) ;
 #define DEMANGLE(__TYPE__) demangle( typeid(__TYPE__).name() ).c_str() 
 
