aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gold/ChangeLog7
-rw-r--r--gold/config.in6
-rwxr-xr-xgold/configure14
-rw-r--r--gold/configure.ac1
-rw-r--r--gold/system.h17
5 files changed, 43 insertions, 2 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index ea67ee9..2e26946 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,10 @@
+2013-12-18 Cary Coutant <ccoutant@google.com>
+
+ * configure.ac: Check for <unordered_set> and <unordered_map>.
+ * config.in: Regenerate.
+ * configure: Regenerate.
+ * system.h: Use <unordered_set> and <unordered_map> if available.
+
2013-12-10 Roland McGrath <mcgrathr@google.com>
* Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
diff --git a/gold/config.in b/gold/config.in
index d46fd75..be77810 100644
--- a/gold/config.in
+++ b/gold/config.in
@@ -187,6 +187,12 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
+/* Define to 1 if you have the <unordered_map> header file. */
+#undef HAVE_UNORDERED_MAP
+
+/* Define to 1 if you have the <unordered_set> header file. */
+#undef HAVE_UNORDERED_SET
+
/* Define to 1 if you have the <windows.h> header file. */
#undef HAVE_WINDOWS_H
diff --git a/gold/configure b/gold/configure
index 24140cf..2257324 100755
--- a/gold/configure
+++ b/gold/configure
@@ -7133,6 +7133,20 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+for ac_header in unordered_set unordered_map
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_cxx_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+eval as_val=\$$as_ac_Header
+ if test "x$as_val" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
for ac_header in tr1/unordered_set tr1/unordered_map
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
diff --git a/gold/configure.ac b/gold/configure.ac
index 9bc216b..b2741cf 100644
--- a/gold/configure.ac
+++ b/gold/configure.ac
@@ -523,6 +523,7 @@ AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf, strvers
AC_LANG_PUSH(C++)
+AC_CHECK_HEADERS(unordered_set unordered_map)
AC_CHECK_HEADERS(tr1/unordered_set tr1/unordered_map)
AC_CHECK_HEADERS(ext/hash_map ext/hash_set)
AC_CHECK_HEADERS(byteswap.h)
diff --git a/gold/system.h b/gold/system.h
index 3e6fe1d..aea3723 100644
--- a/gold/system.h
+++ b/gold/system.h
@@ -57,8 +57,21 @@
// Figure out how to get a hash set and a hash map.
-#if defined(HAVE_TR1_UNORDERED_SET) && defined(HAVE_TR1_UNORDERED_MAP) \
- && defined(HAVE_TR1_UNORDERED_MAP_REHASH)
+#if defined(HAVE_UNORDERED_SET) && defined(HAVE_UNORDERED_MAP)
+
+#include <unordered_set>
+#include <unordered_map>
+
+// We need a template typedef here.
+
+#define Unordered_set std::unordered_set
+#define Unordered_map std::unordered_map
+#define Unordered_multimap std::unordered_multimap
+
+#define reserve_unordered_map(map, n) ((map)->rehash(n))
+
+#elif defined(HAVE_TR1_UNORDERED_SET) && defined(HAVE_TR1_UNORDERED_MAP) \
+ && defined(HAVE_TR1_UNORDERED_MAP_REHASH)
#include <tr1/unordered_set>
#include <tr1/unordered_map>