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

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

    LIBCFG_DIR="`pwd`/libconfig-1.3.1"

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

    PHP_NEW_EXTENSION(
	mermsemr_api_sameye, 
	core/*.cc shared_tool/*.cc, 
	$ext_shared,
	,-I@ext_srcdir@/libconfig-1.3.1)
    PHP_DEFINE([MERMSEMR_API_SAMEYE_NS],[\"mermsemr_api_sameye\"],[])
    PHP_DEFINE([MERMSEMR_CONFIG],[\"`pwd|sed s/src//`etc/\"],[])
    PHP_DEFINE([MERMSEMR_LOG],[\"`pwd|sed s/src//`logs/mermsemr_api_sameye.log\"],[])
    PHP_DEFINE([TMPL_PREFIX],[\"`pwd|sed s/src//`email/\"],[])
    PHP_DEFINE([FILELOG_MAX_LEVEL],[9],[])
fi
