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
28 AC_CONFIG_SUBDIRS(libltdl)
31 # Checks for header files.
36 AC_CHECK_HEADERS(stdint.h)
37 AC_CHECK_HEADERS(stdio.h)
38 AC_CHECK_HEADERS(errno.h)
39 AC_CHECK_HEADERS(math.h)
40 AC_CHECK_HEADERS(syslog.h)
41 AC_CHECK_HEADERS(fcntl.h)
42 AC_CHECK_HEADERS(signal.h)
43 AC_CHECK_HEADERS(assert.h)
44 AC_CHECK_HEADERS(sys/types.h)
45 AC_CHECK_HEADERS(sys/socket.h)
46 AC_CHECK_HEADERS(sys/select.h)
47 AC_CHECK_HEADERS(sys/poll.h)
48 AC_CHECK_HEADERS(netdb.h)
49 AC_CHECK_HEADERS(arpa/inet.h)
50 AC_CHECK_HEADERS(sys/resource.h)
51 AC_CHECK_HEADERS(sys/param.h)
54 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
59 # include <sys/types.h>
62 AC_CHECK_HEADERS(netinet/in.h, [], [],
67 # include <sys/types.h>
69 #if HAVE_NETINET_IN_SYSTM_H
70 # include <netinet/in_systm.h>
73 AC_CHECK_HEADERS(netinet/ip.h, [], [],
78 # include <sys/types.h>
80 #if HAVE_NETINET_IN_SYSTM_H
81 # include <netinet/in_systm.h>
84 # include <netinet/in.h>
87 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
92 # include <sys/types.h>
94 #if HAVE_NETINET_IN_SYSTM_H
95 # include <netinet/in_systm.h>
98 # include <netinet/in.h>
100 #if HAVE_NETINET_IP_H
101 # include <netinet/ip.h>
104 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
109 # include <sys/types.h>
111 #if HAVE_NETINET_IN_SYSTM_H
112 # include <netinet/in_systm.h>
114 #if HAVE_NETINET_IN_H
115 # include <netinet/in.h>
117 #if HAVE_NETINET_IP_H
118 # include <netinet/ip.h>
121 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
126 # include <sys/types.h>
128 #if HAVE_NETINET_IN_SYSTM_H
129 # include <netinet/in_systm.h>
131 #if HAVE_NETINET_IN_H
132 # include <netinet/in.h>
135 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
140 # include <sys/types.h>
142 #if HAVE_NETINET_IN_SYSTM_H
143 # include <netinet/in_systm.h>
145 #if HAVE_NETINET_IN_H
146 # include <netinet/in.h>
148 #if HAVE_NETINET_IP6_H
149 # include <netinet/ip6.h>
152 AC_CHECK_HEADERS(netinet/udp.h, [], [],
157 # include <sys/types.h>
159 #if HAVE_NETINET_IN_SYSTM_H
160 # include <netinet/in_systm.h>
162 #if HAVE_NETINET_IN_H
163 # include <netinet/in.h>
165 #if HAVE_NETINET_IP_H
166 # include <netinet/ip.h>
171 AC_CHECK_HEADERS(sys/sysctl.h sys/dkstat.h)
172 AC_CHECK_HEADERS(mach/mach_init.h)
173 AC_CHECK_HEADERS(mach/host_priv.h)
174 AC_CHECK_HEADERS(mach/mach_error.h)
175 AC_CHECK_HEADERS(mach/mach_host.h)
176 AC_CHECK_HEADERS(mach/mach_port.h)
177 AC_CHECK_HEADERS(mach/mach_types.h)
178 AC_CHECK_HEADERS(mach/message.h)
179 AC_CHECK_HEADERS(mach/processor_set.h)
180 AC_CHECK_HEADERS(mach/processor.h)
181 AC_CHECK_HEADERS(mach/processor_info.h)
182 AC_CHECK_HEADERS(mach/task.h)
183 AC_CHECK_HEADERS(mach/thread_act.h)
184 AC_CHECK_HEADERS(mach/vm_region.h)
185 AC_CHECK_HEADERS(mach/vm_map.h)
186 AC_CHECK_HEADERS(mach/vm_prot.h)
187 AC_CHECK_HEADERS(mach/vm_statistics.h)
188 AC_CHECK_HEADERS(mach/kern_return.h)
191 AC_CHECK_HEADERS(linux/major.h)
193 # For the apple_sensors module
194 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h)
195 AC_CHECK_HEADERS(IOKit/IOKitLib.h)
196 AC_CHECK_HEADERS(IOKit/IOTypes.h)
198 # For the battery plugin
199 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
201 #if HAVE_IOKIT_IOKITLIB_H
202 # include <IOKit/IOKitLib.h>
204 #if HAVE_IOKIT_IOTYPES_H
205 # include <IOKit/IOTypes.h>
208 AC_CHECK_HEADERS(IOKit/ps/IOPSKeys.h)
210 # For the `disk' plugin
211 AC_CHECK_HEADERS(IOKit/IOBSD.h)
212 AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDriver.h)
215 AC_CHECK_HEADERS(sys/loadavg.h)
217 # For the processes plugin
218 AC_CHECK_HEADERS(linux/config.h)
220 # For the swap module
221 AC_CHECK_HEADERS(sys/swap.h)
224 AC_CHECK_HEADERS(utmp.h)
225 AC_CHECK_HEADERS(utmpx.h)
228 AC_CHECK_HEADERS(ifaddrs.h)
229 AC_CHECK_HEADERS(net/if.h, [], [],
232 # include <sys/types.h>
234 #if HAVE_SYS_SOCKET_H
235 # include <sys/socket.h>
238 AC_CHECK_HEADERS(linux/if.h, [], [],
241 # include <sys/types.h>
243 #if HAVE_SYS_SOCKET_H
244 # include <sys/socket.h>
247 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
250 # include <sys/types.h>
252 #if HAVE_SYS_SOCKET_H
253 # include <sys/socket.h>
256 # include <linux/if.h>
261 AC_CHECK_HEADERS(curl/curl.h)
264 AC_CHECK_HEADERS(grp.h pwd.h sys/ucred.h)
265 AC_CHECK_HEADERS(ctype.h)
266 AC_CHECK_HEADERS(limits.h)
267 AC_CHECK_HEADERS(sys/quota.h)
268 AC_CHECK_HEADERS(xfs/xqm.h)
270 # For mount interface
271 AC_CHECK_HEADERS(fs_info.h)
272 AC_CHECK_HEADERS(fshelp.h)
273 AC_CHECK_HEADERS(paths.h)
274 AC_CHECK_HEADERS(mntent.h)
275 AC_CHECK_HEADERS(mnttab.h)
276 AC_CHECK_HEADERS(sys/fstyp.h)
277 AC_CHECK_HEADERS(sys/fs_types.h)
278 AC_CHECK_HEADERS(sys/mntent.h)
279 AC_CHECK_HEADERS(sys/mnttab.h)
280 AC_CHECK_HEADERS(sys/mount.h)
281 AC_CHECK_HEADERS(sys/statfs.h)
282 AC_CHECK_HEADERS(sys/statvfs.h)
283 AC_CHECK_HEADERS(sys/vfs.h)
284 AC_CHECK_HEADERS(sys/vfstab.h)
286 # For the swap plugin, FreeBSD
287 AC_CHECK_HEADERS(kvm.h)
289 # For the email plugin
290 AC_CHECK_HEADERS(linux/un.h, [], [],
292 #if HAVE_SYS_SOCKET_H
293 # include <sys/socket.h>
296 AC_CHECK_HEADERS(sys/un.h)
297 AC_CHECK_HEADERS(grp.h)
299 # For debugging interface (variable number of arguments)
300 AC_CHECK_HEADERS(stdarg.h)
302 # Regular expressions for the ignorelist.
303 AC_CHECK_HEADERS(regex.h)
306 AC_CHECK_HEADERS(arpa/nameser.h arpa/nameser_compat.h)
308 AC_CHECK_HEADERS(net/if_arp.h)
309 AC_CHECK_HEADERS(net/if_ppp.h)
310 AC_CHECK_HEADERS(netinet/if_ether.h)
313 # Checking for libraries
318 # Checks for typedefs, structures, and compiler characteristics.
327 # Checks for library functions.
329 AC_PROG_GCC_TRADITIONAL
330 AC_CHECK_FUNCS(gettimeofday select strdup strtol)
331 AC_CHECK_FUNCS(getaddrinfo getnameinfo)
332 AC_CHECK_FUNCS(strchr memcpy strstr strcmp strncmp strncpy strlen)
333 AC_CHECK_FUNCS(strncasecmp strcasecmp)
334 AC_CHECK_FUNCS(openlog syslog closelog)
336 socket_needs_socket="no"
337 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
338 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
340 nanosleep_needs_rt="no"
341 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
342 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
344 # Regular expressions for the ignorelist.
345 AC_CHECK_FUNCS(regcomp regerror regexec regfree)
348 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
351 AC_CHECK_FUNCS(statfs statvfs)
354 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
356 # For the `processes' plugin
357 AC_CHECK_FUNCS(thread_info)
360 AC_CHECK_FUNCS(getutent getutxent)
363 AC_CHECK_FUNCS(quotactl)
364 AC_CHECK_FUNCS(getgrgid getpwuid)
367 AC_CHECK_FUNCS(getifaddrs)
369 # For mount interface
370 #AC_CHECK_FUNCS(getfsent getvfsent)
373 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
375 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
377 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
380 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
381 if test "x$have_getmntent" = "xno"; then
382 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
384 if test "x$have_getmntent" = "xno"; then
385 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
387 if test "x$have_getmntent" = "xno"; then
388 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
391 if test "x$have_getmntent" = "xc"; then
392 AC_CACHE_CHECK([whether getmntent takes one argument],
393 [have_one_getmntent],
395 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
397 #include "$srcdir/src/utils_mount.h"]],
401 fh = setmntent ("/etc/mtab", "r");
405 [have_one_getmntent="yes"],
406 [have_one_getmntent="no"]
409 AC_CACHE_CHECK([whether getmntent takes two arguments],
410 [have_two_getmntent],
412 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
413 #include <sys/mnttab.h>
414 #include "$srcdir/src/utils_mount.h"]],
419 fh = fopen ("/etc/mnttab", "r");
420 status = getmntent (fh, &mt);
423 [have_two_getmntent="yes"],
424 [have_two_getmntent="no"]
429 # Check for different versions of `getmntent' here..
431 if test "x$have_getmntent" = "xc"; then
432 if test "x$have_one_getmntent" = "xyes"; then
433 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
434 [Define if the function getmntent exists and takes one argument.])
436 if test "x$have_two_getmntent" = "xyes"; then
437 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
438 [Define if the function getmntent exists and takes two arguments.])
441 if test "x$have_getmntent" = "xsun"; then
442 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
443 [Define if the function getmntent exists. It's the version from libsun.])
445 if test "x$have_getmntent" = "xseq"; then
446 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
447 [Define if the function getmntent exists. It's the version from libseq.])
449 if test "x$have_getmntent" = "xgen"; then
450 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
451 [Define if the function getmntent exists. It's the version from libgen.])
454 # Check for structures
455 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
456 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
459 #include <sys/types.h>
460 #include <sys/socket.h>
463 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
464 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
467 #include <sys/types.h>
468 #include <sys/socket.h>
469 #include <linux/if.h>
470 #include <linux/netdevice.h>
473 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
478 # include <sys/types.h>
480 #if HAVE_NETINET_IN_SYSTM_H
481 # include <netinet/in_systm.h>
483 #if HAVE_NETINET_IN_H
484 # include <netinet/in.h>
486 #if HAVE_NETINET_IP_H
487 # include <netinet/ip.h>
489 #if HAVE_NETINET_UDP_H
490 # include <netinet/udp.h>
493 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
498 # include <sys/types.h>
500 #if HAVE_NETINET_IN_SYSTM_H
501 # include <netinet/in_systm.h>
503 #if HAVE_NETINET_IN_H
504 # include <netinet/in.h>
506 #if HAVE_NETINET_IP_H
507 # include <netinet/ip.h>
509 #if HAVE_NETINET_UDP_H
510 # include <netinet/udp.h>
514 AC_MSG_CHECKING([for kernel type ($host_os)])
517 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
521 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
527 AC_MSG_RESULT([$ac_system])
530 AC_CHECK_LIB(resolv, res_search,
532 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
534 [with_libresolv="no"])
535 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
538 m4_divert_once([HELP_WITH], [
539 collectd additional packages:])
541 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
542 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
543 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
545 LDFLAGS="$LDFLAGS -L$withval/lib"
546 CPPFLAGS="$CPPFLAGS -I$withval/include"
549 ], [with_rrdtool="yes"])
550 if test "x$with_rrdtool" = "xyes"
552 AC_CHECK_LIB(rrd, rrd_update,
554 AC_DEFINE(HAVE_LIBRRD, 1, [Define to 1 if you have the rrd library (-lrrd).])
556 [with_rrdtool="no (librrd not found)"], [-lm])
558 if test "x$with_rrdtool" = "xyes"
560 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
562 if test "x$with_rrdtool" = "xyes"
568 AC_DEFINE_UNQUOTED(COLLECT_RRDTOOL, [$collect_rrdtool],
569 [Wether or not to use rrdtool library])
570 AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
572 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
573 [ if test "x$withval" != "xno" -a "x$withval" != "xyes"
575 LDFLAGS="$LDFLAGS -L$withval/lib"
576 CPPFLAGS="$CPPFLAGS -I$withval/include"
577 with_libpthread="yes"
579 if test "x$withval" = "xno"
581 with_libpthread="no (disabled)"
584 ], [with_libpthread="yes"])
585 if test "x$with_libpthread" = "xyes"
587 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
589 if test "x$with_libpthread" = "xyes"
591 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
593 if test "x$with_libpthread" = "xyes"
599 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
600 [Wether or not to use pthread (POSIX threads) library])
601 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
603 if test "$ac_system" = "Solaris"
608 with_kstat="no (Solaris only)"
609 with_devinfo="no (Solaris only)"
612 if test "x$with_kstat" = "xyes"
614 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
616 if test "x$with_kstat" = "xyes"
618 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
619 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
621 if test "x$with_kstat" = "xyes"
627 AC_DEFINE_UNQUOTED(COLLECT_KSTAT, [$collect_kstat],
628 [Wether or not to use kstat library (Solaris)])
629 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
630 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
632 ### BEGIN of check for libcurl ###
633 with_curl_config="curl-config"
636 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
638 if test "x$withval" != "xno" -a "x$withval" != "xyes"
640 if test -x "$withval/bin/curl-config"
642 with_curl_config="$withval/bin/curl-config"
646 if test "x$withval" = "xno"
656 if test "x$with_libcurl" = "xyes"
658 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
659 curl_config_status=$?
661 if test $curl_config_status -ne 0
665 AC_CHECK_LIB(curl, curl_easy_init,
667 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
668 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
676 if test "x$with_libcurl" = "xyes" -a $with_curl_prefix -ne 0
678 with_curl_prefix=`$with_curl_config --libs 2>/dev/null`
679 curl_config_status=$?
681 if test $curl_config_status -ne 0
685 if test -d "$with_curl_prefix/include"
687 CPPFLAGS="$CPPFLAGS -I$with_curl_prefix/include"
692 with_libcurl_numeric=0
693 if test "x$with_libcurl" = "xyes"
695 with_libcurl_numeric=1
697 AC_DEFINE_UNQUOTED(HAVE_LIBCURL, [$with_libcurl_numeric], [Define to 1 if you have the 'curl' library (-lcurl).])
698 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
699 ### END of check for libcurl ###
703 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
712 AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
713 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
715 with_libstatgrab="yes"
717 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
719 if test "x$withval" != "xno" -a "x$withval" != "xyes"
721 LDFLAGS="$LDFLAGS -L$withval/lib"
722 CPPFLAGS="$CPPFLAGS -I$withval/include"
723 with_libstatgrab="yes"
727 if test "x$ac_system" == "xunknown"
729 with_libstatgrab="yes"
731 with_libstatgrab="no"
734 if test "x$with_libstatgrab" = "xyes"
736 AC_CHECK_LIB(statgrab, sg_init, [with_libstatgrab="yes"], [with_libstatgrab="no (libstatgrab not found)"])
738 if test "x$with_libstatgrab" = "xyes"
740 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (statgrab.h not found)"])
742 if test "x$with_libstatgrab" = "xyes"
744 AC_CHECK_LIB(devstat, getdevs, [with_libdevstat="yes"], [with_libdevstat="no"])
746 if test "x$with_libstatgrab" = "xyes"
748 collect_libstatgrab=1
750 collect_libstatgrab=0
752 AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
753 [Wether or not to use statgrab library])
754 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
755 AM_CONDITIONAL(BUILD_WITH_LIBDEVSTAT, test "x$with_libdevstat" = "xyes")
757 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
758 if test "x$with_libkvm" = "xyes"
760 AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
762 AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
764 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
766 if test "x$withval" != "xno" && test "x$withval" != "xyes"
768 LDFLAGS="$LDFLAGS -L$withval/lib"
769 CPPFLAGS="$CPPFLAGS -I$withval/include"
770 with_lm_sensors="yes"
774 if test "x$ac_system" = "xLinux"
776 with_lm_sensors="yes"
781 if test "x$with_lm_sensors" = "xyes"
783 AC_CHECK_LIB(sensors, sensors_init,
785 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
787 [with_lm_sensors="no (libsensors not found)"])
789 if test "x$with_lm_sensors" = "xyes"
791 AC_CHECK_HEADERS(sensors/sensors.h,
793 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
795 [with_lm_sensors="no (sensors/sensors.h not found)"])
797 if test "x$with_lm_sensors" = "xyes"
803 AC_DEFINE_UNQUOTED(COLLECT_LM_SENSORS, [$collect_lm_sensors],
804 [Wether or not to use sensors library])
805 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
807 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
809 if test "x$withval" != "xno" && test "x$withval" != "xyes"
811 LDFLAGS="$LDFLAGS -L$withval/lib"
812 CPPFLAGS="$CPPFLAGS -I$withval/include"
819 if test "x$with_libmysql" = "xyes"
821 AC_CHECK_LIB(mysqlclient, mysql_init,
823 AC_DEFINE(HAVE_LIBMYSQLCLIENT, 1, [Define to 1 if you have the mysqlclient library (-lmysqlclient).])
824 ], [with_libmysql="no (libmysql not found)"])
826 if test "x$with_libmysql" = "xyes"
828 AC_CHECK_HEADERS(mysql/mysql.h,
830 AC_DEFINE(HAVE_MYSQL_MYSQL_H, 1, [Define to 1 if you have the <mysql/mysql.h> header file.])
831 ], [with_libmysql="no (mysql/mysql.h not found)"])
833 if test "x$with_libmysql" = "xyes"
839 AC_DEFINE_UNQUOTED(COLLECT_LIBMYSQL, [$collect_libmysql],
840 [Wether or not to use mysql library])
841 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
844 with_own_liboping="no"
845 liboping_LDFLAGS="$LDFLAGS"
846 liboping_CPPFLAGS="$CPPFLAGS"
847 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
849 if test "x$withval" != "xno" && test "x$withval" != "xyes"
851 if test -d "$withval/lib"
853 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
855 if test -d "$withval/include"
857 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
860 if test "x$withval" = "xno"
863 with_own_liboping="no"
871 if test "x$with_liboping" = "xyes"
873 save_LDFLAGS="$LDFLAGS"
874 save_CPPFLAGS="$CPPFLAGS"
875 LDFLAGS="$liboping_LDFLAGS"
876 CPPFLAGS="$liboping_CPPFLAGS"
877 AC_CHECK_LIB(oping, ping_construct,
880 with_own_liboping="no"
884 with_own_liboping="yes"
885 LDFLAGS="$save_LDFLAGS"
886 CPPFLAGS="$save_CPPFLAGS"
889 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
890 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
891 if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
893 with_liboping="yes (shipped version)"
896 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
898 if test "x$withval" != "xno" && test "x$withval" != "xyes"
900 LDFLAGS="$LDFLAGS -L$withval/lib"
901 CPPFLAGS="$CPPFLAGS -I$withval/include"
908 if test "x$with_libpcap" = "xyes"
910 AC_CHECK_LIB(pcap, pcap_open_live,
912 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
913 ], [with_libpcap="no (libpcap not found)"])
915 if test "x$with_libpcap" = "xyes"
917 AC_CHECK_HEADERS(pcap.h,
919 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
920 ], [with_libpcap="no (pcap.h not found)"])
922 if test "x$with_libpcap" = "xyes"
928 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
929 [Wether or not to use the pcap library])
930 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
932 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
934 if test "x$withval" != "xno" && test "x$withval" != "xyes"
936 LDFLAGS="$LDFLAGS -L$withval/lib"
937 CPPFLAGS="$CPPFLAGS -I$withval/include"
942 if test "x$ac_system" = "xLinux"
946 with_libiptc="no (Linux only)"
949 if test "x$with_libiptc" = "xyes"
951 AC_CHECK_LIB(iptc, iptc_init,
953 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
954 ], [with_libiptc="no (libiptc not found)"])
956 if test "x$with_libiptc" = "xyes"
958 AC_CHECK_HEADERS(libiptc/libiptc.h,
960 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
961 ], [with_libiptc="no (libiptc/libiptc.h not found)"])
963 if test "x$with_libiptc" = "xyes"
969 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
971 # Define `step' and `hearbeat' values..
972 declare -i collectd_step=10
973 declare -i collectd_heartbeat=25
974 AC_ARG_WITH(step, [AS_HELP_STRING([--with-step=SECONDS], [Interval in which plugins are queried.])],
976 if test "x$withval" != "xno" -a "x$withval" != "xyes"
978 declare -i tmp_collectd_step="$withval"
979 if test $tmp_collectd_step -gt 0
981 collectd_step=$tmp_collectd_step
982 let "collectd_heartbeat=$collectd_step*2"
986 AC_ARG_WITH(heartbeat, [AS_HELP_STRING([--with-heartbeat=SECONDS], [Heartbeat of the DS in generated RRD files.])],
988 if test "x$withval" != "xno" -a "x$withval" != "xyes"
990 declare -i tmp_collectd_heartbeat="$withval"
991 if test $tmp_collectd_heartbeat -gt 0
993 collectd_heartbeat=$tmp_collectd_heartbeat
998 if test $collectd_step -ne 10
1000 AC_DEFINE_UNQUOTED(COLLECTD_STEP, "$collectd_step", [Interval in which plugins are queried.])
1002 if test $collectd_heartbeat -ne 25
1004 AC_DEFINE_UNQUOTED(COLLECTD_HEARTBEAT, "$collectd_heartbeat", [Interval in which plugins are queried.])
1007 # Check for enabled/disabled features
1010 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
1011 # ------------------------------------------------------------
1013 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
1018 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
1023 m4_define([EnDis],[disabled])dnl
1024 m4_define([YesNo],[no])dnl
1030 m4_define([EnDis],[enabled])dnl
1031 m4_define([YesNo],[yes])dnl
1034 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
1038 m4_if([$3], [feature], [],
1042 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
1048 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
1050 enable_$1='[YesNo]'dnl
1052 if test "x$enable_$1" = "xno"
1056 if test "x$enable_$1" = "xyes"
1060 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
1065 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
1066 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
1068 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
1070 m4_divert_once([HELP_ENABLE], [
1071 collectd features:])
1072 AC_COLLECTD([debug], [enable], [feature], [debugging])
1073 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
1074 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
1076 m4_divert_once([HELP_ENABLE], [
1078 AC_COLLECTD([apache], [disable], [module], [Apache httpd statistics])
1079 AC_COLLECTD([apcups], [disable], [module], [Statistics of UPSes by APC])
1080 AC_COLLECTD([apple_sensors], [disable], [module], [Apple's hardware sensors])
1081 AC_COLLECTD([battery], [disable], [module], [battery statistics])
1082 AC_COLLECTD([cpu], [disable], [module], [cpu usage statistics])
1083 AC_COLLECTD([cpufreq], [disable], [module], [system cpu frequency statistics])
1084 AC_COLLECTD([disk], [disable], [module], [disk/partition statistics])
1085 AC_COLLECTD([df], [disable], [module], [df statistics])
1086 AC_COLLECTD([dns], [disable], [module], [dns statistics])
1087 AC_COLLECTD([email], [disable], [module], [email statistics])
1088 AC_COLLECTD([quota], [enable], [module], [quota statistics (experimental)])
1089 AC_COLLECTD([hddtemp], [disable], [module], [hdd temperature statistics])
1090 AC_COLLECTD([iptables], [disable], [module], [IPtables statistics])
1091 AC_COLLECTD([load], [disable], [module], [system load statistics])
1092 AC_COLLECTD([mbmon], [disable], [module], [motherboard monitor statistics])
1093 AC_COLLECTD([memory], [disable], [module], [memory statistics])
1094 AC_COLLECTD([multimeter],[disable], [module], [multimeter statistics])
1095 AC_COLLECTD([mysql], [disable], [module], [mysql statistics])
1096 AC_COLLECTD([nfs], [disable], [module], [nfs statistics])
1097 AC_COLLECTD([ntpd], [disable], [module], [nfs statistics])
1098 AC_COLLECTD([ping], [disable], [module], [ping statistics])
1099 AC_COLLECTD([processes], [disable], [module], [processes statistics])
1100 AC_COLLECTD([sensors], [disable], [module], [lm_sensors statistics])
1101 AC_COLLECTD([serial], [disable], [module], [serial statistics])
1102 AC_COLLECTD([swap], [disable], [module], [swap statistics])
1103 AC_COLLECTD([tape], [disable], [module], [tape statistics])
1104 AC_COLLECTD([traffic], [disable], [module], [system traffic statistics])
1105 AC_COLLECTD([users], [disable], [module], [user count statistics])
1106 AC_COLLECTD([vserver], [disable], [module], [vserver statistics])
1107 AC_COLLECTD([wireless], [disable], [module], [wireless link statistics])
1109 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libconfig/Makefile src/liboping/Makefile)
1115 libcurl . . . . . . $with_libcurl
1116 libiokit . . . . . $with_libiokit
1117 liboping . . . . . $with_liboping
1118 librrd . . . . . . $with_rrdtool
1119 lm_sensors . . . . $with_lm_sensors
1120 libstatgrab . . . . $with_libstatgrab
1121 libkstat . . . . . $with_kstat
1122 libmysql . . . . . $with_libmysql
1123 libpcap . . . . . . $with_libpcap
1124 libiptc . . . . . . $with_libiptc
1125 libpthread . . . . $with_libpthread
1128 debug . . . . . . . $enable_debug
1129 daemon mode . . . . $enable_daemon
1130 step . . . . . . . $collectd_step seconds
1131 heartbeat . . . . . $collectd_heartbeat seconds
1134 apache . . . . . . $enable_apache
1135 apcups . . . . . . $enable_apcups
1136 apple_sensors . . . $enable_apple_sensors
1137 battery . . . . . . $enable_battery
1138 cpu . . . . . . . . $enable_cpu
1139 cpufreq . . . . . . $enable_cpufreq
1140 df . . . . . . . . $enable_df
1141 disk . . . . . . . $enable_disk
1142 dns . . . . . . . . $enable_dns
1143 email . . . . . . . $enable_email
1144 hddtemp . . . . . . $enable_hddtemp
1145 load . . . . . . . $enable_load
1146 mbmon . . . . . . . $enable_mbmon
1147 memory . . . . . . $enable_memory
1148 multimeter . . . . $enable_multimeter
1149 mysql . . . . . . . $enable_mysql
1150 nfs . . . . . . . . $enable_nfs
1151 ntpd . . . . . . . $enable_ntpd
1152 ping . . . . . . . $enable_ping
1153 processes . . . . . $enable_processes
1154 sensors . . . . . . $enable_sensors
1155 serial . . . . . . $enable_serial
1156 swap . . . . . . . $enable_swap
1157 tape . . . . . . . $enable_tape
1158 traffic . . . . . . $enable_traffic
1159 users . . . . . . . $enable_users
1160 vserver . . . . . . $enable_vserver
1161 wireless . . . . . $enable_wireless