Implemented Debug Tag functionality
[public/netxms.git] / configure.ac
index 78a56f3..f5379aa 100644 (file)
@@ -4,7 +4,7 @@
 # Configure script
 #
 
-AC_INIT([NetXMS], [2.1-RC1], [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
@@ -109,8 +109,13 @@ 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=""
@@ -329,7 +334,7 @@ AC_ARG_ENABLE(mqtt,
 AC_ARG_WITH(curl,
 [AS_HELP_STRING(--without-curl,build without curl)],
 [
-       if test "x$enableval" = "xno"; then
+       if test "x$withval" = "xno"; then
                DISABLE_CURL="yes"
        fi
 ])
@@ -357,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
@@ -683,8 +694,8 @@ AC_ARG_ENABLE(64bit,
 AC_ARG_WITH(dist,
 [AS_HELP_STRING(--with-dist,for maintainers only)],
        DB_DRIVERS="mysql mariadb 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 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"
+       MODULES="appagent jansson libexpat libstrophe libtre zlib libnetxms libnxjava install sqlite snmp libnxsl libnxmb libnxlp libnxcc db server smsdrv agent client nxscript nxcproxy nxlptest tools"
+       SUBAGENT_DIRS="linux ds18x20 freebsd openbsd minix mqtt mysql netbsd sunos aix ipso hpux odbcquery informix oracle lmsensors darwin rpi java jmx bind9 ubntlw netsvc db2 tuxedo mongodb ssh vmgr xen lorawan"
        AGENT_DIRS="libnxtux"
        SMSDRV_DIRS="anysms kannel mymobile nexmo nxagent slack smseagle text2reach websms"
    HDLINK_DIRS="jira redmine"
@@ -725,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
@@ -732,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
@@ -775,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"
                        ;;
@@ -838,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
@@ -962,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"
@@ -983,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 client libnxmb"
+               MODULES="$MODULES appagent client"
        else
-               MODULES="$MODULES appagent client libnxsl libnxmb libnxlp libnxcc db nxscript smsdrv snmp"
+               MODULES="$MODULES appagent client libnxsl libnxlp libnxcc db nxscript smsdrv snmp"
        fi
 fi
 
@@ -1067,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"
@@ -1076,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"
@@ -1690,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
 #--------------------------------------------------------------------
 
@@ -2076,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 utime])
+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])
 
@@ -2361,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>
         ]],[[
@@ -2384,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>
         ]],[[
@@ -2434,6 +2495,7 @@ 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 wutime])
+AC_CHECK_FUNCS([wprintf vwprintf swprintf vswprintf fwprintf vfwprintf])
 
 AC_CHECK_DECLS([putws],,,[
 #if HAVE_WCHAR_H
@@ -3258,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
 #--------------------------------------------------------------------
@@ -3321,15 +3415,22 @@ AM_CONDITIONAL([ZEROMQ_SUPPORT], [test "x$ZEROMQ_SUPPORT" = "xyes"])
 #--------------------------------------------------------------------
 
 COMPILER_VERSION=""
-for opt in -qversion --version -v -V; 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])
 
 
 #--------------------------------------------------------------------
@@ -3388,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)
@@ -3404,7 +3506,9 @@ 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)
 
@@ -3469,6 +3573,7 @@ AC_CONFIG_FILES([
        doc/misc/Makefile
        images/Makefile
        include/Makefile
+       include/msvc/Makefile
        m4/Makefile
        src/Makefile
        src/agent/Makefile
@@ -3499,6 +3604,7 @@ 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
@@ -3521,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
@@ -3553,6 +3660,8 @@ AC_CONFIG_FILES([
        src/libexpat/libexpat/Makefile
        src/libnetxms/Makefile
        src/libnxcc/Makefile
+       src/libnxjava/Makefile
+       src/libnxjava/java/Makefile
        src/libnxlp/Makefile
        src/libnxmb/Makefile
        src/libnxsl/Makefile
@@ -3584,6 +3693,7 @@ AC_CONFIG_FILES([
        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
@@ -3733,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
@@ -3896,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