Implemented Debug Tag functionality
[public/netxms.git] / configure.ac
index 8787679..f5379aa 100644 (file)
@@ -4,7 +4,7 @@
 # Configure script
 #
 
-AC_INIT([NetXMS], [2.1-M2], [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
@@ -98,13 +98,24 @@ 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="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=""
@@ -292,7 +303,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"
@@ -304,6 +315,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
@@ -327,6 +362,12 @@ AC_ARG_WITH(libvirt,
        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
@@ -391,7 +432,7 @@ AC_ARG_WITH(mysql,
                        MYSQL_LD_RUN_PATH="$__dir$"    
                        MYSQL_LDFLAGS="-L$__dir"
                fi
-               if find_existing_dir "/usr/local/mysql/include" "/usr/include/mysql" "/usr/mysql/include" "/usr/local/include/mysql" "/usr/local/mysql/include/mysql" "/usr/mysql/include/mysql"; then
+               if find_existing_dir "/usr/local/mysql/include" "/usr/include/mysql" "/usr/mysql/include" "/usr/local/include/mysql" "/usr/local/mysql/include/mysql" "/usr/mysql/include/mysql" "/usr/include/mariadb"; then
                        MYSQL_CPPFLAGS="-I$__dir"
                fi
        fi
@@ -399,6 +440,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"; then
+                       MARIADB_LD_RUN_PATH="$__dir$"    
+                       MARIADB_LDFLAGS="-L$__dir"
+               fi
+               if find_existing_dir "${withval}/include" "${withval}/include/mariadb" "${withval}/mariadb/include"; then
+                       MARIADB_CPPFLAGS="-I$__dir"
+               fi
+       else
+               if find_existing_dir "/usr/local/mariadb/lib"; 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"; 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
@@ -578,6 +643,12 @@ AC_ARG_ENABLE(xmpp,
        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)],
 [
@@ -622,12 +693,12 @@ AC_ARG_ENABLE(64bit,
 
 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 mysql netbsd sunos aix ipso hpux odbcquery informix oracle lmsensors darwin rpi java jmx bind9 ubntlw netsvc db2 tuxedo mongodb ssh vmgr"
+       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="kannel mymobile nexmo nxagent slack smseagle text2reach websms"
-   HDLINK_DIRS="jira"
+       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"
@@ -637,12 +708,6 @@ AC_ARG_WITH(dist,
        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)],
 [
@@ -671,6 +736,12 @@ if test $? = 0; then
        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
@@ -678,7 +749,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
@@ -721,47 +792,47 @@ if test $? = 0; then
 
        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"
                        ;;
@@ -784,42 +855,42 @@ 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
@@ -833,7 +904,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"
@@ -865,6 +936,11 @@ if test $? = 0; then
        SUBAGENT_DIRS="$SUBAGENT_DIRS mysql"
 fi
 
+check_substr "$COMPONENTS" "mariadb"
+if test $? = 0; then
+       DB_DRIVERS="$DB_DRIVERS mariadb"
+fi
+
 check_substr "$COMPONENTS" "pgsql"
 if test $? = 0; then
        DB_DRIVERS="$DB_DRIVERS pgsql"
@@ -903,11 +979,6 @@ if test $? = 0; then
        SUBAGENT_DIRS="$SUBAGENT_DIRS rpi"
 fi
 
-check_substr "$COMPONENTS" "java"
-if test $? = 0; then
-       SUBAGENT_DIRS="$SUBAGENT_DIRS java bind9 jmx ubntlw"
-fi
-
 check_substr "$COMPONENTS" "tuxedo"
 if test $? = 0; then
        AGENT_DIRS="$AGENT_DIRS libnxtux"
@@ -924,12 +995,17 @@ 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 snmp"
+               MODULES="$MODULES appagent client libnxsl libnxlp libnxcc db nxscript smsdrv snmp"
        fi
 fi
 
@@ -1008,6 +1084,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"
@@ -1017,6 +1094,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"
@@ -1482,8 +1569,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,
@@ -1589,6 +1682,8 @@ if test "x$DISABLE_ENCRYPTION" != "xyes" ; then
                                else
                                        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)
@@ -1608,7 +1703,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 stdbool.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>
@@ -1623,6 +1718,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
 #--------------------------------------------------------------------
 
@@ -1654,6 +1774,36 @@ 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
 #--------------------------------------------------------------------
 
@@ -1849,21 +1999,25 @@ 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
+               ])
+       fi
 
-if test "x$HAVE_LIBCURL" = "xyes"; then
-  SUBAGENT_DIRS="$SUBAGENT_DIRS netsvc"
-  SMSDRV_DIRS="$SMSDRV_DIRS kannel mymobile nexmo slack smseagle text2reach websms"
-  HDLINK_DIRS="$HDLINK_DIRS jira"
-  AC_DEFINE(HAVE_LIBCURL, 1, Define to 1 if libcurl is available)
+       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$DISABLE_SSH" != "xyes"; then
@@ -1975,7 +2129,8 @@ AC_CHECK_FUNCS([strrchr strlwr strtok_r strtol strtoul strtoll strtoull setlocal
 AC_CHECK_FUNCS([tolower if_nametoindex daemon mmap strerror_r scandir uname poll])
 AC_CHECK_FUNCS([usleep nanosleep gmtime_r localtime_r stat64 fstat64 lstat64])
 AC_CHECK_FUNCS([fopen64 strptime timegm gethostbyname2_r getaddrinfo rand_r])
-AC_CHECK_FUNCS([itoa _itoa isatty getgrnam getpwnam malloc_info malloc_trim])
+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])
 
@@ -2260,10 +2415,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>
         ]],[[
@@ -2283,6 +2444,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>
         ]],[[
@@ -2332,7 +2494,8 @@ 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_DECLS([putws],,,[
 #if HAVE_WCHAR_H
@@ -2760,7 +2923,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"
@@ -2775,6 +2940,35 @@ 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
 #--------------------------------------------------------------------
 
@@ -2983,6 +3177,7 @@ if test $? = 0; then
        fi
 fi
 
+
 #--------------------------------------------------------------------
 # ZeroMQ
 #--------------------------------------------------------------------
@@ -3024,6 +3219,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
 #--------------------------------------------------------------------
@@ -3057,6 +3286,7 @@ if test $? = 0; then
        LIBS="$OLD_LIBS"
 fi
 
+
 #--------------------------------------------------------------------
 # VMGR
 #--------------------------------------------------------------------
@@ -3090,6 +3320,38 @@ if test $? = 0; then
        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
 #--------------------------------------------------------------------
@@ -3109,7 +3371,7 @@ else
        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"
@@ -3143,6 +3405,7 @@ AM_CONDITIONAL([STATIC_BUILD], [test "x$STATIC_BUILD" = "xyes"])
 AM_CONDITIONAL([ALL_STATIC], [test "x$ALL_STATIC" = "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([ZEROMQ_SUPPORT], [test "x$ZEROMQ_SUPPORT" = "xyes"])
 
@@ -3152,15 +3415,22 @@ AM_CONDITIONAL([ZEROMQ_SUPPORT], [test "x$ZEROMQ_SUPPORT" = "xyes"])
 #--------------------------------------------------------------------
 
 COMPILER_VERSION=""
-for opt in --version -v -V -qversion; do
-       v=`$CXX $opt 2>/dev/null | head -1`
+if test "$CXX" = "CC"; then
+       v=`$CXX -V 2>&1 | head -1`
        if test $? = 0; then
-               if test "x$COMPILER_VERSION" = "x"; then
-                       COMPILER_VERSION="$v"
-                       AC_DEFINE_UNQUOTED([CPP_COMPILER_VERSION], "$COMPILER_VERSION", [C++ compiler version information])
-               fi
+               COMPILER_VERSION="$v"
        fi
-done
+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])
 
 
 #--------------------------------------------------------------------
@@ -3201,6 +3471,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)
@@ -3216,6 +3489,7 @@ 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)
@@ -3226,10 +3500,15 @@ AC_SUBST(TUXEDO_TPINIT)
 AC_SUBST(MONGODB_CPPFLAGS)
 AC_SUBST(MONGODB_LDFLAGS)
 AC_SUBST(MONGODB_LIBS)
+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(INSTALL_LIBPATH)
+AC_SUBST(XEN_CPPFLAGS)
+AC_SUBST(XEN_LDFLAGS)
+AC_SUBST(XEN_LIBS)
 AC_SUBST(ZEROMQ_CPPFLAGS)
 AC_SUBST(ZEROMQ_LDFLAGS)
 
@@ -3279,6 +3558,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
@@ -3293,6 +3573,7 @@ AC_CONFIG_FILES([
        doc/misc/Makefile
        images/Makefile
        include/Makefile
+       include/msvc/Makefile
        m4/Makefile
        src/Makefile
        src/agent/Makefile
@@ -3323,7 +3604,9 @@ AC_CONFIG_FILES([
        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
@@ -3344,6 +3627,7 @@ AC_CONFIG_FILES([
        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
@@ -3362,6 +3646,7 @@ AC_CONFIG_FILES([
        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
@@ -3375,8 +3660,9 @@ AC_CONFIG_FILES([
        src/libexpat/libexpat/Makefile
        src/libnetxms/Makefile
        src/libnxcc/Makefile
+       src/libnxjava/Makefile
+       src/libnxjava/java/Makefile
        src/libnxlp/Makefile
-       src/libnxmap/Makefile
        src/libnxmb/Makefile
        src/libnxsl/Makefile
        src/libstrophe/Makefile
@@ -3398,12 +3684,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
@@ -3414,6 +3704,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
@@ -3430,6 +3721,8 @@ AC_CONFIG_FILES([
        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
@@ -3502,6 +3795,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}"
@@ -3545,8 +3843,8 @@ else
 fi
 if test "x${BUILD_AGENT}" = "xyes"; then
        echo "Build Agent             : YES"
-       echo "Agent extra components  : ${AGENT_DIRS}"
-       echo "Subagents list          : ${SUBAGENT_DIRS}"
+       echo "Agent extra components  :${AGENT_DIRS}"
+       echo "Subagents list          :${SUBAGENT_DIRS}"
 else
        echo "Build Agent             : NO"
 fi
@@ -3614,6 +3912,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
@@ -3698,6 +4006,16 @@ 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