Initial support for the CMake build system.
[oota-llvm.git] / cmake / modules / CheckCxxHashmap.cmake
1 # - Check if for hash_map.
2 # CHECK_HASHMAP ()
3 #
4
5 include(CheckCXXSourceCompiles)
6
7 macro(CHECK_HASHMAP)
8   message(STATUS "Checking for C++ hash_map implementation...")
9   check_cxx_source_compiles("
10                 #include <ext/hash_map>
11                 int main() {
12                         __gnu_cxx::hash_map<int, int> t;
13                 }
14 "
15     HAVE_GNU_EXT_HASH_MAP
16     )
17   if(HAVE_GNU_EXT_HASH_MAP)
18     message(STATUS "C++ hash_map found in 'ext' dir in namespace __gnu_cxx::")
19   endif(HAVE_GNU_EXT_HASH_MAP)
20
21   check_cxx_source_compiles("
22                 #include <ext/hash_map>
23                 int main() {
24                         std::hash_map<int, int> t;
25                 }
26 "
27     HAVE_STD_EXT_HASH_MAP
28     )
29   if(HAVE_STD_EXT_HASH_MAP)
30     message(STATUS "C++ hash_map found in 'ext' dir in namespace std::")
31   endif(HAVE_STD_EXT_HASH_MAP)
32
33   check_cxx_source_compiles("
34                 #include <hash_map>
35                 int main() {
36                         hash_map<int, int> t;
37                 }
38 "
39     HAVE_GLOBAL_HASH_MAP
40     )
41   if(HAVE_GLOBAL_HASH_MAP)
42     message(STATUS "C++ hash_map found in global namespace")
43   endif(HAVE_GLOBAL_HASH_MAP)
44
45   if(NOT HAVE_GNU_EXT_HASH_MAP)
46     if(NOT HAVE_STD_EXT_HASH_MAP)
47       if(NOT HAVE_GLOBAL_HASH_MAP)
48         message(STATUS "C++ hash_map not found")
49       endif(NOT HAVE_GLOBAL_HASH_MAP)
50     endif(NOT HAVE_STD_EXT_HASH_MAP)
51   endif(NOT HAVE_GNU_EXT_HASH_MAP)
52
53 endmacro(CHECK_HASHMAP)