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