forked from sparsehash/sparsehash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
73 lines (61 loc) · 2.75 KB
/
configure.ac
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
## Process this file with autoconf to produce configure.
## In general, the safest way to proceed is to run ./autogen.sh
# make sure we're interpreted by some minimal autoconf
AC_PREREQ(2.57)
AC_INIT(sparsehash, 2.0.2, [email protected])
# The argument here is just something that should be in the current directory
# (for sanity checking)
AC_CONFIG_SRCDIR(README)
AM_INIT_AUTOMAKE([dist-zip])
AM_CONFIG_HEADER(src/config.h)
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_CPP
AM_CONDITIONAL(GCC, test "$GCC" = yes) # let the Makefile know if we're gcc
# Check whether some low-level functions/files are available
AC_HEADER_STDC
AC_CHECK_FUNCS(memcpy memmove)
AC_CHECK_TYPES([uint16_t]) # defined in C99 systems
AC_CHECK_TYPES([u_int16_t]) # defined in BSD-derived systems, and gnu
AC_CHECK_TYPES([__uint16]) # defined in some windows systems (vc7)
AC_CHECK_TYPES([long long]) # probably defined everywhere, but...
# These are 'only' needed for unittests
AC_CHECK_HEADERS(sys/resource.h unistd.h sys/time.h sys/utsname.h)
# If you have google-perftools installed, we can do a bit more testing.
# We not only want to set HAVE_MALLOC_EXTENSION_H, we also want to set
# a variable to let the Makefile to know to link in tcmalloc.
AC_LANG([C++])
AC_CHECK_HEADERS(google/malloc_extension.h,
tcmalloc_libs=-ltcmalloc,
tcmalloc_libs=)
# On some systems, when linking in tcmalloc you also need to link in
# pthread. That's a bug somewhere, but we'll work around it for now.
tcmalloc_flags=""
if test -n "$tcmalloc_libs"; then
ACX_PTHREAD
tcmalloc_flags="\$(PTHREAD_CFLAGS)"
tcmalloc_libs="$tcmalloc_libs \$(PTHREAD_LIBS)"
fi
AC_SUBST(tcmalloc_flags)
AC_SUBST(tcmalloc_libs)
# Figure out where hash_map lives and also hash_fun.h (or stl_hash_fun.h).
# This also tells us what namespace hash code lives in.
AC_CXX_STL_HASH
AC_CXX_STL_HASH_FUN
# Find out what namespace the user wants our classes to be defined in.
# TODO(csilvers): change this to default to sparsehash instead.
AC_DEFINE_GOOGLE_NAMESPACE(google)
# In unix-based systems, hash is always defined as hash<> (in namespace.
# HASH_NAMESPACE.) So we can use a simple AC_DEFINE here. On
# windows, and possibly on future unix STL implementations, this
# macro will evaluate to something different.)
AC_DEFINE(SPARSEHASH_HASH_NO_NAMESPACE, hash,
[The system-provided hash function, in namespace HASH_NAMESPACE.])
# Do *not* define this in terms of SPARSEHASH_HASH_NO_NAMESPACE, because
# SPARSEHASH_HASH is exported to sparseconfig.h, but S_H_NO_NAMESPACE isn't.
AC_DEFINE(SPARSEHASH_HASH, HASH_NAMESPACE::hash,
[The system-provided hash function including the namespace.])
# Write generated configuration file
AC_CONFIG_FILES([Makefile])
AC_OUTPUT