diff --git a/code/globalincs/vmallocator.h b/code/globalincs/vmallocator.h
index 659775f..3a957ed 100644
--- a/code/globalincs/vmallocator.h
+++ b/code/globalincs/vmallocator.h
@@ -9,11 +9,26 @@
 #include <string>
 #include <queue>
 
-#if defined __GNUC__ || defined __APPLE__
+#if defined __GNUC__
+#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
+#if GCC_VERSION >= 40300
+#include <tr1/unordered_map>
+#define SCP_hash_map std::tr1::unordered_map
+#elif GCC_VERSION < 40300
 #include <ext/hash_map>
-#else
+#define SCP_hash_map std::hash_map
+#endif // GCC_VERSION
+#endif // __GNUC__
+
+#if defined __APPLE__ && ! defined __GNUC__
+#include <ext/hash_map>
+#define SCP_hash_map std::hash_map
+#endif // defined __APPLE__ && ! defined __GNUC__
+
+#if ! defined __APPLE__ && ! defined __GNUC__
 #include <hash_map>
-#endif
+#define SCP_hash_map stdext::hash_map
+#endif // ! defined __APPLE__ && ! defined __GNUC__
 
 #if defined(_MSC_VER) && _MSC_VER >= 1400 || !defined(_MSC_VER)
 
@@ -125,16 +140,7 @@ bool operator!=(const SCP_vm_allocator<T1>&, const SCP_vm_allocator<T2>&) throw(
 	return false;
 }
 
-#ifdef SCP_UNIX
-#define SCP_hash_map __gnu_cxx::hash_map
-#elif defined __APPLE__
-#define SCP_hash_map std::hash_map
 #else
-#define SCP_hash_map stdext::hash_map
-#endif
-
-#else
-
 #define SCP_string std::string
 #define SCP_stringstream std::stringstream
 #define SCP_map std::map