Reid Spencer | b15e69a | 2004-09-07 06:56:14 +0000 | [diff] [blame] | 1 | # Check for hash_map extension. This is from |
| 2 | # http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_map.html |
| 3 | AC_DEFUN([AC_CXX_HAVE_STD_EXT_HASH_MAP], |
| 4 | [AC_CACHE_CHECK([whether the compiler has <ext/hash_map> defining template class std::hash_map], |
| 5 | ac_cv_cxx_have_std_ext_hash_map, |
| 6 | [AC_REQUIRE([AC_CXX_NAMESPACES]) |
| 7 | AC_LANG_SAVE |
| 8 | AC_LANG_CPLUSPLUS |
| 9 | AC_TRY_COMPILE([#include <ext/hash_map> |
| 10 | #ifdef HAVE_NAMESPACES |
| 11 | using namespace std; |
| 12 | #endif],[hash_map<int, int> t;], |
| 13 | [ac_cv_cxx_have_std_ext_hash_map=yes], [ac_cv_cxx_have_std_ext_hash_map=no]) |
| 14 | AC_LANG_RESTORE]) |
| 15 | HAVE_STD_EXT_HASH_MAP=0 |
| 16 | if test "$ac_cv_cxx_have_std_ext_hash_map" = yes |
| 17 | then |
| 18 | HAVE_STD_EXT_HASH_MAP=1 |
| 19 | fi |
| 20 | AC_SUBST(HAVE_STD_EXT_HASH_MAP)]) |
| 21 | |
| 22 | AC_DEFUN([AC_CXX_HAVE_GNU_EXT_HASH_MAP], |
| 23 | [AC_CACHE_CHECK([whether the compiler has <ext/hash_map> defining template class __gnu_cxx::hash_map], |
| 24 | ac_cv_cxx_have_gnu_ext_hash_map, |
| 25 | [AC_REQUIRE([AC_CXX_NAMESPACES]) |
| 26 | AC_LANG_SAVE |
| 27 | AC_LANG_CPLUSPLUS |
| 28 | AC_TRY_COMPILE([#include <ext/hash_map> |
| 29 | #ifdef HAVE_NAMESPACES |
| 30 | using namespace __gnu_cxx; |
| 31 | #endif],[hash_map<int,int> t; ], |
| 32 | [ac_cv_cxx_have_gnu_ext_hash_map=yes],[ac_cv_cxx_have_gnu_ext_hash_map=no]) |
| 33 | AC_LANG_RESTORE]) |
| 34 | HAVE_GNU_EXT_HASH_MAP=0 |
| 35 | if test "$ac_cv_cxx_have_gnu_ext_hash_map" = yes |
| 36 | then |
| 37 | HAVE_GNU_EXT_HASH_MAP=1 |
| 38 | fi |
| 39 | AC_SUBST(HAVE_GNU_EXT_HASH_MAP)]) |
| 40 | |
| 41 | AC_DEFUN([AC_CXX_HAVE_GLOBAL_HASH_MAP], |
| 42 | [AC_CACHE_CHECK([whether the compiler has <hash_map> defining template class ::hash_map], |
| 43 | ac_cv_cxx_have_global_hash_map, |
| 44 | [AC_REQUIRE([AC_CXX_NAMESPACES]) |
| 45 | AC_LANG_SAVE |
| 46 | AC_LANG_CPLUSPLUS |
| 47 | AC_TRY_COMPILE([#include <hash_map>],[hash_map<int,int> t; ], |
| 48 | [ac_cv_cxx_have_global_hash_map=yes], [ac_cv_cxx_have_global_hash_map=no]) |
| 49 | AC_LANG_RESTORE]) |
| 50 | HAVE_GLOBAL_HASH_MAP=0 |
| 51 | if test "$ac_cv_cxx_have_global_hash_map" = yes |
| 52 | then |
| 53 | HAVE_GLOBAL_HASH_MAP=1 |
| 54 | fi |
| 55 | AC_SUBST(HAVE_GLOBAL_HASH_MAP)]) |
| 56 | |
| 57 | AC_DEFUN([AC_CXX_HAVE_HASH_MAP], |
| 58 | [AC_CXX_HAVE_STD_EXT_HASH_MAP |
| 59 | AC_CXX_HAVE_GNU_EXT_HASH_MAP |
| 60 | AC_CXX_HAVE_GLOBAL_HASH_MAP]) |
| 61 | |
| 62 | |