2009-04-23 Chris Demetriou <cgd@google.com>
authorChris Demetriou <cgd@google.com>
Fri, 24 Apr 2009 19:33:42 +0000 (19:33 +0000)
committerChris Demetriou <cgd@google.com>
Fri, 24 Apr 2009 19:33:42 +0000 (19:33 +0000)
        * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
        * configure: Regenerate.
        * config.in: Regenerate.
        * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
        if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.

gold/ChangeLog
gold/config.in
gold/configure
gold/configure.ac
gold/gold.h

index 3841da29336bfce561114828a4bf3780893f1b82..bec3a75bef72c402a419b9b6cca36eca2e43f6f3 100644 (file)
@@ -1,3 +1,11 @@
+2009-04-23  Chris Demetriou  <cgd@google.com>
+
+       * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
+       * configure: Regenerate.
+       * config.in: Regenerate.
+       * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
+       if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
+
 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
 
        * incremental.cc (Incremental_inputs_header_data): Renamed from
index 97af33583cf25661d5577a5429e1459a351dbb48..1ab4ca593d8c0dbe36d6c833b73b07f7110f4d8f 100644 (file)
@@ -97,6 +97,9 @@
 /* Define to 1 if you have the <tr1/unordered_map> header file. */
 #undef HAVE_TR1_UNORDERED_MAP
 
+/* Define if ::std::tr1::unordered_map::rehash is usable */
+#undef HAVE_TR1_UNORDERED_MAP_REHASH
+
 /* Define to 1 if you have the <tr1/unordered_set> header file. */
 #undef HAVE_TR1_UNORDERED_SET
 
index 8cd51534561b9a25417a71725a68d8863e67ac11..45a2c24a8ac05013890deece9880b8b01bd9c20f 100755 (executable)
@@ -6855,6 +6855,73 @@ fi
 done
 
 
+# Use of ::std::tr1::unordered_map::rehash causes undefined symbols
+# at link time with some versions of GCC.
+echo "$as_me:$LINENO: checking whether ::std::tr1::unordered_map::rehash is usable." >&5
+echo $ECHO_N "checking whether ::std::tr1::unordered_map::rehash is usable.... $ECHO_C" >&6
+if test "${gold_cv_unordered_map_rehash+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <tr1/unordered_map>
+void bar() { ::std::tr1::unordered_map<int, int> x; x.rehash(10); }
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  gold_cv_unordered_map_rehash=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+gold_cv_unordered_map_rehash=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $gold_cv_unordered_map_rehash" >&5
+echo "${ECHO_T}$gold_cv_unordered_map_rehash" >&6
+if test "$gold_cv_unordered_map_rehash" = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_TR1_UNORDERED_MAP_REHASH 1
+_ACEOF
+
+fi
+
 # gcc 4.3.0 doesn't recognize the printf attribute on a template
 # function.  Check for that.  This is gcc bug 35546.  This test can
 # probably be removed after the bug has been fixed for a while.
index e8d576236a2568fc7364649a0fb67c25f6015a42..ad04fa6bb60ce97d9e6dbe25e2f15b6208239674 100644 (file)
@@ -325,6 +325,19 @@ AC_CHECK_HEADERS(ext/hash_map ext/hash_set)
 AC_CHECK_HEADERS(byteswap.h)
 AC_CHECK_FUNCS(mallinfo posix_fallocate)
 
+# Use of ::std::tr1::unordered_map::rehash causes undefined symbols
+# at link time with some versions of GCC.
+AC_CACHE_CHECK([whether ::std::tr1::unordered_map::rehash is usable.],
+[gold_cv_unordered_map_rehash],
+[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#include <tr1/unordered_map>
+void bar() { ::std::tr1::unordered_map<int, int> x; x.rehash(10); }
+]])], [gold_cv_unordered_map_rehash=yes], [gold_cv_unordered_map_rehash=no])])
+if test "$gold_cv_unordered_map_rehash" = "yes"; then
+  AC_DEFINE(HAVE_TR1_UNORDERED_MAP_REHASH, 1,
+           [Define if ::std::tr1::unordered_map::rehash is usable])
+fi
+
 # gcc 4.3.0 doesn't recognize the printf attribute on a template
 # function.  Check for that.  This is gcc bug 35546.  This test can
 # probably be removed after the bug has been fixed for a while.
index 4c23aa6f6d541f715a2a612b052a416d8cef549d..efebda8a36670cdae8aba514378f7daa9d2bdaca 100644 (file)
@@ -65,7 +65,8 @@
 
 // Figure out how to get a hash set and a hash map.
 
-#if defined(HAVE_TR1_UNORDERED_SET) && defined(HAVE_TR1_UNORDERED_MAP)
+#if defined(HAVE_TR1_UNORDERED_SET) && defined(HAVE_TR1_UNORDERED_MAP) \
+    && defined(HAVE_TR1_UNORDERED_MAP_REHASH)
 
 #include <tr1/unordered_set>
 #include <tr1/unordered_map>
This page took 0.037967 seconds and 4 git commands to generate.