diff options
author | Jeff Davidson <jpd@google.com> | 2014-09-15 16:29:06 -0700 |
---|---|---|
committer | Jeff Davidson <jpd@google.com> | 2015-01-15 14:10:53 -0800 |
commit | a3b2a6da25a76f17c73d31def3952feb0fd2296e (patch) | |
tree | 586f7d5e9a7e05af45d0e821188097c0faa96219 /m4/stl_hash.m4 | |
parent | c7c25812eb19d080087b71e08bfe35aff9f21433 (diff) | |
download | external_protobuf-a3b2a6da25a76f17c73d31def3952feb0fd2296e.zip external_protobuf-a3b2a6da25a76f17c73d31def3952feb0fd2296e.tar.gz external_protobuf-a3b2a6da25a76f17c73d31def3952feb0fd2296e.tar.bz2 |
Update protobuf library from 2.3 to 2.6.
Copied in all files from the open source protobuf project at commit
edc5994525c79cd1919859a370837a6ff7c8e308, removing files which have
been renamed (COPYING.txt -> LICENSE, README.txt -> README.md).
Removed 2.3 prebuilts, which is an approach that will not work due to
incompatibility with the 2.6 runtime.
Merged in micro/nano-specific changes in the following files:
-Android.mk - updated list of C++/Java sources, bumped versions
-java/README.txt - merged in micro/nano instructions, bumped versions
-java/pom.xml - merged in micro/nano build rules, set packaging to jar
-src/Makefile.am - merged in references to micro/nano generators
-src/google/protobuf/compiler/javamicro/javamicro_file.h - imported
google/protobuf/compiler/code_generator.h and removed redundant
OutputDirectory class.
-src/google/protobuf/compiler/javanano/javanano_file.h - same
-Replaced instances of vector with std::vector as needed to get
libprotobuf-cpp-full to compile. Plan to upstream this fix per
discussion with protobuf maintainers.
Reran autogen.sh to update ./configure and associated scripts.
Change-Id: I949d32fb5126f1c05e2a6ed48f6636a4a9b15a48
Diffstat (limited to 'm4/stl_hash.m4')
-rw-r--r-- | m4/stl_hash.m4 | 98 |
1 files changed, 55 insertions, 43 deletions
diff --git a/m4/stl_hash.m4 b/m4/stl_hash.m4 index 08813c9..0722b14 100644 --- a/m4/stl_hash.m4 +++ b/m4/stl_hash.m4 @@ -1,60 +1,72 @@ -# We check two things: where the include file is for hash_map, and -# what namespace hash_map lives in within that include file. We +# We check two things: where the include file is for +# unordered_map/hash_map (we prefer the first form), and what +# namespace unordered/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?) +# wild. We define HASH_MAP_H to the location of the header file, and +# HASH_NAMESPACE to the namespace the class (unordered_map or +# hash_map) is in. We define HAVE_UNORDERED_MAP if the class we found +# is named unordered_map, or leave it undefined if not. +# This also checks if unordered map exists. AC_DEFUN([AC_CXX_STL_HASH], - [AC_MSG_CHECKING(the location of hash_map) - AC_LANG_SAVE + [ + AC_MSG_CHECKING(the location of hash_map) + AC_LANG_SAVE AC_LANG_CPLUSPLUS - ac_cv_cxx_hash_map_header="" - ac_cv_cxx_hash_map_class="" - for location in [tr1/unordered_map ext/hash_map hash_map]; do - for namespace in [std::tr1 __gnu_cxx "" std stdext]; do - for name in [unordered_map hash_map]; do - - if test -z "$ac_cv_cxx_hash_map_header"; then - - # On OSX 1.5 / GCC 4.0.1 (the standard compiler on that platform), - # calling find() on a const unordered_map does not compile. So, we - # include a call to find() in our test to detect this broken - # implementation and avoid using it. Note that ext/hash_map works - # fine on this platform, so we'll end up using that. - AC_TRY_COMPILE([#include <$location>], - [const ${namespace}::$name<int, int> t; - t.find(1);], - [ac_cv_cxx_hash_map_header="<$location>"; - ac_cv_cxx_hash_namespace="$namespace"; - ac_cv_cxx_hash_map_class="$name";]) - fi - done + ac_cv_cxx_hash_map="" + # First try unordered_map, but not on gcc's before 4.2 -- I've + # seen unexplainable unordered_map bugs with -O2 on older gcc's. + AC_TRY_COMPILE([#if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2)) + # error GCC too old for unordered_map + #endif + ], + [/* no program body necessary */], + [stl_hash_old_gcc=no], + [stl_hash_old_gcc=yes]) + for location in unordered_map tr1/unordered_map; do + for namespace in std std::tr1; do + if test -z "$ac_cv_cxx_hash_map" -a "$stl_hash_old_gcc" != yes; then + # Some older gcc's have a buggy tr1, so test a bit of code. + AC_TRY_COMPILE([#include <$location>], + [const ${namespace}::unordered_map<int, int> t; + return t.find(5) == t.end();], + [ac_cv_cxx_hash_map="<$location>"; + ac_cv_cxx_hash_namespace="$namespace"; + ac_cv_cxx_hash_map_class="unordered_map";]) + fi done done - ac_cv_cxx_hash_set_header=`echo "$ac_cv_cxx_hash_map_header" | sed s/map/set/`; + # Now try 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"; + ac_cv_cxx_hash_map_class="hash_map";]) + fi + done + done + ac_cv_cxx_hash_set=`echo "$ac_cv_cxx_hash_map" | sed s/map/set/`; ac_cv_cxx_hash_set_class=`echo "$ac_cv_cxx_hash_map_class" | sed s/map/set/`; - if test -n "$ac_cv_cxx_hash_map_header"; then + 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_header, - [the location of <hash_map>]) - AC_DEFINE_UNQUOTED(HASH_SET_H,$ac_cv_cxx_hash_set_header, - [the location of <hash_set>]) + AC_DEFINE_UNQUOTED(HASH_MAP_H,$ac_cv_cxx_hash_map, + [the location of <unordered_map> or <hash_map>]) + AC_DEFINE_UNQUOTED(HASH_SET_H,$ac_cv_cxx_hash_set, + [the location of <unordered_set> or <hash_set>]) + AC_DEFINE_UNQUOTED(HASH_NAMESPACE,$ac_cv_cxx_hash_namespace, + [the namespace of hash_map/hash_set]) AC_DEFINE_UNQUOTED(HASH_MAP_CLASS,$ac_cv_cxx_hash_map_class, - [the name of <hash_set>]) + [the name of <hash_map>]) AC_DEFINE_UNQUOTED(HASH_SET_CLASS,$ac_cv_cxx_hash_set_class, [the name 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_header]) + AC_MSG_RESULT([$ac_cv_cxx_hash_map]) else AC_MSG_RESULT() AC_MSG_WARN([could not find an STL hash_map]) fi ]) + |