1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, 4.0.0-rc4)
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)
212 # For the apple_sensors module
213 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h)
214 AC_CHECK_HEADERS(IOKit/IOKitLib.h)
215 AC_CHECK_HEADERS(IOKit/IOTypes.h)
217 # For the battery plugin
218 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
220 #if HAVE_IOKIT_IOKITLIB_H
221 # include <IOKit/IOKitLib.h>
223 #if HAVE_IOKIT_IOTYPES_H
224 # include <IOKit/IOTypes.h>
227 AC_CHECK_HEADERS(IOKit/ps/IOPSKeys.h)
229 # For the `disk' plugin
230 AC_CHECK_HEADERS(IOKit/IOBSD.h)
231 AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDriver.h)
234 AC_CHECK_HEADERS(sys/loadavg.h)
236 # For the processes plugin
237 AC_CHECK_HEADERS(linux/config.h)
239 # For the swap module
240 AC_CHECK_HEADERS(sys/swap.h)
243 AC_CHECK_HEADERS(utmp.h)
244 AC_CHECK_HEADERS(utmpx.h)
246 # For interface plugin
247 AC_CHECK_HEADERS(ifaddrs.h)
248 AC_CHECK_HEADERS(net/if.h, [], [],
251 # include <sys/types.h>
253 #if HAVE_SYS_SOCKET_H
254 # include <sys/socket.h>
257 AC_CHECK_HEADERS(linux/if.h, [], [],
260 # include <sys/types.h>
262 #if HAVE_SYS_SOCKET_H
263 # include <sys/socket.h>
266 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
269 # include <sys/types.h>
271 #if HAVE_SYS_SOCKET_H
272 # include <sys/socket.h>
275 # include <linux/if.h>
280 AC_CHECK_HEADERS(curl/curl.h)
283 AC_CHECK_HEADERS(grp.h pwd.h sys/ucred.h)
284 AC_CHECK_HEADERS(ctype.h)
285 AC_CHECK_HEADERS(limits.h)
286 AC_CHECK_HEADERS(sys/quota.h)
287 AC_CHECK_HEADERS(xfs/xqm.h)
289 # For mount interface
290 AC_CHECK_HEADERS(fs_info.h)
291 AC_CHECK_HEADERS(fshelp.h)
292 AC_CHECK_HEADERS(paths.h)
293 AC_CHECK_HEADERS(mntent.h)
294 AC_CHECK_HEADERS(mnttab.h)
295 AC_CHECK_HEADERS(sys/fstyp.h)
296 AC_CHECK_HEADERS(sys/fs_types.h)
297 AC_CHECK_HEADERS(sys/mntent.h)
298 AC_CHECK_HEADERS(sys/mnttab.h)
299 AC_CHECK_HEADERS(sys/mount.h)
300 AC_CHECK_HEADERS(sys/statfs.h)
301 AC_CHECK_HEADERS(sys/statvfs.h)
302 AC_CHECK_HEADERS(sys/vfs.h)
303 AC_CHECK_HEADERS(sys/vfstab.h)
305 # For the swap plugin, FreeBSD
306 AC_CHECK_HEADERS(kvm.h)
308 # For the email plugin
309 AC_CHECK_HEADERS(linux/un.h, [], [],
311 #if HAVE_SYS_SOCKET_H
312 # include <sys/socket.h>
315 AC_CHECK_HEADERS(sys/un.h)
316 AC_CHECK_HEADERS(grp.h)
318 # For debugging interface (variable number of arguments)
319 AC_CHECK_HEADERS(stdarg.h)
321 # Regular expressions for the ignorelist.
322 AC_CHECK_HEADERS(regex.h)
325 AC_CHECK_HEADERS(arpa/nameser.h arpa/nameser_compat.h)
327 AC_CHECK_HEADERS(net/if_arp.h, [], [],
328 [#if HAVE_SYS_SOCKET_H
329 # include <sys/socket.h>
332 AC_CHECK_HEADERS(net/if_ppp.h)
333 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
338 # include <sys/types.h>
340 #if HAVE_SYS_SOCKET_H
341 # include <sys/socket.h>
346 #if HAVE_NETINET_IN_H
347 # include <netinet/in.h>
351 # For the multimeter plugin
352 AC_CHECK_HEADERS(termios.h)
353 AC_CHECK_HEADERS(sys/ioctl.h)
356 # Checking for libraries
361 # Checks for typedefs, structures, and compiler characteristics.
370 # Checks for library functions.
372 AC_PROG_GCC_TRADITIONAL
373 AC_CHECK_FUNCS(gettimeofday select strdup strtol)
374 AC_CHECK_FUNCS(getaddrinfo getnameinfo)
375 AC_CHECK_FUNCS(strchr memcpy strstr strcmp strncmp strncpy strlen)
376 AC_CHECK_FUNCS(strncasecmp strcasecmp)
377 AC_CHECK_FUNCS(openlog syslog closelog)
379 socket_needs_socket="no"
380 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
381 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
383 nanosleep_needs_rt="no"
384 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
385 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
387 # Regular expressions for the ignorelist.
388 AC_CHECK_FUNCS(regcomp regerror regexec regfree)
391 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
394 AC_CHECK_FUNCS(statfs statvfs)
397 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
399 # For the `processes' plugin
400 AC_CHECK_FUNCS(thread_info)
403 AC_CHECK_FUNCS(getutent getutxent)
406 AC_CHECK_FUNCS(quotactl)
407 AC_CHECK_FUNCS(getgrgid getpwuid)
409 # For interface module
410 AC_CHECK_FUNCS(getifaddrs)
414 if test "x$nan_type" = "xnone"; then
415 AC_CACHE_CHECK([whether NAN is defined by default],
422 static float foo = NAN;
430 [have_nan_default="yes"],
431 [have_nan_default="no"]
434 if test "x$have_nan_default" = "xyes"
437 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
438 [Define if NAN is defined by default and can initialize static variables.])
441 if test "x$nan_type" = "xnone"; then
442 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
448 #define __USE_ISOC99 1
450 static float foo = NAN;
458 [have_nan_isoc="yes"],
462 if test "x$have_nan_isoc" = "xyes"
465 AC_DEFINE(NAN_STATIC_ISOC, 1,
466 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
469 if test "x$nan_type" = "xnone"; then
470 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
480 #define NAN (0.0 / 0.0)
482 # define isnan(f) ((f) != (f))
484 static float foo = NAN;
492 [have_nan_zero="yes"],
496 if test "x$have_nan_zero" = "xyes"
499 AC_DEFINE(NAN_ZERO_ZERO, 1,
500 [Define if NAN can be defined as (0.0 / 0.0)])
503 if test "x$nan_type" = "xnone"; then
504 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
507 # For mount interface
508 #AC_CHECK_FUNCS(getfsent getvfsent)
511 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
513 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
515 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
518 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
519 if test "x$have_getmntent" = "xno"; then
520 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
522 if test "x$have_getmntent" = "xno"; then
523 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
525 if test "x$have_getmntent" = "xno"; then
526 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
529 if test "x$have_getmntent" = "xc"; then
530 AC_CACHE_CHECK([whether getmntent takes one argument],
531 [have_one_getmntent],
533 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
535 #include "$srcdir/src/utils_mount.h"]],
539 fh = setmntent ("/etc/mtab", "r");
543 [have_one_getmntent="yes"],
544 [have_one_getmntent="no"]
547 AC_CACHE_CHECK([whether getmntent takes two arguments],
548 [have_two_getmntent],
550 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
551 #include <sys/mnttab.h>
552 #include "$srcdir/src/utils_mount.h"]],
557 fh = fopen ("/etc/mnttab", "r");
558 status = getmntent (fh, &mt);
561 [have_two_getmntent="yes"],
562 [have_two_getmntent="no"]
567 # Check for different versions of `getmntent' here..
569 if test "x$have_getmntent" = "xc"; then
570 if test "x$have_one_getmntent" = "xyes"; then
571 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
572 [Define if the function getmntent exists and takes one argument.])
574 if test "x$have_two_getmntent" = "xyes"; then
575 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
576 [Define if the function getmntent exists and takes two arguments.])
579 if test "x$have_getmntent" = "xsun"; then
580 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
581 [Define if the function getmntent exists. It's the version from libsun.])
583 if test "x$have_getmntent" = "xseq"; then
584 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
585 [Define if the function getmntent exists. It's the version from libseq.])
587 if test "x$have_getmntent" = "xgen"; then
588 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
589 [Define if the function getmntent exists. It's the version from libgen.])
592 # Check for structures
593 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
594 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
597 #include <sys/types.h>
598 #include <sys/socket.h>
601 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
602 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
605 #include <sys/types.h>
606 #include <sys/socket.h>
607 #include <linux/if.h>
608 #include <linux/netdevice.h>
611 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
616 # include <sys/types.h>
618 #if HAVE_NETINET_IN_SYSTM_H
619 # include <netinet/in_systm.h>
621 #if HAVE_NETINET_IN_H
622 # include <netinet/in.h>
624 #if HAVE_NETINET_IP_H
625 # include <netinet/ip.h>
627 #if HAVE_NETINET_UDP_H
628 # include <netinet/udp.h>
631 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
636 # include <sys/types.h>
638 #if HAVE_NETINET_IN_SYSTM_H
639 # include <netinet/in_systm.h>
641 #if HAVE_NETINET_IN_H
642 # include <netinet/in.h>
644 #if HAVE_NETINET_IP_H
645 # include <netinet/ip.h>
647 #if HAVE_NETINET_UDP_H
648 # include <netinet/udp.h>
652 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
661 AC_MSG_CHECKING([for kernel type ($host_os)])
664 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
668 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
674 AC_MSG_RESULT([$ac_system])
677 AC_CHECK_LIB(resolv, res_search,
679 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
681 [with_libresolv="no"])
682 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
685 m4_divert_once([HELP_WITH], [
686 collectd additional packages:])
688 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
689 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
690 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
692 LDFLAGS="$LDFLAGS -L$withval/lib"
693 CPPFLAGS="$CPPFLAGS -I$withval/include"
696 ], [with_rrdtool="yes"])
697 if test "x$with_rrdtool" = "xyes"
699 AC_CHECK_LIB(rrd, rrd_update,
701 AC_DEFINE(HAVE_LIBRRD, 1, [Define to 1 if you have the rrd library (-lrrd).])
703 [with_rrdtool="no (librrd not found)"], [-lm])
705 if test "x$with_rrdtool" = "xyes"
707 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
709 if test "x$with_rrdtool" = "xyes"
715 AC_DEFINE_UNQUOTED(COLLECT_RRDTOOL, [$collect_rrdtool],
716 [Wether or not to use rrdtool library])
717 AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
719 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
720 [ if test "x$withval" != "xno" -a "x$withval" != "xyes"
722 LDFLAGS="$LDFLAGS -L$withval/lib"
723 CPPFLAGS="$CPPFLAGS -I$withval/include"
724 with_libpthread="yes"
726 if test "x$withval" = "xno"
728 with_libpthread="no (disabled)"
731 ], [with_libpthread="yes"])
732 if test "x$with_libpthread" = "xyes"
734 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
736 if test "x$with_libpthread" = "xyes"
738 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
740 if test "x$with_libpthread" = "xyes"
746 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
747 [Wether or not to use pthread (POSIX threads) library])
748 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
750 if test "$ac_system" = "Solaris"
755 with_kstat="no (Solaris only)"
756 with_devinfo="no (Solaris only)"
759 if test "x$with_kstat" = "xyes"
761 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
763 if test "x$with_kstat" = "xyes"
765 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
766 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
768 if test "x$with_kstat" = "xyes"
770 AC_DEFINE(HAVE_LIBKSTAT, 1,
771 [Define to 1 if you have the 'kstat' library (-lkstat)])
773 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
774 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
776 ### BEGIN of check for libcurl ###
777 with_curl_config="curl-config"
780 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
782 if test "x$withval" != "xno" -a "x$withval" != "xyes"
784 if test -x "$withval/bin/curl-config"
786 with_curl_config="$withval/bin/curl-config"
790 if test "x$withval" = "xno"
800 if test "x$with_libcurl" = "xyes"
802 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
803 curl_config_status=$?
805 if test $curl_config_status -ne 0
809 AC_CHECK_LIB(curl, curl_easy_init,
811 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
812 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
820 if test "x$with_libcurl" = "xyes" -a $with_curl_prefix -ne 0
822 with_curl_prefix=`$with_curl_config --libs 2>/dev/null`
823 curl_config_status=$?
825 if test $curl_config_status -ne 0
829 if test -d "$with_curl_prefix/include"
831 CPPFLAGS="$CPPFLAGS -I$with_curl_prefix/include"
836 with_libcurl_numeric=0
837 if test "x$with_libcurl" = "xyes"
839 with_libcurl_numeric=1
841 AC_DEFINE_UNQUOTED(HAVE_LIBCURL, [$with_libcurl_numeric], [Define to 1 if you have the 'curl' library (-lcurl).])
842 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
843 ### END of check for libcurl ###
847 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
856 AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
857 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
859 with_libstatgrab="yes"
861 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
863 if test "x$withval" != "xno" -a "x$withval" != "xyes"
865 LDFLAGS="$LDFLAGS -L$withval/lib"
866 CPPFLAGS="$CPPFLAGS -I$withval/include"
867 with_libstatgrab="yes"
871 if test "x$ac_system" == "xunknown"
873 with_libstatgrab="yes"
875 with_libstatgrab="no"
878 if test "x$with_libstatgrab" = "xyes"
880 AC_CHECK_LIB(statgrab, sg_init, [with_libstatgrab="yes"], [with_libstatgrab="no (libstatgrab not found)"])
882 if test "x$with_libstatgrab" = "xyes"
884 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (statgrab.h not found)"])
886 if test "x$with_libstatgrab" = "xyes"
888 AC_CHECK_LIB(devstat, getdevs, [with_libdevstat="yes"], [with_libdevstat="no"])
890 if test "x$with_libstatgrab" = "xyes"
892 collect_libstatgrab=1
894 collect_libstatgrab=0
896 AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
897 [Wether or not to use statgrab library])
898 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
899 AM_CONDITIONAL(BUILD_WITH_LIBDEVSTAT, test "x$with_libdevstat" = "xyes")
901 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
902 if test "x$with_libkvm" = "xyes"
904 AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
906 AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
908 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
910 if test "x$withval" != "xno" && test "x$withval" != "xyes"
912 LDFLAGS="$LDFLAGS -L$withval/lib"
913 CPPFLAGS="$CPPFLAGS -I$withval/include"
914 with_lm_sensors="yes"
918 if test "x$ac_system" = "xLinux"
920 with_lm_sensors="yes"
925 if test "x$with_lm_sensors" = "xyes"
927 AC_CHECK_LIB(sensors, sensors_init,
929 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
931 [with_lm_sensors="no (libsensors not found)"])
933 if test "x$with_lm_sensors" = "xyes"
935 AC_CHECK_HEADERS(sensors/sensors.h,
937 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
939 [with_lm_sensors="no (sensors/sensors.h not found)"])
941 if test "x$with_lm_sensors" = "xyes"
947 AC_DEFINE_UNQUOTED(COLLECT_LM_SENSORS, [$collect_lm_sensors],
948 [Wether or not to use sensors library])
949 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
951 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
953 if test "x$withval" != "xno" && test "x$withval" != "xyes"
955 LDFLAGS="$LDFLAGS -L$withval/lib"
956 CPPFLAGS="$CPPFLAGS -I$withval/include"
963 if test "x$with_libmysql" = "xyes"
965 AC_CHECK_LIB(mysqlclient, mysql_init,
967 AC_DEFINE(HAVE_LIBMYSQLCLIENT, 1, [Define to 1 if you have the mysqlclient library (-lmysqlclient).])
968 ], [with_libmysql="no (libmysql not found)"])
970 if test "x$with_libmysql" = "xyes"
972 AC_CHECK_HEADERS(mysql/mysql.h,
974 AC_DEFINE(HAVE_MYSQL_MYSQL_H, 1, [Define to 1 if you have the <mysql/mysql.h> header file.])
975 ], [with_libmysql="no (mysql/mysql.h not found)"])
977 if test "x$with_libmysql" = "xyes"
983 AC_DEFINE_UNQUOTED(COLLECT_LIBMYSQL, [$collect_libmysql],
984 [Wether or not to use mysql library])
985 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
988 with_own_liboping="no"
989 liboping_LDFLAGS="$LDFLAGS"
990 liboping_CPPFLAGS="$CPPFLAGS"
991 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
993 if test "x$withval" != "xno" && test "x$withval" != "xyes"
995 if test -d "$withval/lib"
997 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
999 if test -d "$withval/include"
1001 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
1004 if test "x$withval" = "xno"
1007 with_own_liboping="no"
1015 if test "x$with_liboping" = "xyes"
1017 save_LDFLAGS="$LDFLAGS"
1018 save_CPPFLAGS="$CPPFLAGS"
1019 LDFLAGS="$liboping_LDFLAGS"
1020 CPPFLAGS="$liboping_CPPFLAGS"
1021 AC_CHECK_LIB(oping, ping_construct,
1024 with_own_liboping="no"
1028 with_own_liboping="yes"
1029 LDFLAGS="$save_LDFLAGS"
1030 CPPFLAGS="$save_CPPFLAGS"
1033 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1034 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1035 if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
1037 with_liboping="yes (shipped version)"
1040 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1042 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1044 LDFLAGS="$LDFLAGS -L$withval/lib"
1045 CPPFLAGS="$CPPFLAGS -I$withval/include"
1052 if test "x$with_libpcap" = "xyes"
1054 AC_CHECK_LIB(pcap, pcap_open_live,
1056 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1057 ], [with_libpcap="no (libpcap not found)"])
1059 if test "x$with_libpcap" = "xyes"
1061 AC_CHECK_HEADERS(pcap.h,
1063 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1064 ], [with_libpcap="no (pcap.h not found)"])
1066 if test "x$with_libpcap" = "xyes"
1072 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1073 [Wether or not to use the pcap library])
1074 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1076 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1078 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1080 LDFLAGS="$LDFLAGS -L$withval/lib"
1081 CPPFLAGS="$CPPFLAGS -I$withval/include"
1088 if test "x$with_libperl" = "xyes"
1091 SAVE_LDFLAGS=$LDFLAGS
1092 CFLAGS="$CFLAGS `perl -MExtUtils::Embed -e ccopts`"
1093 LDFLAGS="$LDFLAGS `perl -MExtUtils::Embed -e ldopts`"
1095 AC_CACHE_CHECK([for libperl],
1105 PerlInterpreter *perl = NULL;
1106 Perl_load_module (perl, PERL_LOADMOD_NOIMPORT,
1107 Perl_newSVpvf (perl, "Collectd::Plugin::%s", "foo"),
1110 [have_libperl="yes"],
1115 if test "x$have_libperl" = "xyes"
1117 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
1123 LDFLAGS=$SAVE_LDFLAGS
1125 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1127 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1129 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1131 LDFLAGS="$LDFLAGS -L$withval/lib"
1132 CPPFLAGS="$CPPFLAGS -I$withval/include"
1137 if test "x$ac_system" = "xLinux"
1141 with_libiptc="no (Linux only)"
1144 if test "x$with_libiptc" = "xyes"
1146 AC_CHECK_LIB(iptc, iptc_init,
1148 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1149 ], [with_libiptc="no (libiptc not found)"])
1151 if test "x$with_libiptc" = "xyes"
1153 AC_CHECK_HEADERS(libiptc/libiptc.h,
1155 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1156 ], [with_libiptc="no (libiptc/libiptc.h not found)"])
1158 if test "x$with_libiptc" = "xyes"
1164 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1166 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])],
1168 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1170 LDFLAGS="$LDFLAGS -L$withval/lib"
1171 CPPFLAGS="$CPPFLAGS -I$withval/include"
1172 with_libupsclient="yes"
1176 with_libupsclient="yes"
1178 if test "x$with_libupsclient" = "xyes"
1180 AC_CHECK_LIB(upsclient, upscli_connect,
1182 AC_DEFINE(HAVE_LIBUPSCLIENT, 1, [Define to 1 if you have the upsclient library (-lupsclient).])
1183 ], [with_libupsclient="no (libupsclient not found)"])
1185 if test "x$with_libupsclient" = "xyes"
1187 AC_CHECK_HEADERS(upsclient.h,
1189 AC_DEFINE(HAVE_UPSCLIENT_H, 1, [Define to 1 if you have the <upsclient.h> header file.])
1190 ], [with_libupsclient="no (upsclient.h not found)"])
1192 AM_CONDITIONAL(BUILD_WITH_LIBUPSCLIENT, test "x$with_libupsclient" = "xyes")
1194 # Check for enabled/disabled features
1197 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
1198 # ------------------------------------------------------------
1200 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
1205 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
1210 m4_define([EnDis],[disabled])dnl
1211 m4_define([YesNo],[no])dnl
1217 m4_define([EnDis],[enabled])dnl
1218 m4_define([YesNo],[yes])dnl
1221 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
1225 m4_if([$3], [feature], [],
1229 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
1235 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
1237 enable_$1='[YesNo]'dnl
1239 if test "x$enable_$1" = "xno"
1243 if test "x$enable_$1" = "xyes"
1247 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
1252 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
1253 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
1255 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
1257 m4_divert_once([HELP_ENABLE], [
1258 collectd features:])
1259 AC_COLLECTD([debug], [enable], [feature], [debugging])
1260 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
1261 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
1263 m4_divert_once([HELP_ENABLE], [
1265 AC_COLLECTD([apache], [disable], [module], [Apache httpd statistics])
1266 AC_COLLECTD([apcups], [disable], [module], [Statistics of UPSes by APC])
1267 AC_COLLECTD([apple_sensors], [disable], [module], [Apple's hardware sensors])
1268 AC_COLLECTD([battery], [disable], [module], [battery statistics])
1269 AC_COLLECTD([cpu], [disable], [module], [cpu usage statistics])
1270 AC_COLLECTD([cpufreq], [disable], [module], [system cpu frequency statistics])
1271 AC_COLLECTD([disk], [disable], [module], [disk/partition statistics])
1272 AC_COLLECTD([csv], [disable], [module], [csv output plugin])
1273 AC_COLLECTD([df], [disable], [module], [df statistics])
1274 AC_COLLECTD([dns], [disable], [module], [dns statistics])
1275 AC_COLLECTD([email], [disable], [module], [email statistics])
1276 AC_COLLECTD([entropy], [disable], [module], [entropy statistics])
1277 AC_COLLECTD([exec], [disable], [module], [exec of external programs])
1278 AC_COLLECTD([hddtemp], [disable], [module], [hdd temperature statistics])
1279 AC_COLLECTD([interface], [disable], [module], [interface statistics])
1280 AC_COLLECTD([iptables], [disable], [module], [IPtables statistics])
1281 AC_COLLECTD([irq], [disable], [module], [irq statistics])
1282 AC_COLLECTD([load], [disable], [module], [system load statistics])
1283 AC_COLLECTD([mbmon], [disable], [module], [motherboard monitor statistics])
1284 AC_COLLECTD([memory], [disable], [module], [memory statistics])
1285 AC_COLLECTD([multimeter],[disable], [module], [multimeter statistics])
1286 AC_COLLECTD([mysql], [disable], [module], [mysql statistics])
1287 AC_COLLECTD([network], [disable], [module], [network functionality])
1288 AC_COLLECTD([nfs], [disable], [module], [nfs statistics])
1289 AC_COLLECTD([ntpd], [disable], [module], [ntpd statistics])
1290 AC_COLLECTD([nut], [disable], [module], [network UPS tools statistics])
1291 AC_COLLECTD([perl], [disable], [module], [embedded perl interpreter])
1292 AC_COLLECTD([ping], [disable], [module], [ping statistics])
1293 AC_COLLECTD([processes], [disable], [module], [processes statistics])
1294 AC_COLLECTD([sensors], [disable], [module], [lm_sensors statistics])
1295 AC_COLLECTD([serial], [disable], [module], [serial statistics])
1296 AC_COLLECTD([logfile], [disable], [module], [logfile log facility])
1297 AC_COLLECTD([swap], [disable], [module], [swap statistics])
1298 AC_COLLECTD([syslog], [disable], [module], [syslog log facility])
1299 AC_COLLECTD([tape], [disable], [module], [tape statistics])
1300 AC_COLLECTD([unixsock], [disable], [module], [UNIX socket plugin])
1301 AC_COLLECTD([users], [disable], [module], [user count statistics])
1302 AC_COLLECTD([vserver], [disable], [module], [vserver statistics])
1303 AC_COLLECTD([wireless], [disable], [module], [wireless link statistics])
1305 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile)
1307 if test "x$with_libperl" = "xyes"
1309 with_libperl="yes (version `perl -MConfig -e 'print $Config{version};'`)"
1311 enable_perl="no (needs libperl)"
1318 libcurl . . . . . . $with_libcurl
1319 libiokit . . . . . $with_libiokit
1320 libiptc . . . . . . $with_libiptc
1321 libkstat . . . . . $with_kstat
1322 libmysql . . . . . $with_libmysql
1323 liboping . . . . . $with_liboping
1324 libpcap . . . . . . $with_libpcap
1325 libperl . . . . . . $with_libperl
1326 libpthread . . . . $with_libpthread
1327 librrd . . . . . . $with_rrdtool
1328 libsensors . . . . $with_lm_sensors
1329 libstatgrab . . . . $with_libstatgrab
1330 libupsclient . . . $with_libupsclient
1333 daemon mode . . . . $enable_daemon
1334 debug . . . . . . . $enable_debug
1337 apache . . . . . . $enable_apache
1338 apcups . . . . . . $enable_apcups
1339 apple_sensors . . . $enable_apple_sensors
1340 battery . . . . . . $enable_battery
1341 cpu . . . . . . . . $enable_cpu
1342 cpufreq . . . . . . $enable_cpufreq
1343 csv . . . . . . . . $enable_csv
1344 df . . . . . . . . $enable_df
1345 disk . . . . . . . $enable_disk
1346 dns . . . . . . . . $enable_dns
1347 email . . . . . . . $enable_email
1348 entropy . . . . . . $enable_entropy
1349 exec . . . . . . . $enable_exec
1350 hddtemp . . . . . . $enable_hddtemp
1351 interface . . . . . $enable_interface
1352 iptables . . . . . $enable_iptables
1353 irq . . . . . . . . $enable_irq
1354 load . . . . . . . $enable_load
1355 logfile . . . . . . $enable_logfile
1356 mbmon . . . . . . . $enable_mbmon
1357 memory . . . . . . $enable_memory
1358 multimeter . . . . $enable_multimeter
1359 mysql . . . . . . . $enable_mysql
1360 network . . . . . . $enable_network
1361 nfs . . . . . . . . $enable_nfs
1362 ntpd . . . . . . . $enable_ntpd
1363 nut . . . . . . . . $enable_nut
1364 perl . . . . . . . $enable_perl
1365 ping . . . . . . . $enable_ping
1366 processes . . . . . $enable_processes
1367 sensors . . . . . . $enable_sensors
1368 serial . . . . . . $enable_serial
1369 swap . . . . . . . $enable_swap
1370 syslog . . . . . . $enable_syslog
1371 tape . . . . . . . $enable_tape
1372 unixsock . . . . . $enable_unixsock
1373 users . . . . . . . $enable_users
1374 vserver . . . . . . $enable_vserver
1375 wireless . . . . . $enable_wireless