~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
13
AC_DEFUN([AC_CXX_STL_HASH],
14
  [AC_MSG_CHECKING(the location of hash_map)
779.2.11 by Monty Taylor
General build cleanup - removed cruft, removed depreated checks.
15
   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.
16
   ac_cv_cxx_hash_map=""
17
   for location in ext/hash_map boost/hash_map hash_map; do
18
     for namespace in __gnu_cxx "" std stdext; do
19
       if test -z "$ac_cv_cxx_hash_map"; then
942.1.1 by Monty Taylor
Started transitioning from AC_TRY_COMPILE to AC_COMPILE_IFELSE
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";])
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.
26
       fi
27
     done
28
   done
779.2.11 by Monty Taylor
General build cleanup - removed cruft, removed depreated checks.
29
   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.
30
   ac_cv_cxx_hash_set=`echo "$ac_cv_cxx_hash_map" | sed s/map/set/`;
31
   if test -n "$ac_cv_cxx_hash_map"; then
32
      AC_DEFINE(HAVE_HASH_MAP, 1, [define if the compiler has hash_map])
33
      AC_DEFINE(HAVE_HASH_SET, 1, [define if the compiler has hash_set])
34
      AC_DEFINE_UNQUOTED(HASH_MAP_H,$ac_cv_cxx_hash_map,
35
                         [the location of <hash_map>])
36
      AC_DEFINE_UNQUOTED(HASH_SET_H,$ac_cv_cxx_hash_set,
37
                         [the location of <hash_set>])
38
      AC_DEFINE_UNQUOTED(HASH_NAMESPACE,$ac_cv_cxx_hash_namespace,
39
                         [the namespace of hash_map/hash_set])
40
      AC_MSG_RESULT([$ac_cv_cxx_hash_map])
41
   else
42
      AC_MSG_RESULT()
43
      AC_MSG_WARN([could not find an STL hash_map])
44
   fi
45
])