1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, 4.0.0-rc5)
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")
987 with_own_liboconfig="no"
988 liboconfig_LDFLAGS="$LDFLAGS"
989 liboconfig_CPPFLAGS="$CPPFLAGS"
990 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
992 if test "x$withval" != "xno" && test "x$withval" != "xyes"
994 if test -d "$withval/lib"
996 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
998 if test -d "$withval/include"
1000 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1003 if test "x$withval" = "xno"
1005 AC_MSG_ERROR("liboconfig is required")
1009 with_liboconfig="yes"
1012 save_LDFLAGS="$LDFLAGS"
1013 save_CPPFLAGS="$CPPFLAGS"
1014 LDFLAGS="$liboconfig_LDFLAGS"
1015 CPPFLAGS="$liboconfig_CPPFLAGS"
1016 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1018 with_liboconfig="yes"
1019 with_own_liboconfig="no"
1022 with_liboconfig="yes"
1023 with_own_liboconfig="yes"
1024 LDFLAGS="$save_LDFLAGS"
1025 CPPFLAGS="$save_CPPFLAGS"
1028 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1029 if test "x$with_own_liboconfig" = "xyes"
1031 with_liboconfig="yes (shipped version)"
1034 #with_liboping="yes"
1035 with_own_liboping="no"
1036 liboping_LDFLAGS="$LDFLAGS"
1037 liboping_CPPFLAGS="$CPPFLAGS"
1038 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1040 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1042 if test -d "$withval/lib"
1044 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
1046 if test -d "$withval/include"
1048 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
1051 if test "x$withval" = "xno"
1054 with_own_liboping="no"
1062 if test "x$with_liboping" = "xyes"
1064 save_LDFLAGS="$LDFLAGS"
1065 save_CPPFLAGS="$CPPFLAGS"
1066 LDFLAGS="$liboping_LDFLAGS"
1067 CPPFLAGS="$liboping_CPPFLAGS"
1068 AC_CHECK_LIB(oping, ping_construct,
1071 with_own_liboping="no"
1075 with_own_liboping="yes"
1076 LDFLAGS="$save_LDFLAGS"
1077 CPPFLAGS="$save_CPPFLAGS"
1080 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1081 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1082 if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
1084 with_liboping="yes (shipped version)"
1087 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1089 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1091 LDFLAGS="$LDFLAGS -L$withval/lib"
1092 CPPFLAGS="$CPPFLAGS -I$withval/include"
1099 if test "x$with_libpcap" = "xyes"
1101 AC_CHECK_LIB(pcap, pcap_open_live,
1103 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1104 ], [with_libpcap="no (libpcap not found)"])
1106 if test "x$with_libpcap" = "xyes"
1108 AC_CHECK_HEADERS(pcap.h,
1110 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1111 ], [with_libpcap="no (pcap.h not found)"])
1113 if test "x$with_libpcap" = "xyes"
1119 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1120 [Wether or not to use the pcap library])
1121 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1123 perl_interpreter="perl"
1124 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1126 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1128 LDFLAGS="$LDFLAGS -L$withval/lib"
1129 CPPFLAGS="$CPPFLAGS -I$withval/include"
1130 perl_interpreter="$withval/bin/perl"
1137 if test "x$with_libperl" = "xyes"
1140 SAVE_LDFLAGS=$LDFLAGS
1141 PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
1142 PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
1143 CFLAGS="$CFLAGS $PERL_CFLAGS"
1144 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1146 AC_CACHE_CHECK([for libperl],
1156 PerlInterpreter *perl = NULL;
1157 Perl_load_module (perl, PERL_LOADMOD_NOIMPORT,
1158 newSVpv ("Collectd::Plugin::FooBar", 24),
1161 [have_libperl="yes"],
1166 if test "x$have_libperl" = "xyes"
1168 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
1169 AC_SUBST(PERL_CFLAGS)
1170 AC_SUBST(PERL_LDFLAGS)
1176 LDFLAGS=$SAVE_LDFLAGS
1178 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1180 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1182 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1184 LDFLAGS="$LDFLAGS -L$withval/lib"
1185 CPPFLAGS="$CPPFLAGS -I$withval/include"
1190 if test "x$ac_system" = "xLinux"
1194 with_libiptc="no (Linux only)"
1197 if test "x$with_libiptc" = "xyes"
1199 AC_CHECK_LIB(iptc, iptc_init,
1201 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1202 ], [with_libiptc="no (libiptc not found)"])
1204 if test "x$with_libiptc" = "xyes"
1206 AC_CHECK_HEADERS(libiptc/libiptc.h,
1208 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1209 ], [with_libiptc="no (libiptc/libiptc.h not found)"])
1211 if test "x$with_libiptc" = "xyes"
1217 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1219 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])],
1221 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1223 LDFLAGS="$LDFLAGS -L$withval/lib"
1224 CPPFLAGS="$CPPFLAGS -I$withval/include"
1225 with_libupsclient="yes"
1229 with_libupsclient="yes"
1231 if test "x$with_libupsclient" = "xyes"
1233 AC_CHECK_LIB(upsclient, upscli_connect,
1235 AC_DEFINE(HAVE_LIBUPSCLIENT, 1, [Define to 1 if you have the upsclient library (-lupsclient).])
1236 ], [with_libupsclient="no (libupsclient not found)"])
1238 if test "x$with_libupsclient" = "xyes"
1240 AC_CHECK_HEADERS(upsclient.h,
1242 AC_DEFINE(HAVE_UPSCLIENT_H, 1, [Define to 1 if you have the <upsclient.h> header file.])
1243 ], [with_libupsclient="no (upsclient.h not found)"])
1245 AM_CONDITIONAL(BUILD_WITH_LIBUPSCLIENT, test "x$with_libupsclient" = "xyes")
1247 # Check for enabled/disabled features
1250 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
1251 # ------------------------------------------------------------
1253 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
1258 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
1263 m4_define([EnDis],[disabled])dnl
1264 m4_define([YesNo],[no])dnl
1270 m4_define([EnDis],[enabled])dnl
1271 m4_define([YesNo],[yes])dnl
1274 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
1278 m4_if([$3], [feature], [],
1282 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
1288 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
1290 enable_$1='[YesNo]'dnl
1292 if test "x$enable_$1" = "xno"
1296 if test "x$enable_$1" = "xyes"
1300 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
1305 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
1306 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
1308 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
1310 m4_divert_once([HELP_ENABLE], [
1311 collectd features:])
1312 AC_COLLECTD([debug], [enable], [feature], [debugging])
1313 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
1314 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
1316 m4_divert_once([HELP_ENABLE], [
1318 AC_COLLECTD([apache], [disable], [module], [Apache httpd statistics])
1319 AC_COLLECTD([apcups], [disable], [module], [Statistics of UPSes by APC])
1320 AC_COLLECTD([apple_sensors], [disable], [module], [Apple's hardware sensors])
1321 AC_COLLECTD([battery], [disable], [module], [battery statistics])
1322 AC_COLLECTD([cpu], [disable], [module], [cpu usage statistics])
1323 AC_COLLECTD([cpufreq], [disable], [module], [system cpu frequency statistics])
1324 AC_COLLECTD([disk], [disable], [module], [disk/partition statistics])
1325 AC_COLLECTD([csv], [disable], [module], [csv output plugin])
1326 AC_COLLECTD([df], [disable], [module], [df statistics])
1327 AC_COLLECTD([dns], [disable], [module], [dns statistics])
1328 AC_COLLECTD([email], [disable], [module], [email statistics])
1329 AC_COLLECTD([entropy], [disable], [module], [entropy statistics])
1330 AC_COLLECTD([exec], [disable], [module], [exec of external programs])
1331 AC_COLLECTD([hddtemp], [disable], [module], [hdd temperature statistics])
1332 AC_COLLECTD([interface], [disable], [module], [interface statistics])
1333 AC_COLLECTD([iptables], [disable], [module], [IPtables statistics])
1334 AC_COLLECTD([irq], [disable], [module], [irq statistics])
1335 AC_COLLECTD([load], [disable], [module], [system load statistics])
1336 AC_COLLECTD([mbmon], [disable], [module], [motherboard monitor statistics])
1337 AC_COLLECTD([memory], [disable], [module], [memory statistics])
1338 AC_COLLECTD([multimeter],[disable], [module], [multimeter statistics])
1339 AC_COLLECTD([mysql], [disable], [module], [mysql statistics])
1340 AC_COLLECTD([network], [disable], [module], [network functionality])
1341 AC_COLLECTD([nfs], [disable], [module], [nfs statistics])
1342 AC_COLLECTD([ntpd], [disable], [module], [ntpd statistics])
1343 AC_COLLECTD([nut], [disable], [module], [network UPS tools statistics])
1344 AC_COLLECTD([perl], [disable], [module], [embedded perl interpreter])
1345 AC_COLLECTD([ping], [disable], [module], [ping statistics])
1346 AC_COLLECTD([processes], [disable], [module], [processes statistics])
1347 AC_COLLECTD([sensors], [disable], [module], [lm_sensors statistics])
1348 AC_COLLECTD([serial], [disable], [module], [serial statistics])
1349 AC_COLLECTD([logfile], [disable], [module], [logfile log facility])
1350 AC_COLLECTD([swap], [disable], [module], [swap statistics])
1351 AC_COLLECTD([syslog], [disable], [module], [syslog log facility])
1352 AC_COLLECTD([tape], [disable], [module], [tape statistics])
1353 AC_COLLECTD([unixsock], [disable], [module], [UNIX socket plugin])
1354 AC_COLLECTD([users], [disable], [module], [user count statistics])
1355 AC_COLLECTD([vserver], [disable], [module], [vserver statistics])
1356 AC_COLLECTD([wireless], [disable], [module], [wireless link statistics])
1358 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile)
1360 if test "x$with_libperl" = "xyes"
1362 with_libperl="yes (version `perl -MConfig -e 'print $Config{version};'`)"
1364 enable_perl="no (needs libperl)"
1371 libcurl . . . . . . $with_libcurl
1372 libiokit . . . . . $with_libiokit
1373 libiptc . . . . . . $with_libiptc
1374 libkstat . . . . . $with_kstat
1375 libmysql . . . . . $with_libmysql
1376 liboconfig . . . . $with_liboconfig
1377 liboping . . . . . $with_liboping
1378 libpcap . . . . . . $with_libpcap
1379 libperl . . . . . . $with_libperl
1380 libpthread . . . . $with_libpthread
1381 librrd . . . . . . $with_rrdtool
1382 libsensors . . . . $with_lm_sensors
1383 libstatgrab . . . . $with_libstatgrab
1384 libupsclient . . . $with_libupsclient
1387 daemon mode . . . . $enable_daemon
1388 debug . . . . . . . $enable_debug
1391 apache . . . . . . $enable_apache
1392 apcups . . . . . . $enable_apcups
1393 apple_sensors . . . $enable_apple_sensors
1394 battery . . . . . . $enable_battery
1395 cpu . . . . . . . . $enable_cpu
1396 cpufreq . . . . . . $enable_cpufreq
1397 csv . . . . . . . . $enable_csv
1398 df . . . . . . . . $enable_df
1399 disk . . . . . . . $enable_disk
1400 dns . . . . . . . . $enable_dns
1401 email . . . . . . . $enable_email
1402 entropy . . . . . . $enable_entropy
1403 exec . . . . . . . $enable_exec
1404 hddtemp . . . . . . $enable_hddtemp
1405 interface . . . . . $enable_interface
1406 iptables . . . . . $enable_iptables
1407 irq . . . . . . . . $enable_irq
1408 load . . . . . . . $enable_load
1409 logfile . . . . . . $enable_logfile
1410 mbmon . . . . . . . $enable_mbmon
1411 memory . . . . . . $enable_memory
1412 multimeter . . . . $enable_multimeter
1413 mysql . . . . . . . $enable_mysql
1414 network . . . . . . $enable_network
1415 nfs . . . . . . . . $enable_nfs
1416 ntpd . . . . . . . $enable_ntpd
1417 nut . . . . . . . . $enable_nut
1418 perl . . . . . . . $enable_perl
1419 ping . . . . . . . $enable_ping
1420 processes . . . . . $enable_processes
1421 sensors . . . . . . $enable_sensors
1422 serial . . . . . . $enable_serial
1423 swap . . . . . . . $enable_swap
1424 syslog . . . . . . $enable_syslog
1425 tape . . . . . . . $enable_tape
1426 unixsock . . . . . $enable_unixsock
1427 users . . . . . . . $enable_users
1428 vserver . . . . . . $enable_vserver
1429 wireless . . . . . $enable_wireless