support for struct dirent.d_type added to Linux readdir wrapper
[public/netxms.git] / configure.ac
index 329de97..c86a84d 100644 (file)
@@ -4,7 +4,7 @@
 # Configure script
 #
 
 # Configure script
 #
 
-AC_INIT([NetXMS], [2.1-M2], [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
 AC_CONFIG_AUX_DIR(config)
 AC_CONFIG_HEADERS(config.h)
 AM_INIT_AUTOMAKE
@@ -98,6 +98,11 @@ ZEROMQ_SUPPORT="no"
 ZEROMQ_REQUIRED="no"
 ZEROMQ_CPPFLAGS=""
 ZEROMQ_LDFLAGS=""
 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=""
 LDAP_SUPPORT="yes"
 DISABLE_READLINE="yes"
 TUXEDO_LIBS=""
@@ -292,7 +297,7 @@ AC_ARG_WITH(tuxedo,
 fi ])
 
 AC_ARG_WITH(zeromq,
 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"
 [ if test "x$withval" != "xno" ; then
        if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
                ZEROMQ_BASE="$withval"
@@ -304,6 +309,18 @@ else
        ZEROMQ_SUPPORT=no
 fi ])
 
        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
 AC_ARG_WITH(mongodb,
 [AS_HELP_STRING(--with-mongodb,build MongoDB-dependent components)],
 [ if test "x$withval" != "xno" ; then
@@ -624,7 +641,7 @@ 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"
 [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"
+       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="anysms kannel mymobile nexmo nxagent slack smseagle text2reach websms"
    HDLINK_DIRS="jira redmine"
        AGENT_DIRS="libnxtux"
        SMSDRV_DIRS="anysms kannel mymobile nexmo nxagent slack smseagle text2reach websms"
    HDLINK_DIRS="jira redmine"
@@ -1482,8 +1499,14 @@ else
                        [#if defined(__FreeBSD_cc_version) || defined(__OpenBSD__)
                                yes
                        #endif
                        [#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,
                        AC_MSG_RESULT(no))
                if test "x$PTHREAD_LIBS" = "xerror"; then
                        AC_CHECK_LIB(pthread, pthread_attr_init,
@@ -1589,6 +1612,8 @@ if test "x$DISABLE_ENCRYPTION" != "xyes" ; then
                                else
                                        AC_MSG_ERROR(lib$OPENSSL_LIBCRYPTO does not provide any suitable encryption algorithm)
                                fi
                                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)
                        ],
                        [
                                AC_MSG_ERROR(lib$OPENSSL_LIBCRYPTO is required for encryption support)
@@ -1654,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
 #--------------------------------------------------------------------
 
 # Checks for IPv6 support
 #--------------------------------------------------------------------
 
@@ -2983,6 +3038,7 @@ if test $? = 0; then
        fi
 fi
 
        fi
 fi
 
+
 #--------------------------------------------------------------------
 # ZeroMQ
 #--------------------------------------------------------------------
 #--------------------------------------------------------------------
 # ZeroMQ
 #--------------------------------------------------------------------
@@ -3024,6 +3080,49 @@ if test $? = 0; then
        LIBS="$OLD_LIBS"
 fi
 
        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
 #--------------------------------------------------------------------
 #--------------------------------------------------------------------
 # MongoDB
 #--------------------------------------------------------------------
@@ -3109,7 +3208,7 @@ else
        LDFLAGS_SUFFIX="$LDFLAGS_SUFFIX -R $RUNTIME_PREFIX/lib"
 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"
 
 if test "x${ENABLE_WERROR}" = "xyes"; then
        CPPFLAGS="$CPPFLAGS -Werror"
@@ -3143,6 +3242,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([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"])
 
 AM_CONDITIONAL([XMPP_SUPPORT], [test "x$XMPP_SUPPORT" = "xyes"])
 AM_CONDITIONAL([ZEROMQ_SUPPORT], [test "x$ZEROMQ_SUPPORT" = "xyes"])
 
@@ -3226,6 +3326,9 @@ AC_SUBST(TUXEDO_TPINIT)
 AC_SUBST(MONGODB_CPPFLAGS)
 AC_SUBST(MONGODB_LDFLAGS)
 AC_SUBST(MONGODB_LIBS)
 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(VMGR_CPPFLAGS)
 AC_SUBST(VMGR_LDFLAGS)
 AC_SUBST(VMGR_LIBS)
@@ -3279,6 +3382,7 @@ AC_CONFIG_FILES([
        contrib/mibs/Makefile
        contrib/music/Makefile
        contrib/startup/Makefile
        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
        contrib/startup/debian/Makefile
        contrib/startup/gentoo/Makefile
        contrib/startup/hp-ux/Makefile
@@ -3324,6 +3428,7 @@ AC_CONFIG_FILES([
        src/agent/subagents/lmsensors/Makefile
        src/agent/subagents/logwatch/Makefile
        src/agent/subagents/minix/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/mysql/Makefile
        src/agent/subagents/netbsd/Makefile
        src/agent/subagents/netsvc/Makefile
@@ -3398,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/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/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/lib/Makefile
        src/server/drivers/lib/avaya-ers/Makefile
        src/server/drivers/lib/cisco/Makefile
@@ -3505,6 +3613,11 @@ if test "x$IPV6_SUPPORT" = "xyes"; then
 else
        echo "IPv6 support            : NO"
 fi
 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}"
 if test "x${BUILD_SERVER}" = "xyes"; then
        echo "Build Server            : YES"
        echo "Server libs             : ${SERVER_LIBS}"