Add configure checks for <unordered_set> and <unordered_map>.

gold/
	* configure.ac: Check for <unordered_set> and <unordered_map>.
	* config.in: Regenerate.
	* configure: Regenerate.
	* system.h: Use <unordered_set> and <unordered_map> if available.
This commit is contained in:
Cary Coutant 2013-12-18 15:53:05 -08:00
parent a6d17b0194
commit 8356f2d009
5 changed files with 43 additions and 2 deletions

View File

@ -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

View File

@ -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

14
gold/configure vendored
View File

@ -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`

View File

@ -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)

View File

@ -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>