gperftools/m4/stl_hash.m4
csilvers c437e1fcdd Tue Jul 17 22:26:27 2007 Google Inc. <opensource@google.com>
* google-perftools: version 0.92 release
	* PERFORMANCE: use a packed cache to speed up tcmalloc
	* PORTING: preliminary windows support! (see README.windows)
	* PORTING: better support for solaris, OS X, FreeBSD (see INSTALL)
	* Envvar support for running the heap-checker under gdb
	* Add weak declarations to maybe_threads to fix no-pthreads compile bugs
	* Some 64bit fixes, especially with pprof
	* Better heap-checker support for some low-level allocations
	* Fix bug where heap-profiles would sometimes get truncated
	* New documentation about how to handle common heap leak situations
	* Use computed includes for hash_map/set: easier config
	* Added all used .m4 templates to the distribution


git-svn-id: http://gperftools.googlecode.com/svn/trunk@36 6b5cf1ce-ec42-a296-1ba9-69fdba395a50
2007-07-18 18:30:50 +00:00

45 lines
1.9 KiB
Plaintext

# We check two things: where the include file is for hash_map, and
# what namespace hash_map lives in within that include file. We
# include AC_TRY_COMPILE for all the combinations we've seen in the
# wild. We define one of HAVE_HASH_MAP or HAVE_EXT_HASH_MAP depending
# on location, and HASH_NAMESPACE to be the namespace hash_map is
# defined in.
#
# Ideally we'd use AC_CACHE_CHECK, but that only lets us store one value
# at a time, and we need to store two (filename and namespace).
# prints messages itself, so we have to do the message-printing ourselves
# via AC_MSG_CHECKING + AC_MSG_RESULT. (TODO(csilvers): can we cache?)
AC_DEFUN([AC_CXX_STL_HASH],
[AC_REQUIRE([AC_CXX_NAMESPACES])
AC_MSG_CHECKING(the location of hash_map)
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
ac_cv_cxx_hash_map=""
for location in ext/hash_map hash_map; do
for namespace in __gnu_cxx "" std stdext; do
if test -z "$ac_cv_cxx_hash_map"; then
AC_TRY_COMPILE([#include <$location>],
[${namespace}::hash_map<int, int> t],
[ac_cv_cxx_hash_map="<$location>";
ac_cv_cxx_hash_namespace="$namespace";])
fi
done
done
ac_cv_cxx_hash_set=`echo "$ac_cv_cxx_hash_map" | sed s/map/set/`;
if test -n "$ac_cv_cxx_hash_map"; then
AC_DEFINE(HAVE_HASH_MAP, 1, [define if the compiler has hash_map])
AC_DEFINE(HAVE_HASH_SET, 1, [define if the compiler has hash_set])
AC_DEFINE_UNQUOTED(HASH_MAP_H,$ac_cv_cxx_hash_map,
[the location of <hash_map>])
AC_DEFINE_UNQUOTED(HASH_SET_H,$ac_cv_cxx_hash_set,
[the location of <hash_set>])
AC_DEFINE_UNQUOTED(HASH_NAMESPACE,$ac_cv_cxx_hash_namespace,
[the namespace of hash_map/hash_set])
AC_MSG_RESULT([$ac_cv_cxx_hash_map])
else
AC_MSG_RESULT()
AC_MSG_WARN([could not find an STL hash_map])
fi
])