+ enable_strict="yes"
+ CFLAGS="${CFLAGS} -pedantic -Wall -Wextra -Wno-long-long"
+fi
+
+
+# -----------------------------------------------------------------------------
+# memory allocation library
+
+AC_MSG_CHECKING([for memory allocator])
+TS_CHECK_JEMALLOC
+if test "$has_jemalloc" = "1"; then
+ AC_DEFINE([ENABLE_JEMALLOC], [1], [compile and link with jemalloc])
+ AC_MSG_RESULT([jemalloc])
+else
+ TS_CHECK_TCMALLOC
+ if test "$has_tcmalloc" = "1"; then
+ AC_DEFINE([ENABLE_TCMALLOC], [1], [compile and link with tcmalloc])
+ AC_MSG_RESULT([tcmalloc])
+ else
+ AC_MSG_RESULT([system])
+ AC_C_MALLOPT
+ AC_C_MALLINFO
+ fi
+fi
+
+
+# -----------------------------------------------------------------------------
+# libcap
+
+PKG_CHECK_MODULES(
+ [LIBCAP],
+ [libcap],
+ [AC_CHECK_LIB([cap], [cap_get_proc, cap_set_proc],
+ [AC_CHECK_HEADER(
+ [sys/capability.h],
+ [have_libcap=yes],
+ [have_libcap=no]
+ )],
+ [have_libcap=no]
+ )],
+ [have_libcap=no]
+)
+test "${with_libcap}" = "yes" -a "${have_libcap}" != "yes" && AC_MSG_ERROR([libcap required but not found.])
+
+AC_MSG_CHECKING([if libcap should be used])
+if test "${with_libcap}" != "no" -a "${have_libcap}" = "yes"; then
+ with_libcap="yes"
+ AC_DEFINE([HAVE_CAPABILITY], [1], [libcap usability])
+ OPTIONAL_LIBCAP_CLFAGS="${LIBCAP_CFLAGS}"
+ OPTIONAL_LIBCAP_LIBS="${LIBCAP_LIBS}"
+else
+ with_libcap="no"
+fi
+AC_MSG_RESULT([${with_libcap}])
+AM_CONDITIONAL([ENABLE_CAPABILITY], [test "${with_libcap}" = "yes"])
+
+
+# -----------------------------------------------------------------------------
+# apps.plugin
+
+AC_MSG_CHECKING([if apps.plugin should be enabled])
+if test "${build_target}" != "macos"; then
+ enable_plugin_apps="yes"
+else
+ enable_plugin_apps="no"
+fi
+AC_MSG_RESULT([${enable_plugin_apps}])
+AM_CONDITIONAL([ENABLE_PLUGIN_APPS], [test "${enable_plugin_apps}" = "yes"])
+
+
+# -----------------------------------------------------------------------------
+# freeipmi.plugin - libipmimonitoring
+
+PKG_CHECK_MODULES(
+ [IPMIMONITORING],
+ [libipmimonitoring],
+ [have_ipmimonitoring=yes],
+ [have_ipmimonitoring=no]
+)
+test "${enable_plugin_freeipmi}" = "yes" -a "${have_ipmimonitoring}" != "yes" && \
+ AC_MSG_ERROR([ipmimonitoring required but not found. Try installing 'libipmimonitoring-dev' or 'libipmimonitoring-devel'])
+
+AC_MSG_CHECKING([if freeipmi.plugin should be enabled])
+if test "${enable_plugin_freeipmi}" != "no" -a "${have_ipmimonitoring}" = "yes"; then
+ enable_plugin_freeipmi="yes"
+ AC_DEFINE([HAVE_FREEIPMI], [1], [ipmimonitoring usability])
+ OPTIONAL_IPMIMONITORING_CLFAGS="${IPMIMONITORING_CFLAGS}"
+ OPTIONAL_IPMIMONITORING_LIBS="${IPMIMONITORING_LIBS}"
+else
+ enable_plugin_freeipmi="no"
+fi
+AC_MSG_RESULT([${enable_plugin_freeipmi}])
+AM_CONDITIONAL([ENABLE_PLUGIN_FREEIPMI], [test "${enable_plugin_freeipmi}" = "yes"])
+
+
+# -----------------------------------------------------------------------------
+# nfacct.plugin - libmnl, libnetfilter_acct
+
+AC_CHECK_HEADERS_ONCE([linux/netfilter/nfnetlink_conntrack.h])
+
+PKG_CHECK_MODULES(
+ [NFACCT],
+ [libnetfilter_acct],
+ [have_libnetfilter_acct=yes],
+ [have_libnetfilter_acct=no]
+)
+
+PKG_CHECK_MODULES(
+ [LIBMNL],
+ [libmnl],
+ [have_libmnl=yes],
+ [have_libmnl=no]
+)
+
+test "${enable_plugin_nfacct}" = "yes" -a "${have_libnetfilter_acct}" != "yes" && \
+ AC_MSG_ERROR([netfilter_acct required but not found])
+
+test "${enable_plugin_nfacct}" = "yes" -a "${have_libmnl}" != "yes" && \
+ AC_MSG_ERROR([libmnl required but not found. Try installing 'libmnl-dev' or 'libmnl-devel'])
+
+AC_MSG_CHECKING([if nfacct.plugin should be enabled])
+if test "${enable_plugin_nfacct}" != "no" -a "${have_libnetfilter_acct}" = "yes" -a "${have_libmnl}" = "yes"; then
+ enable_plugin_nfacct="yes"
+ AC_DEFINE([HAVE_LIBMNL], [1], [libmnl usability])
+ AC_DEFINE([HAVE_LIBNETFILTER_ACCT], [1], [libnetfilter_acct usability])
+ AC_DEFINE([INTERNAL_PLUGIN_NFACCT], [1], [nfacct plugin usability])
+ OPTIONAL_NFACCT_CLFAGS="${NFACCT_CFLAGS} ${LIBMNL_CFLAGS}"
+ OPTIONAL_NFACCT_LIBS="${NFACCT_LIBS} ${LIBMNL_LIBS}"
+else
+ enable_plugin_nfacct="no"
+fi
+AC_MSG_RESULT([${enable_plugin_nfacct}])
+AM_CONDITIONAL([ENABLE_PLUGIN_NFACCT], [test "${enable_plugin_nfacct}" = "yes"])
+
+
+# -----------------------------------------------------------------------------
+# Link-Time-Optimization
+
+if test "${enable_lto}" != "no"; then
+ opt="-flto"
+ AX_CHECK_COMPILE_FLAG(${opt}, [have_lto=yes], [have_lto=no])
+fi
+if test "${have_lto}" = "yes"; then
+ oCFLAGS="${CFLAGS}"
+ CFLAGS="${CFLAGS} -flto ${OPTIONAL_MATH_CLFAGS} ${OPTIONAL_NFACCT_CLFAGS} ${OPTIONAL_ZLIB_CLFAGS} ${OPTIONAL_UUID_CLFAGS} ${OPTIONAL_LIBCAP_CFLAGS} ${OPTIONAL_IPMIMONITORING_CFLAGS}"
+ ac_cv_c_lto_cross_compile="${enable_lto}"
+ test "${ac_cv_c_lto_cross_compile}" != "yes" && ac_cv_c_lto_cross_compile="no"
+ AC_C_LTO
+ CFLAGS="${oCFLAGS}"
+ test "${ac_cv_c_lto}" != "yes" && have_lto="no"
+fi
+test "${enable_lto}" = "yes" -a "${have_lto}" != "yes" && \
+ AC_MSG_ERROR([LTO is required but is not available.])
+AC_MSG_CHECKING([if LTO should be enabled])
+if test "${enable_lto}" != "no" -a "${have_lto}" = "yes"; then
+ enable_lto="yes"
+ CFLAGS="${CFLAGS} -flto"
+else
+ enable_lto="no"