Merge pull request #1743 from rubenk/apcups-coverity
[collectd.git] / configure.ac
index cd38b71..a85d2e1 100644 (file)
@@ -31,7 +31,7 @@ m4_ifdef([LT_PACKAGE_VERSION],
 
 AM_CONDITIONAL([BUILD_INCLUDED_LTDL], [test "x$LTDLDEPS" != "x"])
 
-AM_INIT_AUTOMAKE([subdir-objects tar-pax dist-bzip2 foreign])
+AM_INIT_AUTOMAKE([subdir-objects tar-pax dist-bzip2 no-dist-gzip foreign])
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 AC_LANG(C)
 
@@ -57,6 +57,8 @@ AC_PROG_LIBTOOL
 AC_PROG_LEX
 AC_PROG_YACC
 
+AC_PATH_PROG([VALGRIND], [valgrind])
+
 # Warn when pkg.m4 is missing
 m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
 
@@ -86,11 +88,9 @@ if test "x$PROTOC" != "x"; then
        fi
        AC_MSG_RESULT([$protoc3])
 fi
-AC_SUBST([PROTOC])
 AM_CONDITIONAL(HAVE_PROTOC3, test "x$have_protoc3" = "xyes")
 
 AC_PATH_PROG([GRPC_CPP_PLUGIN], [grpc_cpp_plugin])
-AC_SUBST([GRPC_CPP_PLUGIN])
 AM_CONDITIONAL(HAVE_GRPC_CPP, test "x$GRPC_CPP_PLUGIN" != "x")
 
 AC_CHECK_PROG([have_protoc_c], [protoc-c], [yes], [no])
@@ -800,12 +800,14 @@ AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr
 AC_FUNC_STRERROR_R
 
 test_cxx_flags() {
-       AC_LANG_PUSH(C++)
-       AC_LANG_CONFTEST([int main(void){}])
+       AC_LANG_PUSH([C++])
+       AC_LANG_CONFTEST([
+               AC_LANG_SOURCE([[int main(void){}]])
+       ])
        $CXX -c conftest.cpp $CXXFLAGS $@ > /dev/null 2> /dev/null
        ret=$?
        rm -f conftest.o
-       AC_LANG_POP(C++)
+       AC_LANG_POP([C++])
        return $ret
 }
 
@@ -1633,45 +1635,21 @@ if test "x$with_libhal" = "xyes"; then
        fi
 fi
 
-# --with-libpthread {{{
-AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
-[      if test "x$withval" != "xno" \
-               && test "x$withval" != "xyes"
-       then
-               LDFLAGS="$LDFLAGS -L$withval/lib"
-               CPPFLAGS="$CPPFLAGS -I$withval/include"
-               with_libpthread="yes"
-       else
-               if test "x$withval" = "xno"
-               then
-                       with_libpthread="no (disabled)"
-               fi
-       fi
-], [with_libpthread="yes"])
+SAVE_LIBS="$LIBS"
+AC_CHECK_LIB([pthread],
+  [pthread_create],
+  [],
+  [AC_MSG_ERROR([Symbol 'pthread_create' not found in libpthread"])],
+  []
+)
+PTHREAD_LIBS="$LIBS"
+LIBS="$SAVE_LIBS"
 
+AC_CHECK_HEADERS([pthread.h],
+  [],
+  [AC_MSG_ERROR([pthread.h not found])]
+)
 AC_SUBST([PTHREAD_LIBS])
-if test "x$with_libpthread" = "xyes"
-then
-       SAVE_LIBS="$LIBS"
-       AC_CHECK_LIB(pthread, pthread_create, [], [with_libpthread="no (Symbol 'pthread_create' not found)"], [])
-       PTHREAD_LIBS="$LIBS"
-       LIBS="$SAVE_LIBS"
-fi
-
-if test "x$with_libpthread" = "xyes"
-then
-       AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
-fi
-if test "x$with_libpthread" = "xyes"
-then
-       collect_pthread=1
-else
-       collect_pthread=0
-fi
-AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
-       [Wether or not to use pthread (POSIX threads) library])
-AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
-# }}}
 
 m4_divert_once([HELP_WITH], [
 collectd additional packages:])
@@ -1986,7 +1964,6 @@ then
                AC_DEFINE(HAVE_CURLOPT_TIMEOUT_MS, 1, [Define if libcurl supports CURLOPT_TIMEOUT_MS option.])
        fi
 fi
-AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
 # }}}
 
 # --with-libdbi {{{
@@ -3452,9 +3429,9 @@ then
 fi
 if test "x$with_oracle" = "xyes"
 then
-       BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
+       BUILD_WITH_ORACLE_CPPFLAGS="$with_oracle_cppflags"
        BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
-       AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
+       AC_SUBST(BUILD_WITH_ORACLE_CPPFLAGS)
        AC_SUBST(BUILD_WITH_ORACLE_LIBS)
 fi
 # }}}
@@ -4861,6 +4838,10 @@ then
 
        CPPFLAGS="$SAVE_CPPFLAGS"
        LDFLAGS="$SAVE_LDFLAGS"
+       LIBXENCTL_CPPFLAGS="$with_libxenctl_cppflags"
+       LIBXENCTL_LDFLAGS="$with_libxenctl_ldflags"
+       AC_SUBST(LIBXENCTL_CPPFLAGS)
+       AC_SUBST(LIBXENCTL_LDFLAGS)
 fi
 
 # --with-libxmms {{{
@@ -5936,6 +5917,7 @@ AC_PLUGIN([battery],             [$plugin_battery],         [Battery statistics]
 AC_PLUGIN([bind],                [$plugin_bind],            [ISC Bind nameserver statistics])
 AC_PLUGIN([ceph],                [$plugin_ceph],            [Ceph daemon statistics])
 AC_PLUGIN([cgroups],             [$plugin_cgroups],         [CGroups CPU usage accounting])
+AC_PLUGIN([chrony],              [yes],                     [Chrony statistics])
 AC_PLUGIN([conntrack],           [$plugin_conntrack],       [nf_conntrack statistics])
 AC_PLUGIN([contextswitch],       [$plugin_contextswitch],   [context switch statistics])
 AC_PLUGIN([cpu],                 [$plugin_cpu],             [CPU usage statistics])
@@ -6219,7 +6201,7 @@ AM_CXXFLAGS="-Wall"
 if test "x$enable_werror" != "xno"
 then
         AM_CFLAGS="$AM_CFLAGS -Werror"
-        AM_CXXFLAGS="$AM_CFLAGS -Werror"
+        AM_CXXFLAGS="$AM_CXXFLAGS -Werror"
 fi
 AC_SUBST([AM_CFLAGS])
 AC_SUBST([AM_CXXFLAGS])
@@ -6305,7 +6287,6 @@ Configuration:
     libperfstat . . . . . $with_perfstat
     libperl . . . . . . . $with_libperl
     libpq . . . . . . . . $with_libpq
-    libpthread  . . . . . $with_libpthread
     librabbitmq . . . . . $with_librabbitmq
     libriemann-client . . $with_libriemann_client
     librdkafka  . . . . . $with_librdkafka
@@ -6348,6 +6329,7 @@ Configuration:
     bind  . . . . . . . . $enable_bind
     ceph  . . . . . . . . $enable_ceph
     cgroups . . . . . . . $enable_cgroups
+    chrony. . . . . . . . $enable_chrony
     conntrack . . . . . . $enable_conntrack
     contextswitch . . . . $enable_contextswitch
     cpu . . . . . . . . . $enable_cpu