1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, m4_esyscmd(./version-gen.sh))
3 AC_CONFIG_SRCDIR(src/collectd.c)
4 AC_CONFIG_HEADERS(src/config.h)
5 AM_INIT_AUTOMAKE(dist-bzip2)
8 AC_PREFIX_DEFAULT("/opt/collectd")
13 # Checks for programs.
21 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
25 AC_LIBLTDL_CONVENIENCE
32 AC_CONFIG_SUBDIRS(libltdl)
34 AC_MSG_CHECKING([for kernel type ($host_os)])
37 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
41 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
50 AC_MSG_RESULT([$ac_system])
53 # Checks for header files.
59 AC_CHECK_HEADERS(stdint.h stdio.h errno.h math.h stdarg.h syslog.h fcntl.h signal.h assert.h sys/types.h sys/socket.h sys/select.h poll.h netdb.h arpa/inet.h sys/resource.h sys/param.h kstat.h regex.h sys/ioctl.h)
62 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
67 # include <sys/types.h>
70 AC_CHECK_HEADERS(netinet/in.h, [], [],
75 # include <sys/types.h>
77 #if HAVE_NETINET_IN_SYSTM_H
78 # include <netinet/in_systm.h>
81 AC_CHECK_HEADERS(netinet/ip.h, [], [],
86 # include <sys/types.h>
88 #if HAVE_NETINET_IN_SYSTM_H
89 # include <netinet/in_systm.h>
92 # include <netinet/in.h>
95 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
100 # include <sys/types.h>
102 #if HAVE_NETINET_IN_SYSTM_H
103 # include <netinet/in_systm.h>
105 #if HAVE_NETINET_IN_H
106 # include <netinet/in.h>
108 #if HAVE_NETINET_IP_H
109 # include <netinet/ip.h>
112 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
117 # include <sys/types.h>
119 #if HAVE_NETINET_IN_SYSTM_H
120 # include <netinet/in_systm.h>
122 #if HAVE_NETINET_IN_H
123 # include <netinet/in.h>
125 #if HAVE_NETINET_IP_H
126 # include <netinet/ip.h>
129 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
134 # include <sys/types.h>
136 #if HAVE_NETINET_IN_SYSTM_H
137 # include <netinet/in_systm.h>
139 #if HAVE_NETINET_IN_H
140 # include <netinet/in.h>
143 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
148 # include <sys/types.h>
150 #if HAVE_NETINET_IN_SYSTM_H
151 # include <netinet/in_systm.h>
153 #if HAVE_NETINET_IN_H
154 # include <netinet/in.h>
156 #if HAVE_NETINET_IP6_H
157 # include <netinet/ip6.h>
160 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
165 # include <sys/types.h>
167 #if HAVE_NETINET_IN_SYSTM_H
168 # include <netinet/in_systm.h>
170 #if HAVE_NETINET_IN_H
171 # include <netinet/in.h>
173 #if HAVE_NETINET_IP_H
174 # include <netinet/ip.h>
177 AC_CHECK_HEADERS(netinet/udp.h, [], [],
182 # include <sys/types.h>
184 #if HAVE_NETINET_IN_SYSTM_H
185 # include <netinet/in_systm.h>
187 #if HAVE_NETINET_IN_H
188 # include <netinet/in.h>
190 #if HAVE_NETINET_IP_H
191 # include <netinet/ip.h>
196 AC_CHECK_HEADERS(sys/dkstat.h)
197 if test "x$ac_system" = "xDarwin"
199 AC_CHECK_HEADERS(mach/mach_init.h mach/host_priv.h mach/mach_error.h mach/mach_host.h mach/mach_port.h mach/mach_types.h mach/message.h mach/processor_set.h mach/processor.h mach/processor_info.h mach/task.h mach/thread_act.h mach/vm_region.h mach/vm_map.h mach/vm_prot.h mach/vm_statistics.h mach/kern_return.h)
200 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
202 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
205 # include <sys/types.h>
208 # include <sys/param.h>
213 AC_CHECK_HEADERS(linux/major.h libgen.h)
215 # For the battery plugin
216 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
218 #if HAVE_IOKIT_IOKITLIB_H
219 # include <IOKit/IOKitLib.h>
221 #if HAVE_IOKIT_IOTYPES_H
222 # include <IOKit/IOTypes.h>
226 # For the swap module
227 AC_CHECK_HEADERS(sys/swap.h, [], [],
230 # include <sys/types.h>
233 # include <sys/param.h>
238 # For the processes plugin
240 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
242 # For interface plugin
243 AC_CHECK_HEADERS(ifaddrs.h)
244 AC_CHECK_HEADERS(net/if.h, [], [],
247 # include <sys/types.h>
249 #if HAVE_SYS_SOCKET_H
250 # include <sys/socket.h>
253 AC_CHECK_HEADERS(linux/if.h, [], [],
256 # include <sys/types.h>
258 #if HAVE_SYS_SOCKET_H
259 # include <sys/socket.h>
262 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
265 # include <sys/types.h>
267 #if HAVE_SYS_SOCKET_H
268 # include <sys/socket.h>
271 # include <linux/if.h>
276 have_net_ip_vs_h="no"
278 if test "x$ac_system" = "xLinux"
280 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
281 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
285 AC_CHECK_HEADERS(sys/ucred.h, [], [],
288 # include <sys/types.h>
291 # include <sys/param.h>
295 # For mount interface
296 AC_CHECK_HEADERS(sys/mount.h, [], [],
299 # include <sys/types.h>
302 # include <sys/param.h>
306 # For the email plugin
307 AC_CHECK_HEADERS(linux/un.h, [], [],
309 #if HAVE_SYS_SOCKET_H
310 # include <sys/socket.h>
314 AC_CHECK_HEADERS(pwd.h grp.h sys/un.h ctype.h limits.h sys/quota.h xfs/xqm.h fs_info.h fshelp.h paths.h mntent.h mnttab.h sys/fstyp.h sys/fs_types.h sys/mntent.h sys/mnttab.h sys/statfs.h sys/statvfs.h sys/vfs.h sys/vfstab.h kvm.h wordexp.h)
317 AC_CHECK_HEADERS(arpa/nameser.h)
318 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
320 #if HAVE_ARPA_NAMESER_H
321 # include <arpa/nameser.h>
325 AC_CHECK_HEADERS(net/if_arp.h, [], [],
326 [#if HAVE_SYS_SOCKET_H
327 # include <sys/socket.h>
330 AC_CHECK_HEADERS(net/ppp_defs.h)
331 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
332 [#if HAVE_NET_PPP_DEFS_H
333 # include <net/ppp_defs.h>
336 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
341 # include <sys/types.h>
343 #if HAVE_SYS_SOCKET_H
344 # include <sys/socket.h>
349 #if HAVE_NETINET_IN_H
350 # include <netinet/in.h>
354 # For the multimeter plugin
356 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
359 # Checks for typedefs, structures, and compiler characteristics.
368 # Checks for library functions.
370 AC_PROG_GCC_TRADITIONAL
371 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog)
375 AC_CHECK_FUNCS(getpwnam_r)
376 AC_CHECK_FUNCS(getgrnam_r)
378 socket_needs_socket="no"
379 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
380 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
382 nanosleep_needs_rt="no"
383 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
384 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
386 AC_CHECK_FUNCS(regcomp regerror regexec regfree)
388 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
389 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
390 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
391 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
392 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
393 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
394 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
395 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
396 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
397 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
400 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
403 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
405 if test "x$withval" = "xno"; then
407 else if test "x$withval" = "xyes"; then
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"
439 if test "x$nan_type" = "xnone"; then
440 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
446 #define __USE_ISOC99 1
448 static float foo = NAN;
456 [have_nan_isoc="yes"],
460 if test "x$have_nan_isoc" = "xyes"
465 if test "x$nan_type" = "xnone"; then
466 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
476 #define NAN (0.0 / 0.0)
478 # define isnan(f) ((f) != (f))
480 static float foo = NAN;
488 [have_nan_zero="yes"],
492 if test "x$have_nan_zero" = "xyes"
498 if test "x$nan_type" = "xdefault"; then
499 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
500 [Define if NAN is defined by default and can initialize static variables.])
501 else if test "x$nan_type" = "xisoc99"; then
502 AC_DEFINE(NAN_STATIC_ISOC, 1,
503 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
504 else if test "x$nan_type" = "xzero"; then
505 AC_DEFINE(NAN_ZERO_ZERO, 1,
506 [Define if NAN can be defined as (0.0 / 0.0)])
508 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
511 # For mount interface
512 #AC_CHECK_FUNCS(getfsent getvfsent)
515 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
517 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
519 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
522 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
523 if test "x$have_getmntent" = "xno"; then
524 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
526 if test "x$have_getmntent" = "xno"; then
527 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
529 if test "x$have_getmntent" = "xno"; then
530 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
533 if test "x$have_getmntent" = "xc"; then
534 AC_CACHE_CHECK([whether getmntent takes one argument],
535 [have_one_getmntent],
537 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
539 #include "$srcdir/src/utils_mount.h"]],
543 fh = setmntent ("/etc/mtab", "r");
547 [have_one_getmntent="yes"],
548 [have_one_getmntent="no"]
551 AC_CACHE_CHECK([whether getmntent takes two arguments],
552 [have_two_getmntent],
554 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
555 #include <sys/mnttab.h>
556 #include "$srcdir/src/utils_mount.h"]],
561 fh = fopen ("/etc/mnttab", "r");
562 status = getmntent (fh, &mt);
565 [have_two_getmntent="yes"],
566 [have_two_getmntent="no"]
571 # Check for different versions of `getmntent' here..
573 if test "x$have_getmntent" = "xc"; then
574 if test "x$have_one_getmntent" = "xyes"; then
575 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
576 [Define if the function getmntent exists and takes one argument.])
578 if test "x$have_two_getmntent" = "xyes"; then
579 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
580 [Define if the function getmntent exists and takes two arguments.])
583 if test "x$have_getmntent" = "xsun"; then
584 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
585 [Define if the function getmntent exists. It's the version from libsun.])
587 if test "x$have_getmntent" = "xseq"; then
588 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
589 [Define if the function getmntent exists. It's the version from libseq.])
591 if test "x$have_getmntent" = "xgen"; then
592 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
593 [Define if the function getmntent exists. It's the version from libgen.])
596 # Check for structures
597 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
598 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
601 #include <sys/types.h>
602 #include <sys/socket.h>
605 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
606 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
609 #include <sys/types.h>
610 #include <sys/socket.h>
611 #include <linux/if.h>
612 #include <linux/netdevice.h>
615 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
620 # include <sys/types.h>
622 #if HAVE_NETINET_IN_SYSTM_H
623 # include <netinet/in_systm.h>
625 #if HAVE_NETINET_IN_H
626 # include <netinet/in.h>
628 #if HAVE_NETINET_IP_H
629 # include <netinet/ip.h>
631 #if HAVE_NETINET_UDP_H
632 # include <netinet/udp.h>
635 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
640 # include <sys/types.h>
642 #if HAVE_NETINET_IN_SYSTM_H
643 # include <netinet/in_systm.h>
645 #if HAVE_NETINET_IN_H
646 # include <netinet/in.h>
648 #if HAVE_NETINET_IP_H
649 # include <netinet/ip.h>
651 #if HAVE_NETINET_UDP_H
652 # include <netinet/udp.h>
656 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
666 AC_CHECK_LIB(resolv, res_search,
668 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
670 [with_libresolv="no"])
671 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
673 dnl Check for HAL (hardware abstraction library)
675 AC_CHECK_LIB(hal,libhal_device_property_exists,
676 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
678 if test "x$with_libhal" = "xyes"; then
680 if test "x$PKG_CONFIG" != "x"; then
681 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
682 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
683 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
684 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
688 m4_divert_once([HELP_WITH], [
689 collectd additional packages:])
691 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
694 librrd_threadsafe="yes"
695 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
696 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
698 librrd_cflags="-I$withval/include"
699 librrd_ldflags="-L$withval/lib"
702 with_rrdtool="$withval"
704 ], [with_rrdtool="yes"])
705 if test "x$with_rrdtool" = "xyes"
707 SAVE_CPPFLAGS="$CPPFLAGS"
708 SAVE_LDFLAGS="$LDFLAGS"
710 CPPFLAGS="$CPPFLAGS $librrd_cflags"
711 LDFLAGS="$LDFLAGS $librrd_ldflags"
713 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
715 CPPFLAGS="$SAVE_CPPFLAGS"
716 LDFLAGS="$SAVE_LDFLAGS"
718 if test "x$with_rrdtool" = "xyes"
720 SAVE_CPPFLAGS="$CPPFLAGS"
721 SAVE_LDFLAGS="$LDFLAGS"
723 CPPFLAGS="$CPPFLAGS $librrd_cflags"
724 LDFLAGS="$LDFLAGS $librrd_ldflags"
726 AC_CHECK_LIB(rrd_th, rrd_update_r,
728 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
730 [librrd_threadsafe="no"
731 AC_CHECK_LIB(rrd, rrd_update,
733 librrd_ldflags="$librrd_ldflags -lrrd -lm"
735 [with_rrdtool="no (symbol 'rrd_update' not found)"],
740 CPPFLAGS="$SAVE_CPPFLAGS"
741 LDFLAGS="$SAVE_LDFLAGS"
743 if test "x$with_rrdtool" = "xyes"
745 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
746 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
747 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
748 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
750 if test "x$librrd_threadsafe" = "xyes"
752 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
755 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
756 [ if test "x$withval" != "xno" -a "x$withval" != "xyes"
758 LDFLAGS="$LDFLAGS -L$withval/lib"
759 CPPFLAGS="$CPPFLAGS -I$withval/include"
760 with_libpthread="yes"
762 if test "x$withval" = "xno"
764 with_libpthread="no (disabled)"
767 ], [with_libpthread="yes"])
768 if test "x$with_libpthread" = "xyes"
770 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
772 if test "x$with_libpthread" = "xyes"
774 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
776 if test "x$with_libpthread" = "xyes"
782 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
783 [Wether or not to use pthread (POSIX threads) library])
784 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
786 if test "x$ac_system" = "xSolaris"
791 with_kstat="no (Solaris only)"
792 with_devinfo="no (Solaris only)"
795 if test "x$with_kstat" = "xyes"
797 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
799 if test "x$with_kstat" = "xyes"
801 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
802 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
804 if test "x$with_kstat" = "xyes"
806 AC_DEFINE(HAVE_LIBKSTAT, 1,
807 [Define to 1 if you have the 'kstat' library (-lkstat)])
809 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
810 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
812 ### BEGIN of check for libcurl ###
813 with_curl_config="curl-config"
816 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
818 if test "x$withval" = "xno"
821 else if test "x$withval" = "xyes"
825 if test -f "$withval" && test -x "$withval"
827 with_curl_config="$withval"
829 else if test -x "$withval/bin/curl-config"
831 with_curl_config="$withval/bin/curl-config"
840 if test "x$with_libcurl" = "xyes"
842 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
843 curl_config_status=$?
845 if test $curl_config_status -ne 0
847 with_libcurl="no ($with_curl_config failed)"
850 CFLAGS="$CFLAGS $with_curl_cflags"
852 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
854 CFLAGS="$SAVE_CFLAGS"
857 if test "x$with_libcurl" = "xyes"
859 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
860 curl_config_status=$?
862 if test $curl_config_status -ne 0
864 with_libcurl="no ($with_curl_config failed)"
866 AC_CHECK_LIB(curl, curl_easy_init,
867 [with_libcurl="yes"],
868 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
872 if test "x$with_libcurl" = "xyes"
874 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
875 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
876 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
877 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
879 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
880 ### END of check for libcurl ###
884 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
893 AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
894 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
896 with_libstatgrab="yes"
898 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
900 if test "x$withval" != "xno" -a "x$withval" != "xyes"
902 LDFLAGS="$LDFLAGS -L$withval/lib"
903 CPPFLAGS="$CPPFLAGS -I$withval/include"
904 with_libstatgrab="yes"
906 with_libstatgrab="$withval"
910 if test "x$ac_system" == "xunknown"
912 with_libstatgrab="yes"
914 with_libstatgrab="no"
917 if test "x$with_libstatgrab" = "xyes"
919 AC_CHECK_LIB(statgrab, sg_init, [with_libstatgrab="yes"], [with_libstatgrab="no (libstatgrab not found)"])
921 if test "x$with_libstatgrab" = "xyes"
923 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (statgrab.h not found)"])
925 if test "x$with_libstatgrab" = "xyes"
927 AC_CHECK_LIB(devstat, getdevs, [with_libdevstat="yes"], [with_libdevstat="no"])
929 if test "x$with_libstatgrab" = "xyes"
931 collect_libstatgrab=1
933 collect_libstatgrab=0
935 AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
936 [Wether or not to use statgrab library])
937 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
938 AM_CONDITIONAL(BUILD_WITH_LIBDEVSTAT, test "x$with_libdevstat" = "xyes")
940 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
941 if test "x$with_libkvm" = "xyes"
943 AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
945 AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
947 with_sensors_cflags=""
948 with_sensors_ldflags=""
949 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
951 if test "x$withval" = "xno"
955 with_lm_sensors="yes"
956 if test "x$withval" != "xyes"
958 with_sensors_cflags="-I$withval/include"
959 with_sensors_ldflags="-L$withval/lib"
960 with_lm_sensors="yes"
965 if test "x$ac_system" = "xLinux"
967 with_lm_sensors="yes"
969 with_lm_sensors="no (Linux only library)"
972 if test "x$with_lm_sensors" = "xyes"
974 SAVE_CPPFLAGS="$CPPFLAGS"
975 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
977 # AC_CHECK_HEADERS(sensors/sensors.h,
979 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
981 # [with_lm_sensors="no (sensors/sensors.h not found)"])
982 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_lm_sensors="no (sensors/sensors.h not found)"])
984 CPPFLAGS="$SAVE_CPPFLAGS"
986 if test "x$with_lm_sensors" = "xyes"
988 SAVE_CPPFLAGS="$CPPFLAGS"
989 SAVE_LDFLAGS="$LDFLAGS"
990 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
991 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
993 AC_CHECK_LIB(sensors, sensors_init,
995 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
997 [with_lm_sensors="no (libsensors not found)"])
999 CPPFLAGS="$SAVE_CPPFLAGS"
1000 LDFLAGS="$SAVE_LDFLAGS"
1002 if test "x$with_lm_sensors" = "xyes"
1004 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
1005 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
1006 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
1007 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
1009 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
1011 with_mysql_config="mysql_config"
1012 with_mysql_cflags=""
1014 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1016 if test "x$withval" = "xno"
1019 else if test "x$withval" = "xyes"
1023 if test -f "$withval" && test -x "$withval";
1025 with_mysql_config="$withval"
1026 else if test -x "$withval/bin/mysql_config"
1028 with_mysql_config="$withval/bin/mysql_config"
1036 if test "x$with_libmysql" = "xyes"
1038 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1039 mysql_config_status=$?
1041 if test $mysql_config_status -ne 0
1046 CFLAGS="$CFLAGS $with_mysql_cflags"
1048 AC_CHECK_HEADERS(mysql/mysql.h, [], [with_libmysql="no (mysql/mysql.h not found)"], [])
1050 CFLAGS="$SAVE_CFLAGS"
1053 if test "x$with_libmysql" = "xyes"
1055 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
1056 mysql_config_status=$?
1058 if test $mysql_config_status -ne 0
1062 AC_CHECK_LIB(mysqlclient, mysql_init,
1063 [with_libmysql="yes"],
1064 [with_libmysql="no (symbol 'mysql_init' not found)"],
1068 if test "x$with_libmysql" = "xyes"
1070 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
1071 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
1072 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
1073 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
1075 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
1077 with_own_liboconfig="no"
1078 liboconfig_LDFLAGS="$LDFLAGS"
1079 liboconfig_CPPFLAGS="$CPPFLAGS"
1080 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1082 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1084 if test -d "$withval/lib"
1086 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1088 if test -d "$withval/include"
1090 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1093 if test "x$withval" = "xno"
1095 AC_MSG_ERROR("liboconfig is required")
1099 with_liboconfig="yes"
1102 save_LDFLAGS="$LDFLAGS"
1103 save_CPPFLAGS="$CPPFLAGS"
1104 LDFLAGS="$liboconfig_LDFLAGS"
1105 CPPFLAGS="$liboconfig_CPPFLAGS"
1106 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1108 with_liboconfig="yes"
1109 with_own_liboconfig="no"
1112 with_liboconfig="yes"
1113 with_own_liboconfig="yes"
1114 LDFLAGS="$save_LDFLAGS"
1115 CPPFLAGS="$save_CPPFLAGS"
1118 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1119 if test "x$with_own_liboconfig" = "xyes"
1121 with_liboconfig="yes (shipped version)"
1124 #with_liboping="yes"
1125 with_own_liboping="no"
1126 liboping_LDFLAGS="$LDFLAGS"
1127 liboping_CPPFLAGS="$CPPFLAGS"
1128 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1130 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1132 if test -d "$withval/lib"
1134 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
1136 if test -d "$withval/include"
1138 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
1141 if test "x$withval" = "xno"
1144 with_own_liboping="no"
1145 else if test "x$withval" = "xyes"
1154 if test "x$with_liboping" = "xyes"
1156 save_LDFLAGS="$LDFLAGS"
1157 save_CPPFLAGS="$CPPFLAGS"
1158 LDFLAGS="$liboping_LDFLAGS"
1159 CPPFLAGS="$liboping_CPPFLAGS"
1160 AC_CHECK_LIB(oping, ping_construct,
1163 with_own_liboping="no"
1167 with_own_liboping="yes"
1168 LDFLAGS="$save_LDFLAGS"
1169 CPPFLAGS="$save_CPPFLAGS"
1172 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1173 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1175 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1177 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1179 LDFLAGS="$LDFLAGS -L$withval/lib"
1180 CPPFLAGS="$CPPFLAGS -I$withval/include"
1183 with_libpcap="$withval"
1189 if test "x$with_libpcap" = "xyes"
1191 AC_CHECK_LIB(pcap, pcap_open_live,
1193 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1194 ], [with_libpcap="no (libpcap not found)"])
1196 if test "x$with_libpcap" = "xyes"
1198 AC_CHECK_HEADERS(pcap.h,
1200 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1201 ], [with_libpcap="no (pcap.h not found)"])
1203 if test "x$with_libpcap" = "xyes"
1209 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1210 [Wether or not to use the pcap library])
1211 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1213 perl_interpreter="perl"
1214 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1216 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1218 LDFLAGS="$LDFLAGS -L$withval/lib"
1219 CPPFLAGS="$CPPFLAGS -I$withval/include"
1220 perl_interpreter="$withval/bin/perl"
1223 with_libperl="$withval"
1230 AC_SUBST(PERL, "$perl_interpreter")
1232 if test "x$with_libperl" = "xyes"
1235 SAVE_LDFLAGS=$LDFLAGS
1236 PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
1237 PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
1238 CFLAGS="$CFLAGS $PERL_CFLAGS"
1239 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1241 AC_CACHE_CHECK([for libperl],
1251 PerlInterpreter *perl = NULL;
1252 Perl_load_module (perl, PERL_LOADMOD_NOIMPORT,
1253 newSVpv ("Collectd::Plugin::FooBar", 24),
1256 [have_libperl="yes"],
1261 if test "x$have_libperl" = "xyes"
1263 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
1264 AC_SUBST(PERL_CFLAGS)
1265 AC_SUBST(PERL_LDFLAGS)
1271 LDFLAGS=$SAVE_LDFLAGS
1273 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1275 if test "x$with_libperl" = "xyes"
1278 SAVE_LDFLAGS=$LDFLAGS
1279 CFLAGS="$CFLAGS $PERL_CFLAGS"
1280 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1282 AC_CACHE_CHECK([if perl supports ithreads],
1283 [have_perl_ithreads],
1291 #if !defined(USE_ITHREADS)
1292 # error "Perl does not support ithreads!"
1293 #endif /* !defined(USE_ITHREADS) */
1296 [have_perl_ithreads="yes"],
1297 [have_perl_ithreads="no"]
1301 if test "x$have_perl_ithreads" = "xyes"
1303 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
1307 LDFLAGS=$SAVE_LDFLAGS
1310 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1312 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1314 LDFLAGS="$LDFLAGS -L$withval/lib"
1315 CPPFLAGS="$CPPFLAGS -I$withval/include"
1318 with_libiptc="$withval"
1322 if test "x$ac_system" = "xLinux"
1326 with_libiptc="no (Linux only)"
1329 if test "x$with_libiptc" = "xyes"
1331 AC_CHECK_LIB(iptc, iptc_init,
1333 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1334 ], [with_libiptc="no (libiptc not found)"])
1336 if test "x$with_libiptc" = "xyes"
1338 AC_CHECK_HEADERS(libiptc/libiptc.h,
1340 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1341 ], [with_libiptc="no (libiptc/libiptc.h not found)"])
1343 if test "x$with_libiptc" = "xyes"
1349 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1351 with_snmp_config="net-snmp-config"
1354 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1356 if test "x$withval" = "xno"
1358 with_libnetsnmp="no"
1359 else if test "x$withval" = "xyes"
1361 with_libnetsnmp="yes"
1363 if test -x "$withval"
1365 with_snmp_config="$withval"
1366 with_libnetsnmp="yes"
1368 with_snmp_config="$withval/bin/net-snmp-config"
1369 with_libnetsnmp="yes"
1373 [with_libnetsnmp="yes"])
1374 if test "x$with_libnetsnmp" = "xyes"
1376 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
1377 snmp_config_status=$?
1379 if test $snmp_config_status -ne 0
1381 with_libnetsnmp="no ($with_snmp_config failed)"
1384 CFLAGS="$CFLAGS $with_snmp_cflags"
1386 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1388 CFLAGS="$SAVE_CFLAGS"
1391 if test "x$with_libnetsnmp" = "xyes"
1393 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
1394 snmp_config_status=$?
1396 if test $snmp_config_status -ne 0
1398 with_libnetsnmp="no ($with_snmp_config failed)"
1400 AC_CHECK_LIB(netsnmp, init_snmp,
1401 [with_libnetsnmp="yes"],
1402 [with_libnetsnmp="no (libnetsnmp not found)"],
1406 if test "x$with_libnetsnmp" = "xyes"
1408 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
1409 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
1410 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
1411 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
1413 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1415 with_upsclient_config="libupsclient-config"
1416 with_upsclient_cflags=""
1417 with_upsclient_libs=""
1418 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])],
1420 if test "x$withval" = "xno"
1422 with_libupsclient="no"
1424 if test "x$withval" != "xyes"
1426 if test -f "$withval" && test -x "$withval";
1428 with_upsclient_config="$withval"
1430 with_upsclient_config="$withval/bin/libupsclient-config"
1433 with_libupsclient="yes"
1437 with_libupsclient="yes"
1439 if test "x$with_libupsclient" = "xyes"
1441 with_upsclient_cflags=`$with_upsclient_config --cflags 2>/dev/null`
1442 upsclient_config_status=$?
1444 if test $upsclient_config_status -ne 0
1446 with_libupsclient="no ($with_upsclient_config failed)"
1449 if test "x$with_libupsclient" = "xyes"
1451 SAVE_CFLAGS="$CFLAGS"
1452 CFLAGS="$CFLAGS $with_upsclient_cflags"
1454 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
1456 CFLAGS="$SAVE_CFLAGS"
1458 if test "x$with_libupsclient" = "xyes"
1460 with_upsclient_libs=`$with_upsclient_config --libs 2>/dev/null`
1461 upsclient_config_status=$?
1463 if test $upsclient_config_status -ne 0
1465 with_libupsclient="no ($with_upsclient_config failed)"
1468 if test "x$with_libupsclient" = "xyes"
1470 AC_CHECK_LIB(upsclient, upscli_connect,
1472 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_upsclient_cflags"
1473 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_upsclient_libs"
1474 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
1475 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
1478 with_libupsclient="no (symbol 'upscli_connect' not found)"
1479 ], [$with_upsclient_libs])
1481 if test "x$with_libupsclient" = "xyes"
1483 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
1484 [#include <stdlib.h>
1486 #include <upsclient.h>])
1488 AM_CONDITIONAL(BUILD_WITH_LIBUPSCLIENT, test "x$with_libupsclient" = "xyes")
1490 ### BEGIN of check for libxmms ###
1491 with_xmms_config="xmms-config"
1494 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
1496 if test "x$withval" != "xno" -a "x$withval" != "xyes"
1498 if test -f "$withval" && test -x "$withval";
1500 with_xmms_config="$withval"
1501 else if test -x "$withval/bin/xmms-config"
1503 with_xmms_config="$withval/bin/xmms-config"
1506 else if test "x$withval" = "xno"
1516 if test "x$with_libxmms" = "xyes"
1518 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
1519 xmms_config_status=$?
1521 if test $xmms_config_status -ne 0
1526 if test "x$with_libxmms" = "xyes"
1528 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
1529 xmms_config_status=$?
1531 if test $xmms_config_status -ne 0
1536 if test "x$with_libxmms" = "xyes"
1538 AC_CHECK_LIB(xmms, xmms_remote_get_info,
1540 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
1541 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
1542 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
1543 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
1550 with_libxmms_numeric=0
1551 if test "x$with_libxmms" = "xyes"
1553 with_libxmms_numeric=1
1555 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
1556 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
1557 ### END of check for libxmms ###
1559 with_libnetlink_cflags=""
1560 with_libnetlink_libs="-lnetlink"
1561 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
1563 echo "libnetlink: withval = $withval"
1564 if test "x$withval" = "xyes"
1566 with_libnetlink="yes"
1567 else if test "x$withval" = "xno"
1569 with_libnetlink="no"
1571 if test -d "$withval/include"
1573 with_libnetlink_cflags="-I$withval/include"
1574 with_libnetlink_libs="-L$withval/lib -lnetlink"
1575 with_libnetlink="yes"
1577 AC_MSG_ERROR("no such directory: $withval/include")
1582 if test "x$ac_system" = "xLinux"
1584 with_libnetlink="yes"
1586 with_libnetlink="no (Linux only library)"
1589 if test "x$with_libnetlink" = "xyes"
1592 CFLAGS="$CFLAGS $with_libnetlink_cflags"
1594 with_libnetlink="no (libnetlink.h not found)"
1596 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
1598 with_libnetlink="yes"
1602 #include <sys/types.h>
1603 #include <asm/types.h>
1604 #include <sys/socket.h>
1605 #include <linux/netlink.h>
1606 #include <linux/rtnetlink.h>])
1607 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
1609 #include <sys/types.h>
1610 #include <asm/types.h>
1611 #include <sys/socket.h>])
1615 #include <sys/types.h>
1616 #include <asm/types.h>
1617 #include <sys/socket.h>
1618 #include <linux/netlink.h>
1619 #include <linux/rtnetlink.h>
1623 int retval = TCA_STATS2;
1626 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
1631 #include <sys/types.h>
1632 #include <asm/types.h>
1633 #include <sys/socket.h>
1634 #include <linux/netlink.h>
1635 #include <linux/rtnetlink.h>
1639 int retval = TCA_STATS;
1642 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
1645 CFLAGS="$SAVE_CFLAGS"
1647 if test "x$with_libnetlink" = "xyes"
1649 AC_CHECK_LIB(netlink, rtnl_open,
1650 [with_libnetlink="yes"],
1651 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
1652 [$with_libnetlink_libs])
1654 if test "x$with_libnetlink" = "xyes"
1656 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
1657 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
1658 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
1659 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
1661 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
1663 dnl Check for libvirt and libxml2 libraries.
1664 with_libxml2="no (pkg-config isn't available)"
1665 with_libxml2_cflags=""
1666 with_libxml2_ldflags=""
1667 with_libvirt="no (pkg-config isn't available)"
1668 with_libvirt_cflags=""
1669 with_libvirt_ldflags=""
1671 if test "x$PKG_CONFIG" != "x"
1673 pkg-config --exists 'libxml-2.0' 2>/dev/null
1678 with_libxml2="no (pkg-config doesn't know library)"
1681 pkg-config --exists libvirt 2>/dev/null
1686 with_libvirt="no (pkg-config doesn't know library)"
1689 if test "x$with_libxml2" = "xyes"
1691 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
1696 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
1702 if test "x$with_libxml2" = "xyes"
1704 SAVE_CPPFLAGS="$CPPFLAGS"
1705 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
1707 AC_CHECK_HEADERS(libxml/parser.h, [],
1708 [with_libxml2="no (libxml/parser.h not found)"])
1710 CPPFLAGS="$SAVE_CPPFLAGS"
1712 if test "x$with_libxml2" = "xyes"
1714 SAVE_CFLAGS="$CFLAGS"
1715 SAVE_LD_FLAGS="$LDFLAGS"
1717 CFLAGS="$CFLAGS $with_libxml2_cflags"
1718 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
1720 AC_CHECK_LIB(xml2, xmlXPathEval,
1721 [with_libxml2="yes"],
1722 [with_libxml2="no (symbol xmlXPathEval not found)"])
1724 CFLAGS="$SAVE_CFLAGS"
1725 LDFLAGS="$SAVE_LDFLAGS"
1727 dnl Add the right compiler flags and libraries.
1728 if test "x$with_libxml2" = "xyes"; then
1729 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
1730 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
1731 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
1732 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
1734 if test "x$with_libvirt" = "xyes"
1736 with_libvirt_cflags="`pkg-config --cflags libvirt`"
1741 with_libvirt_ldflags="`pkg-config --libs libvirt`"
1747 if test "x$with_libvirt" = "xyes"
1749 SAVE_CPPFLAGS="$CPPFLAGS"
1750 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
1752 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
1753 [with_libvirt="no (libvirt/libvirt.h not found)"])
1755 CPPFLAGS="$SAVE_CPPFLAGS"
1757 if test "x$with_libvirt" = "xyes"
1759 SAVE_CFLAGS="$CFLAGS"
1760 SAVE_LD_FLAGS="$LDFLAGS"
1762 CFLAGS="$CFLAGS $with_libvirt_cflags"
1763 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
1765 AC_CHECK_LIB(virt, virDomainBlockStats,
1766 [with_libvirt="yes"],
1767 [with_libvirt="no (symbol virDomainBlockStats not found)"])
1769 CFLAGS="$SAVE_CFLAGS"
1770 LDFLAGS="$SAVE_LDFLAGS"
1772 dnl Add the right compiler flags and libraries.
1773 if test "x$with_libvirt" = "xyes"; then
1774 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
1775 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
1776 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
1777 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
1780 dnl End of check for libvirt and libxml2 libraries.
1782 # Check for enabled/disabled features
1785 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
1786 # ------------------------------------------------------------
1788 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
1793 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
1798 m4_define([EnDis],[disabled])dnl
1799 m4_define([YesNo],[no])dnl
1805 m4_define([EnDis],[enabled])dnl
1806 m4_define([YesNo],[yes])dnl
1809 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
1813 m4_if([$3], [feature], [],
1817 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
1823 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
1825 enable_$1='[YesNo]'dnl
1827 if test "x$enable_$1" = "xno"
1831 if test "x$enable_$1" = "xyes"
1835 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
1840 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
1841 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
1843 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
1845 # AC_PLUGIN(name, default, info)
1846 # ------------------------------------------------------------
1852 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
1854 if test "x$enableval" = "xyes"
1862 if test "x$2" = "xyes"
1869 if test "x$enable_plugin" = "xyes"
1871 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
1873 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
1874 enable_$1="$enable_plugin"
1876 )# AC_PLUGIN(name, default, info)
1878 m4_divert_once([HELP_ENABLE], [
1879 collectd features:])
1880 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
1881 AC_COLLECTD([debug], [enable], [feature], [debugging])
1882 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
1883 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
1891 plugin_interface="no"
1897 plugin_multimeter="no"
1900 plugin_processes="no"
1904 plugin_tcpconns="no"
1907 plugin_wireless="no"
1910 if test "x$ac_system" = "xLinux"
1912 plugin_battery="yes"
1914 plugin_cpufreq="yes"
1916 plugin_entropy="yes"
1917 plugin_interface="yes"
1922 plugin_processes="yes"
1925 plugin_tcpconns="yes"
1926 plugin_vserver="yes"
1927 plugin_wireless="yes"
1929 if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
1936 if test "x$with_libiokit" = "xyes"
1938 plugin_battery="yes"
1943 if test "x$with_devinfo$with_kstat" = "xyesyes"
1947 plugin_interface="yes"
1954 if test "x$with_libstatgrab" = "xyes"
1956 plugin_interface="yes"
1962 if test "x$have_processor_info" = "xyes"
1966 if test "x$have_sysctlbyname" = "xyes"
1970 plugin_tcpconns="yes"
1973 if test "x$have_statfs" = "xyes"
1977 if test "x$have_statvfs" = "xyes"
1982 if test "x$have_getifaddrs" = "xyes"
1984 plugin_interface="yes"
1987 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
1989 plugin_libvirt="yes"
1992 if test "x$have_getloadavg" = "xyes"
1997 if test "x$have_libperl$have_perl_ithreads" = "xyesyes"
2002 # Mac OS X memory interface
2003 if test "x$have_host_statistics" = "xyes"
2008 if test "x$have_termios_h" = "xyes"
2010 plugin_multimeter="yes"
2013 if test "x$have_thread_info" = "xyes"
2015 plugin_processes="yes"
2018 if test "x$with_libkvm" = "xyes"
2023 if test "x$have_getutent" = "xyes"
2027 if test "x$have_getutxent" = "xyes"
2032 # FIXME: sysctl for swap plugin
2034 m4_divert_once([HELP_ENABLE], [
2037 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
2038 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
2039 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
2040 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
2041 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
2042 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
2043 AC_PLUGIN([csv], [yes], [CSV output plugin])
2044 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
2045 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
2046 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
2047 AC_PLUGIN([email], [yes], [EMail statistics])
2048 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
2049 AC_PLUGIN([exec], [yes], [Execution of external programs])
2050 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
2051 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
2052 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
2053 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
2054 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
2055 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
2056 AC_PLUGIN([load], [$plugin_load], [System load])
2057 AC_PLUGIN([logfile], [yes], [File logging plugin])
2058 AC_PLUGIN([mbmon], [yes], [Query mbmond])
2059 AC_PLUGIN([memcached], [yes], [memcached statistics])
2060 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
2061 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
2062 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
2063 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
2064 AC_PLUGIN([network], [yes], [Network communication plugin])
2065 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
2066 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
2067 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
2068 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
2069 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
2070 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
2071 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
2072 AC_PLUGIN([rrdtool], [$with_rrdtool], [RRDTool output plugin])
2073 AC_PLUGIN([sensors], [$with_lm_sensors], [lm_sensors statistics])
2074 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
2075 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
2076 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
2077 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
2078 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
2079 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
2080 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
2081 AC_PLUGIN([users], [$plugin_users], [User statistics])
2082 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
2083 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
2084 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
2085 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
2088 if test "x$ac_system" = "xLinux" -a "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
2090 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
2094 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
2096 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2098 PERL_BINDINGS_OPTIONS="$withval"
2099 with_perl_bindings="yes"
2101 PERL_BINDINGS_OPTIONS=""
2102 with_perl_bindings="$withval"
2106 PERL_BINDINGS_OPTIONS=""
2107 with_perl_bindings="yes"
2109 if test "x$with_perl_bindings" = "xyes"
2111 PERL_BINDINGS="perl"
2115 AC_SUBST(PERL_BINDINGS)
2116 AC_SUBST(PERL_BINDINGS_OPTIONS)
2118 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile bindings/Makefile)
2120 if test "x$with_rrdtool" = "xyes" -a "x$librrd_threadsafe" != "xyes"
2122 with_rrdtool="yes (warning: librrd is not thread-safe)"
2125 if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
2127 with_liboping="yes (shipped version)"
2130 if test "x$with_libperl" = "xyes"
2132 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
2134 enable_perl="no (needs libperl)"
2137 if test "x$with_perl_bindings" = "xyes" -a "x$PERL_BINDINGS_OPTIONS" != "x"
2139 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
2146 libcurl . . . . . . $with_libcurl
2147 libiokit . . . . . $with_libiokit
2148 libiptc . . . . . . $with_libiptc
2149 libkstat . . . . . $with_kstat
2150 libkvm . . . . . . $with_libkvm
2151 libmysql . . . . . $with_libmysql
2152 libnetlink . . . . $with_libnetlink
2153 libnetsnmp . . . . $with_libnetsnmp
2154 liboconfig . . . . $with_liboconfig
2155 liboping . . . . . $with_liboping
2156 libpcap . . . . . . $with_libpcap
2157 libperl . . . . . . $with_libperl
2158 libpthread . . . . $with_libpthread
2159 librrd . . . . . . $with_rrdtool
2160 libsensors . . . . $with_lm_sensors
2161 libstatgrab . . . . $with_libstatgrab
2162 libupsclient . . . $with_libupsclient
2163 libvirt . . . . . . $with_libvirt
2164 libxml2 . . . . . . $with_libxml2
2165 libxmms . . . . . . $with_libxmms
2168 daemon mode . . . . $enable_daemon
2169 debug . . . . . . . $enable_debug
2172 perl . . . . . . . $with_perl_bindings
2175 apache . . . . . . $enable_apache
2176 apcups . . . . . . $enable_apcups
2177 apple_sensors . . . $enable_apple_sensors
2178 battery . . . . . . $enable_battery
2179 cpu . . . . . . . . $enable_cpu
2180 cpufreq . . . . . . $enable_cpufreq
2181 csv . . . . . . . . $enable_csv
2182 df . . . . . . . . $enable_df
2183 disk . . . . . . . $enable_disk
2184 dns . . . . . . . . $enable_dns
2185 email . . . . . . . $enable_email
2186 entropy . . . . . . $enable_entropy
2187 exec . . . . . . . $enable_exec
2188 hddtemp . . . . . . $enable_hddtemp
2189 interface . . . . . $enable_interface
2190 iptables . . . . . $enable_iptables
2191 ipvs . . . . . . . $enable_ipvs
2192 irq . . . . . . . . $enable_irq
2193 libvirt . . . . . . $enable_libvirt
2194 load . . . . . . . $enable_load
2195 logfile . . . . . . $enable_logfile
2196 mbmon . . . . . . . $enable_mbmon
2197 memcached . . . . . $enable_memcached
2198 memory . . . . . . $enable_memory
2199 multimeter . . . . $enable_multimeter
2200 mysql . . . . . . . $enable_mysql
2201 netlink . . . . . . $enable_netlink
2202 network . . . . . . $enable_network
2203 nfs . . . . . . . . $enable_nfs
2204 nginx . . . . . . . $enable_nginx
2205 ntpd . . . . . . . $enable_ntpd
2206 nut . . . . . . . . $enable_nut
2207 perl . . . . . . . $enable_perl
2208 ping . . . . . . . $enable_ping
2209 processes . . . . . $enable_processes
2210 rrdtool . . . . . . $enable_rrdtool
2211 sensors . . . . . . $enable_sensors
2212 serial . . . . . . $enable_serial
2213 snmp . . . . . . . $enable_snmp
2214 swap . . . . . . . $enable_swap
2215 syslog . . . . . . $enable_syslog
2216 tape . . . . . . . $enable_tape
2217 tcpconns . . . . . $enable_tcpconns
2218 unixsock . . . . . $enable_unixsock
2219 users . . . . . . . $enable_users
2220 uuid . . . . . . . $enable_uuid
2221 vserver . . . . . . $enable_vserver
2222 wireless . . . . . $enable_wireless
2223 xmms . . . . . . . $enable_xmms