PHP_ARG_ENABLE(jubabox_api,
    [Whether to enable the "jubabox_api" extension],
    [  --enable-jubabox_api      Enable "jubabox_api" extension support])

if test $PHP_JUBABOX_API != "no"; then
    PHP_REQUIRE_CXX()
    PHP_SUBST(JUBABOX_API_SHARED_LIBADD)
    PHP_ADD_LIBRARY(stdc++, 1, JUBABOX_API_SHARED_LIBADD)
    PHP_ADD_INCLUDE(/usr/include/pgsql)
    PHP_ADD_LIBRARY_WITH_PATH(pq, /usr/lib64,  JUBABOX_API_SHARED_LIBADD)
    PHP_ADD_LIBRARY(curl, 1, JUBABOX_API_SHARED_LIBADD)
    PHP_ADD_LIBRARY(config++, 1, JUBABOX_API_SHARED_LIBADD)
    PHP_ADD_LIBRARY(json-c, 1, JUBABOX_API_SHARED_LIBADD)
    PHP_ADD_LIBRARY(ssl, 1, JUBABOX_API_SHARED_LIBADD)
    PHP_ADD_LIBRARY(z, 1, JUBABOX_API_SHARED_LIBADD)
    PHP_ADD_LIBRARY(pcrecpp, 1, JUBABOX_API_SHARED_LIBADD)
    PHP_ADD_LIBRARY(gcc_s, 1, JUBABOX_API_SHARED_LIBADD)

    LIBCFG_DIR="`pwd`/libconfig-1.3.1"

    PHP_ADD_LIBRARY_WITH_PATH(config++, "$LIBCFG_DIR/.libs/")

    PHP_NEW_EXTENSION(
	jubabox_api, 
	core/*.cc shared_tool/*.cc, 
	$ext_shared,
	,-I@ext_srcdir@/libconfig-1.3.1)
    PHP_DEFINE([JUBABOX_API_NS],[\"jubabox_api_`id -u -n`\"],[])
    PHP_DEFINE([JUBABOX_CONFIG],[\"`pwd|sed s/src//`etc/\"],[])
    PHP_DEFINE([JUBABOX_LOG],[\"`pwd|sed s/src//`logs/jubabox_api.log\"],[])
    PHP_DEFINE([TMPL_PREFIX],[\"`pwd|sed s/src//`email/\"],[])
    PHP_DEFINE([FILELOG_MAX_LEVEL],[9],[])
fi
