Commit c3cdcdd9 authored by Tiago Peixoto's avatar Tiago Peixoto

Improve inclusion of sparsehash when directory prefix is nonstandard

parent 4323e370
......@@ -318,18 +318,23 @@ if test "$USING_CAIRO" = "yes"; then
fi
dnl sparsehash
[SPARSEHASH_PREFIX=sparsehash]
AC_ARG_WITH([sparsehash-prefix], [AS_HELP_STRING([--with-sparsehash-prefix=prefix],
[include directory prefix for sparsehash
[default=sparsehash] ])],
[SPARSEHASH_PREFIX=$withval])
if test "$USING_SPARSEHASH" = "yes"; then
PKG_CHECK_MODULES(SPARSEHASH, [libsparsehash], AC_DEFINE([HAVE_SPARSEHASH], [1],
[Using google's sparsehash]), [])
[SPARSEHASH_CFLAGS="${SPARSEHASH_CFLAGS} -DSPARSEHASH_PREFIX=${SPARSEHASH_PREFIX}"]
AC_SUBST(SPARSEHASH_CFLAGS)
[OLD_CXXFLAGS="${CXXFLAGS}"]
[OLD_CPPFLAGS="${CPPFLAGS}"]
AC_DEFINE_UNQUOTED([SPARSEHASH_INCLUDE(f)], [<${SPARSEHASH_PREFIX}/f>],
[Sparsehash include macro])
[CXXFLAGS="${CXXFLAGS} ${SPARSEHASH_CFLAGS}"]
[CPPFLAGS="${CPPFLAGS} ${SPARSEHASH_CFLAGS}"]
AC_CHECK_HEADER([sparsehash/dense_hash_set], [],
AC_CHECK_HEADER([${SPARSEHASH_PREFIX}/dense_hash_set], [],
[AC_MSG_ERROR([sparsehash headers not found])])
[CXXFLAGS="${OLD_CXXFLAGS}"]
[CPPFLAGS="${OLD_CPPFLAGS}"]
fi
dnl Checks for typedefs, structures, and compiler characteristics.
......
......@@ -24,7 +24,7 @@
#include <boost/mpl/if.hpp>
#ifdef HAVE_SPARSEHASH
#include <sparsehash/dense_hash_set>
#include SPARSEHASH_INCLUDE(dense_hash_set)
#endif
#ifndef __clang__
......
......@@ -28,8 +28,8 @@
#include <tuple>
#ifdef HAVE_SPARSEHASH
#include <sparsehash/dense_hash_set>
#include <sparsehash/dense_hash_map>
#include SPARSEHASH_INCLUDE(dense_hash_set)
#include SPARSEHASH_INCLUDE(dense_hash_map)
#endif
#include "../generation/sampler.hh"
......
......@@ -21,7 +21,7 @@
#include <unordered_map>
#ifdef HAVE_SPARSEHASH
#include <sparsehash/dense_hash_map>
#include SPARSEHASH_INCLUDE(dense_hash_map)
#endif
#include <iostream>
......
......@@ -33,7 +33,7 @@
#include "random.hh"
#ifdef HAVE_SPARSEHASH
#include <sparsehash/dense_hash_map>
#include SPARSEHASH_INCLUDE(dense_hash_map)
#endif
namespace graph_tool
......
......@@ -19,7 +19,7 @@
#include <unordered_map>
#ifdef HAVE_SPARSEHASH
#include <sparsehash/dense_hash_map>
#include SPARSEHASH_INCLUDE(dense_hash_map)
#endif
#include "graph_util.hh"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment