support for struct dirent.d_type added to Linux readdir wrapper
[public/netxms.git] / configure.ac
index 19fd96c..c86a84d 100644 (file)
@@ -4,7 +4,7 @@
 # Configure script
 #
 
-AC_INIT([NetXMS], [2.1-M1], [bugs@netxms.org])
+AC_INIT([NetXMS], [2.1-RC1], [bugs@netxms.org])
 AC_CONFIG_AUX_DIR(config)
 AC_CONFIG_HEADERS(config.h)
 AM_INIT_AUTOMAKE
@@ -48,6 +48,7 @@ COMPONENTS=""
 DISABLE_ICONV="no"
 DISABLE_ENCRYPTION="no"
 DISABLE_LMSENSORS="no"
+DISABLE_SSH="no"
 ENABLE_DEBUG="no"
 ENABLE_WERROR="no"
 STATIC_BUILD="no"
@@ -74,8 +75,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 +94,27 @@ 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="yes"
+MQTT_REQUIRED="no"
+MQTT_CPPFLAGS=""
+MQTT_LDFLAGS=""
+MQTT_LIBS=""
 LDAP_SUPPORT="yes"
-DISABLE_READLINE="no"
+DISABLE_READLINE="yes"
 TUXEDO_LIBS=""
 TUXEDO_TPINIT=""
 MONGODB_LIBS=""
 VMGR_LIBS=""
+LIBVIRT_BASE=""
 DISABLE_IPV6="no"
 IPV6_SUPPORT="no"
 INSTALL_LIBPATH=""
+WITH_ENCRYPTION="no"
+DISABLE_COMMONCRYPTO="no"
 OPENSSL_LIBSSL="ssl"
 OPENSSL_LIBCRYPTO="crypto"
 
@@ -266,9 +276,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 ])
@@ -283,7 +297,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"
@@ -295,6 +309,18 @@ else
        ZEROMQ_SUPPORT=no
 fi ])
 
+AC_ARG_WITH(mqtt,
+[AS_HELP_STRING(--with-mqtt,build with MQTT support)],
+[ if test "x$withval" != "xno" ; then
+       if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
+               MQTT_BASE="$withval"
+               MQTT_REQUIRED=yes
+       fi
+       MQTT_SUPPORT=yes
+else
+       MQTT_SUPPORT=no
+fi ])
+
 AC_ARG_WITH(mongodb,
 [AS_HELP_STRING(--with-mongodb,build MongoDB-dependent components)],
 [ if test "x$withval" != "xno" ; then
@@ -305,12 +331,17 @@ AC_ARG_WITH(mongodb,
 fi ])
 
 AC_ARG_WITH(vmgr,
-[AS_HELP_STRING(--with-vmgr,build VirtualHost managmet subagent)],
+[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
-               VMGR_BASE="$withval"
+               LIBVIRT_BASE="$withval"
        fi
-       COMPONENTS="$COMPONENTS vmgr"
 fi ])
 
 AC_ARG_WITH(sqlite,
@@ -474,6 +505,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)],
 [
@@ -481,6 +520,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)],
 [
@@ -497,13 +544,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,
@@ -514,75 +565,92 @@ 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_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 ssh vmgr"
+       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"
        AGENT_DIRS="libnxtux"
-       SMSDRV_DIRS="kannel nxagent slack 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"
        SERVER_INCLUDE="include"
        CONTRIB_MODULES="mibs backgrounds music templates"
-       CLIENT_COMPONENTS="nxalarm nxevent nxpush nxsms"
+       CLIENT_COMPONENTS="nxalarm nxevent nxpush nxshell nxsms"
        SERVER_TOOLS="nxconfig"
 )
 
@@ -650,16 +718,22 @@ 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
@@ -791,6 +865,10 @@ if test $? = 0; then
        BUILD_CLIENT="yes"
        MODULES="$MODULES client"
        CLIENT_COMPONENTS="$CLIENT_COMPONENTS nxalarm nxevent nxpush nxsms"
+       check_substr "$COMPONENTS" "java"
+       if test $? = 0; then
+               CLIENT_COMPONENTS="$CLIENT_COMPONENTS nxshell"
+       fi
 fi
 
 check_substr "$COMPONENTS" "client-proxy"
@@ -801,6 +879,7 @@ fi
 check_substr "$COMPONENTS" "mysql"
 if test $? = 0; then
        DB_DRIVERS="$DB_DRIVERS mysql"
+       SUBAGENT_DIRS="$SUBAGENT_DIRS mysql"
 fi
 
 check_substr "$COMPONENTS" "pgsql"
@@ -843,7 +922,7 @@ fi
 
 check_substr "$COMPONENTS" "java"
 if test $? = 0; then
-       SUBAGENT_DIRS="$SUBAGENT_DIRS java ubntlw"
+       SUBAGENT_DIRS="$SUBAGENT_DIRS java bind9 jmx ubntlw"
 fi
 
 check_substr "$COMPONENTS" "tuxedo"
@@ -867,7 +946,7 @@ if test $? = 0; then
        if test "x$STATIC_BUILD" = "xyes"; then
                MODULES="$MODULES appagent libnxmap client libnxmb"
        else
-               MODULES="$MODULES appagent libnxmap client libnxsl libnxmb libnxlp libnxcc db nxscript smsdrv"
+               MODULES="$MODULES appagent libnxmap client libnxsl libnxmb libnxlp libnxcc db nxscript smsdrv snmp"
        fi
 fi
 
@@ -1420,8 +1499,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,
@@ -1497,34 +1582,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
 
 
@@ -1539,7 +1633,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>
@@ -1585,6 +1679,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
 #--------------------------------------------------------------------
 
@@ -1606,6 +1730,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.
 #--------------------------------------------------------------------
@@ -1776,19 +1916,25 @@ 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"
+  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
 
-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$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)
+       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
 
 if test "x$LDAP_SUPPORT" = "xyes"; then
@@ -1845,7 +1991,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>
@@ -1874,10 +2027,10 @@ 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([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])
-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 getgrnam getpwnam malloc_info malloc_trim utime])
 
 AC_CHECK_DECLS([nanosleep, daemon, strerror])
 
@@ -1978,7 +2131,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
@@ -2130,8 +2283,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>
@@ -2213,6 +2367,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
@@ -2229,7 +2387,7 @@ 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_DECLS([putws],,,[
 #if HAVE_WCHAR_H
@@ -2696,7 +2854,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"
@@ -2876,6 +3038,7 @@ if test $? = 0; then
        fi
 fi
 
+
 #--------------------------------------------------------------------
 # ZeroMQ
 #--------------------------------------------------------------------
@@ -2917,6 +3080,49 @@ if test $? = 0; then
        LIBS="$OLD_LIBS"
 fi
 
+
+#--------------------------------------------------------------------
+# MQTT
+#--------------------------------------------------------------------
+
+if test "x$MQTT_SUPPORT" = "xyes"; then
+       OLD_CPPFLAGS="$CPPFLAGS"
+       OLD_LDFLAGS="$LDFLAGS"
+       OLD_LIBS="$LIBS"
+
+       if test "x$MQTT_BASE" != "x"; then
+               MQTT_CPPFLAGS="-I$MQTT_BASE/include"
+               MQTT_LDFLAGS="-L$MQTT_BASE/lib"
+               CPPFLAGS="$CPPFLAGS $MQTT_CPPFLAGS"
+               LDFLAGS="$LDFLAGS $MQTT_LDFLAGS"
+       fi
+       
+       AC_CHECK_HEADER(mosquitto.h,,[
+               if test "x$MQTT_REQUIRED" = "xyes"; then
+                       AC_MSG_ERROR([*** Cannot find mosquitto.h - check your libmosquitto installation ***])
+               else
+                       MQTT_SUPPORT="no"
+               fi
+       ])
+       AC_CHECK_LIB(mosquitto, mosquitto_lib_init, [ MQTT_LIBS="-lmosquitto" ], [
+               if test "x$MQTT_REQUIRED" = "xyes"; then
+                       AC_MSG_ERROR([*** libmosquitto is missing - check your libmosquitto installation ***])
+               else
+                       MQTT_SUPPORT="no"
+               fi
+       ])
+    
+       if test "x$MQTT_SUPPORT" = "xyes"; then
+               AC_DEFINE(WITH_MQTT, 1, Define to 1 if MQTT is supported)
+               SUBAGENT_DIRS="$SUBAGENT_DIRS mqtt"
+       fi
+
+       CPPFLAGS="$OLD_CPPFLAGS"
+       LDFLAGS="$OLD_LDFLAGS"
+       LIBS="$OLD_LIBS"
+fi
+
+
 #--------------------------------------------------------------------
 # MongoDB
 #--------------------------------------------------------------------
@@ -2960,22 +3166,24 @@ if test $? = 0; then
        OLD_LDFLAGS="$LDFLAGS"
        OLD_LIBS="$LIBS"
 
-       if test "x$VMGR_BASE" != "x"; then
-               VMGR_CPPFLAGS="-I$VMGR_BASE/include/libvirt/"
-               VMGR_LDFLAGS="-L$VMGR_BASE/lib"
+       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="-I/usr/include/libvirt/"
-               VMGR_LDFLAGS="-L/usr/lib"
+               VMGR_CPPFLAGS=""
+               VMGR_LDFLAGS=""
                CPPFLAGS="$CPPFLAGS $VMGR_CPPFLAGS"
                LDFLAGS="$LDFLAGS $VMGR_LDFLAGS"
        fi
        
-       AC_CHECK_HEADER(libvirt.h,,AC_MSG_ERROR([*** Cannot find libvirt.h - check your libvirt installation ***]))
+       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"
@@ -2999,7 +3207,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"
@@ -3031,13 +3240,30 @@ AM_CONDITIONAL([USE_INTERNAL_SQLITE], [test "x$HAVE_SQLITE" = "xno"])
 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([ZEROMQ_SUPPORT], [test "x$ZEROMQ_SUPPORT" = "xyes"])
 
 
 #--------------------------------------------------------------------
+# Get compiler version
+#--------------------------------------------------------------------
+
+COMPILER_VERSION=""
+for opt in -qversion --version -v -V; do
+       v=`$CXX $opt 2>/dev/null | 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
+       fi
+done
+
+
+#--------------------------------------------------------------------
 # Cleanup variables
 #--------------------------------------------------------------------
 
@@ -3050,6 +3276,7 @@ AS_IF([test "x$with_dist" = "xyes"],
   HDLINK_DIRS=`echo $HDLINK_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
 ])
 
+
 #--------------------------------------------------------------------
 # Substitute variables
 #--------------------------------------------------------------------
@@ -3099,6 +3326,9 @@ 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)
@@ -3152,6 +3382,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
@@ -3177,6 +3408,7 @@ AC_CONFIG_FILES([
        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
@@ -3191,25 +3423,13 @@ 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/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
@@ -3239,6 +3459,8 @@ AC_CONFIG_FILES([
        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
@@ -3281,8 +3503,11 @@ 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
@@ -3297,6 +3522,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
@@ -3310,14 +3536,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
@@ -3381,6 +3613,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}"
@@ -3402,7 +3639,7 @@ 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"
@@ -3476,6 +3713,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}"
@@ -3567,10 +3805,13 @@ if test "x${ZEROMQ_LDFLAGS}" != "x"; then
 fi
 
 if test "x${VMGR_CPPFLAGS}" != "x"; then
-       echo "Vmgr CPPFLAGS     : ${VMGR_CPPFLAGS}"
+       echo "Vmgr CPPFLAGS           : ${VMGR_CPPFLAGS}"
 fi
 if test "x${VMGR_LDFLAGS}" != "x"; then
-       echo "Vmgr LDFLAGS         : ${VMGR_LDFLAGS}"
+       echo "Vmgr LDFLAGS            : ${VMGR_LDFLAGS}"
+fi
+if test "x${VMGR_LIBS}" != "x"; then
+       echo "Vmgr LIBS               : ${VMGR_LIBS}"
 fi
 
 FLAGS_CPP="src/tools/nxdevcfg/flags.cpp"