~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to m4/stl_hash.m4

  • Committer: Monty Taylor
  • Date: 2009-09-14 16:38:57 UTC
  • mto: (1193.1.1 use-hash-map)
  • mto: This revision was merged to the branch mainline in revision 1203.
  • Revision ID: mordred@inaugust.com-20090914163857-55ytb0w3ra9vi32l
Updated stl_hash to not bother checking boost and to check for unordered_map.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
  [AC_MSG_CHECKING(the location of hash_map)
15
15
   AC_LANG_PUSH(C++)
16
16
   ac_cv_cxx_hash_map=""
17
 
   for location in ext/hash_map boost/hash_map hash_map; do
 
17
   for location in "" "ext/" "tr1/" ; do
18
18
     for namespace in __gnu_cxx "" std stdext; do
19
 
       if test -z "$ac_cv_cxx_hash_map"; then
20
 
         AC_COMPILE_IFELSE(
21
 
           [AC_LANG_PROGRAM(
22
 
             [[#include <$location>]],
23
 
             [[${namespace}::hash_map<int, int> t]])],
24
 
           [ac_cv_cxx_hash_map="<$location>";
25
 
           ac_cv_cxx_hash_namespace="$namespace";])
26
 
       fi
 
19
       for classprefix in unordered hash; do
 
20
         if test -z "$ac_cv_cxx_hash_map"; then
 
21
           AC_COMPILE_IFELSE(
 
22
             [AC_LANG_PROGRAM([[#include <${location}${classprefix}_map>]],
 
23
                           [[${namespace}::${classprefix}_map<int, int> t]])],
 
24
             [ac_cv_cxx_hash_map="<${location}${classprefix}_map>";
 
25
              ac_cv_cxx_hash_set="<${location}${classprefix}_set>";
 
26
              ac_cv_cxx_hash_namespace="$namespace";
 
27
              ac_cv_cxx_hash_map_class="${classprefix}_map";
 
28
              ac_cv_cxx_hash_set_class="${classprefix}_set"])
 
29
 
 
30
         fi
 
31
       done
27
32
     done
28
33
   done
29
 
   AC_LANG_POP()
30
 
   ac_cv_cxx_hash_set=`echo "$ac_cv_cxx_hash_map" | sed s/map/set/`;
 
34
 
31
35
   if test -n "$ac_cv_cxx_hash_map"; then
32
36
      AC_DEFINE(HAVE_HASH_MAP, 1, [define if the compiler has hash_map])
33
37
      AC_DEFINE(HAVE_HASH_SET, 1, [define if the compiler has hash_set])
37
41
                         [the location of <hash_set>])
38
42
      AC_DEFINE_UNQUOTED(HASH_NAMESPACE,$ac_cv_cxx_hash_namespace,
39
43
                         [the namespace of hash_map/hash_set])
 
44
      AC_DEFINE_UNQUOTED(HASH_MAP_CLASS,$ac_cv_cxx_hash_map_class,
 
45
                         [the classname of hash_map])
 
46
      AC_DEFINE_UNQUOTED(HASH_SET_CLASS,$ac_cv_cxx_hash_set_class,
 
47
                         [the classname of hash_set])
40
48
      AC_MSG_RESULT([$ac_cv_cxx_hash_map])
41
49
   else
42
50
      AC_MSG_RESULT()
43
51
      AC_MSG_WARN([could not find an STL hash_map])
44
52
   fi
 
53
   AC_CACHE_CHECK(
 
54
     [whether to redefine hash<string>],
 
55
     [ac_cv_redefine_hash_string],
 
56
     [AC_COMPILE_IFELSE(
 
57
       [AC_LANG_PROGRAM([[
 
58
#include HASH_SET_H
 
59
#include <string>
 
60
using namespace HASH_NAMESPACE;
 
61
using namespace std;
 
62
          ]],[[
 
63
string teststr("test");
 
64
HASH_SET_CLASS<string> test_hash;
 
65
HASH_SET_CLASS<string>::iterator iter= test_hash.find(teststr);
 
66
if (iter != test_hash.end())
 
67
  return 1;
 
68
          ]])],
 
69
       [ac_cv_redefine_hash_string=no],
 
70
       [ac_cv_redefine_hash_string=yes])])
 
71
   AS_IF([test $ac_cv_redefine_hash_string = yes],[
 
72
      AC_DEFINE(REDEFINE_HASH_STRING, 1, [if hash<string> needs to be defined])
 
73
   ])
 
74
   AC_LANG_POP()
45
75
])