File: stl_hash_fun.m4

package info (click to toggle)
sparsehash 2.0.3-2
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 1,756 kB
  • sloc: cpp: 6,600; sh: 3,960; ansic: 1,317; makefile: 240
file content (36 lines) | stat: -rw-r--r-- 1,491 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# We just try to figure out where hash<> is defined.  It's in some file
# that ends in hash_fun.h...
#
# Ideally we'd use AC_CACHE_CHECK, but that only lets us store one value
# at a time, and we need to store two (filename and namespace).
# prints messages itself, so we have to do the message-printing ourselves
# via AC_MSG_CHECKING + AC_MSG_RESULT.  (TODO(csilvers): can we cache?)
#
# tr1/functional_hash.h: new gcc's with tr1 support
# stl_hash_fun.h: old gcc's (gc2.95?)
# ext/hash_fun.h: newer gcc's (gcc4)
# stl/_hash_fun.h: STLport

AC_DEFUN([AC_CXX_STL_HASH_FUN],
  [AC_REQUIRE([AC_CXX_STL_HASH])
   AC_MSG_CHECKING(how to include hash_fun directly)
   AC_LANG_SAVE
   AC_LANG_CPLUSPLUS
   ac_cv_cxx_stl_hash_fun=""
   for location in functional tr1/functional \
                   ext/hash_fun.h ext/stl_hash_fun.h \
                   hash_fun.h stl_hash_fun.h \
                   stl/_hash_fun.h; do
     if test -z "$ac_cv_cxx_stl_hash_fun"; then
       AC_TRY_COMPILE([#include <$location>],
                      [int x = ${ac_cv_cxx_hash_namespace}::hash<int>()(5)],
                      [ac_cv_cxx_stl_hash_fun="<$location>";])
     fi
   done
   AC_LANG_RESTORE
   AC_DEFINE_UNQUOTED(HASH_FUN_H,$ac_cv_cxx_stl_hash_fun,
                      [the location of the header defining hash functions])
   AC_DEFINE_UNQUOTED(HASH_NAMESPACE,$ac_cv_cxx_hash_namespace,
                      [the namespace of the hash<> function])
   AC_MSG_RESULT([$ac_cv_cxx_stl_hash_fun])
])