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 getgrnam_r setgroups regcomp regerror regexec regfree)
377 socket_needs_socket="no"
378 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
379 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
381 nanosleep_needs_rt="no"
382 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
383 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
385 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
386 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
387 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
388 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
389 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
390 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
391 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
392 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
393 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
394 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
397 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
400 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
402 if test "x$withval" = "xno"; then
404 else if test "x$withval" = "xyes"; then
411 if test "x$nan_type" = "xnone"; then
412 AC_CACHE_CHECK([whether NAN is defined by default],
419 static float foo = NAN;
427 [have_nan_default="yes"],
428 [have_nan_default="no"]
431 if test "x$have_nan_default" = "xyes"
436 if test "x$nan_type" = "xnone"; then
437 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
443 #define __USE_ISOC99 1
445 static float foo = NAN;
453 [have_nan_isoc="yes"],
457 if test "x$have_nan_isoc" = "xyes"
462 if test "x$nan_type" = "xnone"; then
463 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
473 #define NAN (0.0 / 0.0)
475 # define isnan(f) ((f) != (f))
477 static float foo = NAN;
485 [have_nan_zero="yes"],
489 if test "x$have_nan_zero" = "xyes"
495 if test "x$nan_type" = "xdefault"; then
496 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
497 [Define if NAN is defined by default and can initialize static variables.])
498 else if test "x$nan_type" = "xisoc99"; then
499 AC_DEFINE(NAN_STATIC_ISOC, 1,
500 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
501 else if test "x$nan_type" = "xzero"; then
502 AC_DEFINE(NAN_ZERO_ZERO, 1,
503 [Define if NAN can be defined as (0.0 / 0.0)])
505 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
508 # For mount interface
509 #AC_CHECK_FUNCS(getfsent getvfsent)
512 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
514 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
516 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
519 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
520 if test "x$have_getmntent" = "xno"; then
521 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
523 if test "x$have_getmntent" = "xno"; then
524 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
526 if test "x$have_getmntent" = "xno"; then
527 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
530 if test "x$have_getmntent" = "xc"; then
531 AC_CACHE_CHECK([whether getmntent takes one argument],
532 [have_one_getmntent],
534 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
536 #include "$srcdir/src/utils_mount.h"]],
540 fh = setmntent ("/etc/mtab", "r");
544 [have_one_getmntent="yes"],
545 [have_one_getmntent="no"]
548 AC_CACHE_CHECK([whether getmntent takes two arguments],
549 [have_two_getmntent],
551 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
552 #include <sys/mnttab.h>
553 #include "$srcdir/src/utils_mount.h"]],
558 fh = fopen ("/etc/mnttab", "r");
559 status = getmntent (fh, &mt);
562 [have_two_getmntent="yes"],
563 [have_two_getmntent="no"]
568 # Check for different versions of `getmntent' here..
570 if test "x$have_getmntent" = "xc"; then
571 if test "x$have_one_getmntent" = "xyes"; then
572 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
573 [Define if the function getmntent exists and takes one argument.])
575 if test "x$have_two_getmntent" = "xyes"; then
576 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
577 [Define if the function getmntent exists and takes two arguments.])
580 if test "x$have_getmntent" = "xsun"; then
581 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
582 [Define if the function getmntent exists. It's the version from libsun.])
584 if test "x$have_getmntent" = "xseq"; then
585 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
586 [Define if the function getmntent exists. It's the version from libseq.])
588 if test "x$have_getmntent" = "xgen"; then
589 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
590 [Define if the function getmntent exists. It's the version from libgen.])
593 # Check for structures
594 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
595 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
598 #include <sys/types.h>
599 #include <sys/socket.h>
602 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
603 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
606 #include <sys/types.h>
607 #include <sys/socket.h>
608 #include <linux/if.h>
609 #include <linux/netdevice.h>
612 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
617 # include <sys/types.h>
619 #if HAVE_NETINET_IN_SYSTM_H
620 # include <netinet/in_systm.h>
622 #if HAVE_NETINET_IN_H
623 # include <netinet/in.h>
625 #if HAVE_NETINET_IP_H
626 # include <netinet/ip.h>
628 #if HAVE_NETINET_UDP_H
629 # include <netinet/udp.h>
632 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
637 # include <sys/types.h>
639 #if HAVE_NETINET_IN_SYSTM_H
640 # include <netinet/in_systm.h>
642 #if HAVE_NETINET_IN_H
643 # include <netinet/in.h>
645 #if HAVE_NETINET_IP_H
646 # include <netinet/ip.h>
648 #if HAVE_NETINET_UDP_H
649 # include <netinet/udp.h>
653 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
663 AC_CHECK_LIB(resolv, res_search,
665 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
667 [with_libresolv="no"])
668 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
670 dnl Check for HAL (hardware abstraction library)
672 AC_CHECK_LIB(hal,libhal_device_property_exists,
673 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
675 if test "x$with_libhal" = "xyes"; then
677 if test "x$PKG_CONFIG" != "x"; then
678 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
679 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
680 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
681 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
685 m4_divert_once([HELP_WITH], [
686 collectd additional packages:])
688 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
691 librrd_threadsafe="yes"
692 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
693 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
695 librrd_cflags="-I$withval/include"
696 librrd_ldflags="-L$withval/lib"
699 with_rrdtool="$withval"
701 ], [with_rrdtool="yes"])
702 if test "x$with_rrdtool" = "xyes"
704 SAVE_CPPFLAGS="$CPPFLAGS"
705 SAVE_LDFLAGS="$LDFLAGS"
707 CPPFLAGS="$CPPFLAGS $librrd_cflags"
708 LDFLAGS="$LDFLAGS $librrd_ldflags"
710 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
712 CPPFLAGS="$SAVE_CPPFLAGS"
713 LDFLAGS="$SAVE_LDFLAGS"
715 if test "x$with_rrdtool" = "xyes"
717 SAVE_CPPFLAGS="$CPPFLAGS"
718 SAVE_LDFLAGS="$LDFLAGS"
720 CPPFLAGS="$CPPFLAGS $librrd_cflags"
721 LDFLAGS="$LDFLAGS $librrd_ldflags"
723 AC_CHECK_LIB(rrd_th, rrd_update_r,
725 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
727 [librrd_threadsafe="no"
728 AC_CHECK_LIB(rrd, rrd_update,
730 librrd_ldflags="$librrd_ldflags -lrrd -lm"
732 [with_rrdtool="no (symbol 'rrd_update' not found)"],
737 CPPFLAGS="$SAVE_CPPFLAGS"
738 LDFLAGS="$SAVE_LDFLAGS"
740 if test "x$with_rrdtool" = "xyes"
742 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
743 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
744 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
745 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
747 if test "x$librrd_threadsafe" = "xyes"
749 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
752 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
753 [ if test "x$withval" != "xno" -a "x$withval" != "xyes"
755 LDFLAGS="$LDFLAGS -L$withval/lib"
756 CPPFLAGS="$CPPFLAGS -I$withval/include"
757 with_libpthread="yes"
759 if test "x$withval" = "xno"
761 with_libpthread="no (disabled)"
764 ], [with_libpthread="yes"])
765 if test "x$with_libpthread" = "xyes"
767 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
769 if test "x$with_libpthread" = "xyes"
771 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
773 if test "x$with_libpthread" = "xyes"
779 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
780 [Wether or not to use pthread (POSIX threads) library])
781 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
783 if test "x$ac_system" = "xSolaris"
788 with_kstat="no (Solaris only)"
789 with_devinfo="no (Solaris only)"
792 if test "x$with_kstat" = "xyes"
794 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
796 if test "x$with_kstat" = "xyes"
798 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
799 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
801 if test "x$with_kstat" = "xyes"
803 AC_DEFINE(HAVE_LIBKSTAT, 1,
804 [Define to 1 if you have the 'kstat' library (-lkstat)])
806 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
807 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
809 ### BEGIN of check for libcurl ###
810 with_curl_config="curl-config"
813 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
815 if test "x$withval" = "xno"
818 else if test "x$withval" = "xyes"
822 if test -f "$withval" && test -x "$withval"
824 with_curl_config="$withval"
826 else if test -x "$withval/bin/curl-config"
828 with_curl_config="$withval/bin/curl-config"
837 if test "x$with_libcurl" = "xyes"
839 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
840 curl_config_status=$?
842 if test $curl_config_status -ne 0
844 with_libcurl="no ($with_curl_config failed)"
847 CFLAGS="$CFLAGS $with_curl_cflags"
849 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
851 CFLAGS="$SAVE_CFLAGS"
854 if test "x$with_libcurl" = "xyes"
856 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
857 curl_config_status=$?
859 if test $curl_config_status -ne 0
861 with_libcurl="no ($with_curl_config failed)"
863 AC_CHECK_LIB(curl, curl_easy_init,
864 [with_libcurl="yes"],
865 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
869 if test "x$with_libcurl" = "xyes"
871 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
872 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
873 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
874 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
876 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
877 ### END of check for libcurl ###
881 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
890 AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
891 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
893 with_libstatgrab="yes"
895 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
897 if test "x$withval" != "xno" -a "x$withval" != "xyes"
899 LDFLAGS="$LDFLAGS -L$withval/lib"
900 CPPFLAGS="$CPPFLAGS -I$withval/include"
901 with_libstatgrab="yes"
903 with_libstatgrab="$withval"
907 if test "x$ac_system" == "xunknown"
909 with_libstatgrab="yes"
911 with_libstatgrab="no"
914 if test "x$with_libstatgrab" = "xyes"
916 AC_CHECK_LIB(statgrab, sg_init, [with_libstatgrab="yes"], [with_libstatgrab="no (libstatgrab not found)"])
918 if test "x$with_libstatgrab" = "xyes"
920 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (statgrab.h not found)"])
922 if test "x$with_libstatgrab" = "xyes"
924 AC_CHECK_LIB(devstat, getdevs, [with_libdevstat="yes"], [with_libdevstat="no"])
926 if test "x$with_libstatgrab" = "xyes"
928 collect_libstatgrab=1
930 collect_libstatgrab=0
932 AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
933 [Wether or not to use statgrab library])
934 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
935 AM_CONDITIONAL(BUILD_WITH_LIBDEVSTAT, test "x$with_libdevstat" = "xyes")
937 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
938 if test "x$with_libkvm" = "xyes"
940 AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
942 AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
944 with_sensors_cflags=""
945 with_sensors_ldflags=""
946 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
948 if test "x$withval" = "xno"
952 with_lm_sensors="yes"
953 if test "x$withval" != "xyes"
955 with_sensors_cflags="-I$withval/include"
956 with_sensors_ldflags="-L$withval/lib"
957 with_lm_sensors="yes"
962 if test "x$ac_system" = "xLinux"
964 with_lm_sensors="yes"
966 with_lm_sensors="no (Linux only library)"
969 if test "x$with_lm_sensors" = "xyes"
971 SAVE_CPPFLAGS="$CPPFLAGS"
972 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
974 # AC_CHECK_HEADERS(sensors/sensors.h,
976 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
978 # [with_lm_sensors="no (sensors/sensors.h not found)"])
979 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_lm_sensors="no (sensors/sensors.h not found)"])
981 CPPFLAGS="$SAVE_CPPFLAGS"
983 if test "x$with_lm_sensors" = "xyes"
985 SAVE_CPPFLAGS="$CPPFLAGS"
986 SAVE_LDFLAGS="$LDFLAGS"
987 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
988 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
990 AC_CHECK_LIB(sensors, sensors_init,
992 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
994 [with_lm_sensors="no (libsensors not found)"])
996 CPPFLAGS="$SAVE_CPPFLAGS"
997 LDFLAGS="$SAVE_LDFLAGS"
999 if test "x$with_lm_sensors" = "xyes"
1001 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
1002 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
1003 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
1004 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
1006 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
1008 with_mysql_config="mysql_config"
1009 with_mysql_cflags=""
1011 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1013 if test "x$withval" = "xno"
1016 else if test "x$withval" = "xyes"
1020 if test -f "$withval" && test -x "$withval";
1022 with_mysql_config="$withval"
1023 else if test -x "$withval/bin/mysql_config"
1025 with_mysql_config="$withval/bin/mysql_config"
1033 if test "x$with_libmysql" = "xyes"
1035 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1036 mysql_config_status=$?
1038 if test $mysql_config_status -ne 0
1043 CFLAGS="$CFLAGS $with_mysql_cflags"
1045 AC_CHECK_HEADERS(mysql/mysql.h, [], [with_libmysql="no (mysql/mysql.h not found)"], [])
1047 CFLAGS="$SAVE_CFLAGS"
1050 if test "x$with_libmysql" = "xyes"
1052 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
1053 mysql_config_status=$?
1055 if test $mysql_config_status -ne 0
1059 AC_CHECK_LIB(mysqlclient, mysql_init,
1060 [with_libmysql="yes"],
1061 [with_libmysql="no (symbol 'mysql_init' not found)"],
1065 if test "x$with_libmysql" = "xyes"
1067 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
1068 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
1069 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
1070 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
1072 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
1074 with_own_liboconfig="no"
1075 liboconfig_LDFLAGS="$LDFLAGS"
1076 liboconfig_CPPFLAGS="$CPPFLAGS"
1077 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1079 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1081 if test -d "$withval/lib"
1083 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1085 if test -d "$withval/include"
1087 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1090 if test "x$withval" = "xno"
1092 AC_MSG_ERROR("liboconfig is required")
1096 with_liboconfig="yes"
1099 save_LDFLAGS="$LDFLAGS"
1100 save_CPPFLAGS="$CPPFLAGS"
1101 LDFLAGS="$liboconfig_LDFLAGS"
1102 CPPFLAGS="$liboconfig_CPPFLAGS"
1103 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1105 with_liboconfig="yes"
1106 with_own_liboconfig="no"
1109 with_liboconfig="yes"
1110 with_own_liboconfig="yes"
1111 LDFLAGS="$save_LDFLAGS"
1112 CPPFLAGS="$save_CPPFLAGS"
1115 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1116 if test "x$with_own_liboconfig" = "xyes"
1118 with_liboconfig="yes (shipped version)"
1121 #with_liboping="yes"
1122 with_own_liboping="no"
1123 liboping_LDFLAGS="$LDFLAGS"
1124 liboping_CPPFLAGS="$CPPFLAGS"
1125 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1127 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1129 if test -d "$withval/lib"
1131 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
1133 if test -d "$withval/include"
1135 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
1138 if test "x$withval" = "xno"
1141 with_own_liboping="no"
1142 else if test "x$withval" = "xyes"
1151 if test "x$with_liboping" = "xyes"
1153 save_LDFLAGS="$LDFLAGS"
1154 save_CPPFLAGS="$CPPFLAGS"
1155 LDFLAGS="$liboping_LDFLAGS"
1156 CPPFLAGS="$liboping_CPPFLAGS"
1157 AC_CHECK_LIB(oping, ping_construct,
1160 with_own_liboping="no"
1164 with_own_liboping="yes"
1165 LDFLAGS="$save_LDFLAGS"
1166 CPPFLAGS="$save_CPPFLAGS"
1169 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1170 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1172 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1174 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1176 LDFLAGS="$LDFLAGS -L$withval/lib"
1177 CPPFLAGS="$CPPFLAGS -I$withval/include"
1180 with_libpcap="$withval"
1186 if test "x$with_libpcap" = "xyes"
1188 AC_CHECK_LIB(pcap, pcap_open_live,
1190 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1191 ], [with_libpcap="no (libpcap not found)"])
1193 if test "x$with_libpcap" = "xyes"
1195 AC_CHECK_HEADERS(pcap.h,
1197 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1198 ], [with_libpcap="no (pcap.h not found)"])
1200 if test "x$with_libpcap" = "xyes"
1206 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1207 [Wether or not to use the pcap library])
1208 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1210 perl_interpreter="perl"
1211 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1213 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1215 LDFLAGS="$LDFLAGS -L$withval/lib"
1216 CPPFLAGS="$CPPFLAGS -I$withval/include"
1217 perl_interpreter="$withval/bin/perl"
1220 with_libperl="$withval"
1227 AC_SUBST(PERL, "$perl_interpreter")
1229 if test "x$with_libperl" = "xyes"
1232 SAVE_LDFLAGS=$LDFLAGS
1233 PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
1234 PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
1235 CFLAGS="$CFLAGS $PERL_CFLAGS"
1236 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1238 AC_CACHE_CHECK([for libperl],
1248 PerlInterpreter *perl = NULL;
1249 Perl_load_module (perl, PERL_LOADMOD_NOIMPORT,
1250 newSVpv ("Collectd::Plugin::FooBar", 24),
1253 [have_libperl="yes"],
1258 if test "x$have_libperl" = "xyes"
1260 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
1261 AC_SUBST(PERL_CFLAGS)
1262 AC_SUBST(PERL_LDFLAGS)
1268 LDFLAGS=$SAVE_LDFLAGS
1270 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1272 if test "x$with_libperl" = "xyes"
1275 SAVE_LDFLAGS=$LDFLAGS
1276 CFLAGS="$CFLAGS $PERL_CFLAGS"
1277 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1279 AC_CACHE_CHECK([if perl supports ithreads],
1280 [have_perl_ithreads],
1288 #if !defined(USE_ITHREADS)
1289 # error "Perl does not support ithreads!"
1290 #endif /* !defined(USE_ITHREADS) */
1293 [have_perl_ithreads="yes"],
1294 [have_perl_ithreads="no"]
1298 if test "x$have_perl_ithreads" = "xyes"
1300 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
1304 LDFLAGS=$SAVE_LDFLAGS
1307 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1309 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1311 LDFLAGS="$LDFLAGS -L$withval/lib"
1312 CPPFLAGS="$CPPFLAGS -I$withval/include"
1315 with_libiptc="$withval"
1319 if test "x$ac_system" = "xLinux"
1323 with_libiptc="no (Linux only)"
1326 if test "x$with_libiptc" = "xyes"
1328 AC_CHECK_LIB(iptc, iptc_init,
1330 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1331 ], [with_libiptc="no (libiptc not found)"])
1333 if test "x$with_libiptc" = "xyes"
1335 AC_CHECK_HEADERS(libiptc/libiptc.h,
1337 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1338 ], [with_libiptc="no (libiptc/libiptc.h not found)"])
1340 if test "x$with_libiptc" = "xyes"
1346 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1348 with_snmp_config="net-snmp-config"
1351 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1353 if test "x$withval" = "xno"
1355 with_libnetsnmp="no"
1356 else if test "x$withval" = "xyes"
1358 with_libnetsnmp="yes"
1360 if test -x "$withval"
1362 with_snmp_config="$withval"
1363 with_libnetsnmp="yes"
1365 with_snmp_config="$withval/bin/net-snmp-config"
1366 with_libnetsnmp="yes"
1370 [with_libnetsnmp="yes"])
1371 if test "x$with_libnetsnmp" = "xyes"
1373 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
1374 snmp_config_status=$?
1376 if test $snmp_config_status -ne 0
1378 with_libnetsnmp="no ($with_snmp_config failed)"
1381 CFLAGS="$CFLAGS $with_snmp_cflags"
1383 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1385 CFLAGS="$SAVE_CFLAGS"
1388 if test "x$with_libnetsnmp" = "xyes"
1390 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
1391 snmp_config_status=$?
1393 if test $snmp_config_status -ne 0
1395 with_libnetsnmp="no ($with_snmp_config failed)"
1397 AC_CHECK_LIB(netsnmp, init_snmp,
1398 [with_libnetsnmp="yes"],
1399 [with_libnetsnmp="no (libnetsnmp not found)"],
1403 if test "x$with_libnetsnmp" = "xyes"
1405 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
1406 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
1407 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
1408 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
1410 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1412 with_upsclient_config="libupsclient-config"
1413 with_upsclient_cflags=""
1414 with_upsclient_libs=""
1415 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])],
1417 if test "x$withval" = "xno"
1419 with_libupsclient="no"
1421 if test "x$withval" != "xyes"
1423 if test -f "$withval" && test -x "$withval";
1425 with_upsclient_config="$withval"
1427 with_upsclient_config="$withval/bin/libupsclient-config"
1430 with_libupsclient="yes"
1434 with_libupsclient="yes"
1436 if test "x$with_libupsclient" = "xyes"
1438 with_upsclient_cflags=`$with_upsclient_config --cflags 2>/dev/null`
1439 upsclient_config_status=$?
1441 if test $upsclient_config_status -ne 0
1443 with_libupsclient="no ($with_upsclient_config failed)"
1446 if test "x$with_libupsclient" = "xyes"
1448 SAVE_CFLAGS="$CFLAGS"
1449 CFLAGS="$CFLAGS $with_upsclient_cflags"
1451 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
1453 CFLAGS="$SAVE_CFLAGS"
1455 if test "x$with_libupsclient" = "xyes"
1457 with_upsclient_libs=`$with_upsclient_config --libs 2>/dev/null`
1458 upsclient_config_status=$?
1460 if test $upsclient_config_status -ne 0
1462 with_libupsclient="no ($with_upsclient_config failed)"
1465 if test "x$with_libupsclient" = "xyes"
1467 AC_CHECK_LIB(upsclient, upscli_connect,
1469 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_upsclient_cflags"
1470 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_upsclient_libs"
1471 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
1472 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
1475 with_libupsclient="no (symbol 'upscli_connect' not found)"
1476 ], [$with_upsclient_libs])
1478 if test "x$with_libupsclient" = "xyes"
1480 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
1481 [#include <stdlib.h>
1483 #include <upsclient.h>])
1485 AM_CONDITIONAL(BUILD_WITH_LIBUPSCLIENT, test "x$with_libupsclient" = "xyes")
1487 ### BEGIN of check for libxmms ###
1488 with_xmms_config="xmms-config"
1491 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
1493 if test "x$withval" != "xno" -a "x$withval" != "xyes"
1495 if test -f "$withval" && test -x "$withval";
1497 with_xmms_config="$withval"
1498 else if test -x "$withval/bin/xmms-config"
1500 with_xmms_config="$withval/bin/xmms-config"
1503 else if test "x$withval" = "xno"
1513 if test "x$with_libxmms" = "xyes"
1515 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
1516 xmms_config_status=$?
1518 if test $xmms_config_status -ne 0
1523 if test "x$with_libxmms" = "xyes"
1525 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
1526 xmms_config_status=$?
1528 if test $xmms_config_status -ne 0
1533 if test "x$with_libxmms" = "xyes"
1535 AC_CHECK_LIB(xmms, xmms_remote_get_info,
1537 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
1538 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
1539 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
1540 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
1547 with_libxmms_numeric=0
1548 if test "x$with_libxmms" = "xyes"
1550 with_libxmms_numeric=1
1552 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
1553 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
1554 ### END of check for libxmms ###
1556 with_libnetlink_cflags=""
1557 with_libnetlink_libs="-lnetlink"
1558 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
1560 echo "libnetlink: withval = $withval"
1561 if test "x$withval" = "xyes"
1563 with_libnetlink="yes"
1564 else if test "x$withval" = "xno"
1566 with_libnetlink="no"
1568 if test -d "$withval/include"
1570 with_libnetlink_cflags="-I$withval/include"
1571 with_libnetlink_libs="-L$withval/lib -lnetlink"
1572 with_libnetlink="yes"
1574 AC_MSG_ERROR("no such directory: $withval/include")
1579 if test "x$ac_system" = "xLinux"
1581 with_libnetlink="yes"
1583 with_libnetlink="no (Linux only library)"
1586 if test "x$with_libnetlink" = "xyes"
1589 CFLAGS="$CFLAGS $with_libnetlink_cflags"
1591 with_libnetlink="no (libnetlink.h not found)"
1593 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
1595 with_libnetlink="yes"
1599 #include <sys/types.h>
1600 #include <asm/types.h>
1601 #include <sys/socket.h>
1602 #include <linux/netlink.h>
1603 #include <linux/rtnetlink.h>])
1604 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
1606 #include <sys/types.h>
1607 #include <asm/types.h>
1608 #include <sys/socket.h>])
1612 #include <sys/types.h>
1613 #include <asm/types.h>
1614 #include <sys/socket.h>
1615 #include <linux/netlink.h>
1616 #include <linux/rtnetlink.h>
1620 int retval = TCA_STATS2;
1623 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
1628 #include <sys/types.h>
1629 #include <asm/types.h>
1630 #include <sys/socket.h>
1631 #include <linux/netlink.h>
1632 #include <linux/rtnetlink.h>
1636 int retval = TCA_STATS;
1639 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
1642 CFLAGS="$SAVE_CFLAGS"
1644 if test "x$with_libnetlink" = "xyes"
1646 AC_CHECK_LIB(netlink, rtnl_open,
1647 [with_libnetlink="yes"],
1648 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
1649 [$with_libnetlink_libs])
1651 if test "x$with_libnetlink" = "xyes"
1653 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
1654 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
1655 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
1656 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
1658 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
1660 dnl Check for libvirt and libxml2 libraries.
1661 with_libxml2="no (pkg-config isn't available)"
1662 with_libxml2_cflags=""
1663 with_libxml2_ldflags=""
1664 with_libvirt="no (pkg-config isn't available)"
1665 with_libvirt_cflags=""
1666 with_libvirt_ldflags=""
1668 if test "x$PKG_CONFIG" != "x"
1670 pkg-config --exists 'libxml-2.0' 2>/dev/null
1675 with_libxml2="no (pkg-config doesn't know library)"
1678 pkg-config --exists libvirt 2>/dev/null
1683 with_libvirt="no (pkg-config doesn't know library)"
1686 if test "x$with_libxml2" = "xyes"
1688 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
1693 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
1699 if test "x$with_libxml2" = "xyes"
1701 SAVE_CPPFLAGS="$CPPFLAGS"
1702 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
1704 AC_CHECK_HEADERS(libxml/parser.h, [],
1705 [with_libxml2="no (libxml/parser.h not found)"])
1707 CPPFLAGS="$SAVE_CPPFLAGS"
1709 if test "x$with_libxml2" = "xyes"
1711 SAVE_CFLAGS="$CFLAGS"
1712 SAVE_LD_FLAGS="$LDFLAGS"
1714 CFLAGS="$CFLAGS $with_libxml2_cflags"
1715 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
1717 AC_CHECK_LIB(xml2, xmlXPathEval,
1718 [with_libxml2="yes"],
1719 [with_libxml2="no (symbol xmlXPathEval not found)"])
1721 CFLAGS="$SAVE_CFLAGS"
1722 LDFLAGS="$SAVE_LDFLAGS"
1724 dnl Add the right compiler flags and libraries.
1725 if test "x$with_libxml2" = "xyes"; then
1726 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
1727 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
1728 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
1729 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
1731 if test "x$with_libvirt" = "xyes"
1733 with_libvirt_cflags="`pkg-config --cflags libvirt`"
1738 with_libvirt_ldflags="`pkg-config --libs libvirt`"
1744 if test "x$with_libvirt" = "xyes"
1746 SAVE_CPPFLAGS="$CPPFLAGS"
1747 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
1749 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
1750 [with_libvirt="no (libvirt/libvirt.h not found)"])
1752 CPPFLAGS="$SAVE_CPPFLAGS"
1754 if test "x$with_libvirt" = "xyes"
1756 SAVE_CFLAGS="$CFLAGS"
1757 SAVE_LD_FLAGS="$LDFLAGS"
1759 CFLAGS="$CFLAGS $with_libvirt_cflags"
1760 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
1762 AC_CHECK_LIB(virt, virDomainBlockStats,
1763 [with_libvirt="yes"],
1764 [with_libvirt="no (symbol virDomainBlockStats not found)"])
1766 CFLAGS="$SAVE_CFLAGS"
1767 LDFLAGS="$SAVE_LDFLAGS"
1769 dnl Add the right compiler flags and libraries.
1770 if test "x$with_libvirt" = "xyes"; then
1771 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
1772 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
1773 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
1774 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
1777 dnl End of check for libvirt and libxml2 libraries.
1779 # Check for enabled/disabled features
1782 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
1783 # ------------------------------------------------------------
1785 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
1790 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
1795 m4_define([EnDis],[disabled])dnl
1796 m4_define([YesNo],[no])dnl
1802 m4_define([EnDis],[enabled])dnl
1803 m4_define([YesNo],[yes])dnl
1806 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
1810 m4_if([$3], [feature], [],
1814 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
1820 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
1822 enable_$1='[YesNo]'dnl
1824 if test "x$enable_$1" = "xno"
1828 if test "x$enable_$1" = "xyes"
1832 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
1837 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
1838 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
1840 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
1842 # AC_PLUGIN(name, default, info)
1843 # ------------------------------------------------------------
1849 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
1851 if test "x$enableval" = "xyes"
1859 if test "x$2" = "xyes"
1866 if test "x$enable_plugin" = "xyes"
1868 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
1870 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
1871 enable_$1="$enable_plugin"
1873 )# AC_PLUGIN(name, default, info)
1875 m4_divert_once([HELP_ENABLE], [
1876 collectd features:])
1877 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
1878 AC_COLLECTD([debug], [enable], [feature], [debugging])
1879 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
1880 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
1888 plugin_interface="no"
1894 plugin_multimeter="no"
1897 plugin_processes="no"
1901 plugin_tcpconns="no"
1904 plugin_wireless="no"
1907 if test "x$ac_system" = "xLinux"
1909 plugin_battery="yes"
1911 plugin_cpufreq="yes"
1913 plugin_entropy="yes"
1914 plugin_interface="yes"
1919 plugin_processes="yes"
1922 plugin_tcpconns="yes"
1923 plugin_vserver="yes"
1924 plugin_wireless="yes"
1926 if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
1933 if test "x$with_libiokit" = "xyes"
1935 plugin_battery="yes"
1940 if test "x$with_devinfo$with_kstat" = "xyesyes"
1944 plugin_interface="yes"
1951 if test "x$with_libstatgrab" = "xyes"
1953 plugin_interface="yes"
1959 if test "x$have_processor_info" = "xyes"
1963 if test "x$have_sysctlbyname" = "xyes"
1967 plugin_tcpconns="yes"
1970 if test "x$have_statfs" = "xyes"
1974 if test "x$have_statvfs" = "xyes"
1979 if test "x$have_getifaddrs" = "xyes"
1981 plugin_interface="yes"
1984 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
1986 plugin_libvirt="yes"
1989 if test "x$have_getloadavg" = "xyes"
1994 if test "x$have_libperl$have_perl_ithreads" = "xyesyes"
1999 # Mac OS X memory interface
2000 if test "x$have_host_statistics" = "xyes"
2005 if test "x$have_termios_h" = "xyes"
2007 plugin_multimeter="yes"
2010 if test "x$have_thread_info" = "xyes"
2012 plugin_processes="yes"
2015 if test "x$with_libkvm" = "xyes"
2020 if test "x$have_getutent" = "xyes"
2024 if test "x$have_getutxent" = "xyes"
2029 # FIXME: sysctl for swap plugin
2031 m4_divert_once([HELP_ENABLE], [
2034 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
2035 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
2036 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
2037 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
2038 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
2039 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
2040 AC_PLUGIN([csv], [yes], [CSV output plugin])
2041 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
2042 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
2043 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
2044 AC_PLUGIN([email], [yes], [EMail statistics])
2045 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
2046 AC_PLUGIN([exec], [yes], [Execution of external programs])
2047 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
2048 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
2049 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
2050 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
2051 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
2052 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
2053 AC_PLUGIN([load], [$plugin_load], [System load])
2054 AC_PLUGIN([logfile], [yes], [File logging plugin])
2055 AC_PLUGIN([mbmon], [yes], [Query mbmond])
2056 AC_PLUGIN([memcached], [yes], [memcached statistics])
2057 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
2058 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
2059 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
2060 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
2061 AC_PLUGIN([network], [yes], [Network communication plugin])
2062 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
2063 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
2064 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
2065 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
2066 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
2067 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
2068 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
2069 AC_PLUGIN([rrdtool], [$with_rrdtool], [RRDTool output plugin])
2070 AC_PLUGIN([sensors], [$with_lm_sensors], [lm_sensors statistics])
2071 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
2072 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
2073 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
2074 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
2075 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
2076 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
2077 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
2078 AC_PLUGIN([users], [$plugin_users], [User statistics])
2079 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
2080 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
2081 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
2082 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
2085 if test "x$ac_system" = "xLinux" -a "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
2087 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
2091 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
2093 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2095 PERL_BINDINGS_OPTIONS="$withval"
2096 with_perl_bindings="yes"
2098 PERL_BINDINGS_OPTIONS=""
2099 with_perl_bindings="$withval"
2103 PERL_BINDINGS_OPTIONS=""
2104 with_perl_bindings="yes"
2106 if test "x$with_perl_bindings" = "xyes"
2108 PERL_BINDINGS="perl"
2112 AC_SUBST(PERL_BINDINGS)
2113 AC_SUBST(PERL_BINDINGS_OPTIONS)
2115 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile bindings/Makefile)
2117 if test "x$with_rrdtool" = "xyes" -a "x$librrd_threadsafe" != "xyes"
2119 with_rrdtool="yes (warning: librrd is not thread-safe)"
2122 if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
2124 with_liboping="yes (shipped version)"
2127 if test "x$with_libperl" = "xyes"
2129 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
2131 enable_perl="no (needs libperl)"
2134 if test "x$with_perl_bindings" = "xyes" -a "x$PERL_BINDINGS_OPTIONS" != "x"
2136 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
2143 libcurl . . . . . . $with_libcurl
2144 libiokit . . . . . $with_libiokit
2145 libiptc . . . . . . $with_libiptc
2146 libkstat . . . . . $with_kstat
2147 libkvm . . . . . . $with_libkvm
2148 libmysql . . . . . $with_libmysql
2149 libnetlink . . . . $with_libnetlink
2150 libnetsnmp . . . . $with_libnetsnmp
2151 liboconfig . . . . $with_liboconfig
2152 liboping . . . . . $with_liboping
2153 libpcap . . . . . . $with_libpcap
2154 libperl . . . . . . $with_libperl
2155 libpthread . . . . $with_libpthread
2156 librrd . . . . . . $with_rrdtool
2157 libsensors . . . . $with_lm_sensors
2158 libstatgrab . . . . $with_libstatgrab
2159 libupsclient . . . $with_libupsclient
2160 libvirt . . . . . . $with_libvirt
2161 libxml2 . . . . . . $with_libxml2
2162 libxmms . . . . . . $with_libxmms
2165 daemon mode . . . . $enable_daemon
2166 debug . . . . . . . $enable_debug
2169 perl . . . . . . . $with_perl_bindings
2172 apache . . . . . . $enable_apache
2173 apcups . . . . . . $enable_apcups
2174 apple_sensors . . . $enable_apple_sensors
2175 battery . . . . . . $enable_battery
2176 cpu . . . . . . . . $enable_cpu
2177 cpufreq . . . . . . $enable_cpufreq
2178 csv . . . . . . . . $enable_csv
2179 df . . . . . . . . $enable_df
2180 disk . . . . . . . $enable_disk
2181 dns . . . . . . . . $enable_dns
2182 email . . . . . . . $enable_email
2183 entropy . . . . . . $enable_entropy
2184 exec . . . . . . . $enable_exec
2185 hddtemp . . . . . . $enable_hddtemp
2186 interface . . . . . $enable_interface
2187 iptables . . . . . $enable_iptables
2188 ipvs . . . . . . . $enable_ipvs
2189 irq . . . . . . . . $enable_irq
2190 libvirt . . . . . . $enable_libvirt
2191 load . . . . . . . $enable_load
2192 logfile . . . . . . $enable_logfile
2193 mbmon . . . . . . . $enable_mbmon
2194 memcached . . . . . $enable_memcached
2195 memory . . . . . . $enable_memory
2196 multimeter . . . . $enable_multimeter
2197 mysql . . . . . . . $enable_mysql
2198 netlink . . . . . . $enable_netlink
2199 network . . . . . . $enable_network
2200 nfs . . . . . . . . $enable_nfs
2201 nginx . . . . . . . $enable_nginx
2202 ntpd . . . . . . . $enable_ntpd
2203 nut . . . . . . . . $enable_nut
2204 perl . . . . . . . $enable_perl
2205 ping . . . . . . . $enable_ping
2206 processes . . . . . $enable_processes
2207 rrdtool . . . . . . $enable_rrdtool
2208 sensors . . . . . . $enable_sensors
2209 serial . . . . . . $enable_serial
2210 snmp . . . . . . . $enable_snmp
2211 swap . . . . . . . $enable_swap
2212 syslog . . . . . . $enable_syslog
2213 tape . . . . . . . $enable_tape
2214 tcpconns . . . . . $enable_tcpconns
2215 unixsock . . . . . $enable_unixsock
2216 users . . . . . . . $enable_users
2217 uuid . . . . . . . $enable_uuid
2218 vserver . . . . . . $enable_vserver
2219 wireless . . . . . $enable_wireless
2220 xmms . . . . . . . $enable_xmms