aboutsummaryrefslogtreecommitdiffstats
path: root/m4/stl_hash.m4
diff options
context:
space:
mode:
authorWink Saville <wink@google.com>2010-05-27 16:25:37 -0700
committerWink Saville <wink@google.com>2010-05-27 16:25:37 -0700
commitfbaaef999ba563838ebd00874ed8a1c01fbf286d (patch)
tree24ff5c76344e90abc5b0fe6f07120ea0d2d011ee /m4/stl_hash.m4
parent79a4a60053f74ab71c7c3ec436d2f6caedc5be61 (diff)
downloadexternal_protobuf-fbaaef999ba563838ebd00874ed8a1c01fbf286d.zip
external_protobuf-fbaaef999ba563838ebd00874ed8a1c01fbf286d.tar.gz
external_protobuf-fbaaef999ba563838ebd00874ed8a1c01fbf286d.tar.bz2
Add protobuf 2.2.0a sources
This is the contents of protobuf-2.2.0a.tar.bz2 from http://code.google.com/p/protobuf/downloads/list and is the base code for the javamicro code generator. Change-Id: Ie9a0440a824d615086445b6636944484b3155afa
Diffstat (limited to 'm4/stl_hash.m4')
-rw-r--r--m4/stl_hash.m443
1 files changed, 43 insertions, 0 deletions
diff --git a/m4/stl_hash.m4 b/m4/stl_hash.m4
new file mode 100644
index 0000000..912b954
--- /dev/null
+++ b/m4/stl_hash.m4
@@ -0,0 +1,43 @@
+# 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_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
+])