support for struct dirent.d_type added to Linux readdir wrapper
[public/netxms.git] / configure.ac
index f44cbd0..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"
@@ -97,6 +98,11 @@ 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="yes"
 TUXEDO_LIBS=""
@@ -107,6 +113,8 @@ LIBVIRT_BASE=""
 DISABLE_IPV6="no"
 IPV6_SUPPORT="no"
 INSTALL_LIBPATH=""
+WITH_ENCRYPTION="no"
+DISABLE_COMMONCRYPTO="no"
 OPENSSL_LIBSSL="ssl"
 OPENSSL_LIBCRYPTO="crypto"
 
@@ -274,6 +282,7 @@ AC_ARG_WITH(jdk,
                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 ])
@@ -288,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"
@@ -300,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
@@ -484,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)],
 [
@@ -491,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)],
 [
@@ -604,16 +641,16 @@ 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 bind9 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 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"
        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"
 )
 
@@ -681,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
@@ -822,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"
@@ -832,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"
@@ -874,7 +922,7 @@ fi
 
 check_substr "$COMPONENTS" "java"
 if test $? = 0; then
-       SUBAGENT_DIRS="$SUBAGENT_DIRS java bind9 ubntlw"
+       SUBAGENT_DIRS="$SUBAGENT_DIRS java bind9 jmx ubntlw"
 fi
 
 check_substr "$COMPONENTS" "tuxedo"
@@ -898,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
 
@@ -1451,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,
@@ -1528,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
 
 
@@ -1570,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>
@@ -1616,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
 #--------------------------------------------------------------------
 
@@ -1823,19 +1916,25 @@ 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"
+  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
@@ -1892,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>
@@ -1923,8 +2029,8 @@ 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([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])
 
@@ -2177,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>
@@ -2280,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
@@ -2931,6 +3038,7 @@ if test $? = 0; then
        fi
 fi
 
+
 #--------------------------------------------------------------------
 # ZeroMQ
 #--------------------------------------------------------------------
@@ -2972,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
 #--------------------------------------------------------------------
@@ -3031,6 +3182,8 @@ if test $? = 0; then
        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"
@@ -3054,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"
@@ -3086,8 +3240,9 @@ 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"])
 
@@ -3097,7 +3252,7 @@ AM_CONDITIONAL([ZEROMQ_SUPPORT], [test "x$ZEROMQ_SUPPORT" = "xyes"])
 #--------------------------------------------------------------------
 
 COMPILER_VERSION=""
-for opt in --version -v -V -qversion; do
+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
@@ -3121,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
 #--------------------------------------------------------------------
@@ -3170,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)
@@ -3223,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
@@ -3263,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
@@ -3311,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
@@ -3353,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
@@ -3369,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
@@ -3385,6 +3539,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
@@ -3457,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}"
@@ -3478,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"