Commit 60ad713a authored by Francis Dupont's avatar Francis Dupont

[master] Merged trac5488 / PR71 (pkg-config for --with-cql)

parents 505ce96e 0784ba1e
......@@ -783,27 +783,41 @@ fi
# ... and at the shell level, so Makefile.am can take action depending on this.
AM_CONDITIONAL(HAVE_PGSQL, test "$PG_CONFIG" != "")
# allow building kea programs with static link to cassandra cpp-driver.
AC_ARG_ENABLE([cql-static-link],
AS_HELP_STRING([--enable-cql-static-link],
[build programs with cassandra cpp driver static link [[default=no]]]),
[enable_cql_static_link=yes], [enable_cql_static_link=no])
AM_CONDITIONAL(USE_CQL_STATIC_LIB, test "$enable_cql_static_lib" = yes)
#AC_DEFINE USE_CQL_STATIC_LIB? (unused)
cql_lib="cassandra"
if test "${enable_cql_static_lib}" = "yes" ; then
cql_lib="${cql_lib}_static"
fi
cql_config="no"
AC_ARG_WITH([cql],
AC_HELP_STRING([--with-cql=PATH],
[path to the Cassandra CQL 'cql_config' script]),
[path to pkg-config or the Cassandra CQL 'cql_config' script]),
[cql_config="$withval"])
if test "${cql_config}" = "yes" ; then
CQL_CONFIG="/usr/bin/cql_config"
AC_PATH_PROG([PKG_CONFIG], [pkg-config])
CQL_CONFIG="$PKG_CONFIG"
elif test "${cql_config}" != "no" ; then
CQL_CONFIG="${cql_config}"
fi
if test "$CQL_CONFIG" != "" ; then
if test -d "$CQL_CONFIG" -o ! -x "$CQL_CONFIG" ; then
AC_MSG_ERROR([--with-cql should point to a cql_config program])
AC_MSG_ERROR([--with-cql should point to a pkg-config or cql_config program])
fi
CQL_INCLUDEDIR=`$CQL_CONFIG --includedir`
CQL_CPPFLAGS="`$CQL_CONFIG --cppflags` -I$CQL_INCLUDEDIR"
CQL_LIBS="-L`$CQL_CONFIG --libdir` -lcassandra -luv"
CQL_VERSION=`$CQL_CONFIG --version`
CQL_INCLUDEDIR=`$CQL_CONFIG --cflags-only-I $cql_lib`
CQL_CPPFLAGS="`$CQL_CONFIG --cflags-only-other $cql_lib` $CQL_INCLUDEDIR"
CQL_LIBS="`$CQL_CONFIG --libs $cql_lib`"
CQL_VERSION=`$CQL_CONFIG --modversion $cql_lib`
AC_SUBST(CQL_CPPFLAGS)
AC_SUBST(CQL_LIBS)
......
......@@ -588,6 +588,19 @@ Debian and Ubuntu:
Install Cassandra according to the instructions for your system. The
Cassandra project website contains useful pointers: <uri xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://cassandra.apache.org">http://cassandra.apache.org</uri>.
</para>
<para>
If you have a cpp-driver package available as binary or as source
simply install or build and install the package. Then build
and install Kea as described in <xref linkend="installation"/>:
To enable the Cassandra (CQL) database code, at the "configure"
step (see <xref linkend="configure"/>), do:
<screen><userinput>./configure [other-options] --with-cql=<replaceable>path-to-pkg-config</replaceable></userinput></screen>
Note if <command>pkg-config</command> is at its standard location
(and thus in the shell path) you do not need to supply its path.
If it does not work (e.g. no pkg-config, package not available in
pkg-config with the cassandra name), you can still use
the <command>cql_config</command> script in tools/ as describe below.
</para>
<para>
Download and compile cpp-driver from DataStax. For details regarding
dependencies for building cpp-driver, see the project homepage
......
#!/bin/bash
cql_lib="cassandra"
if test `uname -s` = "Darwin"; then
DIR=$(stat -f %N $0 | xargs dirname)
else
......@@ -13,40 +15,58 @@ then
fi
source ${DIR}/cql_config_defines.sh
if [ $# -ne 1 ]
if [ $# -ne 1 ] && [ $# -ne 2 ]
then
echo "run: \`$0 --help\` for more help"
exit 0
fi
if [ $1 == "--help" ]
then
echo "cql_config 'option' ['library']"
echo "options:"
echo "--help"
echo " print this help message"
echo "--cppflags"
echo "--cflags-only-other"
echo " get cpp compilation flags"
echo "--includedir"
echo "--cflags-only-I"
echo " get include path"
echo "--libdir"
echo "--libs"
echo " get lib path"
echo "--version"
echo "--modversion"
echo " get version"
echo "libraries:"
echo " cassandra"
echo " cassandra_static"
exit 0
else if [ $# -ne 2 ]
then
echo "run: \`$0 --help\` for more help"
exit 0
else if [ $2 != "cassandra" ] && [ $2 != "cassandra_static" ]
then
echo "library $2 not supported"
echo "run: \`$0 --help\` for more help"
exit 0
else
cql_lib=$2
fi
fi
fi
if [ $1 == "--cppflags" ]
if [ $1 == "--cflags-only-other" ]
then
exit 0
fi
if [ $1 == "--includedir" ]
if [ $1 == "--cflags-only-I" ]
then
echo "${CPP_DRIVER_PATH}/include/"
echo "-I${CPP_DRIVER_PATH}/include/"
exit 0
fi
if [ $1 == "--libdir" ]
if [ $1 == "--libs" ]
then
echo "${CPP_DRIVER_PATH}/build/"
echo "-L${CPP_DRIVER_PATH}/build/ -l${cql_lib} -luv"
exit 0
fi
if [ $1 == "--version" ]
if [ $1 == "--modversion" ]
then
MAJOR=`grep VERSION_MAJOR ${CPP_DRIVER_PATH}/include/cassandra.h | cut -d " " -f 3`
MINOR=`grep VERSION_MINOR ${CPP_DRIVER_PATH}/include/cassandra.h | cut -d " " -f 3`
......
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