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)
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="yes"])
703 if test "x$with_rrdtool" = "xyes"
705 SAVE_CPPFLAGS="$CPPFLAGS"
706 SAVE_LDFLAGS="$LDFLAGS"
708 CPPFLAGS="$CPPFLAGS $librrd_cflags"
709 LDFLAGS="$LDFLAGS $librrd_ldflags"
711 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
713 CPPFLAGS="$SAVE_CPPFLAGS"
714 LDFLAGS="$SAVE_LDFLAGS"
716 if test "x$with_rrdtool" = "xyes"
718 SAVE_CPPFLAGS="$CPPFLAGS"
719 SAVE_LDFLAGS="$LDFLAGS"
721 CPPFLAGS="$CPPFLAGS $librrd_cflags"
722 LDFLAGS="$LDFLAGS $librrd_ldflags"
724 AC_CHECK_LIB(rrd_th, rrd_update_r,
726 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
728 [librrd_threadsafe="no"
729 AC_CHECK_LIB(rrd, rrd_update,
731 librrd_ldflags="$librrd_ldflags -lrrd -lm"
733 [with_rrdtool="no (symbol 'rrd_update' not found)"],
738 CPPFLAGS="$SAVE_CPPFLAGS"
739 LDFLAGS="$SAVE_LDFLAGS"
741 if test "x$with_rrdtool" = "xyes"
743 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
744 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
745 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
746 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
748 if test "x$librrd_threadsafe" = "xyes"
750 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
753 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
754 [ if test "x$withval" != "xno" -a "x$withval" != "xyes"
756 LDFLAGS="$LDFLAGS -L$withval/lib"
757 CPPFLAGS="$CPPFLAGS -I$withval/include"
758 with_libpthread="yes"
760 if test "x$withval" = "xno"
762 with_libpthread="no (disabled)"
765 ], [with_libpthread="yes"])
766 if test "x$with_libpthread" = "xyes"
768 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
770 if test "x$with_libpthread" = "xyes"
772 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
774 if test "x$with_libpthread" = "xyes"
780 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
781 [Wether or not to use pthread (POSIX threads) library])
782 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
784 if test "x$ac_system" = "xSolaris"
789 with_kstat="no (Solaris only)"
790 with_devinfo="no (Solaris only)"
793 if test "x$with_kstat" = "xyes"
795 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
797 if test "x$with_kstat" = "xyes"
799 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
800 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
802 if test "x$with_kstat" = "xyes"
804 AC_DEFINE(HAVE_LIBKSTAT, 1,
805 [Define to 1 if you have the 'kstat' library (-lkstat)])
807 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
808 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
810 ### BEGIN of check for libcurl ###
811 with_curl_config="curl-config"
814 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
816 if test "x$withval" = "xno"
819 else if test "x$withval" = "xyes"
823 if test -f "$withval" && test -x "$withval"
825 with_curl_config="$withval"
827 else if test -x "$withval/bin/curl-config"
829 with_curl_config="$withval/bin/curl-config"
838 if test "x$with_libcurl" = "xyes"
840 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
841 curl_config_status=$?
843 if test $curl_config_status -ne 0
845 with_libcurl="no ($with_curl_config failed)"
848 CFLAGS="$CFLAGS $with_curl_cflags"
850 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
852 CFLAGS="$SAVE_CFLAGS"
855 if test "x$with_libcurl" = "xyes"
857 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
858 curl_config_status=$?
860 if test $curl_config_status -ne 0
862 with_libcurl="no ($with_curl_config failed)"
864 AC_CHECK_LIB(curl, curl_easy_init,
865 [with_libcurl="yes"],
866 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
870 if test "x$with_libcurl" = "xyes"
872 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
873 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
874 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
875 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
877 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
878 ### END of check for libcurl ###
882 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
891 AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
892 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
894 with_libstatgrab="yes"
896 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
898 if test "x$withval" != "xno" -a "x$withval" != "xyes"
900 LDFLAGS="$LDFLAGS -L$withval/lib"
901 CPPFLAGS="$CPPFLAGS -I$withval/include"
902 with_libstatgrab="yes"
906 if test "x$ac_system" == "xunknown"
908 with_libstatgrab="yes"
910 with_libstatgrab="no"
913 if test "x$with_libstatgrab" = "xyes"
915 AC_CHECK_LIB(statgrab, sg_init, [with_libstatgrab="yes"], [with_libstatgrab="no (libstatgrab not found)"])
917 if test "x$with_libstatgrab" = "xyes"
919 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (statgrab.h not found)"])
921 if test "x$with_libstatgrab" = "xyes"
923 AC_CHECK_LIB(devstat, getdevs, [with_libdevstat="yes"], [with_libdevstat="no"])
925 if test "x$with_libstatgrab" = "xyes"
927 collect_libstatgrab=1
929 collect_libstatgrab=0
931 AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
932 [Wether or not to use statgrab library])
933 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
934 AM_CONDITIONAL(BUILD_WITH_LIBDEVSTAT, test "x$with_libdevstat" = "xyes")
936 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
937 if test "x$with_libkvm" = "xyes"
939 AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
941 AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
943 with_sensors_cflags=""
944 with_sensors_ldflags=""
945 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
947 if test "x$withval" = "xno"
951 with_lm_sensors="yes"
952 if test "x$withval" != "xyes"
954 with_sensors_cflags="-I$withval/include"
955 with_sensors_ldflags="-L$withval/lib"
956 with_lm_sensors="yes"
961 if test "x$ac_system" = "xLinux"
963 with_lm_sensors="yes"
965 with_lm_sensors="no (Linux only library)"
968 if test "x$with_lm_sensors" = "xyes"
970 SAVE_CPPFLAGS="$CPPFLAGS"
971 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
973 # AC_CHECK_HEADERS(sensors/sensors.h,
975 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
977 # [with_lm_sensors="no (sensors/sensors.h not found)"])
978 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_lm_sensors="no (sensors/sensors.h not found)"])
980 CPPFLAGS="$SAVE_CPPFLAGS"
982 if test "x$with_lm_sensors" = "xyes"
984 SAVE_CPPFLAGS="$CPPFLAGS"
985 SAVE_LDFLAGS="$LDFLAGS"
986 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
987 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
989 AC_CHECK_LIB(sensors, sensors_init,
991 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
993 [with_lm_sensors="no (libsensors not found)"])
995 CPPFLAGS="$SAVE_CPPFLAGS"
996 LDFLAGS="$SAVE_LDFLAGS"
998 if test "x$with_lm_sensors" = "xyes"
1000 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
1001 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
1002 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
1003 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
1005 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
1007 with_mysql_config="mysql_config"
1008 with_mysql_cflags=""
1010 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1012 if test "x$withval" = "xno"
1015 else if test "x$withval" = "xyes"
1019 if test -f "$withval" && test -x "$withval";
1021 with_mysql_config="$withval"
1022 else if test -x "$withval/bin/mysql_config"
1024 with_mysql_config="$withval/bin/mysql_config"
1032 if test "x$with_libmysql" = "xyes"
1034 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1035 mysql_config_status=$?
1037 if test $mysql_config_status -ne 0
1042 CFLAGS="$CFLAGS $with_mysql_cflags"
1044 AC_CHECK_HEADERS(mysql/mysql.h, [], [with_libmysql="no (mysql/mysql.h not found)"], [])
1046 CFLAGS="$SAVE_CFLAGS"
1049 if test "x$with_libmysql" = "xyes"
1051 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
1052 mysql_config_status=$?
1054 if test $mysql_config_status -ne 0
1058 AC_CHECK_LIB(mysqlclient, mysql_init,
1059 [with_libmysql="yes"],
1060 [with_libmysql="no (symbol 'mysql_init' not found)"],
1064 if test "x$with_libmysql" = "xyes"
1066 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
1067 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
1068 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
1069 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
1071 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
1073 with_own_liboconfig="no"
1074 liboconfig_LDFLAGS="$LDFLAGS"
1075 liboconfig_CPPFLAGS="$CPPFLAGS"
1076 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1078 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1080 if test -d "$withval/lib"
1082 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1084 if test -d "$withval/include"
1086 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1089 if test "x$withval" = "xno"
1091 AC_MSG_ERROR("liboconfig is required")
1095 with_liboconfig="yes"
1098 save_LDFLAGS="$LDFLAGS"
1099 save_CPPFLAGS="$CPPFLAGS"
1100 LDFLAGS="$liboconfig_LDFLAGS"
1101 CPPFLAGS="$liboconfig_CPPFLAGS"
1102 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1104 with_liboconfig="yes"
1105 with_own_liboconfig="no"
1108 with_liboconfig="yes"
1109 with_own_liboconfig="yes"
1110 LDFLAGS="$save_LDFLAGS"
1111 CPPFLAGS="$save_CPPFLAGS"
1114 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1115 if test "x$with_own_liboconfig" = "xyes"
1117 with_liboconfig="yes (shipped version)"
1120 #with_liboping="yes"
1121 with_own_liboping="no"
1122 liboping_LDFLAGS="$LDFLAGS"
1123 liboping_CPPFLAGS="$CPPFLAGS"
1124 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1126 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1128 if test -d "$withval/lib"
1130 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
1132 if test -d "$withval/include"
1134 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
1137 if test "x$withval" = "xno"
1140 with_own_liboping="no"
1147 if test "x$with_liboping" = "xyes"
1149 save_LDFLAGS="$LDFLAGS"
1150 save_CPPFLAGS="$CPPFLAGS"
1151 LDFLAGS="$liboping_LDFLAGS"
1152 CPPFLAGS="$liboping_CPPFLAGS"
1153 AC_CHECK_LIB(oping, ping_construct,
1156 with_own_liboping="no"
1160 with_own_liboping="yes"
1161 LDFLAGS="$save_LDFLAGS"
1162 CPPFLAGS="$save_CPPFLAGS"
1165 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1166 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1168 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1170 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1172 LDFLAGS="$LDFLAGS -L$withval/lib"
1173 CPPFLAGS="$CPPFLAGS -I$withval/include"
1180 if test "x$with_libpcap" = "xyes"
1182 AC_CHECK_LIB(pcap, pcap_open_live,
1184 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1185 ], [with_libpcap="no (libpcap not found)"])
1187 if test "x$with_libpcap" = "xyes"
1189 AC_CHECK_HEADERS(pcap.h,
1191 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1192 ], [with_libpcap="no (pcap.h not found)"])
1194 if test "x$with_libpcap" = "xyes"
1200 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1201 [Wether or not to use the pcap library])
1202 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1204 perl_interpreter="perl"
1205 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1207 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1209 LDFLAGS="$LDFLAGS -L$withval/lib"
1210 CPPFLAGS="$CPPFLAGS -I$withval/include"
1211 perl_interpreter="$withval/bin/perl"
1219 AC_SUBST(PERL, "$perl_interpreter")
1221 if test "x$with_libperl" = "xyes"
1224 SAVE_LDFLAGS=$LDFLAGS
1225 PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
1226 PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
1227 CFLAGS="$CFLAGS $PERL_CFLAGS"
1228 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1230 AC_CACHE_CHECK([for libperl],
1240 PerlInterpreter *perl = NULL;
1241 Perl_load_module (perl, PERL_LOADMOD_NOIMPORT,
1242 newSVpv ("Collectd::Plugin::FooBar", 24),
1245 [have_libperl="yes"],
1250 if test "x$have_libperl" = "xyes"
1252 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
1253 AC_SUBST(PERL_CFLAGS)
1254 AC_SUBST(PERL_LDFLAGS)
1260 LDFLAGS=$SAVE_LDFLAGS
1262 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1264 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1266 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1268 LDFLAGS="$LDFLAGS -L$withval/lib"
1269 CPPFLAGS="$CPPFLAGS -I$withval/include"
1274 if test "x$ac_system" = "xLinux"
1278 with_libiptc="no (Linux only)"
1281 if test "x$with_libiptc" = "xyes"
1283 AC_CHECK_LIB(iptc, iptc_init,
1285 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1286 ], [with_libiptc="no (libiptc not found)"])
1288 if test "x$with_libiptc" = "xyes"
1290 AC_CHECK_HEADERS(libiptc/libiptc.h,
1292 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1293 ], [with_libiptc="no (libiptc/libiptc.h not found)"])
1295 if test "x$with_libiptc" = "xyes"
1301 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1303 with_snmp_config="net-snmp-config"
1306 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1308 if test "x$withval" = "xno"
1310 with_libnetsnmp="no"
1311 else if test "x$withval" = "xyes"
1313 with_libnetsnmp="yes"
1315 if test -x "$withval"
1317 with_snmp_config="$withval"
1318 with_libnetsnmp="yes"
1320 with_snmp_config="$withval/bin/net-snmp-config"
1321 with_libnetsnmp="yes"
1325 [with_libnetsnmp="yes"])
1326 if test "x$with_libnetsnmp" = "xyes"
1328 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
1329 snmp_config_status=$?
1331 if test $snmp_config_status -ne 0
1333 with_libnetsnmp="no ($with_snmp_config failed)"
1336 CFLAGS="$CFLAGS $with_snmp_cflags"
1338 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1340 CFLAGS="$SAVE_CFLAGS"
1343 if test "x$with_libnetsnmp" = "xyes"
1345 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
1346 snmp_config_status=$?
1348 if test $snmp_config_status -ne 0
1350 with_libnetsnmp="no ($with_snmp_config failed)"
1352 AC_CHECK_LIB(netsnmp, init_snmp,
1353 [with_libnetsnmp="yes"],
1354 [with_libnetsnmp="no (libnetsnmp not found)"],
1358 if test "x$with_libnetsnmp" = "xyes"
1360 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
1361 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
1362 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
1363 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
1365 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1367 with_upsclient_config="libupsclient-config"
1368 with_upsclient_cflags=""
1369 with_upsclient_libs=""
1370 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])],
1372 if test "x$withval" = "xno"
1374 with_libupsclient="no"
1376 if test "x$withval" != "xyes"
1378 if test -f "$withval" && test -x "$withval";
1380 with_upsclient_config="$withval"
1382 with_upsclient_config="$withval/bin/libupsclient-config"
1385 with_libupsclient="yes"
1389 with_libupsclient="yes"
1391 if test "x$with_libupsclient" = "xyes"
1393 with_upsclient_cflags=`$with_upsclient_config --cflags 2>/dev/null`
1394 upsclient_config_status=$?
1396 if test $upsclient_config_status -ne 0
1398 with_libupsclient="no ($with_upsclient_config failed)"
1401 if test "x$with_libupsclient" = "xyes"
1403 SAVE_CFLAGS="$CFLAGS"
1404 CFLAGS="$CFLAGS $with_upsclient_cflags"
1406 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
1408 CFLAGS="$SAVE_CFLAGS"
1410 if test "x$with_libupsclient" = "xyes"
1412 with_upsclient_libs=`$with_upsclient_config --libs 2>/dev/null`
1413 upsclient_config_status=$?
1415 if test $upsclient_config_status -ne 0
1417 with_libupsclient="no ($with_upsclient_config failed)"
1420 if test "x$with_libupsclient" = "xyes"
1422 AC_CHECK_LIB(upsclient, upscli_connect,
1424 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_upsclient_cflags"
1425 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_upsclient_libs"
1426 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
1427 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
1430 with_libupsclient="no (symbol 'upscli_connect' not found)"
1431 ], [$with_upsclient_libs])
1433 if test "x$with_libupsclient" = "xyes"
1435 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
1436 [#include <stdlib.h>
1438 #include <upsclient.h>])
1440 AM_CONDITIONAL(BUILD_WITH_LIBUPSCLIENT, test "x$with_libupsclient" = "xyes")
1442 ### BEGIN of check for libxmms ###
1443 with_xmms_config="xmms-config"
1446 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
1448 if test "x$withval" != "xno" -a "x$withval" != "xyes"
1450 if test -f "$withval" && test -x "$withval";
1452 with_xmms_config="$withval"
1453 else if test -x "$withval/bin/xmms-config"
1455 with_xmms_config="$withval/bin/xmms-config"
1458 else if test "x$withval" = "xno"
1468 if test "x$with_libxmms" = "xyes"
1470 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
1471 xmms_config_status=$?
1473 if test $xmms_config_status -ne 0
1478 if test "x$with_libxmms" = "xyes"
1480 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
1481 xmms_config_status=$?
1483 if test $xmms_config_status -ne 0
1488 if test "x$with_libxmms" = "xyes"
1490 AC_CHECK_LIB(xmms, xmms_remote_get_info,
1492 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
1493 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
1494 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
1495 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
1502 with_libxmms_numeric=0
1503 if test "x$with_libxmms" = "xyes"
1505 with_libxmms_numeric=1
1507 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
1508 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
1509 ### END of check for libxmms ###
1511 with_libnetlink_cflags=""
1512 with_libnetlink_libs="-lnetlink"
1513 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
1515 echo "libnetlink: withval = $withval"
1516 if test "x$withval" = "xyes"
1518 with_libnetlink="yes"
1519 else if test "x$withval" = "xno"
1521 with_libnetlink="no"
1523 if test -d "$withval/include"
1525 with_libnetlink_cflags="-I$withval/include"
1526 with_libnetlink_libs="-L$withval/lib -lnetlink"
1527 with_libnetlink="yes"
1529 AC_MSG_ERROR("no such directory: $withval/include")
1534 if test "x$ac_system" = "xLinux"
1536 with_libnetlink="yes"
1538 with_libnetlink="no (Linux only library)"
1541 if test "x$with_libnetlink" = "xyes"
1544 CFLAGS="$CFLAGS $with_libnetlink_cflags"
1546 with_libnetlink="no (libnetlink.h not found)"
1548 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
1550 with_libnetlink="yes"
1554 #include <sys/types.h>
1555 #include <asm/types.h>
1556 #include <sys/socket.h>
1557 #include <linux/netlink.h>
1558 #include <linux/rtnetlink.h>])
1559 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
1561 #include <sys/types.h>
1562 #include <asm/types.h>
1563 #include <sys/socket.h>])
1567 #include <sys/types.h>
1568 #include <asm/types.h>
1569 #include <sys/socket.h>
1570 #include <linux/netlink.h>
1571 #include <linux/rtnetlink.h>
1575 int retval = TCA_STATS2;
1578 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
1583 #include <sys/types.h>
1584 #include <asm/types.h>
1585 #include <sys/socket.h>
1586 #include <linux/netlink.h>
1587 #include <linux/rtnetlink.h>
1591 int retval = TCA_STATS;
1594 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
1597 CFLAGS="$SAVE_CFLAGS"
1599 if test "x$with_libnetlink" = "xyes"
1601 AC_CHECK_LIB(netlink, rtnl_open,
1602 [with_libnetlink="yes"],
1603 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
1604 [$with_libnetlink_libs])
1606 if test "x$with_libnetlink" = "xyes"
1608 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
1609 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
1610 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
1611 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
1613 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
1615 dnl Check for libvirt and libxml2 libraries.
1616 AC_CHECK_LIB(xml2,xmlXPathEval,
1617 [with_libxml2="yes"],
1618 [with_libxml2="no"])
1621 if test "x$with_libxml2" = "xyes"; then
1622 AC_CHECK_LIB(virt,virDomainBlockStats,
1623 [with_libvirt="yes"],
1624 [with_libvirt="no (symbol virDomainBlockStats not found)"])
1626 dnl Add the right compiler flags and libraries.
1627 if test "x$with_libvirt" = "xyes"; then
1629 if test "x$PKG_CONFIG" != "x"; then
1630 BUILD_WITH_LIBVIRTSTATS_CFLAGS="`pkg-config --cflags libvirt` `pkg-config --cflags libxml-2.0`"
1631 BUILD_WITH_LIBVIRTSTATS_LIBS="`pkg-config --libs libvirt` `pkg-config --libs libxml-2.0`"
1632 AC_SUBST(BUILD_WITH_LIBVIRTSTATS_CFLAGS)
1633 AC_SUBST(BUILD_WITH_LIBVIRTSTATS_LIBS)
1637 dnl End of check for libvirt and libxml2 libraries.
1639 # Check for enabled/disabled features
1642 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
1643 # ------------------------------------------------------------
1645 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
1650 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
1655 m4_define([EnDis],[disabled])dnl
1656 m4_define([YesNo],[no])dnl
1662 m4_define([EnDis],[enabled])dnl
1663 m4_define([YesNo],[yes])dnl
1666 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
1670 m4_if([$3], [feature], [],
1674 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
1680 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
1682 enable_$1='[YesNo]'dnl
1684 if test "x$enable_$1" = "xno"
1688 if test "x$enable_$1" = "xyes"
1692 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
1697 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
1698 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
1700 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
1702 # AC_PLUGIN(name, default, info)
1703 # ------------------------------------------------------------
1709 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
1711 if test "x$enableval" = "xyes"
1719 if test "x$2" = "xyes"
1726 if test "x$enable_plugin" = "xyes"
1728 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
1730 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
1731 enable_$1="$enable_plugin"
1733 )# AC_PLUGIN(name, default, info)
1735 m4_divert_once([HELP_ENABLE], [
1736 collectd features:])
1737 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
1738 AC_COLLECTD([debug], [enable], [feature], [debugging])
1739 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
1740 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
1748 plugin_interface="no"
1753 plugin_multimeter="no"
1755 plugin_processes="no"
1759 plugin_tcpconns="no"
1762 plugin_wireless="no"
1765 if test "x$ac_system" = "xLinux"
1767 plugin_battery="yes"
1769 plugin_cpufreq="yes"
1771 plugin_entropy="yes"
1772 plugin_interface="yes"
1777 plugin_processes="yes"
1780 plugin_tcpconns="yes"
1781 plugin_vserver="yes"
1782 plugin_wireless="yes"
1784 if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
1791 if test "x$with_libiokit" = "xyes"
1793 plugin_battery="yes"
1798 if test "x$with_devinfo$with_kstat" = "xyesyes"
1802 plugin_interface="yes"
1809 if test "x$with_libstatgrab" = "xyes"
1811 plugin_interface="yes"
1817 if test "x$have_processor_info" = "xyes"
1821 if test "x$have_sysctlbyname" = "xyes"
1825 plugin_tcpconns="yes"
1828 if test "x$have_statfs" = "xyes"
1832 if test "x$have_statvfs" = "xyes"
1837 if test "x$have_getifaddrs" = "xyes"
1839 plugin_interface="yes"
1842 if test "x$have_getloadavg" = "xyes"
1847 # Mac OS X memory interface
1848 if test "x$have_host_statistics" = "xyes"
1853 if test "x$have_termios_h" = "xyes"
1855 plugin_multimeter="yes"
1858 if test "x$have_thread_info" = "xyes"
1860 plugin_processes="yes"
1863 if test "x$with_libkvm" = "xyes"
1868 if test "x$have_getutent" = "xyes"
1872 if test "x$have_getutxent" = "xyes"
1877 # FIXME: sysctl for swap plugin
1879 m4_divert_once([HELP_ENABLE], [
1882 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
1883 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
1884 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
1885 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
1886 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
1887 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
1888 AC_PLUGIN([csv], [yes], [CSV output plugin])
1889 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
1890 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
1891 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
1892 AC_PLUGIN([email], [yes], [EMail statistics])
1893 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
1894 AC_PLUGIN([exec], [yes], [Execution of external programs])
1895 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
1896 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
1897 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
1898 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
1899 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
1900 AC_PLUGIN([libvirtstats],[$with_libvirt], [Virtual machine statistics])
1901 AC_PLUGIN([load], [$plugin_load], [System load])
1902 AC_PLUGIN([logfile], [yes], [File logging plugin])
1903 AC_PLUGIN([mbmon], [yes], [Query mbmond])
1904 AC_PLUGIN([memcached], [yes], [memcached statistics])
1905 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
1906 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
1907 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
1908 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
1909 AC_PLUGIN([network], [yes], [Network communication plugin])
1910 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
1911 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
1912 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
1913 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
1914 AC_PLUGIN([perl], [$with_libperl], [Embed a Perl interpreter])
1915 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
1916 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
1917 AC_PLUGIN([rrdtool], [$with_rrdtool], [RRDTool output plugin])
1918 AC_PLUGIN([sensors], [$with_lm_sensors], [lm_sensors statistics])
1919 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
1920 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
1921 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
1922 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
1923 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
1924 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
1925 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
1926 AC_PLUGIN([users], [$plugin_users], [User statistics])
1927 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
1928 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
1929 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
1930 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
1933 if test "x$ac_system" = "xLinux" -a "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
1935 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
1939 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
1941 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1943 PERL_BINDINGS_OPTIONS="$withval"
1944 with_perl_bindings="yes"
1948 PERL_BINDINGS_OPTIONS=""
1949 with_perl_bindings="yes"
1951 if test "x$with_perl_bindings" = "xyes"
1953 PERL_BINDINGS="perl"
1957 AC_SUBST(PERL_BINDINGS)
1958 AC_SUBST(PERL_BINDINGS_OPTIONS)
1960 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile bindings/Makefile)
1962 if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
1964 with_liboping="yes (shipped version)"
1967 if test "x$with_libperl" = "xyes"
1969 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
1971 enable_perl="no (needs libperl)"
1974 if test "x$with_perl_bindings" = "xyes" -a "x$PERL_BINDINGS_OPTIONS" != "x"
1976 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
1983 libcurl . . . . . . $with_libcurl
1984 libiokit . . . . . $with_libiokit
1985 libiptc . . . . . . $with_libiptc
1986 libkstat . . . . . $with_kstat
1987 libkvm . . . . . . $with_libkvm
1988 libmysql . . . . . $with_libmysql
1989 libnetlink . . . . $with_libnetlink
1990 libnetsnmp . . . . $with_libnetsnmp
1991 liboconfig . . . . $with_liboconfig
1992 liboping . . . . . $with_liboping
1993 libpcap . . . . . . $with_libpcap
1994 libperl . . . . . . $with_libperl
1995 libpthread . . . . $with_libpthread
1996 librrd . . . . . . $with_rrdtool
1997 libsensors . . . . $with_lm_sensors
1998 libstatgrab . . . . $with_libstatgrab
1999 libupsclient . . . $with_libupsclient
2000 libvirt . . . . . . $with_libvirt
2001 libxml2 . . . . . . $with_libxml2
2002 libxmms . . . . . . $with_libxmms
2005 daemon mode . . . . $enable_daemon
2006 debug . . . . . . . $enable_debug
2009 perl . . . . . . . $with_perl_bindings
2012 apache . . . . . . $enable_apache
2013 apcups . . . . . . $enable_apcups
2014 apple_sensors . . . $enable_apple_sensors
2015 battery . . . . . . $enable_battery
2016 cpu . . . . . . . . $enable_cpu
2017 cpufreq . . . . . . $enable_cpufreq
2018 csv . . . . . . . . $enable_csv
2019 df . . . . . . . . $enable_df
2020 disk . . . . . . . $enable_disk
2021 dns . . . . . . . . $enable_dns
2022 email . . . . . . . $enable_email
2023 entropy . . . . . . $enable_entropy
2024 exec . . . . . . . $enable_exec
2025 hddtemp . . . . . . $enable_hddtemp
2026 interface . . . . . $enable_interface
2027 iptables . . . . . $enable_iptables
2028 ipvs . . . . . . . $enable_ipvs
2029 irq . . . . . . . . $enable_irq
2030 libvirtstats . . . $enable_libvirtstats
2031 load . . . . . . . $enable_load
2032 logfile . . . . . . $enable_logfile
2033 mbmon . . . . . . . $enable_mbmon
2034 memcached . . . . . $enable_memcached
2035 memory . . . . . . $enable_memory
2036 multimeter . . . . $enable_multimeter
2037 mysql . . . . . . . $enable_mysql
2038 netlink . . . . . . $enable_netlink
2039 network . . . . . . $enable_network
2040 nfs . . . . . . . . $enable_nfs
2041 nginx . . . . . . . $enable_nginx
2042 ntpd . . . . . . . $enable_ntpd
2043 nut . . . . . . . . $enable_nut
2044 perl . . . . . . . $enable_perl
2045 ping . . . . . . . $enable_ping
2046 processes . . . . . $enable_processes
2047 rrdtool . . . . . . $enable_rrdtool
2048 sensors . . . . . . $enable_sensors
2049 serial . . . . . . $enable_serial
2050 snmp . . . . . . . $enable_snmp
2051 swap . . . . . . . $enable_swap
2052 syslog . . . . . . $enable_syslog
2053 tape . . . . . . . $enable_tape
2054 tcpconns . . . . . $enable_tcpconns
2055 unixsock . . . . . $enable_unixsock
2056 users . . . . . . . $enable_users
2057 uuid . . . . . . . $enable_uuid
2058 vserver . . . . . . $enable_vserver
2059 wireless . . . . . $enable_wireless
2060 xmms . . . . . . . $enable_xmms