Implemented retention time for DCO instances. Fixes #NX-757
[public/netxms.git] / configure.ac
index eb28fea..81117f2 100644 (file)
@@ -4,7 +4,9 @@
 # Configure script
 #
 
-AC_INIT([NetXMS], [2.1-M1], [bugs@netxms.org])
+m4_ifdef([m4_esyscmd_s],
+       [AC_INIT([NetXMS], [m4_esyscmd_s([git describe --tags --always])], [bugs@netxms.org])],
+       [AC_INIT([NetXMS], [3.0-M0], [bugs@netxms.org])])
 AC_CONFIG_AUX_DIR(config)
 AC_CONFIG_HEADERS(config.h)
 AM_INIT_AUTOMAKE
@@ -48,6 +50,7 @@ COMPONENTS=""
 DISABLE_ICONV="no"
 DISABLE_ENCRYPTION="no"
 DISABLE_LMSENSORS="no"
+DISABLE_SSH="no"
 ENABLE_DEBUG="no"
 ENABLE_WERROR="no"
 STATIC_BUILD="no"
@@ -59,12 +62,13 @@ BUILD_AGENT="no"
 BUILD_CLIENT="no"
 BUILD_STATIC_AGENT="no"
 BUILD_SDK="no"
-NEED_ZLIB="no"
 MODULES="libnetxms tools install"
 STATIC_SUBAGENT_LIST=""
 PROPOSED_STATIC_SUBAGENTS="default"
 SUBAGENT_DIRS=""
 SUBAGENT_LIBS=""
+AGENT_LIBS=""
+AGENT_DIRS=""
 SERVER_LIBS=""
 SERVER_TOOLS=""
 SERVER_INCLUDE=""
@@ -74,8 +78,9 @@ PDSDRV_DIRS=""
 TOP_LEVEL_MODULES=""
 CONTRIB_MODULES=""
 CLIENT_COMPONENTS=""
-BUILD_UNICODE="no"
+BUILD_UNICODE="yes"
 FORCE_INTERNAL_EXPAT="no"
+FORCE_INTERNAL_LIBTRE="yes"
 USE_INTERNAL_LIBTRE="no"
 FORCE_INTERNAL_LIBTRE="no"
 FORCE_INTERNAL_JANSSON="no"
@@ -92,19 +97,36 @@ RUNTIME_PREFIX=""
 RUNTIME_STATE_DIR=""
 HPUX_HPPA="no"
 XMPP_SUPPORT="yes"
-ZEROMQ_SUPPORT="yes"
+ZEROMQ_SUPPORT="no"
 ZEROMQ_REQUIRED="no"
 ZEROMQ_CPPFLAGS=""
 ZEROMQ_LDFLAGS=""
+MQTT_SUPPORT="no"
+DISABLE_MQTT="no"
+MQTT_CPPFLAGS=""
+MQTT_LDFLAGS=""
+MQTT_LIBS=""
+DISABLE_CURL="no"
 LDAP_SUPPORT="yes"
-DISABLE_READLINE="no"
+DISABLE_READLINE="yes"
 TUXEDO_LIBS=""
+TUXEDO_TPINIT=""
 MONGODB_LIBS=""
+VMGR_CPPFLAGS=""
+VMGR_LDFLAGS=""
+VMGR_LIBS=""
+LIBVIRT_BASE=""
+XEN_CPPFLAGS=""
+XEN_LDFLAGS=""
+XEN_LIBS=""
 DISABLE_IPV6="no"
 IPV6_SUPPORT="no"
 INSTALL_LIBPATH=""
+WITH_ENCRYPTION="no"
+DISABLE_COMMONCRYPTO="no"
 OPENSSL_LIBSSL="ssl"
 OPENSSL_LIBCRYPTO="crypto"
+SYSTEMD_SUPPORT="yes"
 
 
 #--------------------------------------------------------------------
@@ -131,6 +153,12 @@ AC_ARG_WITH(runtime-state-dir,
    RUNTIME_STATE_DIR="$withval"
 ])
 
+AC_ARG_WITH(clang,
+[AS_HELP_STRING(--with-clang,use clang C++ compiler on Linux if available)],
+[
+       ALLOW_CLANG="yes"
+])
+
 AC_ARG_WITH(server,
 [AS_HELP_STRING(--with-server,build server)],
 [
@@ -209,6 +237,17 @@ AC_ARG_WITH(profiler,
        LDFLAGS="$LDFLAGS -lprofiler"
 ])
 
+AC_ARG_WITH(private-extensions,
+[AS_HELP_STRING(--with-private-extensions,enable private extensions)],
+[
+       if test "x$withval" != "xno" ; then
+               WITH_PRIVATE_EXTENSIONS="yes"
+               if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
+                       CUSTOM_INCLUDE="$withval"
+               fi
+       fi
+])
+
 AC_ARG_WITH(internal-libexpat,
 [AS_HELP_STRING(--with-internal-libexpat,force use of bundled libexpat)],
 [
@@ -264,6 +303,13 @@ AC_ARG_WITH(jdk,
                LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"   
                LDFLAGS="$LDFLAGS -L${withval}/lib"
                CPPFLAGS="$CPPFLAGS -I${withval}/include"
+               if test -d "${withval}/include/linux"; then
+                       CPPFLAGS="$CPPFLAGS -I${withval}/include/linux"
+               fi
+               if test -d "${withval}/include/solaris"; then
+                       CPPFLAGS="$CPPFLAGS -I${withval}/include/solaris"
+               fi
+               AC_DEFINE_UNQUOTED([JDK_LOCATION],["$withval"],[JDK location])
        fi
        COMPONENTS="$COMPONENTS java"
 fi ])
@@ -278,7 +324,7 @@ AC_ARG_WITH(tuxedo,
 fi ])
 
 AC_ARG_WITH(zeromq,
-[AS_HELP_STRING(--with-zeromq,build  with ZeroMQ)],
+[AS_HELP_STRING(--with-zeromq,build with ZeroMQ)],
 [ if test "x$withval" != "xno" ; then
        if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
                ZEROMQ_BASE="$withval"
@@ -290,6 +336,30 @@ else
        ZEROMQ_SUPPORT=no
 fi ])
 
+AC_ARG_WITH(mosquitto,
+[AS_HELP_STRING(--with-mosquitto,specify mosquitto library location)],
+[ if test "x$withval" != "xno" ; then
+       if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
+               MOSQUITTO_BASE="$withval"
+       fi
+fi ])
+
+AC_ARG_ENABLE(mqtt,
+[AS_HELP_STRING(--disable-mqtt,disable MQTT support)],
+[
+       if test "x$enableval" = "xno"; then
+               DISABLE_MQTT="yes"
+       fi
+])
+
+AC_ARG_WITH(curl,
+[AS_HELP_STRING(--without-curl,build without curl)],
+[
+       if test "x$withval" = "xno"; then
+               DISABLE_CURL="yes"
+       fi
+])
+
 AC_ARG_WITH(mongodb,
 [AS_HELP_STRING(--with-mongodb,build MongoDB-dependent components)],
 [ if test "x$withval" != "xno" ; then
@@ -299,6 +369,26 @@ AC_ARG_WITH(mongodb,
        COMPONENTS="$COMPONENTS mongodb"
 fi ])
 
+AC_ARG_WITH(vmgr,
+[AS_HELP_STRING(--with-vmgr,build VirtualHost management subagent)],
+[ if test "x$withval" != "xno" ; then
+       COMPONENTS="$COMPONENTS vmgr"
+fi ])
+
+AC_ARG_WITH(libvirt,
+[AS_HELP_STRING(--with-libvirt,provide libvirt location)],
+[ if test "x$withval" != "xno" ; then
+       if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
+               LIBVIRT_BASE="$withval"
+       fi
+fi ])
+
+AC_ARG_WITH(xen,
+[AS_HELP_STRING(--with-xen,build XEN subagent)],
+[ if test "x$withval" != "xno" ; then
+       COMPONENTS="$COMPONENTS xen"
+fi ])
+
 AC_ARG_WITH(sqlite,
 [AS_HELP_STRING(--with-sqlite,build SQLite database driver)],
 [ if test "x$withval" != "xno" ; then
@@ -371,6 +461,30 @@ AC_ARG_WITH(mysql,
        DBDRIVER_SELECTED="yes"
 fi ])
 
+AC_ARG_WITH(mariadb,
+[AS_HELP_STRING(--with-mariadb,build MariaDB database driver)],
+[ if test "x$withval" != "xno" ; then
+       if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
+               if find_existing_dir "${withval}/lib" "${withval}/lib/mariadb" "${withval}/mariadb/lib" "${withval}/lib/mysql"; then
+                       MARIADB_LD_RUN_PATH="$__dir$"    
+                       MARIADB_LDFLAGS="-L$__dir"
+               fi
+               if find_existing_dir "${withval}/include" "${withval}/include/mariadb" "${withval}/mariadb/include" "${withval}/include/mysql"; then
+                       MARIADB_CPPFLAGS="-I$__dir"
+               fi
+       else
+               if find_existing_dir "/usr/local/mariadb/lib" "/usr/local/lib/mysql"; then
+                       MARIADB_LD_RUN_PATH="$__dir$"    
+                       MARIADB_LDFLAGS="-L$__dir"
+               fi
+               if find_existing_dir "/usr/local/mariadb/include" "/usr/include/mariadb" "/usr/local/include/mariadb" "/usr/local/include/mysql"; then
+                       MARIADB_CPPFLAGS="-I$__dir"
+               fi
+       fi
+       COMPONENTS="$COMPONENTS mariadb"
+       DBDRIVER_SELECTED="yes"
+fi ])
+
 AC_ARG_WITH(pgsql,
 [AS_HELP_STRING(--with-pgsql,build PostgreSQL database driver)],
 [ if test "x$withval" != "xno" ; then
@@ -460,6 +574,14 @@ AC_ARG_WITH(openssl,
        fi
 ])
 
+AC_ARG_ENABLE(commoncrypto,
+[AS_HELP_STRING(--disable-commoncrypto,disable CommonCrypto usage on Mac OS X)],
+[
+       if test "x$enableval" = "xno"; then
+               DISABLE_COMMONCRYPTO="yes"
+       fi
+])
+
 AC_ARG_WITH(bundled-openssl,
 [AS_HELP_STRING(--with-bundled-openssl,use bundled OpenSSL libraries with product-specific prefix)],
 [
@@ -467,6 +589,14 @@ AC_ARG_WITH(bundled-openssl,
        OPENSSL_LIBCRYPTO="nxcrypto"
 ])
 
+AC_ARG_ENABLE(ssh,
+[AS_HELP_STRING(--disable-ssh,disable SSH support)],
+[
+       if test "x$enableval" = "xno"; then
+               DISABLE_SSH="yes"
+       fi
+])
+
 AC_ARG_WITH(jemalloc,
 [AS_HELP_STRING(--with-jemalloc,specify libjemalloc location)],
 [
@@ -483,13 +613,17 @@ AC_ARG_WITH(jemalloc,
 AC_ARG_ENABLE(iconv,
 [AS_HELP_STRING(--disable-iconv,do not use iconv() for text conversions)],
 [
-       DISABLE_ICONV="yes"
+       if test "x$$enableval" = "xno"; then
+               DISABLE_ICONV="yes"
+       fi
 ])
 
 AC_ARG_ENABLE(ipv6,
 [AS_HELP_STRING(--disable-ipv6,disable IPv6 support)],
 [
-       DISABLE_IPV6="yes"
+       if test "x$$enableval" = "xno"; then
+               DISABLE_IPV6="yes"
+       fi
 ])
 
 AC_ARG_ENABLE(iconv-cache,
@@ -500,89 +634,115 @@ AC_ARG_ENABLE(iconv-cache,
 AC_ARG_ENABLE(readline,
 [AS_HELP_STRING(--disable-readline,do not use libreadline)],
 [
-       DISABLE_READLINE="yes"
+       if test "x$$enableval" = "xno"; then
+               DISABLE_READLINE="yes"
+       fi
 ])
 
 AC_ARG_ENABLE(encryption,
 [AS_HELP_STRING(--disable-encryption,disable encryption support)],
 [
-       DISABLE_ENCRYPTION="yes"
-       XMPP_SUPPORT="no"
+       if test "x$$enableval" = "xno"; then
+               DISABLE_ENCRYPTION="yes"
+               XMPP_SUPPORT="no"
+       fi
 ])
 
 AC_ARG_ENABLE(lmsensors,
 [AS_HELP_STRING(--disable-lmsensors,disable lmsensors support)],
 [
-       DISABLE_LMSENSORS="yes"
+       if test "x$$enableval" = "xno"; then
+               DISABLE_LMSENSORS="yes"
+       fi
 ])
 
 AC_ARG_ENABLE(xmpp,
 [AS_HELP_STRING(--disable-xmpp,disable XMPP support)],
 [
-       XMPP_SUPPORT="no"
+       if test "x$$enableval" = "xno"; then
+               XMPP_SUPPORT="no"
+       fi
+])
+
+AC_ARG_WITH(rpi-agent,
+[AS_HELP_STRING(--with-rpi-agent,build Raspberry Pi agent)],
+[
+       COMPONENTS="$COMPONENTS raspberrypi"
 ])
 
 AC_ARG_ENABLE(ldap,
 [AS_HELP_STRING(--disable-ldap,disable LDAP support)],
 [
-       LDAP_SUPPORT="no"
+       if test "x$$enableval" = "xno"; then
+               LDAP_SUPPORT="no"
+       fi
 ])
 
 AC_ARG_ENABLE(unicode,
-[AS_HELP_STRING(--enable-unicode,enable UNICODE build)],
+[AS_HELP_STRING(--disable-unicode,disable UNICODE build)],
 [
-       BUILD_UNICODE="yes"
-       CPPFLAGS="$CPPFLAGS -DUNICODE"
-       FORCE_INTERNAL_LIBTRE="yes"
-       DISABLE_READLINE="yes"
+       if test "x$enableval" = "xno"; then
+               BUILD_UNICODE="no"
+               FORCE_INTERNAL_LIBTRE="no"
+               DISABLE_READLINE="no"
+       fi
 ])
 
 AC_ARG_ENABLE(debug,
 [AS_HELP_STRING(--enable-debug,enable additional debugging functionality)],
 [
-       ENABLE_DEBUG="yes"
+       if test "x$enableval" = "xyes"; then
+               ENABLE_DEBUG="yes"
+       fi
 ])
 
 AC_ARG_ENABLE(werror,
 [AS_HELP_STRING(--enable-werror,threat all warnings as errors)],
 [
-       ENABLE_WERROR="yes"
+       if test "x$enableval" = "xyes"; then
+               ENABLE_WERROR="yes"
+       fi
 ])
 
 AC_ARG_ENABLE(64bit,
 [AS_HELP_STRING(--disable-64bit,disable 64bit build (force 32bit build on 64bit machine))],
 [
-       FORCE_32BIT_BUILD="yes"
+       if test "x$enableval" = "xno"; then
+               FORCE_32BIT_BUILD="yes"
+       fi
 ])
 
 AC_ARG_WITH(dist,
 [AS_HELP_STRING(--with-dist,for maintainers only)],
-       DB_DRIVERS=" mysql pgsql odbc mssql sqlite oracle db2 informix"
-       MODULES="appagent jansson libexpat libstrophe libtre zlib libnetxms install sqlite snmp libnxsl libnxmb libnxlp libnxcc db server smsdrv agent libnxmap client nxscript nxcproxy nxlptest tools"
-       SUBAGENT_DIRS="linux ds18x20 freebsd openbsd minix netbsd sunos aix ipso hpux odbcquery informix oracle lmsensors darwin rpi java ubntlw netsvc db2 tuxedo mongodb"
-       SMSDRV_DIRS="kannel nxagent slack text2reach websms"
-   HDLINK_DIRS="jira"
+       DB_DRIVERS="mysql mariadb pgsql odbc mssql sqlite oracle db2 informix"
+       MODULES="appagent jansson libexpat libstrophe libtre zlib libnetxms libnxjava install sqlite snmp libnxsl libnxmb libnxlp libnxcc db server smsdrv agent client nxscript nxcproxy nxlptest tools"
+       SUBAGENT_DIRS="linux ds18x20 freebsd openbsd minix mqtt mysql netbsd sunos aix ipso hpux odbcquery informix oracle lmsensors darwin rpi java jmx bind9 ubntlw netsvc db2 tuxedo mongodb ssh vmgr xen lorawan"
+       AGENT_DIRS="libnxtux"
+       SMSDRV_DIRS="anysms kannel mymobile nexmo nxagent slack smseagle text2reach websms"
+   HDLINK_DIRS="jira redmine"
    PDSDRV_DIRS="rrdtool"
        NXCONFIG="nxconfig"
        TOP_LEVEL_MODULES="include sql images tests"
        SERVER_INCLUDE="include"
        CONTRIB_MODULES="mibs backgrounds music templates"
-       CLIENT_COMPONENTS="nxalarm nxevent nxpush nxsms"
+       CLIENT_COMPONENTS="java nxalarm nxevent nxpush nxshell nxsms"
        SERVER_TOOLS="nxconfig"
 )
 
-AC_ARG_WITH(rpi-agent,
-[AS_HELP_STRING(--with-rpi-agent,build Raspberry Pi agent)],
-[
-       COMPONENTS="$COMPONENTS raspberrypi"
-])
-
 AC_ARG_WITH(tests,
 [AS_HELP_STRING(--with-tests,build tests)],
 [
        TOP_LEVEL_MODULES="$TOP_LEVEL_MODULES tests"
 ])
 
+AC_ARG_ENABLE(systemd,
+[AS_HELP_STRING(--disable-systemd,disable Systemd support)],
+[
+       if test "x$enableval" = "xno"; then
+               SYSTEMD_SUPPORT="no"
+       fi
+])
+
 
 #--------------------------------------------------------------------
 # Set LD_LIBRARY_PATH from LD_RUN_PATH because on some systems
@@ -602,10 +762,15 @@ fi
 
 check_substr "$COMPONENTS" "snmp"
 if test $? = 0; then
-       NEED_ZLIB="yes"
        MODULES="$MODULES snmp"
 fi
 
+check_substr "$COMPONENTS" "java"
+if test $? = 0; then
+       MODULES="$MODULES libnxjava"
+       SUBAGENT_DIRS="$SUBAGENT_DIRS java bind9 jmx ubntlw"
+fi
+
 check_substr "$COMPONENTS" "static-agent"
 if test $? = 0; then
        if test "x$COMPONENTS" != "x sqlite snmp static-agent sqlite_drv"; then
@@ -613,7 +778,7 @@ if test $? = 0; then
        fi
        STATIC_BUILD="yes"
        BUILD_STATIC_AGENT="yes"
-       MODULES="$MODULES appagent libnxlp db agent"
+       MODULES="$MODULES appagent libnxlp libnxmb db agent"
        DISABLE_ICONV="yes"
        CPPFLAGS="$CPPFLAGS -D_STATIC_AGENT"
        if test "x$PROPOSED_STATIC_SUBAGENTS" = "xdefault"; then
@@ -636,61 +801,67 @@ if test $? = 0; then
                SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/oracle/oracle.la"
        fi
 
-    check_substr "$STATIC_SUBAGENT_LIST" "informix"
-    if test $? = 0; then
-        COMPONENTS="$COMPONENTS informix"
-        SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/informix/informix.la"
-    fi
+       check_substr "$STATIC_SUBAGENT_LIST" "informix"
+       if test $? = 0; then
+               COMPONENTS="$COMPONENTS informix"
+               SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/informix/informix.la"
+       fi
        
        check_substr "$STATIC_SUBAGENT_LIST" "db2"
        if test $? = 0; then
                COMPONENTS="$COMPONENTS db2"
-        SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/db2/db2.la"
+               SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/db2/db2.la"
+       fi
+
+       check_substr "$STATIC_SUBAGENT_LIST" "mysql"
+       if test $? = 0; then
+               COMPONENTS="$COMPONENTS mysql"
+               SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/mysql/mysql.la"
        fi
 
        case "$PLATFORM" in
                Linux)
-                       SUBAGENT_DIRS="linux ds18x20"
+                       SUBAGENT_DIRS="$SUBAGENT_DIRS linux ds18x20"
                        SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/linux/linux.la ../subagents/ds18x20/ds18x20.la"
                        STATIC_SUBAGENT_LIST="linux ds18x20 $STATIC_SUBAGENT_LIST"
                        ;;
                FreeBSD)
-                       SUBAGENT_DIRS="freebsd"
+                       SUBAGENT_DIRS="$SUBAGENT_DIRS freebsd"
                        SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/freebsd/freebsd.la"
                        STATIC_SUBAGENT_LIST="freebsd $STATIC_SUBAGENT_LIST"
                        ;;
                OpenBSD)
-                       SUBAGENT_DIRS="openbsd"
+                       SUBAGENT_DIRS="$SUBAGENT_DIRS openbsd"
                        SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/openbsd/openbsd.la"
                        STATIC_SUBAGENT_LIST="openbsd $STATIC_SUBAGENT_LIST"
                        ;;
                NetBSD)
-                       SUBAGENT_DIRS="netbsd"
+                       SUBAGENT_DIRS="$SUBAGENT_DIRS netbsd"
                        SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/netbsd/netbsd.la"
                        STATIC_SUBAGENT_LIST="netbsd $STATIC_SUBAGENT_LIST"
                        ;;
                SunOS)
-                       SUBAGENT_DIRS="sunos"
+                       SUBAGENT_DIRS="$SUBAGENT_DIRS sunos"
                        SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/sunos/sunos.la"
                        STATIC_SUBAGENT_LIST="sunos $STATIC_SUBAGENT_LIST"
                        ;;
                AIX)
-                       SUBAGENT_DIRS="aix"
+                       SUBAGENT_DIRS="$SUBAGENT_DIRS aix"
                        SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/aix/aix.la"
                        STATIC_SUBAGENT_LIST="aix $STATIC_SUBAGENT_LIST"
                        ;;
                HP-UX)
-                       SUBAGENT_DIRS="hpux"
+                       SUBAGENT_DIRS="$SUBAGENT_DIRS hpux"
                        SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/hpux/hpux.la"
                        STATIC_SUBAGENT_LIST="hpux $STATIC_SUBAGENT_LIST"
                        ;;
                Darwin)
-                       SUBAGENT_DIRS="darwin"
+                       SUBAGENT_DIRS="$SUBAGENT_DIRS darwin"
                        SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/darwin/darwin.la"
                        STATIC_SUBAGENT_LIST="darwin $STATIC_SUBAGENT_LIST"
                        ;;
                Minix)
-                       SUBAGENT_DIRS="minix"
+                       SUBAGENT_DIRS="$SUBAGENT_DIRS minix"
                        SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/minix/minix.la"
                        STATIC_SUBAGENT_LIST="minix $STATIC_SUBAGENT_LIST"
                        ;;
@@ -713,47 +884,49 @@ if test $? = 0; then
        CPPFLAGS="$CPPFLAGS -D_STATIC_AGENT -D_IPSO -DSQLITE_THREADSAFE=0 -I/usr/local/include"
        LDFLAGS="$LDFLAGS -all-static"
        STATIC_SUBAGENT_LIST="ecs ipso logwatch ping portcheck ups"
-       SUBAGENT_DIRS="ipso"
+       SUBAGENT_DIRS="$SUBAGENT_DIRS ipso"
        SUBAGENT_LIBS="../subagents/ecs/ecs.la ../subagents/ipso/ipso.la ../subagents/logwatch/logwatch.la ../subagents/ping/ping.la ../subagents/portCheck/portcheck.la ../subagents/ups/ups.la"
 fi
 
 check_substr "$COMPONENTS" "agent"
 if test $? = 0; then
        BUILD_AGENT="yes"
-       MODULES="$MODULES appagent libnxlp db agent"
+       MODULES="$MODULES appagent libnxlp libnxmb db agent"
 
        case "$PLATFORM" in
                Linux)
-                       SUBAGENT_DIRS="linux ds18x20"
+                       SUBAGENT_DIRS="$SUBAGENT_DIRS linux ds18x20"
                        ;;
                FreeBSD)
-                       SUBAGENT_DIRS="freebsd"
+                       SUBAGENT_DIRS="$SUBAGENT_DIRS freebsd"
                        ;;
                OpenBSD)
-                       SUBAGENT_DIRS="openbsd"
+                       SUBAGENT_DIRS="$SUBAGENT_DIRS openbsd"
                        ;;
                NetBSD)
-                       SUBAGENT_DIRS="netbsd"
+                       SUBAGENT_DIRS="$SUBAGENT_DIRS netbsd"
                        ;;
                SunOS)
-                       SUBAGENT_DIRS="sunos"
+                       SUBAGENT_DIRS="$SUBAGENT_DIRS sunos"
                        ;;
                AIX)
-                       SUBAGENT_DIRS="aix"
+                       SUBAGENT_DIRS="$SUBAGENT_DIRS aix"
                        ;;
                HP-UX)
-                       SUBAGENT_DIRS="hpux"
+                       SUBAGENT_DIRS="$SUBAGENT_DIRS hpux"
       ;;
                Darwin)
-                       SUBAGENT_DIRS="darwin"
+                       SUBAGENT_DIRS="$SUBAGENT_DIRS darwin"
                        ;;
                Minix)
-                       SUBAGENT_DIRS="minix"
+                       SUBAGENT_DIRS="$SUBAGENT_DIRS minix"
                        ;;
                *)
                        # unknown
                        ;;
        esac
+else
+       SYSTEMD_SUPPORT="no"
 fi
 
 check_substr "$COMPONENTS" "server"
@@ -762,7 +935,7 @@ if test $? = 0; then
                AC_MSG_ERROR(You must select at least one database driver when building server.)
        fi
        BUILD_SERVER="yes"
-       MODULES="$MODULES libnxmap libnxsl libnxcc server smsdrv nxscript"
+       MODULES="$MODULES libnxsl libnxcc server smsdrv nxscript"
        TOP_LEVEL_MODULES="$TOP_LEVEL_MODULES sql images"
        CONTRIB_MODULES="$CONTRIB_MODULES mibs backgrounds music templates"
        SMSDRV_DIRS="$SMSDRV_DIRS nxagent"
@@ -775,9 +948,12 @@ fi
 check_substr "$COMPONENTS" "client"
 if test $? = 0; then
        BUILD_CLIENT="yes"
-       NEED_ZLIB="yes"
        MODULES="$MODULES client"
        CLIENT_COMPONENTS="$CLIENT_COMPONENTS nxalarm nxevent nxpush nxsms"
+       check_substr "$COMPONENTS" "java"
+       if test $? = 0; then
+               CLIENT_COMPONENTS="$CLIENT_COMPONENTS java nxshell"
+       fi
 fi
 
 check_substr "$COMPONENTS" "client-proxy"
@@ -788,6 +964,12 @@ fi
 check_substr "$COMPONENTS" "mysql"
 if test $? = 0; then
        DB_DRIVERS="$DB_DRIVERS mysql"
+       SUBAGENT_DIRS="$SUBAGENT_DIRS mysql"
+fi
+
+check_substr "$COMPONENTS" "mariadb"
+if test $? = 0; then
+       DB_DRIVERS="$DB_DRIVERS mariadb"
 fi
 
 check_substr "$COMPONENTS" "pgsql"
@@ -825,17 +1007,12 @@ fi
 
 check_substr "$COMPONENTS" "raspberrypi"
 if test $? = 0; then
-       NEED_ZLIB="yes"
        SUBAGENT_DIRS="$SUBAGENT_DIRS rpi"
 fi
 
-check_substr "$COMPONENTS" "java"
-if test $? = 0; then
-       SUBAGENT_DIRS="$SUBAGENT_DIRS java ubntlw"
-fi
-
 check_substr "$COMPONENTS" "tuxedo"
 if test $? = 0; then
+       AGENT_DIRS="$AGENT_DIRS libnxtux"
        SUBAGENT_DIRS="$SUBAGENT_DIRS tuxedo"
 fi
 
@@ -844,12 +1021,22 @@ if test $? = 0; then
        SUBAGENT_DIRS="$SUBAGENT_DIRS mongodb"
 fi
 
+check_substr "$COMPONENTS" "vmgr"
+if test $? = 0; then
+       SUBAGENT_DIRS="$SUBAGENT_DIRS vmgr"
+fi
+
+check_substr "$COMPONENTS" "xen"
+if test $? = 0; then
+       SUBAGENT_DIRS="$SUBAGENT_DIRS xen"
+fi
+
 check_substr "$COMPONENTS" "sdk"
 if test $? = 0; then
        if test "x$STATIC_BUILD" = "xyes"; then
-               MODULES="$MODULES appagent libnxmap client libnxmb"
+               MODULES="$MODULES appagent client"
        else
-               MODULES="$MODULES appagent libnxmap client libnxsl libnxmb libnxlp libnxcc db nxscript smsdrv"
+               MODULES="$MODULES appagent client libnxsl libnxlp libnxcc db nxscript smsdrv snmp"
        fi
 fi
 
@@ -874,6 +1061,10 @@ if test "x$PLATFORM" = "xMinix"; then
        AC_CHECK_PROG([CC], [clang], [clang])
        AC_CHECK_PROG([CCC], [clang++], [clang++])
 fi
+if test "x$PLATFORM" = "xLinux" -a "x$ALLOW_CLANG" = "xyes"; then
+       AC_CHECK_PROG([CC], [clang], [clang])
+       AC_CHECK_PROG([CCC], [clang++], [clang++])
+fi
 AC_PROG_CC
 AC_PROG_CPP
 AC_PROG_CXX
@@ -884,7 +1075,23 @@ if test "x$CXX" = "xg++"; then
        fi
 fi
 if test "x$CXX" = "xclang++"; then
-       LIBS="$LIBS -lc++"
+       AC_LANG_PUSH([C++])
+
+       AC_MSG_CHECKING(whether -lc++ is needed)
+       AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
+               [ AC_MSG_RESULT(no) ], 
+               [ 
+                       OLDLIBS="$LIBS"
+                       LIBS="$LIBS -lc++"
+                       AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
+                               [ AC_MSG_RESULT(yes) ], 
+                               [
+                                       LIBS="$OLDLIBS"
+                                       AC_MSG_RESULT(no)
+                               ])
+               ])
+
+       AC_LANG_POP([C++])
 fi
 AM_PROG_AS
 AC_PROG_INSTALL
@@ -905,6 +1112,34 @@ AC_C_CONST
 AC_PROG_GCC_TRADITIONAL
 AC_C_BIGENDIAN
 
+AC_LANG_PUSH([C++])
+
+AC_MSG_CHECKING(whether C++ compiler supports deletion of copy constructor)
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+class A {
+public:
+   A(const A &s) = delete;
+};
+]],[[ ]])
+],[
+       AC_MSG_RESULT(yes)
+       AC_DEFINE(CAN_DELETE_COPY_CTOR,1,Define to 1 if C++ compiler supports copy constructor deletion)
+],[
+       AC_MSG_RESULT(no)
+       AC_DEFINE(CAN_DELETE_COPY_CTOR,0,Define to 1 if C++ compiler supports copy constructor deletion)
+])
+
+AC_LANG_POP([C++])
+
+
+#--------------------------------------------------------------------
+# Private extensions
+#--------------------------------------------------------------------
+
+if test "x$WITH_PRIVATE_EXTENSIONS" = "xyes"; then
+       CXXFLAGS="$CXXFLAGS -DCUSTOM_INIT_CODE"
+fi
+
 
 #--------------------------------------------------------------------
 # Platform-dependent settings
@@ -928,6 +1163,7 @@ case "$PLATFORM" in
       ;;
    SunOS)
       CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D__EXTENSIONS__"
+
       AC_MSG_CHECKING(whether C compiler accepts -O2)
       OLD_CPPFLAGS="$CPPFLAGS"
       CPPFLAGS="$CPPFLAGS -O2"
@@ -937,6 +1173,16 @@ case "$PLATFORM" in
             CPPFLAGS="$OLD_CPPFLAGS"
             AC_MSG_RESULT(no)
          ])
+
+      AC_MSG_CHECKING(whether C compiler accepts -features=extensions)
+      OLD_CFLAGS="$CFLAGS"
+      CFLAGS="$CFLAGS -features=extensions"
+      AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
+         [ AC_MSG_RESULT(yes) ],
+         [
+            CFLAGS="$OLD_CFLAGS"
+            AC_MSG_RESULT(no)
+         ])
       ;;
    Linux)
       CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE -O2"
@@ -989,6 +1235,16 @@ if test "x$ac_compiler_gnu" = "xyes" ; then
 
        AC_LANG_PUSH([C++])
 
+       AC_MSG_CHECKING(whether C++ compiler accepts -std=c++11)
+       OLD_CXXFLAGS="$CXXFLAGS"
+       CXXFLAGS="$CXXFLAGS -std=c++11"
+       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
+               [ AC_MSG_RESULT(yes) ], 
+               [ 
+                       CXXFLAGS="$OLD_CXXFLAGS"
+                       AC_MSG_RESULT(no)
+               ])
+
        AC_MSG_CHECKING(whether C++ compiler accepts -fno-rtti)
        OLD_CXXFLAGS="$CXXFLAGS"
        CXXFLAGS="$CXXFLAGS -fno-rtti"
@@ -1100,6 +1356,8 @@ if test "x$ac_compiler_gnu" = "xyes" ; then
                        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
                                [ 
                                        LDFLAGS="-m32 $LDFLAGS"
+                                       LTINIT_CC="$CC -m32"
+                                       LTINIT_CXX="$CXX -m32"
                                        AC_MSG_RESULT(yes) 
                                ], 
                                [ 
@@ -1113,6 +1371,8 @@ if test "x$ac_compiler_gnu" = "xyes" ; then
                        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
                                [ 
                                        LDFLAGS="-m64 $LDFLAGS"
+                                       LTINIT_CC="$CC -m64"
+                                       LTINIT_CXX="$CXX -m64"
                                        AC_MSG_RESULT(yes) 
                                ], 
                                [ 
@@ -1131,6 +1391,8 @@ if test "x$ac_compiler_gnu" = "xyes" ; then
                        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
                                [ 
                                        LDFLAGS="-m32 $LDFLAGS"
+                                       LTINIT_CC="$CC -m32"
+                                       LTINIT_CXX="$CXX -m32"
                                        AC_MSG_RESULT(yes) 
                                ], 
                                [ 
@@ -1396,8 +1658,14 @@ else
                        [#if defined(__FreeBSD_cc_version) || defined(__OpenBSD__)
                                yes
                        #endif
-                       ], AC_MSG_RESULT(yes)
-                       PTHREAD_LIBS="-pthread",
+                       ], [
+                               AC_MSG_RESULT(yes)
+                               PTHREAD_LIBS="-pthread"
+                               if test "x$CXX" = "xc++"; then
+                                       # Quash clang's "-pthread unused during compilation" warnings
+                                       PTHREAD_LDFLAGS="-Wc,-Qunused-arguments"
+                               fi
+                       ],
                        AC_MSG_RESULT(no))
                if test "x$PTHREAD_LIBS" = "xerror"; then
                        AC_CHECK_LIB(pthread, pthread_attr_init,
@@ -1428,7 +1696,7 @@ else
        AC_CHECK_HEADERS([pthread_np.h],,,[
 #include <pthread.h>
        ])
-       AC_CHECK_FUNCS([pthread_cond_reltimedwait_np])
+       AC_CHECK_FUNCS([pthread_cond_reltimedwait_np pthread_setname_np])
 
        # Check for recursive mutexes
        AC_CHECK_FUNCS([pthread_mutexattr_settype __pthread_mutexattr_settype pthread_mutexattr_setkind_np])
@@ -1473,34 +1741,43 @@ fi
 
 
 #--------------------------------------------------------------------
-# Checks for OpenSSL
+# Checks for OpenSSL/CommonCrypto
 #--------------------------------------------------------------------
 
 if test "x$DISABLE_ENCRYPTION" != "xyes" ; then
-       AC_CHECK_LIB($OPENSSL_LIBCRYPTO, RSA_new,
-               [
-                       AC_DEFINE(WITH_OPENSSL, 1, Define to 1 if you have OpenSSL library and headers)
-                       AC_CHECK_LIB($OPENSSL_LIBCRYPTO, EVP_aes_256_cbc,
-                                                        [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_AES,,[desc])])
-                       AC_CHECK_LIB($OPENSSL_LIBCRYPTO, EVP_bf_cbc,
-                                                        [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_BF,,[desc])])
-                       AC_CHECK_LIB($OPENSSL_LIBCRYPTO, EVP_idea_cbc,
-                                                        [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_IDEA,,[desc])])
-                       AC_CHECK_LIB($OPENSSL_LIBCRYPTO, EVP_des_ede3_cbc,
-                                                        [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_DES,,[desc])])
-                       if test "x$HAVE_LIBCRYPTO" = "xyes"; then
-                               if test "x$BUILD_STATIC_AGENT" = "xyes"; then
+       USE_COMMONCRYPTO="no"
+       if test "x$PLATFORM" = "xDarwin" -a "x$DISABLE_COMMONCRYPTO" != "xyes"; then
+               AC_CHECK_FUNC(CC_MD5_Init, [ 
+                       AC_DEFINE(WITH_COMMONCRYPTO, 1, Define to 1 if you have CommonCrypto library and headers)
+                       USE_COMMONCRYPTO="yes"
+                       WITH_ENCRYPTION="yes"
+               ])
+       fi
+       if test "x$USE_COMMONCRYPTO" != "xyes"; then
+               AC_CHECK_LIB($OPENSSL_LIBCRYPTO, RSA_new,
+                       [
+                               AC_DEFINE(WITH_OPENSSL, 1, Define to 1 if you have OpenSSL library and headers)
+                               AC_CHECK_LIB($OPENSSL_LIBCRYPTO, EVP_aes_256_cbc,
+                                                                [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_AES,,[desc])])
+                               AC_CHECK_LIB($OPENSSL_LIBCRYPTO, EVP_bf_cbc,
+                                                                [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_BF,,[desc])])
+                               AC_CHECK_LIB($OPENSSL_LIBCRYPTO, EVP_idea_cbc,
+                                                                [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_IDEA,,[desc])])
+                               AC_CHECK_LIB($OPENSSL_LIBCRYPTO, EVP_des_ede3_cbc,
+                                                                [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_DES,,[desc])])
+                               if test "x$HAVE_LIBCRYPTO" = "xyes"; then
+                                       WITH_ENCRYPTION="yes"
                                        LIBS="$LIBS -l$OPENSSL_LIBSSL -l$OPENSSL_LIBCRYPTO"
                                else
-                                       LIBS="$LIBS -l$OPENSSL_LIBSSL -l$OPENSSL_LIBCRYPTO"
-                               fi      
-                       else
-                               AC_MSG_ERROR(lib$OPENSSL_LIBCRYPTO does not provide any suitable encryption algorithm)
-                       fi
-               ],
-               [
-                       AC_MSG_ERROR(lib$OPENSSL_LIBCRYPTO is required for encryption support)
-               ])
+                                       AC_MSG_ERROR(lib$OPENSSL_LIBCRYPTO does not provide any suitable encryption algorithm)
+                               fi
+
+                               AC_CHECK_FUNCS([X509_STORE_set_verify_cb])
+                       ],
+                       [
+                               AC_MSG_ERROR(lib$OPENSSL_LIBCRYPTO is required for encryption support)
+                       ])
+       fi
 fi
 
 
@@ -1515,7 +1792,7 @@ AC_CHECK_HEADERS([fcntl.h dirent.h sys/ioctl.h sys/sockio.h poll.h termios.h])
 AC_CHECK_HEADERS([inttypes.h memory.h stdint.h stdlib.h strings.h string.h])
 AC_CHECK_HEADERS([readline/readline.h byteswap.h sys/select.h dlfcn.h locale.h])
 AC_CHECK_HEADERS([sys/sysctl.h sys/param.h sys/user.h vm/vm_param.h syslog.h])
-AC_CHECK_HEADERS([grp.h pwd.h malloc.h])
+AC_CHECK_HEADERS([grp.h pwd.h malloc.h stdbool.h utime.h])
 AC_CHECK_HEADERS([net/if.h net/if_arp.h net/if_dl.h net/if_types.h],,,
 [[#ifdef HAVE_SYS_TYPES_H
 # include <sys/types.h>
@@ -1529,6 +1806,31 @@ AC_CHECK_HEADERS([net/if.h net/if_arp.h net/if_dl.h net/if_types.h],,,
 ]])
 
 
+#--------------------------------------------------------------------
+# Checks for __get_cpuid
+#--------------------------------------------------------------------
+
+AC_CHECK_HEADERS([cpuid.h])
+AC_MSG_CHECKING(for __get_cpuid)
+AC_LANG_PUSH([C++])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#if HAVE_CPUID_H
+#include <cpuid.h>
+#endif
+]],[[
+       unsigned int eax, ebx, ecx, edx;
+       return __get_cpuid(0x01, &eax, &ebx, &ecx, &edx);
+]])
+],[
+       AC_MSG_RESULT(yes)
+       AC_DEFINE(HAVE_GET_CPUID,1,Define to 1 if __get_cpuid function is available)
+],[
+       AC_MSG_RESULT(no)
+       AC_DEFINE(HAVE_GET_CPUID,0,Define to 1 if __get_cpuid function is available)
+])
+AC_LANG_POP([C++])
+
+
 #--------------------------------------------------------------------
 # Checks for alloca
 #--------------------------------------------------------------------
@@ -1560,6 +1862,36 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 AC_LANG_POP([C++])
 
 
+#--------------------------------------------------------------------
+# Checks for d_type in struct dirent
+#--------------------------------------------------------------------
+
+AC_MSG_CHECKING(for d_type in struct dirent)
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_DIRENT_H
+#include <dirent.h>
+#endif
+]],[[
+       struct dirent d;
+       return d.d_type;
+]])
+],[
+       AC_MSG_RESULT(yes)
+       AC_DEFINE(HAVE_DIRENT_D_TYPE,1,Define to 1 if struct dirent has member d_type)
+],[
+       AC_MSG_RESULT(no)
+       AC_DEFINE(HAVE_DIRENT_D_TYPE,0,Define to 1 if struct dirent has member d_type)
+])
+AC_CHECK_DECLS([DT_DIR, DT_REG, DT_UNKNOWN],,,[
+#if HAVE_DIRENT_H
+#include <dirent.h>
+#endif
+])
+
+
 #--------------------------------------------------------------------
 # Checks for IPv6 support
 #--------------------------------------------------------------------
@@ -1582,6 +1914,22 @@ if test "x$DISABLE_IPV6" != "xyes"; then
        fi
 fi
 
+
+#--------------------------------------------------------------------
+# Checks for RADIUS client library
+#--------------------------------------------------------------------
+
+if test "x$BUILD_SERVER" = "xyes" ; then
+       AC_CHECK_HEADERS([radcli/radcli.h])
+       if test "x$ac_cv_header_radcli_radcli_h" = "xyes"; then
+               AC_CHECK_LIB(radcli, rc_auth, [
+                       SERVER_LIBS="$SERVER_LIBS -lradcli"
+                       AC_DEFINE(USE_RADCLI, 1, Define to 1 if radcli is used as RADIUS client)
+               ])
+       fi
+fi
+
+
 #--------------------------------------------------------------------
 # Checks for other libs.
 #--------------------------------------------------------------------
@@ -1669,20 +2017,18 @@ if test $? = 0; then
        fi
 fi
 
-if test "x$NEED_ZLIB" = "xyes"; then
-       if test "x$FORCE_INTERNAL_ZLIB" = "xyes"; then
-               HAVE_ZLIB=no
-       else
-               HAVE_ZLIB=yes
-               AC_CHECK_HEADER(zlib.h,,HAVE_ZLIB=no)
-               if test "x$HAVE_ZLIB" = "xyes"; then
-                       AC_CHECK_LIB(z, deflate, [], [ HAVE_ZLIB=no ])
-               fi
-       fi
-       if test "x$HAVE_ZLIB" = "xno"; then
-               MODULES="zlib $MODULES"
+if test "x$FORCE_INTERNAL_ZLIB" = "xyes"; then
+       HAVE_ZLIB=no
+else
+       HAVE_ZLIB=yes
+       AC_CHECK_HEADER(zlib.h,,HAVE_ZLIB=no)
+       if test "x$HAVE_ZLIB" = "xyes"; then
+               AC_CHECK_LIB(z, deflate, [], [ HAVE_ZLIB=no ])
        fi
 fi
+if test "x$HAVE_ZLIB" = "xno"; then
+       MODULES="zlib $MODULES"
+fi
 
 if test "x$FORCE_INTERNAL_EXPAT" = "xyes"; then
        HAVE_LIBEXPAT=no
@@ -1742,23 +2088,48 @@ if test "x$DISABLE_LMSENSORS" = "xno"; then
        fi
 fi
 
-AC_CHECK_HEADER(curl/curl.h,HAVE_LIBCURL=yes,HAVE_LIBCURL=no)
-if test "x$HAVE_LIBCURL" = "xyes"; then
-  AC_CHECK_LIB(curl, curl_global_init, [ HAVE_LIBCURL=yes ], [ HAVE_LIBCURL=no ])
-  AC_CHECK_DECLS([CURLOPT_NOSIGNAL, curl_version_info],,,[
+if test "x$DISABLE_CURL" = "xno"; then
+       AC_CHECK_HEADER(curl/curl.h,HAVE_LIBCURL=yes,HAVE_LIBCURL=no)
+       if test "x$HAVE_LIBCURL" = "xyes"; then
+               AC_CHECK_LIB(curl, curl_global_init, [ HAVE_LIBCURL=yes ], [ HAVE_LIBCURL=no ])
+               AC_CHECK_DECLS([CURLOPT_NOSIGNAL, curl_version_info],,,[
 #ifdef HAVE_CURL_CURL_H
 #include <curl/curl.h>
 #endif
-])
+               ])
+       fi
+
+       if test "x$HAVE_LIBCURL" != "xyes"; then
+               AC_MSG_ERROR(libcurl is required. Check that it is installed or use --without-curl option)
+       fi
+
+       SUBAGENT_DIRS="$SUBAGENT_DIRS netsvc"
+       SMSDRV_DIRS="$SMSDRV_DIRS anysms kannel mymobile nexmo slack smseagle text2reach websms"
+       HDLINK_DIRS="$HDLINK_DIRS jira redmine"
+       AC_DEFINE(HAVE_LIBCURL, 1, Define to 1 if libcurl is available)
 fi
 
-if test "x$HAVE_LIBCURL" = "xyes"; then
-  SUBAGENT_DIRS="$SUBAGENT_DIRS netsvc"
-  SMSDRV_DIRS="$SMSDRV_DIRS kannel slack text2reach websms"
-  HDLINK_DIRS="$HDLINK_DIRS jira"
-  AC_DEFINE(HAVE_LIBCURL, 1, Define to 1 if libcurl is available)
+if test "x$DISABLE_SSH" != "xyes"; then
+       AC_CHECK_HEADER(libssh/libssh.h,HAVE_LIBSSH=yes,HAVE_LIBSSH=no)
+       if test "x$HAVE_LIBSSH" = "xyes"; then
+               AC_CHECK_LIB(ssh, ssh_version, [ HAVE_LIBSSH=yes ], [ HAVE_LIBSSH=no ])
+       fi
+
+       if test "x$HAVE_LIBSSH" = "xyes"; then
+               SUBAGENT_DIRS="$SUBAGENT_DIRS ssh"
+               AC_DEFINE(HAVE_LIBSSH, 1, Define to 1 if libssh is available)
+       else
+               AC_MSG_ERROR(libssh is required for SSH support. Check that it is installed or use --disable-ssh option)
+       fi
+else
+       HAVE_LIBSSH=no
 fi
 
+
+#--------------------------------------------------------------------
+# Checks for LDAP libraries
+#--------------------------------------------------------------------
+
 if test "x$LDAP_SUPPORT" = "xyes"; then
        AC_CHECK_HEADER(ldap.h,HAVE_LDAP=yes,HAVE_LDAP=no)
        if test "x$HAVE_LDAP" = "xyes"; then
@@ -1800,6 +2171,24 @@ if test "x$LDAP_SUPPORT" = "xyes"; then
        LDAP_SUPPORT="$HAVE_LDAP"
 fi
 
+
+#--------------------------------------------------------------------
+# Checks for systemd libraries
+#--------------------------------------------------------------------
+
+if test "x$SYSTEMD_SUPPORT" = "xyes"; then
+       AC_CHECK_HEADER(systemd/sd-bus.h, [ HAVE_SYSTEMD=yes ], [ HAVE_SYSTEMD=no ])
+       if test "x$HAVE_SYSTEMD" = "xyes"; then
+               AC_CHECK_LIB(systemd, sd_bus_open_system, [ HAVE_SYSTEMD=yes ], [ HAVE_SYSTEMD=no ])
+       fi
+       if test "x$HAVE_SYSTEMD" = "xyes"; then
+               AC_DEFINE(WITH_SYSTEMD, 1, Define to 1 if you have Systemd libraries and headers)
+               AGENT_LIBS="$AGENT_LIBS -lsystemd"
+       fi
+       SYSTEMD_SUPPORT="$HAVE_SYSTEMD"
+fi
+
+
 #--------------------------------------------------------------------
 # Checks for data types
 #--------------------------------------------------------------------
@@ -1813,7 +2202,14 @@ AC_TYPE_PID_T
 AC_TYPE_SIZE_T
 AC_STRUCT_TIMEZONE
 
-AC_CHECK_TYPES([long long, unsigned long long, int64_t, uint64_t, u_int64_t, uuid_t])
+AC_CHECK_TYPES([long long, unsigned long long, int64_t, uint64_t, u_int64_t, uuid_t, bool],,,[
+#ifdef HAVE_STDBOOL_H
+#include <stdbool.h>
+#endif
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+])
 AC_CHECK_TYPES([mode_t, off_t, socklen_t],,,[
 #if HAVE_SYS_TYPES_H
 #include <sys/types.h>
@@ -1840,12 +2236,14 @@ AC_FUNC_STRFTIME
 AC_FUNC_STRTOD
 AC_FUNC_VPRINTF
 
-AC_CHECK_FUNCS([gettimeofday memmove memset bcopy strchr strcspn strdup strerror])
-AC_CHECK_FUNCS([strrchr strlwr strtok_r strtol strtoul strtoll strtoull setlocale])
-AC_CHECK_FUNCS([if_nametoindex daemon mmap strerror_r scandir uname poll])
+AC_CHECK_FUNCS([gettimeofday memmove memset bcopy strchr strcspn strdup])
+AC_CHECK_FUNCS([strrchr strlwr strtok_r strtol strtoul strtoll strtoull])
+AC_CHECK_FUNCS([strlcpy strlcat setlocale strerror strerror_r])
+AC_CHECK_FUNCS([tolower if_nametoindex daemon mmap scandir uname poll])
 AC_CHECK_FUNCS([usleep nanosleep gmtime_r localtime_r stat64 fstat64 lstat64])
-AC_CHECK_FUNCS([fopen64 strptime timegm gethostbyname2_r getaddrinfo])
-AC_CHECK_FUNCS([itoa _itoa isatty getgrnam getpwnam malloc_info malloc_trim])
+AC_CHECK_FUNCS([fopen64 strptime timegm gethostbyname2_r getaddrinfo rand_r])
+AC_CHECK_FUNCS([itoa _itoa isatty malloc_info malloc_trim utime])
+AC_CHECK_FUNCS([getgrnam getpwnam getpwuid getpwuid_r getpeereid])
 
 AC_CHECK_DECLS([nanosleep, daemon, strerror])
 
@@ -1946,7 +2344,7 @@ AC_RUN_IFELSE(
 # Checks for macros and definitions
 #--------------------------------------------------------------------
 
-AC_CHECK_DECLS([__bswap_32, __bswap_64, htonll, ntohll],,,[
+AC_CHECK_DECLS([bswap_16, bswap_32, bswap_64, htonll, ntohll],,,[
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
@@ -2032,7 +2430,7 @@ fi
 
 if test "x$PLATFORM" = "xAIX"; then
        AC_CHECK_HEADERS([procinfo.h],,,[[ ]])
-       AC_CHECK_DECLS([getkerninfo, getprocs, getprocs64, __sync_add_and_fetch, __sync_sub_and_fetch],,,[
+       AC_CHECK_DECLS([getkerninfo, getprocs, getprocs64, __sync_add_and_fetch, __sync_sub_and_fetch, __sync_lock_test_and_set],,,[
 #if HAVE_PROCINFO_H
 #include <procinfo.h>
 #endif
@@ -2050,7 +2448,7 @@ fi
 #--------------------------------------------------------------------
 
 if test "x$PLATFORM" = "xSunOS"; then
-       AC_CHECK_FUNCS([atomic_inc_32_nv atomic_dec_32_nv],,,[
+       AC_CHECK_FUNCS([atomic_inc_32_nv atomic_dec_32_nv atomic_swap_ptr],,,[
 #include <sys/atomic.h>
        ])
 fi
@@ -2098,8 +2496,9 @@ fi
 # *BSD specific checks
 #--------------------------------------------------------------------
 
+AC_CHECK_HEADERS([sys/event.h])
 AC_CHECK_LIB(kvm, kvm_open)
-AC_CHECK_FUNCS([kvm_getswapinfo])
+AC_CHECK_FUNCS([kvm_openfiles kvm_getswapinfo kqueue])
 AC_CHECK_TYPES([struct kinfo_proc2],,,[
 #if HAVE_SYS_SYSCTL_H
 #include <sys/sysctl.h>
@@ -2129,10 +2528,16 @@ fi
 #--------------------------------------------------------------------
 
 if test "x$PLATFORM" = "xOpenBSD"; then
+       AC_CHECK_DECLS([SIOCGIFDATA],,,[
+#if HAVE_SYS_SOCKIO_H
+#include <sys/sockio.h>
+#endif
+       ])
        AC_MSG_CHECKING(if kvm_getprocs requires sizeof kinfo_proc argument)
         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 #include <sys/param.h>
 #include <sys/proc.h>
+#include <sys/sysctl.h>
 #include <kvm.h>
 #include <sys/user.h>
         ]],[[
@@ -2152,6 +2557,7 @@ if test "x$PLATFORM" = "xOpenBSD"; then
         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 #include <sys/param.h>
 #include <sys/proc.h>
+#include <sys/sysctl.h>
 #include <kvm.h>
 #include <sys/user.h>
         ]],[[
@@ -2181,6 +2587,10 @@ fi
 # Check for UNICODE stuff
 #--------------------------------------------------------------------
 
+if test "x$BUILD_UNICODE" = "xyes"; then
+       CPPFLAGS="$CPPFLAGS -DUNICODE"
+fi
+
 AC_CHECK_HEADERS([wchar.h wctype.h iconv.h widec.h])
 AC_CHECK_TYPES([wchar_t, wint_t],,,[
 #if HAVE_WCHAR_H
@@ -2197,7 +2607,9 @@ AC_CHECK_FUNCS([wcslwr wcserror wcserror_r wfopen wfopen64 fputws putws])
 AC_CHECK_FUNCS([wopen wstat waccess wgetenv wrename wunlink wremove wchdir])
 AC_CHECK_FUNCS([wmkdir wrmdir wsystem wmkstemp wpopen wctime wchmod vwscanf])
 AC_CHECK_FUNCS([vswscanf vfwscanf wcscasecmp wcsncasecmp wcstombs wcsrtombs])
-AC_CHECK_FUNCS([mbstowcs mbsrtowcs itow _itow wcsftime wcstok])
+AC_CHECK_FUNCS([mbstowcs mbsrtowcs itow _itow wcsftime wcstok wutime])
+AC_CHECK_FUNCS([wprintf vwprintf swprintf vswprintf fwprintf vfwprintf])
+AC_CHECK_FUNCS([wcslcpy wcslcat])
 
 AC_CHECK_DECLS([putws],,,[
 #if HAVE_WCHAR_H
@@ -2625,7 +3037,9 @@ if test $? = 0; then
        AC_CHECK_HEADER(mysql.h,,AC_MSG_ERROR([Cannot find mysql.h - check your MySQL client installation]))
 
        AC_CHECK_LIB(mysqlclient, mysql_init, [MYSQL_LIBS="-lmysqlclient"],
-               [AC_MSG_ERROR(libmysqlclient is requred for MySQL support)])
+               [
+                       AC_MSG_ERROR(libmysqlclient is requred for MySQL support)
+               ])
 
        OLD_LIBS="$LIBS"
        LIBS="$LIBS $MYSQL_LIBS"
@@ -2639,6 +3053,35 @@ if test $? = 0; then
 fi
 
 
+#--------------------------------------------------------------------
+# MariaDB
+#--------------------------------------------------------------------
+
+check_substr "$COMPONENTS" "mariadb"
+if test $? = 0; then
+       OLD_CPPFLAGS="$CPPFLAGS"
+       OLD_LDFLAGS="$LDFLAGS"
+       OLD_LD_RUN_PATH="$LD_RUN_PATH"
+
+       CPPFLAGS="$CPPFLAGS $MARIADB_CPPFLAGS"
+       LDFLAGS="$LDFLAGS $MARIADB_LDFLAGS"
+       if test "x$MARIADB_LD_RUN_PATH" != "x"; then
+               LD_RUN_PATH="${MARIADB_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
+       fi
+
+       AC_CHECK_HEADER(mysql.h,,AC_MSG_ERROR([Cannot find mysql.h - check your MariaDB client installation]))
+
+       AC_CHECK_LIB(mariadb, mysql_init, [MARIADB_LIBS="-lmariadb"],
+               [
+                       AC_MSG_ERROR(libmariadb is requred for MariaDB support)
+               ])
+
+       CPPFLAGS="$OLD_CPPFLAGS"
+       LDFLAGS="$OLD_LDFLAGS"
+       LD_RUN_PATH="$OLD_LD_RUN_PATH"
+fi
+
+
 #--------------------------------------------------------------------
 # PostgreSQL
 #--------------------------------------------------------------------
@@ -2664,7 +3107,11 @@ if test $? = 0; then
        AC_CHECK_LIB(m, floor)
        AC_CHECK_LIB(pq, PQconnectdb, [PGSQL_LIBS="-lpq"], [
                if test "x$PLATFORM" = "xSunOS"; then
-                       PGSQL_LDFLAGS="$PGSQL_LDFLAGS/sparcv9"
+                       if test -d "$PGSQL_LD_RUN_PATH/sparcv9"; then
+                               PGSQL_LDFLAGS="$PGSQL_LDFLAGS/sparcv9"
+                       else
+                               PGSQL_LDFLAGS="$PGSQL_LDFLAGS/64"
+                       fi
                        LDFLAGS="$OLD_LDFLAGS $PGSQL_LDFLAGS"
                        if test "x$PGSQL_LD_RUN_PATH" != "x"; then
                                PGSQL_LD_RUN_PATH="$PGSQL_LD_RUN_PATH/sparcv9"
@@ -2839,11 +3286,12 @@ if test $? = 0; then
 
        if test "x$PLATFORM" = "xAIX"; then
                if test -e $TUXEDO_BASE/lib/tpinit.o; then
-                       TUXEDO_LIBS="$TUXEDO_BASE/lib/tpinit.o $TUXEDO_LIBS"
+                       TUXEDO_TPINIT="$TUXEDO_BASE/lib/tpinit.o"
                fi
        fi
 fi
 
+
 #--------------------------------------------------------------------
 # ZeroMQ
 #--------------------------------------------------------------------
@@ -2885,6 +3333,40 @@ if test $? = 0; then
        LIBS="$OLD_LIBS"
 fi
 
+
+#--------------------------------------------------------------------
+# MQTT
+#--------------------------------------------------------------------
+
+if test "x$DISABLE_MQTT" != "xyes"; then
+       OLD_CPPFLAGS="$CPPFLAGS"
+       OLD_LDFLAGS="$LDFLAGS"
+       OLD_LIBS="$LIBS"
+
+       if test "x$MOSQUITTO_BASE" != "x"; then
+               MQTT_CPPFLAGS="-I$MOSQUITTO_BASE/include"
+               MQTT_LDFLAGS="-L$MOSQUITTO_BASE/lib"
+               CPPFLAGS="$CPPFLAGS $MQTT_CPPFLAGS"
+               LDFLAGS="$LDFLAGS $MQTT_LDFLAGS"
+       fi
+       
+       AC_CHECK_HEADER(mosquitto.h,,[
+               AC_MSG_ERROR([*** Cannot find mosquitto.h - check your libmosquitto installation or disable MQTT support with --disable-mqtt ***])
+       ])
+       AC_CHECK_LIB(mosquitto, mosquitto_lib_init, [ MQTT_LIBS="-lmosquitto" ], [
+               AC_MSG_ERROR([*** libmosquitto is missing - check your libmosquitto installation or disable MQTT support with --disable-mqtt***])
+       ])
+    
+       MQTT_SUPPORT="yes"
+       AC_DEFINE(WITH_MQTT, 1, Define to 1 if MQTT is supported)
+       SUBAGENT_DIRS="$SUBAGENT_DIRS mqtt"
+
+       CPPFLAGS="$OLD_CPPFLAGS"
+       LDFLAGS="$OLD_LDFLAGS"
+       LIBS="$OLD_LIBS"
+fi
+
+
 #--------------------------------------------------------------------
 # MongoDB
 #--------------------------------------------------------------------
@@ -2905,10 +3387,10 @@ if test $? = 0; then
                MONGODB_LDFLAGS="-L/usr/local/lib"
                CPPFLAGS="$CPPFLAGS $MONGODB_CPPFLAGS"
                LDFLAGS="$LDFLAGS $MONGODB_LDFLAGS"
-    fi
+       fi
        
        AC_CHECK_HEADER(mongoc.h,,AC_MSG_ERROR([*** Cannot find mongoc.h - check your MongoDB installation ***]))
-       AC_CHECK_LIB(mongoc-1.0, nanosleep, [ MONGODB_LIBS="$MONGODB_LIBS -lmongoc-1.0" ])
+       AC_CHECK_LIB(mongoc-1.0, mongoc_client_get_database, [ MONGODB_LIBS="$MONGODB_LIBS -lmongoc-1.0" ])
        AC_CHECK_LIB(bson-1.0, nanosleep, [ MONGODB_LIBS="$MONGODB_LIBS -lbson-1.0" ])
 
        LIBS="$LIBS $MONGODB_LIBS"
@@ -2918,6 +3400,72 @@ if test $? = 0; then
        LIBS="$OLD_LIBS"
 fi
 
+
+#--------------------------------------------------------------------
+# VMGR
+#--------------------------------------------------------------------
+
+check_substr "$COMPONENTS" "vmgr"
+if test $? = 0; then
+       OLD_CPPFLAGS="$CPPFLAGS"
+       OLD_LDFLAGS="$LDFLAGS"
+       OLD_LIBS="$LIBS"
+
+       if test "x$LIBVIRT_BASE" != "x"; then
+               VMGR_CPPFLAGS="-I$LIBVIRT_BASE/include"
+               VMGR_LDFLAGS="-L$LIBVIRT_BASE/lib"
+               CPPFLAGS="$CPPFLAGS $VMGR_CPPFLAGS"
+               LDFLAGS="$LDFLAGS $VMGR_LDFLAGS"
+       else
+               VMGR_CPPFLAGS=""
+               VMGR_LDFLAGS=""
+               CPPFLAGS="$CPPFLAGS $VMGR_CPPFLAGS"
+               LDFLAGS="$LDFLAGS $VMGR_LDFLAGS"
+       fi
+       
+       AC_CHECK_HEADER(libvirt/libvirt.h,,AC_MSG_ERROR([*** Cannot find libvirt.h - check your libvirt installation ***]))
+       AC_CHECK_LIB(virt, virConnectGetLibVersion, [ VMGR_LIBS="$VMGR_LIBS -lvirt" ])
+       LIBS="$LIBS $VMGR_LIBS"
+
+       AC_CHECK_FUNCS([virDomainGetTime])
+
+       CPPFLAGS="$OLD_CPPFLAGS"
+       LDFLAGS="$OLD_LDFLAGS"
+       LIBS="$OLD_LIBS"
+fi
+
+
+#--------------------------------------------------------------------
+# XEN
+#--------------------------------------------------------------------
+
+check_substr "$COMPONENTS" "xen"
+if test $? = 0; then
+       OLD_CPPFLAGS="$CPPFLAGS"
+       OLD_LDFLAGS="$LDFLAGS"
+       OLD_LIBS="$LIBS"
+
+       AC_CHECK_HEADER(libxl.h,,AC_MSG_ERROR([*** Cannot find libxl.h - check your libxen installation ***]))
+       AC_CHECK_LIB(xenlight, libxl_ctx_alloc, [ XEN_LIBS="$XEN_LIBS -lxenlight" ])
+       AC_CHECK_LIB(xenctrl, xc_vcpu_getinfo, [ XEN_LIBS="$XEN_LIBS -lxenctrl" ])
+
+       CPPFLAGS="$OLD_CPPFLAGS"
+       LDFLAGS="$OLD_LDFLAGS"
+       LIBS="$OLD_LIBS"
+fi
+
+
+#--------------------------------------------------------------------
+# LoraWAN
+#--------------------------------------------------------------------
+
+check_substr "$COMPONENTS" "agent"
+if test $? = 0; then
+       if test "x$HAVE_LIBCURL" = "xyes" -a "x$MQTT_SUPPORT" = "xyes"; then
+               SUBAGENT_DIRS="$SUBAGENT_DIRS lorawan"
+       fi
+fi
+
 #--------------------------------------------------------------------
 # Other settings
 #--------------------------------------------------------------------
@@ -2936,7 +3484,8 @@ else
        fi
        LDFLAGS_SUFFIX="$LDFLAGS_SUFFIX -R $RUNTIME_PREFIX/lib"
 fi
-LDFLAGS="$LDFLAGS_PREFIX $LDFLAGS $LDFLAGS_SUFFIX"
+
+LDFLAGS="$LDFLAGS_PREFIX $LDFLAGS $PTHREAD_LDFLAGS $LDFLAGS_SUFFIX"
 
 if test "x${ENABLE_WERROR}" = "xyes"; then
        CPPFLAGS="$CPPFLAGS -Werror"
@@ -2965,33 +3514,63 @@ AM_CONDITIONAL([USE_INTERNAL_EXPAT], [test "x$HAVE_LIBEXPAT" = "xno"])
 AM_CONDITIONAL([USE_INTERNAL_LIBTRE], [test "x$HAVE_LIBTRE" = "xno"])
 AM_CONDITIONAL([USE_INTERNAL_JANSSON], [test "x$HAVE_JANSSON" = "xno"])
 AM_CONDITIONAL([USE_INTERNAL_SQLITE], [test "x$HAVE_SQLITE" = "xno"])
-AM_CONDITIONAL([USE_INTERNAL_ZLIB], [test "$NEED_ZLIB/$HAVE_ZLIB" = "yes/no"])
+AM_CONDITIONAL([USE_INTERNAL_ZLIB], [test "$HAVE_ZLIB" = "no"])
 AM_CONDITIONAL([STATIC_BUILD], [test "x$STATIC_BUILD" = "xyes"])
 AM_CONDITIONAL([ALL_STATIC], [test "x$ALL_STATIC" = "xyes"])
-AM_CONDITIONAL([USE_ENCRYPTION], [test "x${HAVE_LIBCRYPTO}" = "xyes"])
+AM_CONDITIONAL([USE_ENCRYPTION], [test "x${WITH_ENCRYPTION}" = "xyes"])
 AM_CONDITIONAL([HPUX_HPPA], [test "x$HPUX_HPPA" = "xyes"])
+AM_CONDITIONAL([MQTT_SUPPORT], [test "x$MQTT_SUPPORT" = "xyes"])
 AM_CONDITIONAL([XMPP_SUPPORT], [test "x$XMPP_SUPPORT" = "xyes"])
+AM_CONDITIONAL([WITH_PRIVATE_EXTENSIONS], [test "x$WITH_PRIVATE_EXTENSIONS" = "xyes"])
 AM_CONDITIONAL([ZEROMQ_SUPPORT], [test "x$ZEROMQ_SUPPORT" = "xyes"])
 
 
+#--------------------------------------------------------------------
+# Get compiler version
+#--------------------------------------------------------------------
+
+COMPILER_VERSION=""
+if test "$CXX" = "CC"; then
+       v=`$CXX -V 2>&1 | head -1`
+       if test $? = 0; then
+               COMPILER_VERSION="$v"
+       fi
+else
+       for opt in -qversion --version -v -V; do
+               v=`$CXX $opt 2>/dev/null | head -1`
+               if test $? = 0; then
+                       if test "x$v" != "x" -a "x$COMPILER_VERSION" = "x"; then
+                               COMPILER_VERSION="$v"
+                       fi
+               fi
+       done
+fi
+AC_DEFINE_UNQUOTED([CPP_COMPILER_VERSION], "$COMPILER_VERSION", [C++ compiler version information])
+
+
 #--------------------------------------------------------------------
 # Cleanup variables
 #--------------------------------------------------------------------
 
 AS_IF([test "x$with_dist" = "xyes"],
 [
+  AGENT_DIRS=`echo $AGENT_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
   SUBAGENT_DIRS=`echo $SUBAGENT_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
   MODULES=`echo $MODULES|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
   SMSDRV_DIRS=`echo $SMSDRV_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
   HDLINK_DIRS=`echo $HDLINK_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
 ])
 
+
 #--------------------------------------------------------------------
 # Substitute variables
 #--------------------------------------------------------------------
 
-AC_SUBST(DB_DRIVERS)
 AC_SUBST(MODULES)
+AC_SUBST(AGENT_DIRS)
+AC_SUBST(AGENT_LIBS)
+AC_SUBST(CUSTOM_INCLUDE)
+AC_SUBST(DB_DRIVERS)
 AC_SUBST(SUBAGENT_DIRS)
 AC_SUBST(SERVER_INCLUDE)
 AC_SUBST(SERVER_LIBS)
@@ -3009,6 +3588,9 @@ AC_SUBST(BUILD_SDK)
 AC_SUBST(MYSQL_CPPFLAGS)
 AC_SUBST(MYSQL_LDFLAGS)
 AC_SUBST(MYSQL_LIBS)
+AC_SUBST(MARIADB_CPPFLAGS)
+AC_SUBST(MARIADB_LDFLAGS)
+AC_SUBST(MARIADB_LIBS)
 AC_SUBST(PGSQL_CPPFLAGS)
 AC_SUBST(PGSQL_LDFLAGS)
 AC_SUBST(PGSQL_LIBS)
@@ -3024,16 +3606,26 @@ AC_SUBST(DB2_LIBS)
 AC_SUBST(INFORMIX_CPPFLAGS)
 AC_SUBST(INFORMIX_LDFLAGS)
 AC_SUBST(INFORMIX_LIBS)
+AC_SUBST(INSTALL_LIBPATH)
 AC_SUBST(OBJECT_MODE)
 AC_SUBST(SQLFLAGS)
 AC_SUBST(SHLIB_SUFFIX)
 AC_SUBST(TUXEDO_CPPFLAGS)
 AC_SUBST(TUXEDO_LDFLAGS)
 AC_SUBST(TUXEDO_LIBS)
+AC_SUBST(TUXEDO_TPINIT)
 AC_SUBST(MONGODB_CPPFLAGS)
 AC_SUBST(MONGODB_LDFLAGS)
 AC_SUBST(MONGODB_LIBS)
-AC_SUBST(INSTALL_LIBPATH)
+AC_SUBST(MQTT_CPPFLAGS)
+AC_SUBST(MQTT_LDFLAGS)
+AC_SUBST(MQTT_LIBS)
+AC_SUBST(VMGR_CPPFLAGS)
+AC_SUBST(VMGR_LDFLAGS)
+AC_SUBST(VMGR_LIBS)
+AC_SUBST(XEN_CPPFLAGS)
+AC_SUBST(XEN_LDFLAGS)
+AC_SUBST(XEN_LIBS)
 AC_SUBST(ZEROMQ_CPPFLAGS)
 AC_SUBST(ZEROMQ_LDFLAGS)
 
@@ -3083,6 +3675,7 @@ AC_CONFIG_FILES([
        contrib/mibs/Makefile
        contrib/music/Makefile
        contrib/startup/Makefile
+       contrib/startup/systemd/Makefile
        contrib/startup/debian/Makefile
        contrib/startup/gentoo/Makefile
        contrib/startup/hp-ux/Makefile
@@ -3097,6 +3690,7 @@ AC_CONFIG_FILES([
        doc/misc/Makefile
        images/Makefile
        include/Makefile
+       include/msvc/Makefile
        m4/Makefile
        src/Makefile
        src/agent/Makefile
@@ -3105,8 +3699,10 @@ AC_CONFIG_FILES([
        src/agent/libnxagent/Makefile
        src/agent/libnxappc/Makefile
        src/agent/libnxsd/Makefile
+       src/agent/libnxtux/Makefile
        src/agent/subagents/Makefile
        src/agent/subagents/aix/Makefile
+       src/agent/subagents/bind9/Makefile
        src/agent/subagents/darwin/Makefile
        src/agent/subagents/db2/Makefile
        src/agent/subagents/dbquery/Makefile
@@ -3121,25 +3717,14 @@ AC_CONFIG_FILES([
        src/agent/subagents/ipso/Makefile
        src/agent/subagents/java/Makefile
        src/agent/subagents/java/java/Makefile
-       src/agent/subagents/java/java/src/Makefile
-       src/agent/subagents/java/java/src/main/Makefile
-       src/agent/subagents/java/java/src/main/java/Makefile
-       src/agent/subagents/java/java/src/main/java/org/Makefile
-       src/agent/subagents/java/java/src/main/java/org/netxms/Makefile
-       src/agent/subagents/java/java/src/main/java/org/netxms/agent/Makefile
-       src/agent/subagents/java/java/src/main/java/org/netxms/agent/adapters/Makefile
-       src/agent/subagents/java/sample/Makefile
-       src/agent/subagents/java/sample/src/Makefile
-       src/agent/subagents/java/sample/src/main/Makefile
-       src/agent/subagents/java/sample/src/main/java/Makefile
-       src/agent/subagents/java/sample/src/main/java/org/Makefile
-       src/agent/subagents/java/sample/src/main/java/org/netxms/Makefile
-       src/agent/subagents/java/sample/src/main/java/org/netxms/agent/Makefile
-       src/agent/subagents/java/sample/src/main/java/org/netxms/agent/demo/Makefile
+       src/agent/subagents/jmx/Makefile
        src/agent/subagents/linux/Makefile
        src/agent/subagents/lmsensors/Makefile
        src/agent/subagents/logwatch/Makefile
+       src/agent/subagents/lorawan/Makefile
        src/agent/subagents/minix/Makefile
+       src/agent/subagents/mqtt/Makefile
+       src/agent/subagents/mysql/Makefile
        src/agent/subagents/netbsd/Makefile
        src/agent/subagents/netsvc/Makefile
        src/agent/subagents/odbcquery/Makefile
@@ -3149,30 +3734,38 @@ AC_CONFIG_FILES([
        src/agent/subagents/portCheck/Makefile
        src/agent/subagents/rpi/Makefile
        src/agent/subagents/sms/Makefile
+       src/agent/subagents/ssh/Makefile
        src/agent/subagents/sunos/Makefile
        src/agent/subagents/tuxedo/Makefile
        src/agent/subagents/mongodb/Makefile
        src/agent/subagents/ubntlw/Makefile
        src/agent/subagents/ups/Makefile
+       src/agent/subagents/vmgr/Makefile
        src/agent/subagents/winnt/Makefile
        src/agent/subagents/winperf/Makefile
        src/agent/subagents/wmi/Makefile
+       src/agent/subagents/xen/Makefile
        src/agent/tools/Makefile
        src/agent/tools/nxappget/Makefile
        src/agent/tools/nxapush/Makefile
        src/appagent/Makefile
        src/client/Makefile
        src/client/install/Makefile
+       src/client/java/Makefile
+       src/client/java/netxms-client/Makefile
        src/client/libnxclient/Makefile
        src/client/nxalarm/Makefile
        src/client/nxevent/Makefile
        src/client/nxpush/Makefile
+       src/client/nxshell/Makefile
+       src/client/nxshell/java/Makefile
        src/client/nxsms/Makefile
        src/db/Makefile
        src/db/dbdrv/Makefile
        src/db/dbdrv/db2/Makefile
        src/db/dbdrv/informix/Makefile
        src/db/dbdrv/odbc/Makefile
+       src/db/dbdrv/mariadb/Makefile
        src/db/dbdrv/mssql/Makefile
        src/db/dbdrv/mysql/Makefile
        src/db/dbdrv/oracle/Makefile
@@ -3186,8 +3779,13 @@ AC_CONFIG_FILES([
        src/libexpat/libexpat/Makefile
        src/libnetxms/Makefile
        src/libnxcc/Makefile
+       src/libnxjava/Makefile
+       src/libnxjava/java/Makefile
+       src/libnxjava/java/base/Makefile
+       src/libnxjava/java/base/lib/Makefile
+       src/libnxjava/java/base/netxms-base/Makefile
+       src/libnxjava/java/bridge/Makefile
        src/libnxlp/Makefile
-       src/libnxmap/Makefile
        src/libnxmb/Makefile
        src/libnxsl/Makefile
        src/libstrophe/Makefile
@@ -3209,12 +3807,16 @@ AC_CONFIG_FILES([
        src/server/drivers/dell-pwc/Makefile
        src/server/drivers/dlink/Makefile
        src/server/drivers/ers8000/Makefile
+       src/server/drivers/extreme/Makefile
        src/server/drivers/h3c/Makefile
        src/server/drivers/hpsw/Makefile
+       src/server/drivers/ignitenet/Makefile
+       src/server/drivers/juniper/Makefile
        src/server/drivers/lib/Makefile
        src/server/drivers/lib/avaya-ers/Makefile
        src/server/drivers/lib/cisco/Makefile
        src/server/drivers/mikrotik/Makefile
+       src/server/drivers/netonix/Makefile
        src/server/drivers/netscreen/Makefile
        src/server/drivers/ntws/Makefile
        src/server/drivers/ping3/Makefile
@@ -3225,6 +3827,7 @@ AC_CONFIG_FILES([
        src/server/drivers/ubnt/Makefile
        src/server/hdlink/Makefile
        src/server/hdlink/jira/Makefile
+       src/server/hdlink/redmine/Makefile
        src/server/include/Makefile
        src/server/libnxsrv/Makefile
        src/server/netxmsd/Makefile
@@ -3238,14 +3841,20 @@ AC_CONFIG_FILES([
        src/server/tools/nxconfig/res/Makefile
        src/server/tools/nxdbmgr/Makefile
        src/server/tools/nxget/Makefile
+       src/server/tools/nxminfo/Makefile
        src/server/tools/nxupload/Makefile
        src/smsdrv/Makefile
+       src/smsdrv/anysms/Makefile
+       src/smsdrv/dbemu/Makefile
        src/smsdrv/dummy/Makefile
        src/smsdrv/generic/Makefile
        src/smsdrv/kannel/Makefile
+       src/smsdrv/mymobile/Makefile
+       src/smsdrv/nexmo/Makefile
        src/smsdrv/nxagent/Makefile
        src/smsdrv/portech/Makefile
        src/smsdrv/slack/Makefile
+       src/smsdrv/smseagle/Makefile
        src/smsdrv/text2reach/Makefile
        src/smsdrv/websms/Makefile
        src/snmp/Makefile
@@ -3309,6 +3918,11 @@ if test "x$IPV6_SUPPORT" = "xyes"; then
 else
        echo "IPv6 support            : NO"
 fi
+if test "x${MQTT_SUPPORT}" = "xyes"; then
+       echo "MQTT support            : YES"
+else
+       echo "MQTT support            : NO"
+fi
 if test "x${BUILD_SERVER}" = "xyes"; then
        echo "Build Server            : YES"
        echo "Server libs             : ${SERVER_LIBS}"
@@ -3330,11 +3944,16 @@ if test "x${BUILD_SERVER}" = "xyes"; then
 else
        echo "Build Server            : NO"
 fi
-if test "x${HAVE_LIBCRYPTO}" = "xyes"; then
+if test "x${WITH_ENCRYPTION}" = "xyes"; then
        echo "Encryption enabled      : YES"
 else
        echo "Encryption enabled      : NO"
 fi
+if test "x${HAVE_LIBSSH}" = "xyes"; then
+       echo "SSH support enabled     : YES"
+else
+       echo "SSH support enabled     : NO"
+fi
 if test "x${DB_DRIVERS}" != "x"; then
        echo "Build DB-Drivers        :${DB_DRIVERS}"
 else
@@ -3347,7 +3966,14 @@ else
 fi
 if test "x${BUILD_AGENT}" = "xyes"; then
        echo "Build Agent             : YES"
-       echo "Subagents list          : ${SUBAGENT_DIRS}"
+       echo "Agent libs              :${AGENT_LIBS}"
+       echo "Agent extra components  :${AGENT_DIRS}"
+       echo "Subagents list          :${SUBAGENT_DIRS}"
+       if test "x${SYSTEMD_SUPPORT}" = "xyes"; then
+               echo "Systemd support           : YES"
+       else
+               echo "Systemd support           : NO"
+       fi
 else
        echo "Build Agent             : NO"
 fi
@@ -3385,12 +4011,10 @@ if test $? = 0; then
                echo "Use internal sqlite     : NO"
        fi
 fi
-if test "x${NEED_ZLIB}" = "xyes"; then
-       if test "x${HAVE_ZLIB}" = "xno"; then
-               echo "Use internal zlib       : YES"
-       else
-               echo "Use internal zlib       : NO"
-       fi
+if test "x${HAVE_ZLIB}" = "xno"; then
+       echo "Use internal zlib       : YES"
+else
+       echo "Use internal zlib       : NO"
 fi
 if test "x${FORCE_32BIT_BUILD}" = "xyes"; then
        echo "Force 32bit build       : YES"
@@ -3400,6 +4024,7 @@ fi
 
 echo "C compiler              : ${CC}"
 echo "C++ compiler            : ${CXX}"
+echo "C++ compiler info       : ${COMPILER_VERSION}"
 echo "CPPFLAGS                : ${CPPFLAGS}"
 echo "CXXFLAGS                : ${CXXFLAGS}"
 echo "CFLAGS                  : ${CFLAGS}"
@@ -3416,6 +4041,16 @@ if test "x${MYSQL_LIBS}" != "x"; then
        echo "MySQL LIBS              : ${MYSQL_LIBS}"
 fi
 
+if test "x${MARIADB_CPPFLAGS}" != "x"; then
+       echo "MariaDB CPPFLAGS        : ${MARIADB_CPPFLAGS}"
+fi
+if test "x${MARIADB_LDFLAGS}" != "x"; then
+       echo "MariaDB LDFLAGS         : ${MARIADB_LDFLAGS}"
+fi
+if test "x${MARIADB_LIBS}" != "x"; then
+       echo "MariaDB LIBS            : ${MARIADB_LIBS}"
+fi
+
 if test "x${PGSQL_CPPFLAGS}" != "x"; then
        echo "PostgreSQL CPPFLAGS     : ${PGSQL_CPPFLAGS}"
 fi
@@ -3490,6 +4125,26 @@ if test "x${ZEROMQ_LDFLAGS}" != "x"; then
        echo "ZeroMQ LDFLAGS          : ${ZEROMQ_LDFLAGS}"
 fi
 
+if test "x${VMGR_CPPFLAGS}" != "x"; then
+       echo "Vmgr CPPFLAGS           : ${VMGR_CPPFLAGS}"
+fi
+if test "x${VMGR_LDFLAGS}" != "x"; then
+       echo "Vmgr LDFLAGS            : ${VMGR_LDFLAGS}"
+fi
+if test "x${VMGR_LIBS}" != "x"; then
+       echo "Vmgr LIBS               : ${VMGR_LIBS}"
+fi
+
+if test "x${XEN_CPPFLAGS}" != "x"; then
+       echo "XEN CPPFLAGS            : ${XEN_CPPFLAGS}"
+fi
+if test "x${XEN_LDFLAGS}" != "x"; then
+       echo "XEN LDFLAGS             : ${XEN_LDFLAGS}"
+fi
+if test "x${XEN_LIBS}" != "x"; then
+       echo "XEN LIBS                : ${XEN_LIBS}"
+fi
+
 FLAGS_CPP="src/tools/nxdevcfg/flags.cpp"
 echo "/* Automatically generated by configure */" > $FLAGS_CPP
 echo "#include <nms_common.h>" >> $FLAGS_CPP
@@ -3503,3 +4158,6 @@ echo "const TCHAR *g_cxx = _T(\"${CXX}\");" >> $FLAGS_CPP
 echo "const TCHAR *g_ld = _T(\"${LD}\");" >> $FLAGS_CPP
 echo "const TCHAR *g_perl = _T(\"${PERL}\");" >> $FLAGS_CPP
 echo "const TCHAR *g_serverLibs = _T(\"${SERVER_LIBS}\");" >> $FLAGS_CPP
+echo "const TCHAR *g_tuxedoCppFlags = _T(\"${TUXEDO_CPPFLAGS}\");" >> $FLAGS_CPP
+echo "const TCHAR *g_tuxedoLdFlags = _T(\"${TUXEDO_LDFLAGS}\");" >> $FLAGS_CPP
+echo "const TCHAR *g_tuxedoLibs = _T(\"${TUXEDO_LIBS}\");" >> $FLAGS_CPP