blob: 71c74b11e1b8d47014c6c1dd3d1266407a65b0a6 [file] [log] [blame]
Reid Spencer491f6812004-09-07 06:56:14 +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])
Reid Spencer12de17d2004-09-19 22:31:49 +00007 AC_LANG_PUSH([C++])
8 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <ext/hash_map>
Reid Spencer491f6812004-09-07 06:56:14 +00009#ifdef HAVE_NAMESPACES
10using namespace std;
Reid Spencer12de17d2004-09-19 22:31:49 +000011#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++])])
Reid Spencer491f6812004-09-07 06:56:14 +000013 if test "$ac_cv_cxx_have_std_ext_hash_map" = yes
14 then
John Criswell9f011862004-09-24 18:28:00 +000015 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>])
Reid Spencer491f6812004-09-07 06:56:14 +000018 fi
John Criswell9f011862004-09-24 18:28:00 +000019 ])
Reid Spencer491f6812004-09-07 06:56:14 +000020
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])
Reid Spencer12de17d2004-09-19 22:31:49 +000025 AC_LANG_PUSH([C++])
26 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <ext/hash_map>
Reid Spencer491f6812004-09-07 06:56:14 +000027#ifdef HAVE_NAMESPACES
28using namespace __gnu_cxx;
Reid Spencer12de17d2004-09-19 22:31:49 +000029#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++])])
Reid Spencer491f6812004-09-07 06:56:14 +000031 if test "$ac_cv_cxx_have_gnu_ext_hash_map" = yes
32 then
John Criswell9f011862004-09-24 18:28:00 +000033 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])
Reid Spencer491f6812004-09-07 06:56:14 +000036 fi
John Criswell9f011862004-09-24 18:28:00 +000037 ])
Reid Spencer491f6812004-09-07 06:56:14 +000038
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])
Reid Spencer12de17d2004-09-19 22:31:49 +000043 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++])])
Reid Spencer491f6812004-09-07 06:56:14 +000046 if test "$ac_cv_cxx_have_global_hash_map" = yes
47 then
John Criswell9f011862004-09-24 18:28:00 +000048 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>])
Reid Spencer491f6812004-09-07 06:56:14 +000051 fi
John Criswell9f011862004-09-24 18:28:00 +000052 ])
Reid Spencer491f6812004-09-07 06:56:14 +000053
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