1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, 4.0.0-rc7)
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)
53 AC_CHECK_HEADERS(kstat.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/tcp.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>
171 AC_CHECK_HEADERS(netinet/udp.h, [], [],
176 # include <sys/types.h>
178 #if HAVE_NETINET_IN_SYSTM_H
179 # include <netinet/in_systm.h>
181 #if HAVE_NETINET_IN_H
182 # include <netinet/in.h>
184 #if HAVE_NETINET_IP_H
185 # include <netinet/ip.h>
190 AC_CHECK_HEADERS(sys/sysctl.h sys/dkstat.h)
191 AC_CHECK_HEADERS(mach/mach_init.h)
192 AC_CHECK_HEADERS(mach/host_priv.h)
193 AC_CHECK_HEADERS(mach/mach_error.h)
194 AC_CHECK_HEADERS(mach/mach_host.h)
195 AC_CHECK_HEADERS(mach/mach_port.h)
196 AC_CHECK_HEADERS(mach/mach_types.h)
197 AC_CHECK_HEADERS(mach/message.h)
198 AC_CHECK_HEADERS(mach/processor_set.h)
199 AC_CHECK_HEADERS(mach/processor.h)
200 AC_CHECK_HEADERS(mach/processor_info.h)
201 AC_CHECK_HEADERS(mach/task.h)
202 AC_CHECK_HEADERS(mach/thread_act.h)
203 AC_CHECK_HEADERS(mach/vm_region.h)
204 AC_CHECK_HEADERS(mach/vm_map.h)
205 AC_CHECK_HEADERS(mach/vm_prot.h)
206 AC_CHECK_HEADERS(mach/vm_statistics.h)
207 AC_CHECK_HEADERS(mach/kern_return.h)
210 AC_CHECK_HEADERS(linux/major.h)
211 AC_CHECK_HEADERS(libgen.h)
213 # For the apple_sensors module
214 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h)
215 AC_CHECK_HEADERS(IOKit/IOKitLib.h)
216 AC_CHECK_HEADERS(IOKit/IOTypes.h)
218 # For the battery plugin
219 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
221 #if HAVE_IOKIT_IOKITLIB_H
222 # include <IOKit/IOKitLib.h>
224 #if HAVE_IOKIT_IOTYPES_H
225 # include <IOKit/IOTypes.h>
228 AC_CHECK_HEADERS(IOKit/ps/IOPSKeys.h)
230 # For the `disk' plugin
231 AC_CHECK_HEADERS(IOKit/IOBSD.h)
232 AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDriver.h)
235 AC_CHECK_HEADERS(sys/loadavg.h)
237 # For the processes plugin
238 AC_CHECK_HEADERS(linux/config.h)
240 # For the swap module
241 AC_CHECK_HEADERS(sys/swap.h)
244 AC_CHECK_HEADERS(utmp.h)
245 AC_CHECK_HEADERS(utmpx.h)
247 # For interface plugin
248 AC_CHECK_HEADERS(ifaddrs.h)
249 AC_CHECK_HEADERS(net/if.h, [], [],
252 # include <sys/types.h>
254 #if HAVE_SYS_SOCKET_H
255 # include <sys/socket.h>
258 AC_CHECK_HEADERS(linux/if.h, [], [],
261 # include <sys/types.h>
263 #if HAVE_SYS_SOCKET_H
264 # include <sys/socket.h>
267 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
270 # include <sys/types.h>
272 #if HAVE_SYS_SOCKET_H
273 # include <sys/socket.h>
276 # include <linux/if.h>
281 AC_CHECK_HEADERS(curl/curl.h)
284 AC_CHECK_HEADERS(grp.h pwd.h sys/ucred.h)
285 AC_CHECK_HEADERS(ctype.h)
286 AC_CHECK_HEADERS(limits.h)
287 AC_CHECK_HEADERS(sys/quota.h)
288 AC_CHECK_HEADERS(xfs/xqm.h)
290 # For mount interface
291 AC_CHECK_HEADERS(fs_info.h)
292 AC_CHECK_HEADERS(fshelp.h)
293 AC_CHECK_HEADERS(paths.h)
294 AC_CHECK_HEADERS(mntent.h)
295 AC_CHECK_HEADERS(mnttab.h)
296 AC_CHECK_HEADERS(sys/fstyp.h)
297 AC_CHECK_HEADERS(sys/fs_types.h)
298 AC_CHECK_HEADERS(sys/mntent.h)
299 AC_CHECK_HEADERS(sys/mnttab.h)
300 AC_CHECK_HEADERS(sys/mount.h)
301 AC_CHECK_HEADERS(sys/statfs.h)
302 AC_CHECK_HEADERS(sys/statvfs.h)
303 AC_CHECK_HEADERS(sys/vfs.h)
304 AC_CHECK_HEADERS(sys/vfstab.h)
306 # For the swap plugin, FreeBSD
307 AC_CHECK_HEADERS(kvm.h)
309 # For the email plugin
310 AC_CHECK_HEADERS(linux/un.h, [], [],
312 #if HAVE_SYS_SOCKET_H
313 # include <sys/socket.h>
316 AC_CHECK_HEADERS(sys/un.h)
317 AC_CHECK_HEADERS(grp.h)
319 # For debugging interface (variable number of arguments)
320 AC_CHECK_HEADERS(stdarg.h)
322 # Regular expressions for the ignorelist.
323 AC_CHECK_HEADERS(regex.h)
326 AC_CHECK_HEADERS(arpa/nameser.h arpa/nameser_compat.h)
328 AC_CHECK_HEADERS(net/if_arp.h, [], [],
329 [#if HAVE_SYS_SOCKET_H
330 # include <sys/socket.h>
333 AC_CHECK_HEADERS(net/if_ppp.h)
334 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
339 # include <sys/types.h>
341 #if HAVE_SYS_SOCKET_H
342 # include <sys/socket.h>
347 #if HAVE_NETINET_IN_H
348 # include <netinet/in.h>
352 # For the multimeter plugin
353 AC_CHECK_HEADERS(termios.h)
354 AC_CHECK_HEADERS(sys/ioctl.h)
357 # Checking for libraries
362 # Checks for typedefs, structures, and compiler characteristics.
371 # Checks for library functions.
373 AC_PROG_GCC_TRADITIONAL
374 AC_CHECK_FUNCS(gettimeofday select strdup strtol)
375 AC_CHECK_FUNCS(getaddrinfo getnameinfo)
376 AC_CHECK_FUNCS(strchr memcpy strstr strcmp strncmp strncpy strlen)
377 AC_CHECK_FUNCS(strncasecmp strcasecmp)
378 AC_CHECK_FUNCS(openlog syslog closelog)
380 socket_needs_socket="no"
381 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
382 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
384 nanosleep_needs_rt="no"
385 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
386 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
388 # Regular expressions for the ignorelist.
389 AC_CHECK_FUNCS(regcomp regerror regexec regfree)
392 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
395 AC_CHECK_FUNCS(statfs statvfs)
398 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
400 # For the `processes' plugin
401 AC_CHECK_FUNCS(thread_info)
404 AC_CHECK_FUNCS(getutent getutxent)
407 AC_CHECK_FUNCS(quotactl)
408 AC_CHECK_FUNCS(getgrgid getpwuid)
410 # For interface module
411 AC_CHECK_FUNCS(getifaddrs)
415 if test "x$nan_type" = "xnone"; then
416 AC_CACHE_CHECK([whether NAN is defined by default],
423 static float foo = NAN;
431 [have_nan_default="yes"],
432 [have_nan_default="no"]
435 if test "x$have_nan_default" = "xyes"
438 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
439 [Define if NAN is defined by default and can initialize static variables.])
442 if test "x$nan_type" = "xnone"; then
443 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
449 #define __USE_ISOC99 1
451 static float foo = NAN;
459 [have_nan_isoc="yes"],
463 if test "x$have_nan_isoc" = "xyes"
466 AC_DEFINE(NAN_STATIC_ISOC, 1,
467 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
470 if test "x$nan_type" = "xnone"; then
471 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
481 #define NAN (0.0 / 0.0)
483 # define isnan(f) ((f) != (f))
485 static float foo = NAN;
493 [have_nan_zero="yes"],
497 if test "x$have_nan_zero" = "xyes"
500 AC_DEFINE(NAN_ZERO_ZERO, 1,
501 [Define if NAN can be defined as (0.0 / 0.0)])
504 if test "x$nan_type" = "xnone"; then
505 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
508 # For mount interface
509 #AC_CHECK_FUNCS(getfsent getvfsent)
512 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
514 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
516 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
519 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
520 if test "x$have_getmntent" = "xno"; then
521 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
523 if test "x$have_getmntent" = "xno"; then
524 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
526 if test "x$have_getmntent" = "xno"; then
527 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
530 if test "x$have_getmntent" = "xc"; then
531 AC_CACHE_CHECK([whether getmntent takes one argument],
532 [have_one_getmntent],
534 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
536 #include "$srcdir/src/utils_mount.h"]],
540 fh = setmntent ("/etc/mtab", "r");
544 [have_one_getmntent="yes"],
545 [have_one_getmntent="no"]
548 AC_CACHE_CHECK([whether getmntent takes two arguments],
549 [have_two_getmntent],
551 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
552 #include <sys/mnttab.h>
553 #include "$srcdir/src/utils_mount.h"]],
558 fh = fopen ("/etc/mnttab", "r");
559 status = getmntent (fh, &mt);
562 [have_two_getmntent="yes"],
563 [have_two_getmntent="no"]
568 # Check for different versions of `getmntent' here..
570 if test "x$have_getmntent" = "xc"; then
571 if test "x$have_one_getmntent" = "xyes"; then
572 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
573 [Define if the function getmntent exists and takes one argument.])
575 if test "x$have_two_getmntent" = "xyes"; then
576 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
577 [Define if the function getmntent exists and takes two arguments.])
580 if test "x$have_getmntent" = "xsun"; then
581 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
582 [Define if the function getmntent exists. It's the version from libsun.])
584 if test "x$have_getmntent" = "xseq"; then
585 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
586 [Define if the function getmntent exists. It's the version from libseq.])
588 if test "x$have_getmntent" = "xgen"; then
589 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
590 [Define if the function getmntent exists. It's the version from libgen.])
593 # Check for structures
594 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
595 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
598 #include <sys/types.h>
599 #include <sys/socket.h>
602 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
603 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
606 #include <sys/types.h>
607 #include <sys/socket.h>
608 #include <linux/if.h>
609 #include <linux/netdevice.h>
612 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
617 # include <sys/types.h>
619 #if HAVE_NETINET_IN_SYSTM_H
620 # include <netinet/in_systm.h>
622 #if HAVE_NETINET_IN_H
623 # include <netinet/in.h>
625 #if HAVE_NETINET_IP_H
626 # include <netinet/ip.h>
628 #if HAVE_NETINET_UDP_H
629 # include <netinet/udp.h>
632 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
637 # include <sys/types.h>
639 #if HAVE_NETINET_IN_SYSTM_H
640 # include <netinet/in_systm.h>
642 #if HAVE_NETINET_IN_H
643 # include <netinet/in.h>
645 #if HAVE_NETINET_IP_H
646 # include <netinet/ip.h>
648 #if HAVE_NETINET_UDP_H
649 # include <netinet/udp.h>
653 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
662 AC_MSG_CHECKING([for kernel type ($host_os)])
665 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
669 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
675 AC_MSG_RESULT([$ac_system])
678 AC_CHECK_LIB(resolv, res_search,
680 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
682 [with_libresolv="no"])
683 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
686 m4_divert_once([HELP_WITH], [
687 collectd additional packages:])
689 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
690 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
691 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
693 LDFLAGS="$LDFLAGS -L$withval/lib"
694 CPPFLAGS="$CPPFLAGS -I$withval/include"
697 ], [with_rrdtool="yes"])
698 if test "x$with_rrdtool" = "xyes"
700 AC_CHECK_LIB(rrd, rrd_update,
702 AC_DEFINE(HAVE_LIBRRD, 1, [Define to 1 if you have the rrd library (-lrrd).])
704 [with_rrdtool="no (librrd not found)"], [-lm])
706 if test "x$with_rrdtool" = "xyes"
708 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
710 if test "x$with_rrdtool" = "xyes"
716 AC_DEFINE_UNQUOTED(COLLECT_RRDTOOL, [$collect_rrdtool],
717 [Wether or not to use rrdtool library])
718 AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
720 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
721 [ if test "x$withval" != "xno" -a "x$withval" != "xyes"
723 LDFLAGS="$LDFLAGS -L$withval/lib"
724 CPPFLAGS="$CPPFLAGS -I$withval/include"
725 with_libpthread="yes"
727 if test "x$withval" = "xno"
729 with_libpthread="no (disabled)"
732 ], [with_libpthread="yes"])
733 if test "x$with_libpthread" = "xyes"
735 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
737 if test "x$with_libpthread" = "xyes"
739 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
741 if test "x$with_libpthread" = "xyes"
747 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
748 [Wether or not to use pthread (POSIX threads) library])
749 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
751 if test "$ac_system" = "Solaris"
756 with_kstat="no (Solaris only)"
757 with_devinfo="no (Solaris only)"
760 if test "x$with_kstat" = "xyes"
762 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
764 if test "x$with_kstat" = "xyes"
766 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
767 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
769 if test "x$with_kstat" = "xyes"
771 AC_DEFINE(HAVE_LIBKSTAT, 1,
772 [Define to 1 if you have the 'kstat' library (-lkstat)])
774 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
775 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
777 ### BEGIN of check for libcurl ###
778 with_curl_config="curl-config"
781 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
783 if test "x$withval" != "xno" -a "x$withval" != "xyes"
785 if test -x "$withval/bin/curl-config"
787 with_curl_config="$withval/bin/curl-config"
791 if test "x$withval" = "xno"
801 if test "x$with_libcurl" = "xyes"
803 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
804 curl_config_status=$?
806 if test $curl_config_status -ne 0
810 AC_CHECK_LIB(curl, curl_easy_init,
812 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
813 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
821 if test "x$with_libcurl" = "xyes" -a $with_curl_prefix -ne 0
823 with_curl_prefix=`$with_curl_config --libs 2>/dev/null`
824 curl_config_status=$?
826 if test $curl_config_status -ne 0
830 if test -d "$with_curl_prefix/include"
832 CPPFLAGS="$CPPFLAGS -I$with_curl_prefix/include"
837 with_libcurl_numeric=0
838 if test "x$with_libcurl" = "xyes"
840 with_libcurl_numeric=1
842 AC_DEFINE_UNQUOTED(HAVE_LIBCURL, [$with_libcurl_numeric], [Define to 1 if you have the 'curl' library (-lcurl).])
843 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
844 ### END of check for libcurl ###
848 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
857 AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
858 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
860 with_libstatgrab="yes"
862 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
864 if test "x$withval" != "xno" -a "x$withval" != "xyes"
866 LDFLAGS="$LDFLAGS -L$withval/lib"
867 CPPFLAGS="$CPPFLAGS -I$withval/include"
868 with_libstatgrab="yes"
872 if test "x$ac_system" == "xunknown"
874 with_libstatgrab="yes"
876 with_libstatgrab="no"
879 if test "x$with_libstatgrab" = "xyes"
881 AC_CHECK_LIB(statgrab, sg_init, [with_libstatgrab="yes"], [with_libstatgrab="no (libstatgrab not found)"])
883 if test "x$with_libstatgrab" = "xyes"
885 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (statgrab.h not found)"])
887 if test "x$with_libstatgrab" = "xyes"
889 AC_CHECK_LIB(devstat, getdevs, [with_libdevstat="yes"], [with_libdevstat="no"])
891 if test "x$with_libstatgrab" = "xyes"
893 collect_libstatgrab=1
895 collect_libstatgrab=0
897 AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
898 [Wether or not to use statgrab library])
899 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
900 AM_CONDITIONAL(BUILD_WITH_LIBDEVSTAT, test "x$with_libdevstat" = "xyes")
902 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
903 if test "x$with_libkvm" = "xyes"
905 AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
907 AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
909 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
911 if test "x$withval" != "xno" && test "x$withval" != "xyes"
913 LDFLAGS="$LDFLAGS -L$withval/lib"
914 CPPFLAGS="$CPPFLAGS -I$withval/include"
915 with_lm_sensors="yes"
919 if test "x$ac_system" = "xLinux"
921 with_lm_sensors="yes"
926 if test "x$with_lm_sensors" = "xyes"
928 AC_CHECK_LIB(sensors, sensors_init,
930 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
932 [with_lm_sensors="no (libsensors not found)"])
934 if test "x$with_lm_sensors" = "xyes"
936 AC_CHECK_HEADERS(sensors/sensors.h,
938 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
940 [with_lm_sensors="no (sensors/sensors.h not found)"])
942 if test "x$with_lm_sensors" = "xyes"
948 AC_DEFINE_UNQUOTED(COLLECT_LM_SENSORS, [$collect_lm_sensors],
949 [Wether or not to use sensors library])
950 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
952 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
954 if test "x$withval" != "xno" && test "x$withval" != "xyes"
956 LDFLAGS="$LDFLAGS -L$withval/lib"
957 CPPFLAGS="$CPPFLAGS -I$withval/include"
964 if test "x$with_libmysql" = "xyes"
966 AC_CHECK_LIB(mysqlclient, mysql_init,
968 AC_DEFINE(HAVE_LIBMYSQLCLIENT, 1, [Define to 1 if you have the mysqlclient library (-lmysqlclient).])
969 ], [with_libmysql="no (libmysql not found)"])
971 if test "x$with_libmysql" = "xyes"
973 AC_CHECK_HEADERS(mysql/mysql.h,
975 AC_DEFINE(HAVE_MYSQL_MYSQL_H, 1, [Define to 1 if you have the <mysql/mysql.h> header file.])
976 ], [with_libmysql="no (mysql/mysql.h not found)"])
978 if test "x$with_libmysql" = "xyes"
984 AC_DEFINE_UNQUOTED(COLLECT_LIBMYSQL, [$collect_libmysql],
985 [Wether or not to use mysql library])
986 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
988 with_own_liboconfig="no"
989 liboconfig_LDFLAGS="$LDFLAGS"
990 liboconfig_CPPFLAGS="$CPPFLAGS"
991 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
993 if test "x$withval" != "xno" && test "x$withval" != "xyes"
995 if test -d "$withval/lib"
997 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
999 if test -d "$withval/include"
1001 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1004 if test "x$withval" = "xno"
1006 AC_MSG_ERROR("liboconfig is required")
1010 with_liboconfig="yes"
1013 save_LDFLAGS="$LDFLAGS"
1014 save_CPPFLAGS="$CPPFLAGS"
1015 LDFLAGS="$liboconfig_LDFLAGS"
1016 CPPFLAGS="$liboconfig_CPPFLAGS"
1017 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1019 with_liboconfig="yes"
1020 with_own_liboconfig="no"
1023 with_liboconfig="yes"
1024 with_own_liboconfig="yes"
1025 LDFLAGS="$save_LDFLAGS"
1026 CPPFLAGS="$save_CPPFLAGS"
1029 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1030 if test "x$with_own_liboconfig" = "xyes"
1032 with_liboconfig="yes (shipped version)"
1035 #with_liboping="yes"
1036 with_own_liboping="no"
1037 liboping_LDFLAGS="$LDFLAGS"
1038 liboping_CPPFLAGS="$CPPFLAGS"
1039 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1041 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1043 if test -d "$withval/lib"
1045 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
1047 if test -d "$withval/include"
1049 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
1052 if test "x$withval" = "xno"
1055 with_own_liboping="no"
1063 if test "x$with_liboping" = "xyes"
1065 save_LDFLAGS="$LDFLAGS"
1066 save_CPPFLAGS="$CPPFLAGS"
1067 LDFLAGS="$liboping_LDFLAGS"
1068 CPPFLAGS="$liboping_CPPFLAGS"
1069 AC_CHECK_LIB(oping, ping_construct,
1072 with_own_liboping="no"
1076 with_own_liboping="yes"
1077 LDFLAGS="$save_LDFLAGS"
1078 CPPFLAGS="$save_CPPFLAGS"
1081 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1082 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1083 if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
1085 with_liboping="yes (shipped version)"
1088 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1090 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1092 LDFLAGS="$LDFLAGS -L$withval/lib"
1093 CPPFLAGS="$CPPFLAGS -I$withval/include"
1100 if test "x$with_libpcap" = "xyes"
1102 AC_CHECK_LIB(pcap, pcap_open_live,
1104 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1105 ], [with_libpcap="no (libpcap not found)"])
1107 if test "x$with_libpcap" = "xyes"
1109 AC_CHECK_HEADERS(pcap.h,
1111 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1112 ], [with_libpcap="no (pcap.h not found)"])
1114 if test "x$with_libpcap" = "xyes"
1120 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1121 [Wether or not to use the pcap library])
1122 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1124 perl_interpreter="perl"
1125 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1127 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1129 LDFLAGS="$LDFLAGS -L$withval/lib"
1130 CPPFLAGS="$CPPFLAGS -I$withval/include"
1131 perl_interpreter="$withval/bin/perl"
1138 if test "x$with_libperl" = "xyes"
1141 SAVE_LDFLAGS=$LDFLAGS
1142 PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
1143 PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
1144 CFLAGS="$CFLAGS $PERL_CFLAGS"
1145 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1147 AC_CACHE_CHECK([for libperl],
1157 PerlInterpreter *perl = NULL;
1158 Perl_load_module (perl, PERL_LOADMOD_NOIMPORT,
1159 newSVpv ("Collectd::Plugin::FooBar", 24),
1162 [have_libperl="yes"],
1167 if test "x$have_libperl" = "xyes"
1169 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
1170 AC_SUBST(PERL_CFLAGS)
1171 AC_SUBST(PERL_LDFLAGS)
1177 LDFLAGS=$SAVE_LDFLAGS
1179 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1181 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1183 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1185 LDFLAGS="$LDFLAGS -L$withval/lib"
1186 CPPFLAGS="$CPPFLAGS -I$withval/include"
1191 if test "x$ac_system" = "xLinux"
1195 with_libiptc="no (Linux only)"
1198 if test "x$with_libiptc" = "xyes"
1200 AC_CHECK_LIB(iptc, iptc_init,
1202 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1203 ], [with_libiptc="no (libiptc not found)"])
1205 if test "x$with_libiptc" = "xyes"
1207 AC_CHECK_HEADERS(libiptc/libiptc.h,
1209 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1210 ], [with_libiptc="no (libiptc/libiptc.h not found)"])
1212 if test "x$with_libiptc" = "xyes"
1218 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1220 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])],
1222 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1224 LDFLAGS="$LDFLAGS -L$withval/lib"
1225 CPPFLAGS="$CPPFLAGS -I$withval/include"
1226 with_libupsclient="yes"
1230 with_libupsclient="yes"
1232 if test "x$with_libupsclient" = "xyes"
1234 AC_CHECK_LIB(upsclient, upscli_connect,
1236 AC_DEFINE(HAVE_LIBUPSCLIENT, 1, [Define to 1 if you have the upsclient library (-lupsclient).])
1237 ], [with_libupsclient="no (libupsclient not found)"])
1239 if test "x$with_libupsclient" = "xyes"
1241 AC_CHECK_HEADERS(upsclient.h,
1243 AC_DEFINE(HAVE_UPSCLIENT_H, 1, [Define to 1 if you have the <upsclient.h> header file.])
1244 ], [with_libupsclient="no (upsclient.h not found)"])
1246 AM_CONDITIONAL(BUILD_WITH_LIBUPSCLIENT, test "x$with_libupsclient" = "xyes")
1248 # Check for enabled/disabled features
1251 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
1252 # ------------------------------------------------------------
1254 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
1259 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
1264 m4_define([EnDis],[disabled])dnl
1265 m4_define([YesNo],[no])dnl
1271 m4_define([EnDis],[enabled])dnl
1272 m4_define([YesNo],[yes])dnl
1275 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
1279 m4_if([$3], [feature], [],
1283 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
1289 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
1291 enable_$1='[YesNo]'dnl
1293 if test "x$enable_$1" = "xno"
1297 if test "x$enable_$1" = "xyes"
1301 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
1306 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
1307 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
1309 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
1311 m4_divert_once([HELP_ENABLE], [
1312 collectd features:])
1313 AC_COLLECTD([debug], [enable], [feature], [debugging])
1314 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
1315 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
1317 m4_divert_once([HELP_ENABLE], [
1319 AC_COLLECTD([apache], [disable], [module], [Apache httpd statistics])
1320 AC_COLLECTD([apcups], [disable], [module], [Statistics of UPSes by APC])
1321 AC_COLLECTD([apple_sensors], [disable], [module], [Apple's hardware sensors])
1322 AC_COLLECTD([battery], [disable], [module], [battery statistics])
1323 AC_COLLECTD([cpu], [disable], [module], [cpu usage statistics])
1324 AC_COLLECTD([cpufreq], [disable], [module], [system cpu frequency statistics])
1325 AC_COLLECTD([disk], [disable], [module], [disk/partition statistics])
1326 AC_COLLECTD([csv], [disable], [module], [csv output plugin])
1327 AC_COLLECTD([df], [disable], [module], [df statistics])
1328 AC_COLLECTD([dns], [disable], [module], [dns statistics])
1329 AC_COLLECTD([email], [disable], [module], [email statistics])
1330 AC_COLLECTD([entropy], [disable], [module], [entropy statistics])
1331 AC_COLLECTD([exec], [disable], [module], [exec of external programs])
1332 AC_COLLECTD([hddtemp], [disable], [module], [hdd temperature statistics])
1333 AC_COLLECTD([interface], [disable], [module], [interface statistics])
1334 AC_COLLECTD([iptables], [disable], [module], [IPtables statistics])
1335 AC_COLLECTD([irq], [disable], [module], [irq statistics])
1336 AC_COLLECTD([load], [disable], [module], [system load statistics])
1337 AC_COLLECTD([mbmon], [disable], [module], [motherboard monitor statistics])
1338 AC_COLLECTD([memory], [disable], [module], [memory statistics])
1339 AC_COLLECTD([multimeter],[disable], [module], [multimeter statistics])
1340 AC_COLLECTD([mysql], [disable], [module], [mysql statistics])
1341 AC_COLLECTD([network], [disable], [module], [network functionality])
1342 AC_COLLECTD([nfs], [disable], [module], [nfs statistics])
1343 AC_COLLECTD([ntpd], [disable], [module], [ntpd statistics])
1344 AC_COLLECTD([nut], [disable], [module], [network UPS tools statistics])
1345 AC_COLLECTD([perl], [disable], [module], [embedded perl interpreter])
1346 AC_COLLECTD([ping], [disable], [module], [ping statistics])
1347 AC_COLLECTD([processes], [disable], [module], [processes statistics])
1348 AC_COLLECTD([sensors], [disable], [module], [lm_sensors statistics])
1349 AC_COLLECTD([serial], [disable], [module], [serial statistics])
1350 AC_COLLECTD([logfile], [disable], [module], [logfile log facility])
1351 AC_COLLECTD([swap], [disable], [module], [swap statistics])
1352 AC_COLLECTD([syslog], [disable], [module], [syslog log facility])
1353 AC_COLLECTD([tape], [disable], [module], [tape statistics])
1354 AC_COLLECTD([unixsock], [disable], [module], [UNIX socket plugin])
1355 AC_COLLECTD([users], [disable], [module], [user count statistics])
1356 AC_COLLECTD([vserver], [disable], [module], [vserver statistics])
1357 AC_COLLECTD([wireless], [disable], [module], [wireless link statistics])
1359 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile)
1361 if test "x$with_libperl" = "xyes"
1363 with_libperl="yes (version `perl -MConfig -e 'print $Config{version};'`)"
1365 enable_perl="no (needs libperl)"
1372 libcurl . . . . . . $with_libcurl
1373 libiokit . . . . . $with_libiokit
1374 libiptc . . . . . . $with_libiptc
1375 libkstat . . . . . $with_kstat
1376 libmysql . . . . . $with_libmysql
1377 liboconfig . . . . $with_liboconfig
1378 liboping . . . . . $with_liboping
1379 libpcap . . . . . . $with_libpcap
1380 libperl . . . . . . $with_libperl
1381 libpthread . . . . $with_libpthread
1382 librrd . . . . . . $with_rrdtool
1383 libsensors . . . . $with_lm_sensors
1384 libstatgrab . . . . $with_libstatgrab
1385 libupsclient . . . $with_libupsclient
1388 daemon mode . . . . $enable_daemon
1389 debug . . . . . . . $enable_debug
1392 apache . . . . . . $enable_apache
1393 apcups . . . . . . $enable_apcups
1394 apple_sensors . . . $enable_apple_sensors
1395 battery . . . . . . $enable_battery
1396 cpu . . . . . . . . $enable_cpu
1397 cpufreq . . . . . . $enable_cpufreq
1398 csv . . . . . . . . $enable_csv
1399 df . . . . . . . . $enable_df
1400 disk . . . . . . . $enable_disk
1401 dns . . . . . . . . $enable_dns
1402 email . . . . . . . $enable_email
1403 entropy . . . . . . $enable_entropy
1404 exec . . . . . . . $enable_exec
1405 hddtemp . . . . . . $enable_hddtemp
1406 interface . . . . . $enable_interface
1407 iptables . . . . . $enable_iptables
1408 irq . . . . . . . . $enable_irq
1409 load . . . . . . . $enable_load
1410 logfile . . . . . . $enable_logfile
1411 mbmon . . . . . . . $enable_mbmon
1412 memory . . . . . . $enable_memory
1413 multimeter . . . . $enable_multimeter
1414 mysql . . . . . . . $enable_mysql
1415 network . . . . . . $enable_network
1416 nfs . . . . . . . . $enable_nfs
1417 ntpd . . . . . . . $enable_ntpd
1418 nut . . . . . . . . $enable_nut
1419 perl . . . . . . . $enable_perl
1420 ping . . . . . . . $enable_ping
1421 processes . . . . . $enable_processes
1422 sensors . . . . . . $enable_sensors
1423 serial . . . . . . $enable_serial
1424 swap . . . . . . . $enable_swap
1425 syslog . . . . . . $enable_syslog
1426 tape . . . . . . . $enable_tape
1427 unixsock . . . . . $enable_unixsock
1428 users . . . . . . . $enable_users
1429 vserver . . . . . . $enable_vserver
1430 wireless . . . . . $enable_wireless