+
+dnl When plugins enabled dynamic loader interface is required. Check headers
+dnl which may provide this interface. Add the necessary library to link.
+AC_CHECK_HEADERS(windows.h)
+AC_CHECK_HEADERS(dlfcn.h)
+AC_SEARCH_LIBS(dlopen, [dl dld])
+case "$ac_cv_search_dlopen" in
+ no*) DLOPEN_LIBS="";;
+ *) DLOPEN_LIBS="$ac_cv_search_dlopen";;
+esac
+AC_SUBST(DLOPEN_LIBS)
+
+AC_CHECK_FUNCS(mallinfo posix_fallocate fallocate readv sysconf times mkdtemp)
+AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf, strverscmp, strndup, memmem])
+
+# 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
+
+# Use of tr1/unordered_map with off_t as a key is not supported on GCC
+# 4.1.xx when compiling in 32-bit mode with a 64-bit off_t type.
+AC_CACHE_CHECK([whether std::tr1::hash<off_t> is defined],
+[gold_cv_hash_off_t],
+[CXXFLAGS_hold=$CXXFLAGS
+CXXFLAGS="$CXXFLAGS $LFS_CFLAGS"
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+#include <sys/types.h>
+#include <tr1/unordered_map>
+std::tr1::hash<off_t> h;
+])],
+[gold_cv_hash_off_t=yes],
+[gold_cv_hash_off_t=no])
+CXXFLAGS=$CXXFLAGS_hold])
+if test "$gold_cv_hash_off_t" = "yes"; then
+ AC_DEFINE(HAVE_TR1_HASH_OFF_T, 1,
+ [Define if std::tr1::hash<off_t> is usable])
+fi