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 if test "x$with_libperl" = "xyes"
1267 SAVE_LDFLAGS=$LDFLAGS
1268 CFLAGS="$CFLAGS $PERL_CFLAGS"
1269 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1271 AC_CACHE_CHECK([if perl supports ithreads],
1272 [have_perl_ithreads],
1280 #if !defined(USE_ITHREADS)
1281 # error "Perl does not support ithreads!"
1282 #endif /* !defined(USE_ITHREADS) */
1285 [have_perl_ithreads="yes"],
1286 [have_perl_ithreads="no"]
1290 if test "x$have_perl_ithreads" = "xyes"
1292 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
1296 LDFLAGS=$SAVE_LDFLAGS
1299 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1301 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1303 LDFLAGS="$LDFLAGS -L$withval/lib"
1304 CPPFLAGS="$CPPFLAGS -I$withval/include"
1309 if test "x$ac_system" = "xLinux"
1313 with_libiptc="no (Linux only)"
1316 if test "x$with_libiptc" = "xyes"
1318 AC_CHECK_LIB(iptc, iptc_init,
1320 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1321 ], [with_libiptc="no (libiptc not found)"])
1323 if test "x$with_libiptc" = "xyes"
1325 AC_CHECK_HEADERS(libiptc/libiptc.h,
1327 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1328 ], [with_libiptc="no (libiptc/libiptc.h not found)"])
1330 if test "x$with_libiptc" = "xyes"
1336 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1338 with_snmp_config="net-snmp-config"
1341 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1343 if test "x$withval" = "xno"
1345 with_libnetsnmp="no"
1346 else if test "x$withval" = "xyes"
1348 with_libnetsnmp="yes"
1350 if test -x "$withval"
1352 with_snmp_config="$withval"
1353 with_libnetsnmp="yes"
1355 with_snmp_config="$withval/bin/net-snmp-config"
1356 with_libnetsnmp="yes"
1360 [with_libnetsnmp="yes"])
1361 if test "x$with_libnetsnmp" = "xyes"
1363 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
1364 snmp_config_status=$?
1366 if test $snmp_config_status -ne 0
1368 with_libnetsnmp="no ($with_snmp_config failed)"
1371 CFLAGS="$CFLAGS $with_snmp_cflags"
1373 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1375 CFLAGS="$SAVE_CFLAGS"
1378 if test "x$with_libnetsnmp" = "xyes"
1380 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
1381 snmp_config_status=$?
1383 if test $snmp_config_status -ne 0
1385 with_libnetsnmp="no ($with_snmp_config failed)"
1387 AC_CHECK_LIB(netsnmp, init_snmp,
1388 [with_libnetsnmp="yes"],
1389 [with_libnetsnmp="no (libnetsnmp not found)"],
1393 if test "x$with_libnetsnmp" = "xyes"
1395 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
1396 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
1397 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
1398 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
1400 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1402 with_upsclient_config="libupsclient-config"
1403 with_upsclient_cflags=""
1404 with_upsclient_libs=""
1405 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])],
1407 if test "x$withval" = "xno"
1409 with_libupsclient="no"
1411 if test "x$withval" != "xyes"
1413 if test -f "$withval" && test -x "$withval";
1415 with_upsclient_config="$withval"
1417 with_upsclient_config="$withval/bin/libupsclient-config"
1420 with_libupsclient="yes"
1424 with_libupsclient="yes"
1426 if test "x$with_libupsclient" = "xyes"
1428 with_upsclient_cflags=`$with_upsclient_config --cflags 2>/dev/null`
1429 upsclient_config_status=$?
1431 if test $upsclient_config_status -ne 0
1433 with_libupsclient="no ($with_upsclient_config failed)"
1436 if test "x$with_libupsclient" = "xyes"
1438 SAVE_CFLAGS="$CFLAGS"
1439 CFLAGS="$CFLAGS $with_upsclient_cflags"
1441 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
1443 CFLAGS="$SAVE_CFLAGS"
1445 if test "x$with_libupsclient" = "xyes"
1447 with_upsclient_libs=`$with_upsclient_config --libs 2>/dev/null`
1448 upsclient_config_status=$?
1450 if test $upsclient_config_status -ne 0
1452 with_libupsclient="no ($with_upsclient_config failed)"
1455 if test "x$with_libupsclient" = "xyes"
1457 AC_CHECK_LIB(upsclient, upscli_connect,
1459 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_upsclient_cflags"
1460 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_upsclient_libs"
1461 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
1462 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
1465 with_libupsclient="no (symbol 'upscli_connect' not found)"
1466 ], [$with_upsclient_libs])
1468 if test "x$with_libupsclient" = "xyes"
1470 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
1471 [#include <stdlib.h>
1473 #include <upsclient.h>])
1475 AM_CONDITIONAL(BUILD_WITH_LIBUPSCLIENT, test "x$with_libupsclient" = "xyes")
1477 ### BEGIN of check for libxmms ###
1478 with_xmms_config="xmms-config"
1481 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
1483 if test "x$withval" != "xno" -a "x$withval" != "xyes"
1485 if test -f "$withval" && test -x "$withval";
1487 with_xmms_config="$withval"
1488 else if test -x "$withval/bin/xmms-config"
1490 with_xmms_config="$withval/bin/xmms-config"
1493 else if test "x$withval" = "xno"
1503 if test "x$with_libxmms" = "xyes"
1505 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
1506 xmms_config_status=$?
1508 if test $xmms_config_status -ne 0
1513 if test "x$with_libxmms" = "xyes"
1515 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
1516 xmms_config_status=$?
1518 if test $xmms_config_status -ne 0
1523 if test "x$with_libxmms" = "xyes"
1525 AC_CHECK_LIB(xmms, xmms_remote_get_info,
1527 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
1528 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
1529 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
1530 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
1537 with_libxmms_numeric=0
1538 if test "x$with_libxmms" = "xyes"
1540 with_libxmms_numeric=1
1542 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
1543 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
1544 ### END of check for libxmms ###
1546 with_libnetlink_cflags=""
1547 with_libnetlink_libs="-lnetlink"
1548 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
1550 echo "libnetlink: withval = $withval"
1551 if test "x$withval" = "xyes"
1553 with_libnetlink="yes"
1554 else if test "x$withval" = "xno"
1556 with_libnetlink="no"
1558 if test -d "$withval/include"
1560 with_libnetlink_cflags="-I$withval/include"
1561 with_libnetlink_libs="-L$withval/lib -lnetlink"
1562 with_libnetlink="yes"
1564 AC_MSG_ERROR("no such directory: $withval/include")
1569 if test "x$ac_system" = "xLinux"
1571 with_libnetlink="yes"
1573 with_libnetlink="no (Linux only library)"
1576 if test "x$with_libnetlink" = "xyes"
1579 CFLAGS="$CFLAGS $with_libnetlink_cflags"
1581 with_libnetlink="no (libnetlink.h not found)"
1583 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
1585 with_libnetlink="yes"
1589 #include <sys/types.h>
1590 #include <asm/types.h>
1591 #include <sys/socket.h>
1592 #include <linux/netlink.h>
1593 #include <linux/rtnetlink.h>])
1594 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
1596 #include <sys/types.h>
1597 #include <asm/types.h>
1598 #include <sys/socket.h>])
1602 #include <sys/types.h>
1603 #include <asm/types.h>
1604 #include <sys/socket.h>
1605 #include <linux/netlink.h>
1606 #include <linux/rtnetlink.h>
1610 int retval = TCA_STATS2;
1613 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
1618 #include <sys/types.h>
1619 #include <asm/types.h>
1620 #include <sys/socket.h>
1621 #include <linux/netlink.h>
1622 #include <linux/rtnetlink.h>
1626 int retval = TCA_STATS;
1629 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
1632 CFLAGS="$SAVE_CFLAGS"
1634 if test "x$with_libnetlink" = "xyes"
1636 AC_CHECK_LIB(netlink, rtnl_open,
1637 [with_libnetlink="yes"],
1638 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
1639 [$with_libnetlink_libs])
1641 if test "x$with_libnetlink" = "xyes"
1643 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
1644 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
1645 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
1646 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
1648 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
1650 dnl Check for libvirt and libxml2 libraries.
1651 with_libxml2="no (pkg-config isn't available)"
1652 with_libxml2_cflags=""
1653 with_libxml2_ldflags=""
1654 with_libvirt="no (pkg-config isn't available)"
1655 with_libvirt_cflags=""
1656 with_libvirt_ldflags=""
1658 if test "x$PKG_CONFIG" != "x"
1660 pkg-config --exists 'libxml-2.0' 2>/dev/null
1665 with_libxml2="no (pkg-config doesn't know library)"
1668 pkg-config --exists libvirt 2>/dev/null
1673 with_libvirt="no (pkg-config doesn't know library)"
1676 if test "x$with_libxml2" = "xyes"
1678 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
1683 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
1689 if test "x$with_libxml2" = "xyes"
1691 SAVE_CPPFLAGS="$CPPFLAGS"
1692 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
1694 AC_CHECK_HEADERS(libxml/parser.h, [],
1695 [with_libxml2="no (libxml/parser.h not found)"])
1697 CPPFLAGS="$SAVE_CPPFLAGS"
1699 if test "x$with_libxml2" = "xyes"
1701 SAVE_CFLAGS="$CFLAGS"
1702 SAVE_LD_FLAGS="$LDFLAGS"
1704 CFLAGS="$CFLAGS $with_libxml2_cflags"
1705 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
1707 AC_CHECK_LIB(xml2, xmlXPathEval,
1708 [with_libxml2="yes"],
1709 [with_libxml2="no (symbol xmlXPathEval not found)"])
1711 CFLAGS="$SAVE_CFLAGS"
1712 LDFLAGS="$SAVE_LDFLAGS"
1714 dnl Add the right compiler flags and libraries.
1715 if test "x$with_libxml2" = "xyes"; then
1716 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
1717 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
1718 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
1719 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
1721 if test "x$with_libvirt" = "xyes"
1723 with_libvirt_cflags="`pkg-config --cflags libvirt`"
1728 with_libvirt_ldflags="`pkg-config --libs libvirt`"
1734 if test "x$with_libvirt" = "xyes"
1736 SAVE_CPPFLAGS="$CPPFLAGS"
1737 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
1739 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
1740 [with_libvirt="no (libvirt/libvirt.h not found)"])
1742 CPPFLAGS="$SAVE_CPPFLAGS"
1744 if test "x$with_libvirt" = "xyes"
1746 SAVE_CFLAGS="$CFLAGS"
1747 SAVE_LD_FLAGS="$LDFLAGS"
1749 CFLAGS="$CFLAGS $with_libvirt_cflags"
1750 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
1752 AC_CHECK_LIB(virt, virDomainBlockStats,
1753 [with_libvirt="yes"],
1754 [with_libvirt="no (symbol virDomainBlockStats not found)"])
1756 CFLAGS="$SAVE_CFLAGS"
1757 LDFLAGS="$SAVE_LDFLAGS"
1759 dnl Add the right compiler flags and libraries.
1760 if test "x$with_libvirt" = "xyes"; then
1761 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
1762 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
1763 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
1764 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
1767 dnl End of check for libvirt and libxml2 libraries.
1769 # Check for enabled/disabled features
1772 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
1773 # ------------------------------------------------------------
1775 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
1780 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
1785 m4_define([EnDis],[disabled])dnl
1786 m4_define([YesNo],[no])dnl
1792 m4_define([EnDis],[enabled])dnl
1793 m4_define([YesNo],[yes])dnl
1796 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
1800 m4_if([$3], [feature], [],
1804 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
1810 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
1812 enable_$1='[YesNo]'dnl
1814 if test "x$enable_$1" = "xno"
1818 if test "x$enable_$1" = "xyes"
1822 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
1827 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
1828 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
1830 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
1832 # AC_PLUGIN(name, default, info)
1833 # ------------------------------------------------------------
1839 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
1841 if test "x$enableval" = "xyes"
1849 if test "x$2" = "xyes"
1856 if test "x$enable_plugin" = "xyes"
1858 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
1860 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
1861 enable_$1="$enable_plugin"
1863 )# AC_PLUGIN(name, default, info)
1865 m4_divert_once([HELP_ENABLE], [
1866 collectd features:])
1867 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
1868 AC_COLLECTD([debug], [enable], [feature], [debugging])
1869 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
1870 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
1878 plugin_interface="no"
1884 plugin_multimeter="no"
1887 plugin_processes="no"
1891 plugin_tcpconns="no"
1894 plugin_wireless="no"
1897 if test "x$ac_system" = "xLinux"
1899 plugin_battery="yes"
1901 plugin_cpufreq="yes"
1903 plugin_entropy="yes"
1904 plugin_interface="yes"
1909 plugin_processes="yes"
1912 plugin_tcpconns="yes"
1913 plugin_vserver="yes"
1914 plugin_wireless="yes"
1916 if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
1923 if test "x$with_libiokit" = "xyes"
1925 plugin_battery="yes"
1930 if test "x$with_devinfo$with_kstat" = "xyesyes"
1934 plugin_interface="yes"
1941 if test "x$with_libstatgrab" = "xyes"
1943 plugin_interface="yes"
1949 if test "x$have_processor_info" = "xyes"
1953 if test "x$have_sysctlbyname" = "xyes"
1957 plugin_tcpconns="yes"
1960 if test "x$have_statfs" = "xyes"
1964 if test "x$have_statvfs" = "xyes"
1969 if test "x$have_getifaddrs" = "xyes"
1971 plugin_interface="yes"
1974 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
1976 plugin_libvirt="yes"
1979 if test "x$have_getloadavg" = "xyes"
1984 if test "x$have_libperl$have_perl_ithreads" = "xyesyes"
1989 # Mac OS X memory interface
1990 if test "x$have_host_statistics" = "xyes"
1995 if test "x$have_termios_h" = "xyes"
1997 plugin_multimeter="yes"
2000 if test "x$have_thread_info" = "xyes"
2002 plugin_processes="yes"
2005 if test "x$with_libkvm" = "xyes"
2010 if test "x$have_getutent" = "xyes"
2014 if test "x$have_getutxent" = "xyes"
2019 # FIXME: sysctl for swap plugin
2021 m4_divert_once([HELP_ENABLE], [
2024 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
2025 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
2026 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
2027 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
2028 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
2029 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
2030 AC_PLUGIN([csv], [yes], [CSV output plugin])
2031 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
2032 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
2033 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
2034 AC_PLUGIN([email], [yes], [EMail statistics])
2035 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
2036 AC_PLUGIN([exec], [yes], [Execution of external programs])
2037 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
2038 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
2039 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
2040 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
2041 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
2042 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
2043 AC_PLUGIN([load], [$plugin_load], [System load])
2044 AC_PLUGIN([logfile], [yes], [File logging plugin])
2045 AC_PLUGIN([mbmon], [yes], [Query mbmond])
2046 AC_PLUGIN([memcached], [yes], [memcached statistics])
2047 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
2048 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
2049 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
2050 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
2051 AC_PLUGIN([network], [yes], [Network communication plugin])
2052 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
2053 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
2054 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
2055 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
2056 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
2057 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
2058 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
2059 AC_PLUGIN([rrdtool], [$with_rrdtool], [RRDTool output plugin])
2060 AC_PLUGIN([sensors], [$with_lm_sensors], [lm_sensors statistics])
2061 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
2062 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
2063 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
2064 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
2065 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
2066 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
2067 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
2068 AC_PLUGIN([users], [$plugin_users], [User statistics])
2069 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
2070 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
2071 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
2072 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
2075 if test "x$ac_system" = "xLinux" -a "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
2077 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
2081 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
2083 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2085 PERL_BINDINGS_OPTIONS="$withval"
2086 with_perl_bindings="yes"
2090 PERL_BINDINGS_OPTIONS=""
2091 with_perl_bindings="yes"
2093 if test "x$with_perl_bindings" = "xyes"
2095 PERL_BINDINGS="perl"
2099 AC_SUBST(PERL_BINDINGS)
2100 AC_SUBST(PERL_BINDINGS_OPTIONS)
2102 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile bindings/Makefile)
2104 if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
2106 with_liboping="yes (shipped version)"
2109 if test "x$with_libperl" = "xyes"
2111 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
2113 enable_perl="no (needs libperl)"
2116 if test "x$with_perl_bindings" = "xyes" -a "x$PERL_BINDINGS_OPTIONS" != "x"
2118 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
2125 libcurl . . . . . . $with_libcurl
2126 libiokit . . . . . $with_libiokit
2127 libiptc . . . . . . $with_libiptc
2128 libkstat . . . . . $with_kstat
2129 libkvm . . . . . . $with_libkvm
2130 libmysql . . . . . $with_libmysql
2131 libnetlink . . . . $with_libnetlink
2132 libnetsnmp . . . . $with_libnetsnmp
2133 liboconfig . . . . $with_liboconfig
2134 liboping . . . . . $with_liboping
2135 libpcap . . . . . . $with_libpcap
2136 libperl . . . . . . $with_libperl
2137 libpthread . . . . $with_libpthread
2138 librrd . . . . . . $with_rrdtool
2139 libsensors . . . . $with_lm_sensors
2140 libstatgrab . . . . $with_libstatgrab
2141 libupsclient . . . $with_libupsclient
2142 libvirt . . . . . . $with_libvirt
2143 libxml2 . . . . . . $with_libxml2
2144 libxmms . . . . . . $with_libxmms
2147 daemon mode . . . . $enable_daemon
2148 debug . . . . . . . $enable_debug
2151 perl . . . . . . . $with_perl_bindings
2154 apache . . . . . . $enable_apache
2155 apcups . . . . . . $enable_apcups
2156 apple_sensors . . . $enable_apple_sensors
2157 battery . . . . . . $enable_battery
2158 cpu . . . . . . . . $enable_cpu
2159 cpufreq . . . . . . $enable_cpufreq
2160 csv . . . . . . . . $enable_csv
2161 df . . . . . . . . $enable_df
2162 disk . . . . . . . $enable_disk
2163 dns . . . . . . . . $enable_dns
2164 email . . . . . . . $enable_email
2165 entropy . . . . . . $enable_entropy
2166 exec . . . . . . . $enable_exec
2167 hddtemp . . . . . . $enable_hddtemp
2168 interface . . . . . $enable_interface
2169 iptables . . . . . $enable_iptables
2170 ipvs . . . . . . . $enable_ipvs
2171 irq . . . . . . . . $enable_irq
2172 libvirt . . . . . . $enable_libvirt
2173 load . . . . . . . $enable_load
2174 logfile . . . . . . $enable_logfile
2175 mbmon . . . . . . . $enable_mbmon
2176 memcached . . . . . $enable_memcached
2177 memory . . . . . . $enable_memory
2178 multimeter . . . . $enable_multimeter
2179 mysql . . . . . . . $enable_mysql
2180 netlink . . . . . . $enable_netlink
2181 network . . . . . . $enable_network
2182 nfs . . . . . . . . $enable_nfs
2183 nginx . . . . . . . $enable_nginx
2184 ntpd . . . . . . . $enable_ntpd
2185 nut . . . . . . . . $enable_nut
2186 perl . . . . . . . $enable_perl
2187 ping . . . . . . . $enable_ping
2188 processes . . . . . $enable_processes
2189 rrdtool . . . . . . $enable_rrdtool
2190 sensors . . . . . . $enable_sensors
2191 serial . . . . . . $enable_serial
2192 snmp . . . . . . . $enable_snmp
2193 swap . . . . . . . $enable_swap
2194 syslog . . . . . . $enable_syslog
2195 tape . . . . . . . $enable_tape
2196 tcpconns . . . . . $enable_tcpconns
2197 unixsock . . . . . $enable_unixsock
2198 users . . . . . . . $enable_users
2199 uuid . . . . . . . $enable_uuid
2200 vserver . . . . . . $enable_vserver
2201 wireless . . . . . $enable_wireless
2202 xmms . . . . . . . $enable_xmms