~drizzle-trunk/drizzle/development

481.1.9 by Monty Taylor
Added autoconf tests for location of cstdint and cinttypes. Use those in C++ programs now, so that we don't have to define _STDC_LIMIT_MACROS, etc by hand. Stop, in fact, defining those by hand.
1
# We check two things: where the include file is for hash_map, and
2
# what namespace hash_map lives in within that include file.  We
942.1.1 by Monty Taylor
Started transitioning from AC_TRY_COMPILE to AC_COMPILE_IFELSE
3
# include AC_COMPILE_IFELSE for all the combinations we've seen in the
481.1.9 by Monty Taylor
Added autoconf tests for location of cstdint and cinttypes. Use those in C++ programs now, so that we don't have to define _STDC_LIMIT_MACROS, etc by hand. Stop, in fact, defining those by hand.
4
# wild.  We define one of HAVE_HASH_MAP or HAVE_EXT_HASH_MAP depending
5
# on location, and HASH_NAMESPACE to be the namespace hash_map is
6
# defined in.
7
#
8
# Ideally we'd use AC_CACHE_CHECK, but that only lets us store one value
9
# at a time, and we need to store two (filename and namespace).
10
# prints messages itself, so we have to do the message-printing ourselves
11
# via AC_MSG_CHECKING + AC_MSG_RESULT.  (TODO(csilvers): can we cache?)
12
1192.3.28 by Monty Taylor
pandora-build v0.72 - Moved remaining hard-coded tests into pandora-build
13
AC_DEFUN([PANDORA_CXX_STL_HASH],
481.1.9 by Monty Taylor
Added autoconf tests for location of cstdint and cinttypes. Use those in C++ programs now, so that we don't have to define _STDC_LIMIT_MACROS, etc by hand. Stop, in fact, defining those by hand.
14
  [AC_MSG_CHECKING(the location of hash_map)
1241.9.10 by Monty Taylor
pandora-build v0.85 - Fixed the C++ standard setting in the build checks.
15
   save_CXXFLAGS="${CXXFLAGS}"
16
   CXXFLAGS="${AM_CXXFLAGS} ${CXXFLAGS}"
779.2.11 by Monty Taylor
General build cleanup - removed cruft, removed depreated checks.
17
   AC_LANG_PUSH(C++)
481.1.9 by Monty Taylor
Added autoconf tests for location of cstdint and cinttypes. Use those in C++ programs now, so that we don't have to define _STDC_LIMIT_MACROS, etc by hand. Stop, in fact, defining those by hand.
18
   ac_cv_cxx_hash_map=""
1126.15.1 by Monty Taylor
Updated stl_hash to not bother checking boost and to check for unordered_map.
19
   for location in "" "ext/" "tr1/" ; do
481.1.9 by Monty Taylor
Added autoconf tests for location of cstdint and cinttypes. Use those in C++ programs now, so that we don't have to define _STDC_LIMIT_MACROS, etc by hand. Stop, in fact, defining those by hand.
20
     for namespace in __gnu_cxx "" std stdext; do
1126.15.1 by Monty Taylor
Updated stl_hash to not bother checking boost and to check for unordered_map.
21
       for classprefix in unordered hash; do
22
         if test -z "$ac_cv_cxx_hash_map"; then
23
           AC_COMPILE_IFELSE(
24
             [AC_LANG_PROGRAM([[#include <${location}${classprefix}_map>]],
25
                           [[${namespace}::${classprefix}_map<int, int> t]])],
26
             [ac_cv_cxx_hash_map="<${location}${classprefix}_map>";
27
              ac_cv_cxx_hash_set="<${location}${classprefix}_set>";
28
              ac_cv_cxx_hash_namespace="$namespace";
29
              ac_cv_cxx_hash_map_class="${classprefix}_map";
30
              ac_cv_cxx_hash_set_class="${classprefix}_set"])
31
32
         fi
33
       done
481.1.9 by Monty Taylor
Added autoconf tests for location of cstdint and cinttypes. Use those in C++ programs now, so that we don't have to define _STDC_LIMIT_MACROS, etc by hand. Stop, in fact, defining those by hand.
34
     done
35
   done
1126.15.1 by Monty Taylor
Updated stl_hash to not bother checking boost and to check for unordered_map.
36
481.1.9 by Monty Taylor
Added autoconf tests for location of cstdint and cinttypes. Use those in C++ programs now, so that we don't have to define _STDC_LIMIT_MACROS, etc by hand. Stop, in fact, defining those by hand.
37
   if test -n "$ac_cv_cxx_hash_map"; then
38
      AC_DEFINE(HAVE_HASH_MAP, 1, [define if the compiler has hash_map])
39
      AC_DEFINE(HAVE_HASH_SET, 1, [define if the compiler has hash_set])
40
      AC_DEFINE_UNQUOTED(HASH_MAP_H,$ac_cv_cxx_hash_map,
41
                         [the location of <hash_map>])
42
      AC_DEFINE_UNQUOTED(HASH_SET_H,$ac_cv_cxx_hash_set,
43
                         [the location of <hash_set>])
44
      AC_DEFINE_UNQUOTED(HASH_NAMESPACE,$ac_cv_cxx_hash_namespace,
45
                         [the namespace of hash_map/hash_set])
1126.15.1 by Monty Taylor
Updated stl_hash to not bother checking boost and to check for unordered_map.
46
      AC_DEFINE_UNQUOTED(HASH_MAP_CLASS,$ac_cv_cxx_hash_map_class,
47
                         [the classname of hash_map])
48
      AC_DEFINE_UNQUOTED(HASH_SET_CLASS,$ac_cv_cxx_hash_set_class,
49
                         [the classname of hash_set])
481.1.9 by Monty Taylor
Added autoconf tests for location of cstdint and cinttypes. Use those in C++ programs now, so that we don't have to define _STDC_LIMIT_MACROS, etc by hand. Stop, in fact, defining those by hand.
50
      AC_MSG_RESULT([$ac_cv_cxx_hash_map])
51
   else
52
      AC_MSG_RESULT()
53
      AC_MSG_WARN([could not find an STL hash_map])
54
   fi
1126.15.1 by Monty Taylor
Updated stl_hash to not bother checking boost and to check for unordered_map.
55
   AC_CACHE_CHECK(
1223.3.3 by Monty Taylor
Account for older hash_maps
56
     [whether hash_map has rehash method],
57
     [ac_cv_hash_map_has_rehash],
58
     [AC_COMPILE_IFELSE(
59
       [AC_LANG_PROGRAM([[
60
#include HASH_MAP_H
61
using namespace HASH_NAMESPACE;
62
       ]],[[
63
HASH_MAP_CLASS<int, int> test_hash;
64
test_hash.rehash(100);
65
          ]])],
66
       [ac_cv_hash_map_has_rehash=yes],
67
       [ac_cv_hash_map_has_rehash=no])])
68
   AS_IF([test $ac_cv_hash_map_has_rehash = yes],[
69
      AC_DEFINE(HASH_MAP_HAS_REHASH, 1, [if hash_map<> hash rehash method])
70
   ])
71
   AC_CACHE_CHECK(
72
     [whether hash_map has resize method],
73
     [ac_cv_hash_map_has_resize],
74
     [AC_COMPILE_IFELSE(
75
       [AC_LANG_PROGRAM([[
76
#include HASH_MAP_H
77
using namespace HASH_NAMESPACE;
78
       ]],[[
79
HASH_MAP_CLASS<int, int> test_hash;
80
test_hash.resize(100);
81
          ]])],
82
       [ac_cv_hash_map_has_resize=yes],
83
       [ac_cv_hash_map_has_resize=no])])
84
   AS_IF([test $ac_cv_hash_map_has_resize = yes],[
85
      AC_DEFINE(HASH_MAP_HAS_RESIZE, 1, [if hash_map<> hash resize method])
86
   ])
87
   AC_CACHE_CHECK(
1126.15.1 by Monty Taylor
Updated stl_hash to not bother checking boost and to check for unordered_map.
88
     [whether to redefine hash<string>],
89
     [ac_cv_redefine_hash_string],
90
     [AC_COMPILE_IFELSE(
91
       [AC_LANG_PROGRAM([[
92
#include HASH_SET_H
93
#include <string>
94
using namespace HASH_NAMESPACE;
95
using namespace std;
96
          ]],[[
97
string teststr("test");
98
HASH_SET_CLASS<string> test_hash;
99
HASH_SET_CLASS<string>::iterator iter= test_hash.find(teststr);
100
if (iter != test_hash.end())
101
  return 1;
102
          ]])],
103
       [ac_cv_redefine_hash_string=no],
104
       [ac_cv_redefine_hash_string=yes])])
105
   AS_IF([test $ac_cv_redefine_hash_string = yes],[
106
      AC_DEFINE(REDEFINE_HASH_STRING, 1, [if hash<string> needs to be defined])
107
   ])
1241.11.1 by Monty Taylor
pandora-build v0.85 - Fixed C++ standard setting.
108
   CXXFLAGS="${save_CXXFLAGS}"
1126.15.1 by Monty Taylor
Updated stl_hash to not bother checking boost and to check for unordered_map.
109
   AC_LANG_POP()
481.1.9 by Monty Taylor
Added autoconf tests for location of cstdint and cinttypes. Use those in C++ programs now, so that we don't have to define _STDC_LIMIT_MACROS, etc by hand. Stop, in fact, defining those by hand.
110
])