blob: 71c74b11e1b8d47014c6c1dd3d1266407a65b0a6 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001# Check for hash_map extension. This is from
2# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_map.html
3AC_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_PUSH([C++])
8 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <ext/hash_map>
9#ifdef HAVE_NAMESPACES
10using namespace std;
11#endif]], [[hash_map<int, int> t;]])],[ac_cv_cxx_have_std_ext_hash_map=yes],[ac_cv_cxx_have_std_ext_hash_map=no])
12 AC_LANG_POP([C++])])
13 if test "$ac_cv_cxx_have_std_ext_hash_map" = yes
14 then
15 AC_DEFINE(HAVE_STD_EXT_HASH_MAP,1,[Have ext/hash_map>])
16 else
17 AC_DEFINE(HAVE_STD_EXT_HASH_MAP,0,[Does not have ext/hash_map>])
18 fi
19 ])
20
21AC_DEFUN([AC_CXX_HAVE_GNU_EXT_HASH_MAP],
22[AC_CACHE_CHECK([whether the compiler has <ext/hash_map> defining template class __gnu_cxx::hash_map],
23 ac_cv_cxx_have_gnu_ext_hash_map,
24 [AC_REQUIRE([AC_CXX_NAMESPACES])
25 AC_LANG_PUSH([C++])
26 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <ext/hash_map>
27#ifdef HAVE_NAMESPACES
28using namespace __gnu_cxx;
29#endif]], [[hash_map<int,int> t; ]])],[ac_cv_cxx_have_gnu_ext_hash_map=yes],[ac_cv_cxx_have_gnu_ext_hash_map=no])
30 AC_LANG_POP([C++])])
31 if test "$ac_cv_cxx_have_gnu_ext_hash_map" = yes
32 then
33 AC_DEFINE(HAVE_GNU_EXT_HASH_MAP,1,[Have ext/hash_map])
34 else
35 AC_DEFINE(HAVE_GNU_EXT_HASH_MAP,0,[Does not have ext/hash_map])
36 fi
37 ])
38
39AC_DEFUN([AC_CXX_HAVE_GLOBAL_HASH_MAP],
40[AC_CACHE_CHECK([whether the compiler has <hash_map> defining template class ::hash_map],
41 ac_cv_cxx_have_global_hash_map,
42 [AC_REQUIRE([AC_CXX_NAMESPACES])
43 AC_LANG_PUSH([C++])
44 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <hash_map>]], [[hash_map<int,int> t; ]])],[ac_cv_cxx_have_global_hash_map=yes],[ac_cv_cxx_have_global_hash_map=no])
45 AC_LANG_POP([C++])])
46 if test "$ac_cv_cxx_have_global_hash_map" = yes
47 then
48 AC_DEFINE(HAVE_GLOBAL_HASH_MAP,1,[Have <hash_map>])
49 else
50 AC_DEFINE(HAVE_GLOBAL_HASH_MAP,0,[Does not have <hash_map>])
51 fi
52 ])
53
54AC_DEFUN([AC_CXX_HAVE_HASH_MAP],
55[AC_CXX_HAVE_STD_EXT_HASH_MAP
56 AC_CXX_HAVE_GNU_EXT_HASH_MAP
57 AC_CXX_HAVE_GLOBAL_HASH_MAP])
58
59