1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, 3.11.4)
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")
13 # Checks for programs.
20 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
24 AC_LIBLTDL_CONVENIENCE
30 AC_CONFIG_SUBDIRS(libltdl)
33 # Checks for header files.
38 AC_CHECK_HEADERS(stdint.h)
39 AC_CHECK_HEADERS(stdio.h)
40 AC_CHECK_HEADERS(errno.h)
41 AC_CHECK_HEADERS(math.h)
42 AC_CHECK_HEADERS(syslog.h)
43 AC_CHECK_HEADERS(fcntl.h)
44 AC_CHECK_HEADERS(signal.h)
45 AC_CHECK_HEADERS(assert.h)
46 AC_CHECK_HEADERS(sys/types.h)
47 AC_CHECK_HEADERS(sys/socket.h)
48 AC_CHECK_HEADERS(sys/select.h)
49 AC_CHECK_HEADERS(sys/poll.h)
50 AC_CHECK_HEADERS(netdb.h)
51 AC_CHECK_HEADERS(arpa/inet.h)
52 AC_CHECK_HEADERS(sys/resource.h)
53 AC_CHECK_HEADERS(sys/param.h)
56 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
61 # include <sys/types.h>
64 AC_CHECK_HEADERS(netinet/in.h, [], [],
69 # include <sys/types.h>
71 #if HAVE_NETINET_IN_SYSTM_H
72 # include <netinet/in_systm.h>
75 AC_CHECK_HEADERS(netinet/ip.h, [], [],
80 # include <sys/types.h>
82 #if HAVE_NETINET_IN_SYSTM_H
83 # include <netinet/in_systm.h>
86 # include <netinet/in.h>
89 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
94 # include <sys/types.h>
96 #if HAVE_NETINET_IN_SYSTM_H
97 # include <netinet/in_systm.h>
100 # include <netinet/in.h>
102 #if HAVE_NETINET_IP_H
103 # include <netinet/ip.h>
106 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
111 # include <sys/types.h>
113 #if HAVE_NETINET_IN_SYSTM_H
114 # include <netinet/in_systm.h>
116 #if HAVE_NETINET_IN_H
117 # include <netinet/in.h>
119 #if HAVE_NETINET_IP_H
120 # include <netinet/ip.h>
123 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
128 # include <sys/types.h>
130 #if HAVE_NETINET_IN_SYSTM_H
131 # include <netinet/in_systm.h>
133 #if HAVE_NETINET_IN_H
134 # include <netinet/in.h>
137 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
142 # include <sys/types.h>
144 #if HAVE_NETINET_IN_SYSTM_H
145 # include <netinet/in_systm.h>
147 #if HAVE_NETINET_IN_H
148 # include <netinet/in.h>
150 #if HAVE_NETINET_IP6_H
151 # include <netinet/ip6.h>
154 AC_CHECK_HEADERS(netinet/udp.h, [], [],
159 # include <sys/types.h>
161 #if HAVE_NETINET_IN_SYSTM_H
162 # include <netinet/in_systm.h>
164 #if HAVE_NETINET_IN_H
165 # include <netinet/in.h>
167 #if HAVE_NETINET_IP_H
168 # include <netinet/ip.h>
173 AC_CHECK_HEADERS(sys/sysctl.h sys/dkstat.h)
174 AC_CHECK_HEADERS(mach/mach_init.h)
175 AC_CHECK_HEADERS(mach/host_priv.h)
176 AC_CHECK_HEADERS(mach/mach_error.h)
177 AC_CHECK_HEADERS(mach/mach_host.h)
178 AC_CHECK_HEADERS(mach/mach_port.h)
179 AC_CHECK_HEADERS(mach/mach_types.h)
180 AC_CHECK_HEADERS(mach/message.h)
181 AC_CHECK_HEADERS(mach/processor_set.h)
182 AC_CHECK_HEADERS(mach/processor.h)
183 AC_CHECK_HEADERS(mach/processor_info.h)
184 AC_CHECK_HEADERS(mach/task.h)
185 AC_CHECK_HEADERS(mach/thread_act.h)
186 AC_CHECK_HEADERS(mach/vm_region.h)
187 AC_CHECK_HEADERS(mach/vm_map.h)
188 AC_CHECK_HEADERS(mach/vm_prot.h)
189 AC_CHECK_HEADERS(mach/vm_statistics.h)
190 AC_CHECK_HEADERS(mach/kern_return.h)
193 AC_CHECK_HEADERS(linux/major.h)
195 # For the apple_sensors module
196 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h)
197 AC_CHECK_HEADERS(IOKit/IOKitLib.h)
198 AC_CHECK_HEADERS(IOKit/IOTypes.h)
200 # For the battery plugin
201 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
203 #if HAVE_IOKIT_IOKITLIB_H
204 # include <IOKit/IOKitLib.h>
206 #if HAVE_IOKIT_IOTYPES_H
207 # include <IOKit/IOTypes.h>
210 AC_CHECK_HEADERS(IOKit/ps/IOPSKeys.h)
212 # For the `disk' plugin
213 AC_CHECK_HEADERS(IOKit/IOBSD.h)
214 AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDriver.h)
217 AC_CHECK_HEADERS(sys/loadavg.h)
219 # For the processes plugin
220 AC_CHECK_HEADERS(linux/config.h)
222 # For the swap module
223 AC_CHECK_HEADERS(sys/swap.h)
226 AC_CHECK_HEADERS(utmp.h)
227 AC_CHECK_HEADERS(utmpx.h)
230 AC_CHECK_HEADERS(ifaddrs.h)
231 AC_CHECK_HEADERS(net/if.h, [], [],
234 # include <sys/types.h>
236 #if HAVE_SYS_SOCKET_H
237 # include <sys/socket.h>
240 AC_CHECK_HEADERS(linux/if.h, [], [],
243 # include <sys/types.h>
245 #if HAVE_SYS_SOCKET_H
246 # include <sys/socket.h>
249 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
252 # include <sys/types.h>
254 #if HAVE_SYS_SOCKET_H
255 # include <sys/socket.h>
258 # include <linux/if.h>
263 AC_CHECK_HEADERS(curl/curl.h)
266 AC_CHECK_HEADERS(grp.h pwd.h sys/ucred.h)
267 AC_CHECK_HEADERS(ctype.h)
268 AC_CHECK_HEADERS(limits.h)
269 AC_CHECK_HEADERS(sys/quota.h)
270 AC_CHECK_HEADERS(xfs/xqm.h)
272 # For mount interface
273 AC_CHECK_HEADERS(fs_info.h)
274 AC_CHECK_HEADERS(fshelp.h)
275 AC_CHECK_HEADERS(paths.h)
276 AC_CHECK_HEADERS(mntent.h)
277 AC_CHECK_HEADERS(mnttab.h)
278 AC_CHECK_HEADERS(sys/fstyp.h)
279 AC_CHECK_HEADERS(sys/fs_types.h)
280 AC_CHECK_HEADERS(sys/mntent.h)
281 AC_CHECK_HEADERS(sys/mnttab.h)
282 AC_CHECK_HEADERS(sys/mount.h)
283 AC_CHECK_HEADERS(sys/statfs.h)
284 AC_CHECK_HEADERS(sys/statvfs.h)
285 AC_CHECK_HEADERS(sys/vfs.h)
286 AC_CHECK_HEADERS(sys/vfstab.h)
288 # For the swap plugin, FreeBSD
289 AC_CHECK_HEADERS(kvm.h)
291 # For the email plugin
292 AC_CHECK_HEADERS(linux/un.h, [], [],
294 #if HAVE_SYS_SOCKET_H
295 # include <sys/socket.h>
298 AC_CHECK_HEADERS(sys/un.h)
299 AC_CHECK_HEADERS(grp.h)
301 # For debugging interface (variable number of arguments)
302 AC_CHECK_HEADERS(stdarg.h)
304 # Regular expressions for the ignorelist.
305 AC_CHECK_HEADERS(regex.h)
308 AC_CHECK_HEADERS(arpa/nameser.h arpa/nameser_compat.h)
310 AC_CHECK_HEADERS(net/if_arp.h, [], [],
311 [#if HAVE_SYS_SOCKET_H
312 # include <sys/socket.h>
315 AC_CHECK_HEADERS(net/if_ppp.h)
316 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
321 # include <sys/types.h>
323 #if HAVE_SYS_SOCKET_H
324 # include <sys/socket.h>
329 #if HAVE_NETINET_IN_H
330 # include <netinet/in.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)
389 AC_CHECK_FUNCS(getifaddrs)
391 # For mount interface
392 #AC_CHECK_FUNCS(getfsent getvfsent)
395 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
397 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
399 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
402 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
403 if test "x$have_getmntent" = "xno"; then
404 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
406 if test "x$have_getmntent" = "xno"; then
407 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
409 if test "x$have_getmntent" = "xno"; then
410 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
413 if test "x$have_getmntent" = "xc"; then
414 AC_CACHE_CHECK([whether getmntent takes one argument],
415 [have_one_getmntent],
417 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
419 #include "$srcdir/src/utils_mount.h"]],
423 fh = setmntent ("/etc/mtab", "r");
427 [have_one_getmntent="yes"],
428 [have_one_getmntent="no"]
431 AC_CACHE_CHECK([whether getmntent takes two arguments],
432 [have_two_getmntent],
434 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
435 #include <sys/mnttab.h>
436 #include "$srcdir/src/utils_mount.h"]],
441 fh = fopen ("/etc/mnttab", "r");
442 status = getmntent (fh, &mt);
445 [have_two_getmntent="yes"],
446 [have_two_getmntent="no"]
451 # Check for different versions of `getmntent' here..
453 if test "x$have_getmntent" = "xc"; then
454 if test "x$have_one_getmntent" = "xyes"; then
455 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
456 [Define if the function getmntent exists and takes one argument.])
458 if test "x$have_two_getmntent" = "xyes"; then
459 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
460 [Define if the function getmntent exists and takes two arguments.])
463 if test "x$have_getmntent" = "xsun"; then
464 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
465 [Define if the function getmntent exists. It's the version from libsun.])
467 if test "x$have_getmntent" = "xseq"; then
468 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
469 [Define if the function getmntent exists. It's the version from libseq.])
471 if test "x$have_getmntent" = "xgen"; then
472 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
473 [Define if the function getmntent exists. It's the version from libgen.])
476 # Check for structures
477 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
478 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
481 #include <sys/types.h>
482 #include <sys/socket.h>
485 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
486 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
489 #include <sys/types.h>
490 #include <sys/socket.h>
491 #include <linux/if.h>
492 #include <linux/netdevice.h>
495 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
500 # include <sys/types.h>
502 #if HAVE_NETINET_IN_SYSTM_H
503 # include <netinet/in_systm.h>
505 #if HAVE_NETINET_IN_H
506 # include <netinet/in.h>
508 #if HAVE_NETINET_IP_H
509 # include <netinet/ip.h>
511 #if HAVE_NETINET_UDP_H
512 # include <netinet/udp.h>
515 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
520 # include <sys/types.h>
522 #if HAVE_NETINET_IN_SYSTM_H
523 # include <netinet/in_systm.h>
525 #if HAVE_NETINET_IN_H
526 # include <netinet/in.h>
528 #if HAVE_NETINET_IP_H
529 # include <netinet/ip.h>
531 #if HAVE_NETINET_UDP_H
532 # include <netinet/udp.h>
536 AC_MSG_CHECKING([for kernel type ($host_os)])
539 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
543 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
549 AC_MSG_RESULT([$ac_system])
552 AC_CHECK_LIB(resolv, res_search,
554 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
556 [with_libresolv="no"])
557 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
560 m4_divert_once([HELP_WITH], [
561 collectd additional packages:])
563 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
564 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
565 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
567 LDFLAGS="$LDFLAGS -L$withval/lib"
568 CPPFLAGS="$CPPFLAGS -I$withval/include"
571 ], [with_rrdtool="yes"])
572 if test "x$with_rrdtool" = "xyes"
574 AC_CHECK_LIB(rrd, rrd_update,
576 AC_DEFINE(HAVE_LIBRRD, 1, [Define to 1 if you have the rrd library (-lrrd).])
578 [with_rrdtool="no (librrd not found)"], [-lm])
580 if test "x$with_rrdtool" = "xyes"
582 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
584 if test "x$with_rrdtool" = "xyes"
590 AC_DEFINE_UNQUOTED(COLLECT_RRDTOOL, [$collect_rrdtool],
591 [Wether or not to use rrdtool library])
592 AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
594 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
595 [ if test "x$withval" != "xno" -a "x$withval" != "xyes"
597 LDFLAGS="$LDFLAGS -L$withval/lib"
598 CPPFLAGS="$CPPFLAGS -I$withval/include"
599 with_libpthread="yes"
601 if test "x$withval" = "xno"
603 with_libpthread="no (disabled)"
606 ], [with_libpthread="yes"])
607 if test "x$with_libpthread" = "xyes"
609 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
611 if test "x$with_libpthread" = "xyes"
613 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
615 if test "x$with_libpthread" = "xyes"
621 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
622 [Wether or not to use pthread (POSIX threads) library])
623 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
625 if test "$ac_system" = "Solaris"
630 with_kstat="no (Solaris only)"
631 with_devinfo="no (Solaris only)"
634 if test "x$with_kstat" = "xyes"
636 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
638 if test "x$with_kstat" = "xyes"
640 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
641 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
643 if test "x$with_kstat" = "xyes"
645 AC_DEFINE(HAVE_LIBKSTAT, 1,
646 [Define to 1 if you have the 'kstat' library (-lkstat)])
648 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
649 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
651 ### BEGIN of check for libcurl ###
652 with_curl_config="curl-config"
655 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
657 if test "x$withval" != "xno" -a "x$withval" != "xyes"
659 if test -x "$withval/bin/curl-config"
661 with_curl_config="$withval/bin/curl-config"
665 if test "x$withval" = "xno"
675 if test "x$with_libcurl" = "xyes"
677 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
678 curl_config_status=$?
680 if test $curl_config_status -ne 0
684 AC_CHECK_LIB(curl, curl_easy_init,
686 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
687 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
695 if test "x$with_libcurl" = "xyes" -a $with_curl_prefix -ne 0
697 with_curl_prefix=`$with_curl_config --libs 2>/dev/null`
698 curl_config_status=$?
700 if test $curl_config_status -ne 0
704 if test -d "$with_curl_prefix/include"
706 CPPFLAGS="$CPPFLAGS -I$with_curl_prefix/include"
711 with_libcurl_numeric=0
712 if test "x$with_libcurl" = "xyes"
714 with_libcurl_numeric=1
716 AC_DEFINE_UNQUOTED(HAVE_LIBCURL, [$with_libcurl_numeric], [Define to 1 if you have the 'curl' library (-lcurl).])
717 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
718 ### END of check for libcurl ###
722 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
731 AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
732 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
734 with_libstatgrab="yes"
736 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
738 if test "x$withval" != "xno" -a "x$withval" != "xyes"
740 LDFLAGS="$LDFLAGS -L$withval/lib"
741 CPPFLAGS="$CPPFLAGS -I$withval/include"
742 with_libstatgrab="yes"
746 if test "x$ac_system" == "xunknown"
748 with_libstatgrab="yes"
750 with_libstatgrab="no"
753 if test "x$with_libstatgrab" = "xyes"
755 AC_CHECK_LIB(statgrab, sg_init, [with_libstatgrab="yes"], [with_libstatgrab="no (libstatgrab not found)"])
757 if test "x$with_libstatgrab" = "xyes"
759 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (statgrab.h not found)"])
761 if test "x$with_libstatgrab" = "xyes"
763 AC_CHECK_LIB(devstat, getdevs, [with_libdevstat="yes"], [with_libdevstat="no"])
765 if test "x$with_libstatgrab" = "xyes"
767 collect_libstatgrab=1
769 collect_libstatgrab=0
771 AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
772 [Wether or not to use statgrab library])
773 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
774 AM_CONDITIONAL(BUILD_WITH_LIBDEVSTAT, test "x$with_libdevstat" = "xyes")
776 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
777 if test "x$with_libkvm" = "xyes"
779 AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
781 AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
783 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
785 if test "x$withval" != "xno" && test "x$withval" != "xyes"
787 LDFLAGS="$LDFLAGS -L$withval/lib"
788 CPPFLAGS="$CPPFLAGS -I$withval/include"
789 with_lm_sensors="yes"
793 if test "x$ac_system" = "xLinux"
795 with_lm_sensors="yes"
800 if test "x$with_lm_sensors" = "xyes"
802 AC_CHECK_LIB(sensors, sensors_init,
804 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
806 [with_lm_sensors="no (libsensors not found)"])
808 if test "x$with_lm_sensors" = "xyes"
810 AC_CHECK_HEADERS(sensors/sensors.h,
812 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
814 [with_lm_sensors="no (sensors/sensors.h not found)"])
816 if test "x$with_lm_sensors" = "xyes"
822 AC_DEFINE_UNQUOTED(COLLECT_LM_SENSORS, [$collect_lm_sensors],
823 [Wether or not to use sensors library])
824 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
826 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
828 if test "x$withval" != "xno" && test "x$withval" != "xyes"
830 LDFLAGS="$LDFLAGS -L$withval/lib"
831 CPPFLAGS="$CPPFLAGS -I$withval/include"
838 if test "x$with_libmysql" = "xyes"
840 AC_CHECK_LIB(mysqlclient, mysql_init,
842 AC_DEFINE(HAVE_LIBMYSQLCLIENT, 1, [Define to 1 if you have the mysqlclient library (-lmysqlclient).])
843 ], [with_libmysql="no (libmysql not found)"])
845 if test "x$with_libmysql" = "xyes"
847 AC_CHECK_HEADERS(mysql/mysql.h,
849 AC_DEFINE(HAVE_MYSQL_MYSQL_H, 1, [Define to 1 if you have the <mysql/mysql.h> header file.])
850 ], [with_libmysql="no (mysql/mysql.h not found)"])
852 if test "x$with_libmysql" = "xyes"
858 AC_DEFINE_UNQUOTED(COLLECT_LIBMYSQL, [$collect_libmysql],
859 [Wether or not to use mysql library])
860 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
863 with_own_liboping="no"
864 liboping_LDFLAGS="$LDFLAGS"
865 liboping_CPPFLAGS="$CPPFLAGS"
866 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
868 if test "x$withval" != "xno" && test "x$withval" != "xyes"
870 if test -d "$withval/lib"
872 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
874 if test -d "$withval/include"
876 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
879 if test "x$withval" = "xno"
882 with_own_liboping="no"
890 if test "x$with_liboping" = "xyes"
892 save_LDFLAGS="$LDFLAGS"
893 save_CPPFLAGS="$CPPFLAGS"
894 LDFLAGS="$liboping_LDFLAGS"
895 CPPFLAGS="$liboping_CPPFLAGS"
896 AC_CHECK_LIB(oping, ping_construct,
899 with_own_liboping="no"
903 with_own_liboping="yes"
904 LDFLAGS="$save_LDFLAGS"
905 CPPFLAGS="$save_CPPFLAGS"
908 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
909 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
910 if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
912 with_liboping="yes (shipped version)"
915 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
917 if test "x$withval" != "xno" && test "x$withval" != "xyes"
919 LDFLAGS="$LDFLAGS -L$withval/lib"
920 CPPFLAGS="$CPPFLAGS -I$withval/include"
927 if test "x$with_libpcap" = "xyes"
929 AC_CHECK_LIB(pcap, pcap_open_live,
931 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
932 ], [with_libpcap="no (libpcap not found)"])
934 if test "x$with_libpcap" = "xyes"
936 AC_CHECK_HEADERS(pcap.h,
938 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
939 ], [with_libpcap="no (pcap.h not found)"])
941 if test "x$with_libpcap" = "xyes"
947 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
948 [Wether or not to use the pcap library])
949 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
951 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
953 if test "x$withval" != "xno" && test "x$withval" != "xyes"
955 LDFLAGS="$LDFLAGS -L$withval/lib"
956 CPPFLAGS="$CPPFLAGS -I$withval/include"
961 if test "x$ac_system" = "xLinux"
965 with_libiptc="no (Linux only)"
968 if test "x$with_libiptc" = "xyes"
970 AC_CHECK_LIB(iptc, iptc_init,
972 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
973 ], [with_libiptc="no (libiptc not found)"])
975 if test "x$with_libiptc" = "xyes"
977 AC_CHECK_HEADERS(libiptc/libiptc.h,
979 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
980 ], [with_libiptc="no (libiptc/libiptc.h not found)"])
982 if test "x$with_libiptc" = "xyes"
988 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
990 # Define `step' and `hearbeat' values..
991 declare -i collectd_step=10
992 declare -i collectd_heartbeat=25
993 AC_ARG_WITH(step, [AS_HELP_STRING([--with-step=SECONDS], [Interval in which plugins are queried.])],
995 if test "x$withval" != "xno" -a "x$withval" != "xyes"
997 declare -i tmp_collectd_step="$withval"
998 if test $tmp_collectd_step -gt 0
1000 collectd_step=$tmp_collectd_step
1001 let "collectd_heartbeat=$collectd_step*2"
1005 AC_ARG_WITH(heartbeat, [AS_HELP_STRING([--with-heartbeat=SECONDS], [Heartbeat of the DS in generated RRD files.])],
1007 if test "x$withval" != "xno" -a "x$withval" != "xyes"
1009 declare -i tmp_collectd_heartbeat="$withval"
1010 if test $tmp_collectd_heartbeat -gt 0
1012 collectd_heartbeat=$tmp_collectd_heartbeat
1017 if test $collectd_step -ne 10
1019 AC_DEFINE_UNQUOTED(COLLECTD_STEP, "$collectd_step", [Interval in which plugins are queried.])
1021 if test $collectd_heartbeat -ne 25
1023 AC_DEFINE_UNQUOTED(COLLECTD_HEARTBEAT, "$collectd_heartbeat", [Interval in which plugins are queried.])
1026 # Check for enabled/disabled features
1029 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
1030 # ------------------------------------------------------------
1032 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
1037 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
1042 m4_define([EnDis],[disabled])dnl
1043 m4_define([YesNo],[no])dnl
1049 m4_define([EnDis],[enabled])dnl
1050 m4_define([YesNo],[yes])dnl
1053 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
1057 m4_if([$3], [feature], [],
1061 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
1067 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
1069 enable_$1='[YesNo]'dnl
1071 if test "x$enable_$1" = "xno"
1075 if test "x$enable_$1" = "xyes"
1079 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
1084 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
1085 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
1087 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
1089 m4_divert_once([HELP_ENABLE], [
1090 collectd features:])
1091 AC_COLLECTD([debug], [enable], [feature], [debugging])
1092 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
1093 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
1095 m4_divert_once([HELP_ENABLE], [
1097 AC_COLLECTD([apache], [disable], [module], [Apache httpd statistics])
1098 AC_COLLECTD([apcups], [disable], [module], [Statistics of UPSes by APC])
1099 AC_COLLECTD([apple_sensors], [disable], [module], [Apple's hardware sensors])
1100 AC_COLLECTD([battery], [disable], [module], [battery statistics])
1101 AC_COLLECTD([cpu], [disable], [module], [cpu usage statistics])
1102 AC_COLLECTD([cpufreq], [disable], [module], [system cpu frequency statistics])
1103 AC_COLLECTD([disk], [disable], [module], [disk/partition statistics])
1104 AC_COLLECTD([df], [disable], [module], [df statistics])
1105 AC_COLLECTD([dns], [disable], [module], [dns statistics])
1106 AC_COLLECTD([email], [disable], [module], [email statistics])
1107 AC_COLLECTD([quota], [enable], [module], [quota statistics (experimental)])
1108 AC_COLLECTD([hddtemp], [disable], [module], [hdd temperature statistics])
1109 AC_COLLECTD([iptables], [disable], [module], [IPtables statistics])
1110 AC_COLLECTD([irq], [disable], [module], [irq statistics])
1111 AC_COLLECTD([load], [disable], [module], [system load statistics])
1112 AC_COLLECTD([mbmon], [disable], [module], [motherboard monitor statistics])
1113 AC_COLLECTD([memory], [disable], [module], [memory statistics])
1114 AC_COLLECTD([multimeter],[disable], [module], [multimeter statistics])
1115 AC_COLLECTD([mysql], [disable], [module], [mysql statistics])
1116 AC_COLLECTD([nfs], [disable], [module], [nfs statistics])
1117 AC_COLLECTD([ntpd], [disable], [module], [ntpd statistics])
1118 AC_COLLECTD([ping], [disable], [module], [ping statistics])
1119 AC_COLLECTD([processes], [disable], [module], [processes statistics])
1120 AC_COLLECTD([sensors], [disable], [module], [lm_sensors statistics])
1121 AC_COLLECTD([serial], [disable], [module], [serial statistics])
1122 AC_COLLECTD([swap], [disable], [module], [swap statistics])
1123 AC_COLLECTD([tape], [disable], [module], [tape statistics])
1124 AC_COLLECTD([traffic], [disable], [module], [system traffic statistics])
1125 AC_COLLECTD([users], [disable], [module], [user count statistics])
1126 AC_COLLECTD([vserver], [disable], [module], [vserver statistics])
1127 AC_COLLECTD([wireless], [disable], [module], [wireless link statistics])
1129 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libconfig/Makefile src/liboping/Makefile)
1135 libcurl . . . . . . $with_libcurl
1136 libiokit . . . . . $with_libiokit
1137 liboping . . . . . $with_liboping
1138 librrd . . . . . . $with_rrdtool
1139 lm_sensors . . . . $with_lm_sensors
1140 libstatgrab . . . . $with_libstatgrab
1141 libkstat . . . . . $with_kstat
1142 libmysql . . . . . $with_libmysql
1143 libpcap . . . . . . $with_libpcap
1144 libiptc . . . . . . $with_libiptc
1145 libpthread . . . . $with_libpthread
1148 debug . . . . . . . $enable_debug
1149 daemon mode . . . . $enable_daemon
1150 step . . . . . . . $collectd_step seconds
1151 heartbeat . . . . . $collectd_heartbeat seconds
1154 apache . . . . . . $enable_apache
1155 apcups . . . . . . $enable_apcups
1156 apple_sensors . . . $enable_apple_sensors
1157 battery . . . . . . $enable_battery
1158 cpu . . . . . . . . $enable_cpu
1159 cpufreq . . . . . . $enable_cpufreq
1160 df . . . . . . . . $enable_df
1161 disk . . . . . . . $enable_disk
1162 dns . . . . . . . . $enable_dns
1163 email . . . . . . . $enable_email
1164 hddtemp . . . . . . $enable_hddtemp
1165 irq . . . . . . . . $enable_irq
1166 iptables . . . . . $enable_iptables
1167 load . . . . . . . $enable_load
1168 mbmon . . . . . . . $enable_mbmon
1169 memory . . . . . . $enable_memory
1170 multimeter . . . . $enable_multimeter
1171 mysql . . . . . . . $enable_mysql
1172 nfs . . . . . . . . $enable_nfs
1173 ntpd . . . . . . . $enable_ntpd
1174 ping . . . . . . . $enable_ping
1175 processes . . . . . $enable_processes
1176 sensors . . . . . . $enable_sensors
1177 serial . . . . . . $enable_serial
1178 swap . . . . . . . $enable_swap
1179 tape . . . . . . . $enable_tape
1180 traffic . . . . . . $enable_traffic
1181 users . . . . . . . $enable_users
1182 vserver . . . . . . $enable_vserver
1183 wireless . . . . . $enable_wireless