From: Florian Forster Date: Mon, 18 Aug 2014 07:35:04 +0000 (+0200) Subject: Merge branch 'collectd-5.3' into collectd-5.4 X-Git-Tag: collectd-5.4.2~23 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=fd7673e5e9ad074624fc23cda5d2ec4549d43659;hp=96e0f2341bace029acefe0a88bab96ae326c0ff5;p=collectd.git Merge branch 'collectd-5.3' into collectd-5.4 Conflicts: contrib/redhat/collectd.spec --- diff --git a/.gitignore b/.gitignore index 6e87aaf2..7c7c848f 100644 --- a/.gitignore +++ b/.gitignore @@ -33,11 +33,12 @@ src/stamp-h1 .libs/ src/collectd src/collectd-nagios +src/collectd-tg src/collectdctl src/collectdmon src/*.1 src/*.5 -src/libcollectdclient/lcc_features.h +src/libcollectdclient/collectd/lcc_features.h # patch stuff *.rej diff --git a/AUTHORS b/AUTHORS index 45645d1a..31d132fb 100644 --- a/AUTHORS +++ b/AUTHORS @@ -21,6 +21,9 @@ Akkarit Sangpetch Alessandro Iurlano - Initial filecount plugin. +Alex Deymo + - aquaero plugin. + Alvaro Barcellos - Don't-fork patch. @@ -28,6 +31,9 @@ Amit Gupta - Multiple servers in the apache plugin. - curl_xml plugin. +Andreas Henriksson + - libmnl support in the netlink plugin. + Anthony Dewhurst - zfs_arc plugin. @@ -41,12 +47,18 @@ Aurélien Reynaud - LPAR plugin. - Various fixes for AIX, HP-UX and Solaris. +Bert Vermeulen + - sigrok plugin + Bruno Prémont - BIND plugin. - Many bugreports and -fixes in various plugins, especially a nasty bug in the network plugin. - Wireshark dissector. +Chad Malfait + - LVM plugin. + Chris Lundquist - Improvements to the write_mongodb plugin. @@ -73,6 +85,9 @@ Doug MacEachern Edward “Koko” Konetzko - fscache plugin. +Evan Felix + - mic plugin. + Fabian Linzberger - Percentage aggregation for `collectd-nagios'. @@ -88,6 +103,9 @@ Franck Lombardi Jason Pepas - nfs plugin. +J. Javier Maestro + - Write-Graphite plugin: UDP support and LogSendErrors flag. + Jérôme Renard - varnish plugin. @@ -116,6 +134,11 @@ Manuel Sanmartin + swap - Various AIX-related fixes and hacks. +Marc Fournier + - Various fixes to the varnish plugin. + - RPM specfile update. + - libmnl support in the netlink plugin. + Marco Chiappero - uptime plugin. - ip6tables support in the iptables plugin. @@ -126,6 +149,7 @@ Michael Hanselmann Michael Stapelberg - OpenBSD port of the tcpconns plugin. + - cgroups plugin. Michał Mirosław - thermal plugin. @@ -219,6 +243,9 @@ Tommie Gannert Vincent Stehlé - hddtemp plugin. +Xin Li + - FreeBSD port of the ZFS-ARC plugin. + collectd is available at: diff --git a/ChangeLog b/ChangeLog index acbf7bba..a2c46f00 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,79 @@ +2014-01-26, Version 5.4.1 + * amqp plugin: Add support for RabbitMQ 0.4.x to avoid compiler + warnings. Thanks to Sebastian Harl for implementing this. + * apache / network plugins: Improved initialization order hopefully + resolved gcrypt initialization problems. + * aquaero plugin: The type used to submit fan utilization was fixed. + Thanks to Alex Deymo for the patch. + * cgroups plugin: A small memory leak was fixed. Checking the existence + of a mount option without a value was fixed. More permissive parsing + of the cpuacct.stats file fixes support for some versions of Linux. + Thanks to Marc Fournier for bug reports and patches. + * curl plugin: Fix blocks without an instance. Thanks to + Alexander Golovko for reporting and Sebastian Harl for fixing this. + * curl_json plugin: Potentially invalid memory access has been + sanitized. Thanks to Jim Radford for his patch. + * interface plugin: Fix behavior under FreeBSD 10: Reporting of + per-address statistics caused duplicate updates to the same metric. + Thanks to demon / @trtrmitya for the patch. + * write_graphite plugin: Use TCP to connect to Graphite by default. The + default changed from TCP to UDP between 5.3.1 and 5.4.0, which is a + regression. Thanks to Marc Fournier for fixing this. Reconnect + behavior was improved. Thanks to Michael Hart for his patch. + * zfs_arc plugin: Collect "allocated" and "stolen" on FreeBSD only. + +2013-08-18, Version 5.4.0 + * collectd: The "LoadPlugin" config option no longer attempts to load + plugins twice. If more than one "LoadPlugin" statement or block is + encountered, only the first will have any effect. + * collectd: The "AutoLoadPlugin" option allows to automatically load + plugins for which a configuration is found. + * collectd: The "WriteQueueLimitHigh" and "WriteQueueLimitLow" options + allow collectd to drop values when under stress, to avoid running out + of memory. Thanks to Yves Mettier for his patch. + * amqp plugin: The "GraphiteSeparateInstances" and + "GraphiteAlwaysAppendDS" options have been added. Thanks to Laurent + for the patch. + * aquaero plugin: This new plugin reads various metrics, e.g. fan + speeds and temperatures, from Aquaero 5, a fan and water cooling + control panel. Thanks to Alex Deymo for his patch. + * curl plugin: The "MeasureResponseCode" option has been added. Thanks + to Jan Matějka for his patch. + * curl_json plugin: Support for UNIX domain sockets and array wildcards + has been added. Thanks to Jim Radford for his patch. + * curl_xml plugin: Support for long URLs has been improved. + * cgroups plugin: This new plugin collects CPU accounting information + for processes in a cgroup. Thanks to Michael Stapelberg for his patch. + * df plugin: The "ValuesAbsolute" and "ValuesPercentage" options have + been added. Thanks to Vedran Bartonicek for the patch. + * exec plugin: Do UID / GID lookups before forking. This should prevent + a race condition in the NSS library. Thanks to Ceri Storey for the + patch. + * lvm plugin: This new plugin collects size information from Linux' + Logical Volume Manager (LVM). Thanks to Chad Malfait for his work. + * memcached plugin: Support for increment and decrement counts has been + added. Thanks to Blake Matheny for the patch. + * mic plugin: This new plugin collects CPU and memory usage, power + consumption and temperatures of Intel's Many-Integrated-Core (MIC) + architecture, such as Xeon Phi cards. Thanks to Evan Felix for his + work. + * netlink plugin: This plugin has been converted to use the supported + "libmnl" library. Thanks to Andreas Henriksson for his patch. + * nginx plugin: Collection of accepted and handled connections has been + added. Thanks to Patrick Shan for his patch. + * sigrok plugin: This new plugin collects metrics from sigrok, a signal + processing framework reading various hardware devices, from light + meters to spectrum analyzers. Thanks to Bert Vermeulen for his patch. + * statsd plugin: This new plugin listens to a UDP socket and reads + metrics in the StatsD format. + * varnish plugin: Many additional metrics have been added. Thanks to + Nick Stenning for his patch. + * write_graphite plugin: Support for "UDP" has been added. Thanks to + Javier Maestro for his patch. + * write_riemann plugin: The "TTLFactor" option has been added. + * zfs_arc plugin: Support for FreeBSD has been added. Thanks to Xin Li + for his patch. + 2013-07-13, Version 5.3.1 * Documentation: Various fixes. * Configuration: Fix error handling: Errors in included files were diff --git a/README b/README index c3c45472..c0d70363 100644 --- a/README +++ b/README @@ -26,6 +26,9 @@ Features Sensors in Macs running Mac OS X / Darwin: Temperature, fanspeed and voltage sensors. + - aquaero + Various sensors in the Aquaero 5 watercooling board made by Aquacomputer. + - ascent Statistics about Ascent, a free server for the game `World of Warcraft'. @@ -37,6 +40,9 @@ Features Name server and resolver statistics from the `statistics-channel' interface of BIND 9.5, 9,6 and later. + - cgroups + CPU accounting information for process groups under Linux. + - conntrack Number of nf_conntrack entries. @@ -135,6 +141,10 @@ Features - libvirt CPU, memory, disk and network I/O statistics from virtual machines. + - lvm + Size of “Logical Volumes” (LV) and “Volume Groups” (VG) of Linux' + “Logical Volume Manager” (LVM). + - madwifi Queries very detailed usage statistics from wireless LAN adapters and interfaces that use the Atheros chipset and the MadWifi driver. @@ -158,6 +168,10 @@ Features Memory utilization: Memory occupied by running processes, page cache, buffer cache and free. + - mic + Collects CPU usage, memory usage, temperatures and power consumption from + Intel Many Integrated Core (MIC) CPUs. + - modbus Reads values from Modbus/TCP enabled devices. Supports reading values from multiple "slaves" so gateway devices can be used. @@ -269,6 +283,11 @@ Features - serial RX and TX of serial interfaces. Linux only; needs root privileges. + - sigrok + Uses libsigrok as a backend, allowing any sigrok-supported device + to have its measurements fed to collectd. This includes multimeters, + sound level meters, thermometers, and much more. + - snmp Read values from SNMP (Simple Network Management Protocol) enabled network devices such as switches, routers, thermometers, rack monitoring @@ -376,7 +395,9 @@ Features done. - write_graphite - Sends data to Carbon, the storage layer of Graphite. + Sends data to Carbon, the storage layer of Graphite using TCP or UDP. It + can be configured to avoid logging send errors (especially useful when + using UDP). - write_http Sends the values collected by collectd to a web-server using HTTP POST @@ -548,6 +569,14 @@ Prerequisites used and should be found in various implementations for hopefully all platforms. + * aerotools-ng (optional) + Used by the `aquaero' plugin. Currently, the `libaquaero5' library, which + is used by the `aerotools-ng' toolkit, is not compiled as a shared object + nor does it feature an installation routine. Therefore, you need to point + collectd's configure script at the source directory of the `aerotools-ng' + project. + + * CoreFoundation.framework and IOKit.framework (optional) For compiling on Darwin in general and the `apple_sensors' plugin in particular. @@ -605,6 +634,10 @@ Prerequisites Used by the `memcachec' plugin to connect to a memcache daemon. + * libmnl (optional) + Used by the `netlink' plugin. + + * libmodbus (optional) Used by the “modbus” plugin to communicate with Modbus/TCP devices. The “modbus” plugin works with version 2.0.3 of the library – due to frequent @@ -619,10 +652,6 @@ Prerequisites Required for the “netapp” plugin. This library is part of the “Manage ONTAP SDK” published by NetApp. - * libnetlink (optional) - Used, obviously, for the `netlink' plugin. - - * libnetsnmp (optional) For the `snmp' plugin. @@ -688,6 +717,11 @@ Prerequisites To read from `lm_sensors', see the `sensors' plugin. + * libsigrok (optional) + Used by the sigrok plugin. In addition, libsigrok depends on glib, + libzip, and optionally (depending on which drivers are enabled) on + libusb, libftdi and libudev. + * libstatgrab (optional) Used by various plugins to collect statistics on systems other than Linux and/or Solaris. diff --git a/clean.sh b/clean.sh index 9defb05d..46e8c29e 100755 --- a/clean.sh +++ b/clean.sh @@ -21,6 +21,7 @@ true \ && rm -f Makefile \ && rm -f Makefile.in \ && rm -f missing \ +&& rm -f INSTALL \ && rm -f -r src/.deps \ && rm -f -r src/.libs \ && rm -f src/*.o \ @@ -28,6 +29,11 @@ true \ && rm -f src/*.lo \ && rm -f src/collectd \ && rm -f src/collectd.1 \ +&& rm -f src/collectd.conf \ +&& rm -f src/collectdctl \ +&& rm -f src/collectd-tg \ +&& rm -f src/collectd-nagios \ +&& rm -f src/collectdmon \ && rm -f src/config.h \ && rm -f src/config.h.in \ && rm -f src/config.h.in~ \ @@ -35,6 +41,18 @@ true \ && rm -f src/Makefile.in \ && rm -f src/stamp-h1 \ && rm -f src/stamp-h1.in \ +&& rm -f src/*.pb-c.c \ +&& rm -f src/*.pb-c.h \ +&& rm -f src/Makefile.in \ +&& rm -f src/liboconfig/*.o \ +&& rm -f src/liboconfig/*.la \ +&& rm -f src/liboconfig/*.lo \ +&& rm -f -r src/liboconfig/.libs \ +&& rm -f -r src/liboconfig/Makefile \ +&& rm -f -r src/liboconfig/Makefile.in \ +&& rm -f -r src/liboconfig/parser.c \ +&& rm -f -r src/liboconfig/parser.h \ +&& rm -f -r src/liboconfig/scanner.c \ && rm -f -r src/libping/.libs \ && rm -f src/libping/*.o \ && rm -f src/libping/*.la \ @@ -48,5 +66,17 @@ true \ && rm -f src/libcollectdclient/*.o \ && rm -f src/libcollectdclient/*.la \ && rm -f src/libcollectdclient/*.lo \ +&& rm -f src/libcollectdclient/Makefile \ +&& rm -f src/libcollectdclient/Makefile.in \ +&& rm -f src/libcollectdclient/collectd/lcc_features.h \ +&& rm -f src/libcollectdclient/libcollectdclient.pc \ +&& rm -f bindings/Makefile \ +&& rm -f bindings/Makefile.in \ +&& rm -f -r bindings/java/.libs \ +&& rm -f bindings/java/Makefile \ +&& rm -f bindings/java/Makefile.in \ +&& rm -f bindings/java/java-build-stamp \ +&& rm -f bindings/java/org/collectd/api/*.class \ +&& rm -f bindings/java/org/collectd/java/*.class \ && rm -f bindings/.perl-directory-stamp \ && rm -f -r bindings/buildperl diff --git a/configure.ac b/configure.ac new file mode 100644 index 00000000..d38cbb5d --- /dev/null +++ b/configure.ac @@ -0,0 +1,5623 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT([collectd],[m4_esyscmd(./version-gen.sh)]) +AC_CONFIG_SRCDIR(src/collectd.c) +AC_CONFIG_HEADERS(src/config.h) +AC_CONFIG_AUX_DIR([libltdl/config]) + +m4_ifdef([LT_PACKAGE_VERSION], + # libtool >= 2.2 + [ + LT_CONFIG_LTDL_DIR([libltdl]) + LT_INIT([dlopen]) + LTDL_INIT([convenience]) + AC_DEFINE(LIBTOOL_VERSION, 2, [Define to used libtool version.]) + ] +, + # libtool <= 1.5 + [ + AC_LIBLTDL_CONVENIENCE + AC_SUBST(LTDLINCL) + AC_SUBST(LIBLTDL) + AC_LIBTOOL_DLOPEN + AC_CONFIG_SUBDIRS(libltdl) + AC_DEFINE(LIBTOOL_VERSION, 1, [Define to used libtool version.]) + ] +) + +AM_INIT_AUTOMAKE([tar-pax dist-bzip2 foreign]) +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) +AC_LANG(C) + +AC_PREFIX_DEFAULT("/opt/collectd") + +AC_SYS_LARGEFILE + +# +# Checks for programs. +# +AC_PROG_CC +AC_PROG_CPP +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_MAKE_SET +AM_PROG_CC_C_O +AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes") + +AC_DISABLE_STATIC +AC_PROG_LIBTOOL +AC_PROG_LEX +AC_PROG_YACC +PKG_PROG_PKG_CONFIG + +AC_CHECK_PROG([have_protoc_c], [protoc-c], [yes], [no]) +AC_CHECK_HEADERS([google/protobuf-c/protobuf-c.h], + [have_protobuf_c_h="yes"], + [have_protobuf_c_h="no"]) +if test "x$have_protoc_c" = "xyes" && test "x$have_protobuf_c_h" != "xyes" +then + have_protoc_c="no (unable to find )" +fi +AM_CONDITIONAL(HAVE_PROTOC_C, test "x$have_protoc_c" = "xyes") + +AC_MSG_CHECKING([for kernel type ($host_os)]) +case $host_os in + *linux*) + AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel]) + ac_system="Linux" + ;; + *solaris*) + AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel]) + ac_system="Solaris" + ;; + *darwin*) + ac_system="Darwin" + ;; + *openbsd*) + ac_system="OpenBSD" + ;; + *aix*) + AC_DEFINE([KERNEL_AIX], 1, [True if program is to be compiled for a AIX kernel]) + ac_system="AIX" + ;; + *freebsd*) + AC_DEFINE([KERNEL_FREEBSD], 1, [True if program is to be compiled for a FreeBSD kernel]) + ac_system="FreeBSD" + ;; + *) + ac_system="unknown" +esac +AC_MSG_RESULT([$ac_system]) + +if test "x$ac_system" = "xLinux" +then + AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources]) + if test -z "$KERNEL_DIR" + then + KERNEL_DIR="/lib/modules/`uname -r`/source" + fi + + KERNEL_CFLAGS="-I$KERNEL_DIR/include" + AC_SUBST(KERNEL_CFLAGS) +fi + +if test "x$ac_system" = "xSolaris" +then + AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.]) + AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.]) +fi +if test "x$ac_system" = "xAIX" +then + AC_DEFINE(_THREAD_SAFE_ERRNO, 1, [Define to use the thread-safe version of errno under AIX.]) +fi + +# Where to install .pc files. +pkgconfigdir="${libdir}/pkgconfig" +AC_SUBST(pkgconfigdir) + +# Check for standards compliance mode +AC_ARG_ENABLE(standards, + AS_HELP_STRING([--enable-standards], [Enable standards compliance mode]), + [enable_standards="$enableval"], + [enable_standards="no"]) +if test "x$enable_standards" = "xyes" +then + AC_DEFINE(_ISOC99_SOURCE, 1, [Define to enforce ISO C99 compliance.]) + AC_DEFINE(_POSIX_C_SOURCE, 200809L, [Define to enforce POSIX.1-2008 compliance.]) + AC_DEFINE(_XOPEN_SOURCE, 700, [Define to enforce X/Open 7 (XSI) compliance.]) + AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.]) + if test "x$GCC" = "xyes" + then + CFLAGS="$CFLAGS -std=c99" + fi +fi +AM_CONDITIONAL(BUILD_FEATURE_STANDARDS, test "x$enable_standards" = "xyes") + +# +# Checks for header files. +# +AC_HEADER_STDC +AC_HEADER_SYS_WAIT +AC_HEADER_DIRENT +AC_HEADER_STDBOOL + +AC_CHECK_HEADERS(stdio.h errno.h math.h stdarg.h syslog.h fcntl.h signal.h assert.h sys/types.h sys/socket.h sys/select.h poll.h netdb.h arpa/inet.h sys/resource.h sys/param.h kstat.h regex.h sys/ioctl.h endian.h sys/isa_defs.h fnmatch.h libgen.h) + +# For ping library +AC_CHECK_HEADERS(netinet/in_systm.h, [], [], +[#if HAVE_STDINT_H +# include +#endif +#if HAVE_SYS_TYPES_H +# include +#endif +]) +AC_CHECK_HEADERS(netinet/in.h, [], [], +[#if HAVE_STDINT_H +# include +#endif +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_SYSTM_H +# include +#endif +]) +AC_CHECK_HEADERS(netinet/ip.h, [], [], +[#if HAVE_STDINT_H +# include +#endif +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_SYSTM_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif +]) +AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [], +[#if HAVE_STDINT_H +# include +#endif +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_SYSTM_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif +#if HAVE_NETINET_IP_H +# include +#endif +]) +AC_CHECK_HEADERS(netinet/ip_var.h, [], [], +[#if HAVE_STDINT_H +# include +#endif +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_SYSTM_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif +#if HAVE_NETINET_IP_H +# include +#endif +]) +AC_CHECK_HEADERS(netinet/ip6.h, [], [], +[#if HAVE_STDINT_H +# include +#endif +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_SYSTM_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif +]) +AC_CHECK_HEADERS(netinet/icmp6.h, [], [], +[#if HAVE_STDINT_H +# include +#endif +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_SYSTM_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif +#if HAVE_NETINET_IP6_H +# include +#endif +]) +AC_CHECK_HEADERS(netinet/tcp.h, [], [], +[#if HAVE_STDINT_H +# include +#endif +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_SYSTM_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif +#if HAVE_NETINET_IP_H +# include +#endif +]) +AC_CHECK_HEADERS(netinet/udp.h, [], [], +[#if HAVE_STDINT_H +# include +#endif +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_SYSTM_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif +#if HAVE_NETINET_IP_H +# include +#endif +]) + +# For cpu modules +AC_CHECK_HEADERS(sys/dkstat.h) +if test "x$ac_system" = "xDarwin" +then + AC_CHECK_HEADERS(mach/mach_init.h mach/host_priv.h mach/mach_error.h mach/mach_host.h mach/mach_port.h mach/mach_types.h mach/message.h mach/processor_set.h mach/processor.h mach/processor_info.h mach/task.h mach/thread_act.h mach/vm_region.h mach/vm_map.h mach/vm_prot.h mach/vm_statistics.h mach/kern_return.h) + AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h) + # For the battery plugin + AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [], +[ +#if HAVE_IOKIT_IOKITLIB_H +# include +#endif +#if HAVE_IOKIT_IOTYPES_H +# include +#endif +]) + +fi + +AC_CHECK_HEADERS(sys/sysctl.h, [], [], +[ +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_PARAM_H +# include +#endif +]) + +AC_MSG_CHECKING([for sysctl kern.cp_times]) +if test -x /sbin/sysctl +then + /sbin/sysctl kern.cp_times 2>/dev/null + if test $? -eq 0 + then + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_SYSCTL_KERN_CP_TIMES, 1, + [Define if sysctl supports kern.cp_times]) + else + AC_MSG_RESULT([no]) + fi +else + AC_MSG_RESULT([no]) +fi + +# For hddtemp module +AC_CHECK_HEADERS(linux/major.h) + +# For md module (Linux only) +if test "x$ac_system" = "xLinux" +then + AC_CHECK_HEADERS(linux/raid/md_u.h, + [have_linux_raid_md_u_h="yes"], + [have_linux_raid_md_u_h="no"], +[ +#include +#include +#include +]) +else + have_linux_raid_md_u_h="no" +fi + +# For the swap module +have_linux_wireless_h="no" +if test "x$ac_system" = "xLinux" +then + AC_CHECK_HEADERS(linux/wireless.h, + [have_linux_wireless_h="yes"], + [have_linux_wireless_h="no"], +[ +#include +#include +#include +]) +fi + +# For the swap module +have_sys_swap_h="yes" +AC_CHECK_HEADERS(sys/swap.h vm/anon.h, [], [have_sys_swap_h="no"], +[ +#undef _FILE_OFFSET_BITS +#undef _LARGEFILE64_SOURCE +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_PARAM_H +# include +#endif +]) + +if test "x$have_sys_swap_h$ac_system" = "xnoSolaris" +then + hint_64="" + if test "x$GCC" = "xyes" + then + hint_64="CFLAGS='-m64'" + else + hint_64="CFLAGS='-xarch=v9'" + fi + AC_MSG_NOTICE([Solaris detected and sys/swap.h not usable. Try building a 64-bit binary ($hint_64 ./configure).]) +fi + +# For load module +# For the processes plugin +# For users module +AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h) + +# For interface plugin +AC_CHECK_HEADERS(ifaddrs.h) +AC_CHECK_HEADERS(net/if.h, [], [], +[ +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_SOCKET_H +# include +#endif +]) +AC_CHECK_HEADERS(linux/if.h, [], [], +[ +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_SOCKET_H +# include +#endif +]) +AC_CHECK_HEADERS(linux/inet_diag.h, [], [], +[ +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_SOCKET_H +# include +#endif +#if HAVE_LINUX_INET_DIAG_H +# include +#endif +]) +AC_CHECK_HEADERS(linux/netdevice.h, [], [], +[ +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_SOCKET_H +# include +#endif +#if HAVE_LINUX_IF_H +# include +#endif +]) + +# For ethstat module +AC_CHECK_HEADERS(linux/sockios.h, + [have_linux_sockios_h="yes"], + [have_linux_sockios_h="no"], + [ +#if HAVE_SYS_IOCTL_H +# include +#endif +#if HAVE_NET_IF_H +# include +#endif + ]) +AC_CHECK_HEADERS(linux/ethtool.h, + [have_linux_ethtool_h="yes"], + [have_linux_ethtool_h="no"], + [ +#if HAVE_SYS_IOCTL_H +# include +#endif +#if HAVE_NET_IF_H +# include +#endif +#if HAVE_LINUX_SOCKIOS_H +# include +#endif + ]) + +# For ipvs module +have_linux_ip_vs_h="no" +have_net_ip_vs_h="no" +have_ip_vs_h="no" +ip_vs_h_needs_kernel_cflags="no" +if test "x$ac_system" = "xLinux" +then + AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"]) + AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"]) + AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"]) + + if test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono" && test -d "$KERNEL_DIR" + then + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $KERNEL_CFLAGS" + + AC_MSG_NOTICE([Did not find ip_vs.h. Trying again using headers from $KERNEL_DIR.]) + + AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"]) + AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"]) + AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"]) + + if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes" + then + ip_vs_h_needs_kernel_cflags="yes" + fi + + CFLAGS="$SAVE_CFLAGS" + fi +fi +AM_CONDITIONAL(IP_VS_H_NEEDS_KERNEL_CFLAGS, test "x$ip_vs_h_needs_kernel_cflags" = "xyes") + +# For quota module +AC_CHECK_HEADERS(sys/ucred.h, [], [], +[ +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_PARAM_H +# include +#endif +]) + +# For mount interface +AC_CHECK_HEADERS(sys/mount.h, [], [], +[ +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_PARAM_H +# include +#endif +]) + +# For the email plugin +AC_CHECK_HEADERS(linux/un.h, [], [], +[ +#if HAVE_SYS_SOCKET_H +# include +#endif +]) + +AC_CHECK_HEADERS(pwd.h grp.h sys/un.h ctype.h limits.h xfs/xqm.h fs_info.h fshelp.h paths.h mntent.h mnttab.h sys/fstyp.h sys/fs_types.h sys/mntent.h sys/mnttab.h sys/statfs.h sys/statvfs.h sys/vfs.h sys/vfstab.h kvm.h wordexp.h) + +# For the dns plugin +AC_CHECK_HEADERS(arpa/nameser.h) +AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [], +[ +#if HAVE_ARPA_NAMESER_H +# include +#endif +]) + +AC_CHECK_HEADERS(net/if_arp.h, [], [], +[#if HAVE_SYS_SOCKET_H +# include +#endif +]) +AC_CHECK_HEADERS(net/ppp_defs.h) +AC_CHECK_HEADERS(net/if_ppp.h, [], [], +[#if HAVE_NET_PPP_DEFS_H +# include +#endif +]) +AC_CHECK_HEADERS(netinet/if_ether.h, [], [], +[#if HAVE_STDINT_H +# include +#endif +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_SOCKET_H +# include +#endif +#if HAVE_NET_IF_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif +]) + +AC_CHECK_HEADERS(netinet/ip_compat.h) + +have_net_pfvar_h="no" +AC_CHECK_HEADERS(net/pfvar.h, + [have_net_pfvar_h="yes"], + [have_net_pfvar_h="no"], +[ +#if HAVE_SYS_IOCTL_H +# include +#endif +#if HAVE_SYS_SOCKET_H +# include +#endif +#if HAVE_NET_IF_H +# include +#endif +]) + +# For the multimeter plugin +have_termios_h="no" +AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"]) + +# +# Checks for typedefs, structures, and compiler characteristics. +# +AC_C_CONST +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_TYPE_UID_T +AC_HEADER_TIME + +# +# Checks for library functions. +# +AC_PROG_GCC_TRADITIONAL +AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf setenv if_indextoname) + +AC_FUNC_STRERROR_R + +SAVE_CFLAGS="$CFLAGS" +# Emulate behavior of src/Makefile.am +if test "x$GCC" = "xyes" +then + CFLAGS="$CFLAGS -Wall -Werror" +fi + +AC_CACHE_CHECK([for strtok_r], + [c_cv_have_strtok_r_default], + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( +[[[ +#include +#include +#include +]]], +[[[ + char buffer[] = "foo,bar,baz"; + char *token; + char *dummy; + char *saveptr; + + dummy = buffer; + saveptr = NULL; + while ((token = strtok_r (dummy, ",", &saveptr)) != NULL) + { + dummy = NULL; + printf ("token = %s;\n", token); + } +]]] + )], + [c_cv_have_strtok_r_default="yes"], + [c_cv_have_strtok_r_default="no"] + ) +) + +if test "x$c_cv_have_strtok_r_default" = "xno" +then + CFLAGS="$CFLAGS -D_REENTRANT=1" + + AC_CACHE_CHECK([if strtok_r needs _REENTRANT], + [c_cv_have_strtok_r_reentrant], + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( +[[[ +#include +#include +#include +]]], +[[[ + char buffer[] = "foo,bar,baz"; + char *token; + char *dummy; + char *saveptr; + + dummy = buffer; + saveptr = NULL; + while ((token = strtok_r (dummy, ",", &saveptr)) != NULL) + { + dummy = NULL; + printf ("token = %s;\n", token); + } +]]] + )], + [c_cv_have_strtok_r_reentrant="yes"], + [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])] + ) + ) +fi + +CFLAGS="$SAVE_CFLAGS" +if test "x$c_cv_have_strtok_r_reentrant" = "xyes" +then + CFLAGS="$CFLAGS -D_REENTRANT=1" +fi + +AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree) + +socket_needs_socket="no" +AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket))) +AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes") + +clock_gettime_needs_rt="no" +clock_gettime_needs_posix4="no" +have_clock_gettime="no" +AC_CHECK_FUNCS(clock_gettime, [have_clock_gettime="yes"]) +if test "x$have_clock_gettime" = "xno" +then + AC_CHECK_LIB(rt, clock_gettime, [clock_gettime_needs_rt="yes" + have_clock_gettime="yes"]) +fi +if test "x$have_clock_gettime" = "xno" +then + AC_CHECK_LIB(posix4, clock_gettime, [clock_gettime_needs_posix4="yes" + have_clock_gettime="yes"]) +fi +if test "x$have_clock_gettime" = "xyes" +then + AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if the clock_gettime(2) function is available.]) +else + AC_MSG_WARN(cannot find clock_gettime) +fi + +nanosleep_needs_rt="no" +nanosleep_needs_posix4="no" +AC_CHECK_FUNCS(nanosleep, + [], + AC_CHECK_LIB(rt, nanosleep, + [nanosleep_needs_rt="yes"], + AC_CHECK_LIB(posix4, nanosleep, + [nanosleep_needs_posix4="yes"], + AC_MSG_ERROR(cannot find nanosleep)))) + +AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$clock_gettime_needs_rt" = "xyes" || test "x$nanosleep_needs_rt" = "xyes") +AM_CONDITIONAL(BUILD_WITH_LIBPOSIX4, test "x$clock_gettime_needs_posix4" = "xyes" || test "x$nanosleep_needs_posix4" = "xyes") + +AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"]) +AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"]) +AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"]) +AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"]) +AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"]) +AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"]) +AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"]) +AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"]) +AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"]) +AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"]) +AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"]) +AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"]) + +# Check for strptime {{{ +if test "x$GCC" = "xyes" +then + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wall -Wextra -Werror" +fi + +AC_CHECK_FUNCS(strptime, [have_strptime="yes"], [have_strptime="no"]) +if test "x$have_strptime" = "xyes" +then + AC_CACHE_CHECK([whether strptime is exported by default], + [c_cv_have_strptime_default], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( +[[[ +#include +]]], +[[[ + struct tm stm; + (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm); +]]] + )], + [c_cv_have_strptime_default="yes"], + [c_cv_have_strptime_default="no"])) +fi +if test "x$have_strptime" = "xyes" && test "x$c_cv_have_strptime_default" = "xno" +then + AC_CACHE_CHECK([whether strptime needs standards mode], + [c_cv_have_strptime_standards], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( +[[[ +#ifndef _ISOC99_SOURCE +# define _ISOC99_SOURCE 1 +#endif +#ifndef _POSIX_C_SOURCE +# define _POSIX_C_SOURCE 200112L +#endif +#ifndef _XOPEN_SOURCE +# define _XOPEN_SOURCE 500 +#endif +#include +]]], +[[[ + struct tm stm; + (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm); +]]] + )], + [c_cv_have_strptime_standards="yes"], + [c_cv_have_strptime_standards="no"])) + + if test "x$c_cv_have_strptime_standards" = "xyes" + then + AC_DEFINE([STRPTIME_NEEDS_STANDARDS], 1, [Set to true if strptime is only exported in X/Open mode (GNU libc).]) + else + have_strptime="no" + fi +fi + +if test "x$GCC" = "xyes" +then + CFLAGS="$SAVE_CFLAGS" +fi +# }}} Check for strptime + +AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"]) +if test "x$have_swapctl" = "xyes"; then + AC_CACHE_CHECK([whether swapctl takes two arguments], + [c_cv_have_swapctl_two_args], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( +[[[ +#if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64 +# undef _FILE_OFFSET_BITS +# undef _LARGEFILE64_SOURCE +#endif +#include +#include +]]], +[[[ +int num = swapctl(0, NULL); +]]] + )], + [c_cv_have_swapctl_two_args="yes"], + [c_cv_have_swapctl_two_args="no"] + ) + ) + AC_CACHE_CHECK([whether swapctl takes three arguments], + [c_cv_have_swapctl_three_args], + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( +[[[ +#if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64 +# undef _FILE_OFFSET_BITS +# undef _LARGEFILE64_SOURCE +#endif +#include +#include +]]], +[[[ +int num = swapctl(0, NULL, 0); +]]] + )], + [c_cv_have_swapctl_three_args="yes"], + [c_cv_have_swapctl_three_args="no"] + ) + ) +fi +# Check for different versions of `swapctl' here.. +if test "x$have_swapctl" = "xyes"; then + if test "x$c_cv_have_swapctl_two_args" = "xyes"; then + AC_DEFINE(HAVE_SWAPCTL_TWO_ARGS, 1, + [Define if the function swapctl exists and takes two arguments.]) + fi + if test "x$c_cv_have_swapctl_three_args" = "xyes"; then + AC_DEFINE(HAVE_SWAPCTL_THREE_ARGS, 1, + [Define if the function swapctl exists and takes three arguments.]) + fi +fi + +# Check for NAN +AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])], +[ + if test "x$withval" = "xno"; then + nan_type="none" + else if test "x$withval" = "xyes"; then + nan_type="zero" + else + nan_type="$withval" + fi; fi +], +[nan_type="none"]) +if test "x$nan_type" = "xnone"; then + AC_CACHE_CHECK([whether NAN is defined by default], + [c_cv_have_nan_default], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( +[[[ +#include +#include +static double foo = NAN; +]]], +[[[ + if (isnan (foo)) + return 0; + else + return 1; +]]] + )], + [c_cv_have_nan_default="yes"], + [c_cv_have_nan_default="no"] + ) + ) + if test "x$c_cv_have_nan_default" = "xyes" + then + nan_type="default" + fi +fi +if test "x$nan_type" = "xnone"; then + AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99], + [c_cv_have_nan_isoc], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( +[[[ +#include +#define __USE_ISOC99 1 +#include +static double foo = NAN; +]]], +[[[ + if (isnan (foo)) + return 0; + else + return 1; +]]] + )], + [c_cv_have_nan_isoc="yes"], + [c_cv_have_nan_isoc="no"] + ) + ) + if test "x$c_cv_have_nan_isoc" = "xyes" + then + nan_type="isoc99" + fi +fi +if test "x$nan_type" = "xnone"; then + SAVE_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -lm" + AC_CACHE_CHECK([whether NAN can be defined by 0/0], + [c_cv_have_nan_zero], + AC_RUN_IFELSE([AC_LANG_PROGRAM( +[[[ +#include +#include +#ifdef NAN +# undef NAN +#endif +#define NAN (0.0 / 0.0) +#ifndef isnan +# define isnan(f) ((f) != (f)) +#endif +static double foo = NAN; +]]], +[[[ + if (isnan (foo)) + return 0; + else + return 1; +]]] + )], + [c_cv_have_nan_zero="yes"], + [c_cv_have_nan_zero="no"] + ) + ) + LDFLAGS=$SAVE_LDFLAGS + if test "x$c_cv_have_nan_zero" = "xyes" + then + nan_type="zero" + fi +fi + +if test "x$nan_type" = "xdefault"; then + AC_DEFINE(NAN_STATIC_DEFAULT, 1, + [Define if NAN is defined by default and can initialize static variables.]) +else if test "x$nan_type" = "xisoc99"; then + AC_DEFINE(NAN_STATIC_ISOC, 1, + [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.]) +else if test "x$nan_type" = "xzero"; then + AC_DEFINE(NAN_ZERO_ZERO, 1, + [Define if NAN can be defined as (0.0 / 0.0)]) +else + AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.]) +fi; fi; fi + +AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])], +[ + if test "x$withval" = "xnothing"; then + fp_layout_type="nothing" + else if test "x$withval" = "xendianflip"; then + fp_layout_type="endianflip" + else if test "x$withval" = "xintswap"; then + fp_layout_type="intswap" + else + AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]); +fi; fi; fi +], +[fp_layout_type="unknown"]) + +if test "x$fp_layout_type" = "xunknown"; then + AC_CACHE_CHECK([if doubles are stored in x86 representation], + [c_cv_fp_layout_need_nothing], + AC_RUN_IFELSE([AC_LANG_PROGRAM( +[[[ +#include +#include +#include +#if HAVE_STDINT_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#endif +#if HAVE_STDBOOL_H +# include +#endif +]]], +[[[ + uint64_t i0; + uint64_t i1; + uint8_t c[8]; + double d; + + d = 8.642135e130; + memcpy ((void *) &i0, (void *) &d, 8); + + i1 = i0; + memcpy ((void *) c, (void *) &i1, 8); + + if ((c[0] == 0x2f) && (c[1] == 0x25) + && (c[2] == 0xc0) && (c[3] == 0xc7) + && (c[4] == 0x43) && (c[5] == 0x2b) + && (c[6] == 0x1f) && (c[7] == 0x5b)) + return (0); + else + return (1); +]]] + )], + [c_cv_fp_layout_need_nothing="yes"], + [c_cv_fp_layout_need_nothing="no"] + ) + ) + if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then + fp_layout_type="nothing" + fi +fi +if test "x$fp_layout_type" = "xunknown"; then + AC_CACHE_CHECK([if endianflip converts to x86 representation], + [c_cv_fp_layout_need_endianflip], + AC_RUN_IFELSE([AC_LANG_PROGRAM( +[[[ +#include +#include +#include +#if HAVE_STDINT_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#endif +#if HAVE_STDBOOL_H +# include +#endif +#define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \ + (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \ + (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \ + (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \ + (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \ + (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \ + (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \ + (((uint64_t)(A) & 0x00000000000000ffLL) << 56)) +]]], +[[[ + uint64_t i0; + uint64_t i1; + uint8_t c[8]; + double d; + + d = 8.642135e130; + memcpy ((void *) &i0, (void *) &d, 8); + + i1 = endianflip (i0); + memcpy ((void *) c, (void *) &i1, 8); + + if ((c[0] == 0x2f) && (c[1] == 0x25) + && (c[2] == 0xc0) && (c[3] == 0xc7) + && (c[4] == 0x43) && (c[5] == 0x2b) + && (c[6] == 0x1f) && (c[7] == 0x5b)) + return (0); + else + return (1); +]]] + )], + [c_cv_fp_layout_need_endianflip="yes"], + [c_cv_fp_layout_need_endianflip="no"] + ) + ) + if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then + fp_layout_type="endianflip" + fi +fi +if test "x$fp_layout_type" = "xunknown"; then + AC_CACHE_CHECK([if intswap converts to x86 representation], + [c_cv_fp_layout_need_intswap], + AC_RUN_IFELSE([AC_LANG_PROGRAM( +[[[ +#include +#include +#include +#if HAVE_STDINT_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#endif +#if HAVE_STDBOOL_H +# include +#endif +#define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \ + (((uint64_t)(A) & 0x00000000ffffffffLL) << 32)) +]]], +[[[ + uint64_t i0; + uint64_t i1; + uint8_t c[8]; + double d; + + d = 8.642135e130; + memcpy ((void *) &i0, (void *) &d, 8); + + i1 = intswap (i0); + memcpy ((void *) c, (void *) &i1, 8); + + if ((c[0] == 0x2f) && (c[1] == 0x25) + && (c[2] == 0xc0) && (c[3] == 0xc7) + && (c[4] == 0x43) && (c[5] == 0x2b) + && (c[6] == 0x1f) && (c[7] == 0x5b)) + return (0); + else + return (1); +]]] + )], + [c_cv_fp_layout_need_intswap="yes"], + [c_cv_fp_layout_need_intswap="no"] + ) + ) + if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then + fp_layout_type="intswap" + fi +fi + +if test "x$fp_layout_type" = "xnothing"; then + AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1, + [Define if doubles are stored in x86 representation.]) +else if test "x$fp_layout_type" = "xendianflip"; then + AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1, + [Define if endianflip is needed to convert to x86 representation.]) +else if test "x$fp_layout_type" = "xintswap"; then + AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1, + [Define if intswap is needed to convert to x86 representation.]) +else + AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.]) +fi; fi; fi + +have_getfsstat="no" +AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"]) +have_getvfsstat="no" +AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"]) +have_listmntent="no" +AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"]) + +have_getmntent="no" +AC_CHECK_FUNCS(getmntent, [have_getmntent="c"]) +if test "x$have_getmntent" = "xno"; then + AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"]) +fi +if test "x$have_getmntent" = "xno"; then + AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"]) +fi +if test "x$have_getmntent" = "xno"; then + AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"]) +fi + +if test "x$have_getmntent" = "xc"; then + AC_CACHE_CHECK([whether getmntent takes one argument], + [c_cv_have_one_getmntent], + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( +[[[ +#include "$srcdir/src/utils_mount.h" +]]], +[[[ +FILE *fh; +struct mntent *me; +fh = setmntent ("/etc/mtab", "r"); +me = getmntent (fh); +]]] + )], + [c_cv_have_one_getmntent="yes"], + [c_cv_have_one_getmntent="no"] + ) + ) + AC_CACHE_CHECK([whether getmntent takes two arguments], + [c_cv_have_two_getmntent], + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( +[[[ +#include "$srcdir/src/utils_mount.h" +]]], +[[[ + FILE *fh; + struct mnttab mt; + int status; + fh = fopen ("/etc/mnttab", "r"); + status = getmntent (fh, &mt); +]]] + )], + [c_cv_have_two_getmntent="yes"], + [c_cv_have_two_getmntent="no"] + ) + ) +fi + +# Check for different versions of `getmntent' here.. + +if test "x$have_getmntent" = "xc"; then + if test "x$c_cv_have_one_getmntent" = "xyes"; then + AC_DEFINE(HAVE_ONE_GETMNTENT, 1, + [Define if the function getmntent exists and takes one argument.]) + fi + if test "x$c_cv_have_two_getmntent" = "xyes"; then + AC_DEFINE(HAVE_TWO_GETMNTENT, 1, + [Define if the function getmntent exists and takes two arguments.]) + fi +fi +if test "x$have_getmntent" = "xsun"; then + AC_DEFINE(HAVE_SUN_GETMNTENT, 1, + [Define if the function getmntent exists. It's the version from libsun.]) +fi +if test "x$have_getmntent" = "xseq"; then + AC_DEFINE(HAVE_SEQ_GETMNTENT, 1, + [Define if the function getmntent exists. It's the version from libseq.]) +fi +if test "x$have_getmntent" = "xgen"; then + AC_DEFINE(HAVE_GEN_GETMNTENT, 1, + [Define if the function getmntent exists. It's the version from libgen.]) +fi + +# Check for htonll +AC_CACHE_CHECK([if have htonll defined], + [c_cv_have_htonll], + AC_LINK_IFELSE([AC_LANG_PROGRAM( +[[[ +#include +#include +#if HAVE_INTTYPES_H +# include +#endif +]]], +[[[ + return htonll(0); +]]] + )], + [c_cv_have_htonll="yes"], + [c_cv_have_htonll="no"] + ) +) +if test "x$c_cv_have_htonll" = "xyes" +then + AC_DEFINE(HAVE_HTONLL, 1, [Define if the function htonll exists.]) +fi + +# Check for structures +AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors], + [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])], + [], + [ + #include + #include + #include + ]) +AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors], + [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])], + [], + [ + #include + #include + #include + #include + ]) +AC_CHECK_MEMBERS([struct inet_diag_req.id, struct inet_diag_req.idiag_states], + [AC_DEFINE(HAVE_STRUCT_LINUX_INET_DIAG_REQ, 1, [Define if struct inet_diag_req exists and is usable.])], + [], + [ + #include + ]) + + +AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [], + [], + [ + #include + #include + ]) + +AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage], + [ + AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1, + [Define if struct kinfo_proc exists in the FreeBSD variant.]) + have_struct_kinfo_proc_freebsd="yes" + ], + [ + have_struct_kinfo_proc_freebsd="no" + ], + [ +#include +#include +#include +#include + ]) + +AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc], + [ + AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1, + [Define if struct kinfo_proc exists in the OpenBSD variant.]) + have_struct_kinfo_proc_openbsd="yes" + ], + [ + have_struct_kinfo_proc_openbsd="no" + ], + [ +#include +#include +#include + ]) + +AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [], +[#define _BSD_SOURCE +#if HAVE_STDINT_H +# include +#endif +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_SYSTM_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif +#if HAVE_NETINET_IP_H +# include +#endif +#if HAVE_NETINET_UDP_H +# include +#endif +]) +AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [], +[#define _BSD_SOURCE +#if HAVE_STDINT_H +# include +#endif +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_SYSTM_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif +#if HAVE_NETINET_IP_H +# include +#endif +#if HAVE_NETINET_UDP_H +# include +#endif +]) + +AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime], + [], + [], + [ +#if HAVE_KSTAT_H +# include +#endif + ]) + +# +# Checks for libraries begin here +# + +with_libresolv="yes" +AC_CHECK_LIB(resolv, res_search, +[ + AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).]) +], +[with_libresolv="no"]) +AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes") + +dnl Check for HAL (hardware abstraction library) +with_libhal="yes" +AC_CHECK_LIB(hal,libhal_device_property_exists, + [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])], + [with_libhal="no"]) +if test "x$with_libhal" = "xyes"; then + if test "x$PKG_CONFIG" != "x"; then + BUILD_WITH_LIBHAL_CFLAGS="`$PKG_CONFIG --cflags hal`" + BUILD_WITH_LIBHAL_LIBS="`$PKG_CONFIG --libs hal`" + AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS) + AC_SUBST(BUILD_WITH_LIBHAL_LIBS) + fi +fi + +m4_divert_once([HELP_WITH], [ +collectd additional packages:]) + +AM_CONDITIONAL([BUILD_FREEBSD],[test "x$x$ac_system" = "xFreeBSD"]) + +AM_CONDITIONAL([BUILD_AIX],[test "x$x$ac_system" = "xAIX"]) + +if test "x$ac_system" = "xAIX" +then + with_perfstat="yes" + with_procinfo="yes" +else + with_perfstat="no (AIX only)" + with_procinfo="no (AIX only)" +fi + +if test "x$with_perfstat" = "xyes" +then + AC_CHECK_LIB(perfstat, perfstat_reset, [with_perfstat="yes"], [with_perfstat="no (perfstat not found)"], []) +# AC_CHECK_HEADERS(sys/protosw.h libperfstat.h,, [with_perfstat="no (perfstat not found)"]) +fi +if test "x$with_perfstat" = "xyes" +then + AC_DEFINE(HAVE_PERFSTAT, 1, [Define to 1 if you have the 'perfstat' library (-lperfstat)]) + # struct members pertaining to donation have been added to libperfstat somewhere between AIX5.3ML5 and AIX5.3ML9 + AC_CHECK_MEMBER([perfstat_partition_type_t.b.donate_enabled], [], [], [[#include @], [Path to aquatools-ng source code.])], +[ + if test "x$withval" = "xyes" + then + with_libaquaero5="yes" + else if test "x$withval" = "xno" + then + with_libaquaero5="no" + else + with_libaquaero5="yes" + LIBAQUAERO5_CFLAGS="$LIBAQUAERO5_CFLAGS -I$withval/src" + LIBAQUAERO5_LDFLAGS="$LIBAQUAERO5_LDFLAGS -L$withval/obj" + fi; fi +], +[with_libaquaero5="yes"]) + +SAVE_CPPFLAGS="$CPPFLAGS" +SAVE_LDFLAGS="$LDFLAGS" + +CPPFLAGS="$CPPFLAGS $LIBAQUAERO5_CFLAGS" +LDFLAGS="$LDFLAGS $LIBAQUAERO5_LDFLAGS" + +if test "x$with_libaquaero5" = "xyes" +then + if test "x$LIBAQUAERO5_CFLAGS" != "x" + then + AC_MSG_NOTICE([libaquaero5 CPPFLAGS: $LIBAQUAERO5_CFLAGS]) + fi + AC_CHECK_HEADERS(libaquaero5.h, + [with_libaquaero5="yes"], + [with_libaquaero5="no (libaquaero5.h not found)"]) +fi +if test "x$with_libaquaero5" = "xyes" +then + if test "x$LIBAQUAERO5_LDFLAGS" != "x" + then + AC_MSG_NOTICE([libaquaero5 LDFLAGS: $LIBAQUAERO5_LDFLAGS]) + fi + AC_CHECK_LIB(aquaero5, libaquaero5_poll, + [with_libaquaero5="yes"], + [with_libaquaero5="no (symbol 'libaquaero5_poll' not found)"]) +fi + +CPPFLAGS="$SAVE_CPPFLAGS" +LDFLAGS="$SAVE_LDFLAGS" + +if test "x$with_libaquaero5" = "xyes" +then + BUILD_WITH_LIBAQUAERO5_CFLAGS="$LIBAQUAERO5_CFLAGS" + BUILD_WITH_LIBAQUAERO5_LDFLAGS="$LIBAQUAERO5_LDFLAGS" + AC_SUBST(BUILD_WITH_LIBAQUAERO5_CFLAGS) + AC_SUBST(BUILD_WITH_LIBAQUAERO5_LDFLAGS) +fi +AM_CONDITIONAL(BUILD_WITH_LIBAQUAERO5, test "x$with_libaquaero5" = "xyes") +# }}} + +# --with-libcredis {{{ +AC_ARG_WITH(libcredis, [AS_HELP_STRING([--with-libcredis@<:@=PREFIX@:>@], [Path to libcredis.])], +[ + if test "x$withval" = "xyes" + then + with_libcredis="yes" + else if test "x$withval" = "xno" + then + with_libcredis="no" + else + with_libcredis="yes" + LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS -I$withval/include" + LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS -L$withval/lib" + fi; fi +], +[with_libcredis="yes"]) + +SAVE_CPPFLAGS="$CPPFLAGS" +SAVE_LDFLAGS="$LDFLAGS" + +CPPFLAGS="$CPPFLAGS $LIBCREDIS_CPPFLAGS" +LDFLAGS="$LDFLAGS $LIBCREDIS_LDFLAGS" + +if test "x$with_libcredis" = "xyes" +then + if test "x$LIBCREDIS_CPPFLAGS" != "x" + then + AC_MSG_NOTICE([libcredis CPPFLAGS: $LIBCREDIS_CPPFLAGS]) + fi + AC_CHECK_HEADERS(credis.h, + [with_libcredis="yes"], + [with_libcredis="no (credis.h not found)"]) +fi +if test "x$with_libcredis" = "xyes" +then + if test "x$LIBCREDIS_LDFLAGS" != "x" + then + AC_MSG_NOTICE([libcredis LDFLAGS: $LIBCREDIS_LDFLAGS]) + fi + AC_CHECK_LIB(credis, credis_info, + [with_libcredis="yes"], + [with_libcredis="no (symbol 'credis_info' not found)"]) + +fi + +CPPFLAGS="$SAVE_CPPFLAGS" +LDFLAGS="$SAVE_LDFLAGS" + +if test "x$with_libcredis" = "xyes" +then + BUILD_WITH_LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS" + BUILD_WITH_LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS" + AC_SUBST(BUILD_WITH_LIBCREDIS_CPPFLAGS) + AC_SUBST(BUILD_WITH_LIBCREDIS_LDFLAGS) +fi +AM_CONDITIONAL(BUILD_WITH_LIBCREDIS, test "x$with_libcredis" = "xyes") +# }}} + +# --with-libcurl {{{ +with_curl_config="curl-config" +with_curl_cflags="" +with_curl_libs="" +AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])], +[ + if test "x$withval" = "xno" + then + with_libcurl="no" + else if test "x$withval" = "xyes" + then + with_libcurl="yes" + else + if test -f "$withval" && test -x "$withval" + then + with_curl_config="$withval" + with_libcurl="yes" + else if test -x "$withval/bin/curl-config" + then + with_curl_config="$withval/bin/curl-config" + with_libcurl="yes" + fi; fi + with_libcurl="yes" + fi; fi +], +[ + with_libcurl="yes" +]) +if test "x$with_libcurl" = "xyes" +then + with_curl_cflags=`$with_curl_config --cflags 2>/dev/null` + curl_config_status=$? + + if test $curl_config_status -ne 0 + then + with_libcurl="no ($with_curl_config failed)" + else + SAVE_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $with_curl_cflags" + + AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], []) + + CPPFLAGS="$SAVE_CPPFLAGS" + fi +fi +if test "x$with_libcurl" = "xyes" +then + with_curl_libs=`$with_curl_config --libs 2>/dev/null` + curl_config_status=$? + + if test $curl_config_status -ne 0 + then + with_libcurl="no ($with_curl_config failed)" + else + AC_CHECK_LIB(curl, curl_easy_init, + [with_libcurl="yes"], + [with_libcurl="no (symbol 'curl_easy_init' not found)"], + [$with_curl_libs]) + fi +fi +if test "x$with_libcurl" = "xyes" +then + BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags" + BUILD_WITH_LIBCURL_LIBS="$with_curl_libs" + AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS) + AC_SUBST(BUILD_WITH_LIBCURL_LIBS) +fi +AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes") +# }}} + +# --with-libdbi {{{ +with_libdbi_cppflags="" +with_libdbi_ldflags="" +AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])], +[ + if test "x$withval" != "xno" && test "x$withval" != "xyes" + then + with_libdbi_cppflags="-I$withval/include" + with_libdbi_ldflags="-L$withval/lib" + with_libdbi="yes" + else + with_libdbi="$withval" + fi +], +[ + with_libdbi="yes" +]) +if test "x$with_libdbi" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags" + + AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"]) + + CPPFLAGS="$SAVE_CPPFLAGS" +fi +if test "x$with_libdbi" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags" + LDFLAGS="$LDFLAGS $with_libdbi_ldflags" + + AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"]) + + CPPFLAGS="$SAVE_CPPFLAGS" + LDFLAGS="$SAVE_LDFLAGS" +fi +if test "x$with_libdbi" = "xyes" +then + BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags" + BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags" + BUILD_WITH_LIBDBI_LIBS="-ldbi" + AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS) + AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS) + AC_SUBST(BUILD_WITH_LIBDBI_LIBS) +fi +AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes") +# }}} + +# --with-libesmtp {{{ +AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])], +[ + if test "x$withval" != "xno" && test "x$withval" != "xyes" + then + LDFLAGS="$LDFLAGS -L$withval/lib" + CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE" + with_libesmtp="yes" + else + with_libesmtp="$withval" + fi +], +[ + with_libesmtp="yes" +]) +if test "x$with_libesmtp" = "xyes" +then + AC_CHECK_LIB(esmtp, smtp_create_session, + [ + AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).]) + ], [with_libesmtp="no (libesmtp not found)"]) +fi +if test "x$with_libesmtp" = "xyes" +then + AC_CHECK_HEADERS(libesmtp.h, + [ + AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the header file.]) + ], [with_libesmtp="no (libesmtp.h not found)"]) +fi +if test "x$with_libesmtp" = "xyes" +then + collect_libesmtp=1 +else + collect_libesmtp=0 +fi +AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp], + [Wether or not to use the esmtp library]) +AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes") +# }}} + +# --with-libganglia {{{ +AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])], +[ + if test -f "$withval" && test -x "$withval" + then + with_libganglia_config="$withval" + with_libganglia="yes" + else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config" + then + with_libganglia_config="$withval/bin/ganglia-config" + with_libganglia="yes" + else if test -d "$withval" + then + GANGLIA_CPPFLAGS="-I$withval/include" + GANGLIA_LDFLAGS="-L$withval/lib" + with_libganglia="yes" + else + with_libganglia_config="ganglia-config" + with_libganglia="$withval" + fi; fi; fi +], +[ + with_libganglia_config="ganglia-config" + with_libganglia="yes" +]) + +if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x" +then + if test "x$GANGLIA_CPPFLAGS" = "x" + then + GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null` + fi + + if test "x$GANGLIA_LDFLAGS" = "x" + then + GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null` + fi + + if test "x$GANGLIA_LIBS" = "x" + then + GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null` + fi +fi + +SAVE_CPPFLAGS="$CPPFLAGS" +SAVE_LDFLAGS="$LDFLAGS" +CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS" +LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS" + +if test "x$with_libganglia" = "xyes" +then + AC_CHECK_HEADERS(gm_protocol.h, + [ + AC_DEFINE(HAVE_GM_PROTOCOL_H, 1, + [Define to 1 if you have the header file.]) + ], [with_libganglia="no (gm_protocol.h not found)"]) +fi + +if test "x$with_libganglia" = "xyes" +then + AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg, + [ + AC_DEFINE(HAVE_LIBGANGLIA, 1, + [Define to 1 if you have the ganglia library (-lganglia).]) + ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"]) +fi + +CPPFLAGS="$SAVE_CPPFLAGS" +LDFLAGS="$SAVE_LDFLAGS" + +AC_SUBST(GANGLIA_CPPFLAGS) +AC_SUBST(GANGLIA_LDFLAGS) +AC_SUBST(GANGLIA_LIBS) +AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes") +# }}} + +# --with-libgcrypt {{{ +GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS" +GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS" +GCRYPT_LIBS="$GCRYPT_LIBS" +AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])], +[ + if test -f "$withval" && test -x "$withval" + then + with_libgcrypt_config="$withval" + with_libgcrypt="yes" + else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config" + then + with_libgcrypt_config="$withval/bin/gcrypt-config" + with_libgcrypt="yes" + else if test -d "$withval" + then + GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include" + GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib" + with_libgcrypt="yes" + else + with_libgcrypt_config="gcrypt-config" + with_libgcrypt="$withval" + fi; fi; fi +], +[ + with_libgcrypt_config="libgcrypt-config" + with_libgcrypt="yes" +]) + +if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x" +then + if test "x$GCRYPT_CPPFLAGS" = "x" + then + GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null` + fi + + if test "x$GCRYPT_LDFLAGS" = "x" + then + gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null` + GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib" + fi + + if test "x$GCRYPT_LIBS" = "x" + then + GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null` + fi +fi + +SAVE_CPPFLAGS="$CPPFLAGS" +SAVE_LDFLAGS="$LDFLAGS" +CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS" +LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS" + +if test "x$with_libgcrypt" = "xyes" +then + if test "x$GCRYPT_CPPFLAGS" != "x" + then + AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS]) + fi + AC_CHECK_HEADERS(gcrypt.h, + [with_libgcrypt="yes"], + [with_libgcrypt="no (gcrypt.h not found)"]) +fi + +if test "x$with_libgcrypt" = "xyes" +then + if test "x$GCRYPT_LDFLAGS" != "x" + then + AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS]) + fi + AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer, + [with_libgcrypt="yes"], + [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"]) + + if test "$with_libgcrypt" != "no"; then + AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)") + GCRYPT_CPPFLAGS="$LIBGCRYPT_CPPFLAGS $LIBGCRYPT_CFLAGS" + GCRYPT_LIBS="$LIBGCRYPT_LIBS" + fi +fi + +CPPFLAGS="$SAVE_CPPFLAGS" +LDFLAGS="$SAVE_LDFLAGS" + +if test "x$with_libgcrypt" = "xyes" +then + AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).]) +fi + +AC_SUBST(GCRYPT_CPPFLAGS) +AC_SUBST(GCRYPT_LDFLAGS) +AC_SUBST(GCRYPT_LIBS) +AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes") +# }}} + +# --with-libiptc {{{ +AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])], +[ + if test "x$withval" = "xshipped" + then + with_libiptc="own" + else if test "x$withval" = "xyes" + then + with_libiptc="pkgconfig" + else if test "x$withval" = "xno" + then + with_libiptc="no" + else + with_libiptc="yes" + with_libiptc_cflags="-I$withval/include" + with_libiptc_libs="-L$withval/lib" + fi; fi; fi +], +[ + if test "x$ac_system" = "xLinux" + then + with_libiptc="pkgconfig" + else + with_libiptc="no (Linux only)" + fi +]) + +if test "x$with_libiptc" = "xpkgconfig" && test "x$PKG_CONFIG" = "x" +then + with_libiptc="no (Don't have pkg-config)" +fi + +if test "x$with_libiptc" = "xpkgconfig" +then + $PKG_CONFIG --exists 'libiptc' 2>/dev/null + if test $? -ne 0 + then + with_libiptc="no (pkg-config doesn't know libiptc)" + fi +fi +if test "x$with_libiptc" = "xpkgconfig" +then + with_libiptc_cflags="`$PKG_CONFIG --cflags 'libiptc'`" + if test $? -ne 0 + then + with_libiptc="no ($PKG_CONFIG failed)" + fi + with_libiptc_libs="`$PKG_CONFIG --libs 'libiptc'`" + if test $? -ne 0 + then + with_libiptc="no ($PKG_CONFIG failed)" + fi +fi + +SAVE_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $with_libiptc_cflags" + +# check whether the header file for libiptc is available. +if test "x$with_libiptc" = "xpkgconfig" +then + AC_CHECK_HEADERS(libiptc/libiptc.h libiptc/libip6tc.h, , + [with_libiptc="no (header file missing)"]) +fi +# If the header file is available, check for the required type declaractions. +# They may be missing in old versions of libiptc. In that case, they will be +# declared in the iptables plugin. +if test "x$with_libiptc" = "xpkgconfig" +then + AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], []) +fi +# Check for the iptc_init symbol in the library. +# This could be in iptc or ip4tc +if test "x$with_libiptc" = "xpkgconfig" +then + SAVE_LIBS="$LIBS" + AC_SEARCH_LIBS(iptc_init, [iptc ip4tc], + [with_libiptc="pkgconfig"], + [with_libiptc="no"], + [$with_libiptc_libs]) + LIBS="$SAVE_LIBS" +fi +if test "x$with_libiptc" = "xpkgconfig" +then + with_libiptc="yes" +fi + +CPPFLAGS="$SAVE_CPPFLAGS" + +if test "x$with_libiptc" = "xown" +then + with_libiptc_cflags="" + with_libiptc_libs="" +fi +if test "x$with_libiptc" = "xown" +then + AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h linux/netfilter/x_tables.h, [], + [ + with_libiptc="no (Linux iptables headers not found)" + ], + [ +#include "$srcdir/src/owniptc/ipt_kernel_headers.h" + ]) +fi +AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_libiptc" = "xown") +if test "x$with_libiptc" = "xown" +then + AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.]) + with_libiptc="yes" +fi + +AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes") +if test "x$with_libiptc" = "xyes" +then + BUILD_WITH_LIBIPTC_CPPFLAGS="$with_libiptc_cflags" + BUILD_WITH_LIBIPTC_LDFLAGS="$with_libiptc_libs" + AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS) + AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS) +fi +# }}} + +# --with-java {{{ +with_java_home="$JAVA_HOME" +with_java_vmtype="client" +with_java_cflags="" +with_java_libs="" +JAVAC="$JAVAC" +JAR="$JAR" +AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])], +[ + if test "x$withval" = "xno" + then + with_java="no" + else if test "x$withval" = "xyes" + then + with_java="yes" + else + with_java_home="$withval" + with_java="yes" + fi; fi +], +[with_java="yes"]) +if test "x$with_java" = "xyes" +then + if test -d "$with_java_home" + then + AC_MSG_CHECKING([for jni.h]) + TMPVAR=`find "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1` + if test "x$TMPVAR" != "x" + then + AC_MSG_RESULT([found in $TMPVAR]) + JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR" + else + AC_MSG_RESULT([not found]) + fi + + AC_MSG_CHECKING([for jni_md.h]) + TMPVAR=`find "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1` + if test "x$TMPVAR" != "x" + then + AC_MSG_RESULT([found in $TMPVAR]) + JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR" + else + AC_MSG_RESULT([not found]) + fi + + AC_MSG_CHECKING([for libjvm.so]) + TMPVAR=`find "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1` + if test "x$TMPVAR" != "x" + then + AC_MSG_RESULT([found in $TMPVAR]) + JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPVAR -Wl,-rpath -Wl,$TMPVAR" + else + AC_MSG_RESULT([not found]) + fi + + if test "x$JAVAC" = "x" + then + AC_MSG_CHECKING([for javac]) + TMPVAR=`find "$with_java_home" -name javac -type f 2>/dev/null | head -n 1` + if test "x$TMPVAR" != "x" + then + JAVAC="$TMPVAR" + AC_MSG_RESULT([$JAVAC]) + else + AC_MSG_RESULT([not found]) + fi + fi + if test "x$JAR" = "x" + then + AC_MSG_CHECKING([for jar]) + TMPVAR=`find "$with_java_home" -name jar -type f 2>/dev/null | head -n 1` + if test "x$TMPVAR" != "x" + then + JAR="$TMPVAR" + AC_MSG_RESULT([$JAR]) + else + AC_MSG_RESULT([not found]) + fi + fi + else if test "x$with_java_home" != "x" + then + AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home]) + fi; fi +fi + +if test "x$JAVA_CPPFLAGS" != "x" +then + AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS]) +fi +if test "x$JAVA_CFLAGS" != "x" +then + AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS]) +fi +if test "x$JAVA_LDFLAGS" != "x" +then + AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS]) +fi +if test "x$JAVAC" = "x" +then + with_javac_path="$PATH" + if test "x$with_java_home" != "x" + then + with_javac_path="$with_java_home:with_javac_path" + if test -d "$with_java_home/bin" + then + with_javac_path="$with_java_home/bin:with_javac_path" + fi + fi + + AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path") +fi +if test "x$JAVAC" = "x" +then + with_java="no (javac not found)" +fi +if test "x$JAR" = "x" +then + with_jar_path="$PATH" + if test "x$with_java_home" != "x" + then + with_jar_path="$with_java_home:$with_jar_path" + if test -d "$with_java_home/bin" + then + with_jar_path="$with_java_home/bin:$with_jar_path" + fi + fi + + AC_PATH_PROG(JAR, jar, [], "$with_jar_path") +fi +if test "x$JAR" = "x" +then + with_java="no (jar not found)" +fi + +SAVE_CPPFLAGS="$CPPFLAGS" +SAVE_CFLAGS="$CFLAGS" +SAVE_LDFLAGS="$LDFLAGS" +CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS" +CFLAGS="$CFLAGS $JAVA_CFLAGS" +LDFLAGS="$LDFLAGS $JAVA_LDFLAGS" + +if test "x$with_java" = "xyes" +then + AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"]) +fi +if test "x$with_java" = "xyes" +then + AC_CHECK_LIB(jvm, JNI_CreateJavaVM, + [with_java="yes"], + [with_java="no (libjvm not found)"], + [$JAVA_LIBS]) +fi +if test "x$with_java" = "xyes" +then + JAVA_LIBS="$JAVA_LIBS -ljvm" + AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS]) +fi + +CPPFLAGS="$SAVE_CPPFLAGS" +CFLAGS="$SAVE_CFLAGS" +LDFLAGS="$SAVE_LDFLAGS" + +AC_SUBST(JAVA_CPPFLAGS) +AC_SUBST(JAVA_CFLAGS) +AC_SUBST(JAVA_LDFLAGS) +AC_SUBST(JAVA_LIBS) +AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes") +# }}} + +# --with-liblvm2app {{{ +with_liblvm2app_cppflags="" +with_liblvm2app_ldflags="" +AC_ARG_WITH(liblvm2app, [AS_HELP_STRING([--with-liblvm2app@<:@=PREFIX@:>@], [Path to liblvm2app.])], +[ + if test "x$withval" != "xno" && test "x$withval" != "xyes" + then + with_liblvm2app_cppflags="-I$withval/include" + with_liblvm2app_ldflags="-L$withval/lib" + with_liblvm2app="yes" + else + with_liblvm2app="$withval" + fi +], +[ + with_liblvm2app="yes" +]) +if test "x$with_liblvm2app" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $with_liblvm2app_cppflags" + + AC_CHECK_HEADERS(lvm2app.h, [with_liblvm2app="yes"], [with_liblvm2app="no (lvm2app.h not found)"]) + + CPPFLAGS="$SAVE_CPPFLAGS" +fi + +if test "x$with_liblvm2app" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + CPPFLAGS="$CPPFLAGS $with_liblvm2app_cppflags" + LDFLAGS="$LDFLAGS $with_liblvm2app_ldflags" + + AC_CHECK_LIB(lvm2app, lvm_init, [with_liblvm2app="yes"], [with_liblvm2app="no (Symbol 'lvm_init' not found)"]) + + CPPFLAGS="$SAVE_CPPFLAGS" + LDFLAGS="$SAVE_LDFLAGS" +fi +if test "x$with_liblvm2app" = "xyes" +then + BUILD_WITH_LIBLVM2APP_CPPFLAGS="$with_liblvm2app_cppflags" + BUILD_WITH_LIBLVM2APP_LDFLAGS="$with_liblvm2app_ldflags" + BUILD_WITH_LIBLVM2APP_LIBS="-llvm2app" + AC_SUBST(BUILD_WITH_LIBLVM2APP_CPPFLAGS) + AC_SUBST(BUILD_WITH_LIBLVM2APP_LDFLAGS) + AC_SUBST(BUILD_WITH_LIBLVM2APP_LIBS) + AC_DEFINE(HAVE_LIBLVM2APP, 1, [Define if liblvm2app is present and usable.]) +fi +AM_CONDITIONAL(BUILD_WITH_LIBLVM2APP, test "x$with_liblvm2app" = "xyes") +# }}} + +# --with-libmemcached {{{ +with_libmemcached_cppflags="" +with_libmemcached_ldflags="" +AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])], +[ + if test "x$withval" != "xno" && test "x$withval" != "xyes" + then + with_libmemcached_cppflags="-I$withval/include" + with_libmemcached_ldflags="-L$withval/lib" + with_libmemcached="yes" + else + with_libmemcached="$withval" + fi +], +[ + with_libmemcached="yes" +]) +if test "x$with_libmemcached" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags" + + AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"]) + + CPPFLAGS="$SAVE_CPPFLAGS" +fi +if test "x$with_libmemcached" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags" + LDFLAGS="$LDFLAGS $with_libmemcached_ldflags" + + AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"]) + + CPPFLAGS="$SAVE_CPPFLAGS" + LDFLAGS="$SAVE_LDFLAGS" +fi +if test "x$with_libmemcached" = "xyes" +then + BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags" + BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags" + BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached" + AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS) + AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS) + AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS) + AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.]) +fi +AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes") +# }}} + +# --with-libmodbus {{{ +with_libmodbus_config="" +with_libmodbus_cflags="" +with_libmodbus_libs="" +AC_ARG_WITH(libmodbus, [AS_HELP_STRING([--with-libmodbus@<:@=PREFIX@:>@], [Path to the modbus library.])], +[ + if test "x$withval" = "xno" + then + with_libmodbus="no" + else if test "x$withval" = "xyes" + then + with_libmodbus="use_pkgconfig" + else if test -d "$with_libmodbus/lib" + then + AC_MSG_NOTICE([Not checking for libmodbus: Manually configured]) + with_libmodbus_cflags="-I$withval/include" + with_libmodbus_libs="-L$withval/lib -lmodbus" + with_libmodbus="yes" + fi; fi; fi +], +[with_libmodbus="use_pkgconfig"]) + +# configure using pkg-config +if test "x$with_libmodbus" = "xuse_pkgconfig" +then + if test "x$PKG_CONFIG" = "x" + then + with_libmodbus="no (Don't have pkg-config)" + fi +fi +if test "x$with_libmodbus" = "xuse_pkgconfig" +then + AC_MSG_NOTICE([Checking for libmodbus using $PKG_CONFIG]) + $PKG_CONFIG --exists 'libmodbus' 2>/dev/null + if test $? -ne 0 + then + with_libmodbus="no (pkg-config doesn't know libmodbus)" + fi +fi +if test "x$with_libmodbus" = "xuse_pkgconfig" +then + with_libmodbus_cflags="`$PKG_CONFIG --cflags 'libmodbus'`" + if test $? -ne 0 + then + with_libmodbus="no ($PKG_CONFIG failed)" + fi + with_libmodbus_libs="`$PKG_CONFIG --libs 'libmodbus'`" + if test $? -ne 0 + then + with_libmodbus="no ($PKG_CONFIG failed)" + fi +fi +if test "x$with_libmodbus" = "xuse_pkgconfig" +then + with_libmodbus="yes" +fi + +# with_libmodbus_cflags and with_libmodbus_libs are set up now, let's do +# the actual checks. +if test "x$with_libmodbus" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags" + + AC_CHECK_HEADERS(modbus/modbus.h, [], [with_libmodbus="no (modbus/modbus.h not found)"]) + + CPPFLAGS="$SAVE_CPPFLAGS" +fi +if test "x$with_libmodbus" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + + CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags" + LDFLAGS="$LDFLAGS $with_libmodbus_libs" + + AC_CHECK_LIB(modbus, modbus_connect, + [with_libmodbus="yes"], + [with_libmodbus="no (symbol modbus_connect not found)"]) + + CPPFLAGS="$SAVE_CPPFLAGS" + LDFLAGS="$SAVE_LDFLAGS" +fi +if test "x$with_libmodbus" = "xyes" +then + BUILD_WITH_LIBMODBUS_CFLAGS="$with_libmodbus_cflags" + BUILD_WITH_LIBMODBUS_LIBS="$with_libmodbus_libs" + AC_SUBST(BUILD_WITH_LIBMODBUS_CFLAGS) + AC_SUBST(BUILD_WITH_LIBMODBUS_LIBS) +fi +# }}} + +# --with-libmongoc {{{ +AC_ARG_WITH(libmongoc, [AS_HELP_STRING([--with-libmongoc@<:@=PREFIX@:>@], [Path to libmongoc.])], +[ + if test "x$withval" = "xyes" + then + with_libmongoc="yes" + else if test "x$withval" = "xno" + then + with_libmongoc="no" + else + with_libmongoc="yes" + LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS -I$withval/include" + LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS -L$withval/lib" + fi; fi +], +[with_libmongoc="yes"]) + +SAVE_CPPFLAGS="$CPPFLAGS" +SAVE_LDFLAGS="$LDFLAGS" + +CPPFLAGS="$CPPFLAGS $LIBMONGOC_CPPFLAGS" +LDFLAGS="$LDFLAGS $LIBMONGOC_LDFLAGS" + +if test "x$with_libmongoc" = "xyes" +then + if test "x$LIBMONGOC_CPPFLAGS" != "x" + then + AC_MSG_NOTICE([libmongoc CPPFLAGS: $LIBMONGOC_CPPFLAGS]) + fi + AC_CHECK_HEADERS(mongo.h, + [with_libmongoc="yes"], + [with_libmongoc="no ('mongo.h' not found)"], +[#if HAVE_STDINT_H +# define MONGO_HAVE_STDINT 1 +#else +# define MONGO_USE_LONG_LONG_INT 1 +#endif +]) +fi +if test "x$with_libmongoc" = "xyes" +then + if test "x$LIBMONGOC_LDFLAGS" != "x" + then + AC_MSG_NOTICE([libmongoc LDFLAGS: $LIBMONGOC_LDFLAGS]) + fi + AC_CHECK_LIB(mongoc, mongo_run_command, + [with_libmongoc="yes"], + [with_libmongoc="no (symbol 'mongo_run_command' not found)"]) +fi + +CPPFLAGS="$SAVE_CPPFLAGS" +LDFLAGS="$SAVE_LDFLAGS" + +if test "x$with_libmongoc" = "xyes" +then + BUILD_WITH_LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS" + BUILD_WITH_LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS" + AC_SUBST(BUILD_WITH_LIBMONGOC_CPPFLAGS) + AC_SUBST(BUILD_WITH_LIBMONGOC_LDFLAGS) +fi +AM_CONDITIONAL(BUILD_WITH_LIBMONGOC, test "x$with_libmongoc" = "xyes") +# }}} + +# --with-libmysql {{{ +with_mysql_config="mysql_config" +with_mysql_cflags="" +with_mysql_libs="" +AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])], +[ + if test "x$withval" = "xno" + then + with_libmysql="no" + else if test "x$withval" = "xyes" + then + with_libmysql="yes" + else + if test -f "$withval" && test -x "$withval"; + then + with_mysql_config="$withval" + else if test -x "$withval/bin/mysql_config" + then + with_mysql_config="$withval/bin/mysql_config" + fi; fi + with_libmysql="yes" + fi; fi +], +[ + with_libmysql="yes" +]) +if test "x$with_libmysql" = "xyes" +then + with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null` + mysql_config_status=$? + + if test $mysql_config_status -ne 0 + then + with_libmysql="no ($with_mysql_config failed)" + else + SAVE_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $with_mysql_cflags" + + have_mysql_h="no" + have_mysql_mysql_h="no" + AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"]) + + if test "x$have_mysql_h" = "xno" + then + AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"]) + fi + + if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono" + then + with_libmysql="no (mysql.h not found)" + fi + + CPPFLAGS="$SAVE_CPPFLAGS" + fi +fi +if test "x$with_libmysql" = "xyes" +then + with_mysql_libs=`$with_mysql_config --libs_r 2>/dev/null` + mysql_config_status=$? + + if test $mysql_config_status -ne 0 + then + with_libmysql="no ($with_mysql_config failed)" + else + AC_CHECK_LIB(mysqlclient, mysql_init, + [with_libmysql="yes"], + [with_libmysql="no (symbol 'mysql_init' not found)"], + [$with_mysql_libs]) + + AC_CHECK_LIB(mysqlclient, mysql_get_server_version, + [with_libmysql="yes"], + [with_libmysql="no (symbol 'mysql_get_server_version' not found)"], + [$with_mysql_libs]) + fi +fi +if test "x$with_libmysql" = "xyes" +then + BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags" + BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs" + AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS) + AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS) +fi +AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes") +# }}} + +# --with-libmnl {{{ +with_libmnl_cflags="" +with_libmnl_libs="" +AC_ARG_WITH(libmnl, [AS_HELP_STRING([--with-libmnl@<:@=PREFIX@:>@], [Path to libmnl.])], +[ + echo "libmnl: withval = $withval" + if test "x$withval" = "xyes" + then + with_libmnl="yes" + else if test "x$withval" = "xno" + then + with_libmnl="no" + else + if test -d "$withval/include" + then + with_libmnl_cflags="-I$withval/include" + with_libmnl_libs="-L$withval/lib -lmnl" + with_libmnl="yes" + else + AC_MSG_ERROR("no such directory: $withval/include") + fi + fi; fi +], +[ + if test "x$ac_system" = "xLinux" + then + with_libmnl="yes" + else + with_libmnl="no (Linux only library)" + fi +]) +if test "x$PKG_CONFIG" = "x" +then + with_libmnl="no (Don't have pkg-config)" +fi +if test "x$with_libmnl" = "xyes" +then + if $PKG_CONFIG --exists libmnl 2>/dev/null; then + with_libmnl_cflags="$with_libmnl_ldflags `$PKG_CONFIG --cflags libmnl`" + with_libmnl_libs="$with_libmnl_libs `$PKG_CONFIG --libs libmnl`" + fi + + AC_CHECK_HEADERS(libmnl.h libmnl/libmnl.h, + [ + with_libmnl="yes" + break + ], [], +[#include +#include +#include +#include +#include +#include ]) + AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [], +[#include +#include +#include +#include ]) + + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( +[[ +#include +#include +#include +#include +#include +#include +]], +[[ +int retval = TCA_STATS2; +return (retval); +]] + )], + [AC_DEFINE([HAVE_TCA_STATS2], [1], [True if the enum-member TCA_STATS2 exists])]) + + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( +[[ +#include +#include +#include +#include +#include +#include +]], +[[ +int retval = TCA_STATS; +return (retval); +]] + )], + [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]) +fi +if test "x$with_libmnl" = "xyes" +then + AC_CHECK_LIB(mnl, mnl_nlmsg_get_payload, + [with_libmnl="yes"], + [with_libmnl="no (symbol 'mnl_nlmsg_get_payload' not found)"], + [$with_libmnl_libs]) +fi +if test "x$with_libmnl" = "xyes" +then + AC_DEFINE(HAVE_LIBMNL, 1, [Define if libmnl is present and usable.]) + BUILD_WITH_LIBMNL_CFLAGS="$with_libmnl_cflags" + BUILD_WITH_LIBMNL_LIBS="$with_libmnl_libs" + AC_SUBST(BUILD_WITH_LIBMNL_CFLAGS) + AC_SUBST(BUILD_WITH_LIBMNL_LIBS) +fi +AM_CONDITIONAL(BUILD_WITH_LIBMNL, test "x$with_libmnl" = "xyes") +# }}} + +# --with-libnetapp {{{ +AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp]) +AC_ARG_VAR([LIBNETAPP_LDFLAGS], [Linker flags required to build with libnetapp]) +AC_ARG_VAR([LIBNETAPP_LIBS], [Other libraries required to link against libnetapp]) +LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS" +LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS" +LIBNETAPP_LIBS="$LIBNETAPP_LIBS" +AC_ARG_WITH(libnetapp, [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])], +[ + if test -d "$withval" + then + LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include" + LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib" + with_libnetapp="yes" + else + with_libnetapp="$withval" + fi +], +[ + with_libnetapp="yes" +]) + +SAVE_CPPFLAGS="$CPPFLAGS" +SAVE_LDFLAGS="$LDFLAGS" +CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS" +LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS" + +if test "x$with_libnetapp" = "xyes" +then + if test "x$LIBNETAPP_CPPFLAGS" != "x" + then + AC_MSG_NOTICE([netapp CPPFLAGS: $LIBNETAPP_CPPFLAGS]) + fi + AC_CHECK_HEADERS(netapp_api.h, + [with_libnetapp="yes"], + [with_libnetapp="no (netapp_api.h not found)"]) +fi + +if test "x$with_libnetapp" = "xyes" +then + if test "x$LIBNETAPP_LDFLAGS" != "x" + then + AC_MSG_NOTICE([netapp LDFLAGS: $LIBNETAPP_LDFLAGS]) + fi + + if test "x$LIBNETAPP_LIBS" = "x" + then + LIBNETAPP_LIBS="-lpthread -lxml -ladt -lssl -lm -lcrypto -lz" + fi + AC_MSG_NOTICE([netapp LIBS: $LIBNETAPP_LIBS]) + + AC_CHECK_LIB(netapp, na_server_invoke_elem, + [with_libnetapp="yes"], + [with_libnetapp="no (symbol na_server_invoke_elem not found)"], + [$LIBNETAPP_LIBS]) + LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS" +fi + +CPPFLAGS="$SAVE_CPPFLAGS" +LDFLAGS="$SAVE_LDFLAGS" + +if test "x$with_libnetapp" = "xyes" +then + AC_DEFINE(HAVE_LIBNETAPP, 1, [Define to 1 if you have the netapp library (-lnetapp).]) +fi + +AC_SUBST(LIBNETAPP_CPPFLAGS) +AC_SUBST(LIBNETAPP_LDFLAGS) +AC_SUBST(LIBNETAPP_LIBS) +AM_CONDITIONAL(BUILD_WITH_LIBNETAPP, test "x$with_libnetapp" = "xyes") +# }}} + +# --with-libnetsnmp {{{ +with_snmp_config="net-snmp-config" +with_snmp_cflags="" +with_snmp_libs="" +AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])], +[ + if test "x$withval" = "xno" + then + with_libnetsnmp="no" + else if test "x$withval" = "xyes" + then + with_libnetsnmp="yes" + else + if test -x "$withval" + then + with_snmp_config="$withval" + with_libnetsnmp="yes" + else + with_snmp_config="$withval/bin/net-snmp-config" + with_libnetsnmp="yes" + fi + fi; fi +], +[with_libnetsnmp="yes"]) +if test "x$with_libnetsnmp" = "xyes" +then + with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null` + snmp_config_status=$? + + if test $snmp_config_status -ne 0 + then + with_libnetsnmp="no ($with_snmp_config failed)" + else + SAVE_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $with_snmp_cflags" + + AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"]) + + CPPFLAGS="$SAVE_CPPFLAGS" + fi +fi +if test "x$with_libnetsnmp" = "xyes" +then + with_snmp_libs=`$with_snmp_config --libs 2>/dev/null` + snmp_config_status=$? + + if test $snmp_config_status -ne 0 + then + with_libnetsnmp="no ($with_snmp_config failed)" + else + AC_CHECK_LIB(netsnmp, init_snmp, + [with_libnetsnmp="yes"], + [with_libnetsnmp="no (libnetsnmp not found)"], + [$with_snmp_libs]) + fi +fi +if test "x$with_libnetsnmp" = "xyes" +then + BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags" + BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs" + AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS) + AC_SUBST(BUILD_WITH_LIBSNMP_LIBS) +fi +AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes") +# }}} + +# --with-liboconfig {{{ +with_own_liboconfig="no" +liboconfig_LDFLAGS="$LDFLAGS" +liboconfig_CPPFLAGS="$CPPFLAGS" +AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])], +[ + if test "x$withval" != "xno" && test "x$withval" != "xyes" + then + if test -d "$withval/lib" + then + liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib" + fi + if test -d "$withval/include" + then + liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include" + fi + fi + if test "x$withval" = "xno" + then + AC_MSG_ERROR("liboconfig is required") + fi +], +[ + with_liboconfig="yes" +]) + +save_LDFLAGS="$LDFLAGS" +save_CPPFLAGS="$CPPFLAGS" +LDFLAGS="$liboconfig_LDFLAGS" +CPPFLAGS="$liboconfig_CPPFLAGS" +AC_CHECK_LIB(oconfig, oconfig_parse_fh, +[ + with_liboconfig="yes" + with_own_liboconfig="no" +], +[ + with_liboconfig="yes" + with_own_liboconfig="yes" + LDFLAGS="$save_LDFLAGS" + CPPFLAGS="$save_CPPFLAGS" +]) + +AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes") +if test "x$with_own_liboconfig" = "xyes" +then + with_liboconfig="yes (shipped version)" +fi +# }}} + +# --with-liboping {{{ +AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])], +[ + if test "x$withval" = "xyes" + then + with_liboping="yes" + else if test "x$withval" = "xno" + then + with_liboping="no" + else + with_liboping="yes" + LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include" + LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib" + fi; fi +], +[with_liboping="yes"]) + +SAVE_CPPFLAGS="$CPPFLAGS" +SAVE_LDFLAGS="$LDFLAGS" + +CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS" +LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS" + +if test "x$with_liboping" = "xyes" +then + if test "x$LIBOPING_CPPFLAGS" != "x" + then + AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS]) + fi + AC_CHECK_HEADERS(oping.h, + [with_liboping="yes"], + [with_liboping="no (oping.h not found)"]) +fi +if test "x$with_liboping" = "xyes" +then + if test "x$LIBOPING_LDFLAGS" != "x" + then + AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS]) + fi + AC_CHECK_LIB(oping, ping_construct, + [with_liboping="yes"], + [with_liboping="no (symbol 'ping_construct' not found)"]) +fi + +CPPFLAGS="$SAVE_CPPFLAGS" +LDFLAGS="$SAVE_LDFLAGS" + +if test "x$with_liboping" = "xyes" +then + BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS" + BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS" + AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS) + AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS) +fi +AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes") +# }}} + +# --with-oracle {{{ +with_oracle_cppflags="" +with_oracle_libs="" +AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])], +[ + if test "x$withval" = "xyes" + then + if test "x$ORACLE_HOME" = "x" + then + AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.]) + fi + with_oracle="yes" + else if test "x$withval" = "xno" + then + with_oracle="no" + else + with_oracle="yes" + ORACLE_HOME="$withval" + fi; fi +], +[ + if test "x$ORACLE_HOME" = "x" + then + with_oracle="no (ORACLE_HOME is not set)" + else + with_oracle="yes" + fi +]) +if test "x$ORACLE_HOME" != "x" +then + with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public" + + if test -e "$ORACLE_HOME/lib/ldflags" + then + with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"` + fi + #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh" + with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh" +fi +if test "x$with_oracle" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $with_oracle_cppflags" + + AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"]) + + CPPFLAGS="$SAVE_CPPFLAGS" +fi +if test "x$with_oracle" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_LIBS="$LIBS" + CPPFLAGS="$CPPFLAGS $with_oracle_cppflags" + LIBS="$LIBS $with_oracle_libs" + + AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"]) + + CPPFLAGS="$SAVE_CPPFLAGS" + LIBS="$SAVE_LIBS" +fi +if test "x$with_oracle" = "xyes" +then + BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags" + BUILD_WITH_ORACLE_LIBS="$with_oracle_libs" + AC_SUBST(BUILD_WITH_ORACLE_CFLAGS) + AC_SUBST(BUILD_WITH_ORACLE_LIBS) +fi +# }}} + +# --with-libowcapi {{{ +with_libowcapi_cppflags="" +with_libowcapi_libs="-lowcapi" +AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])], +[ + if test "x$withval" != "xno" && test "x$withval" != "xyes" + then + with_libowcapi_cppflags="-I$withval/include" + with_libowcapi_libs="-L$withval/lib -lowcapi" + with_libowcapi="yes" + else + with_libowcapi="$withval" + fi +], +[ + with_libowcapi="yes" +]) +if test "x$with_libowcapi" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$with_libowcapi_cppflags" + + AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"]) + + CPPFLAGS="$SAVE_CPPFLAGS" +fi +if test "x$with_libowcapi" = "xyes" +then + SAVE_LDFLAGS="$LDFLAGS" + SAVE_CPPFLAGS="$CPPFLAGS" + LDFLAGS="$with_libowcapi_libs" + CPPFLAGS="$with_libowcapi_cppflags" + + AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"]) + + LDFLAGS="$SAVE_LDFLAGS" + CPPFLAGS="$SAVE_CPPFLAGS" +fi +if test "x$with_libowcapi" = "xyes" +then + BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags" + BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs" + AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS) + AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS) +fi +# }}} + +# --with-libpcap {{{ +AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])], +[ + if test "x$withval" != "xno" && test "x$withval" != "xyes" + then + LDFLAGS="$LDFLAGS -L$withval/lib" + CPPFLAGS="$CPPFLAGS -I$withval/include" + with_libpcap="yes" + else + with_libpcap="$withval" + fi +], +[ + with_libpcap="yes" +]) +if test "x$with_libpcap" = "xyes" +then + AC_CHECK_LIB(pcap, pcap_open_live, + [ + AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).]) + ], [with_libpcap="no (libpcap not found)"]) +fi +if test "x$with_libpcap" = "xyes" +then + AC_CHECK_HEADERS(pcap.h,, + [with_libpcap="no (pcap.h not found)"]) +fi +if test "x$with_libpcap" = "xyes" +then + AC_CHECK_HEADERS(pcap-bpf.h,, + [with_libpcap="no (pcap-bpf.h not found)"]) +fi +if test "x$with_libpcap" = "xyes" +then + AC_CACHE_CHECK([whether libpcap has PCAP_ERROR_IFACE_NOT_UP], + [c_cv_libpcap_have_pcap_error_iface_not_up], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( +[[[ +#include +]]], +[[[ + int val = PCAP_ERROR_IFACE_NOT_UP; +]]] + )], + [c_cv_libpcap_have_pcap_error_iface_not_up="yes"], + [c_cv_libpcap_have_pcap_error_iface_not_up="no"])) +fi +if test "x$c_cv_libpcap_have_pcap_error_iface_not_up" != "xyes" +then + with_libpcap="no (pcap.h misses PCAP_ERROR_IFACE_NOT_UP)" +fi +AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes") +# }}} + +# --with-libperl {{{ +perl_interpreter="perl" +AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])], +[ + if test -f "$withval" && test -x "$withval" + then + perl_interpreter="$withval" + with_libperl="yes" + else if test "x$withval" != "xno" && test "x$withval" != "xyes" + then + LDFLAGS="$LDFLAGS -L$withval/lib" + CPPFLAGS="$CPPFLAGS -I$withval/include" + perl_interpreter="$withval/bin/perl" + with_libperl="yes" + else + with_libperl="$withval" + fi; fi +], +[ + with_libperl="yes" +]) + +AC_MSG_CHECKING([for perl]) +perl_interpreter=`which "$perl_interpreter" 2> /dev/null` +if test -x "$perl_interpreter" +then + AC_MSG_RESULT([yes ($perl_interpreter)]) +else + perl_interpreter="" + AC_MSG_RESULT([no]) +fi + +AC_SUBST(PERL, "$perl_interpreter") + +if test "x$with_libperl" = "xyes" \ + && test -n "$perl_interpreter" +then + SAVE_CFLAGS="$CFLAGS" + SAVE_LDFLAGS="$LDFLAGS" +dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string) + PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts` + PERL_LDFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts` + CFLAGS="$CFLAGS $PERL_CFLAGS" + LDFLAGS="$LDFLAGS $PERL_LDFLAGS" + + AC_CACHE_CHECK([for libperl], + [c_cv_have_libperl], + AC_LINK_IFELSE([AC_LANG_PROGRAM( +[[[ +#define PERL_NO_GET_CONTEXT +#include +#include +#include +]]], +[[[ + dTHX; + load_module (PERL_LOADMOD_NOIMPORT, + newSVpv ("Collectd::Plugin::FooBar", 24), + Nullsv); +]]] + )], + [c_cv_have_libperl="yes"], + [c_cv_have_libperl="no"] + ) + ) + + if test "x$c_cv_have_libperl" = "xyes" + then + AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.]) + AC_SUBST(PERL_CFLAGS) + AC_SUBST(PERL_LDFLAGS) + else + with_libperl="no" + fi + + CFLAGS="$SAVE_CFLAGS" + LDFLAGS="$SAVE_LDFLAGS" +else if test -z "$perl_interpreter"; then + with_libperl="no (no perl interpreter found)" + c_cv_have_libperl="no" +fi; fi +AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes") + +if test "x$with_libperl" = "xyes" +then + SAVE_CFLAGS="$CFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + CFLAGS="$CFLAGS $PERL_CFLAGS" + LDFLAGS="$LDFLAGS $PERL_LDFLAGS" + + AC_CACHE_CHECK([if perl supports ithreads], + [c_cv_have_perl_ithreads], + AC_LINK_IFELSE([AC_LANG_PROGRAM( +[[[ +#include +#include +#include + +#if !defined(USE_ITHREADS) +# error "Perl does not support ithreads!" +#endif /* !defined(USE_ITHREADS) */ +]]], +[[[ ]]] + )], + [c_cv_have_perl_ithreads="yes"], + [c_cv_have_perl_ithreads="no"] + ) + ) + + if test "x$c_cv_have_perl_ithreads" = "xyes" + then + AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.]) + fi + + CFLAGS="$SAVE_CFLAGS" + LDFLAGS="$SAVE_LDFLAGS" +fi + +if test "x$with_libperl" = "xyes" +then + SAVE_CFLAGS="$CFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3) + # (see issues #41 and #42) + CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror" + LDFLAGS="$LDFLAGS $PERL_LDFLAGS" + + AC_CACHE_CHECK([for broken Perl_load_module()], + [c_cv_have_broken_perl_load_module], + AC_LINK_IFELSE([AC_LANG_PROGRAM( +[[[ +#define PERL_NO_GET_CONTEXT +#include +#include +#include +]]], +[[[ + dTHX; + load_module (PERL_LOADMOD_NOIMPORT, + newSVpv ("Collectd::Plugin::FooBar", 24), + Nullsv); +]]] + )], + [c_cv_have_broken_perl_load_module="no"], + [c_cv_have_broken_perl_load_module="yes"] + ) + ) + + CFLAGS="$SAVE_CFLAGS" + LDFLAGS="$SAVE_LDFLAGS" +fi +AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE, + test "x$c_cv_have_broken_perl_load_module" = "xyes") + +if test "x$with_libperl" = "xyes" +then + SAVE_CFLAGS="$CFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + CFLAGS="$CFLAGS $PERL_CFLAGS" + LDFLAGS="$LDFLAGS $PERL_LDFLAGS" + + AC_CHECK_MEMBER( + [struct mgvtbl.svt_local], + [have_struct_mgvtbl_svt_local="yes"], + [have_struct_mgvtbl_svt_local="no"], + [ +#include +#include +#include + ]) + + if test "x$have_struct_mgvtbl_svt_local" = "xyes" + then + AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1, + [Define if Perl's struct mgvtbl has member svt_local.]) + fi + + CFLAGS="$SAVE_CFLAGS" + LDFLAGS="$SAVE_LDFLAGS" +fi +# }}} + +# --with-libpq {{{ +with_pg_config="pg_config" +with_libpq_includedir="" +with_libpq_libdir="" +with_libpq_cppflags="" +with_libpq_ldflags="" +AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@], + [Path to libpq.])], +[ + if test "x$withval" = "xno" + then + with_libpq="no" + else if test "x$withval" = "xyes" + then + with_libpq="yes" + else + if test -f "$withval" && test -x "$withval"; + then + with_pg_config="$withval" + else if test -x "$withval/bin/pg_config" + then + with_pg_config="$withval/bin/pg_config" + fi; fi + with_libpq="yes" + fi; fi +], +[ + with_libpq="yes" +]) +if test "x$with_libpq" = "xyes" +then + with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null` + pg_config_status=$? + + if test $pg_config_status -eq 0 + then + if test -n "$with_libpq_includedir"; then + for dir in $with_libpq_includedir; do + with_libpq_cppflags="$with_libpq_cppflags -I$dir" + done + fi + else + AC_MSG_WARN([$with_pg_config returned with status $pg_config_status]) + fi + + SAVE_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $with_libpq_cppflags" + + AC_CHECK_HEADERS(libpq-fe.h, [], + [with_libpq="no (libpq-fe.h not found)"], []) + + CPPFLAGS="$SAVE_CPPFLAGS" +fi +if test "x$with_libpq" = "xyes" +then + with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null` + pg_config_status=$? + + if test $pg_config_status -eq 0 + then + if test -n "$with_libpq_libdir"; then + for dir in $with_libpq_libdir; do + with_libpq_ldflags="$with_libpq_ldflags -L$dir" + done + fi + else + AC_MSG_WARN([$with_pg_config returned with status $pg_config_status]) + fi + + SAVE_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $with_libpq_ldflags" + + AC_CHECK_LIB(pq, PQconnectdb, + [with_libpq="yes"], + [with_libpq="no (symbol 'PQconnectdb' not found)"]) + + AC_CHECK_LIB(pq, PQserverVersion, + [with_libpq="yes"], + [with_libpq="no (symbol 'PQserverVersion' not found)"]) + + LDFLAGS="$SAVE_LDFLAGS" +fi +if test "x$with_libpq" = "xyes" +then + BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags" + BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags" + AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS) + AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS) +fi +AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes") +# }}} + +# --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"]) +if test "x$with_libpthread" = "xyes" +then + AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], []) +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") +# }}} + +# --with-python {{{ +with_python_prog="" +with_python_path="$PATH" +AC_ARG_WITH(python, [AS_HELP_STRING([--with-python@<:@=PREFIX@:>@], [Path to the python interpreter.])], +[ + if test "x$withval" = "xyes" || test "x$withval" = "xno" + then + with_python="$withval" + else if test -x "$withval" + then + with_python_prog="$withval" + with_python_path="`dirname \"$withval\"`$PATH_SEPARATOR$with_python_path" + with_python="yes" + else if test -d "$withval" + then + with_python_path="$withval$PATH_SEPARATOR$with_python_path" + with_python="yes" + else + AC_MSG_WARN([Argument not recognized: $withval]) + fi; fi; fi +], [with_python="yes"]) + +SAVE_PATH="$PATH" +SAVE_CPPFLAGS="$CPPFLAGS" +SAVE_LDFLAGS="$LDFLAGS" +SAVE_LIBS="$LIBS" + +PATH="$with_python_path" + +if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x" +then + AC_MSG_CHECKING([for python]) + with_python_prog="`which python 2>/dev/null`" + if test "x$with_python_prog" = "x" + then + AC_MSG_RESULT([not found]) + with_python="no (interpreter not found)" + else + AC_MSG_RESULT([$with_python_prog]) + fi +fi + +if test "x$with_python" = "xyes" +then + AC_MSG_CHECKING([for Python CPPFLAGS]) + python_include_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_python_inc())" | "$with_python_prog" 2>&1` + python_config_status=$? + + if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x" + then + AC_MSG_RESULT([failed with status $python_config_status (output: $python_include_path)]) + with_python="no" + else + AC_MSG_RESULT([$python_include_path]) + fi +fi + +if test "x$with_python" = "xyes" +then + CPPFLAGS="-I$python_include_path $CPPFLAGS" + AC_CHECK_HEADERS(Python.h, + [with_python="yes"], + [with_python="no ('Python.h' not found)"]) +fi + +if test "x$with_python" = "xyes" +then + AC_MSG_CHECKING([for Python LDFLAGS]) + python_library_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_config_vars(\"LIBDIR\").__getitem__(0))" | "$with_python_prog" 2>&1` + python_config_status=$? + + if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x" + then + AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_path)]) + with_python="no" + else + AC_MSG_RESULT([$python_library_path]) + fi +fi + +if test "x$with_python" = "xyes" +then + AC_MSG_CHECKING([for Python LIBS]) + python_library_flags=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_config_vars(\"BLDLIBRARY\").__getitem__(0))" | "$with_python_prog" 2>&1` + python_config_status=$? + + if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x" + then + AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_flags)]) + with_python="no" + else + AC_MSG_RESULT([$python_library_flags]) + fi +fi + +if test "x$with_python" = "xyes" +then + LDFLAGS="-L$python_library_path $LDFLAGS" + LIBS="$python_library_flags $LIBS" + + AC_CHECK_FUNC(PyObject_CallFunction, + [with_python="yes"], + [with_python="no (Symbol 'PyObject_CallFunction' not found)"]) +fi + +PATH="$SAVE_PATH" +CPPFLAGS="$SAVE_CPPFLAGS" +LDFLAGS="$SAVE_LDFLAGS" +LIBS="$SAVE_LIBS" + +if test "x$with_python" = "xyes" +then + BUILD_WITH_PYTHON_CPPFLAGS="-I$python_include_path" + BUILD_WITH_PYTHON_LDFLAGS="-L$python_library_path" + BUILD_WITH_PYTHON_LIBS="$python_library_flags" + AC_SUBST(BUILD_WITH_PYTHON_CPPFLAGS) + AC_SUBST(BUILD_WITH_PYTHON_LDFLAGS) + AC_SUBST(BUILD_WITH_PYTHON_LIBS) +fi +# }}} --with-python + +# --with-librabbitmq {{{ +with_librabbitmq_cppflags="" +with_librabbitmq_ldflags="" +AC_ARG_WITH(librabbitmq, [AS_HELP_STRING([--with-librabbitmq@<:@=PREFIX@:>@], [Path to librabbitmq.])], +[ + if test "x$withval" != "xno" && test "x$withval" != "xyes" + then + with_librabbitmq_cppflags="-I$withval/include" + with_librabbitmq_ldflags="-L$withval/lib" + with_librabbitmq="yes" + else + with_librabbitmq="$withval" + fi +], +[ + with_librabbitmq="yes" +]) +SAVE_CPPFLAGS="$CPPFLAGS" +SAVE_LDFLAGS="$LDFLAGS" +CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags" +LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags" +if test "x$with_librabbitmq" = "xyes" +then + AC_CHECK_HEADERS(amqp.h, [with_librabbitmq="yes"], [with_librabbitmq="no (amqp.h not found)"]) +fi +if test "x$with_librabbitmq" = "xyes" +then + # librabbitmq up to version 0.9.1 provides "library_errno", later + # versions use "library_error". The library does not provide a version + # macro :( Use "AC_CHECK_MEMBERS" (plural) for automatic defines. + AC_CHECK_MEMBERS([amqp_rpc_reply_t.library_errno],,, + [ +#if HAVE_STDLIB_H +# include +#endif +#if HAVE_STDIO_H +# include +#endif +#if HAVE_STDINT_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#endif +#include + ]) +fi +if test "x$with_librabbitmq" = "xyes" +then + AC_CHECK_LIB(rabbitmq, amqp_basic_publish, [with_librabbitmq="yes"], [with_librabbitmq="no (Symbol 'amqp_basic_publish' not found)"]) +fi +if test "x$with_librabbitmq" = "xyes" +then + BUILD_WITH_LIBRABBITMQ_CPPFLAGS="$with_librabbitmq_cppflags" + BUILD_WITH_LIBRABBITMQ_LDFLAGS="$with_librabbitmq_ldflags" + BUILD_WITH_LIBRABBITMQ_LIBS="-lrabbitmq" + AC_SUBST(BUILD_WITH_LIBRABBITMQ_CPPFLAGS) + AC_SUBST(BUILD_WITH_LIBRABBITMQ_LDFLAGS) + AC_SUBST(BUILD_WITH_LIBRABBITMQ_LIBS) + AC_DEFINE(HAVE_LIBRABBITMQ, 1, [Define if librabbitmq is present and usable.]) +fi +CPPFLAGS="$SAVE_CPPFLAGS" +LDFLAGS="$SAVE_LDFLAGS" +AM_CONDITIONAL(BUILD_WITH_LIBRABBITMQ, test "x$with_librabbitmq" = "xyes") + +with_amqp_tcp_socket="no" +if test "x$with_librabbitmq" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + SAVE_LIBS="$LIBS" + CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags" + LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags" + LIBS="-lrabbitmq" + + AC_CHECK_HEADERS(amqp_tcp_socket.h amqp_socket.h) + AC_CHECK_FUNC(amqp_tcp_socket_new, [with_amqp_tcp_socket="yes"], [with_amqp_tcp_socket="no"]) + if test "x$with_amqp_tcp_socket" = "xyes" + then + AC_DEFINE(HAVE_AMQP_TCP_SOCKET, 1, + [Define if librabbitmq provides the new TCP socket interface.]) + fi + + AC_CHECK_DECLS(amqp_socket_close, + [amqp_socket_close_decl="yes"], [amqp_socket_close_decl="no"], + [[ +#include +#ifdef HAVE_AMQP_TCP_SOCKET_H +# include +#endif +#ifdef HAVE_AMQP_SOCKET_H +# include +#endif + ]]) + + CPPFLAGS="$SAVE_CPPFLAGS" + LDFLAGS="$SAVE_LDFLAGS" + LIBS="$SAVE_LIBS" +fi +# }}} + +# --with-librouteros {{{ +AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])], +[ + if test "x$withval" = "xyes" + then + with_librouteros="yes" + else if test "x$withval" = "xno" + then + with_librouteros="no" + else + with_librouteros="yes" + LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include" + LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib" + fi; fi +], +[with_librouteros="yes"]) + +SAVE_CPPFLAGS="$CPPFLAGS" +SAVE_LDFLAGS="$LDFLAGS" + +CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS" +LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS" + +if test "x$with_librouteros" = "xyes" +then + if test "x$LIBROUTEROS_CPPFLAGS" != "x" + then + AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS]) + fi + AC_CHECK_HEADERS(routeros_api.h, + [with_librouteros="yes"], + [with_librouteros="no (routeros_api.h not found)"]) +fi +if test "x$with_librouteros" = "xyes" +then + if test "x$LIBROUTEROS_LDFLAGS" != "x" + then + AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS]) + fi + AC_CHECK_LIB(routeros, ros_interface, + [with_librouteros="yes"], + [with_librouteros="no (symbol 'ros_interface' not found)"]) +fi + +CPPFLAGS="$SAVE_CPPFLAGS" +LDFLAGS="$SAVE_LDFLAGS" + +if test "x$with_librouteros" = "xyes" +then + BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS" + BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS" + AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS) + AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS) +fi +AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes") +# }}} + +# --with-librrd {{{ +# AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given]) +librrd_cflags="" +librrd_ldflags="" +librrd_threadsafe="yes" +librrd_rrdc_update="no" +AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])], +[ if test "x$withval" != "xno" && test "x$withval" != "xyes" + then + librrd_cflags="-I$withval/include" + librrd_ldflags="-L$withval/lib" + with_librrd="yes" + else + with_librrd="$withval" + fi +], [with_librrd="yes"]) +if test "x$with_librrd" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + + CPPFLAGS="$CPPFLAGS $librrd_cflags" + LDFLAGS="$LDFLAGS $librrd_ldflags" + + AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"]) + + CPPFLAGS="$SAVE_CPPFLAGS" + LDFLAGS="$SAVE_LDFLAGS" +fi +if test "x$with_librrd" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + + CPPFLAGS="$CPPFLAGS $librrd_cflags" + LDFLAGS="$LDFLAGS $librrd_ldflags" + + AC_CHECK_LIB(rrd_th, rrd_update_r, + [with_librrd="yes" + librrd_ldflags="$librrd_ldflags -lrrd_th -lm" + ], + [librrd_threadsafe="no" + AC_CHECK_LIB(rrd, rrd_update, + [with_librrd="yes" + librrd_ldflags="$librrd_ldflags -lrrd -lm" + ], + [with_librrd="no (symbol 'rrd_update' not found)"], + [-lm]) + ], + [-lm]) + + if test "x$librrd_threadsafe" = "xyes" + then + AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"]) + else + AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"]) + fi + + CPPFLAGS="$SAVE_CPPFLAGS" + LDFLAGS="$SAVE_LDFLAGS" +fi +if test "x$with_librrd" = "xyes" +then + BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags" + BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags" + AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS) + AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS) +fi +if test "x$librrd_threadsafe" = "xyes" +then + AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).]) +fi +# }}} + +# --with-libsensors {{{ +with_sensors_cflags="" +with_sensors_ldflags="" +AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])], +[ + if test "x$withval" = "xno" + then + with_libsensors="no" + else + with_libsensors="yes" + if test "x$withval" != "xyes" + then + with_sensors_cflags="-I$withval/include" + with_sensors_ldflags="-L$withval/lib" + with_libsensors="yes" + fi + fi +], +[ + if test "x$ac_system" = "xLinux" + then + with_libsensors="yes" + else + with_libsensors="no (Linux only library)" + fi +]) +if test "x$with_libsensors" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $with_sensors_cflags" + +# AC_CHECK_HEADERS(sensors/sensors.h, +# [ +# AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the header file.]) +# ], +# [with_libsensors="no (sensors/sensors.h not found)"]) + AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"]) + + CPPFLAGS="$SAVE_CPPFLAGS" +fi +if test "x$with_libsensors" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + CPPFLAGS="$CPPFLAGS $with_sensors_cflags" + LDFLAGS="$LDFLAGS $with_sensors_ldflags" + + AC_CHECK_LIB(sensors, sensors_init, + [ + AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).]) + ], + [with_libsensors="no (libsensors not found)"]) + + CPPFLAGS="$SAVE_CPPFLAGS" + LDFLAGS="$SAVE_LDFLAGS" +fi +if test "x$with_libsensors" = "xyes" +then + BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags" + BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags" + AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS) + AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS) +fi +AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes") +# }}} + +# --with-libsigrok {{{ +with_libsigrok_cflags="" +with_libsigrok_ldflags="" +AC_ARG_WITH(libsigrok, [AS_HELP_STRING([--with-libsigrok@<:@=PREFIX@:>@], [Path to libsigrok.])], +[ + if test "x$withval" = "xno" + then + with_libsigrok="no" + else + with_libsigrok="yes" + if test "x$withval" != "xyes" + then + with_libsigrok_cflags="-I$withval/include" + with_libsigrok_ldflags="-L$withval/lib" + fi + fi +],[with_libsigrok="yes"]) + +# libsigrok has a glib dependency +if test "x$with_libsigrok" = "xyes" +then +m4_ifdef([AM_PATH_GLIB_2_0], + [ + AM_PATH_GLIB_2_0([2.28.0], + [with_libsigrok_cflags="$with_libsigrok_cflags $GLIB_CFLAGS"; with_libsigrok_ldflags="$with_libsigrok_ldflags $GLIB_LIBS"]) + ], + [ + with_libsigrok="no (glib not available)" + ] +) +fi + +# libsigrok headers +if test "x$with_libsigrok" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $with_libsigrok_cflags" + + AC_CHECK_HEADERS(libsigrok/libsigrok.h, [], [with_libsigrok="no (libsigrok/libsigrok.h not found)"]) + + CPPFLAGS="$SAVE_CPPFLAGS" +fi + +# libsigrok library +if test "x$with_libsigrok" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + CPPFLAGS="$CPPFLAGS $with_libsigrok_cflags" + LDFLAGS="$LDFLAGS $with_libsigrok_ldflags" + + AC_CHECK_LIB(sigrok, sr_init, + [ + AC_DEFINE(HAVE_LIBSIGROK, 1, [Define to 1 if you have the sigrok library (-lsigrok).]) + ], + [with_libsigrok="no (libsigrok not found)"]) + + CPPFLAGS="$SAVE_CPPFLAGS" + LDFLAGS="$SAVE_LDFLAGS" +fi +if test "x$with_libsigrok" = "xyes" +then + BUILD_WITH_LIBSIGROK_CFLAGS="$with_libsigrok_cflags" + BUILD_WITH_LIBSIGROK_LDFLAGS="$with_libsigrok_ldflags" + AC_SUBST(BUILD_WITH_LIBSIGROK_CFLAGS) + AC_SUBST(BUILD_WITH_LIBSIGROK_LDFLAGS) +fi +AM_CONDITIONAL(BUILD_WITH_LIBSIGROK, test "x$with_libsigrok" = "xyes") +# }}} + +# --with-libstatgrab {{{ +with_libstatgrab_cflags="" +with_libstatgrab_ldflags="" +AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])], +[ + if test "x$withval" != "xno" \ + && test "x$withval" != "xyes" + then + with_libstatgrab_cflags="-I$withval/include" + with_libstatgrab_ldflags="-L$withval/lib -lstatgrab" + with_libstatgrab="yes" + with_libstatgrab_pkg_config="no" + else + with_libstatgrab="$withval" + with_libstatgrab_pkg_config="yes" + fi + ], +[ + with_libstatgrab="yes" + with_libstatgrab_pkg_config="yes" +]) + +if test "x$with_libstatgrab" = "xyes" \ + && test "x$with_libstatgrab_pkg_config" = "xyes" +then + if test "x$PKG_CONFIG" != "x" + then + AC_MSG_CHECKING([pkg-config for libstatgrab]) + temp_result="found" + $PKG_CONFIG --exists libstatgrab 2>/dev/null + if test "$?" != "0" + then + with_libstatgrab_pkg_config="no" + with_libstatgrab="no (pkg-config doesn't know libstatgrab)" + temp_result="not found" + fi + AC_MSG_RESULT([$temp_result]) + else + AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.]) + with_libstatgrab_pkg_config="no" + with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab" + fi +fi + +if test "x$with_libstatgrab" = "xyes" \ + && test "x$with_libstatgrab_pkg_config" = "xyes" \ + && test "x$with_libstatgrab_cflags" = "x" +then + AC_MSG_CHECKING([for libstatgrab CFLAGS]) + temp_result="`$PKG_CONFIG --cflags libstatgrab`" + if test "$?" = "0" + then + with_libstatgrab_cflags="$temp_result" + else + with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)" + temp_result="$PKG_CONFIG --cflags libstatgrab failed" + fi + AC_MSG_RESULT([$temp_result]) +fi + +if test "x$with_libstatgrab" = "xyes" \ + && test "x$with_libstatgrab_pkg_config" = "xyes" \ + && test "x$with_libstatgrab_ldflags" = "x" +then + AC_MSG_CHECKING([for libstatgrab LDFLAGS]) + temp_result="`$PKG_CONFIG --libs libstatgrab`" + if test "$?" = "0" + then + with_libstatgrab_ldflags="$temp_result" + else + with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)" + temp_result="$PKG_CONFIG --libs libstatgrab failed" + fi + AC_MSG_RESULT([$temp_result]) +fi + +if test "x$with_libstatgrab" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags" + + AC_CHECK_HEADERS(statgrab.h, + [with_libstatgrab="yes"], + [with_libstatgrab="no (statgrab.h not found)"]) + + CPPFLAGS="$SAVE_CPPFLAGS" +fi + +if test "x$with_libstatgrab" = "xyes" +then + SAVE_CFLAGS="$CFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + + CFLAGS="$CFLAGS $with_libstatgrab_cflags" + LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags" + + AC_CHECK_LIB(statgrab, sg_init, + [with_libstatgrab="yes"], + [with_libstatgrab="no (symbol sg_init not found)"]) + + CFLAGS="$SAVE_CFLAGS" + LDFLAGS="$SAVE_LDFLAGS" +fi + +AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes") +if test "x$with_libstatgrab" = "xyes" +then + AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)]) + BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags" + BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags" + AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS) + AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS) +fi +# }}} + +# --with-libtokyotyrant {{{ +with_libtokyotyrant_cppflags="" +with_libtokyotyrant_ldflags="" +with_libtokyotyrant_libs="" +AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])], +[ + if test "x$withval" = "xno" + then + with_libtokyotyrant="no" + else if test "x$withval" = "xyes" + then + with_libtokyotyrant="yes" + else + with_libtokyotyrant_cppflags="-I$withval/include" + with_libtokyotyrant_ldflags="-L$withval/include" + with_libtokyotyrant_libs="-ltokyotyrant" + with_libtokyotyrant="yes" + fi; fi +], +[ + with_libtokyotyrant="yes" +]) + +if test "x$with_libtokyotyrant" = "xyes" +then + if $PKG_CONFIG --exists tokyotyrant + then + with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`" + with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `$PKG_CONFIG --libs-only-L tokyotyrant`" + with_libtokyotyrant_libs="$with_libtokyotyrant_libs `$PKG_CONFIG --libs-only-l tokyotyrant`" + fi +fi + +SAVE_CPPFLAGS="$CPPFLAGS" +SAVE_LDFLAGS="$LDFLAGS" +CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags" +LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags" + +if test "x$with_libtokyotyrant" = "xyes" +then + AC_CHECK_HEADERS(tcrdb.h, + [ + AC_DEFINE(HAVE_TCRDB_H, 1, + [Define to 1 if you have the header file.]) + ], [with_libtokyotyrant="no (tcrdb.h not found)"]) +fi + +if test "x$with_libtokyotyrant" = "xyes" +then + AC_CHECK_LIB(tokyotyrant, tcrdbrnum, + [ + AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1, + [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).]) + ], + [with_libtokyotyrant="no (symbol tcrdbrnum not found)"], + [$with_libtokyotyrant_libs]) +fi + +CPPFLAGS="$SAVE_CPPFLAGS" +LDFLAGS="$SAVE_LDFLAGS" + +if test "x$with_libtokyotyrant" = "xyes" +then + BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags" + BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags" + BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs" + AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS) + AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS) + AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS) +fi +AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes") +# }}} + +# --with-libupsclient {{{ +with_libupsclient_config="" +with_libupsclient_cflags="" +with_libupsclient_libs="" +AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the upsclient library.])], +[ + if test "x$withval" = "xno" + then + with_libupsclient="no" + else if test "x$withval" = "xyes" + then + with_libupsclient="use_pkgconfig" + else + if test -x "$withval" + then + with_libupsclient_config="$withval" + with_libupsclient="use_libupsclient_config" + else if test -x "$withval/bin/libupsclient-config" + then + with_libupsclient_config="$withval/bin/libupsclient-config" + with_libupsclient="use_libupsclient_config" + else + AC_MSG_NOTICE([Not checking for libupsclient: Manually configured]) + with_libupsclient_cflags="-I$withval/include" + with_libupsclient_libs="-L$withval/lib -lupsclient" + with_libupsclient="yes" + fi; fi + fi; fi +], +[with_libupsclient="use_pkgconfig"]) + +# configure using libupsclient-config +if test "x$with_libupsclient" = "xuse_libupsclient_config" +then + AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config]) + with_libupsclient_cflags="`$with_libupsclient_config --cflags`" + if test $? -ne 0 + then + with_libupsclient="no ($with_libupsclient_config failed)" + fi + with_libupsclient_libs="`$with_libupsclient_config --libs`" + if test $? -ne 0 + then + with_libupsclient="no ($with_libupsclient_config failed)" + fi +fi +if test "x$with_libupsclient" = "xuse_libupsclient_config" +then + with_libupsclient="yes" +fi + +# configure using pkg-config +if test "x$with_libupsclient" = "xuse_pkgconfig" +then + if test "x$PKG_CONFIG" = "x" + then + with_libupsclient="no (Don't have pkg-config)" + fi +fi +if test "x$with_libupsclient" = "xuse_pkgconfig" +then + AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG]) + $PKG_CONFIG --exists 'libupsclient' 2>/dev/null + if test $? -ne 0 + then + with_libupsclient="no (pkg-config doesn't know libupsclient)" + fi +fi +if test "x$with_libupsclient" = "xuse_pkgconfig" +then + with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`" + if test $? -ne 0 + then + with_libupsclient="no ($PKG_CONFIG failed)" + fi + with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`" + if test $? -ne 0 + then + with_libupsclient="no ($PKG_CONFIG failed)" + fi +fi +if test "x$with_libupsclient" = "xuse_pkgconfig" +then + with_libupsclient="yes" +fi + +# with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do +# the actual checks. +if test "x$with_libupsclient" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags" + + AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"]) + + CPPFLAGS="$SAVE_CPPFLAGS" +fi +if test "x$with_libupsclient" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + + CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags" + LDFLAGS="$LDFLAGS $with_libupsclient_libs" + + AC_CHECK_LIB(upsclient, upscli_connect, + [with_libupsclient="yes"], + [with_libupsclient="no (symbol upscli_connect not found)"]) + + CPPFLAGS="$SAVE_CPPFLAGS" + LDFLAGS="$SAVE_LDFLAGS" +fi +if test "x$with_libupsclient" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags" + + AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [], +[#include +#include +#include ]) + + CPPFLAGS="$SAVE_CPPFLAGS" +fi +if test "x$with_libupsclient" = "xyes" +then + BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags" + BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs" + AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS) + AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS) +fi +# }}} + +# --with-libxmms {{{ +with_xmms_config="xmms-config" +with_xmms_cflags="" +with_xmms_libs="" +AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])], +[ + if test "x$withval" != "xno" \ + && test "x$withval" != "xyes" + then + if test -f "$withval" && test -x "$withval"; + then + with_xmms_config="$withval" + else if test -x "$withval/bin/xmms-config" + then + with_xmms_config="$withval/bin/xmms-config" + fi; fi + with_libxmms="yes" + else if test "x$withval" = "xno" + then + with_libxmms="no" + else + with_libxmms="yes" + fi; fi +], +[ + with_libxmms="yes" +]) +if test "x$with_libxmms" = "xyes" +then + with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null` + xmms_config_status=$? + + if test $xmms_config_status -ne 0 + then + with_libxmms="no" + fi +fi +if test "x$with_libxmms" = "xyes" +then + with_xmms_libs=`$with_xmms_config --libs 2>/dev/null` + xmms_config_status=$? + + if test $xmms_config_status -ne 0 + then + with_libxmms="no" + fi +fi +if test "x$with_libxmms" = "xyes" +then + AC_CHECK_LIB(xmms, xmms_remote_get_info, + [ + BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags" + BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs" + AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS) + AC_SUBST(BUILD_WITH_LIBXMMS_LIBS) + ], + [ + with_libxmms="no" + ], + [$with_xmms_libs]) +fi +with_libxmms_numeric=0 +if test "x$with_libxmms" = "xyes" +then + with_libxmms_numeric=1 +fi +AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).]) +AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes") +# }}} + +# --with-libyajl {{{ +with_libyajl_cppflags="" +with_libyajl_ldflags="" +AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])], +[ + if test "x$withval" != "xno" && test "x$withval" != "xyes" + then + with_libyajl_cppflags="-I$withval/include" + with_libyajl_ldflags="-L$withval/lib" + with_libyajl="yes" + else + with_libyajl="$withval" + fi +], +[ + with_libyajl="yes" +]) +if test "x$with_libyajl" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags" + + AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"]) + AC_CHECK_HEADERS(yajl/yajl_version.h) + + CPPFLAGS="$SAVE_CPPFLAGS" +fi +if test "x$with_libyajl" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags" + LDFLAGS="$LDFLAGS $with_libyajl_ldflags" + + AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"]) + + CPPFLAGS="$SAVE_CPPFLAGS" + LDFLAGS="$SAVE_LDFLAGS" +fi +if test "x$with_libyajl" = "xyes" +then + BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags" + BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags" + BUILD_WITH_LIBYAJL_LIBS="-lyajl" + AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS) + AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS) + AC_SUBST(BUILD_WITH_LIBYAJL_LIBS) + AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.]) +fi +AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes") +# }}} + +# --with-mic {{{ +with_mic_cflags="-I/opt/intel/mic/sysmgmt/sdk/include" +with_mic_ldpath="-L/opt/intel/mic/sysmgmt/sdk/lib/Linux" +with_mic_libs="" +AC_ARG_WITH(mic,[AS_HELP_STRING([--with-mic@<:@=PREFIX@:>@], [Path to Intel MIC Access API.])], +[ + if test "x$withval" = "xno" + then + with_mic="no" + else if test "x$withval" = "xyes" + then + with_mic="yes" + else if test -d "$with_mic/lib" + then + AC_MSG_NOTICE([Not checking for Intel Mic: Manually configured]) + with_mic_cflags="-I$withval/include" + with_mic_ldpath="-L$withval/lib/Linux" + with_mic_libs="-lMicAccessSDK -lscif -lpthread" + with_mic="yes" + fi; fi; fi +], +[with_mic="yes"]) +if test "x$with_mic" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $with_mic_cflags" + AC_CHECK_HEADERS(MicAccessApi.h,[],[with_mic="no (MicAccessApi not found)"]) + CPPFLAGS="$SAVE_CPPFLAGS" +fi +if test "x$with_mic" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + + CPPFLAGS="$CPPFLAGS $with_mic_cflags" + LDFLAGS="$LDFLAGS $with_mic_ldpath" + + AC_CHECK_LIB(MicAccessSDK, MicInitAPI, + [with_mic_ldpath="$with_mic_ldpath" + with_mic_libs="-lMicAccessSDK -lscif -lpthread"], + [with_mic="no (symbol MicInitAPI not found)"],[-lscif -lpthread]) + + CPPFLAGS="$SAVE_CPPFLAGS" + LDFLAGS="$SAVE_LDFLAGS" +fi + +if test "x$with_mic" = "xyes" +then + BUILD_WITH_MIC_CPPFLAGS="$with_mic_cflags" + BUILD_WITH_MIC_LIBPATH="$with_mic_ldpath" + BUILD_WITH_MIC_LDADD="$with_mic_libs" + AC_SUBST(BUILD_WITH_MIC_CPPFLAGS) + AC_SUBST(BUILD_WITH_MIC_LIBPATH) + AC_SUBST(BUILD_WITH_MIC_LDADD) +fi +#}}} + +# --with-libvarnish {{{ +with_libvarnish_cppflags="" +with_libvarnish_cflags="" +with_libvarnish_libs="" +AC_ARG_WITH(libvarnish, [AS_HELP_STRING([--with-libvarnish@<:@=PREFIX@:>@], [Path to libvarnish.])], +[ + if test "x$withval" = "xno" + then + with_libvarnish="no" + else if test "x$withval" = "xyes" + then + with_libvarnish="use_pkgconfig" + else if test -d "$with_libvarnish/lib" + then + AC_MSG_NOTICE([Not checking for libvarnish: Manually configured]) + with_libvarnish_cflags="-I$withval/include" + with_libvarnish_libs="-L$withval/lib -lvarnishapi" + with_libvarnish="yes" + fi; fi; fi +], +[with_libvarnish="use_pkgconfig"]) + +# configure using pkg-config +if test "x$with_libvarnish" = "xuse_pkgconfig" +then + if test "x$PKG_CONFIG" = "x" + then + with_libvarnish="no (Don't have pkg-config)" + fi +fi +if test "x$with_libvarnish" = "xuse_pkgconfig" +then + AC_MSG_NOTICE([Checking for varnishapi using $PKG_CONFIG]) + $PKG_CONFIG --exists 'varnishapi' 2>/dev/null + if test $? -ne 0 + then + with_libvarnish="no (pkg-config doesn't know varnishapi)" + fi +fi +if test "x$with_libvarnish" = "xuse_pkgconfig" +then + with_libvarnish_cflags="`$PKG_CONFIG --cflags 'varnishapi'`" + if test $? -ne 0 + then + with_libvarnish="no ($PKG_CONFIG failed)" + fi + with_libvarnish_libs="`$PKG_CONFIG --libs 'varnishapi'`" + if test $? -ne 0 + then + with_libvarnish="no ($PKG_CONFIG failed)" + fi +fi +if test "x$with_libvarnish" = "xuse_pkgconfig" +then + with_libvarnish="yes" +fi + +# with_libvarnish_cflags and with_libvarnish_libs are set up now, let's do +# the actual checks. +if test "x$with_libvarnish" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags" + AC_CHECK_HEADERS(varnish/varnishapi.h, [], [with_libvarnish="no (varnish/varnishapi.h not found)"]) + + CPPFLAGS="$SAVE_CPPFLAGS" +fi +if test "x$with_libvarnish" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + #SAVE_LDFLAGS="$LDFLAGS" + + CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags" + #LDFLAGS="$LDFLAGS $with_libvarnish_libs" + + AC_CHECK_HEADERS(varnish/vsc.h, + [AC_DEFINE([HAVE_VARNISH_V3], [1], [Varnish 3 API support])], + [AC_DEFINE([HAVE_VARNISH_V2], [1], [Varnish 2 API support])]) + + CPPFLAGS="$SAVE_CPPFLAGS" + #LDFLAGS="$SAVE_LDFLAGS" +fi +if test "x$with_libvarnish" = "xyes" +then + BUILD_WITH_LIBVARNISH_CFLAGS="$with_libvarnish_cflags" + BUILD_WITH_LIBVARNISH_LIBS="$with_libvarnish_libs" + AC_SUBST(BUILD_WITH_LIBVARNISH_CFLAGS) + AC_SUBST(BUILD_WITH_LIBVARNISH_LIBS) +fi +# }}} + +# pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{ +with_libxml2="no (pkg-config isn't available)" +with_libxml2_cflags="" +with_libxml2_ldflags="" +with_libvirt="no (pkg-config isn't available)" +with_libvirt_cflags="" +with_libvirt_ldflags="" +if test "x$PKG_CONFIG" != "x" +then + $PKG_CONFIG --exists 'libxml-2.0' 2>/dev/null + if test "$?" = "0" + then + with_libxml2="yes" + else + with_libxml2="no (pkg-config doesn't know libxml-2.0)" + fi + + $PKG_CONFIG --exists libvirt 2>/dev/null + if test "$?" = "0" + then + with_libvirt="yes" + else + with_libvirt="no (pkg-config doesn't know libvirt)" + fi +fi +if test "x$with_libxml2" = "xyes" +then + with_libxml2_cflags="`$PKG_CONFIG --cflags libxml-2.0`" + if test $? -ne 0 + then + with_libxml2="no" + fi + with_libxml2_ldflags="`$PKG_CONFIG --libs libxml-2.0`" + if test $? -ne 0 + then + with_libxml2="no" + fi +fi +if test "x$with_libxml2" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $with_libxml2_cflags" + + AC_CHECK_HEADERS(libxml/parser.h, [], + [with_libxml2="no (libxml/parser.h not found)"]) + + CPPFLAGS="$SAVE_CPPFLAGS" +fi +if test "x$with_libxml2" = "xyes" +then + SAVE_CFLAGS="$CFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + + CFLAGS="$CFLAGS $with_libxml2_cflags" + LDFLAGS="$LDFLAGS $with_libxml2_ldflags" + + AC_CHECK_LIB(xml2, xmlXPathEval, + [with_libxml2="yes"], + [with_libxml2="no (symbol xmlXPathEval not found)"]) + + CFLAGS="$SAVE_CFLAGS" + LDFLAGS="$SAVE_LDFLAGS" +fi +dnl Add the right compiler flags and libraries. +if test "x$with_libxml2" = "xyes"; then + BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags" + BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags" + AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS) + AC_SUBST(BUILD_WITH_LIBXML2_LIBS) +fi +if test "x$with_libvirt" = "xyes" +then + with_libvirt_cflags="`$PKG_CONFIG --cflags libvirt`" + if test $? -ne 0 + then + with_libvirt="no" + fi + with_libvirt_ldflags="`$PKG_CONFIG --libs libvirt`" + if test $? -ne 0 + then + with_libvirt="no" + fi +fi +if test "x$with_libvirt" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $with_libvirt_cflags" + + AC_CHECK_HEADERS(libvirt/libvirt.h, [], + [with_libvirt="no (libvirt/libvirt.h not found)"]) + + CPPFLAGS="$SAVE_CPPFLAGS" +fi +if test "x$with_libvirt" = "xyes" +then + SAVE_CFLAGS="$CFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + + CFLAGS="$CFLAGS $with_libvirt_cflags" + LDFLAGS="$LDFLAGS $with_libvirt_ldflags" + + AC_CHECK_LIB(virt, virDomainBlockStats, + [with_libvirt="yes"], + [with_libvirt="no (symbol virDomainBlockStats not found)"]) + + CFLAGS="$SAVE_CFLAGS" + LDFLAGS="$SAVE_LDFLAGS" +fi +dnl Add the right compiler flags and libraries. +if test "x$with_libvirt" = "xyes"; then + BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags" + BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags" + AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS) + AC_SUBST(BUILD_WITH_LIBVIRT_LIBS) +fi +# }}} + +# $PKG_CONFIG --exists OpenIPMIpthread {{{ +with_libopenipmipthread="yes" +with_libopenipmipthread_cflags="" +with_libopenipmipthread_libs="" + +AC_MSG_CHECKING([for pkg-config]) +temp_result="no" +if test "x$PKG_CONFIG" = "x" +then + with_libopenipmipthread="no" + temp_result="no" +else + temp_result="$PKG_CONFIG" +fi +AC_MSG_RESULT([$temp_result]) + +if test "x$with_libopenipmipthread" = "xyes" +then + AC_MSG_CHECKING([for libOpenIPMIpthread]) + $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null + if test "$?" != "0" + then + with_libopenipmipthread="no (pkg-config doesn't know OpenIPMIpthread)" + fi + AC_MSG_RESULT([$with_libopenipmipthread]) +fi + +if test "x$with_libopenipmipthread" = "xyes" +then + AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS]) + temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`" + if test "$?" = "0" + then + with_libopenipmipthread_cflags="$temp_result" + else + with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)" + temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed" + fi + AC_MSG_RESULT([$temp_result]) +fi + +if test "x$with_libopenipmipthread" = "xyes" +then + AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS]) + temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`" + if test "$?" = "0" + then + with_libopenipmipthread_ldflags="$temp_result" + else + with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)" + temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed" + fi + AC_MSG_RESULT([$temp_result]) +fi + +if test "x$with_libopenipmipthread" = "xyes" +then + SAVE_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags" + + AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h, + [with_libopenipmipthread="yes"], + [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"], +[#include +#include +#include +#include +]) + + CPPFLAGS="$SAVE_CPPFLAGS" +fi + +if test "x$with_libopenipmipthread" = "xyes" +then + BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags" + BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags" + AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS) + AC_SUBST(BUILD_WITH_OPENIPMI_LIBS) +fi +# }}} + +PKG_CHECK_MODULES([LIBNOTIFY], [libnotify], + [with_libnotify="yes"], + [if test "x$LIBNOTIFY_PKG_ERRORS" = "x"; then + with_libnotify="no" + else + with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)" + fi]) + +# Check for enabled/disabled features +# + +# AC_COLLECTD(name, enable/disable, info-text, feature/module) +# ------------------------------------------------------------ +dnl +m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))]) +dnl +AC_DEFUN( + [AC_COLLECTD], + [ + m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl + m4_if( + [$2], + [enable], + [dnl + m4_define([EnDis],[disabled])dnl + m4_define([YesNo],[no])dnl + ],dnl + [m4_if( + [$2], + [disable], + [dnl + m4_define([EnDis],[enabled])dnl + m4_define([YesNo],[yes])dnl + ], + [dnl + AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl + ]dnl + )]dnl + )dnl + m4_if([$3], [feature], [], + [m4_if( + [$3], [module], [], + [dnl + AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl + ]dnl + )]dnl + )dnl + AC_ARG_ENABLE( + [$1], + AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]), + [], + enable_$1='[YesNo]'dnl + )# AC_ARG_ENABLE +if test "x$enable_$1" = "xno" +then + collectd_$1=0 +else + if test "x$enable_$1" = "xyes" + then + collectd_$1=1 + else + AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.]) + collectd_$1=1 + enable_$1='yes' + fi +fi + AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4]) + AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl + ]dnl +)# AC_COLLECTD(name, enable/disable, info-text, feature/module) + +# AC_PLUGIN(name, default, info) +# ------------------------------------------------------------ +dnl +AC_DEFUN( + [AC_PLUGIN], + [ + enable_plugin="no" + force="no" + AC_ARG_ENABLE([$1], AS_HELP_STRING([--enable-$1],[$3]), + [ + if test "x$enableval" = "xyes" + then + enable_plugin="yes" + else if test "x$enableval" = "xforce" + then + enable_plugin="yes" + force="yes" + else + enable_plugin="no (disabled on command line)" + fi; fi + ], + [ + if test "x$enable_all_plugins" = "xauto" + then + if test "x$2" = "xyes" + then + enable_plugin="yes" + else + enable_plugin="no" + fi + else + enable_plugin="$enable_all_plugins" + fi + ]) + if test "x$enable_plugin" = "xyes" + then + if test "x$2" = "xyes" || test "x$force" = "xyes" + then + AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.]) + if test "x$2" != "xyes" + then + dependency_warning="yes" + fi + else # User passed "yes" but dependency checking yielded "no" => Dependency problem. + dependency_error="yes" + enable_plugin="no (dependency error)" + fi + fi + AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes") + enable_$1="$enable_plugin" + ] +)# AC_PLUGIN(name, default, info) + +m4_divert_once([HELP_ENABLE], [ +collectd features:]) +# FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro. +AC_COLLECTD([debug], [enable], [feature], [debugging]) +AC_COLLECTD([daemon], [disable], [feature], [daemon mode]) +AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux]) + +dependency_warning="no" +dependency_error="no" + +plugin_ascent="no" +plugin_battery="no" +plugin_bind="no" +plugin_cgroups="no" +plugin_conntrack="no" +plugin_contextswitch="no" +plugin_cpu="no" +plugin_cpufreq="no" +plugin_curl_json="no" +plugin_curl_xml="no" +plugin_df="no" +plugin_disk="no" +plugin_entropy="no" +plugin_ethstat="no" +plugin_fscache="no" +plugin_interface="no" +plugin_ipmi="no" +plugin_ipvs="no" +plugin_irq="no" +plugin_libvirt="no" +plugin_load="no" +plugin_memory="no" +plugin_multimeter="no" +plugin_nfs="no" +plugin_numa="no" +plugin_perl="no" +plugin_processes="no" +plugin_protocols="no" +plugin_serial="no" +plugin_swap="no" +plugin_tape="no" +plugin_tcpconns="no" +plugin_ted="no" +plugin_thermal="no" +plugin_users="no" +plugin_uptime="no" +plugin_vmem="no" +plugin_vserver="no" +plugin_wireless="no" +plugin_zfs_arc="no" + +# Linux +if test "x$ac_system" = "xLinux" +then + plugin_battery="yes" + plugin_conntrack="yes" + plugin_contextswitch="yes" + plugin_cgroups="yes" + plugin_cpu="yes" + plugin_cpufreq="yes" + plugin_disk="yes" + plugin_entropy="yes" + plugin_fscache="yes" + plugin_interface="yes" + plugin_irq="yes" + plugin_load="yes" + plugin_lvm="yes" + plugin_memory="yes" + plugin_nfs="yes" + plugin_numa="yes" + plugin_processes="yes" + plugin_protocols="yes" + plugin_serial="yes" + plugin_swap="yes" + plugin_tcpconns="yes" + plugin_thermal="yes" + plugin_uptime="yes" + plugin_vmem="yes" + plugin_vserver="yes" + plugin_wireless="yes" + + if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes" + then + plugin_ipvs="yes" + fi +fi + +if test "x$ac_system" = "xOpenBSD" +then + plugin_tcpconns="yes" +fi + +# Mac OS X devices +if test "x$with_libiokit" = "xyes" +then + plugin_battery="yes" + plugin_disk="yes" +fi + +# AIX + +if test "x$ac_system" = "xAIX" +then + plugin_tcpconns="yes" +fi + +# FreeBSD + +if test "x$ac_system" = "xFreeBSD" +then + plugin_zfs_arc="yes" +fi + + +if test "x$with_perfstat" = "xyes" +then + plugin_cpu="yes" + plugin_contextswitch="yes" + plugin_disk="yes" + plugin_memory="yes" + plugin_swap="yes" + plugin_interface="yes" + plugin_load="yes" + plugin_uptime="yes" +fi + +if test "x$with_procinfo" = "xyes" +then + plugin_processes="yes" +fi + +# Solaris +if test "x$with_kstat" = "xyes" +then + plugin_nfs="yes" + plugin_uptime="yes" + plugin_zfs_arc="yes" +fi + +if test "x$with_devinfo$with_kstat" = "xyesyes" +then + plugin_cpu="yes" + plugin_disk="yes" + plugin_interface="yes" + plugin_memory="yes" + plugin_tape="yes" +fi + +# libstatgrab +if test "x$with_libstatgrab" = "xyes" +then + plugin_cpu="yes" + plugin_disk="yes" + plugin_interface="yes" + plugin_load="yes" + plugin_memory="yes" + plugin_swap="yes" + plugin_users="yes" +fi + +if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes" +then + plugin_ascent="yes" + if test "x$have_strptime" = "xyes" + then + plugin_bind="yes" + fi +fi + +if test "x$with_libopenipmipthread" = "xyes" +then + plugin_ipmi="yes" +fi + +if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes" +then + plugin_curl_json="yes" +fi + +if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes" +then + plugin_curl_xml="yes" +fi + +if test "x$have_processor_info" = "xyes" +then + plugin_cpu="yes" +fi +if test "x$have_sysctl" = "xyes" +then + plugin_cpu="yes" + plugin_memory="yes" + plugin_uptime="yes" + if test "x$ac_system" = "xDarwin" + then + plugin_swap="yes" + fi +fi +if test "x$have_sysctlbyname" = "xyes" +then + plugin_contextswitch="yes" + plugin_cpu="yes" + plugin_memory="yes" + plugin_tcpconns="yes" +fi + +# Df plugin: Check if we know how to determine mount points first. +#if test "x$have_listmntent" = "xyes"; then +# plugin_df="yes" +#fi +if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes" +then + plugin_df="yes" +fi +if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun" +then + plugin_df="yes" +fi +#if test "x$have_getmntent" = "xseq" +#then +# plugin_df="yes" +#fi +if test "x$c_cv_have_one_getmntent" = "xyes" +then + plugin_df="yes" +fi + +# Df plugin: Check if we have either `statfs' or `statvfs' second. +if test "x$plugin_df" = "xyes" +then + plugin_df="no" + if test "x$have_statfs" = "xyes" + then + plugin_df="yes" + fi + if test "x$have_statvfs" = "xyes" + then + plugin_df="yes" + fi +fi + +if test "x$have_linux_sockios_h$have_linux_ethtool_h" = "xyesyes" +then + plugin_ethstat="yes" +fi + +if test "x$have_getifaddrs" = "xyes" +then + plugin_interface="yes" +fi + +if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes" +then + plugin_libvirt="yes" +fi + +if test "x$have_getloadavg" = "xyes" +then + plugin_load="yes" +fi + +if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes" +then + plugin_perl="yes" +fi + +# Mac OS X memory interface +if test "x$have_host_statistics" = "xyes" +then + plugin_memory="yes" +fi + +if test "x$have_termios_h" = "xyes" +then + plugin_multimeter="yes" + plugin_ted="yes" +fi + +if test "x$have_thread_info" = "xyes" +then + plugin_processes="yes" +fi + +if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes" +then + plugin_processes="yes" +fi + +if test "x$with_kvm_getswapinfo" = "xyes" +then + plugin_swap="yes" +fi + +if test "x$have_swapctl" = "xyes" && test "x$c_cv_have_swapctl_two_args" = "xyes" +then + plugin_swap="yes" +fi + +if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes" +then + plugin_tcpconns="yes" +fi + +if test "x$have_getutent" = "xyes" +then + plugin_users="yes" +fi +if test "x$have_getutxent" = "xyes" +then + plugin_users="yes" +fi + +m4_divert_once([HELP_ENABLE], [ +collectd plugins:]) + +AC_ARG_ENABLE([all-plugins], + AS_HELP_STRING([--enable-all-plugins],[enable all plugins (auto by def)]), + [ + if test "x$enableval" = "xyes" + then + enable_all_plugins="yes" + else if test "x$enableval" = "xauto" + then + enable_all_plugins="auto" + else + enable_all_plugins="no" + fi; fi + ], + [enable_all_plugins="auto"]) + +m4_divert_once([HELP_ENABLE], []) + +AC_PLUGIN([aggregation], [yes], [Aggregation plugin]) +AC_PLUGIN([amqp], [$with_librabbitmq], [AMQP output plugin]) +AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics]) +AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC]) +AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors]) +AC_PLUGIN([aquaero], [$with_libaquaero5], [Aquaero's hardware sensors]) +AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics]) +AC_PLUGIN([battery], [$plugin_battery], [Battery statistics]) +AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics]) +AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics]) +AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics]) +AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics]) +AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics]) +AC_PLUGIN([csv], [yes], [CSV output plugin]) +AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics]) +AC_PLUGIN([curl_json], [$plugin_curl_json], [CouchDB statistics]) +AC_PLUGIN([curl_xml], [$plugin_curl_xml], [CURL generic xml statistics]) +AC_PLUGIN([cgroups], [$plugin_cgroups], [CGroups CPU usage accounting]) +AC_PLUGIN([dbi], [$with_libdbi], [General database statistics]) +AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics]) +AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics]) +AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis]) +AC_PLUGIN([email], [yes], [EMail statistics]) +AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics]) +AC_PLUGIN([ethstat], [$plugin_ethstat], [Stats from NIC driver]) +AC_PLUGIN([exec], [yes], [Execution of external programs]) +AC_PLUGIN([filecount], [yes], [Count files in directories]) +AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics]) +AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin]) +AC_PLUGIN([hddtemp], [yes], [Query hddtempd]) +AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics]) +AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics]) +AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters]) +AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics]) +AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics]) +AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine]) +AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics]) +AC_PLUGIN([load], [$plugin_load], [System load]) +AC_PLUGIN([logfile], [yes], [File logging plugin]) +AC_PLUGIN([lpar], [$with_perfstat], [AIX logical partitions statistics]) +AC_PLUGIN([lvm], [$with_liblvm2app], [LVM statistics]) +AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics]) +AC_PLUGIN([match_empty_counter], [yes], [The empty counter match]) +AC_PLUGIN([match_hashed], [yes], [The hashed match]) +AC_PLUGIN([match_regex], [yes], [The regex match]) +AC_PLUGIN([match_timediff], [yes], [The timediff match]) +AC_PLUGIN([match_value], [yes], [The value match]) +AC_PLUGIN([mbmon], [yes], [Query mbmond]) +AC_PLUGIN([md], [$have_linux_raid_md_u_h], [md (Linux software RAID) devices]) +AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics]) +AC_PLUGIN([memcached], [yes], [memcached statistics]) +AC_PLUGIN([memory], [$plugin_memory], [Memory usage]) +AC_PLUGIN([mic], [$with_mic], [Intel Many Integrated Core stats]) +AC_PLUGIN([modbus], [$with_libmodbus], [Modbus plugin]) +AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values]) +AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics]) +AC_PLUGIN([netapp], [$with_libnetapp], [NetApp plugin]) +AC_PLUGIN([netlink], [$with_libmnl], [Enhanced Linux network statistics]) +AC_PLUGIN([network], [yes], [Network communication plugin]) +AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics]) +AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics]) +AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications]) +AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier]) +AC_PLUGIN([ntpd], [yes], [NTPd statistics]) +AC_PLUGIN([numa], [$plugin_numa], [NUMA virtual memory statistics]) +AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics]) +AC_PLUGIN([olsrd], [yes], [olsrd statistics]) +AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics]) +AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics]) +AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin]) +AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter]) +AC_PLUGIN([pf], [$have_net_pfvar_h], [BSD packet filter (PF) statistics]) +# FIXME: Check for libevent, too. +AC_PLUGIN([pinba], [$have_protoc_c], [Pinba statistics]) +AC_PLUGIN([ping], [$with_liboping], [Network latency statistics]) +AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics]) +AC_PLUGIN([powerdns], [yes], [PowerDNS statistics]) +AC_PLUGIN([processes], [$plugin_processes], [Process statistics]) +AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics]) +AC_PLUGIN([python], [$with_python], [Embed a Python interpreter]) +AC_PLUGIN([redis], [$with_libcredis], [Redis plugin]) +AC_PLUGIN([routeros], [$with_librouteros], [RouterOS plugin]) +AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin]) +AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin]) +AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics]) +AC_PLUGIN([serial], [$plugin_serial], [serial port traffic]) +AC_PLUGIN([sigrok], [$with_libsigrok], [sigrok acquisition sources]) +AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin]) +AC_PLUGIN([statsd], [yes], [StatsD plugin]) +AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics]) +AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin]) +AC_PLUGIN([table], [yes], [Parsing of tabular data]) +AC_PLUGIN([tail], [yes], [Parsing of logfiles]) +AC_PLUGIN([tail_csv], [yes], [Parsing of CSV files]) +AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics]) +AC_PLUGIN([target_notification], [yes], [The notification target]) +AC_PLUGIN([target_replace], [yes], [The replace target]) +AC_PLUGIN([target_scale],[yes], [The scale target]) +AC_PLUGIN([target_set], [yes], [The set target]) +AC_PLUGIN([target_v5upgrade], [yes], [The v5upgrade target]) +AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics]) +AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics]) +AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values]) +AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics]) +AC_PLUGIN([threshold], [yes], [Threshold checking plugin]) +AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant], [TokyoTyrant database statistics]) +AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin]) +AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics]) +AC_PLUGIN([users], [$plugin_users], [User statistics]) +AC_PLUGIN([uuid], [yes], [UUID as hostname plugin]) +AC_PLUGIN([varnish], [$with_libvarnish], [Varnish cache statistics]) +AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics]) +AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics]) +AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics]) +AC_PLUGIN([write_graphite], [yes], [Graphite / Carbon output plugin]) +AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin]) +AC_PLUGIN([write_mongodb], [$with_libmongoc], [MongoDB output plugin]) +AC_PLUGIN([write_redis], [$with_libcredis], [Redis output plugin]) +AC_PLUGIN([write_riemann], [$have_protoc_c], [Riemann output plugin]) +AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics]) +AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics]) + +dnl Default configuration file +# Load either syslog or logfile +LOAD_PLUGIN_SYSLOG="" +LOAD_PLUGIN_LOGFILE="" + +AC_MSG_CHECKING([which default log plugin to load]) +default_log_plugin="none" +if test "x$enable_syslog" = "xyes" +then + default_log_plugin="syslog" +else + LOAD_PLUGIN_SYSLOG="##" +fi + +if test "x$enable_logfile" = "xyes" +then + if test "x$default_log_plugin" = "xnone" + then + default_log_plugin="logfile" + else + LOAD_PLUGIN_LOGFILE="#" + fi +else + LOAD_PLUGIN_LOGFILE="##" +fi +AC_MSG_RESULT([$default_log_plugin]) + +AC_SUBST(LOAD_PLUGIN_SYSLOG) +AC_SUBST(LOAD_PLUGIN_LOGFILE) + +DEFAULT_LOG_LEVEL="info" +if test "x$enable_debug" = "xyes" +then + DEFAULT_LOG_LEVEL="debug" +fi +AC_SUBST(DEFAULT_LOG_LEVEL) + +# Load only one of rrdtool, network, csv in the default config. +LOAD_PLUGIN_RRDTOOL="" +LOAD_PLUGIN_NETWORK="" +LOAD_PLUGIN_CSV="" + +AC_MSG_CHECKING([which default write plugin to load]) +default_write_plugin="none" +if test "x$enable_rrdtool" = "xyes" +then + default_write_plugin="rrdtool" +else + LOAD_PLUGIN_RRDTOOL="##" +fi + +if test "x$enable_network" = "xyes" +then + if test "x$default_write_plugin" = "xnone" + then + default_write_plugin="network" + else + LOAD_PLUGIN_NETWORK="#" + fi +else + LOAD_PLUGIN_NETWORK="##" +fi + +if test "x$enable_csv" = "xyes" +then + if test "x$default_write_plugin" = "xnone" + then + default_write_plugin="csv" + else + LOAD_PLUGIN_CSV="#" + fi +else + LOAD_PLUGIN_CSV="##" +fi +AC_MSG_RESULT([$default_write_plugin]) + +AC_SUBST(LOAD_PLUGIN_RRDTOOL) +AC_SUBST(LOAD_PLUGIN_NETWORK) +AC_SUBST(LOAD_PLUGIN_CSV) + +dnl ip_vs.h +if test "x$ac_system" = "xLinux" \ + && test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono" +then + enable_ipvs="$enable_ipvs (ip_vs.h not found)" +fi + +if test "x$ip_vs_h_needs_kernel_cflags" = "xyes" +then + enable_ipvs="$enable_ipvs (needs $KERNEL_CFLAGS)" +fi + +dnl Perl bindings +PERL_BINDINGS_OPTIONS="PREFIX=${prefix}" +AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])], +[ + if test "x$withval" != "xno" && test "x$withval" != "xyes" + then + PERL_BINDINGS_OPTIONS="$withval" + with_perl_bindings="yes" + else + with_perl_bindings="$withval" + fi +], +[ + if test -n "$perl_interpreter" + then + with_perl_bindings="yes" + else + with_perl_bindings="no (no perl interpreter found)" + fi +]) +if test "x$with_perl_bindings" = "xyes" +then + PERL_BINDINGS="perl" +else + PERL_BINDINGS="" +fi +AC_SUBST(PERL_BINDINGS) +AC_SUBST(PERL_BINDINGS_OPTIONS) + +dnl libcollectdclient +LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1` +LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2` +LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3` + +LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-` + +LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH" + +AC_SUBST(LCC_VERSION_MAJOR) +AC_SUBST(LCC_VERSION_MINOR) +AC_SUBST(LCC_VERSION_PATCH) +AC_SUBST(LCC_VERSION_EXTRA) +AC_SUBST(LCC_VERSION_STRING) + +AC_CONFIG_FILES(src/libcollectdclient/collectd/lcc_features.h) + +AC_CONFIG_FILES([Makefile src/Makefile src/collectd.conf src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile]) +AC_OUTPUT + +if test "x$with_librrd" = "xyes" \ + && test "x$librrd_threadsafe" != "xyes" +then + with_librrd="yes (warning: librrd is not thread-safe)" +fi + +if test "x$with_libperl" = "xyes" +then + with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)" +else + enable_perl="no (needs libperl)" +fi + +if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno" +then + enable_perl="no (libperl doesn't support ithreads)" +fi + +if test "x$with_perl_bindings" = "xyes" \ + && test "x$PERL_BINDINGS_OPTIONS" != "x" +then + with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)" +fi + +cat <= 2.2 - [ - LT_CONFIG_LTDL_DIR([libltdl]) - LT_INIT([dlopen]) - LTDL_INIT([convenience]) - AC_DEFINE(LIBTOOL_VERSION, 2, [Define to used libtool version.]) - ] -, - # libtool <= 1.5 - [ - AC_LIBLTDL_CONVENIENCE - AC_SUBST(LTDLINCL) - AC_SUBST(LIBLTDL) - AC_LIBTOOL_DLOPEN - AC_CONFIG_SUBDIRS(libltdl) - AC_DEFINE(LIBTOOL_VERSION, 1, [Define to used libtool version.]) - ] -) - -AM_INIT_AUTOMAKE([tar-pax dist-bzip2]) -AC_LANG(C) - -AC_PREFIX_DEFAULT("/opt/collectd") - -AC_SYS_LARGEFILE - -# -# Checks for programs. -# -AC_PROG_CC -AC_PROG_CPP -AC_PROG_INSTALL -AC_PROG_LN_S -AC_PROG_MAKE_SET -AM_PROG_CC_C_O -AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes") - -AC_DISABLE_STATIC -AC_PROG_LIBTOOL -AC_PROG_LEX -AC_PROG_YACC -PKG_PROG_PKG_CONFIG - -AC_CHECK_PROG([have_protoc_c], [protoc-c], [yes], [no]) -AC_CHECK_HEADERS([google/protobuf-c/protobuf-c.h], - [have_protobuf_c_h="yes"], - [have_protobuf_c_h="no"]) -if test "x$have_protoc_c" = "xyes" && test "x$have_protobuf_c_h" != "xyes" -then - have_protoc_c="no (unable to find )" -fi -AM_CONDITIONAL(HAVE_PROTOC_C, test "x$have_protoc_c" = "xyes") - -AC_MSG_CHECKING([for kernel type ($host_os)]) -case $host_os in - *linux*) - AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel]) - ac_system="Linux" - ;; - *solaris*) - AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel]) - ac_system="Solaris" - ;; - *darwin*) - ac_system="Darwin" - ;; - *openbsd*) - ac_system="OpenBSD" - ;; - *aix*) - AC_DEFINE([KERNEL_AIX], 1, [True if program is to be compiled for a AIX kernel]) - ac_system="AIX" - ;; - *) - ac_system="unknown" -esac -AC_MSG_RESULT([$ac_system]) - -if test "x$ac_system" = "xLinux" -then - AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources]) - if test -z "$KERNEL_DIR" - then - KERNEL_DIR="/lib/modules/`uname -r`/source" - fi - - KERNEL_CFLAGS="-I$KERNEL_DIR/include" - AC_SUBST(KERNEL_CFLAGS) -fi - -if test "x$ac_system" = "xSolaris" -then - AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.]) - AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.]) -fi -if test "x$ac_system" = "xAIX" -then - AC_DEFINE(_THREAD_SAFE_ERRNO, 1, [Define to use the thread-safe version of errno under AIX.]) -fi - -# Where to install .pc files. -pkgconfigdir="${libdir}/pkgconfig" -AC_SUBST(pkgconfigdir) - -# Check for standards compliance mode -AC_ARG_ENABLE(standards, - AS_HELP_STRING([--enable-standards], [Enable standards compliance mode]), - [enable_standards="$enableval"], - [enable_standards="no"]) -if test "x$enable_standards" = "xyes" -then - AC_DEFINE(_ISOC99_SOURCE, 1, [Define to enforce ISO C99 compliance.]) - AC_DEFINE(_POSIX_C_SOURCE, 200809L, [Define to enforce POSIX.1-2008 compliance.]) - AC_DEFINE(_XOPEN_SOURCE, 700, [Define to enforce X/Open 7 (XSI) compliance.]) - AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.]) - if test "x$GCC" = "xyes" - then - CFLAGS="$CFLAGS -std=c99" - fi -fi -AM_CONDITIONAL(BUILD_FEATURE_STANDARDS, test "x$enable_standards" = "xyes") - -# -# Checks for header files. -# -AC_HEADER_STDC -AC_HEADER_SYS_WAIT -AC_HEADER_DIRENT -AC_HEADER_STDBOOL - -AC_CHECK_HEADERS(stdio.h errno.h math.h stdarg.h syslog.h fcntl.h signal.h assert.h sys/types.h sys/socket.h sys/select.h poll.h netdb.h arpa/inet.h sys/resource.h sys/param.h kstat.h regex.h sys/ioctl.h endian.h sys/isa_defs.h fnmatch.h libgen.h) - -# For ping library -AC_CHECK_HEADERS(netinet/in_systm.h, [], [], -[#if HAVE_STDINT_H -# include -#endif -#if HAVE_SYS_TYPES_H -# include -#endif -]) -AC_CHECK_HEADERS(netinet/in.h, [], [], -[#if HAVE_STDINT_H -# include -#endif -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_NETINET_IN_SYSTM_H -# include -#endif -]) -AC_CHECK_HEADERS(netinet/ip.h, [], [], -[#if HAVE_STDINT_H -# include -#endif -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_NETINET_IN_SYSTM_H -# include -#endif -#if HAVE_NETINET_IN_H -# include -#endif -]) -AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [], -[#if HAVE_STDINT_H -# include -#endif -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_NETINET_IN_SYSTM_H -# include -#endif -#if HAVE_NETINET_IN_H -# include -#endif -#if HAVE_NETINET_IP_H -# include -#endif -]) -AC_CHECK_HEADERS(netinet/ip_var.h, [], [], -[#if HAVE_STDINT_H -# include -#endif -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_NETINET_IN_SYSTM_H -# include -#endif -#if HAVE_NETINET_IN_H -# include -#endif -#if HAVE_NETINET_IP_H -# include -#endif -]) -AC_CHECK_HEADERS(netinet/ip6.h, [], [], -[#if HAVE_STDINT_H -# include -#endif -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_NETINET_IN_SYSTM_H -# include -#endif -#if HAVE_NETINET_IN_H -# include -#endif -]) -AC_CHECK_HEADERS(netinet/icmp6.h, [], [], -[#if HAVE_STDINT_H -# include -#endif -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_NETINET_IN_SYSTM_H -# include -#endif -#if HAVE_NETINET_IN_H -# include -#endif -#if HAVE_NETINET_IP6_H -# include -#endif -]) -AC_CHECK_HEADERS(netinet/tcp.h, [], [], -[#if HAVE_STDINT_H -# include -#endif -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_NETINET_IN_SYSTM_H -# include -#endif -#if HAVE_NETINET_IN_H -# include -#endif -#if HAVE_NETINET_IP_H -# include -#endif -]) -AC_CHECK_HEADERS(netinet/udp.h, [], [], -[#if HAVE_STDINT_H -# include -#endif -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_NETINET_IN_SYSTM_H -# include -#endif -#if HAVE_NETINET_IN_H -# include -#endif -#if HAVE_NETINET_IP_H -# include -#endif -]) - -# For cpu modules -AC_CHECK_HEADERS(sys/dkstat.h) -if test "x$ac_system" = "xDarwin" -then - AC_CHECK_HEADERS(mach/mach_init.h mach/host_priv.h mach/mach_error.h mach/mach_host.h mach/mach_port.h mach/mach_types.h mach/message.h mach/processor_set.h mach/processor.h mach/processor_info.h mach/task.h mach/thread_act.h mach/vm_region.h mach/vm_map.h mach/vm_prot.h mach/vm_statistics.h mach/kern_return.h) - AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h) - # For the battery plugin - AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [], -[ -#if HAVE_IOKIT_IOKITLIB_H -# include -#endif -#if HAVE_IOKIT_IOTYPES_H -# include -#endif -]) - -fi - -AC_CHECK_HEADERS(sys/sysctl.h, [], [], -[ -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_SYS_PARAM_H -# include -#endif -]) - -AC_MSG_CHECKING([for sysctl kern.cp_times]) -if test -x /sbin/sysctl -then - /sbin/sysctl kern.cp_times 2>/dev/null - if test $? -eq 0 - then - AC_MSG_RESULT([yes]) - AC_DEFINE(HAVE_SYSCTL_KERN_CP_TIMES, 1, - [Define if sysctl supports kern.cp_times]) - else - AC_MSG_RESULT([no]) - fi -else - AC_MSG_RESULT([no]) -fi - -# For hddtemp module -AC_CHECK_HEADERS(linux/major.h) - -# For md module (Linux only) -if test "x$ac_system" = "xLinux" -then - AC_CHECK_HEADERS(linux/raid/md_u.h, - [have_linux_raid_md_u_h="yes"], - [have_linux_raid_md_u_h="no"], -[ -#include -#include -#include -]) -else - have_linux_raid_md_u_h="no" -fi - -# For the swap module -have_linux_wireless_h="no" -if test "x$ac_system" = "xLinux" -then - AC_CHECK_HEADERS(linux/wireless.h, - [have_linux_wireless_h="yes"], - [have_linux_wireless_h="no"], -[ -#include -#include -#include -]) -fi - -# For the swap module -have_sys_swap_h="yes" -AC_CHECK_HEADERS(sys/swap.h vm/anon.h, [], [have_sys_swap_h="no"], -[ -#undef _FILE_OFFSET_BITS -#undef _LARGEFILE64_SOURCE -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_SYS_PARAM_H -# include -#endif -]) - -if test "x$have_sys_swap_h$ac_system" = "xnoSolaris" -then - hint_64="" - if test "x$GCC" = "xyes" - then - hint_64="CFLAGS='-m64'" - else - hint_64="CFLAGS='-xarch=v9'" - fi - AC_MSG_NOTICE([Solaris detected and sys/swap.h not usable. Try building a 64-bit binary ($hint_64 ./configure).]) -fi - -# For load module -# For the processes plugin -# For users module -AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h) - -# For interface plugin -AC_CHECK_HEADERS(ifaddrs.h) -AC_CHECK_HEADERS(net/if.h, [], [], -[ -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_SYS_SOCKET_H -# include -#endif -]) -AC_CHECK_HEADERS(linux/if.h, [], [], -[ -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_SYS_SOCKET_H -# include -#endif -]) -AC_CHECK_HEADERS(linux/inet_diag.h, [], [], -[ -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_SYS_SOCKET_H -# include -#endif -#if HAVE_LINUX_INET_DIAG_H -# include -#endif -]) -AC_CHECK_HEADERS(linux/netdevice.h, [], [], -[ -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_SYS_SOCKET_H -# include -#endif -#if HAVE_LINUX_IF_H -# include -#endif -]) - -# For ethstat module -AC_CHECK_HEADERS(linux/sockios.h, - [have_linux_sockios_h="yes"], - [have_linux_sockios_h="no"], - [ -#if HAVE_SYS_IOCTL_H -# include -#endif -#if HAVE_NET_IF_H -# include -#endif - ]) -AC_CHECK_HEADERS(linux/ethtool.h, - [have_linux_ethtool_h="yes"], - [have_linux_ethtool_h="no"], - [ -#if HAVE_SYS_IOCTL_H -# include -#endif -#if HAVE_NET_IF_H -# include -#endif -#if HAVE_LINUX_SOCKIOS_H -# include -#endif - ]) - -# For ipvs module -have_linux_ip_vs_h="no" -have_net_ip_vs_h="no" -have_ip_vs_h="no" -ip_vs_h_needs_kernel_cflags="no" -if test "x$ac_system" = "xLinux" -then - AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"]) - AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"]) - AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"]) - - if test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono" && test -d "$KERNEL_DIR" - then - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $KERNEL_CFLAGS" - - AC_MSG_NOTICE([Did not find ip_vs.h. Trying again using headers from $KERNEL_DIR.]) - - AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"]) - AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"]) - AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"]) - - if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes" - then - ip_vs_h_needs_kernel_cflags="yes" - fi - - CFLAGS="$SAVE_CFLAGS" - fi -fi -AM_CONDITIONAL(IP_VS_H_NEEDS_KERNEL_CFLAGS, test "x$ip_vs_h_needs_kernel_cflags" = "xyes") - -# For quota module -AC_CHECK_HEADERS(sys/ucred.h, [], [], -[ -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_SYS_PARAM_H -# include -#endif -]) - -# For mount interface -AC_CHECK_HEADERS(sys/mount.h, [], [], -[ -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_SYS_PARAM_H -# include -#endif -]) - -# For the email plugin -AC_CHECK_HEADERS(linux/un.h, [], [], -[ -#if HAVE_SYS_SOCKET_H -# include -#endif -]) - -AC_CHECK_HEADERS(pwd.h grp.h sys/un.h ctype.h limits.h xfs/xqm.h fs_info.h fshelp.h paths.h mntent.h mnttab.h sys/fstyp.h sys/fs_types.h sys/mntent.h sys/mnttab.h sys/statfs.h sys/statvfs.h sys/vfs.h sys/vfstab.h kvm.h wordexp.h) - -# For the dns plugin -AC_CHECK_HEADERS(arpa/nameser.h) -AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [], -[ -#if HAVE_ARPA_NAMESER_H -# include -#endif -]) - -AC_CHECK_HEADERS(net/if_arp.h, [], [], -[#if HAVE_SYS_SOCKET_H -# include -#endif -]) -AC_CHECK_HEADERS(net/ppp_defs.h) -AC_CHECK_HEADERS(net/if_ppp.h, [], [], -[#if HAVE_NET_PPP_DEFS_H -# include -#endif -]) -AC_CHECK_HEADERS(netinet/if_ether.h, [], [], -[#if HAVE_STDINT_H -# include -#endif -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_SYS_SOCKET_H -# include -#endif -#if HAVE_NET_IF_H -# include -#endif -#if HAVE_NETINET_IN_H -# include -#endif -]) - -AC_CHECK_HEADERS(netinet/ip_compat.h) - -have_net_pfvar_h="no" -AC_CHECK_HEADERS(net/pfvar.h, - [have_net_pfvar_h="yes"], - [have_net_pfvar_h="no"], -[ -#if HAVE_SYS_IOCTL_H -# include -#endif -#if HAVE_SYS_SOCKET_H -# include -#endif -#if HAVE_NET_IF_H -# include -#endif -]) - -# For the multimeter plugin -have_termios_h="no" -AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"]) - -# -# Checks for typedefs, structures, and compiler characteristics. -# -AC_C_CONST -AC_TYPE_PID_T -AC_TYPE_SIZE_T -AC_TYPE_UID_T -AC_HEADER_TIME - -# -# Checks for library functions. -# -AC_PROG_GCC_TRADITIONAL -AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf setenv if_indextoname) - -AC_FUNC_STRERROR_R - -SAVE_CFLAGS="$CFLAGS" -# Emulate behavior of src/Makefile.am -if test "x$GCC" = "xyes" -then - CFLAGS="$CFLAGS -Wall -Werror" -fi - -AC_CACHE_CHECK([for strtok_r], - [c_cv_have_strtok_r_default], - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( -[[[ -#include -#include -#include -]]], -[[[ - char buffer[] = "foo,bar,baz"; - char *token; - char *dummy; - char *saveptr; - - dummy = buffer; - saveptr = NULL; - while ((token = strtok_r (dummy, ",", &saveptr)) != NULL) - { - dummy = NULL; - printf ("token = %s;\n", token); - } -]]] - )], - [c_cv_have_strtok_r_default="yes"], - [c_cv_have_strtok_r_default="no"] - ) -) - -if test "x$c_cv_have_strtok_r_default" = "xno" -then - CFLAGS="$CFLAGS -D_REENTRANT=1" - - AC_CACHE_CHECK([if strtok_r needs _REENTRANT], - [c_cv_have_strtok_r_reentrant], - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( -[[[ -#include -#include -#include -]]], -[[[ - char buffer[] = "foo,bar,baz"; - char *token; - char *dummy; - char *saveptr; - - dummy = buffer; - saveptr = NULL; - while ((token = strtok_r (dummy, ",", &saveptr)) != NULL) - { - dummy = NULL; - printf ("token = %s;\n", token); - } -]]] - )], - [c_cv_have_strtok_r_reentrant="yes"], - [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])] - ) - ) -fi - -CFLAGS="$SAVE_CFLAGS" -if test "x$c_cv_have_strtok_r_reentrant" = "xyes" -then - CFLAGS="$CFLAGS -D_REENTRANT=1" -fi - -AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree) - -socket_needs_socket="no" -AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket))) -AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes") - -clock_gettime_needs_rt="no" -clock_gettime_needs_posix4="no" -have_clock_gettime="no" -AC_CHECK_FUNCS(clock_gettime, [have_clock_gettime="yes"]) -if test "x$have_clock_gettime" = "xno" -then - AC_CHECK_LIB(rt, clock_gettime, [clock_gettime_needs_rt="yes" - have_clock_gettime="yes"]) -fi -if test "x$have_clock_gettime" = "xno" -then - AC_CHECK_LIB(posix4, clock_gettime, [clock_gettime_needs_posix4="yes" - have_clock_gettime="yes"]) -fi -if test "x$have_clock_gettime" = "xyes" -then - AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if the clock_gettime(2) function is available.]) -else - AC_MSG_WARN(cannot find clock_gettime) -fi - -nanosleep_needs_rt="no" -nanosleep_needs_posix4="no" -AC_CHECK_FUNCS(nanosleep, - [], - AC_CHECK_LIB(rt, nanosleep, - [nanosleep_needs_rt="yes"], - AC_CHECK_LIB(posix4, nanosleep, - [nanosleep_needs_posix4="yes"], - AC_MSG_ERROR(cannot find nanosleep)))) - -AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$clock_gettime_needs_rt" = "xyes" || test "x$nanosleep_needs_rt" = "xyes") -AM_CONDITIONAL(BUILD_WITH_LIBPOSIX4, test "x$clock_gettime_needs_posix4" = "xyes" || test "x$nanosleep_needs_posix4" = "xyes") - -AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"]) -AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"]) -AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"]) -AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"]) -AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"]) -AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"]) -AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"]) -AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"]) -AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"]) -AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"]) -AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"]) -AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"]) - -# Check for strptime {{{ -if test "x$GCC" = "xyes" -then - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -Wall -Wextra -Werror" -fi - -AC_CHECK_FUNCS(strptime, [have_strptime="yes"], [have_strptime="no"]) -if test "x$have_strptime" = "xyes" -then - AC_CACHE_CHECK([whether strptime is exported by default], - [c_cv_have_strptime_default], - AC_COMPILE_IFELSE([AC_LANG_PROGRAM( -[[[ -#include -]]], -[[[ - struct tm stm; - (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm); -]]] - )], - [c_cv_have_strptime_default="yes"], - [c_cv_have_strptime_default="no"])) -fi -if test "x$have_strptime" = "xyes" && test "x$c_cv_have_strptime_default" = "xno" -then - AC_CACHE_CHECK([whether strptime needs standards mode], - [c_cv_have_strptime_standards], - AC_COMPILE_IFELSE([AC_LANG_PROGRAM( -[[[ -#ifndef _ISOC99_SOURCE -# define _ISOC99_SOURCE 1 -#endif -#ifndef _POSIX_C_SOURCE -# define _POSIX_C_SOURCE 200112L -#endif -#ifndef _XOPEN_SOURCE -# define _XOPEN_SOURCE 500 -#endif -#include -]]], -[[[ - struct tm stm; - (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm); -]]] - )], - [c_cv_have_strptime_standards="yes"], - [c_cv_have_strptime_standards="no"])) - - if test "x$c_cv_have_strptime_standards" = "xyes" - then - AC_DEFINE([STRPTIME_NEEDS_STANDARDS], 1, [Set to true if strptime is only exported in X/Open mode (GNU libc).]) - else - have_strptime="no" - fi -fi - -if test "x$GCC" = "xyes" -then - CFLAGS="$SAVE_CFLAGS" -fi -# }}} Check for strptime - -AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"]) -if test "x$have_swapctl" = "xyes"; then - AC_CACHE_CHECK([whether swapctl takes two arguments], - [c_cv_have_swapctl_two_args], - AC_COMPILE_IFELSE([AC_LANG_PROGRAM( -[[[ -#if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64 -# undef _FILE_OFFSET_BITS -# undef _LARGEFILE64_SOURCE -#endif -#include -#include -]]], -[[[ -int num = swapctl(0, NULL); -]]] - )], - [c_cv_have_swapctl_two_args="yes"], - [c_cv_have_swapctl_two_args="no"] - ) - ) - AC_CACHE_CHECK([whether swapctl takes three arguments], - [c_cv_have_swapctl_three_args], - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( -[[[ -#if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64 -# undef _FILE_OFFSET_BITS -# undef _LARGEFILE64_SOURCE -#endif -#include -#include -]]], -[[[ -int num = swapctl(0, NULL, 0); -]]] - )], - [c_cv_have_swapctl_three_args="yes"], - [c_cv_have_swapctl_three_args="no"] - ) - ) -fi -# Check for different versions of `swapctl' here.. -if test "x$have_swapctl" = "xyes"; then - if test "x$c_cv_have_swapctl_two_args" = "xyes"; then - AC_DEFINE(HAVE_SWAPCTL_TWO_ARGS, 1, - [Define if the function swapctl exists and takes two arguments.]) - fi - if test "x$c_cv_have_swapctl_three_args" = "xyes"; then - AC_DEFINE(HAVE_SWAPCTL_THREE_ARGS, 1, - [Define if the function swapctl exists and takes three arguments.]) - fi -fi - -# Check for NAN -AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])], -[ - if test "x$withval" = "xno"; then - nan_type="none" - else if test "x$withval" = "xyes"; then - nan_type="zero" - else - nan_type="$withval" - fi; fi -], -[nan_type="none"]) -if test "x$nan_type" = "xnone"; then - AC_CACHE_CHECK([whether NAN is defined by default], - [c_cv_have_nan_default], - AC_COMPILE_IFELSE([AC_LANG_PROGRAM( -[[[ -#include -#include -static double foo = NAN; -]]], -[[[ - if (isnan (foo)) - return 0; - else - return 1; -]]] - )], - [c_cv_have_nan_default="yes"], - [c_cv_have_nan_default="no"] - ) - ) - if test "x$c_cv_have_nan_default" = "xyes" - then - nan_type="default" - fi -fi -if test "x$nan_type" = "xnone"; then - AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99], - [c_cv_have_nan_isoc], - AC_COMPILE_IFELSE([AC_LANG_PROGRAM( -[[[ -#include -#define __USE_ISOC99 1 -#include -static double foo = NAN; -]]], -[[[ - if (isnan (foo)) - return 0; - else - return 1; -]]] - )], - [c_cv_have_nan_isoc="yes"], - [c_cv_have_nan_isoc="no"] - ) - ) - if test "x$c_cv_have_nan_isoc" = "xyes" - then - nan_type="isoc99" - fi -fi -if test "x$nan_type" = "xnone"; then - SAVE_LDFLAGS=$LDFLAGS - LDFLAGS="$LDFLAGS -lm" - AC_CACHE_CHECK([whether NAN can be defined by 0/0], - [c_cv_have_nan_zero], - AC_RUN_IFELSE([AC_LANG_PROGRAM( -[[[ -#include -#include -#ifdef NAN -# undef NAN -#endif -#define NAN (0.0 / 0.0) -#ifndef isnan -# define isnan(f) ((f) != (f)) -#endif -static double foo = NAN; -]]], -[[[ - if (isnan (foo)) - return 0; - else - return 1; -]]] - )], - [c_cv_have_nan_zero="yes"], - [c_cv_have_nan_zero="no"] - ) - ) - LDFLAGS=$SAVE_LDFLAGS - if test "x$c_cv_have_nan_zero" = "xyes" - then - nan_type="zero" - fi -fi - -if test "x$nan_type" = "xdefault"; then - AC_DEFINE(NAN_STATIC_DEFAULT, 1, - [Define if NAN is defined by default and can initialize static variables.]) -else if test "x$nan_type" = "xisoc99"; then - AC_DEFINE(NAN_STATIC_ISOC, 1, - [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.]) -else if test "x$nan_type" = "xzero"; then - AC_DEFINE(NAN_ZERO_ZERO, 1, - [Define if NAN can be defined as (0.0 / 0.0)]) -else - AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.]) -fi; fi; fi - -AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])], -[ - if test "x$withval" = "xnothing"; then - fp_layout_type="nothing" - else if test "x$withval" = "xendianflip"; then - fp_layout_type="endianflip" - else if test "x$withval" = "xintswap"; then - fp_layout_type="intswap" - else - AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]); -fi; fi; fi -], -[fp_layout_type="unknown"]) - -if test "x$fp_layout_type" = "xunknown"; then - AC_CACHE_CHECK([if doubles are stored in x86 representation], - [c_cv_fp_layout_need_nothing], - AC_RUN_IFELSE([AC_LANG_PROGRAM( -[[[ -#include -#include -#include -#if HAVE_STDINT_H -# include -#endif -#if HAVE_INTTYPES_H -# include -#endif -#if HAVE_STDBOOL_H -# include -#endif -]]], -[[[ - uint64_t i0; - uint64_t i1; - uint8_t c[8]; - double d; - - d = 8.642135e130; - memcpy ((void *) &i0, (void *) &d, 8); - - i1 = i0; - memcpy ((void *) c, (void *) &i1, 8); - - if ((c[0] == 0x2f) && (c[1] == 0x25) - && (c[2] == 0xc0) && (c[3] == 0xc7) - && (c[4] == 0x43) && (c[5] == 0x2b) - && (c[6] == 0x1f) && (c[7] == 0x5b)) - return (0); - else - return (1); -]]] - )], - [c_cv_fp_layout_need_nothing="yes"], - [c_cv_fp_layout_need_nothing="no"] - ) - ) - if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then - fp_layout_type="nothing" - fi -fi -if test "x$fp_layout_type" = "xunknown"; then - AC_CACHE_CHECK([if endianflip converts to x86 representation], - [c_cv_fp_layout_need_endianflip], - AC_RUN_IFELSE([AC_LANG_PROGRAM( -[[[ -#include -#include -#include -#if HAVE_STDINT_H -# include -#endif -#if HAVE_INTTYPES_H -# include -#endif -#if HAVE_STDBOOL_H -# include -#endif -#define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \ - (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \ - (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \ - (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \ - (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \ - (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \ - (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \ - (((uint64_t)(A) & 0x00000000000000ffLL) << 56)) -]]], -[[[ - uint64_t i0; - uint64_t i1; - uint8_t c[8]; - double d; - - d = 8.642135e130; - memcpy ((void *) &i0, (void *) &d, 8); - - i1 = endianflip (i0); - memcpy ((void *) c, (void *) &i1, 8); - - if ((c[0] == 0x2f) && (c[1] == 0x25) - && (c[2] == 0xc0) && (c[3] == 0xc7) - && (c[4] == 0x43) && (c[5] == 0x2b) - && (c[6] == 0x1f) && (c[7] == 0x5b)) - return (0); - else - return (1); -]]] - )], - [c_cv_fp_layout_need_endianflip="yes"], - [c_cv_fp_layout_need_endianflip="no"] - ) - ) - if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then - fp_layout_type="endianflip" - fi -fi -if test "x$fp_layout_type" = "xunknown"; then - AC_CACHE_CHECK([if intswap converts to x86 representation], - [c_cv_fp_layout_need_intswap], - AC_RUN_IFELSE([AC_LANG_PROGRAM( -[[[ -#include -#include -#include -#if HAVE_STDINT_H -# include -#endif -#if HAVE_INTTYPES_H -# include -#endif -#if HAVE_STDBOOL_H -# include -#endif -#define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \ - (((uint64_t)(A) & 0x00000000ffffffffLL) << 32)) -]]], -[[[ - uint64_t i0; - uint64_t i1; - uint8_t c[8]; - double d; - - d = 8.642135e130; - memcpy ((void *) &i0, (void *) &d, 8); - - i1 = intswap (i0); - memcpy ((void *) c, (void *) &i1, 8); - - if ((c[0] == 0x2f) && (c[1] == 0x25) - && (c[2] == 0xc0) && (c[3] == 0xc7) - && (c[4] == 0x43) && (c[5] == 0x2b) - && (c[6] == 0x1f) && (c[7] == 0x5b)) - return (0); - else - return (1); -]]] - )], - [c_cv_fp_layout_need_intswap="yes"], - [c_cv_fp_layout_need_intswap="no"] - ) - ) - if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then - fp_layout_type="intswap" - fi -fi - -if test "x$fp_layout_type" = "xnothing"; then - AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1, - [Define if doubles are stored in x86 representation.]) -else if test "x$fp_layout_type" = "xendianflip"; then - AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1, - [Define if endianflip is needed to convert to x86 representation.]) -else if test "x$fp_layout_type" = "xintswap"; then - AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1, - [Define if intswap is needed to convert to x86 representation.]) -else - AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.]) -fi; fi; fi - -have_getfsstat="no" -AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"]) -have_getvfsstat="no" -AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"]) -have_listmntent="no" -AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"]) - -have_getmntent="no" -AC_CHECK_FUNCS(getmntent, [have_getmntent="c"]) -if test "x$have_getmntent" = "xno"; then - AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"]) -fi -if test "x$have_getmntent" = "xno"; then - AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"]) -fi -if test "x$have_getmntent" = "xno"; then - AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"]) -fi - -if test "x$have_getmntent" = "xc"; then - AC_CACHE_CHECK([whether getmntent takes one argument], - [c_cv_have_one_getmntent], - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( -[[[ -#include "$srcdir/src/utils_mount.h" -]]], -[[[ -FILE *fh; -struct mntent *me; -fh = setmntent ("/etc/mtab", "r"); -me = getmntent (fh); -]]] - )], - [c_cv_have_one_getmntent="yes"], - [c_cv_have_one_getmntent="no"] - ) - ) - AC_CACHE_CHECK([whether getmntent takes two arguments], - [c_cv_have_two_getmntent], - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( -[[[ -#include "$srcdir/src/utils_mount.h" -]]], -[[[ - FILE *fh; - struct mnttab mt; - int status; - fh = fopen ("/etc/mnttab", "r"); - status = getmntent (fh, &mt); -]]] - )], - [c_cv_have_two_getmntent="yes"], - [c_cv_have_two_getmntent="no"] - ) - ) -fi - -# Check for different versions of `getmntent' here.. - -if test "x$have_getmntent" = "xc"; then - if test "x$c_cv_have_one_getmntent" = "xyes"; then - AC_DEFINE(HAVE_ONE_GETMNTENT, 1, - [Define if the function getmntent exists and takes one argument.]) - fi - if test "x$c_cv_have_two_getmntent" = "xyes"; then - AC_DEFINE(HAVE_TWO_GETMNTENT, 1, - [Define if the function getmntent exists and takes two arguments.]) - fi -fi -if test "x$have_getmntent" = "xsun"; then - AC_DEFINE(HAVE_SUN_GETMNTENT, 1, - [Define if the function getmntent exists. It's the version from libsun.]) -fi -if test "x$have_getmntent" = "xseq"; then - AC_DEFINE(HAVE_SEQ_GETMNTENT, 1, - [Define if the function getmntent exists. It's the version from libseq.]) -fi -if test "x$have_getmntent" = "xgen"; then - AC_DEFINE(HAVE_GEN_GETMNTENT, 1, - [Define if the function getmntent exists. It's the version from libgen.]) -fi - -# Check for htonll -AC_MSG_CHECKING([if have htonll defined]) - - have_htonll="no" - AC_LINK_IFELSE([AC_LANG_PROGRAM( -[[[ -#include -#include -#if HAVE_INTTYPES_H -# include -#endif -]]], -[[[ - return htonll(0); -]]] - )], - [ - have_htonll="yes" - AC_DEFINE(HAVE_HTONLL, 1, [Define if the function htonll exists.]) - ]) - -AC_MSG_RESULT([$have_htonll]) - -# Check for structures -AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors], - [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])], - [], - [ - #include - #include - #include - ]) -AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors], - [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])], - [], - [ - #include - #include - #include - #include - ]) -AC_CHECK_MEMBERS([struct inet_diag_req.id, struct inet_diag_req.idiag_states], - [AC_DEFINE(HAVE_STRUCT_LINUX_INET_DIAG_REQ, 1, [Define if struct inet_diag_req exists and is usable.])], - [], - [ - #include - ]) - - -AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [], - [], - [ - #include - #include - ]) - -AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage], - [ - AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1, - [Define if struct kinfo_proc exists in the FreeBSD variant.]) - have_struct_kinfo_proc_freebsd="yes" - ], - [ - have_struct_kinfo_proc_freebsd="no" - ], - [ -#include -#include -#include -#include - ]) - -AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc], - [ - AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1, - [Define if struct kinfo_proc exists in the OpenBSD variant.]) - have_struct_kinfo_proc_openbsd="yes" - ], - [ - have_struct_kinfo_proc_openbsd="no" - ], - [ -#include -#include -#include - ]) - -AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [], -[#define _BSD_SOURCE -#if HAVE_STDINT_H -# include -#endif -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_NETINET_IN_SYSTM_H -# include -#endif -#if HAVE_NETINET_IN_H -# include -#endif -#if HAVE_NETINET_IP_H -# include -#endif -#if HAVE_NETINET_UDP_H -# include -#endif -]) -AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [], -[#define _BSD_SOURCE -#if HAVE_STDINT_H -# include -#endif -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_NETINET_IN_SYSTM_H -# include -#endif -#if HAVE_NETINET_IN_H -# include -#endif -#if HAVE_NETINET_IP_H -# include -#endif -#if HAVE_NETINET_UDP_H -# include -#endif -]) - -AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime], - [], - [], - [ -#if HAVE_KSTAT_H -# include -#endif - ]) - -# -# Checks for libraries begin here -# - -with_libresolv="yes" -AC_CHECK_LIB(resolv, res_search, -[ - AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).]) -], -[with_libresolv="no"]) -AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes") - -dnl Check for HAL (hardware abstraction library) -with_libhal="yes" -AC_CHECK_LIB(hal,libhal_device_property_exists, - [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])], - [with_libhal="no"]) -if test "x$with_libhal" = "xyes"; then - if test "x$PKG_CONFIG" != "x"; then - BUILD_WITH_LIBHAL_CFLAGS="`$PKG_CONFIG --cflags hal`" - BUILD_WITH_LIBHAL_LIBS="`$PKG_CONFIG --libs hal`" - AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS) - AC_SUBST(BUILD_WITH_LIBHAL_LIBS) - fi -fi - -m4_divert_once([HELP_WITH], [ -collectd additional packages:]) - -AM_CONDITIONAL([BUILD_AIX],[test "x$x$ac_system" = "xAIX"]) - -if test "x$ac_system" = "xAIX" -then - with_perfstat="yes" - with_procinfo="yes" -else - with_perfstat="no (AIX only)" - with_procinfo="no (AIX only)" -fi - -if test "x$with_perfstat" = "xyes" -then - AC_CHECK_LIB(perfstat, perfstat_reset, [with_perfstat="yes"], [with_perfstat="no (perfstat not found)"], []) -# AC_CHECK_HEADERS(sys/protosw.h libperfstat.h,, [with_perfstat="no (perfstat not found)"]) -fi -if test "x$with_perfstat" = "xyes" -then - AC_DEFINE(HAVE_PERFSTAT, 1, [Define to 1 if you have the 'perfstat' library (-lperfstat)]) - # struct members pertaining to donation have been added to libperfstat somewhere between AIX5.3ML5 and AIX5.3ML9 - AC_CHECK_MEMBER([perfstat_partition_type_t.b.donate_enabled], [], [], [[#include @], [Path to libcredis.])], -[ - if test "x$withval" = "xyes" - then - with_libcredis="yes" - else if test "x$withval" = "xno" - then - with_libcredis="no" - else - with_libcredis="yes" - LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS -I$withval/include" - LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS -L$withval/lib" - fi; fi -], -[with_libcredis="yes"]) - -SAVE_CPPFLAGS="$CPPFLAGS" -SAVE_LDFLAGS="$LDFLAGS" - -CPPFLAGS="$CPPFLAGS $LIBCREDIS_CPPFLAGS" -LDFLAGS="$LDFLAGS $LIBCREDIS_LDFLAGS" - -if test "x$with_libcredis" = "xyes" -then - if test "x$LIBCREDIS_CPPFLAGS" != "x" - then - AC_MSG_NOTICE([libcredis CPPFLAGS: $LIBCREDIS_CPPFLAGS]) - fi - AC_CHECK_HEADERS(credis.h, - [with_libcredis="yes"], - [with_libcredis="no (credis.h not found)"]) -fi -if test "x$with_libcredis" = "xyes" -then - if test "x$LIBCREDIS_LDFLAGS" != "x" - then - AC_MSG_NOTICE([libcredis LDFLAGS: $LIBCREDIS_LDFLAGS]) - fi - AC_CHECK_LIB(credis, credis_info, - [with_libcredis="yes"], - [with_libcredis="no (symbol 'credis_info' not found)"]) - -fi - -CPPFLAGS="$SAVE_CPPFLAGS" -LDFLAGS="$SAVE_LDFLAGS" - -if test "x$with_libcredis" = "xyes" -then - BUILD_WITH_LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS" - BUILD_WITH_LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS" - AC_SUBST(BUILD_WITH_LIBCREDIS_CPPFLAGS) - AC_SUBST(BUILD_WITH_LIBCREDIS_LDFLAGS) -fi -AM_CONDITIONAL(BUILD_WITH_LIBCREDIS, test "x$with_libcredis" = "xyes") -# }}} - -# --with-libcurl {{{ -with_curl_config="curl-config" -with_curl_cflags="" -with_curl_libs="" -AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])], -[ - if test "x$withval" = "xno" - then - with_libcurl="no" - else if test "x$withval" = "xyes" - then - with_libcurl="yes" - else - if test -f "$withval" && test -x "$withval" - then - with_curl_config="$withval" - with_libcurl="yes" - else if test -x "$withval/bin/curl-config" - then - with_curl_config="$withval/bin/curl-config" - with_libcurl="yes" - fi; fi - with_libcurl="yes" - fi; fi -], -[ - with_libcurl="yes" -]) -if test "x$with_libcurl" = "xyes" -then - with_curl_cflags=`$with_curl_config --cflags 2>/dev/null` - curl_config_status=$? - - if test $curl_config_status -ne 0 - then - with_libcurl="no ($with_curl_config failed)" - else - SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $with_curl_cflags" - - AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], []) - - CPPFLAGS="$SAVE_CPPFLAGS" - fi -fi -if test "x$with_libcurl" = "xyes" -then - with_curl_libs=`$with_curl_config --libs 2>/dev/null` - curl_config_status=$? - - if test $curl_config_status -ne 0 - then - with_libcurl="no ($with_curl_config failed)" - else - AC_CHECK_LIB(curl, curl_easy_init, - [with_libcurl="yes"], - [with_libcurl="no (symbol 'curl_easy_init' not found)"], - [$with_curl_libs]) - fi -fi -if test "x$with_libcurl" = "xyes" -then - BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags" - BUILD_WITH_LIBCURL_LIBS="$with_curl_libs" - AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS) - AC_SUBST(BUILD_WITH_LIBCURL_LIBS) -fi -AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes") -# }}} - -# --with-libdbi {{{ -with_libdbi_cppflags="" -with_libdbi_ldflags="" -AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])], -[ - if test "x$withval" != "xno" && test "x$withval" != "xyes" - then - with_libdbi_cppflags="-I$withval/include" - with_libdbi_ldflags="-L$withval/lib" - with_libdbi="yes" - else - with_libdbi="$withval" - fi -], -[ - with_libdbi="yes" -]) -if test "x$with_libdbi" = "xyes" -then - SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags" - - AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"]) - - CPPFLAGS="$SAVE_CPPFLAGS" -fi -if test "x$with_libdbi" = "xyes" -then - SAVE_CPPFLAGS="$CPPFLAGS" - SAVE_LDFLAGS="$LDFLAGS" - CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags" - LDFLAGS="$LDFLAGS $with_libdbi_ldflags" - - AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"]) - - CPPFLAGS="$SAVE_CPPFLAGS" - LDFLAGS="$SAVE_LDFLAGS" -fi -if test "x$with_libdbi" = "xyes" -then - BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags" - BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags" - BUILD_WITH_LIBDBI_LIBS="-ldbi" - AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS) - AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS) - AC_SUBST(BUILD_WITH_LIBDBI_LIBS) -fi -AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes") -# }}} - -# --with-libesmtp {{{ -AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])], -[ - if test "x$withval" != "xno" && test "x$withval" != "xyes" - then - LDFLAGS="$LDFLAGS -L$withval/lib" - CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE" - with_libesmtp="yes" - else - with_libesmtp="$withval" - fi -], -[ - with_libesmtp="yes" -]) -if test "x$with_libesmtp" = "xyes" -then - AC_CHECK_LIB(esmtp, smtp_create_session, - [ - AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).]) - ], [with_libesmtp="no (libesmtp not found)"]) -fi -if test "x$with_libesmtp" = "xyes" -then - AC_CHECK_HEADERS(libesmtp.h, - [ - AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the header file.]) - ], [with_libesmtp="no (libesmtp.h not found)"]) -fi -if test "x$with_libesmtp" = "xyes" -then - collect_libesmtp=1 -else - collect_libesmtp=0 -fi -AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp], - [Wether or not to use the esmtp library]) -AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes") -# }}} - -# --with-libganglia {{{ -AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])], -[ - if test -f "$withval" && test -x "$withval" - then - with_libganglia_config="$withval" - with_libganglia="yes" - else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config" - then - with_libganglia_config="$withval/bin/ganglia-config" - with_libganglia="yes" - else if test -d "$withval" - then - GANGLIA_CPPFLAGS="-I$withval/include" - GANGLIA_LDFLAGS="-L$withval/lib" - with_libganglia="yes" - else - with_libganglia_config="ganglia-config" - with_libganglia="$withval" - fi; fi; fi -], -[ - with_libganglia_config="ganglia-config" - with_libganglia="yes" -]) - -if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x" -then - if test "x$GANGLIA_CPPFLAGS" = "x" - then - GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null` - fi - - if test "x$GANGLIA_LDFLAGS" = "x" - then - GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null` - fi - - if test "x$GANGLIA_LIBS" = "x" - then - GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null` - fi -fi - -SAVE_CPPFLAGS="$CPPFLAGS" -SAVE_LDFLAGS="$LDFLAGS" -CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS" -LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS" - -if test "x$with_libganglia" = "xyes" -then - AC_CHECK_HEADERS(gm_protocol.h, - [ - AC_DEFINE(HAVE_GM_PROTOCOL_H, 1, - [Define to 1 if you have the header file.]) - ], [with_libganglia="no (gm_protocol.h not found)"]) -fi - -if test "x$with_libganglia" = "xyes" -then - AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg, - [ - AC_DEFINE(HAVE_LIBGANGLIA, 1, - [Define to 1 if you have the ganglia library (-lganglia).]) - ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"]) -fi - -CPPFLAGS="$SAVE_CPPFLAGS" -LDFLAGS="$SAVE_LDFLAGS" - -AC_SUBST(GANGLIA_CPPFLAGS) -AC_SUBST(GANGLIA_LDFLAGS) -AC_SUBST(GANGLIA_LIBS) -AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes") -# }}} - -# --with-libgcrypt {{{ -GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS" -GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS" -GCRYPT_LIBS="$GCRYPT_LIBS" -AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])], -[ - if test -f "$withval" && test -x "$withval" - then - with_libgcrypt_config="$withval" - with_libgcrypt="yes" - else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config" - then - with_libgcrypt_config="$withval/bin/gcrypt-config" - with_libgcrypt="yes" - else if test -d "$withval" - then - GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include" - GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib" - with_libgcrypt="yes" - else - with_libgcrypt_config="gcrypt-config" - with_libgcrypt="$withval" - fi; fi; fi -], -[ - with_libgcrypt_config="libgcrypt-config" - with_libgcrypt="yes" -]) - -if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x" -then - if test "x$GCRYPT_CPPFLAGS" = "x" - then - GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null` - fi - - if test "x$GCRYPT_LDFLAGS" = "x" - then - gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null` - GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib" - fi - - if test "x$GCRYPT_LIBS" = "x" - then - GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null` - fi -fi - -SAVE_CPPFLAGS="$CPPFLAGS" -SAVE_LDFLAGS="$LDFLAGS" -CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS" -LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS" - -if test "x$with_libgcrypt" = "xyes" -then - if test "x$GCRYPT_CPPFLAGS" != "x" - then - AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS]) - fi - AC_CHECK_HEADERS(gcrypt.h, - [with_libgcrypt="yes"], - [with_libgcrypt="no (gcrypt.h not found)"]) -fi - -if test "x$with_libgcrypt" = "xyes" -then - if test "x$GCRYPT_LDFLAGS" != "x" - then - AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS]) - fi - AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer, - [with_libgcrypt="yes"], - [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"]) - - if test "$with_libgcrypt" != "no"; then - AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)") - GCRYPT_CPPFLAGS="$LIBGCRYPT_CPPFLAGS $LIBGCRYPT_CFLAGS" - GCRYPT_LIBS="$LIBGCRYPT_LIBS" - fi -fi - -CPPFLAGS="$SAVE_CPPFLAGS" -LDFLAGS="$SAVE_LDFLAGS" - -if test "x$with_libgcrypt" = "xyes" -then - AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).]) -fi - -AC_SUBST(GCRYPT_CPPFLAGS) -AC_SUBST(GCRYPT_LDFLAGS) -AC_SUBST(GCRYPT_LIBS) -AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes") -# }}} - -# --with-libiptc {{{ -AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])], -[ - if test "x$withval" = "xshipped" - then - with_libiptc="own" - else if test "x$withval" = "xyes" - then - with_libiptc="pkgconfig" - else if test "x$withval" = "xno" - then - with_libiptc="no" - else - with_libiptc="yes" - with_libiptc_cflags="-I$withval/include" - with_libiptc_libs="-L$withval/lib" - fi; fi; fi -], -[ - if test "x$ac_system" = "xLinux" - then - with_libiptc="pkgconfig" - else - with_libiptc="no (Linux only)" - fi -]) - -if test "x$with_libiptc" = "xpkgconfig" && test "x$PKG_CONFIG" = "x" -then - with_libiptc="no (Don't have pkg-config)" -fi - -if test "x$with_libiptc" = "xpkgconfig" -then - $PKG_CONFIG --exists 'libiptc' 2>/dev/null - if test $? -ne 0 - then - with_libiptc="no (pkg-config doesn't know libiptc)" - fi -fi -if test "x$with_libiptc" = "xpkgconfig" -then - with_libiptc_cflags="`$PKG_CONFIG --cflags 'libiptc'`" - if test $? -ne 0 - then - with_libiptc="no ($PKG_CONFIG failed)" - fi - with_libiptc_libs="`$PKG_CONFIG --libs 'libiptc'`" - if test $? -ne 0 - then - with_libiptc="no ($PKG_CONFIG failed)" - fi -fi - -SAVE_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS $with_libiptc_cflags" - -# check whether the header file for libiptc is available. -if test "x$with_libiptc" = "xpkgconfig" -then - AC_CHECK_HEADERS(libiptc/libiptc.h libiptc/libip6tc.h, , - [with_libiptc="no (header file missing)"]) -fi -# If the header file is available, check for the required type declaractions. -# They may be missing in old versions of libiptc. In that case, they will be -# declared in the iptables plugin. -if test "x$with_libiptc" = "xpkgconfig" -then - AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], []) -fi -# Check for the iptc_init symbol in the library. -# This could be in iptc or ip4tc -if test "x$with_libiptc" = "xpkgconfig" -then - SAVE_LIBS="$LIBS" - AC_SEARCH_LIBS(iptc_init, [iptc ip4tc], - [with_libiptc="pkgconfig"], - [with_libiptc="no"], - [$with_libiptc_libs]) - LIBS="$SAVE_LIBS" -fi -if test "x$with_libiptc" = "xpkgconfig" -then - with_libiptc="yes" -fi - -CPPFLAGS="$SAVE_CPPFLAGS" - -if test "x$with_libiptc" = "xown" -then - with_libiptc_cflags="" - with_libiptc_libs="" -fi -if test "x$with_libiptc" = "xown" -then - AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h linux/netfilter/x_tables.h, [], - [ - with_libiptc="no (Linux iptables headers not found)" - ], - [ -#include "$srcdir/src/owniptc/ipt_kernel_headers.h" - ]) -fi -AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_libiptc" = "xown") -if test "x$with_libiptc" = "xown" -then - AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.]) - with_libiptc="yes" -fi - -AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes") -if test "x$with_libiptc" = "xyes" -then - BUILD_WITH_LIBIPTC_CPPFLAGS="$with_libiptc_cflags" - BUILD_WITH_LIBIPTC_LDFLAGS="$with_libiptc_libs" - AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS) - AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS) -fi -# }}} - -# --with-java {{{ -with_java_home="$JAVA_HOME" -with_java_vmtype="client" -with_java_cflags="" -with_java_libs="" -JAVAC="$JAVAC" -JAR="$JAR" -AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])], -[ - if test "x$withval" = "xno" - then - with_java="no" - else if test "x$withval" = "xyes" - then - with_java="yes" - else - with_java_home="$withval" - with_java="yes" - fi; fi -], -[with_java="yes"]) -if test "x$with_java" = "xyes" -then - if test -d "$with_java_home" - then - AC_MSG_CHECKING([for jni.h]) - TMPVAR=`find "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1` - if test "x$TMPVAR" != "x" - then - AC_MSG_RESULT([found in $TMPVAR]) - JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR" - else - AC_MSG_RESULT([not found]) - fi - - AC_MSG_CHECKING([for jni_md.h]) - TMPVAR=`find "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1` - if test "x$TMPVAR" != "x" - then - AC_MSG_RESULT([found in $TMPVAR]) - JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR" - else - AC_MSG_RESULT([not found]) - fi - - AC_MSG_CHECKING([for libjvm.so]) - TMPVAR=`find "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1` - if test "x$TMPVAR" != "x" - then - AC_MSG_RESULT([found in $TMPVAR]) - JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPVAR -Wl,-rpath -Wl,$TMPVAR" - else - AC_MSG_RESULT([not found]) - fi - - if test "x$JAVAC" = "x" - then - AC_MSG_CHECKING([for javac]) - TMPVAR=`find "$with_java_home" -name javac -type f 2>/dev/null | head -n 1` - if test "x$TMPVAR" != "x" - then - JAVAC="$TMPVAR" - AC_MSG_RESULT([$JAVAC]) - else - AC_MSG_RESULT([not found]) - fi - fi - if test "x$JAR" = "x" - then - AC_MSG_CHECKING([for jar]) - TMPVAR=`find "$with_java_home" -name jar -type f 2>/dev/null | head -n 1` - if test "x$TMPVAR" != "x" - then - JAR="$TMPVAR" - AC_MSG_RESULT([$JAR]) - else - AC_MSG_RESULT([not found]) - fi - fi - else if test "x$with_java_home" != "x" - then - AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home]) - fi; fi -fi - -if test "x$JAVA_CPPFLAGS" != "x" -then - AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS]) -fi -if test "x$JAVA_CFLAGS" != "x" -then - AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS]) -fi -if test "x$JAVA_LDFLAGS" != "x" -then - AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS]) -fi -if test "x$JAVAC" = "x" -then - with_javac_path="$PATH" - if test "x$with_java_home" != "x" - then - with_javac_path="$with_java_home:with_javac_path" - if test -d "$with_java_home/bin" - then - with_javac_path="$with_java_home/bin:with_javac_path" - fi - fi - - AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path") -fi -if test "x$JAVAC" = "x" -then - with_java="no (javac not found)" -fi -if test "x$JAR" = "x" -then - with_jar_path="$PATH" - if test "x$with_java_home" != "x" - then - with_jar_path="$with_java_home:$with_jar_path" - if test -d "$with_java_home/bin" - then - with_jar_path="$with_java_home/bin:$with_jar_path" - fi - fi - - AC_PATH_PROG(JAR, jar, [], "$with_jar_path") -fi -if test "x$JAR" = "x" -then - with_java="no (jar not found)" -fi - -SAVE_CPPFLAGS="$CPPFLAGS" -SAVE_CFLAGS="$CFLAGS" -SAVE_LDFLAGS="$LDFLAGS" -CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS" -CFLAGS="$CFLAGS $JAVA_CFLAGS" -LDFLAGS="$LDFLAGS $JAVA_LDFLAGS" - -if test "x$with_java" = "xyes" -then - AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"]) -fi -if test "x$with_java" = "xyes" -then - AC_CHECK_LIB(jvm, JNI_CreateJavaVM, - [with_java="yes"], - [with_java="no (libjvm not found)"], - [$JAVA_LIBS]) -fi -if test "x$with_java" = "xyes" -then - JAVA_LIBS="$JAVA_LIBS -ljvm" - AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS]) -fi - -CPPFLAGS="$SAVE_CPPFLAGS" -CFLAGS="$SAVE_CFLAGS" -LDFLAGS="$SAVE_LDFLAGS" - -AC_SUBST(JAVA_CPPFLAGS) -AC_SUBST(JAVA_CFLAGS) -AC_SUBST(JAVA_LDFLAGS) -AC_SUBST(JAVA_LIBS) -AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes") -# }}} - -# --with-libmemcached {{{ -with_libmemcached_cppflags="" -with_libmemcached_ldflags="" -AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])], -[ - if test "x$withval" != "xno" && test "x$withval" != "xyes" - then - with_libmemcached_cppflags="-I$withval/include" - with_libmemcached_ldflags="-L$withval/lib" - with_libmemcached="yes" - else - with_libmemcached="$withval" - fi -], -[ - with_libmemcached="yes" -]) -if test "x$with_libmemcached" = "xyes" -then - SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags" - - AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"]) - - CPPFLAGS="$SAVE_CPPFLAGS" -fi -if test "x$with_libmemcached" = "xyes" -then - SAVE_CPPFLAGS="$CPPFLAGS" - SAVE_LDFLAGS="$LDFLAGS" - CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags" - LDFLAGS="$LDFLAGS $with_libmemcached_ldflags" - - AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"]) - - CPPFLAGS="$SAVE_CPPFLAGS" - LDFLAGS="$SAVE_LDFLAGS" -fi -if test "x$with_libmemcached" = "xyes" -then - BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags" - BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags" - BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached" - AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS) - AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS) - AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS) - AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.]) -fi -AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes") -# }}} - -# --with-libmodbus {{{ -with_libmodbus_config="" -with_libmodbus_cflags="" -with_libmodbus_libs="" -AC_ARG_WITH(libmodbus, [AS_HELP_STRING([--with-libmodbus@<:@=PREFIX@:>@], [Path to the modbus library.])], -[ - if test "x$withval" = "xno" - then - with_libmodbus="no" - else if test "x$withval" = "xyes" - then - with_libmodbus="use_pkgconfig" - else if test -d "$with_libmodbus/lib" - then - AC_MSG_NOTICE([Not checking for libmodbus: Manually configured]) - with_libmodbus_cflags="-I$withval/include" - with_libmodbus_libs="-L$withval/lib -lmodbus" - with_libmodbus="yes" - fi; fi; fi -], -[with_libmodbus="use_pkgconfig"]) - -# configure using pkg-config -if test "x$with_libmodbus" = "xuse_pkgconfig" -then - if test "x$PKG_CONFIG" = "x" - then - with_libmodbus="no (Don't have pkg-config)" - fi -fi -if test "x$with_libmodbus" = "xuse_pkgconfig" -then - AC_MSG_NOTICE([Checking for libmodbus using $PKG_CONFIG]) - $PKG_CONFIG --exists 'libmodbus' 2>/dev/null - if test $? -ne 0 - then - with_libmodbus="no (pkg-config doesn't know libmodbus)" - fi -fi -if test "x$with_libmodbus" = "xuse_pkgconfig" -then - with_libmodbus_cflags="`$PKG_CONFIG --cflags 'libmodbus'`" - if test $? -ne 0 - then - with_libmodbus="no ($PKG_CONFIG failed)" - fi - with_libmodbus_libs="`$PKG_CONFIG --libs 'libmodbus'`" - if test $? -ne 0 - then - with_libmodbus="no ($PKG_CONFIG failed)" - fi -fi -if test "x$with_libmodbus" = "xuse_pkgconfig" -then - with_libmodbus="yes" -fi - -# with_libmodbus_cflags and with_libmodbus_libs are set up now, let's do -# the actual checks. -if test "x$with_libmodbus" = "xyes" -then - SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags" - - AC_CHECK_HEADERS(modbus/modbus.h, [], [with_libmodbus="no (modbus/modbus.h not found)"]) - - CPPFLAGS="$SAVE_CPPFLAGS" -fi -if test "x$with_libmodbus" = "xyes" -then - SAVE_CPPFLAGS="$CPPFLAGS" - SAVE_LDFLAGS="$LDFLAGS" - - CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags" - LDFLAGS="$LDFLAGS $with_libmodbus_libs" - - AC_CHECK_LIB(modbus, modbus_connect, - [with_libmodbus="yes"], - [with_libmodbus="no (symbol modbus_connect not found)"]) - - CPPFLAGS="$SAVE_CPPFLAGS" - LDFLAGS="$SAVE_LDFLAGS" -fi -if test "x$with_libmodbus" = "xyes" -then - BUILD_WITH_LIBMODBUS_CFLAGS="$with_libmodbus_cflags" - BUILD_WITH_LIBMODBUS_LIBS="$with_libmodbus_libs" - AC_SUBST(BUILD_WITH_LIBMODBUS_CFLAGS) - AC_SUBST(BUILD_WITH_LIBMODBUS_LIBS) -fi -# }}} - -# --with-libmongoc {{{ -AC_ARG_WITH(libmongoc, [AS_HELP_STRING([--with-libmongoc@<:@=PREFIX@:>@], [Path to libmongoc.])], -[ - if test "x$withval" = "xyes" - then - with_libmongoc="yes" - else if test "x$withval" = "xno" - then - with_libmongoc="no" - else - with_libmongoc="yes" - LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS -I$withval/include" - LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS -L$withval/lib" - fi; fi -], -[with_libmongoc="yes"]) - -SAVE_CPPFLAGS="$CPPFLAGS" -SAVE_LDFLAGS="$LDFLAGS" - -CPPFLAGS="$CPPFLAGS $LIBMONGOC_CPPFLAGS" -LDFLAGS="$LDFLAGS $LIBMONGOC_LDFLAGS" - -if test "x$with_libmongoc" = "xyes" -then - if test "x$LIBMONGOC_CPPFLAGS" != "x" - then - AC_MSG_NOTICE([libmongoc CPPFLAGS: $LIBMONGOC_CPPFLAGS]) - fi - AC_CHECK_HEADERS(mongo.h, - [with_libmongoc="yes"], - [with_libmongoc="no ('mongo.h' not found)"], -[#if HAVE_STDINT_H -# define MONGO_HAVE_STDINT 1 -#else -# define MONGO_USE_LONG_LONG_INT 1 -#endif -]) -fi -if test "x$with_libmongoc" = "xyes" -then - if test "x$LIBMONGOC_LDFLAGS" != "x" - then - AC_MSG_NOTICE([libmongoc LDFLAGS: $LIBMONGOC_LDFLAGS]) - fi - AC_CHECK_LIB(mongoc, mongo_run_command, - [with_libmongoc="yes"], - [with_libmongoc="no (symbol 'mongo_run_command' not found)"]) -fi - -CPPFLAGS="$SAVE_CPPFLAGS" -LDFLAGS="$SAVE_LDFLAGS" - -if test "x$with_libmongoc" = "xyes" -then - BUILD_WITH_LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS" - BUILD_WITH_LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS" - AC_SUBST(BUILD_WITH_LIBMONGOC_CPPFLAGS) - AC_SUBST(BUILD_WITH_LIBMONGOC_LDFLAGS) -fi -AM_CONDITIONAL(BUILD_WITH_LIBMONGOC, test "x$with_libmongoc" = "xyes") -# }}} - -# --with-libmysql {{{ -with_mysql_config="mysql_config" -with_mysql_cflags="" -with_mysql_libs="" -AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])], -[ - if test "x$withval" = "xno" - then - with_libmysql="no" - else if test "x$withval" = "xyes" - then - with_libmysql="yes" - else - if test -f "$withval" && test -x "$withval"; - then - with_mysql_config="$withval" - else if test -x "$withval/bin/mysql_config" - then - with_mysql_config="$withval/bin/mysql_config" - fi; fi - with_libmysql="yes" - fi; fi -], -[ - with_libmysql="yes" -]) -if test "x$with_libmysql" = "xyes" -then - with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null` - mysql_config_status=$? - - if test $mysql_config_status -ne 0 - then - with_libmysql="no ($with_mysql_config failed)" - else - SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $with_mysql_cflags" - - have_mysql_h="no" - have_mysql_mysql_h="no" - AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"]) - - if test "x$have_mysql_h" = "xno" - then - AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"]) - fi - - if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono" - then - with_libmysql="no (mysql.h not found)" - fi - - CPPFLAGS="$SAVE_CPPFLAGS" - fi -fi -if test "x$with_libmysql" = "xyes" -then - with_mysql_libs=`$with_mysql_config --libs_r 2>/dev/null` - mysql_config_status=$? - - if test $mysql_config_status -ne 0 - then - with_libmysql="no ($with_mysql_config failed)" - else - AC_CHECK_LIB(mysqlclient, mysql_init, - [with_libmysql="yes"], - [with_libmysql="no (symbol 'mysql_init' not found)"], - [$with_mysql_libs]) - - AC_CHECK_LIB(mysqlclient, mysql_get_server_version, - [with_libmysql="yes"], - [with_libmysql="no (symbol 'mysql_get_server_version' not found)"], - [$with_mysql_libs]) - fi -fi -if test "x$with_libmysql" = "xyes" -then - BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags" - BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs" - AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS) - AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS) -fi -AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes") -# }}} - -# --with-libnetlink {{{ -with_libnetlink_cflags="" -with_libnetlink_libs="-lnetlink" -AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])], -[ - echo "libnetlink: withval = $withval" - if test "x$withval" = "xyes" - then - with_libnetlink="yes" - else if test "x$withval" = "xno" - then - with_libnetlink="no" - else - if test -d "$withval/include" - then - with_libnetlink_cflags="-I$withval/include" - with_libnetlink_libs="-L$withval/lib -lnetlink" - with_libnetlink="yes" - else - AC_MSG_ERROR("no such directory: $withval/include") - fi - fi; fi -], -[ - if test "x$ac_system" = "xLinux" - then - with_libnetlink="yes" - else - with_libnetlink="no (Linux only library)" - fi -]) -if test "x$with_libnetlink" = "xyes" -then - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $with_libnetlink_cflags" - - with_libnetlink="no (libnetlink.h not found)" - - AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h, - [ - with_libnetlink="yes" - break - ], [], -[#include -#include -#include -#include -#include -#include ]) - AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [], -[#include -#include -#include -#include ]) - - AC_COMPILE_IFELSE([AC_LANG_PROGRAM( -[[[ -#include -#include -#include -#include -#include -#include -]]], -[[[ -int retval = TCA_STATS2; -return (retval); -]]] - )], - [AC_DEFINE([HAVE_TCA_STATS2], [1], [True if the enum-member TCA_STATS2 exists])]) - - AC_COMPILE_IFELSE([AC_LANG_PROGRAM( -[[[ -#include -#include -#include -#include -#include -#include -]]], -[[[ -int retval = TCA_STATS; -return (retval); -]]] - )], - [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]) - - CFLAGS="$SAVE_CFLAGS" -fi -if test "x$with_libnetlink" = "xyes" -then - AC_CHECK_LIB(netlink, rtnl_open, - [with_libnetlink="yes"], - [with_libnetlink="no (symbol 'rtnl_open' not found)"], - [$with_libnetlink_libs]) -fi -if test "x$with_libnetlink" = "xyes" -then - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $with_libnetlink_cflags" - - AC_CACHE_CHECK( - [if function 'rtnl_dump_filter' expects five arguments], - [c_cv_rtnl_dump_filter_five_args], - AC_COMPILE_IFELSE([AC_LANG_PROGRAM( -[[[ -#include -#include -#include -#include -#if HAVE_LIBNETLINK_H -# include -#elif HAVE_IPROUTE_LIBNETLINK_H -# include -#elif HAVE_LINUX_LIBNETLINK_H -# include -#endif -]]], -[[[ -if (rtnl_dump_filter(NULL, NULL, NULL, NULL, NULL)) - return 1; -return 0; -]]] - )], - [c_cv_rtnl_dump_filter_five_args="yes"], - [c_cv_rtnl_dump_filter_five_args="no"] - ) -) - - AC_CACHE_CHECK( - [if function 'rtnl_dump_filter' expects three arguments], - [c_cv_rtnl_dump_filter_three_args], - AC_COMPILE_IFELSE([AC_LANG_PROGRAM( -[[[ -#include -#include -#include -#include -#if HAVE_LIBNETLINK_H -# include -#elif HAVE_IPROUTE_LIBNETLINK_H -# include -#elif HAVE_LINUX_LIBNETLINK_H -# include -#endif -]]], -[[[ -if (rtnl_dump_filter(NULL, NULL, NULL)) - return 1; -return 0; -]]] - )], - [c_cv_rtnl_dump_filter_three_args="yes"], - [c_cv_rtnl_dump_filter_three_args="no"] - ) -) - - CFLAGS="$SAVE_CFLAGS" - - if test "x$c_cv_rtnl_dump_filter_five_args" = "xyes" - then - AC_DEFINE(RTNL_DUMP_FILTER_FIVE_ARGS, 1, - [Define to 1 if function 'rtnl_dump_filter' expects five arguments.]) - fi - if test "x$c_cv_rtnl_dump_filter_three_args" = "xyes" - then - AC_DEFINE(RTNL_DUMP_FILTER_THREE_ARGS, 1, - [Define to 1 if function 'rtnl_dump_filter' expects three arguments.]) - fi - - BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags" - BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs" - AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS) - AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS) -fi -AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes") -# }}} - -# --with-libnetapp {{{ -AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp]) -AC_ARG_VAR([LIBNETAPP_LDFLAGS], [Linker flags required to build with libnetapp]) -AC_ARG_VAR([LIBNETAPP_LIBS], [Other libraries required to link against libnetapp]) -LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS" -LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS" -LIBNETAPP_LIBS="$LIBNETAPP_LIBS" -AC_ARG_WITH(libnetapp, [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])], -[ - if test -d "$withval" - then - LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include" - LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib" - with_libnetapp="yes" - else - with_libnetapp="$withval" - fi -], -[ - with_libnetapp="yes" -]) - -SAVE_CPPFLAGS="$CPPFLAGS" -SAVE_LDFLAGS="$LDFLAGS" -CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS" -LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS" - -if test "x$with_libnetapp" = "xyes" -then - if test "x$LIBNETAPP_CPPFLAGS" != "x" - then - AC_MSG_NOTICE([netapp CPPFLAGS: $LIBNETAPP_CPPFLAGS]) - fi - AC_CHECK_HEADERS(netapp_api.h, - [with_libnetapp="yes"], - [with_libnetapp="no (netapp_api.h not found)"]) -fi - -if test "x$with_libnetapp" = "xyes" -then - if test "x$LIBNETAPP_LDFLAGS" != "x" - then - AC_MSG_NOTICE([netapp LDFLAGS: $LIBNETAPP_LDFLAGS]) - fi - - if test "x$LIBNETAPP_LIBS" = "x" - then - LIBNETAPP_LIBS="-lpthread -lxml -ladt -lssl -lm -lcrypto -lz" - fi - AC_MSG_NOTICE([netapp LIBS: $LIBNETAPP_LIBS]) - - AC_CHECK_LIB(netapp, na_server_invoke_elem, - [with_libnetapp="yes"], - [with_libnetapp="no (symbol na_server_invoke_elem not found)"], - [$LIBNETAPP_LIBS]) - LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS" -fi - -CPPFLAGS="$SAVE_CPPFLAGS" -LDFLAGS="$SAVE_LDFLAGS" - -if test "x$with_libnetapp" = "xyes" -then - AC_DEFINE(HAVE_LIBNETAPP, 1, [Define to 1 if you have the netapp library (-lnetapp).]) -fi - -AC_SUBST(LIBNETAPP_CPPFLAGS) -AC_SUBST(LIBNETAPP_LDFLAGS) -AC_SUBST(LIBNETAPP_LIBS) -AM_CONDITIONAL(BUILD_WITH_LIBNETAPP, test "x$with_libnetapp" = "xyes") -# }}} - -# --with-libnetsnmp {{{ -with_snmp_config="net-snmp-config" -with_snmp_cflags="" -with_snmp_libs="" -AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])], -[ - if test "x$withval" = "xno" - then - with_libnetsnmp="no" - else if test "x$withval" = "xyes" - then - with_libnetsnmp="yes" - else - if test -x "$withval" - then - with_snmp_config="$withval" - with_libnetsnmp="yes" - else - with_snmp_config="$withval/bin/net-snmp-config" - with_libnetsnmp="yes" - fi - fi; fi -], -[with_libnetsnmp="yes"]) -if test "x$with_libnetsnmp" = "xyes" -then - with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null` - snmp_config_status=$? - - if test $snmp_config_status -ne 0 - then - with_libnetsnmp="no ($with_snmp_config failed)" - else - SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $with_snmp_cflags" - - AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"]) - - CPPFLAGS="$SAVE_CPPFLAGS" - fi -fi -if test "x$with_libnetsnmp" = "xyes" -then - with_snmp_libs=`$with_snmp_config --libs 2>/dev/null` - snmp_config_status=$? - - if test $snmp_config_status -ne 0 - then - with_libnetsnmp="no ($with_snmp_config failed)" - else - AC_CHECK_LIB(netsnmp, init_snmp, - [with_libnetsnmp="yes"], - [with_libnetsnmp="no (libnetsnmp not found)"], - [$with_snmp_libs]) - fi -fi -if test "x$with_libnetsnmp" = "xyes" -then - BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags" - BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs" - AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS) - AC_SUBST(BUILD_WITH_LIBSNMP_LIBS) -fi -AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes") -# }}} - -# --with-liboconfig {{{ -with_own_liboconfig="no" -liboconfig_LDFLAGS="$LDFLAGS" -liboconfig_CPPFLAGS="$CPPFLAGS" -AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])], -[ - if test "x$withval" != "xno" && test "x$withval" != "xyes" - then - if test -d "$withval/lib" - then - liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib" - fi - if test -d "$withval/include" - then - liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include" - fi - fi - if test "x$withval" = "xno" - then - AC_MSG_ERROR("liboconfig is required") - fi -], -[ - with_liboconfig="yes" -]) - -save_LDFLAGS="$LDFLAGS" -save_CPPFLAGS="$CPPFLAGS" -LDFLAGS="$liboconfig_LDFLAGS" -CPPFLAGS="$liboconfig_CPPFLAGS" -AC_CHECK_LIB(oconfig, oconfig_parse_fh, -[ - with_liboconfig="yes" - with_own_liboconfig="no" -], -[ - with_liboconfig="yes" - with_own_liboconfig="yes" - LDFLAGS="$save_LDFLAGS" - CPPFLAGS="$save_CPPFLAGS" -]) - -AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes") -if test "x$with_own_liboconfig" = "xyes" -then - with_liboconfig="yes (shipped version)" -fi -# }}} - -# --with-liboping {{{ -AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])], -[ - if test "x$withval" = "xyes" - then - with_liboping="yes" - else if test "x$withval" = "xno" - then - with_liboping="no" - else - with_liboping="yes" - LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include" - LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib" - fi; fi -], -[with_liboping="yes"]) - -SAVE_CPPFLAGS="$CPPFLAGS" -SAVE_LDFLAGS="$LDFLAGS" - -CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS" -LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS" - -if test "x$with_liboping" = "xyes" -then - if test "x$LIBOPING_CPPFLAGS" != "x" - then - AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS]) - fi - AC_CHECK_HEADERS(oping.h, - [with_liboping="yes"], - [with_liboping="no (oping.h not found)"]) -fi -if test "x$with_liboping" = "xyes" -then - if test "x$LIBOPING_LDFLAGS" != "x" - then - AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS]) - fi - AC_CHECK_LIB(oping, ping_construct, - [with_liboping="yes"], - [with_liboping="no (symbol 'ping_construct' not found)"]) -fi - -CPPFLAGS="$SAVE_CPPFLAGS" -LDFLAGS="$SAVE_LDFLAGS" - -if test "x$with_liboping" = "xyes" -then - BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS" - BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS" - AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS) - AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS) -fi -AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes") -# }}} - -# --with-oracle {{{ -with_oracle_cppflags="" -with_oracle_libs="" -AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])], -[ - if test "x$withval" = "xyes" - then - if test "x$ORACLE_HOME" = "x" - then - AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.]) - fi - with_oracle="yes" - else if test "x$withval" = "xno" - then - with_oracle="no" - else - with_oracle="yes" - ORACLE_HOME="$withval" - fi; fi -], -[ - if test "x$ORACLE_HOME" = "x" - then - with_oracle="no (ORACLE_HOME is not set)" - else - with_oracle="yes" - fi -]) -if test "x$ORACLE_HOME" != "x" -then - with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public" - - if test -e "$ORACLE_HOME/lib/ldflags" - then - with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"` - fi - #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh" - with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh" -fi -if test "x$with_oracle" = "xyes" -then - SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $with_oracle_cppflags" - - AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"]) - - CPPFLAGS="$SAVE_CPPFLAGS" -fi -if test "x$with_oracle" = "xyes" -then - SAVE_CPPFLAGS="$CPPFLAGS" - SAVE_LIBS="$LIBS" - CPPFLAGS="$CPPFLAGS $with_oracle_cppflags" - LIBS="$LIBS $with_oracle_libs" - - AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"]) - - CPPFLAGS="$SAVE_CPPFLAGS" - LIBS="$SAVE_LIBS" -fi -if test "x$with_oracle" = "xyes" -then - BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags" - BUILD_WITH_ORACLE_LIBS="$with_oracle_libs" - AC_SUBST(BUILD_WITH_ORACLE_CFLAGS) - AC_SUBST(BUILD_WITH_ORACLE_LIBS) -fi -# }}} - -# --with-libowcapi {{{ -with_libowcapi_cppflags="" -with_libowcapi_libs="-lowcapi" -AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])], -[ - if test "x$withval" != "xno" && test "x$withval" != "xyes" - then - with_libowcapi_cppflags="-I$withval/include" - with_libowcapi_libs="-L$withval/lib -lowcapi" - with_libowcapi="yes" - else - with_libowcapi="$withval" - fi -], -[ - with_libowcapi="yes" -]) -if test "x$with_libowcapi" = "xyes" -then - SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$with_libowcapi_cppflags" - - AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"]) - - CPPFLAGS="$SAVE_CPPFLAGS" -fi -if test "x$with_libowcapi" = "xyes" -then - SAVE_LDFLAGS="$LDFLAGS" - SAVE_CPPFLAGS="$CPPFLAGS" - LDFLAGS="$with_libowcapi_libs" - CPPFLAGS="$with_libowcapi_cppflags" - - AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"]) - - LDFLAGS="$SAVE_LDFLAGS" - CPPFLAGS="$SAVE_CPPFLAGS" -fi -if test "x$with_libowcapi" = "xyes" -then - BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags" - BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs" - AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS) - AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS) -fi -# }}} - -# --with-libpcap {{{ -AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])], -[ - if test "x$withval" != "xno" && test "x$withval" != "xyes" - then - LDFLAGS="$LDFLAGS -L$withval/lib" - CPPFLAGS="$CPPFLAGS -I$withval/include" - with_libpcap="yes" - else - with_libpcap="$withval" - fi -], -[ - with_libpcap="yes" -]) -if test "x$with_libpcap" = "xyes" -then - AC_CHECK_LIB(pcap, pcap_open_live, - [ - AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).]) - ], [with_libpcap="no (libpcap not found)"]) -fi -if test "x$with_libpcap" = "xyes" -then - AC_CHECK_HEADERS(pcap.h,, - [with_libpcap="no (pcap.h not found)"]) -fi -if test "x$with_libpcap" = "xyes" -then - AC_CHECK_HEADERS(pcap-bpf.h,, - [with_libpcap="no (pcap-bpf.h not found)"]) -fi -if test "x$with_libpcap" = "xyes" -then - AC_CACHE_CHECK([whether libpcap has PCAP_ERROR_IFACE_NOT_UP], - [c_cv_libpcap_have_pcap_error_iface_not_up], - AC_COMPILE_IFELSE([AC_LANG_PROGRAM( -[[[ -#include -]]], -[[[ - int val = PCAP_ERROR_IFACE_NOT_UP; -]]] - )], - [c_cv_libpcap_have_pcap_error_iface_not_up="yes"], - [c_cv_libpcap_have_pcap_error_iface_not_up="no"])) -fi -if test "x$c_cv_libpcap_have_pcap_error_iface_not_up" != "xyes" -then - with_libpcap="no (pcap.h misses PCAP_ERROR_IFACE_NOT_UP)" -fi -AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes") -# }}} - -# --with-libperl {{{ -perl_interpreter="perl" -AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])], -[ - if test -f "$withval" && test -x "$withval" - then - perl_interpreter="$withval" - with_libperl="yes" - else if test "x$withval" != "xno" && test "x$withval" != "xyes" - then - LDFLAGS="$LDFLAGS -L$withval/lib" - CPPFLAGS="$CPPFLAGS -I$withval/include" - perl_interpreter="$withval/bin/perl" - with_libperl="yes" - else - with_libperl="$withval" - fi; fi -], -[ - with_libperl="yes" -]) - -AC_MSG_CHECKING([for perl]) -perl_interpreter=`which "$perl_interpreter" 2> /dev/null` -if test -x "$perl_interpreter" -then - AC_MSG_RESULT([yes ($perl_interpreter)]) -else - perl_interpreter="" - AC_MSG_RESULT([no]) -fi - -AC_SUBST(PERL, "$perl_interpreter") - -if test "x$with_libperl" = "xyes" \ - && test -n "$perl_interpreter" -then - SAVE_CFLAGS="$CFLAGS" - SAVE_LDFLAGS="$LDFLAGS" -dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string) - PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts` - PERL_LDFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts` - CFLAGS="$CFLAGS $PERL_CFLAGS" - LDFLAGS="$LDFLAGS $PERL_LDFLAGS" - - AC_CACHE_CHECK([for libperl], - [c_cv_have_libperl], - AC_LINK_IFELSE([AC_LANG_PROGRAM( -[[[ -#define PERL_NO_GET_CONTEXT -#include -#include -#include -]]], -[[[ - dTHX; - load_module (PERL_LOADMOD_NOIMPORT, - newSVpv ("Collectd::Plugin::FooBar", 24), - Nullsv); -]]] - )], - [c_cv_have_libperl="yes"], - [c_cv_have_libperl="no"] - ) - ) - - if test "x$c_cv_have_libperl" = "xyes" - then - AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.]) - AC_SUBST(PERL_CFLAGS) - AC_SUBST(PERL_LDFLAGS) - else - with_libperl="no" - fi - - CFLAGS="$SAVE_CFLAGS" - LDFLAGS="$SAVE_LDFLAGS" -else if test -z "$perl_interpreter"; then - with_libperl="no (no perl interpreter found)" - c_cv_have_libperl="no" -fi; fi -AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes") - -if test "x$with_libperl" = "xyes" -then - SAVE_CFLAGS="$CFLAGS" - SAVE_LDFLAGS="$LDFLAGS" - CFLAGS="$CFLAGS $PERL_CFLAGS" - LDFLAGS="$LDFLAGS $PERL_LDFLAGS" - - AC_CACHE_CHECK([if perl supports ithreads], - [c_cv_have_perl_ithreads], - AC_LINK_IFELSE([AC_LANG_PROGRAM( -[[[ -#include -#include -#include - -#if !defined(USE_ITHREADS) -# error "Perl does not support ithreads!" -#endif /* !defined(USE_ITHREADS) */ -]]], -[[[ ]]] - )], - [c_cv_have_perl_ithreads="yes"], - [c_cv_have_perl_ithreads="no"] - ) - ) - - if test "x$c_cv_have_perl_ithreads" = "xyes" - then - AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.]) - fi - - CFLAGS="$SAVE_CFLAGS" - LDFLAGS="$SAVE_LDFLAGS" -fi - -if test "x$with_libperl" = "xyes" -then - SAVE_CFLAGS="$CFLAGS" - SAVE_LDFLAGS="$LDFLAGS" - # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3) - # (see issues #41 and #42) - CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror" - LDFLAGS="$LDFLAGS $PERL_LDFLAGS" - - AC_CACHE_CHECK([for broken Perl_load_module()], - [c_cv_have_broken_perl_load_module], - AC_LINK_IFELSE([AC_LANG_PROGRAM( -[[[ -#define PERL_NO_GET_CONTEXT -#include -#include -#include -]]], -[[[ - dTHX; - load_module (PERL_LOADMOD_NOIMPORT, - newSVpv ("Collectd::Plugin::FooBar", 24), - Nullsv); -]]] - )], - [c_cv_have_broken_perl_load_module="no"], - [c_cv_have_broken_perl_load_module="yes"] - ) - ) - - CFLAGS="$SAVE_CFLAGS" - LDFLAGS="$SAVE_LDFLAGS" -fi -AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE, - test "x$c_cv_have_broken_perl_load_module" = "xyes") - -if test "x$with_libperl" = "xyes" -then - SAVE_CFLAGS="$CFLAGS" - SAVE_LDFLAGS="$LDFLAGS" - CFLAGS="$CFLAGS $PERL_CFLAGS" - LDFLAGS="$LDFLAGS $PERL_LDFLAGS" - - AC_CHECK_MEMBER( - [struct mgvtbl.svt_local], - [have_struct_mgvtbl_svt_local="yes"], - [have_struct_mgvtbl_svt_local="no"], - [ -#include -#include -#include - ]) - - if test "x$have_struct_mgvtbl_svt_local" = "xyes" - then - AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1, - [Define if Perl's struct mgvtbl has member svt_local.]) - fi - - CFLAGS="$SAVE_CFLAGS" - LDFLAGS="$SAVE_LDFLAGS" -fi -# }}} - -# --with-libpq {{{ -with_pg_config="pg_config" -with_libpq_includedir="" -with_libpq_libdir="" -with_libpq_cppflags="" -with_libpq_ldflags="" -AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@], - [Path to libpq.])], -[ - if test "x$withval" = "xno" - then - with_libpq="no" - else if test "x$withval" = "xyes" - then - with_libpq="yes" - else - if test -f "$withval" && test -x "$withval"; - then - with_pg_config="$withval" - else if test -x "$withval/bin/pg_config" - then - with_pg_config="$withval/bin/pg_config" - fi; fi - with_libpq="yes" - fi; fi -], -[ - with_libpq="yes" -]) -if test "x$with_libpq" = "xyes" -then - with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null` - pg_config_status=$? - - if test $pg_config_status -eq 0 - then - if test -n "$with_libpq_includedir"; then - for dir in $with_libpq_includedir; do - with_libpq_cppflags="$with_libpq_cppflags -I$dir" - done - fi - else - AC_MSG_WARN([$with_pg_config returned with status $pg_config_status]) - fi - - SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $with_libpq_cppflags" - - AC_CHECK_HEADERS(libpq-fe.h, [], - [with_libpq="no (libpq-fe.h not found)"], []) - - CPPFLAGS="$SAVE_CPPFLAGS" -fi -if test "x$with_libpq" = "xyes" -then - with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null` - pg_config_status=$? - - if test $pg_config_status -eq 0 - then - if test -n "$with_libpq_libdir"; then - for dir in $with_libpq_libdir; do - with_libpq_ldflags="$with_libpq_ldflags -L$dir" - done - fi - else - AC_MSG_WARN([$with_pg_config returned with status $pg_config_status]) - fi - - SAVE_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $with_libpq_ldflags" - - AC_CHECK_LIB(pq, PQconnectdb, - [with_libpq="yes"], - [with_libpq="no (symbol 'PQconnectdb' not found)"]) - - AC_CHECK_LIB(pq, PQserverVersion, - [with_libpq="yes"], - [with_libpq="no (symbol 'PQserverVersion' not found)"]) - - LDFLAGS="$SAVE_LDFLAGS" -fi -if test "x$with_libpq" = "xyes" -then - BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags" - BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags" - AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS) - AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS) -fi -AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes") -# }}} - -# --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"]) -if test "x$with_libpthread" = "xyes" -then - AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], []) -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") -# }}} - -# --with-python {{{ -with_python_prog="" -with_python_path="$PATH" -AC_ARG_WITH(python, [AS_HELP_STRING([--with-python@<:@=PREFIX@:>@], [Path to the python interpreter.])], -[ - if test "x$withval" = "xyes" || test "x$withval" = "xno" - then - with_python="$withval" - else if test -x "$withval" - then - with_python_prog="$withval" - with_python_path="`dirname \"$withval\"`$PATH_SEPARATOR$with_python_path" - with_python="yes" - else if test -d "$withval" - then - with_python_path="$withval$PATH_SEPARATOR$with_python_path" - with_python="yes" - else - AC_MSG_WARN([Argument not recognized: $withval]) - fi; fi; fi -], [with_python="yes"]) - -SAVE_PATH="$PATH" -SAVE_CPPFLAGS="$CPPFLAGS" -SAVE_LDFLAGS="$LDFLAGS" -SAVE_LIBS="$LIBS" - -PATH="$with_python_path" - -if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x" -then - AC_MSG_CHECKING([for python]) - with_python_prog="`which python 2>/dev/null`" - if test "x$with_python_prog" = "x" - then - AC_MSG_RESULT([not found]) - with_python="no (interpreter not found)" - else - AC_MSG_RESULT([$with_python_prog]) - fi -fi - -if test "x$with_python" = "xyes" -then - AC_MSG_CHECKING([for Python CPPFLAGS]) - python_include_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_python_inc())" | "$with_python_prog" 2>&1` - python_config_status=$? - - if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x" - then - AC_MSG_RESULT([failed with status $python_config_status (output: $python_include_path)]) - with_python="no" - else - AC_MSG_RESULT([$python_include_path]) - fi -fi - -if test "x$with_python" = "xyes" -then - CPPFLAGS="-I$python_include_path $CPPFLAGS" - AC_CHECK_HEADERS(Python.h, - [with_python="yes"], - [with_python="no ('Python.h' not found)"]) -fi - -if test "x$with_python" = "xyes" -then - AC_MSG_CHECKING([for Python LDFLAGS]) - python_library_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_config_vars(\"LIBDIR\").__getitem__(0))" | "$with_python_prog" 2>&1` - python_config_status=$? - - if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x" - then - AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_path)]) - with_python="no" - else - AC_MSG_RESULT([$python_library_path]) - fi -fi - -if test "x$with_python" = "xyes" -then - AC_MSG_CHECKING([for Python LIBS]) - python_library_flags=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_config_vars(\"BLDLIBRARY\").__getitem__(0))" | "$with_python_prog" 2>&1` - python_config_status=$? - - if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x" - then - AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_flags)]) - with_python="no" - else - AC_MSG_RESULT([$python_library_flags]) - fi -fi - -if test "x$with_python" = "xyes" -then - LDFLAGS="-L$python_library_path $LDFLAGS" - LIBS="$python_library_flags $LIBS" - - AC_CHECK_FUNC(PyObject_CallFunction, - [with_python="yes"], - [with_python="no (Symbol 'PyObject_CallFunction' not found)"]) -fi - -PATH="$SAVE_PATH" -CPPFLAGS="$SAVE_CPPFLAGS" -LDFLAGS="$SAVE_LDFLAGS" -LIBS="$SAVE_LIBS" - -if test "x$with_python" = "xyes" -then - BUILD_WITH_PYTHON_CPPFLAGS="-I$python_include_path" - BUILD_WITH_PYTHON_LDFLAGS="-L$python_library_path" - BUILD_WITH_PYTHON_LIBS="$python_library_flags" - AC_SUBST(BUILD_WITH_PYTHON_CPPFLAGS) - AC_SUBST(BUILD_WITH_PYTHON_LDFLAGS) - AC_SUBST(BUILD_WITH_PYTHON_LIBS) -fi -# }}} --with-python - -# --with-librabbitmq {{{ -with_librabbitmq_cppflags="" -with_librabbitmq_ldflags="" -AC_ARG_WITH(librabbitmq, [AS_HELP_STRING([--with-librabbitmq@<:@=PREFIX@:>@], [Path to librabbitmq.])], -[ - if test "x$withval" != "xno" && test "x$withval" != "xyes" - then - with_librabbitmq_cppflags="-I$withval/include" - with_librabbitmq_ldflags="-L$withval/lib" - with_librabbitmq="yes" - else - with_librabbitmq="$withval" - fi -], -[ - with_librabbitmq="yes" -]) -SAVE_CPPFLAGS="$CPPFLAGS" -SAVE_LDFLAGS="$LDFLAGS" -CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags" -LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags" -if test "x$with_librabbitmq" = "xyes" -then - AC_CHECK_HEADERS(amqp.h, [with_librabbitmq="yes"], [with_librabbitmq="no (amqp.h not found)"]) -fi -if test "x$with_librabbitmq" = "xyes" -then - # librabbitmq up to version 0.9.1 provides "library_errno", later - # versions use "library_error". The library does not provide a version - # macro :( Use "AC_CHECK_MEMBERS" (plural) for automatic defines. - AC_CHECK_MEMBERS([amqp_rpc_reply_t.library_errno],,, - [ -#if HAVE_STDLIB_H -# include -#endif -#if HAVE_STDIO_H -# include -#endif -#if HAVE_STDINT_H -# include -#endif -#if HAVE_INTTYPES_H -# include -#endif -#include - ]) -fi -if test "x$with_librabbitmq" = "xyes" -then - AC_CHECK_LIB(rabbitmq, amqp_basic_publish, [with_librabbitmq="yes"], [with_librabbitmq="no (Symbol 'amqp_basic_publish' not found)"]) -fi -if test "x$with_librabbitmq" = "xyes" -then - BUILD_WITH_LIBRABBITMQ_CPPFLAGS="$with_librabbitmq_cppflags" - BUILD_WITH_LIBRABBITMQ_LDFLAGS="$with_librabbitmq_ldflags" - BUILD_WITH_LIBRABBITMQ_LIBS="-lrabbitmq" - AC_SUBST(BUILD_WITH_LIBRABBITMQ_CPPFLAGS) - AC_SUBST(BUILD_WITH_LIBRABBITMQ_LDFLAGS) - AC_SUBST(BUILD_WITH_LIBRABBITMQ_LIBS) - AC_DEFINE(HAVE_LIBRABBITMQ, 1, [Define if librabbitmq is present and usable.]) -fi -CPPFLAGS="$SAVE_CPPFLAGS" -LDFLAGS="$SAVE_LDFLAGS" -AM_CONDITIONAL(BUILD_WITH_LIBRABBITMQ, test "x$with_librabbitmq" = "xyes") - -with_amqp_tcp_socket="no" -if test "x$with_librabbitmq" = "xyes" -then - SAVE_CPPFLAGS="$CPPFLAGS" - SAVE_LDFLAGS="$LDFLAGS" - SAVE_LIBS="$LIBS" - CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags" - LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags" - LIBS="-lrabbitmq" - - AC_CHECK_HEADERS(amqp_tcp_socket.h amqp_socket.h) - AC_CHECK_FUNC(amqp_tcp_socket_new, [with_amqp_tcp_socket="yes"], [with_amqp_tcp_socket="no"]) - if test "x$with_amqp_tcp_socket" = "xyes" - then - AC_DEFINE(HAVE_AMQP_TCP_SOCKET, 1, - [Define if librabbitmq provides the new TCP socket interface.]) - fi - - AC_CHECK_DECLS(amqp_socket_close, - [amqp_socket_close_decl="yes"], [amqp_socket_close_decl="no"], - [[ -#include -#ifdef HAVE_AMQP_TCP_SOCKET_H -# include -#endif -#ifdef HAVE_AMQP_SOCKET_H -# include -#endif - ]]) - - CPPFLAGS="$SAVE_CPPFLAGS" - LDFLAGS="$SAVE_LDFLAGS" - LIBS="$SAVE_LIBS" -fi -# }}} - -# --with-librouteros {{{ -AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])], -[ - if test "x$withval" = "xyes" - then - with_librouteros="yes" - else if test "x$withval" = "xno" - then - with_librouteros="no" - else - with_librouteros="yes" - LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include" - LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib" - fi; fi -], -[with_librouteros="yes"]) - -SAVE_CPPFLAGS="$CPPFLAGS" -SAVE_LDFLAGS="$LDFLAGS" - -CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS" -LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS" - -if test "x$with_librouteros" = "xyes" -then - if test "x$LIBROUTEROS_CPPFLAGS" != "x" - then - AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS]) - fi - AC_CHECK_HEADERS(routeros_api.h, - [with_librouteros="yes"], - [with_librouteros="no (routeros_api.h not found)"]) -fi -if test "x$with_librouteros" = "xyes" -then - if test "x$LIBROUTEROS_LDFLAGS" != "x" - then - AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS]) - fi - AC_CHECK_LIB(routeros, ros_interface, - [with_librouteros="yes"], - [with_librouteros="no (symbol 'ros_interface' not found)"]) -fi - -CPPFLAGS="$SAVE_CPPFLAGS" -LDFLAGS="$SAVE_LDFLAGS" - -if test "x$with_librouteros" = "xyes" -then - BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS" - BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS" - AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS) - AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS) -fi -AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes") -# }}} - -# --with-librrd {{{ -# AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given]) -librrd_cflags="" -librrd_ldflags="" -librrd_threadsafe="yes" -librrd_rrdc_update="no" -AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])], -[ if test "x$withval" != "xno" && test "x$withval" != "xyes" - then - librrd_cflags="-I$withval/include" - librrd_ldflags="-L$withval/lib" - with_librrd="yes" - else - with_librrd="$withval" - fi -], [with_librrd="yes"]) -if test "x$with_librrd" = "xyes" -then - SAVE_CPPFLAGS="$CPPFLAGS" - SAVE_LDFLAGS="$LDFLAGS" - - CPPFLAGS="$CPPFLAGS $librrd_cflags" - LDFLAGS="$LDFLAGS $librrd_ldflags" - - AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"]) - - CPPFLAGS="$SAVE_CPPFLAGS" - LDFLAGS="$SAVE_LDFLAGS" -fi -if test "x$with_librrd" = "xyes" -then - SAVE_CPPFLAGS="$CPPFLAGS" - SAVE_LDFLAGS="$LDFLAGS" - - CPPFLAGS="$CPPFLAGS $librrd_cflags" - LDFLAGS="$LDFLAGS $librrd_ldflags" - - AC_CHECK_LIB(rrd_th, rrd_update_r, - [with_librrd="yes" - librrd_ldflags="$librrd_ldflags -lrrd_th -lm" - ], - [librrd_threadsafe="no" - AC_CHECK_LIB(rrd, rrd_update, - [with_librrd="yes" - librrd_ldflags="$librrd_ldflags -lrrd -lm" - ], - [with_librrd="no (symbol 'rrd_update' not found)"], - [-lm]) - ], - [-lm]) - - if test "x$librrd_threadsafe" = "xyes" - then - AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"]) - else - AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"]) - fi - - CPPFLAGS="$SAVE_CPPFLAGS" - LDFLAGS="$SAVE_LDFLAGS" -fi -if test "x$with_librrd" = "xyes" -then - BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags" - BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags" - AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS) - AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS) -fi -if test "x$librrd_threadsafe" = "xyes" -then - AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).]) -fi -# }}} - -# --with-libsensors {{{ -with_sensors_cflags="" -with_sensors_ldflags="" -AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])], -[ - if test "x$withval" = "xno" - then - with_libsensors="no" - else - with_libsensors="yes" - if test "x$withval" != "xyes" - then - with_sensors_cflags="-I$withval/include" - with_sensors_ldflags="-L$withval/lib" - with_libsensors="yes" - fi - fi -], -[ - if test "x$ac_system" = "xLinux" - then - with_libsensors="yes" - else - with_libsensors="no (Linux only library)" - fi -]) -if test "x$with_libsensors" = "xyes" -then - SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $with_sensors_cflags" - -# AC_CHECK_HEADERS(sensors/sensors.h, -# [ -# AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the header file.]) -# ], -# [with_libsensors="no (sensors/sensors.h not found)"]) - AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"]) - - CPPFLAGS="$SAVE_CPPFLAGS" -fi -if test "x$with_libsensors" = "xyes" -then - SAVE_CPPFLAGS="$CPPFLAGS" - SAVE_LDFLAGS="$LDFLAGS" - CPPFLAGS="$CPPFLAGS $with_sensors_cflags" - LDFLAGS="$LDFLAGS $with_sensors_ldflags" - - AC_CHECK_LIB(sensors, sensors_init, - [ - AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).]) - ], - [with_libsensors="no (libsensors not found)"]) - - CPPFLAGS="$SAVE_CPPFLAGS" - LDFLAGS="$SAVE_LDFLAGS" -fi -if test "x$with_libsensors" = "xyes" -then - BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags" - BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags" - AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS) - AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS) -fi -AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes") -# }}} - -# --with-libstatgrab {{{ -with_libstatgrab_cflags="" -with_libstatgrab_ldflags="" -AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])], -[ - if test "x$withval" != "xno" \ - && test "x$withval" != "xyes" - then - with_libstatgrab_cflags="-I$withval/include" - with_libstatgrab_ldflags="-L$withval/lib -lstatgrab" - with_libstatgrab="yes" - with_libstatgrab_pkg_config="no" - else - with_libstatgrab="$withval" - with_libstatgrab_pkg_config="yes" - fi - ], -[ - with_libstatgrab="yes" - with_libstatgrab_pkg_config="yes" -]) - -if test "x$with_libstatgrab" = "xyes" \ - && test "x$with_libstatgrab_pkg_config" = "xyes" -then - if test "x$PKG_CONFIG" != "x" - then - AC_MSG_CHECKING([pkg-config for libstatgrab]) - temp_result="found" - $PKG_CONFIG --exists libstatgrab 2>/dev/null - if test "$?" != "0" - then - with_libstatgrab_pkg_config="no" - with_libstatgrab="no (pkg-config doesn't know libstatgrab)" - temp_result="not found" - fi - AC_MSG_RESULT([$temp_result]) - else - AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.]) - with_libstatgrab_pkg_config="no" - with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab" - fi -fi - -if test "x$with_libstatgrab" = "xyes" \ - && test "x$with_libstatgrab_pkg_config" = "xyes" \ - && test "x$with_libstatgrab_cflags" = "x" -then - AC_MSG_CHECKING([for libstatgrab CFLAGS]) - temp_result="`$PKG_CONFIG --cflags libstatgrab`" - if test "$?" = "0" - then - with_libstatgrab_cflags="$temp_result" - else - with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)" - temp_result="$PKG_CONFIG --cflags libstatgrab failed" - fi - AC_MSG_RESULT([$temp_result]) -fi - -if test "x$with_libstatgrab" = "xyes" \ - && test "x$with_libstatgrab_pkg_config" = "xyes" \ - && test "x$with_libstatgrab_ldflags" = "x" -then - AC_MSG_CHECKING([for libstatgrab LDFLAGS]) - temp_result="`$PKG_CONFIG --libs libstatgrab`" - if test "$?" = "0" - then - with_libstatgrab_ldflags="$temp_result" - else - with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)" - temp_result="$PKG_CONFIG --libs libstatgrab failed" - fi - AC_MSG_RESULT([$temp_result]) -fi - -if test "x$with_libstatgrab" = "xyes" -then - SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags" - - AC_CHECK_HEADERS(statgrab.h, - [with_libstatgrab="yes"], - [with_libstatgrab="no (statgrab.h not found)"]) - - CPPFLAGS="$SAVE_CPPFLAGS" -fi - -if test "x$with_libstatgrab" = "xyes" -then - SAVE_CFLAGS="$CFLAGS" - SAVE_LDFLAGS="$LDFLAGS" - - CFLAGS="$CFLAGS $with_libstatgrab_cflags" - LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags" - - AC_CHECK_LIB(statgrab, sg_init, - [with_libstatgrab="yes"], - [with_libstatgrab="no (symbol sg_init not found)"]) - - CFLAGS="$SAVE_CFLAGS" - LDFLAGS="$SAVE_LDFLAGS" -fi - -AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes") -if test "x$with_libstatgrab" = "xyes" -then - AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)]) - BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags" - BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags" - AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS) - AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS) -fi -# }}} - -# --with-libtokyotyrant {{{ -with_libtokyotyrant_cppflags="" -with_libtokyotyrant_ldflags="" -with_libtokyotyrant_libs="" -AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])], -[ - if test "x$withval" = "xno" - then - with_libtokyotyrant="no" - else if test "x$withval" = "xyes" - then - with_libtokyotyrant="yes" - else - with_libtokyotyrant_cppflags="-I$withval/include" - with_libtokyotyrant_ldflags="-L$withval/include" - with_libtokyotyrant_libs="-ltokyotyrant" - with_libtokyotyrant="yes" - fi; fi -], -[ - with_libtokyotyrant="yes" -]) - -if test "x$with_libtokyotyrant" = "xyes" -then - if $PKG_CONFIG --exists tokyotyrant - then - with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`" - with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `$PKG_CONFIG --libs-only-L tokyotyrant`" - with_libtokyotyrant_libs="$with_libtokyotyrant_libs `$PKG_CONFIG --libs-only-l tokyotyrant`" - fi -fi - -SAVE_CPPFLAGS="$CPPFLAGS" -SAVE_LDFLAGS="$LDFLAGS" -CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags" -LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags" - -if test "x$with_libtokyotyrant" = "xyes" -then - AC_CHECK_HEADERS(tcrdb.h, - [ - AC_DEFINE(HAVE_TCRDB_H, 1, - [Define to 1 if you have the header file.]) - ], [with_libtokyotyrant="no (tcrdb.h not found)"]) -fi - -if test "x$with_libtokyotyrant" = "xyes" -then - AC_CHECK_LIB(tokyotyrant, tcrdbrnum, - [ - AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1, - [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).]) - ], - [with_libtokyotyrant="no (symbol tcrdbrnum not found)"], - [$with_libtokyotyrant_libs]) -fi - -CPPFLAGS="$SAVE_CPPFLAGS" -LDFLAGS="$SAVE_LDFLAGS" - -if test "x$with_libtokyotyrant" = "xyes" -then - BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags" - BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags" - BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs" - AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS) - AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS) - AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS) -fi -AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes") -# }}} - -# --with-libupsclient {{{ -with_libupsclient_config="" -with_libupsclient_cflags="" -with_libupsclient_libs="" -AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the upsclient library.])], -[ - if test "x$withval" = "xno" - then - with_libupsclient="no" - else if test "x$withval" = "xyes" - then - with_libupsclient="use_pkgconfig" - else - if test -x "$withval" - then - with_libupsclient_config="$withval" - with_libupsclient="use_libupsclient_config" - else if test -x "$withval/bin/libupsclient-config" - then - with_libupsclient_config="$withval/bin/libupsclient-config" - with_libupsclient="use_libupsclient_config" - else - AC_MSG_NOTICE([Not checking for libupsclient: Manually configured]) - with_libupsclient_cflags="-I$withval/include" - with_libupsclient_libs="-L$withval/lib -lupsclient" - with_libupsclient="yes" - fi; fi - fi; fi -], -[with_libupsclient="use_pkgconfig"]) - -# configure using libupsclient-config -if test "x$with_libupsclient" = "xuse_libupsclient_config" -then - AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config]) - with_libupsclient_cflags="`$with_libupsclient_config --cflags`" - if test $? -ne 0 - then - with_libupsclient="no ($with_libupsclient_config failed)" - fi - with_libupsclient_libs="`$with_libupsclient_config --libs`" - if test $? -ne 0 - then - with_libupsclient="no ($with_libupsclient_config failed)" - fi -fi -if test "x$with_libupsclient" = "xuse_libupsclient_config" -then - with_libupsclient="yes" -fi - -# configure using pkg-config -if test "x$with_libupsclient" = "xuse_pkgconfig" -then - if test "x$PKG_CONFIG" = "x" - then - with_libupsclient="no (Don't have pkg-config)" - fi -fi -if test "x$with_libupsclient" = "xuse_pkgconfig" -then - AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG]) - $PKG_CONFIG --exists 'libupsclient' 2>/dev/null - if test $? -ne 0 - then - with_libupsclient="no (pkg-config doesn't know libupsclient)" - fi -fi -if test "x$with_libupsclient" = "xuse_pkgconfig" -then - with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`" - if test $? -ne 0 - then - with_libupsclient="no ($PKG_CONFIG failed)" - fi - with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`" - if test $? -ne 0 - then - with_libupsclient="no ($PKG_CONFIG failed)" - fi -fi -if test "x$with_libupsclient" = "xuse_pkgconfig" -then - with_libupsclient="yes" -fi - -# with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do -# the actual checks. -if test "x$with_libupsclient" = "xyes" -then - SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags" - - AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"]) - - CPPFLAGS="$SAVE_CPPFLAGS" -fi -if test "x$with_libupsclient" = "xyes" -then - SAVE_CPPFLAGS="$CPPFLAGS" - SAVE_LDFLAGS="$LDFLAGS" - - CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags" - LDFLAGS="$LDFLAGS $with_libupsclient_libs" - - AC_CHECK_LIB(upsclient, upscli_connect, - [with_libupsclient="yes"], - [with_libupsclient="no (symbol upscli_connect not found)"]) - - CPPFLAGS="$SAVE_CPPFLAGS" - LDFLAGS="$SAVE_LDFLAGS" -fi -if test "x$with_libupsclient" = "xyes" -then - SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags" - - AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [], -[#include -#include -#include ]) - - CPPFLAGS="$SAVE_CPPFLAGS" -fi -if test "x$with_libupsclient" = "xyes" -then - BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags" - BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs" - AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS) - AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS) -fi -# }}} - -# --with-libxmms {{{ -with_xmms_config="xmms-config" -with_xmms_cflags="" -with_xmms_libs="" -AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])], -[ - if test "x$withval" != "xno" \ - && test "x$withval" != "xyes" - then - if test -f "$withval" && test -x "$withval"; - then - with_xmms_config="$withval" - else if test -x "$withval/bin/xmms-config" - then - with_xmms_config="$withval/bin/xmms-config" - fi; fi - with_libxmms="yes" - else if test "x$withval" = "xno" - then - with_libxmms="no" - else - with_libxmms="yes" - fi; fi -], -[ - with_libxmms="yes" -]) -if test "x$with_libxmms" = "xyes" -then - with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null` - xmms_config_status=$? - - if test $xmms_config_status -ne 0 - then - with_libxmms="no" - fi -fi -if test "x$with_libxmms" = "xyes" -then - with_xmms_libs=`$with_xmms_config --libs 2>/dev/null` - xmms_config_status=$? - - if test $xmms_config_status -ne 0 - then - with_libxmms="no" - fi -fi -if test "x$with_libxmms" = "xyes" -then - AC_CHECK_LIB(xmms, xmms_remote_get_info, - [ - BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags" - BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs" - AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS) - AC_SUBST(BUILD_WITH_LIBXMMS_LIBS) - ], - [ - with_libxmms="no" - ], - [$with_xmms_libs]) -fi -with_libxmms_numeric=0 -if test "x$with_libxmms" = "xyes" -then - with_libxmms_numeric=1 -fi -AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).]) -AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes") -# }}} - -# --with-libyajl {{{ -with_libyajl_cppflags="" -with_libyajl_ldflags="" -AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])], -[ - if test "x$withval" != "xno" && test "x$withval" != "xyes" - then - with_libyajl_cppflags="-I$withval/include" - with_libyajl_ldflags="-L$withval/lib" - with_libyajl="yes" - else - with_libyajl="$withval" - fi -], -[ - with_libyajl="yes" -]) -if test "x$with_libyajl" = "xyes" -then - SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags" - - AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"]) - AC_CHECK_HEADERS(yajl/yajl_version.h) - - CPPFLAGS="$SAVE_CPPFLAGS" -fi -if test "x$with_libyajl" = "xyes" -then - SAVE_CPPFLAGS="$CPPFLAGS" - SAVE_LDFLAGS="$LDFLAGS" - CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags" - LDFLAGS="$LDFLAGS $with_libyajl_ldflags" - - AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"]) - - CPPFLAGS="$SAVE_CPPFLAGS" - LDFLAGS="$SAVE_LDFLAGS" -fi -if test "x$with_libyajl" = "xyes" -then - BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags" - BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags" - BUILD_WITH_LIBYAJL_LIBS="-lyajl" - AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS) - AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS) - AC_SUBST(BUILD_WITH_LIBYAJL_LIBS) - AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.]) -fi -AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes") -# }}} - -# --with-libvarnish {{{ -with_libvarnish_cppflags="" -with_libvarnish_cflags="" -with_libvarnish_libs="" -AC_ARG_WITH(libvarnish, [AS_HELP_STRING([--with-libvarnish@<:@=PREFIX@:>@], [Path to libvarnish.])], -[ - if test "x$withval" = "xno" - then - with_libvarnish="no" - else if test "x$withval" = "xyes" - then - with_libvarnish="use_pkgconfig" - else if test -d "$with_libvarnish/lib" - then - AC_MSG_NOTICE([Not checking for libvarnish: Manually configured]) - with_libvarnish_cflags="-I$withval/include" - with_libvarnish_libs="-L$withval/lib -lvarnishapi" - with_libvarnish="yes" - fi; fi; fi -], -[with_libvarnish="use_pkgconfig"]) - -# configure using pkg-config -if test "x$with_libvarnish" = "xuse_pkgconfig" -then - if test "x$PKG_CONFIG" = "x" - then - with_libvarnish="no (Don't have pkg-config)" - fi -fi -if test "x$with_libvarnish" = "xuse_pkgconfig" -then - AC_MSG_NOTICE([Checking for varnishapi using $PKG_CONFIG]) - $PKG_CONFIG --exists 'varnishapi' 2>/dev/null - if test $? -ne 0 - then - with_libvarnish="no (pkg-config doesn't know varnishapi)" - fi -fi -if test "x$with_libvarnish" = "xuse_pkgconfig" -then - with_libvarnish_cflags="`$PKG_CONFIG --cflags 'varnishapi'`" - if test $? -ne 0 - then - with_libvarnish="no ($PKG_CONFIG failed)" - fi - with_libvarnish_libs="`$PKG_CONFIG --libs 'varnishapi'`" - if test $? -ne 0 - then - with_libvarnish="no ($PKG_CONFIG failed)" - fi -fi -if test "x$with_libvarnish" = "xuse_pkgconfig" -then - with_libvarnish="yes" -fi - -# with_libvarnish_cflags and with_libvarnish_libs are set up now, let's do -# the actual checks. -if test "x$with_libvarnish" = "xyes" -then - SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags" - AC_CHECK_HEADERS(varnish/varnishapi.h, [], [with_libvarnish="no (varnish/varnishapi.h not found)"]) - - CPPFLAGS="$SAVE_CPPFLAGS" -fi -if test "x$with_libvarnish" = "xyes" -then - SAVE_CPPFLAGS="$CPPFLAGS" - #SAVE_LDFLAGS="$LDFLAGS" - - CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags" - #LDFLAGS="$LDFLAGS $with_libvarnish_libs" - - AC_CHECK_HEADERS(varnish/vsc.h, - [AC_DEFINE([HAVE_VARNISH_V3], [1], [Varnish 3 API support])], - [AC_DEFINE([HAVE_VARNISH_V2], [1], [Varnish 2 API support])]) - - CPPFLAGS="$SAVE_CPPFLAGS" - #LDFLAGS="$SAVE_LDFLAGS" -fi -if test "x$with_libvarnish" = "xyes" -then - BUILD_WITH_LIBVARNISH_CFLAGS="$with_libvarnish_cflags" - BUILD_WITH_LIBVARNISH_LIBS="$with_libvarnish_libs" - AC_SUBST(BUILD_WITH_LIBVARNISH_CFLAGS) - AC_SUBST(BUILD_WITH_LIBVARNISH_LIBS) -fi -# }}} - -# pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{ -with_libxml2="no (pkg-config isn't available)" -with_libxml2_cflags="" -with_libxml2_ldflags="" -with_libvirt="no (pkg-config isn't available)" -with_libvirt_cflags="" -with_libvirt_ldflags="" -if test "x$PKG_CONFIG" != "x" -then - $PKG_CONFIG --exists 'libxml-2.0' 2>/dev/null - if test "$?" = "0" - then - with_libxml2="yes" - else - with_libxml2="no (pkg-config doesn't know libxml-2.0)" - fi - - $PKG_CONFIG --exists libvirt 2>/dev/null - if test "$?" = "0" - then - with_libvirt="yes" - else - with_libvirt="no (pkg-config doesn't know libvirt)" - fi -fi -if test "x$with_libxml2" = "xyes" -then - with_libxml2_cflags="`$PKG_CONFIG --cflags libxml-2.0`" - if test $? -ne 0 - then - with_libxml2="no" - fi - with_libxml2_ldflags="`$PKG_CONFIG --libs libxml-2.0`" - if test $? -ne 0 - then - with_libxml2="no" - fi -fi -if test "x$with_libxml2" = "xyes" -then - SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $with_libxml2_cflags" - - AC_CHECK_HEADERS(libxml/parser.h, [], - [with_libxml2="no (libxml/parser.h not found)"]) - - CPPFLAGS="$SAVE_CPPFLAGS" -fi -if test "x$with_libxml2" = "xyes" -then - SAVE_CFLAGS="$CFLAGS" - SAVE_LDFLAGS="$LDFLAGS" - - CFLAGS="$CFLAGS $with_libxml2_cflags" - LDFLAGS="$LDFLAGS $with_libxml2_ldflags" - - AC_CHECK_LIB(xml2, xmlXPathEval, - [with_libxml2="yes"], - [with_libxml2="no (symbol xmlXPathEval not found)"]) - - CFLAGS="$SAVE_CFLAGS" - LDFLAGS="$SAVE_LDFLAGS" -fi -dnl Add the right compiler flags and libraries. -if test "x$with_libxml2" = "xyes"; then - BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags" - BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags" - AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS) - AC_SUBST(BUILD_WITH_LIBXML2_LIBS) -fi -if test "x$with_libvirt" = "xyes" -then - with_libvirt_cflags="`$PKG_CONFIG --cflags libvirt`" - if test $? -ne 0 - then - with_libvirt="no" - fi - with_libvirt_ldflags="`$PKG_CONFIG --libs libvirt`" - if test $? -ne 0 - then - with_libvirt="no" - fi -fi -if test "x$with_libvirt" = "xyes" -then - SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $with_libvirt_cflags" - - AC_CHECK_HEADERS(libvirt/libvirt.h, [], - [with_libvirt="no (libvirt/libvirt.h not found)"]) - - CPPFLAGS="$SAVE_CPPFLAGS" -fi -if test "x$with_libvirt" = "xyes" -then - SAVE_CFLAGS="$CFLAGS" - SAVE_LDFLAGS="$LDFLAGS" - - CFLAGS="$CFLAGS $with_libvirt_cflags" - LDFLAGS="$LDFLAGS $with_libvirt_ldflags" - - AC_CHECK_LIB(virt, virDomainBlockStats, - [with_libvirt="yes"], - [with_libvirt="no (symbol virDomainBlockStats not found)"]) - - CFLAGS="$SAVE_CFLAGS" - LDFLAGS="$SAVE_LDFLAGS" -fi -dnl Add the right compiler flags and libraries. -if test "x$with_libvirt" = "xyes"; then - BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags" - BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags" - AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS) - AC_SUBST(BUILD_WITH_LIBVIRT_LIBS) -fi -# }}} - -# $PKG_CONFIG --exists OpenIPMIpthread {{{ -with_libopenipmipthread="yes" -with_libopenipmipthread_cflags="" -with_libopenipmipthread_libs="" - -AC_MSG_CHECKING([for pkg-config]) -temp_result="no" -if test "x$PKG_CONFIG" = "x" -then - with_libopenipmipthread="no" - temp_result="no" -else - temp_result="$PKG_CONFIG" -fi -AC_MSG_RESULT([$temp_result]) - -if test "x$with_libopenipmipthread" = "xyes" -then - AC_MSG_CHECKING([for libOpenIPMIpthread]) - $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null - if test "$?" != "0" - then - with_libopenipmipthread="no (pkg-config doesn't know OpenIPMIpthread)" - fi - AC_MSG_RESULT([$with_libopenipmipthread]) -fi - -if test "x$with_libopenipmipthread" = "xyes" -then - AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS]) - temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`" - if test "$?" = "0" - then - with_libopenipmipthread_cflags="$temp_result" - else - with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)" - temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed" - fi - AC_MSG_RESULT([$temp_result]) -fi - -if test "x$with_libopenipmipthread" = "xyes" -then - AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS]) - temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`" - if test "$?" = "0" - then - with_libopenipmipthread_ldflags="$temp_result" - else - with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)" - temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed" - fi - AC_MSG_RESULT([$temp_result]) -fi - -if test "x$with_libopenipmipthread" = "xyes" -then - SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags" - - AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h, - [with_libopenipmipthread="yes"], - [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"], -[#include -#include -#include -#include -]) - - CPPFLAGS="$SAVE_CPPFLAGS" -fi - -if test "x$with_libopenipmipthread" = "xyes" -then - BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags" - BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags" - AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS) - AC_SUBST(BUILD_WITH_OPENIPMI_LIBS) -fi -# }}} - -PKG_CHECK_MODULES([LIBNOTIFY], [libnotify], - [with_libnotify="yes"], - [if test "x$LIBNOTIFY_PKG_ERRORS" = "x"; then - with_libnotify="no" - else - with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)" - fi]) - -# Check for enabled/disabled features -# - -# AC_COLLECTD(name, enable/disable, info-text, feature/module) -# ------------------------------------------------------------ -dnl -m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))]) -dnl -AC_DEFUN( - [AC_COLLECTD], - [ - m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl - m4_if( - [$2], - [enable], - [dnl - m4_define([EnDis],[disabled])dnl - m4_define([YesNo],[no])dnl - ],dnl - [m4_if( - [$2], - [disable], - [dnl - m4_define([EnDis],[enabled])dnl - m4_define([YesNo],[yes])dnl - ], - [dnl - AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl - ]dnl - )]dnl - )dnl - m4_if([$3], [feature], [], - [m4_if( - [$3], [module], [], - [dnl - AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl - ]dnl - )]dnl - )dnl - AC_ARG_ENABLE( - [$1], - AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]), - [], - enable_$1='[YesNo]'dnl - )# AC_ARG_ENABLE -if test "x$enable_$1" = "xno" -then - collectd_$1=0 -else - if test "x$enable_$1" = "xyes" - then - collectd_$1=1 - else - AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.]) - collectd_$1=1 - enable_$1='yes' - fi -fi - AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4]) - AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl - ]dnl -)# AC_COLLECTD(name, enable/disable, info-text, feature/module) - -# AC_PLUGIN(name, default, info) -# ------------------------------------------------------------ -dnl -AC_DEFUN( - [AC_PLUGIN], - [ - enable_plugin="no" - force="no" - AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]), - [ - if test "x$enableval" = "xyes" - then - enable_plugin="yes" - else if test "x$enableval" = "xforce" - then - enable_plugin="yes" - force="yes" - else - enable_plugin="no (disabled on command line)" - fi; fi - ], - [ - if test "x$enable_all_plugins" = "xauto" - then - if test "x$2" = "xyes" - then - enable_plugin="yes" - else - enable_plugin="no" - fi - else - enable_plugin="$enable_all_plugins" - fi - ]) - if test "x$enable_plugin" = "xyes" - then - if test "x$2" = "xyes" || test "x$force" = "xyes" - then - AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.]) - if test "x$2" != "xyes" - then - dependency_warning="yes" - fi - else # User passed "yes" but dependency checking yielded "no" => Dependency problem. - dependency_error="yes" - enable_plugin="no (dependency error)" - fi - fi - AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes") - enable_$1="$enable_plugin" - ] -)# AC_PLUGIN(name, default, info) - -m4_divert_once([HELP_ENABLE], [ -collectd features:]) -# FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro. -AC_COLLECTD([debug], [enable], [feature], [debugging]) -AC_COLLECTD([daemon], [disable], [feature], [daemon mode]) -AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux]) - -dependency_warning="no" -dependency_error="no" - -plugin_ascent="no" -plugin_battery="no" -plugin_bind="no" -plugin_conntrack="no" -plugin_contextswitch="no" -plugin_cpu="no" -plugin_cpufreq="no" -plugin_curl_json="no" -plugin_curl_xml="no" -plugin_df="no" -plugin_disk="no" -plugin_entropy="no" -plugin_ethstat="no" -plugin_fscache="no" -plugin_interface="no" -plugin_ipmi="no" -plugin_ipvs="no" -plugin_irq="no" -plugin_libvirt="no" -plugin_load="no" -plugin_memory="no" -plugin_multimeter="no" -plugin_nfs="no" -plugin_numa="no" -plugin_perl="no" -plugin_processes="no" -plugin_protocols="no" -plugin_serial="no" -plugin_swap="no" -plugin_tape="no" -plugin_tcpconns="no" -plugin_ted="no" -plugin_thermal="no" -plugin_users="no" -plugin_uptime="no" -plugin_vmem="no" -plugin_vserver="no" -plugin_wireless="no" -plugin_zfs_arc="no" - -# Linux -if test "x$ac_system" = "xLinux" -then - plugin_battery="yes" - plugin_conntrack="yes" - plugin_contextswitch="yes" - plugin_cpu="yes" - plugin_cpufreq="yes" - plugin_disk="yes" - plugin_entropy="yes" - plugin_fscache="yes" - plugin_interface="yes" - plugin_irq="yes" - plugin_load="yes" - plugin_memory="yes" - plugin_nfs="yes" - plugin_numa="yes" - plugin_processes="yes" - plugin_protocols="yes" - plugin_serial="yes" - plugin_swap="yes" - plugin_tcpconns="yes" - plugin_thermal="yes" - plugin_uptime="yes" - plugin_vmem="yes" - plugin_vserver="yes" - plugin_wireless="yes" - - if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes" - then - plugin_ipvs="yes" - fi -fi - -if test "x$ac_system" = "xOpenBSD" -then - plugin_tcpconns="yes" -fi - -# Mac OS X devices -if test "x$with_libiokit" = "xyes" -then - plugin_battery="yes" - plugin_disk="yes" -fi - -# AIX - -if test "x$ac_system" = "xAIX" -then - plugin_tcpconns="yes" -fi - -if test "x$with_perfstat" = "xyes" -then - plugin_cpu="yes" - plugin_contextswitch="yes" - plugin_disk="yes" - plugin_memory="yes" - plugin_swap="yes" - plugin_interface="yes" - plugin_load="yes" - plugin_uptime="yes" -fi - -if test "x$with_procinfo" = "xyes" -then - plugin_processes="yes" -fi - -# Solaris -if test "x$with_kstat" = "xyes" -then - plugin_nfs="yes" - plugin_uptime="yes" - plugin_zfs_arc="yes" -fi - -if test "x$with_devinfo$with_kstat" = "xyesyes" -then - plugin_cpu="yes" - plugin_disk="yes" - plugin_interface="yes" - plugin_memory="yes" - plugin_tape="yes" -fi - -# libstatgrab -if test "x$with_libstatgrab" = "xyes" -then - plugin_cpu="yes" - plugin_disk="yes" - plugin_interface="yes" - plugin_load="yes" - plugin_memory="yes" - plugin_swap="yes" - plugin_users="yes" -fi - -if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes" -then - plugin_ascent="yes" - if test "x$have_strptime" = "xyes" - then - plugin_bind="yes" - fi -fi - -if test "x$with_libopenipmipthread" = "xyes" -then - plugin_ipmi="yes" -fi - -if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes" -then - plugin_curl_json="yes" -fi - -if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes" -then - plugin_curl_xml="yes" -fi - -if test "x$have_processor_info" = "xyes" -then - plugin_cpu="yes" -fi -if test "x$have_sysctl" = "xyes" -then - plugin_cpu="yes" - plugin_memory="yes" - plugin_uptime="yes" - if test "x$ac_system" = "xDarwin" - then - plugin_swap="yes" - fi -fi -if test "x$have_sysctlbyname" = "xyes" -then - plugin_contextswitch="yes" - plugin_cpu="yes" - plugin_memory="yes" - plugin_tcpconns="yes" -fi - -# Df plugin: Check if we know how to determine mount points first. -#if test "x$have_listmntent" = "xyes"; then -# plugin_df="yes" -#fi -if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes" -then - plugin_df="yes" -fi -if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun" -then - plugin_df="yes" -fi -#if test "x$have_getmntent" = "xseq" -#then -# plugin_df="yes" -#fi -if test "x$c_cv_have_one_getmntent" = "xyes" -then - plugin_df="yes" -fi - -# Df plugin: Check if we have either `statfs' or `statvfs' second. -if test "x$plugin_df" = "xyes" -then - plugin_df="no" - if test "x$have_statfs" = "xyes" - then - plugin_df="yes" - fi - if test "x$have_statvfs" = "xyes" - then - plugin_df="yes" - fi -fi - -if test "x$have_linux_sockios_h$have_linux_ethtool_h" = "xyesyes" -then - plugin_ethstat="yes" -fi - -if test "x$have_getifaddrs" = "xyes" -then - plugin_interface="yes" -fi - -if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes" -then - plugin_libvirt="yes" -fi - -if test "x$have_getloadavg" = "xyes" -then - plugin_load="yes" -fi - -if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes" -then - plugin_perl="yes" -fi - -# Mac OS X memory interface -if test "x$have_host_statistics" = "xyes" -then - plugin_memory="yes" -fi - -if test "x$have_termios_h" = "xyes" -then - plugin_multimeter="yes" - plugin_ted="yes" -fi - -if test "x$have_thread_info" = "xyes" -then - plugin_processes="yes" -fi - -if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes" -then - plugin_processes="yes" -fi - -if test "x$with_kvm_getswapinfo" = "xyes" -then - plugin_swap="yes" -fi - -if test "x$have_swapctl" = "xyes" && test "x$c_cv_have_swapctl_two_args" = "xyes" -then - plugin_swap="yes" -fi - -if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes" -then - plugin_tcpconns="yes" -fi - -if test "x$have_getutent" = "xyes" -then - plugin_users="yes" -fi -if test "x$have_getutxent" = "xyes" -then - plugin_users="yes" -fi - -m4_divert_once([HELP_ENABLE], [ -collectd plugins:]) - -AC_ARG_ENABLE([all-plugins], - AC_HELP_STRING([--enable-all-plugins], - [enable all plugins (auto by def)]), - [ - if test "x$enableval" = "xyes" - then - enable_all_plugins="yes" - else if test "x$enableval" = "xauto" - then - enable_all_plugins="auto" - else - enable_all_plugins="no" - fi; fi - ], - [enable_all_plugins="auto"]) - -m4_divert_once([HELP_ENABLE], []) - -AC_PLUGIN([aggregation], [yes], [Aggregation plugin]) -AC_PLUGIN([amqp], [$with_librabbitmq], [AMQP output plugin]) -AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics]) -AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC]) -AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors]) -AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics]) -AC_PLUGIN([battery], [$plugin_battery], [Battery statistics]) -AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics]) -AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics]) -AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics]) -AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics]) -AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics]) -AC_PLUGIN([csv], [yes], [CSV output plugin]) -AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics]) -AC_PLUGIN([curl_json], [$plugin_curl_json], [CouchDB statistics]) -AC_PLUGIN([curl_xml], [$plugin_curl_xml], [CURL generic xml statistics]) -AC_PLUGIN([dbi], [$with_libdbi], [General database statistics]) -AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics]) -AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics]) -AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis]) -AC_PLUGIN([email], [yes], [EMail statistics]) -AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics]) -AC_PLUGIN([ethstat], [$plugin_ethstat], [Stats from NIC driver]) -AC_PLUGIN([exec], [yes], [Execution of external programs]) -AC_PLUGIN([filecount], [yes], [Count files in directories]) -AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics]) -AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin]) -AC_PLUGIN([hddtemp], [yes], [Query hddtempd]) -AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics]) -AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics]) -AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters]) -AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics]) -AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics]) -AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine]) -AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics]) -AC_PLUGIN([load], [$plugin_load], [System load]) -AC_PLUGIN([logfile], [yes], [File logging plugin]) -AC_PLUGIN([lpar], [$with_perfstat], [AIX logical partitions statistics]) -AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics]) -AC_PLUGIN([match_empty_counter], [yes], [The empty counter match]) -AC_PLUGIN([match_hashed], [yes], [The hashed match]) -AC_PLUGIN([match_regex], [yes], [The regex match]) -AC_PLUGIN([match_timediff], [yes], [The timediff match]) -AC_PLUGIN([match_value], [yes], [The value match]) -AC_PLUGIN([mbmon], [yes], [Query mbmond]) -AC_PLUGIN([md], [$have_linux_raid_md_u_h], [md (Linux software RAID) devices]) -AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics]) -AC_PLUGIN([memcached], [yes], [memcached statistics]) -AC_PLUGIN([memory], [$plugin_memory], [Memory usage]) -AC_PLUGIN([modbus], [$with_libmodbus], [Modbus plugin]) -AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values]) -AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics]) -AC_PLUGIN([netapp], [$with_libnetapp], [NetApp plugin]) -AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics]) -AC_PLUGIN([network], [yes], [Network communication plugin]) -AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics]) -AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics]) -AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications]) -AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier]) -AC_PLUGIN([ntpd], [yes], [NTPd statistics]) -AC_PLUGIN([numa], [$plugin_numa], [NUMA virtual memory statistics]) -AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics]) -AC_PLUGIN([olsrd], [yes], [olsrd statistics]) -AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics]) -AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics]) -AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin]) -AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter]) -AC_PLUGIN([pf], [$have_net_pfvar_h], [BSD packet filter (PF) statistics]) -# FIXME: Check for libevent, too. -AC_PLUGIN([pinba], [$have_protoc_c], [Pinba statistics]) -AC_PLUGIN([ping], [$with_liboping], [Network latency statistics]) -AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics]) -AC_PLUGIN([powerdns], [yes], [PowerDNS statistics]) -AC_PLUGIN([processes], [$plugin_processes], [Process statistics]) -AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics]) -AC_PLUGIN([python], [$with_python], [Embed a Python interpreter]) -AC_PLUGIN([redis], [$with_libcredis], [Redis plugin]) -AC_PLUGIN([routeros], [$with_librouteros], [RouterOS plugin]) -AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin]) -AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin]) -AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics]) -AC_PLUGIN([serial], [$plugin_serial], [serial port traffic]) -AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin]) -AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics]) -AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin]) -AC_PLUGIN([table], [yes], [Parsing of tabular data]) -AC_PLUGIN([tail], [yes], [Parsing of logfiles]) -AC_PLUGIN([tail_csv], [yes], [Parsing of CSV files]) -AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics]) -AC_PLUGIN([target_notification], [yes], [The notification target]) -AC_PLUGIN([target_replace], [yes], [The replace target]) -AC_PLUGIN([target_scale],[yes], [The scale target]) -AC_PLUGIN([target_set], [yes], [The set target]) -AC_PLUGIN([target_v5upgrade], [yes], [The v5upgrade target]) -AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics]) -AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics]) -AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values]) -AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics]) -AC_PLUGIN([threshold], [yes], [Threshold checking plugin]) -AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant], [TokyoTyrant database statistics]) -AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin]) -AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics]) -AC_PLUGIN([users], [$plugin_users], [User statistics]) -AC_PLUGIN([uuid], [yes], [UUID as hostname plugin]) -AC_PLUGIN([varnish], [$with_libvarnish], [Varnish cache statistics]) -AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics]) -AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics]) -AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics]) -AC_PLUGIN([write_graphite], [yes], [Graphite / Carbon output plugin]) -AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin]) -AC_PLUGIN([write_mongodb], [$with_libmongoc], [MongoDB output plugin]) -AC_PLUGIN([write_redis], [$with_libcredis], [Redis output plugin]) -AC_PLUGIN([write_riemann], [$have_protoc_c], [Riemann output plugin]) -AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics]) -AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics]) - -dnl Default configuration file -# Load either syslog or logfile -LOAD_PLUGIN_SYSLOG="" -LOAD_PLUGIN_LOGFILE="" - -AC_MSG_CHECKING([which default log plugin to load]) -default_log_plugin="none" -if test "x$enable_syslog" = "xyes" -then - default_log_plugin="syslog" -else - LOAD_PLUGIN_SYSLOG="##" -fi - -if test "x$enable_logfile" = "xyes" -then - if test "x$default_log_plugin" = "xnone" - then - default_log_plugin="logfile" - else - LOAD_PLUGIN_LOGFILE="#" - fi -else - LOAD_PLUGIN_LOGFILE="##" -fi -AC_MSG_RESULT([$default_log_plugin]) - -AC_SUBST(LOAD_PLUGIN_SYSLOG) -AC_SUBST(LOAD_PLUGIN_LOGFILE) - -DEFAULT_LOG_LEVEL="info" -if test "x$enable_debug" = "xyes" -then - DEFAULT_LOG_LEVEL="debug" -fi -AC_SUBST(DEFAULT_LOG_LEVEL) - -# Load only one of rrdtool, network, csv in the default config. -LOAD_PLUGIN_RRDTOOL="" -LOAD_PLUGIN_NETWORK="" -LOAD_PLUGIN_CSV="" - -AC_MSG_CHECKING([which default write plugin to load]) -default_write_plugin="none" -if test "x$enable_rrdtool" = "xyes" -then - default_write_plugin="rrdtool" -else - LOAD_PLUGIN_RRDTOOL="##" -fi - -if test "x$enable_network" = "xyes" -then - if test "x$default_write_plugin" = "xnone" - then - default_write_plugin="network" - else - LOAD_PLUGIN_NETWORK="#" - fi -else - LOAD_PLUGIN_NETWORK="##" -fi - -if test "x$enable_csv" = "xyes" -then - if test "x$default_write_plugin" = "xnone" - then - default_write_plugin="csv" - else - LOAD_PLUGIN_CSV="#" - fi -else - LOAD_PLUGIN_CSV="##" -fi -AC_MSG_RESULT([$default_write_plugin]) - -AC_SUBST(LOAD_PLUGIN_RRDTOOL) -AC_SUBST(LOAD_PLUGIN_NETWORK) -AC_SUBST(LOAD_PLUGIN_CSV) - -dnl ip_vs.h -if test "x$ac_system" = "xLinux" \ - && test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono" -then - enable_ipvs="$enable_ipvs (ip_vs.h not found)" -fi - -if test "x$ip_vs_h_needs_kernel_cflags" = "xyes" -then - enable_ipvs="$enable_ipvs (needs $KERNEL_CFLAGS)" -fi - -dnl Perl bindings -PERL_BINDINGS_OPTIONS="PREFIX=${prefix}" -AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])], -[ - if test "x$withval" != "xno" && test "x$withval" != "xyes" - then - PERL_BINDINGS_OPTIONS="$withval" - with_perl_bindings="yes" - else - with_perl_bindings="$withval" - fi -], -[ - if test -n "$perl_interpreter" - then - with_perl_bindings="yes" - else - with_perl_bindings="no (no perl interpreter found)" - fi -]) -if test "x$with_perl_bindings" = "xyes" -then - PERL_BINDINGS="perl" -else - PERL_BINDINGS="" -fi -AC_SUBST(PERL_BINDINGS) -AC_SUBST(PERL_BINDINGS_OPTIONS) - -dnl libcollectdclient -LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1` -LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2` -LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3` - -LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-` - -LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH" - -AC_SUBST(LCC_VERSION_MAJOR) -AC_SUBST(LCC_VERSION_MINOR) -AC_SUBST(LCC_VERSION_PATCH) -AC_SUBST(LCC_VERSION_EXTRA) -AC_SUBST(LCC_VERSION_STRING) - -AC_CONFIG_FILES(src/libcollectdclient/collectd/lcc_features.h) - -AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile) - -if test "x$with_librrd" = "xyes" \ - && test "x$librrd_threadsafe" != "xyes" -then - with_librrd="yes (warning: librrd is not thread-safe)" -fi - -if test "x$with_libperl" = "xyes" -then - with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)" -else - enable_perl="no (needs libperl)" -fi - -if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno" -then - enable_perl="no (libperl doesn't support ithreads)" -fi - -if test "x$with_perl_bindings" = "xyes" \ - && test "x$PERL_BINDINGS_OPTIONS" != "x" -then - with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)" -fi - -cat <= 1.4 %define with_rrdcached 0%{!?_without_rrdcached:0} +# plugin sigrok disabled, requires libsigrok +%define with_sigrok 0%{!?_without_sigrok:0} # plugin tape disabled, requires libkstat %define with_tape 0%{!?_without_tape:0} # plugin tokyotyrant disabled, requires tcrdb.h @@ -174,7 +185,7 @@ Summary: Statistics collection daemon for filling RRD files Name: collectd -Version: 5.3.1 +Version: 5.4.0 Release: 1%{?dist} URL: http://collectd.org Source: http://collectd.org/files/%{name}-%{version}.tar.bz2 @@ -217,6 +228,15 @@ BuildRequires: curl-devel This plugin collects data provided by Apache's `mod_status'. %endif +%if %{with_aquaero} +%package aquaero +Summary: aquaero plugin for collectd +Group: System Environment/Daemons +Requires: %{name}%{?_isa} = %{version}-%{release} +%description aquaero +Various sensors in the Aquaero 5 watercooling board made by Aquacomputer. +%endif + %if %{with_ascent} %package ascent Summary: Ascent plugin for collectd @@ -371,6 +391,17 @@ BuildRequires: libvirt-devel This plugin collects information from virtualized guests. %endif +%if %{with_lvm} +%package lvm +Summary: LVM plugin for collectd +Group: System Environment/Daemons +Requires: %{name}%{?_isa} = %{version}-%{release} +BuildRequires: lvm2-devel +%description lvm +This plugin collects size of “Logical Volumes” (LV) and “Volume Groups” (VG) +of Linux' “Logical Volume Manager” (LVM). +%endif + %if %{with_memcachec} %package memcachec Summary: Memcachec plugin for collectd @@ -383,6 +414,16 @@ instance. Note that another plugin, named `memcached', exists and does a similar job, without requiring the installation of libmemcached. %endif +%if %{with_mic} +%package mic +Summary: mic plugin for collectd +Group: System Environment/Daemons +Requires: %{name}%{?_isa} = %{version}-%{release} +%description mic +The mic plugin collects CPU usage, memory usage, temperatures and power +consumption from Intel Many Integrated Core (MIC) CPUs. +%endif + %if %{with_modbus} %package modbus Summary: modbus plugin for collectd @@ -404,6 +445,17 @@ MySQL querying plugin. This plugin provides data of issued commands, called handlers and database traffic. %endif +%if %{with_netlink} +%package netlink +Summary: netlink plugin for collectd +Group: System Environment/Daemons +Requires: %{name}%{?_isa} = %{version}-%{release} +BuildRequires: libmnl-devel +%description netlink +This plugin collects very detailed Linux network interface and routing +statistics. +%endif + %if %{with_nginx} %package nginx Summary: Nginx plugin for collectd @@ -548,6 +600,17 @@ BuildRequires: lm_sensors-devel This plugin for collectd provides querying of sensors supported by lm_sensors. %endif +%if %{with_sigrok} +%package sigrok +Summary: sigrok plugin for collectd +Group: System Environment/Daemons +Requires: %{name}%{?_isa} = %{version}-%{release} +%description sigrok +Uses libsigrok as a backend, allowing any sigrok-supported device to have its +measurements fed to collectd. This includes multimeters, sound level meters, +thermometers, and much more. +%endif + %if %{with_snmp} %package snmp Summary: SNMP plugin for collectd @@ -676,6 +739,12 @@ Development files for libcollectdclient %define _with_apple_sensors --disable-apple_sensors %endif +%if %{with_aquaero} +%define _with_aquaero --enable-aquaero +%else +%define _with_aquaero --disable-aquaero +%endif + %if %{with_ascent} %define _with_ascent --enable-ascent %else @@ -694,6 +763,12 @@ Development files for libcollectdclient %define _with_bind --disable-bind %endif +%if %{with_cgroups} +%define _with_cgroups --enable-cgroups +%else +%define _with_cgroups --disable-cgroups +%endif + %if %{with_conntrack} %define _with_conntrack --enable-conntrack %else @@ -874,6 +949,12 @@ Development files for libcollectdclient %define _with_lpar --disable-lpar %endif +%if %{with_lvm} +%define _with_lvm --enable-lvm +%else +%define _with_lvm --disable-lvm +%endif + %if %{with_madwifi} %define _with_madwifi --enable-madwifi %else @@ -910,6 +991,12 @@ Development files for libcollectdclient %define _with_memory --disable-memory %endif +%if %{with_mic} +%define _with_mic --enable-mic +%else +%define _with_mic --disable-mic +%endif + %if %{with_modbus} %define _with_modbus --enable-modbus %else @@ -1112,12 +1199,24 @@ Development files for libcollectdclient %define _with_serial --disable-serial %endif +%if %{with_sigrok} +%define _with_sigrok --enable-sigrok +%else +%define _with_sigrok --disable-sigrok +%endif + %if %{with_snmp} %define _with_snmp --enable-snmp %else %define _with_snmp --disable-snmp %endif +%if %{with_statsd} +%define _with_statsd --enable-statsd +%else +%define _with_statsd --disable-statsd +%endif + %if %{with_swap} %define _with_swap --enable-swap %else @@ -1299,9 +1398,11 @@ Development files for libcollectdclient %{?_with_apache} \ %{?_with_apcups} \ %{?_with_apple_sensors} \ + %{?_with_aquaero} \ %{?_with_ascent} \ %{?_with_battery} \ %{?_with_bind} \ + %{?_with_cgroups} \ %{?_with_conntrack} \ %{?_with_contextswitch} \ %{?_with_cpu} \ @@ -1329,7 +1430,9 @@ Development files for libcollectdclient %{?_with_java} \ %{?_with_libvirt} \ %{?_with_lpar} \ + %{?_with_lvm} \ %{?_with_memcachec} \ + %{?_with_mic} \ %{?_with_modbus} \ %{?_with_multimeter} \ %{?_with_mysql} \ @@ -1352,6 +1455,7 @@ Development files for libcollectdclient %{?_with_rrdcached} \ %{?_with_rrdtool} \ %{?_with_sensors} \ + %{?_with_sigrok} \ %{?_with_snmp} \ %{?_with_tape} \ %{?_with_tokyotyrant} \ @@ -1379,6 +1483,7 @@ Development files for libcollectdclient %{?_with_processes} \ %{?_with_protocols} \ %{?_with_serial} \ + %{?_with_statsd} \ %{?_with_swap} \ %{?_with_syslog} \ %{?_with_table} \ @@ -1520,6 +1625,9 @@ fi %if %{with_battery} %{_libdir}/%{name}/battery.so %endif +%if %{with_cgroups} +%{_libdir}/%{name}/cgroups.so +%endif %if %{with_conntrack} %{_libdir}/%{name}/conntrack.so %endif @@ -1619,6 +1727,9 @@ fi %if %{with_serial} %{_libdir}/%{name}/serial.so %endif +%if %{with_statsd} +%{_libdir}/%{name}/statsd.so +%endif %if %{with_swap} %{_libdir}/%{name}/swap.so %endif @@ -1696,6 +1807,11 @@ fi %{_libdir}/%{name}/apache.so %endif +%if %{with_aquaero} +%files aquaero +%{_libdir}/%{name}/aquaero.so +%endif + %if %{with_ascent} %files ascent %{_libdir}/%{name}/ascent.so @@ -1769,16 +1885,31 @@ fi %{_libdir}/%{name}/libvirt.so %endif +%if %{with_lvm} +%files lvm +%{_libdir}/%{name}/lvm.so +%endif + %if %{with_memcachec} %files memcachec %{_libdir}/%{name}/memcachec.so %endif +%if %{with_mic} +%files mic +%{_libdir}/%{name}/mic.so +%endif + %if %{with_mysql} %files mysql %{_libdir}/%{name}/mysql.so %endif +%if %{with_netlink} +%files netlink +%{_libdir}/%{name}/netlink.so +%endif + %if %{with_nginx} %files nginx %{_libdir}/%{name}/nginx.so @@ -1851,6 +1982,11 @@ fi %{_libdir}/%{name}/sensors.so %endif +%if %{with_sigrok} +%files sigrok +%{_libdir}/%{name}/sigrok.so +%endif + %if %{with_snmp} %files snmp %{_mandir}/man5/collectd-snmp.5* @@ -1889,6 +2025,12 @@ fi %doc contrib/ %changelog +* Mon Aug 19 2013 Marc Fournier 5.4.0-1 +- New upstream version +- Build netlink plugin by default +- Enable cgroups, lvm and statsd plugins +- Enable (but don't build by default) mic, aquaero and sigrok plugins + * Wed Aug 06 2014 Marc Fournier 5.3.1-2 - Enabled modbus plugin diff --git a/contrib/redhat/init.d-collectd b/contrib/redhat/init.d-collectd index ec55a52a..abdb168f 100644 --- a/contrib/redhat/init.d-collectd +++ b/contrib/redhat/init.d-collectd @@ -18,12 +18,18 @@ prog="collectdmon" service="collectd" CONFIG=/etc/collectd.conf COLLECTD=/usr/sbin/collectd -COLLECTDMONPID=/var/run/collectdmon.pid +COLLECTDMONPIDDIR="/var/run" +COLLECTDMONPID="$COLLECTDMONPIDDIR/collectdmon.pid" if [ -r /etc/sysconfig/$service ]; then . /etc/sysconfig/$service fi +if [[ ! -d $COLLECTDMONPIDDIR ]]; then + mkdir -p $COLLECTDMONPIDDIR + [ -n "${RUNAS}" ] && chown "${RUNAS}:" "$COLLECTDMONPIDDIR" +fi + check_config() { if test ! -r "$CONFIG"; then return 2 @@ -44,7 +50,7 @@ start () { echo $"not starting due to configuration error" failure $"not starting $service due to configuration error" else - daemon $prog -P $COLLECTDMONPID -c $COLLECTD -- -C "$CONFIG" $ARGS + daemon --user "${RUNAS:-root}" $prog -P $COLLECTDMONPID -c $COLLECTD -- -C "$CONFIG" $ARGS RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$service @@ -52,7 +58,7 @@ start () { } stop () { echo -n $"Stopping collectd: " - killproc $prog + killproc -p $COLLECTDMONPID $prog RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$service @@ -66,7 +72,7 @@ case "$1" in stop ;; status) - status $prog + status -p $COLLECTDMONPID $prog ;; restart|reload) check_config @@ -81,7 +87,7 @@ case "$1" in fi ;; condrestart) - [ -f /var/lock/subsys/$prog ] && restart || : + [ -f /var/lock/subsys/$service ] && restart || : ;; *) echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}" diff --git a/src/Makefile.am b/src/Makefile.am index a16e423c..36ce028f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -196,6 +196,16 @@ collectd_LDADD += "-dlopen" apple_sensors.la collectd_DEPENDENCIES += apple_sensors.la endif +if BUILD_PLUGIN_AQUAERO +pkglib_LTLIBRARIES += aquaero.la +aquaero_la_SOURCES = aquaero.c +aquaero_la_LDFLAGS = -module -avoid-version +aquaero_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBAQUAERO5_CFLAGS) +aquaero_la_LIBADD = $(BUILD_WITH_LIBAQUAERO5_LDFLAGS) -laquaero5 +collectd_LDADD += "-dlopen" aquaero.la +collectd_DEPENDENCIES += aquaero.la +endif + if BUILD_PLUGIN_ASCENT pkglib_LTLIBRARIES += ascent.la ascent_la_SOURCES = ascent.c @@ -230,6 +240,14 @@ collectd_LDADD += "-dlopen" bind.la collectd_DEPENDENCIES += bind.la endif +if BUILD_PLUGIN_CGROUPS +pkglib_LTLIBRARIES += cgroups.la +cgroups_la_SOURCES = cgroups.c utils_mount.c utils_mount.h +cgroups_la_LDFLAGS = -module -avoid-version +collectd_LDADD += "-dlopen" cgroups.la +collectd_DEPENDENCIES += cgroups.la +endif + if BUILD_PLUGIN_CONNTRACK pkglib_LTLIBRARIES += conntrack.la conntrack_la_SOURCES = conntrack.c @@ -568,6 +586,15 @@ collectd_DEPENDENCIES += lpar.la lpar_la_LIBADD = -lperfstat endif +if BUILD_PLUGIN_LVM +pkglib_LTLIBRARIES += lvm.la +lvm_la_SOURCES = lvm.c +lvm_la_LDFLAGS = -module -avoid-version +lvm_la_LIBADD = $(BUILD_WITH_LIBLVM2APP_LIBS) +collectd_LDADD += "-dlopen" lvm.la +collectd_DEPENDENCIES += lvm.la +endif + if BUILD_PLUGIN_MADWIFI pkglib_LTLIBRARIES += madwifi.la madwifi_la_SOURCES = madwifi.c madwifi.h @@ -727,8 +754,8 @@ if BUILD_PLUGIN_NETLINK pkglib_LTLIBRARIES += netlink.la netlink_la_SOURCES = netlink.c netlink_la_LDFLAGS = -module -avoid-version -netlink_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBNETLINK_CFLAGS) -netlink_la_LIBADD = $(BUILD_WITH_LIBNETLINK_LIBS) +netlink_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBMNL_CFLAGS) +netlink_la_LIBADD = $(BUILD_WITH_LIBMNL_LIBS) collectd_LDADD += "-dlopen" netlink.la collectd_DEPENDENCIES += netlink.la endif @@ -1035,6 +1062,16 @@ collectd_LDADD += "-dlopen" serial.la collectd_DEPENDENCIES += serial.la endif +if BUILD_PLUGIN_SIGROK +pkglib_LTLIBRARIES += sigrok.la +sigrok_la_SOURCES = sigrok.c +sigrok_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBSIGROK_CFLAGS) +sigrok_la_LDFLAGS = -module -avoid-version $(BUILD_WITH_LIBSIGROK_LDFLAGS) +sigrok_la_LIBADD = -lsigrok +collectd_LDADD += "-dlopen" sigrok.la +collectd_DEPENDENCIES += sigrok.la +endif + if BUILD_PLUGIN_SNMP pkglib_LTLIBRARIES += snmp.la snmp_la_SOURCES = snmp.c @@ -1052,6 +1089,16 @@ collectd_LDADD += "-dlopen" snmp.la collectd_DEPENDENCIES += snmp.la endif +if BUILD_PLUGIN_STATSD +pkglib_LTLIBRARIES += statsd.la +statsd_la_SOURCES = statsd.c \ + utils_latency.h utils_latency.c +statsd_la_LDFLAGS = -module -avoid-version +statsd_la_LIBADD = -lpthread +collectd_LDADD += "-dlopen" statsd.la +collectd_DEPENDENCIES += statsd.la +endif + if BUILD_PLUGIN_SWAP pkglib_LTLIBRARIES += swap.la swap_la_SOURCES = swap.c @@ -1271,6 +1318,16 @@ collectd_LDADD += "-dlopen" uuid.la collectd_DEPENDENCIES += uuid.la endif +if BUILD_PLUGIN_MIC +pkglib_LTLIBRARIES += mic.la +mic_la_SOURCES = mic.c +mic_la_LDFLAGS = -module -avoid-version $(BUILD_WITH_MIC_LIBPATH) +mic_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_MIC_CPPFLAGS) +mic_la_LIBADD = $(BUILD_WITH_MIC_LDADD) +collectd_LDADD += "-dlopen" mic.la +collectd_DEPENDENCIES += mic.la +endif + if BUILD_PLUGIN_VARNISH pkglib_LTLIBRARIES += varnish.la varnish_la_SOURCES = varnish.c @@ -1375,7 +1432,11 @@ pkglib_LTLIBRARIES += zfs_arc.la zfs_arc_la_SOURCES = zfs_arc.c zfs_arc_la_CFLAGS = $(AM_CFLAGS) zfs_arc_la_LDFLAGS = -module -avoid-version +if BUILD_FREEBSD +zfs_arc_la_LIBADD = -lm +else zfs_arc_la_LIBADD = -lkstat +endif collectd_LDADD += "-dlopen" zfs_arc.la collectd_DEPENDENCIES += zfs_arc.la endif diff --git a/src/amqp.c b/src/amqp.c index 861cb5cb..ab920a6a 100644 --- a/src/amqp.c +++ b/src/amqp.c @@ -923,6 +923,7 @@ static int camqp_config_connection (oconfig_item_t *ci, /* {{{ */ /* publish only */ conf->delivery_mode = CAMQP_DM_VOLATILE; conf->store_rates = 0; + conf->graphite_flags = 0; /* publish & graphite only */ conf->prefix = NULL; conf->postfix = NULL; @@ -988,6 +989,12 @@ static int camqp_config_connection (oconfig_item_t *ci, /* {{{ */ } else if ((strcasecmp ("Format", child->key) == 0) && publish) status = camqp_config_set_format (child, conf); + else if ((strcasecmp ("GraphiteSeparateInstances", child->key) == 0) && publish) + status = cf_util_get_flag (child, &conf->graphite_flags, + GRAPHITE_SEPARATE_INSTANCES); + else if ((strcasecmp ("GraphiteAlwaysAppendDS", child->key) == 0) && publish) + status = cf_util_get_flag (child, &conf->graphite_flags, + GRAPHITE_ALWAYS_APPEND_DS); else if ((strcasecmp ("GraphitePrefix", child->key) == 0) && publish) status = cf_util_get_string (child, &conf->prefix); else if ((strcasecmp ("GraphitePostfix", child->key) == 0) && publish) diff --git a/src/aquaero.c b/src/aquaero.c new file mode 100644 index 00000000..5db988e6 --- /dev/null +++ b/src/aquaero.c @@ -0,0 +1,193 @@ +/** + * collectd - src/aquaero.c + * Copyright (C) 2013 Alex Deymo + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; only version 2 of the License is applicable. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: + * Alex Deymo + **/ + +#include "collectd.h" +#include "common.h" +#include "plugin.h" + +#include + +/* + * Private variables + */ +/* Default values for contacting daemon */ +static char *conf_device = NULL; + +static int aquaero_config (oconfig_item_t *ci) +{ + int i; + + for (i = 0; i < ci->children_num; i++) + { + oconfig_item_t *child = ci->children + i; + + if (strcasecmp ("Device", child->key)) + cf_util_get_string (child, &conf_device); + else + { + ERROR ("aquaero plugin: Unknown config option \"%s\".", + child->key); + } + } + + return (0); +} + +static int aquaero_shutdown (void) +{ + libaquaero5_exit(); + return (0); +} /* int aquaero_shutdown */ + +static void aquaero_submit (const char *type, const char *type_instance, + double value) +{ + const char *instance = conf_device?conf_device:"default"; + value_t values[1]; + value_list_t vl = VALUE_LIST_INIT; + + /* Don't report undefined values. */ + if (value == AQ5_FLOAT_UNDEF) + return; + + values[0].gauge = value; + + vl.values = values; + vl.values_len = 1; + + sstrncpy (vl.host, hostname_g, sizeof (vl.host)); + sstrncpy (vl.plugin, "aquaero", sizeof (vl.plugin)); + sstrncpy (vl.plugin_instance, instance, sizeof (vl.plugin_instance)); + sstrncpy (vl.type, type, sizeof (vl.type)); + sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance)); + + plugin_dispatch_values (&vl); +} /* int aquaero_submit */ + +/* aquaero_submit_array submits every value of a given array of values */ +static void aquaero_submit_array (const char *type, + const char *type_instance_prefix, double *value_array, int len) +{ + char type_instance[DATA_MAX_NAME_LEN]; + int i; + + for (i = 0; i < len; i++) + { + if (value_array[i] == AQ5_FLOAT_UNDEF) + continue; + + snprintf (type_instance, sizeof (type_instance), "%s%d", + type_instance_prefix, i + 1); + aquaero_submit (type, type_instance, value_array[i]); + } +} + +static int aquaero_read (void) +{ + aq5_data_t aq_data; + aq5_settings_t aq_sett; + char *err_msg = NULL; + char type_instance[DATA_MAX_NAME_LEN]; + int i; + + if (libaquaero5_poll(conf_device, &aq_data, &err_msg) < 0) + { + char errbuf[1024]; + ERROR ("aquaero plugin: Failed to poll device \"%s\": %s (%s)", + conf_device ? conf_device : "default", err_msg, + sstrerror (errno, errbuf, sizeof (errbuf))); + return (-1); + } + + if (libaquaero5_getsettings(conf_device, &aq_sett, &err_msg) < 0) + { + char errbuf[1024]; + ERROR ("aquaero plugin: Failed to get settings " + "for device \"%s\": %s (%s)", + conf_device ? conf_device : "default", err_msg, + sstrerror (errno, errbuf, sizeof (errbuf))); + return (-1); + } + + /* CPU Temperature sensor */ + aquaero_submit("temperature", "cpu", aq_data.cpu_temp[0]); + + /* Temperature sensors */ + aquaero_submit_array("temperature", "sensor", aq_data.temp, + AQ5_NUM_TEMP); + + /* Virtual temperature sensors */ + aquaero_submit_array("temperature", "virtual", aq_data.vtemp, + AQ5_NUM_VIRT_SENSORS); + + /* Software temperature sensors */ + aquaero_submit_array("temperature", "software", aq_data.stemp, + AQ5_NUM_SOFT_SENSORS); + + /* Other temperature sensors */ + aquaero_submit_array("temperature", "other", aq_data.otemp, + AQ5_NUM_OTHER_SENSORS); + + /* Fans */ + for (i = 0; i < AQ5_NUM_FAN; i++) + { + if ((aq_sett.fan_data_source[i] == NONE) + || (aq_data.fan_vrm_temp[i] != AQ5_FLOAT_UNDEF)) + continue; + + snprintf (type_instance, sizeof (type_instance), + "fan%d", i + 1); + + aquaero_submit ("fanspeed", type_instance, + aq_data.fan_rpm[i]); + aquaero_submit ("percent", type_instance, + aq_data.fan_duty[i]); + aquaero_submit ("voltage", type_instance, + aq_data.fan_voltage[i]); + aquaero_submit ("current", type_instance, + aq_data.fan_current[i]); + + /* Report the voltage reglator module (VRM) temperature with a + * different type instance. */ + snprintf (type_instance, sizeof (type_instance), + "fan%d-vrm", i + 1); + aquaero_submit ("temperature", type_instance, + aq_data.fan_vrm_temp[i]); + } + + /* Flow sensors */ + aquaero_submit_array("flow", "sensor", aq_data.flow, AQ5_NUM_FLOW); + + /* Liquid level */ + aquaero_submit_array("percent", "waterlevel", + aq_data.level, AQ5_NUM_LEVEL); + + return (0); +} + +void module_register (void) +{ + plugin_register_complex_config ("aquaero", aquaero_config); + plugin_register_read ("aquaero", aquaero_read); + plugin_register_shutdown ("aquaero", aquaero_shutdown); +} /* void module_register */ + +/* vim: set sw=8 sts=8 noet : */ diff --git a/src/cgroups.c b/src/cgroups.c new file mode 100644 index 00000000..17b12d04 --- /dev/null +++ b/src/cgroups.c @@ -0,0 +1,256 @@ +/** + * collectd - src/cgroups.c + * Copyright (C) 2011 Michael Stapelberg + * Copyright (C) 2013 Florian Forster + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; only version 2 of the license is applicable. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: + * Michael Stapelberg + * Florian Forster + **/ + +#include "collectd.h" +#include "common.h" +#include "plugin.h" +#include "configfile.h" +#include "utils_mount.h" +#include "utils_ignorelist.h" + +static char const *config_keys[] = +{ + "CGroup", + "IgnoreSelected" +}; +static int config_keys_num = STATIC_ARRAY_SIZE (config_keys); + +static ignorelist_t *il_cgroup = NULL; + +__attribute__ ((nonnull(1))) +__attribute__ ((nonnull(2))) +static void cgroups_submit_one (char const *plugin_instance, + char const *type_instance, value_t value) +{ + value_list_t vl = VALUE_LIST_INIT; + + vl.values = &value; + vl.values_len = 1; + sstrncpy (vl.host, hostname_g, sizeof (vl.host)); + sstrncpy (vl.plugin, "cgroups", sizeof (vl.plugin)); + sstrncpy (vl.plugin_instance, plugin_instance, + sizeof (vl.plugin_instance)); + sstrncpy (vl.type, "cpu", sizeof (vl.type)); + sstrncpy (vl.type_instance, type_instance, + sizeof (vl.type_instance)); + + plugin_dispatch_values (&vl); +} /* void cgroups_submit_one */ + +/* + * This callback reads the user/system CPU time for each cgroup. + */ +static int read_cpuacct_procs (const char *dirname, char const *cgroup_name, + void *user_data) +{ + char abs_path[PATH_MAX]; + struct stat statbuf; + char buf[1024]; + int status; + + FILE *fh; + + if (ignorelist_match (il_cgroup, cgroup_name)) + return (0); + + ssnprintf (abs_path, sizeof (abs_path), "%s/%s", dirname, cgroup_name); + + status = lstat (abs_path, &statbuf); + if (status != 0) + { + ERROR ("cgroups plugin: stat (\"%s\") failed.", + abs_path); + return (-1); + } + + /* We are only interested in directories, so skip everything else. */ + if (!S_ISDIR (statbuf.st_mode)) + return (0); + + ssnprintf (abs_path, sizeof (abs_path), "%s/%s/cpuacct.stat", + dirname, cgroup_name); + fh = fopen (abs_path, "r"); + if (fh == NULL) + { + char errbuf[1024]; + ERROR ("cgroups plugin: fopen (\"%s\") failed: %s", + abs_path, + sstrerror (errno, errbuf, sizeof (errbuf))); + return (-1); + } + + while (fgets (buf, sizeof (buf), fh) != NULL) + { + char *fields[8]; + int numfields = 0; + char *key; + size_t key_len; + value_t value; + + /* Expected format: + * + * user: 12345 + * system: 23456 + * + * Or: + * + * user 12345 + * system 23456 + */ + strstripnewline (buf); + numfields = strsplit (buf, fields, STATIC_ARRAY_SIZE (fields)); + if (numfields != 2) + continue; + + key = fields[0]; + key_len = strlen (key); + if (key_len < 2) + continue; + + /* Strip colon off the first column, if found */ + if (key[key_len - 1] == ':') + key[key_len - 1] = 0; + + status = parse_value (fields[1], &value, DS_TYPE_DERIVE); + if (status != 0) + continue; + + cgroups_submit_one (cgroup_name, key, value); + } + + fclose (fh); + return (0); +} /* int read_cpuacct_procs */ + +/* + * Gets called for every file/folder in /sys/fs/cgroup/cpu,cpuacct (or + * whereever cpuacct is mounted on the system). Calls walk_directory with the + * read_cpuacct_procs callback on every folder it finds, such as "system". + */ +static int read_cpuacct_root (const char *dirname, const char *filename, + void *user_data) +{ + char abs_path[PATH_MAX]; + struct stat statbuf; + int status; + + ssnprintf (abs_path, sizeof (abs_path), "%s/%s", dirname, filename); + + status = lstat (abs_path, &statbuf); + if (status != 0) + { + ERROR ("cgroups plugin: stat (%s) failed.", abs_path); + return (-1); + } + + if (S_ISDIR (statbuf.st_mode)) + { + status = walk_directory (abs_path, read_cpuacct_procs, + /* user_data = */ NULL, + /* include_hidden = */ 0); + return (status); + } + + return (0); +} + +static int cgroups_init (void) +{ + if (il_cgroup == NULL) + il_cgroup = ignorelist_create (1); + + return (0); +} + +static int cgroups_config (const char *key, const char *value) +{ + cgroups_init (); + + if (strcasecmp (key, "CGroup") == 0) + { + if (ignorelist_add (il_cgroup, value)) + return (1); + return (0); + } + else if (strcasecmp (key, "IgnoreSelected") == 0) + { + if (IS_TRUE (value)) + ignorelist_set_invert (il_cgroup, 0); + else + ignorelist_set_invert (il_cgroup, 1); + return (0); + } + + return (-1); +} + +static int cgroups_read (void) +{ + cu_mount_t *mnt_list; + cu_mount_t *mnt_ptr; + _Bool cgroup_found = 0; + + mnt_list = NULL; + if (cu_mount_getlist (&mnt_list) == NULL) + { + ERROR ("cgroups plugin: cu_mount_getlist failed."); + return (-1); + } + + for (mnt_ptr = mnt_list; mnt_ptr != NULL; mnt_ptr = mnt_ptr->next) + { + /* Find the cgroup mountpoint which contains the cpuacct + * controller. */ + if ((strcmp(mnt_ptr->type, "cgroup") != 0) + || !cu_mount_checkoption(mnt_ptr->options, + "cpuacct", /* full = */ 1)) + continue; + + walk_directory (mnt_ptr->dir, read_cpuacct_root, + /* user_data = */ NULL, + /* include_hidden = */ 0); + cgroup_found = 1; + /* It doesn't make sense to check other cpuacct mount-points + * (if any), they contain the same data. */ + break; + } + + cu_mount_freelist (mnt_list); + + if (!cgroup_found) + { + WARNING ("cgroups plugin: Unable to find cgroup " + "mount-point with the \"cpuacct\" option."); + return (-1); + } + + return (0); +} /* int cgroup_read */ + +void module_register (void) +{ + plugin_register_config ("cgroups", cgroups_config, + config_keys, config_keys_num); + plugin_register_init ("cgroups", cgroups_init); + plugin_register_read ("cgroups", cgroups_read); +} /* void module_register */ diff --git a/src/collectd.conf.in b/src/collectd.conf.in index 5af15684..678cfb35 100644 --- a/src/collectd.conf.in +++ b/src/collectd.conf.in @@ -18,6 +18,13 @@ #TypesDB "@prefix@/share/@PACKAGE_NAME@/types.db" #----------------------------------------------------------------------------# +# When enabled, plugins are loaded automatically with the default options # +# when an appropriate block is encountered. # +# Disabled by default. # +#----------------------------------------------------------------------------# +#AutoLoadPlugin false + +#----------------------------------------------------------------------------# # Interval at which to query values. This may be overwritten on a per-plugin # # base by using the 'Interval' option of the LoadPlugin block: # # # @@ -30,6 +37,11 @@ #ReadThreads 5 #WriteThreads 5 +# Limit the size of the write queue. Default is no limit. Setting up a limit is +# recommended for servers handling a high volume of traffic. +#WriteQueueLimitHigh 1000000 +#WriteQueueLimitLow 800000 + ############################################################################## # Logging # #----------------------------------------------------------------------------# @@ -67,11 +79,13 @@ #@BUILD_PLUGIN_APACHE_TRUE@LoadPlugin apache #@BUILD_PLUGIN_APCUPS_TRUE@LoadPlugin apcups #@BUILD_PLUGIN_APPLE_SENSORS_TRUE@LoadPlugin apple_sensors +#@BUILD_PLUGIN_AQUAERO_TRUE@LoadPlugin aquaero #@BUILD_PLUGIN_ASCENT_TRUE@LoadPlugin ascent #@BUILD_PLUGIN_BATTERY_TRUE@LoadPlugin battery #@BUILD_PLUGIN_BIND_TRUE@LoadPlugin bind #@BUILD_PLUGIN_CONNTRACK_TRUE@LoadPlugin conntrack #@BUILD_PLUGIN_CONTEXTSWITCH_TRUE@LoadPlugin contextswitch +#@BUILD_PLUGIN_CGROUPS_TRUE@LoadPlugin cgroups @BUILD_PLUGIN_CPU_TRUE@@BUILD_PLUGIN_CPU_TRUE@LoadPlugin cpu #@BUILD_PLUGIN_CPUFREQ_TRUE@LoadPlugin cpufreq @LOAD_PLUGIN_CSV@LoadPlugin csv @@ -99,6 +113,7 @@ #@BUILD_PLUGIN_LIBVIRT_TRUE@LoadPlugin libvirt @BUILD_PLUGIN_LOAD_TRUE@@BUILD_PLUGIN_LOAD_TRUE@LoadPlugin load #@BUILD_PLUGIN_LPAR_TRUE@LoadPlugin lpar +#@BUILD_PLUGIN_LVM_TRUE@LoadPlugin lvm #@BUILD_PLUGIN_MADWIFI_TRUE@LoadPlugin madwifi #@BUILD_PLUGIN_MBMON_TRUE@LoadPlugin mbmon #@BUILD_PLUGIN_MD_TRUE@LoadPlugin md @@ -140,7 +155,9 @@ @LOAD_PLUGIN_RRDTOOL@LoadPlugin rrdtool #@BUILD_PLUGIN_SENSORS_TRUE@LoadPlugin sensors #@BUILD_PLUGIN_SERIAL_TRUE@LoadPlugin serial +#@BUILD_PLUGIN_SIGROK_TRUE@LoadPlugin sigrok #@BUILD_PLUGIN_SNMP_TRUE@LoadPlugin snmp +#@BUILD_PLUGIN_STATSD_TRUE@LoadPlugin statsd #@BUILD_PLUGIN_SWAP_TRUE@LoadPlugin swap #@BUILD_PLUGIN_TABLE_TRUE@LoadPlugin table #@BUILD_PLUGIN_TAIL_TRUE@LoadPlugin tail @@ -156,6 +173,7 @@ #@BUILD_PLUGIN_USERS_TRUE@LoadPlugin users #@BUILD_PLUGIN_UUID_TRUE@LoadPlugin uuid #@BUILD_PLUGIN_VARNISH_TRUE@LoadPlugin varnish +#@BUILD_PLUGIN_MIC_TRUE@LoadPlugin mic #@BUILD_PLUGIN_VMEM_TRUE@LoadPlugin vmem #@BUILD_PLUGIN_VSERVER_TRUE@LoadPlugin vserver #@BUILD_PLUGIN_WIRELESS_TRUE@LoadPlugin wireless @@ -223,6 +241,10 @@ # ReportSeconds true # +# +# Device "" +# + # # URL "http://localhost/ascent/status/" # User "www-user" @@ -250,6 +272,11 @@ # # +# +# CGroup "libvirt" +# IgnoreSelected false +# + # # DataDir "@localstatedir@/lib/@PACKAGE_NAME@/csv" # StoreRates false @@ -351,6 +378,8 @@ # ReportByDevice false # ReportReserved false # ReportInodes false +# ValuesAbsolute true +# ValuesPercentage false # # @@ -875,6 +904,19 @@ # IgnoreSelected false # +# +# LogLevel 3 +# +# Driver "fluke-dmm" +# MinimumInterval 10 +# Conn "/dev/ttyUSB2" +# +# +# Driver "cem-dt-885x" +# Conn "/dev/ttyUSB1" +# +# + # # # Type "voltage" @@ -917,6 +959,16 @@ # # +# +# Host "::" +# Port "8125" +# DeleteCounters false +# DeleteTimers false +# DeleteGauges false +# DeleteSets false +# TimerPercentile 90.0 +# + # # ReportByDevice false # ReportBytes true @@ -1026,6 +1078,24 @@ # UUIDFile "/etc/uuid" # +# +# ShowCPU true +# ShowCPUCores true +# ShowMemory true +# ShowTemperatures true +## Temperature Sensors can be ignored/shown by repeated #Temperature lines, and +## then inverted with a IgnoreSelectedTemperature. +## Known Temperature sensors: die, devmem, fin, fout, vccp, vddg, vddq +# Temperature vddg +# IgnoreSelectedTemperature true +# ShowPower true +## Power Sensors can be ignored/shown by repeated #Power lines, and +## then inverted with a IgnoreSelectedTemperature. +## Known Temperature sensors: total0, total1, inst, imax, pci3, c2x3, c2x4, vccp, vddg, vddq +# Power total1 +# IgnoreSelectedPower true +# + # # This tag support an argument if you want to # monitor the local instance just use @@ -1034,15 +1104,23 @@ # # CollectCache true # CollectBackend true +# CollectBan false # Varnish 3 only # CollectConnections true +# CollectDirectorDNS false # Varnish 3 only # CollectSHM true # CollectESI false # CollectFetch false # CollectHCB false -# CollectSMA false +# CollectObjects false +# CollectPurge false # Varnish 2 only +# CollectSession false +# CollectSMA false # Varnish 2 only # CollectSMS false -# CollectSM false +# CollectSM false # Varnish 2 only +# CollectStruct false # CollectTotals false +# CollectUptime false +# CollectVCL false # CollectWorkers false # # @@ -1055,6 +1133,8 @@ # # Host "localhost" # Port "2003" +# Protocol "tcp" +# LogSendErrors true # Prefix "collectd" # Postfix "collectd" # StoreRates true @@ -1102,6 +1182,7 @@ # Protocol UDP # StoreRates true # AlwaysAppendDS false +# TTLFactor 2.0 # # Tag "foobar" # diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index 69e50056..81c8f4c6 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -70,17 +70,33 @@ directory for the daemon. =item B I -Loads the plugin I. There must be at least one such line or B -will be mostly useless. +Loads the plugin I. This is required to load plugins, unless the +B option is enabled (see below). Without any loaded plugins, +I will be mostly useless. -Starting with collectd 4.9, this may also be a block in which further options -affecting the behavior of B may be specified. The following -options are allowed inside a B block: +Only the first B statement or block for a given plugin name has any +effect. This is useful when you want to split up the configuration into smaller +files and want each file to be "self contained", i.e. it contains a B +block I then appropriate B statement. The downside is that if +you have multiple conflicting B blocks, e.g. when they specify +different intervals, only one of them (the first one encountered) will take +effect and all others will be silently ignored. - - Globals true - Interval 10 - +B may either be a simple configuration I or a I +with additional options, affecting the behavior of B. A simple +statement looks like this: + + LoadPlugin "cpu" + +Options inside a B block can override default settings and +influence the way plugins are loaded, e.g.: + + + Globals true + Interval 60 + + +The following options are valid inside B blocks: =over 4 @@ -111,7 +127,20 @@ interval, that setting will take precedence. =back -=item B I +=item B B|B + +When set to B (the default), each plugin needs to be loaded explicitly, +using the B statement documented above. If a +BPluginE...E> block is encountered and no configuration +handling callback for this plugin has been registered, a warning is logged and +the block is ignored. + +When set to B, explicit B statements are not required. Each +BPluginE...E> block acts as if it was immediately preceded by a +B statement. B statements are still required for +plugins that don't provide any configuration, e.g. the I. + +=item B I [I] If I points to a file, includes that file. If I points to a directory, recursively includes all files within that directory and its @@ -206,6 +235,36 @@ Number of threads to start for dispatching value lists to write plugins. The default value is B<5>, but you may want to increase this if you have more than five plugins that may take relatively long to write to. +=item B I + +=item B I + +Metrics are read by the I and then put into a queue to be handled +by the I. If one of the I is slow (e.g. network +timeouts, I/O saturation of the disk) this queue will grow. In order to avoid +running into memory issues in such a case, you can limit the size of this +queue. + +By default, there is no limit and memory may grow indefinitely. This is most +likely not an issue for clients, i.e. instances that only handle the local +metrics. For servers it is recommended to set this to a non-zero value, though. + +You can set the limits using B and B. +Each of them takes a numerical argument which is the number of metrics in the +queue. If there are I metrics in the queue, any new metrics I be +dropped. If there are less than I metrics in the queue, all new metrics +I be enqueued. If the number of metrics currently in the queue is between +I and I, the metric is dropped with a probability that is +proportional to the number of metrics in the queue (i.e. it increases linearly +until it reaches 100%.) + +If B is set to non-zero and B is +unset, the latter will default to half of B. + +If you do not want to randomly drop values when the queue size is between +I and I, set If B and +B to same value. + =item B I Sets the hostname that identifies a host. If you omit this setting, the @@ -686,6 +745,29 @@ default for backwards compatibility, the time will be reported in minutes. =back +=head2 Plugin C + +This plugin collects the value of the available sensors in an +I5> board. AquaeroE5 is a water-cooling controller board, +manufactured by Aqua Computer GmbH L, with a USB2 +connection for monitoring and configuration. The board can handle multiple +temperature sensors, fans, water pumps and water level sensors and adjust the +output settings such as fan voltage or power used by the water pump based on +the available inputs using a configurable controller included in the board. +This plugin collects all the available inputs as well as some of the output +values chosen by this controller. The plugin is based on the I +library provided by I. + +=over 4 + +=item B I + +Device path of the AquaeroE5's USB HID (human interface device), usually +in the form C. If this option is no set the plugin will try +to auto-detect the Aquaero 5 USB device based on vendor-ID and product-ID. + +=back + =head2 Plugin C This plugin collects information about an Ascent server, a free server for the @@ -883,6 +965,29 @@ By default no detailed zone information is collected. =back +=head2 Plugin C + +This plugin collects the CPU user/system time for each I by reading the +F files in the first cpuacct-mountpoint (typically +F on machines using systemd). + +=over 4 + +=item B I + +Select I based on the name. Whether only matching I are +collected or if they are ignored is controlled by the B option; +see below. + +=item B B|B + +Invert the selection: If set to true, all cgroups I the ones that +match any one of the criteria are collected. By default only selected +cgroups are collected if a selection is made. If no selection is configured +at all, B cgroups are selected. + +=back + =head2 Plugin C This plugin doesn't have any options. It reads @@ -1005,13 +1110,15 @@ is set to B, B blocks are optional. =head2 Plugin C -The B uses B (L) and -B (L) to retrieve JSON data -via cURL. This can be used to collect values from CouchDB documents (which are -stored JSON notation), for example. +The B collects values from JSON data to be parsed by +B (L) retrieved via +either B (L) or read directly from a +unix socket. The former can be used, for example, to collect values +from CouchDB documents (which are stored JSON notation), and the +latter to collect values from a uWSGI stats socket. -The following example will collect several values from the built-in `_stats' -runtime statistics module of CouchDB +The following example will collect several values from the built-in +C<_stats> runtime statistics module of I (L). @@ -1031,11 +1138,30 @@ runtime statistics module of CouchDB -In the B block, there may be one or more B blocks, each defining -a URL to be fetched via HTTP (using libcurl) and one or more B blocks. -The B string argument must be in a path format, which is used to collect a -value from a JSON map object. If a path element of B is the -I<*>Ewildcard, the values for all keys will be collectd. +This example will collect data directly from a I "Stats Server" socket. + + + + Instance "uwsgi" + + Type "http_requests" + + + + Type "http_requests" + + + + +In the B block, there may be one or more B blocks, each +defining a URL to be fetched via HTTP (using libcurl) or B +blocks defining a unix socket to read JSON from directly. Each of +these blocks may have one or more B blocks. + +The B string argument must be in a path format. Each component is +used to match the key from a JSON map or the index of an JSON +array. If a path component of a B is a I<*>Ewildcard, the +values for all map keys or array indices will be collectd. The following options are valid within B blocks: @@ -1490,6 +1616,20 @@ Enable this option if inodes are a scarce resource for you, usually because many small files are stored on the disk. This is a usual scenario for mail transfer agents and web caches. +=item B B|B + +Enables or disables reporting of free, used and used disk space in 1K-blocks. +Defaults to true. + +=item B B|B + +Enables or disables reporting of free, used and used disk space in percentage. +Defaults to false. + +This is useful for deploying collectd on the cloud, where machines with +different disk size may exist. Then it is more practical to configure thresholds +based on relative disk size. + =back =head2 Plugin C @@ -2238,7 +2378,7 @@ interpreted. For a description of match blocks, please see L<"Plugin tail">. =head2 Plugin C -The C connects to a memcached server and queries statistics +The B connects to a memcached server and queries statistics about cache utilization, memory and bandwidth used. L @@ -2270,6 +2410,166 @@ setting is given, the B and B settings are ignored. =back +=head2 Plugin C + +The B gathers CPU statistics, memory usage and temperatures from +Intel's Many Integrated Core (MIC) systems. + +B + + + ShowCPU true + ShowCPUCores true + ShowMemory true + + ShowTemperatures true + Temperature vddg + Temperature vddq + IgnoreSelectedTemperature true + + ShowPower true + Power total0 + Power total1 + IgnoreSelectedPower true + + +The following options are valid inside the Bmic> block: + +=over 4 + +=item B B|B + +If enabled (the default) a sum of the CPU usage accross all cores is reported. + +=item B B|B + +If enabled (the default) per-core CPU usage is reported. + +=item B B|B + +If enabled (the default) the physical memory usage of the MIC system is +reported. + +=item B B|B + +If enabled (the default) various temperatures of the MIC system are reported. + +=item B I + +This option controls which temperatures are being reported. Whether matching +temperatures are being ignored or I matching temperatures are reported +depends on the B setting below. By default I +temperatures are reported. + +=item B B|B + +Controls the behavior of the B setting above. If set to B +(the default) only temperatures matching a B option are reported +or, if no B option is specified, all temperatures are reported. If +set to B, matching temperatures are I and all other temperatures +are reported. + +Known temperature names are: + +=over 4 + +=item die + +Die of the CPU + +=item devmem + +Device Memory + +=item fin + +Fan In + +=item fout + +Fan Out + +=item vccp + +Voltage ccp + +=item vddg + +Voltage ddg + +=item vddq + +Voltage ddq + +=back + +=item B B|B + +If enabled (the default) various temperatures of the MIC system are reported. + +=item B I + +This option controls which power readings are being reported. Whether matching +power readings are being ignored or I matching power readings are reported +depends on the B setting below. By default I +power readings are reported. + +=item B B|B + +Controls the behavior of the B setting above. If set to B +(the default) only power readings matching a B option are reported +or, if no B option is specified, all power readings are reported. If +set to B, matching power readings are I and all other power readings +are reported. + +Known power names are: + +=over 4 + +=item total0 + +Total power utilization averaged over Time Window 0 (uWatts). + +=item total1 + +Total power utilization averaged over Time Window 0 (uWatts). + +=item inst + +Instantaneous power (uWatts). + +=item imax + +Max instantaneous power (uWatts). + +=item pcie + +PCI-E connector power (uWatts). + +=item c2x3 + +2x3 connector power (uWatts). + +=item c2x4 + +2x4 connector power (uWatts). + +=item vccp + +Core rail (uVolts). + +=item vddg + +Uncore rail (uVolts). + +=item vddq + +Memory subsystem rail (uVolts). + +=back + +=back + =head2 Plugin C The B connects to a Modbus "slave" via Modbus/TCP and reads @@ -2277,7 +2577,7 @@ register values. It supports reading single registers (unsigned 16Ebit values), large integer values (unsigned 32Ebit values) and floating point values (two registers interpreted as IEEE floats in big endian notation). -Synopsis: +B RegisterBase 0 @@ -4907,12 +5207,129 @@ and all other sensors are collected. =back +=head2 Plugin C + +The I uses I to retrieve measurements from any device +supported by the L project. + +B + + + LogLevel 3 + + Driver "fluke-dmm" + MinimumInterval 10 + Conn "/dev/ttyUSB2" + + + Driver "cem-dt-885x" + Conn "/dev/ttyUSB1" + + + +=over 4 + +=item B B<0-5> + +The I logging level to pass on to the I log, as a number +between B<0> and B<5> (inclusive). These levels correspond to C, +C, C, C, Cand C, respectively. +The default is B<2> (C). The I log messages, regardless of +their level, are always submitted to I at its INFO log level. + +=item EB IE + +A sigrok-supported device, uniquely identified by this section's options. The +I is passed to I as the I. + +=item B I + +The sigrok driver to use for this device. + +=item B I + +If the device cannot be auto-discovered, or more than one might be discovered +by the driver, I specifies the connection string to the device. +It can be of the form of a device path (e.g.EC), or, in +case of a non-serial USB-connected device, the USB IB<.>I +separated by a period (e.g.EC<0403.6001>). A USB device can also be +specified as IB<.>I
(e.g.EC<1.41>). + +=item B I + +For serial devices with non-standard port settings, this option can be used +to specify them in a form understood by I, e.g.EC<9600/8n1>. +This should not be necessary; drivers know how to communicate with devices they +support. + +=item B I + +Specifies the minimum time between measurement dispatches to I, in +seconds. Since some I supported devices can acquire measurements many +times per second, it may be necessary to throttle these. For example, the +I cannot process writes more than once per second. + +The default B is B<0>, meaning measurements received from the +device are always dispatched to I. When throttled, unused +measurements are discarded. + +=back + =head2 Plugin C Since the configuration of the C is a little more complicated than other plugins, its documentation has been moved to an own manpage, L. Please see there for details. +=head2 Plugin C + +The I listens to a UDP socket, reads "events" in the statsd +protocol and dispatches rates or other aggregates of these numbers +periodically. + +The plugin implements the I, I, I and I types which +are dispatched as the I types C, C, C and +C respectively. + +The following configuration options are valid: + +=over 4 + +=item B I + +Bind to the hostname / address I. By default, the plugin will bind to the +"any" address, i.e. accept packets sent to any of the hosts addresses. + +=item B I + +UDP port to listen to. This can be either a service name or a port number. +Defaults to C<8125>. + +=item B B|B + +=item B B|B + +=item B B|B + +=item B B|B + +These options control what happens if metrics are not updated in an interval. +If set to B, the default, metrics are dispatched unchanged, i.e. the +rate of counters and size of sets will be zero, timers report C and gauges +are unchanged. If set to B, the such metrics are not dispatched and +removed from the internal cache. + +=item B I + +Calculate and dispatch the configured percentile, i.e. compute the latency, so +that I of all reported timers are smaller than or equal to the +computed latency. This is useful for cutting off the long tail latency, as it's +often done in I (SLAs). + +If not specified, no percentile is calculated / dispatched. + +=back + =head2 Plugin C The I collects information about used and available swap space. On @@ -5554,6 +5971,17 @@ and closed connections. True by default. Statistics about the shared memory log, a memory region to store log messages which is flushed to disk when full. True by default. +=item B B|B + +Statistics about ban operations, such as number of bans added, retired, and +number of objects tested against ban operations. Only available with Varnish +3.x. False by default. + +=item B B|B + +DNS director lookup cache statistics. Only available with Varnish 3.x. False by +default. + =item B B|B Edge Side Includes (ESI) parse statistics. False by default. @@ -5567,10 +5995,27 @@ Statistics about fetches (HTTP requests sent to the backend). False by default. Inserts and look-ups in the crit bit tree based hash. Look-ups are divided into locked and unlocked look-ups. False by default. +=item B B|B + +Statistics on cached objects: number of objects expired, nuked (prematurely +expired), saved, moved, etc. False by default. + +=item B B|B + +Statistics about purge operations, such as number of purges added, retired, and +number of objects tested against purge operations. Only available with Varnish +2.x. False by default. + +=item B B|B + +Client session statistics. Number of past and current sessions, session herd and +linger counters, etc. False by default. + =item B B|B -malloc or umem (umem_alloc(3MALLOC) based) storage statistics. -The umem storage component is Solaris specific. False by default. +malloc or umem (umem_alloc(3MALLOC) based) storage statistics. The umem storage +component is Solaris specific. Only available with Varnish 2.x. False by +default. =item B B|B @@ -5579,13 +6024,28 @@ component is used internally only. False by default. =item B B|B -file (memory mapped file) storage statistics. False by default. +file (memory mapped file) storage statistics. Only available with Varnish 2.x. +False by default. + +=item B B|B + +Current varnish internal state statistics. Number of current sessions, objects +in cache store, open connections to backends (with Varnish 2.x), etc. False by +default. =item B B|B Collects overview counters, such as the number of sessions created, the number of requests and bytes transferred. False by default. +=item B B|B + +Varnish uptime. False by default. + +=item B B|B + +Number of total (available + discarded) VCL (config files). False by default. + =item B B|B Collect statistics about worker threads. False by default. @@ -5630,9 +6090,9 @@ iptables to feed data for the guest IPs into the iptables plugin. The C plugin writes data to I, an open-source metrics storage and graphing project. The plugin connects to I, the data layer -of I, and sends data via the "line based" protocol (per default using -portE2003). The data will be sent in blocks of at most 1428 bytes to -minimize the number of network packets. +of I, via I or I and sends data via the "line based" +protocol (per default using portE2003). The data will be sent in blocks +of at most 1428 bytes to minimize the number of network packets. Synopsis: @@ -5640,6 +6100,8 @@ Synopsis: Host "localhost" Port "2003" + Protocol "tcp" + LogSendErrors true Prefix "collectd" @@ -5657,6 +6119,17 @@ Hostname or address to connect to. Defaults to C. Service name or port number to connect to. Defaults to C<2003>. +=item B I + +Protocol to use when connecting to I. Defaults to C. + +=item B B|B + +If set to B (the default), logs errors when sending data to I. +If set to B, it will not log the errors. This is especially useful when +using Protocol UDP since many times we want to use the "fire-and-forget" +approach and logging errors fills syslog with unneeded messages. + =item B I When set, I is added in front of the host name. Dots and whitespace are @@ -5827,7 +6300,7 @@ Synopsis: Protocol UDP StoreRates true AlwaysAppendDS false - Delay 10 + TTLFactor 2.0 Tag "foobar" @@ -5874,6 +6347,15 @@ If set the B, append the name of the I (DS) to the identifies a metric in I. If set to B (the default), this is only done when there is more than one DS. +=item B I + +I events have a I