1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, 3.11.2)
3 AC_CONFIG_SRCDIR(src/collectd.c)
4 AC_CONFIG_HEADERS(src/config.h)
5 AM_INIT_AUTOMAKE(dist-bzip2)
8 AC_PREFIX_DEFAULT("/opt/collectd")
11 # Checks for programs.
18 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
22 AC_LIBLTDL_CONVENIENCE
29 AC_CONFIG_SUBDIRS(libltdl)
32 # Checks for header files.
37 AC_CHECK_HEADERS(stdint.h)
38 AC_CHECK_HEADERS(stdio.h)
39 AC_CHECK_HEADERS(errno.h)
40 AC_CHECK_HEADERS(math.h)
41 AC_CHECK_HEADERS(syslog.h)
42 AC_CHECK_HEADERS(fcntl.h)
43 AC_CHECK_HEADERS(signal.h)
44 AC_CHECK_HEADERS(assert.h)
45 AC_CHECK_HEADERS(sys/types.h)
46 AC_CHECK_HEADERS(sys/socket.h)
47 AC_CHECK_HEADERS(sys/select.h)
48 AC_CHECK_HEADERS(poll.h)
49 AC_CHECK_HEADERS(netdb.h)
50 AC_CHECK_HEADERS(arpa/inet.h)
51 AC_CHECK_HEADERS(sys/resource.h)
52 AC_CHECK_HEADERS(sys/param.h)
55 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
60 # include <sys/types.h>
63 AC_CHECK_HEADERS(netinet/in.h, [], [],
68 # include <sys/types.h>
70 #if HAVE_NETINET_IN_SYSTM_H
71 # include <netinet/in_systm.h>
74 AC_CHECK_HEADERS(netinet/ip.h, [], [],
79 # include <sys/types.h>
81 #if HAVE_NETINET_IN_SYSTM_H
82 # include <netinet/in_systm.h>
85 # include <netinet/in.h>
88 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
93 # include <sys/types.h>
95 #if HAVE_NETINET_IN_SYSTM_H
96 # include <netinet/in_systm.h>
99 # include <netinet/in.h>
101 #if HAVE_NETINET_IP_H
102 # include <netinet/ip.h>
105 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
110 # include <sys/types.h>
112 #if HAVE_NETINET_IN_SYSTM_H
113 # include <netinet/in_systm.h>
115 #if HAVE_NETINET_IN_H
116 # include <netinet/in.h>
118 #if HAVE_NETINET_IP_H
119 # include <netinet/ip.h>
122 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
127 # include <sys/types.h>
129 #if HAVE_NETINET_IN_SYSTM_H
130 # include <netinet/in_systm.h>
132 #if HAVE_NETINET_IN_H
133 # include <netinet/in.h>
136 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
141 # include <sys/types.h>
143 #if HAVE_NETINET_IN_SYSTM_H
144 # include <netinet/in_systm.h>
146 #if HAVE_NETINET_IN_H
147 # include <netinet/in.h>
149 #if HAVE_NETINET_IP6_H
150 # include <netinet/ip6.h>
153 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
158 # include <sys/types.h>
160 #if HAVE_NETINET_IN_SYSTM_H
161 # include <netinet/in_systm.h>
163 #if HAVE_NETINET_IN_H
164 # include <netinet/in.h>
166 #if HAVE_NETINET_IP_H
167 # include <netinet/ip.h>
170 AC_CHECK_HEADERS(netinet/udp.h, [], [],
175 # include <sys/types.h>
177 #if HAVE_NETINET_IN_SYSTM_H
178 # include <netinet/in_systm.h>
180 #if HAVE_NETINET_IN_H
181 # include <netinet/in.h>
183 #if HAVE_NETINET_IP_H
184 # include <netinet/ip.h>
189 AC_CHECK_HEADERS(sys/sysctl.h sys/dkstat.h)
190 AC_CHECK_HEADERS(mach/mach_init.h)
191 AC_CHECK_HEADERS(mach/host_priv.h)
192 AC_CHECK_HEADERS(mach/mach_error.h)
193 AC_CHECK_HEADERS(mach/mach_host.h)
194 AC_CHECK_HEADERS(mach/mach_port.h)
195 AC_CHECK_HEADERS(mach/mach_types.h)
196 AC_CHECK_HEADERS(mach/message.h)
197 AC_CHECK_HEADERS(mach/processor_set.h)
198 AC_CHECK_HEADERS(mach/processor.h)
199 AC_CHECK_HEADERS(mach/processor_info.h)
200 AC_CHECK_HEADERS(mach/task.h)
201 AC_CHECK_HEADERS(mach/thread_act.h)
202 AC_CHECK_HEADERS(mach/vm_region.h)
203 AC_CHECK_HEADERS(mach/vm_map.h)
204 AC_CHECK_HEADERS(mach/vm_prot.h)
205 AC_CHECK_HEADERS(mach/vm_statistics.h)
206 AC_CHECK_HEADERS(mach/kern_return.h)
209 AC_CHECK_HEADERS(linux/major.h)
211 # For the apple_sensors module
212 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h)
213 AC_CHECK_HEADERS(IOKit/IOKitLib.h)
214 AC_CHECK_HEADERS(IOKit/IOTypes.h)
216 # For the battery plugin
217 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
219 #if HAVE_IOKIT_IOKITLIB_H
220 # include <IOKit/IOKitLib.h>
222 #if HAVE_IOKIT_IOTYPES_H
223 # include <IOKit/IOTypes.h>
226 AC_CHECK_HEADERS(IOKit/ps/IOPSKeys.h)
228 # For the `disk' plugin
229 AC_CHECK_HEADERS(IOKit/IOBSD.h)
230 AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDriver.h)
233 AC_CHECK_HEADERS(sys/loadavg.h)
235 # For the processes plugin
236 AC_CHECK_HEADERS(linux/config.h)
238 # For the swap module
239 AC_CHECK_HEADERS(sys/swap.h)
242 AC_CHECK_HEADERS(utmp.h)
243 AC_CHECK_HEADERS(utmpx.h)
245 # For interface plugin
246 AC_CHECK_HEADERS(ifaddrs.h)
247 AC_CHECK_HEADERS(net/if.h, [], [],
250 # include <sys/types.h>
252 #if HAVE_SYS_SOCKET_H
253 # include <sys/socket.h>
256 AC_CHECK_HEADERS(linux/if.h, [], [],
259 # include <sys/types.h>
261 #if HAVE_SYS_SOCKET_H
262 # include <sys/socket.h>
265 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
268 # include <sys/types.h>
270 #if HAVE_SYS_SOCKET_H
271 # include <sys/socket.h>
274 # include <linux/if.h>
279 AC_CHECK_HEADERS(curl/curl.h)
282 AC_CHECK_HEADERS(grp.h pwd.h sys/ucred.h)
283 AC_CHECK_HEADERS(ctype.h)
284 AC_CHECK_HEADERS(limits.h)
285 AC_CHECK_HEADERS(sys/quota.h)
286 AC_CHECK_HEADERS(xfs/xqm.h)
288 # For mount interface
289 AC_CHECK_HEADERS(fs_info.h)
290 AC_CHECK_HEADERS(fshelp.h)
291 AC_CHECK_HEADERS(paths.h)
292 AC_CHECK_HEADERS(mntent.h)
293 AC_CHECK_HEADERS(mnttab.h)
294 AC_CHECK_HEADERS(sys/fstyp.h)
295 AC_CHECK_HEADERS(sys/fs_types.h)
296 AC_CHECK_HEADERS(sys/mntent.h)
297 AC_CHECK_HEADERS(sys/mnttab.h)
298 AC_CHECK_HEADERS(sys/mount.h)
299 AC_CHECK_HEADERS(sys/statfs.h)
300 AC_CHECK_HEADERS(sys/statvfs.h)
301 AC_CHECK_HEADERS(sys/vfs.h)
302 AC_CHECK_HEADERS(sys/vfstab.h)
304 # For the swap plugin, FreeBSD
305 AC_CHECK_HEADERS(kvm.h)
307 # For the email plugin
308 AC_CHECK_HEADERS(linux/un.h, [], [],
310 #if HAVE_SYS_SOCKET_H
311 # include <sys/socket.h>
314 AC_CHECK_HEADERS(sys/un.h)
315 AC_CHECK_HEADERS(grp.h)
317 # For debugging interface (variable number of arguments)
318 AC_CHECK_HEADERS(stdarg.h)
320 # Regular expressions for the ignorelist.
321 AC_CHECK_HEADERS(regex.h)
324 AC_CHECK_HEADERS(arpa/nameser.h arpa/nameser_compat.h)
326 AC_CHECK_HEADERS(net/if_arp.h)
327 AC_CHECK_HEADERS(net/if_ppp.h)
328 AC_CHECK_HEADERS(netinet/if_ether.h)
330 # For the multimeter plugin
331 AC_CHECK_HEADERS(termios.h)
332 AC_CHECK_HEADERS(sys/ioctl.h)
335 # Checking for libraries
340 # Checks for typedefs, structures, and compiler characteristics.
349 # Checks for library functions.
351 AC_PROG_GCC_TRADITIONAL
352 AC_CHECK_FUNCS(gettimeofday select strdup strtol)
353 AC_CHECK_FUNCS(getaddrinfo getnameinfo)
354 AC_CHECK_FUNCS(strchr memcpy strstr strcmp strncmp strncpy strlen)
355 AC_CHECK_FUNCS(strncasecmp strcasecmp)
356 AC_CHECK_FUNCS(openlog syslog closelog)
358 socket_needs_socket="no"
359 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
360 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
362 nanosleep_needs_rt="no"
363 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
364 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
366 # Regular expressions for the ignorelist.
367 AC_CHECK_FUNCS(regcomp regerror regexec regfree)
370 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
373 AC_CHECK_FUNCS(statfs statvfs)
376 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
378 # For the `processes' plugin
379 AC_CHECK_FUNCS(thread_info)
382 AC_CHECK_FUNCS(getutent getutxent)
385 AC_CHECK_FUNCS(quotactl)
386 AC_CHECK_FUNCS(getgrgid getpwuid)
388 # For interface module
389 AC_CHECK_FUNCS(getifaddrs)
393 if test "x$nan_type" = "xnone"; then
394 AC_CACHE_CHECK([whether NAN is defined by default],
401 static float foo = NAN;
409 [have_nan_default="yes"],
410 [have_nan_default="no"]
413 if test "x$have_nan_default" = "xyes"
416 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
417 [Define if NAN is defined by default and can initialize static variables.])
420 if test "x$nan_type" = "xnone"; then
421 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
427 #define __USE_ISOC99 1
429 static float foo = NAN;
437 [have_nan_isoc="yes"],
441 if test "x$have_nan_isoc" = "xyes"
444 AC_DEFINE(NAN_STATIC_ISOC, 1,
445 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
448 if test "x$nan_type" = "xnone"; then
449 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
456 #define NAN (0.0 / 0.0)
458 # define isnan(f) ((f) != (f))
460 static float foo = NAN;
468 [have_nan_zero="yes"],
472 if test "x$have_nan_zero" = "xyes"
475 AC_DEFINE(NAN_ZERO_ZERO, 1,
476 [Define if NAN can be defined as (0.0 / 0.0)])
479 if test "x$nan_type" = "xnone"; then
480 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
483 # For mount interface
484 #AC_CHECK_FUNCS(getfsent getvfsent)
487 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
489 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
491 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
494 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
495 if test "x$have_getmntent" = "xno"; then
496 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
498 if test "x$have_getmntent" = "xno"; then
499 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
501 if test "x$have_getmntent" = "xno"; then
502 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
505 if test "x$have_getmntent" = "xc"; then
506 AC_CACHE_CHECK([whether getmntent takes one argument],
507 [have_one_getmntent],
509 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
511 #include "$srcdir/src/utils_mount.h"]],
515 fh = setmntent ("/etc/mtab", "r");
519 [have_one_getmntent="yes"],
520 [have_one_getmntent="no"]
523 AC_CACHE_CHECK([whether getmntent takes two arguments],
524 [have_two_getmntent],
526 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
527 #include <sys/mnttab.h>
528 #include "$srcdir/src/utils_mount.h"]],
533 fh = fopen ("/etc/mnttab", "r");
534 status = getmntent (fh, &mt);
537 [have_two_getmntent="yes"],
538 [have_two_getmntent="no"]
543 # Check for different versions of `getmntent' here..
545 if test "x$have_getmntent" = "xc"; then
546 if test "x$have_one_getmntent" = "xyes"; then
547 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
548 [Define if the function getmntent exists and takes one argument.])
550 if test "x$have_two_getmntent" = "xyes"; then
551 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
552 [Define if the function getmntent exists and takes two arguments.])
555 if test "x$have_getmntent" = "xsun"; then
556 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
557 [Define if the function getmntent exists. It's the version from libsun.])
559 if test "x$have_getmntent" = "xseq"; then
560 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
561 [Define if the function getmntent exists. It's the version from libseq.])
563 if test "x$have_getmntent" = "xgen"; then
564 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
565 [Define if the function getmntent exists. It's the version from libgen.])
568 # Check for structures
569 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
570 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
573 #include <sys/types.h>
574 #include <sys/socket.h>
577 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
578 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
581 #include <sys/types.h>
582 #include <sys/socket.h>
583 #include <linux/if.h>
584 #include <linux/netdevice.h>
587 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
592 # include <sys/types.h>
594 #if HAVE_NETINET_IN_SYSTM_H
595 # include <netinet/in_systm.h>
597 #if HAVE_NETINET_IN_H
598 # include <netinet/in.h>
600 #if HAVE_NETINET_IP_H
601 # include <netinet/ip.h>
603 #if HAVE_NETINET_UDP_H
604 # include <netinet/udp.h>
607 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
612 # include <sys/types.h>
614 #if HAVE_NETINET_IN_SYSTM_H
615 # include <netinet/in_systm.h>
617 #if HAVE_NETINET_IN_H
618 # include <netinet/in.h>
620 #if HAVE_NETINET_IP_H
621 # include <netinet/ip.h>
623 #if HAVE_NETINET_UDP_H
624 # include <netinet/udp.h>
628 AC_MSG_CHECKING([for kernel type ($host_os)])
631 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
635 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
641 AC_MSG_RESULT([$ac_system])
644 AC_CHECK_LIB(resolv, res_search,
646 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
648 [with_libresolv="no"])
649 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
652 m4_divert_once([HELP_WITH], [
653 collectd additional packages:])
655 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
656 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
657 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
659 LDFLAGS="$LDFLAGS -L$withval/lib"
660 CPPFLAGS="$CPPFLAGS -I$withval/include"
663 ], [with_rrdtool="yes"])
664 if test "x$with_rrdtool" = "xyes"
666 AC_CHECK_LIB(rrd, rrd_update,
668 AC_DEFINE(HAVE_LIBRRD, 1, [Define to 1 if you have the rrd library (-lrrd).])
670 [with_rrdtool="no (librrd not found)"], [-lm])
672 if test "x$with_rrdtool" = "xyes"
674 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
676 if test "x$with_rrdtool" = "xyes"
682 AC_DEFINE_UNQUOTED(COLLECT_RRDTOOL, [$collect_rrdtool],
683 [Wether or not to use rrdtool library])
684 AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
686 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
687 [ if test "x$withval" != "xno" -a "x$withval" != "xyes"
689 LDFLAGS="$LDFLAGS -L$withval/lib"
690 CPPFLAGS="$CPPFLAGS -I$withval/include"
691 with_libpthread="yes"
693 if test "x$withval" = "xno"
695 with_libpthread="no (disabled)"
698 ], [with_libpthread="yes"])
699 if test "x$with_libpthread" = "xyes"
701 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
703 if test "x$with_libpthread" = "xyes"
705 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
707 if test "x$with_libpthread" = "xyes"
713 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
714 [Wether or not to use pthread (POSIX threads) library])
715 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
717 if test "$ac_system" = "Solaris"
722 with_kstat="no (Solaris only)"
723 with_devinfo="no (Solaris only)"
726 if test "x$with_kstat" = "xyes"
728 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
730 if test "x$with_kstat" = "xyes"
732 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
733 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
735 if test "x$with_kstat" = "xyes"
741 AC_DEFINE_UNQUOTED(COLLECT_KSTAT, [$collect_kstat],
742 [Wether or not to use kstat library (Solaris)])
743 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
744 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
746 ### BEGIN of check for libcurl ###
747 with_curl_config="curl-config"
750 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
752 if test "x$withval" != "xno" -a "x$withval" != "xyes"
754 if test -x "$withval/bin/curl-config"
756 with_curl_config="$withval/bin/curl-config"
760 if test "x$withval" = "xno"
770 if test "x$with_libcurl" = "xyes"
772 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
773 curl_config_status=$?
775 if test $curl_config_status -ne 0
779 AC_CHECK_LIB(curl, curl_easy_init,
781 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
782 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
790 if test "x$with_libcurl" = "xyes" -a $with_curl_prefix -ne 0
792 with_curl_prefix=`$with_curl_config --libs 2>/dev/null`
793 curl_config_status=$?
795 if test $curl_config_status -ne 0
799 if test -d "$with_curl_prefix/include"
801 CPPFLAGS="$CPPFLAGS -I$with_curl_prefix/include"
806 with_libcurl_numeric=0
807 if test "x$with_libcurl" = "xyes"
809 with_libcurl_numeric=1
811 AC_DEFINE_UNQUOTED(HAVE_LIBCURL, [$with_libcurl_numeric], [Define to 1 if you have the 'curl' library (-lcurl).])
812 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
813 ### END of check for libcurl ###
817 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
826 AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
827 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
829 with_libstatgrab="yes"
831 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
833 if test "x$withval" != "xno" -a "x$withval" != "xyes"
835 LDFLAGS="$LDFLAGS -L$withval/lib"
836 CPPFLAGS="$CPPFLAGS -I$withval/include"
837 with_libstatgrab="yes"
841 if test "x$ac_system" == "xunknown"
843 with_libstatgrab="yes"
845 with_libstatgrab="no"
848 if test "x$with_libstatgrab" = "xyes"
850 AC_CHECK_LIB(statgrab, sg_init, [with_libstatgrab="yes"], [with_libstatgrab="no (libstatgrab not found)"])
852 if test "x$with_libstatgrab" = "xyes"
854 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (statgrab.h not found)"])
856 if test "x$with_libstatgrab" = "xyes"
858 AC_CHECK_LIB(devstat, getdevs, [with_libdevstat="yes"], [with_libdevstat="no"])
860 if test "x$with_libstatgrab" = "xyes"
862 collect_libstatgrab=1
864 collect_libstatgrab=0
866 AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
867 [Wether or not to use statgrab library])
868 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
869 AM_CONDITIONAL(BUILD_WITH_LIBDEVSTAT, test "x$with_libdevstat" = "xyes")
871 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
872 if test "x$with_libkvm" = "xyes"
874 AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
876 AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
878 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
880 if test "x$withval" != "xno" && test "x$withval" != "xyes"
882 LDFLAGS="$LDFLAGS -L$withval/lib"
883 CPPFLAGS="$CPPFLAGS -I$withval/include"
884 with_lm_sensors="yes"
888 if test "x$ac_system" = "xLinux"
890 with_lm_sensors="yes"
895 if test "x$with_lm_sensors" = "xyes"
897 AC_CHECK_LIB(sensors, sensors_init,
899 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
901 [with_lm_sensors="no (libsensors not found)"])
903 if test "x$with_lm_sensors" = "xyes"
905 AC_CHECK_HEADERS(sensors/sensors.h,
907 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
909 [with_lm_sensors="no (sensors/sensors.h not found)"])
911 if test "x$with_lm_sensors" = "xyes"
917 AC_DEFINE_UNQUOTED(COLLECT_LM_SENSORS, [$collect_lm_sensors],
918 [Wether or not to use sensors library])
919 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
921 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
923 if test "x$withval" != "xno" && test "x$withval" != "xyes"
925 LDFLAGS="$LDFLAGS -L$withval/lib"
926 CPPFLAGS="$CPPFLAGS -I$withval/include"
933 if test "x$with_libmysql" = "xyes"
935 AC_CHECK_LIB(mysqlclient, mysql_init,
937 AC_DEFINE(HAVE_LIBMYSQLCLIENT, 1, [Define to 1 if you have the mysqlclient library (-lmysqlclient).])
938 ], [with_libmysql="no (libmysql not found)"])
940 if test "x$with_libmysql" = "xyes"
942 AC_CHECK_HEADERS(mysql/mysql.h,
944 AC_DEFINE(HAVE_MYSQL_MYSQL_H, 1, [Define to 1 if you have the <mysql/mysql.h> header file.])
945 ], [with_libmysql="no (mysql/mysql.h not found)"])
947 if test "x$with_libmysql" = "xyes"
953 AC_DEFINE_UNQUOTED(COLLECT_LIBMYSQL, [$collect_libmysql],
954 [Wether or not to use mysql library])
955 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
958 with_own_liboping="no"
959 liboping_LDFLAGS="$LDFLAGS"
960 liboping_CPPFLAGS="$CPPFLAGS"
961 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
963 if test "x$withval" != "xno" && test "x$withval" != "xyes"
965 if test -d "$withval/lib"
967 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
969 if test -d "$withval/include"
971 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
974 if test "x$withval" = "xno"
977 with_own_liboping="no"
985 if test "x$with_liboping" = "xyes"
987 save_LDFLAGS="$LDFLAGS"
988 save_CPPFLAGS="$CPPFLAGS"
989 LDFLAGS="$liboping_LDFLAGS"
990 CPPFLAGS="$liboping_CPPFLAGS"
991 AC_CHECK_LIB(oping, ping_construct,
994 with_own_liboping="no"
998 with_own_liboping="yes"
999 LDFLAGS="$save_LDFLAGS"
1000 CPPFLAGS="$save_CPPFLAGS"
1003 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1004 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1005 if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
1007 with_liboping="yes (shipped version)"
1010 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1012 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1014 LDFLAGS="$LDFLAGS -L$withval/lib"
1015 CPPFLAGS="$CPPFLAGS -I$withval/include"
1022 if test "x$with_libpcap" = "xyes"
1024 AC_CHECK_LIB(pcap, pcap_open_live,
1026 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1027 ], [with_libpcap="no (libpcap not found)"])
1029 if test "x$with_libpcap" = "xyes"
1031 AC_CHECK_HEADERS(pcap.h,
1033 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1034 ], [with_libpcap="no (pcap.h not found)"])
1036 if test "x$with_libpcap" = "xyes"
1042 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1043 [Wether or not to use the pcap library])
1044 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1046 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1048 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1050 LDFLAGS="$LDFLAGS -L$withval/lib"
1051 CPPFLAGS="$CPPFLAGS -I$withval/include"
1056 if test "x$ac_system" = "xLinux"
1060 with_libiptc="no (Linux only)"
1063 if test "x$with_libiptc" = "xyes"
1065 AC_CHECK_LIB(iptc, iptc_init,
1067 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1068 ], [with_libiptc="no (libiptc not found)"])
1070 if test "x$with_libiptc" = "xyes"
1072 AC_CHECK_HEADERS(libiptc/libiptc.h,
1074 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1075 ], [with_libiptc="no (libiptc/libiptc.h not found)"])
1077 if test "x$with_libiptc" = "xyes"
1083 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1085 # Define `step' and `hearbeat' values..
1086 declare -i collectd_step=10
1087 declare -i collectd_heartbeat=25
1088 AC_ARG_WITH(step, [AS_HELP_STRING([--with-step=SECONDS], [Interval in which plugins are queried.])],
1090 if test "x$withval" != "xno" -a "x$withval" != "xyes"
1092 declare -i tmp_collectd_step="$withval"
1093 if test $tmp_collectd_step -gt 0
1095 collectd_step=$tmp_collectd_step
1096 let "collectd_heartbeat=$collectd_step*2"
1100 AC_ARG_WITH(heartbeat, [AS_HELP_STRING([--with-heartbeat=SECONDS], [Heartbeat of the DS in generated RRD files.])],
1102 if test "x$withval" != "xno" -a "x$withval" != "xyes"
1104 declare -i tmp_collectd_heartbeat="$withval"
1105 if test $tmp_collectd_heartbeat -gt 0
1107 collectd_heartbeat=$tmp_collectd_heartbeat
1112 if test $collectd_step -ne 10
1114 AC_DEFINE_UNQUOTED(COLLECTD_STEP, "$collectd_step", [Interval in which plugins are queried.])
1116 if test $collectd_heartbeat -ne 25
1118 AC_DEFINE_UNQUOTED(COLLECTD_HEARTBEAT, "$collectd_heartbeat", [Interval in which plugins are queried.])
1121 # Check for enabled/disabled features
1124 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
1125 # ------------------------------------------------------------
1127 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
1132 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
1137 m4_define([EnDis],[disabled])dnl
1138 m4_define([YesNo],[no])dnl
1144 m4_define([EnDis],[enabled])dnl
1145 m4_define([YesNo],[yes])dnl
1148 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
1152 m4_if([$3], [feature], [],
1156 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
1162 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
1164 enable_$1='[YesNo]'dnl
1166 if test "x$enable_$1" = "xno"
1170 if test "x$enable_$1" = "xyes"
1174 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
1179 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
1180 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
1182 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
1184 m4_divert_once([HELP_ENABLE], [
1185 collectd features:])
1186 AC_COLLECTD([debug], [enable], [feature], [debugging])
1187 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
1188 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
1190 m4_divert_once([HELP_ENABLE], [
1192 AC_COLLECTD([apache], [disable], [module], [Apache httpd statistics])
1193 AC_COLLECTD([apcups], [disable], [module], [Statistics of UPSes by APC])
1194 AC_COLLECTD([apple_sensors], [disable], [module], [Apple's hardware sensors])
1195 AC_COLLECTD([battery], [disable], [module], [battery statistics])
1196 AC_COLLECTD([cpu], [disable], [module], [cpu usage statistics])
1197 AC_COLLECTD([cpufreq], [disable], [module], [system cpu frequency statistics])
1198 AC_COLLECTD([disk], [disable], [module], [disk/partition statistics])
1199 AC_COLLECTD([csv], [disable], [module], [csv output plugin])
1200 AC_COLLECTD([df], [disable], [module], [df statistics])
1201 AC_COLLECTD([dns], [disable], [module], [dns statistics])
1202 AC_COLLECTD([email], [disable], [module], [email statistics])
1203 AC_COLLECTD([entropy], [disable], [module], [entropy statistics])
1204 AC_COLLECTD([exec], [disable], [module], [exec of external programs])
1205 AC_COLLECTD([hddtemp], [disable], [module], [hdd temperature statistics])
1206 AC_COLLECTD([interface], [disable], [module], [interface statistics])
1207 AC_COLLECTD([iptables], [disable], [module], [IPtables statistics])
1208 AC_COLLECTD([irq], [disable], [module], [irq statistics])
1209 AC_COLLECTD([load], [disable], [module], [system load statistics])
1210 AC_COLLECTD([mbmon], [disable], [module], [motherboard monitor statistics])
1211 AC_COLLECTD([memory], [disable], [module], [memory statistics])
1212 AC_COLLECTD([multimeter],[disable], [module], [multimeter statistics])
1213 AC_COLLECTD([mysql], [disable], [module], [mysql statistics])
1214 AC_COLLECTD([network], [disable], [module], [network functionality])
1215 AC_COLLECTD([nfs], [disable], [module], [nfs statistics])
1216 AC_COLLECTD([ntpd], [disable], [module], [ntpd statistics])
1217 AC_COLLECTD([ping], [disable], [module], [ping statistics])
1218 AC_COLLECTD([processes], [disable], [module], [processes statistics])
1219 AC_COLLECTD([sensors], [disable], [module], [lm_sensors statistics])
1220 AC_COLLECTD([serial], [disable], [module], [serial statistics])
1221 AC_COLLECTD([logfile], [disable], [module], [logfile log facility])
1222 AC_COLLECTD([swap], [disable], [module], [swap statistics])
1223 AC_COLLECTD([syslog], [disable], [module], [syslog log facility])
1224 AC_COLLECTD([tape], [disable], [module], [tape statistics])
1225 AC_COLLECTD([unixsock], [disable], [module], [UNIX socket plugin])
1226 AC_COLLECTD([users], [disable], [module], [user count statistics])
1227 AC_COLLECTD([vserver], [disable], [module], [vserver statistics])
1228 AC_COLLECTD([wireless], [disable], [module], [wireless link statistics])
1230 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile)
1236 libcurl . . . . . . $with_libcurl
1237 libiokit . . . . . $with_libiokit
1238 liboping . . . . . $with_liboping
1239 librrd . . . . . . $with_rrdtool
1240 lm_sensors . . . . $with_lm_sensors
1241 libstatgrab . . . . $with_libstatgrab
1242 libkstat . . . . . $with_kstat
1243 libmysql . . . . . $with_libmysql
1244 libpcap . . . . . . $with_libpcap
1245 libiptc . . . . . . $with_libiptc
1246 libpthread . . . . $with_libpthread
1249 debug . . . . . . . $enable_debug
1250 daemon mode . . . . $enable_daemon
1251 step . . . . . . . $collectd_step seconds
1252 heartbeat . . . . . $collectd_heartbeat seconds
1255 apache . . . . . . $enable_apache
1256 apcups . . . . . . $enable_apcups
1257 apple_sensors . . . $enable_apple_sensors
1258 battery . . . . . . $enable_battery
1259 cpu . . . . . . . . $enable_cpu
1260 cpufreq . . . . . . $enable_cpufreq
1261 csv . . . . . . . . $enable_csv
1262 df . . . . . . . . $enable_df
1263 disk . . . . . . . $enable_disk
1264 dns . . . . . . . . $enable_dns
1265 email . . . . . . . $enable_email
1266 entropy . . . . . . $enable_entropy
1267 exec . . . . . . . $enable_exec
1268 hddtemp . . . . . . $enable_hddtemp
1269 interface . . . . . $enable_interface
1270 iptables . . . . . $enable_iptables
1271 irq . . . . . . . . $enable_irq
1272 load . . . . . . . $enable_load
1273 mbmon . . . . . . . $enable_mbmon
1274 memory . . . . . . $enable_memory
1275 multimeter . . . . $enable_multimeter
1276 mysql . . . . . . . $enable_mysql
1277 network . . . . . . $enable_network
1278 nfs . . . . . . . . $enable_nfs
1279 ntpd . . . . . . . $enable_ntpd
1280 ping . . . . . . . $enable_ping
1281 processes . . . . . $enable_processes
1282 sensors . . . . . . $enable_sensors
1283 serial . . . . . . $enable_serial
1284 logfile . . . . . . $enable_logfile
1285 swap . . . . . . . $enable_swap
1286 syslog . . . . . . $enable_syslog
1287 tape . . . . . . . $enable_tape
1288 unixsock . . . . . $enable_unixsock
1289 users . . . . . . . $enable_users
1290 vserver . . . . . . $enable_vserver
1291 wireless . . . . . $enable_wireless