# ... 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)
#!/bin/bash
+cql_lib="cassandra"
+
if test `uname -s` = "Darwin"; then
DIR=$(stat -f %N $0 | xargs dirname)
else
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`