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.
20 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
24 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 endian.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 getgrnam_r setgroups regcomp regerror regexec regfree)
377 socket_needs_socket="no"
378 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
379 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
381 nanosleep_needs_rt="no"
382 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
383 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
385 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
386 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
387 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
388 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
389 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
390 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
391 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
392 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
393 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
394 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
397 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
400 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
402 if test "x$withval" = "xno"; then
404 else if test "x$withval" = "xyes"; then
411 if test "x$nan_type" = "xnone"; then
412 AC_CACHE_CHECK([whether NAN is defined by default],
419 static float foo = NAN;
427 [have_nan_default="yes"],
428 [have_nan_default="no"]
431 if test "x$have_nan_default" = "xyes"
436 if test "x$nan_type" = "xnone"; then
437 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
443 #define __USE_ISOC99 1
445 static float foo = NAN;
453 [have_nan_isoc="yes"],
457 if test "x$have_nan_isoc" = "xyes"
462 if test "x$nan_type" = "xnone"; then
463 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
473 #define NAN (0.0 / 0.0)
475 # define isnan(f) ((f) != (f))
477 static float foo = NAN;
485 [have_nan_zero="yes"],
489 if test "x$have_nan_zero" = "xyes"
495 if test "x$nan_type" = "xdefault"; then
496 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
497 [Define if NAN is defined by default and can initialize static variables.])
498 else if test "x$nan_type" = "xisoc99"; then
499 AC_DEFINE(NAN_STATIC_ISOC, 1,
500 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
501 else if test "x$nan_type" = "xzero"; then
502 AC_DEFINE(NAN_ZERO_ZERO, 1,
503 [Define if NAN can be defined as (0.0 / 0.0)])
505 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
508 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
510 if test "x$withval" = "xnothing"; then
511 fp_layout_type="nothing"
512 else if test "x$withval" = "xendianflip"; then
513 fp_layout_type="endianflip"
514 else if test "x$withval" = "xintswap"; then
515 fp_layout_type="intswap"
517 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
520 [fp_layout_type="unknown"])
522 if test "x$fp_layout_type" = "xunknown"; then
523 AC_CACHE_CHECK([if doubles are stored in x86 representation],
524 [fp_layout_need_nothing],
540 memcpy ((void *) &i0, (void *) &d, 8);
543 memcpy ((void *) c, (void *) &i1, 8);
545 if ((c[0] == 0x2f) && (c[1] == 0x25)
546 && (c[2] == 0xc0) && (c[3] == 0xc7)
547 && (c[4] == 0x43) && (c[5] == 0x2b)
548 && (c[6] == 0x1f) && (c[7] == 0x5b))
553 [fp_layout_need_nothing="yes"],
554 [fp_layout_need_nothing="no"]
557 if test "x$fp_layout_need_nothing" = "xyes"; then
558 fp_layout_type="nothing"
561 if test "x$fp_layout_type" = "xunknown"; then
562 AC_CACHE_CHECK([if endianflip converts to x86 representation],
563 [fp_layout_need_endianflip],
571 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
572 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
573 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
574 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
575 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
576 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
577 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
578 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
587 memcpy ((void *) &i0, (void *) &d, 8);
589 i1 = endianflip (i0);
590 memcpy ((void *) c, (void *) &i1, 8);
592 if ((c[0] == 0x2f) && (c[1] == 0x25)
593 && (c[2] == 0xc0) && (c[3] == 0xc7)
594 && (c[4] == 0x43) && (c[5] == 0x2b)
595 && (c[6] == 0x1f) && (c[7] == 0x5b))
600 [fp_layout_need_endianflip="yes"],
601 [fp_layout_need_endianflip="no"]
604 if test "x$fp_layout_need_endianflip" = "xyes"; then
605 fp_layout_type="endianflip"
608 if test "x$fp_layout_type" = "xunknown"; then
609 AC_CACHE_CHECK([if intswap converts to x86 representation],
610 [fp_layout_need_intswap],
618 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
619 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
628 memcpy ((void *) &i0, (void *) &d, 8);
631 memcpy ((void *) c, (void *) &i1, 8);
633 if ((c[0] == 0x2f) && (c[1] == 0x25)
634 && (c[2] == 0xc0) && (c[3] == 0xc7)
635 && (c[4] == 0x43) && (c[5] == 0x2b)
636 && (c[6] == 0x1f) && (c[7] == 0x5b))
641 [fp_layout_need_intswap="yes"],
642 [fp_layout_need_intswap="no"]
645 if test "x$fp_layout_need_intswap" = "xyes"; then
646 fp_layout_type="intswap"
650 if test "x$fp_layout_type" = "xnothing"; then
651 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
652 [Define if doubles are stored in x86 representation.])
653 else if test "x$fp_layout_type" = "xendianflip"; then
654 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
655 [Define if endianflip is needed to convert to x86 representation.])
656 else if test "x$fp_layout_type" = "xintswap"; then
657 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
658 [Define if intswap is needed to convert to x86 representation.])
660 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
664 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
666 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
668 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
671 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
672 if test "x$have_getmntent" = "xno"; then
673 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
675 if test "x$have_getmntent" = "xno"; then
676 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
678 if test "x$have_getmntent" = "xno"; then
679 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
682 if test "x$have_getmntent" = "xc"; then
683 AC_CACHE_CHECK([whether getmntent takes one argument],
684 [have_one_getmntent],
686 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
688 #include "$srcdir/src/utils_mount.h"]],
692 fh = setmntent ("/etc/mtab", "r");
696 [have_one_getmntent="yes"],
697 [have_one_getmntent="no"]
700 AC_CACHE_CHECK([whether getmntent takes two arguments],
701 [have_two_getmntent],
703 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
704 #include <sys/mnttab.h>
705 #include "$srcdir/src/utils_mount.h"]],
710 fh = fopen ("/etc/mnttab", "r");
711 status = getmntent (fh, &mt);
714 [have_two_getmntent="yes"],
715 [have_two_getmntent="no"]
720 # Check for different versions of `getmntent' here..
722 if test "x$have_getmntent" = "xc"; then
723 if test "x$have_one_getmntent" = "xyes"; then
724 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
725 [Define if the function getmntent exists and takes one argument.])
727 if test "x$have_two_getmntent" = "xyes"; then
728 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
729 [Define if the function getmntent exists and takes two arguments.])
732 if test "x$have_getmntent" = "xsun"; then
733 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
734 [Define if the function getmntent exists. It's the version from libsun.])
736 if test "x$have_getmntent" = "xseq"; then
737 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
738 [Define if the function getmntent exists. It's the version from libseq.])
740 if test "x$have_getmntent" = "xgen"; then
741 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
742 [Define if the function getmntent exists. It's the version from libgen.])
745 # Check for structures
746 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
747 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
750 #include <sys/types.h>
751 #include <sys/socket.h>
754 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
755 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
758 #include <sys/types.h>
759 #include <sys/socket.h>
760 #include <linux/if.h>
761 #include <linux/netdevice.h>
764 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
769 # include <sys/types.h>
771 #if HAVE_NETINET_IN_SYSTM_H
772 # include <netinet/in_systm.h>
774 #if HAVE_NETINET_IN_H
775 # include <netinet/in.h>
777 #if HAVE_NETINET_IP_H
778 # include <netinet/ip.h>
780 #if HAVE_NETINET_UDP_H
781 # include <netinet/udp.h>
784 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
789 # include <sys/types.h>
791 #if HAVE_NETINET_IN_SYSTM_H
792 # include <netinet/in_systm.h>
794 #if HAVE_NETINET_IN_H
795 # include <netinet/in.h>
797 #if HAVE_NETINET_IP_H
798 # include <netinet/ip.h>
800 #if HAVE_NETINET_UDP_H
801 # include <netinet/udp.h>
805 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
815 # Checks for libraries begin here
818 AC_CHECK_LIB(resolv, res_search,
820 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
822 [with_libresolv="no"])
823 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
826 m4_divert_once([HELP_WITH], [
827 collectd additional packages:])
829 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
832 librrd_threadsafe="yes"
833 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
834 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
836 librrd_cflags="-I$withval/include"
837 librrd_ldflags="-L$withval/lib"
840 ], [with_rrdtool="yes"])
841 if test "x$with_rrdtool" = "xyes"
843 SAVE_CPPFLAGS="$CPPFLAGS"
844 SAVE_LDFLAGS="$LDFLAGS"
846 CPPFLAGS="$CPPFLAGS $librrd_cflags"
847 LDFLAGS="$LDFLAGS $librrd_ldflags"
849 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
851 CPPFLAGS="$SAVE_CPPFLAGS"
852 LDFLAGS="$SAVE_LDFLAGS"
854 if test "x$with_rrdtool" = "xyes"
856 SAVE_CPPFLAGS="$CPPFLAGS"
857 SAVE_LDFLAGS="$LDFLAGS"
859 CPPFLAGS="$CPPFLAGS $librrd_cflags"
860 LDFLAGS="$LDFLAGS $librrd_ldflags"
862 AC_CHECK_LIB(rrd_th, rrd_update_r,
864 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
866 [librrd_threadsafe="no"
867 AC_CHECK_LIB(rrd, rrd_update,
869 librrd_ldflags="$librrd_ldflags -lrrd -lm"
871 [with_rrdtool="no (symbol 'rrd_update' not found)"],
876 CPPFLAGS="$SAVE_CPPFLAGS"
877 LDFLAGS="$SAVE_LDFLAGS"
879 if test "x$with_rrdtool" = "xyes"
881 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
882 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
883 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
884 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
886 if test "x$librrd_threadsafe" = "xyes"
888 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
891 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
892 [ if test "x$withval" != "xno" -a "x$withval" != "xyes"
894 LDFLAGS="$LDFLAGS -L$withval/lib"
895 CPPFLAGS="$CPPFLAGS -I$withval/include"
896 with_libpthread="yes"
898 if test "x$withval" = "xno"
900 with_libpthread="no (disabled)"
903 ], [with_libpthread="yes"])
904 if test "x$with_libpthread" = "xyes"
906 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
908 if test "x$with_libpthread" = "xyes"
910 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
912 if test "x$with_libpthread" = "xyes"
918 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
919 [Wether or not to use pthread (POSIX threads) library])
920 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
922 if test "x$ac_system" = "xSolaris"
927 with_kstat="no (Solaris only)"
928 with_devinfo="no (Solaris only)"
931 if test "x$with_kstat" = "xyes"
933 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
935 if test "x$with_kstat" = "xyes"
937 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
938 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
940 if test "x$with_kstat" = "xyes"
942 AC_DEFINE(HAVE_LIBKSTAT, 1,
943 [Define to 1 if you have the 'kstat' library (-lkstat)])
945 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
946 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
948 ### BEGIN of check for libcurl ###
949 with_curl_config="curl-config"
952 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
954 if test "x$withval" = "xno"
957 else if test "x$withval" = "xyes"
961 if test -f "$withval" && test -x "$withval"
963 with_curl_config="$withval"
965 else if test -x "$withval/bin/curl-config"
967 with_curl_config="$withval/bin/curl-config"
976 if test "x$with_libcurl" = "xyes"
978 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
979 curl_config_status=$?
981 if test $curl_config_status -ne 0
983 with_libcurl="no ($with_curl_config failed)"
985 SAVE_CPPFLAGS="$CPPFLAGS"
986 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
988 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
990 CPPFLAGS="$SAVE_CPPFLAGS"
993 if test "x$with_libcurl" = "xyes"
995 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
996 curl_config_status=$?
998 if test $curl_config_status -ne 0
1000 with_libcurl="no ($with_curl_config failed)"
1002 AC_CHECK_LIB(curl, curl_easy_init,
1003 [with_libcurl="yes"],
1004 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1008 if test "x$with_libcurl" = "xyes"
1010 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1011 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1012 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1013 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1015 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1016 ### END of check for libcurl ###
1020 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1029 AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
1030 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1032 with_libstatgrab_cflags=""
1033 with_libstatgrab_ldflags=""
1034 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
1036 if test "x$withval" != "xno" -a "x$withval" != "xyes"
1038 with_libstatgrab_cflags="-I$withval/include"
1039 with_libstatgrab_ldflags="-L$withval/lib"
1040 with_libstatgrab="yes"
1044 if test "x$ac_system" == "xunknown"
1046 with_libstatgrab="yes"
1048 with_libstatgrab="no"
1051 with_libstatgrab_pkg_config="yes"
1052 if test "x$with_libstatgrab" = "xyes" \
1053 && test "x$PKG_CONFIG" != "x"
1055 AC_MSG_CHECKING([pkg-config for libstatgrab])
1057 $PKG_CONFIG --exists libstatgrab 2>/dev/null
1060 with_libstatgrab_pkg_config="no"
1061 temp_result="not found"
1063 AC_MSG_RESULT([$temp_result])
1065 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
1066 with_libstatgrab_pkg_config="no"
1067 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
1070 if test "x$with_libstatgrab" = "xyes" \
1071 && test "x$with_libstatgrab_pkg_config" = "xyes" \
1072 && test "x$with_libstatgrab_cflags" = "x"
1074 AC_MSG_CHECKING([for libstatgrab CFLAGS])
1075 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
1078 with_libstatgrab_cflags="$temp_result"
1080 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
1081 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
1083 AC_MSG_RESULT([$temp_result])
1086 if test "x$with_libstatgrab" = "xyes" \
1087 && test "x$with_libstatgrab_pkg_config" = "xyes" \
1088 && test "x$with_libstatgrab_ldflags" = "x"
1090 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
1091 temp_result="`$PKG_CONFIG --libs libstatgrab`"
1094 with_libstatgrab_ldflags="$temp_result"
1096 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
1097 temp_result="$PKG_CONFIG --libs libstatgrab failed"
1099 AC_MSG_RESULT([$temp_result])
1102 if test "x$with_libstatgrab" = "xyes"
1104 SAVE_CPPFLAGS="$CPPFLAGS"
1105 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
1107 AC_CHECK_HEADERS(statgrab.h,
1108 [with_libstatgrab="yes"],
1109 [with_libstatgrab="no (statgrab.h not found)"])
1111 CPPFLAGS="$SAVE_CPPFLAGS"
1114 if test "x$with_libstatgrab" = "xyes"
1116 SAVE_CFLAGS="$CFLAGS"
1117 SAVE_LDFLAGS="$LDFLAGS"
1119 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
1120 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
1122 AC_CHECK_LIB(statgrab, sg_init,
1123 [with_libstatgrab="yes"],
1124 [with_libstatgrab="no (symbol sg_init not found)"])
1126 CFLAGS="$SAVE_CFLAGS"
1127 LDFLAGS="$SAVE_LDFLAGS"
1130 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
1131 if test "x$with_libstatgrab" = "xyes"
1133 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
1134 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
1135 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
1136 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
1139 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
1140 if test "x$with_libkvm" = "xyes"
1142 AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
1144 AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
1146 with_sensors_cflags=""
1147 with_sensors_ldflags=""
1148 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
1150 if test "x$withval" = "xno"
1152 with_lm_sensors="no"
1154 with_lm_sensors="yes"
1155 if test "x$withval" != "xyes"
1157 with_sensors_cflags="-I$withval/include"
1158 with_sensors_ldflags="-L$withval/lib"
1159 with_lm_sensors="yes"
1164 if test "x$ac_system" = "xLinux"
1166 with_lm_sensors="yes"
1168 with_lm_sensors="no (Linux only library)"
1171 if test "x$with_lm_sensors" = "xyes"
1173 SAVE_CPPFLAGS="$CPPFLAGS"
1174 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
1176 # AC_CHECK_HEADERS(sensors/sensors.h,
1178 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
1180 # [with_lm_sensors="no (sensors/sensors.h not found)"])
1181 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_lm_sensors="no (sensors/sensors.h not found)"])
1183 CPPFLAGS="$SAVE_CPPFLAGS"
1185 if test "x$with_lm_sensors" = "xyes"
1187 SAVE_CPPFLAGS="$CPPFLAGS"
1188 SAVE_LDFLAGS="$LDFLAGS"
1189 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
1190 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
1192 AC_CHECK_LIB(sensors, sensors_init,
1194 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
1196 [with_lm_sensors="no (libsensors not found)"])
1198 CPPFLAGS="$SAVE_CPPFLAGS"
1199 LDFLAGS="$SAVE_LDFLAGS"
1201 if test "x$with_lm_sensors" = "xyes"
1203 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
1204 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
1205 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
1206 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
1208 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
1210 with_mysql_config="mysql_config"
1211 with_mysql_cflags=""
1213 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1215 if test "x$withval" = "xno"
1218 else if test "x$withval" = "xyes"
1222 if test -f "$withval" && test -x "$withval";
1224 with_mysql_config="$withval"
1225 else if test -x "$withval/bin/mysql_config"
1227 with_mysql_config="$withval/bin/mysql_config"
1235 if test "x$with_libmysql" = "xyes"
1237 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1238 mysql_config_status=$?
1240 if test $mysql_config_status -ne 0
1244 SAVE_CPPFLAGS="$CPPFLAGS"
1245 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
1247 AC_CHECK_HEADERS(mysql/mysql.h, [], [with_libmysql="no (mysql/mysql.h not found)"], [])
1249 CPPFLAGS="$SAVE_CPPFLAGS"
1252 if test "x$with_libmysql" = "xyes"
1254 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
1255 mysql_config_status=$?
1257 if test $mysql_config_status -ne 0
1261 AC_CHECK_LIB(mysqlclient, mysql_init,
1262 [with_libmysql="yes"],
1263 [with_libmysql="no (symbol 'mysql_init' not found)"],
1267 if test "x$with_libmysql" = "xyes"
1269 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
1270 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
1271 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
1272 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
1274 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
1276 with_own_liboconfig="no"
1277 liboconfig_LDFLAGS="$LDFLAGS"
1278 liboconfig_CPPFLAGS="$CPPFLAGS"
1279 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1281 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1283 if test -d "$withval/lib"
1285 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1287 if test -d "$withval/include"
1289 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1292 if test "x$withval" = "xno"
1294 AC_MSG_ERROR("liboconfig is required")
1298 with_liboconfig="yes"
1301 save_LDFLAGS="$LDFLAGS"
1302 save_CPPFLAGS="$CPPFLAGS"
1303 LDFLAGS="$liboconfig_LDFLAGS"
1304 CPPFLAGS="$liboconfig_CPPFLAGS"
1305 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1307 with_liboconfig="yes"
1308 with_own_liboconfig="no"
1311 with_liboconfig="yes"
1312 with_own_liboconfig="yes"
1313 LDFLAGS="$save_LDFLAGS"
1314 CPPFLAGS="$save_CPPFLAGS"
1317 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1318 if test "x$with_own_liboconfig" = "xyes"
1320 with_liboconfig="yes (shipped version)"
1323 #with_liboping="yes"
1324 with_own_liboping="no"
1325 liboping_LDFLAGS="$LDFLAGS"
1326 liboping_CPPFLAGS="$CPPFLAGS"
1327 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1329 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1331 if test -d "$withval/lib"
1333 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
1335 if test -d "$withval/include"
1337 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
1340 if test "x$withval" = "xno"
1343 with_own_liboping="no"
1351 if test "x$with_liboping" = "xyes"
1353 save_LDFLAGS="$LDFLAGS"
1354 save_CPPFLAGS="$CPPFLAGS"
1355 LDFLAGS="$liboping_LDFLAGS"
1356 CPPFLAGS="$liboping_CPPFLAGS"
1357 AC_CHECK_LIB(oping, ping_construct,
1360 with_own_liboping="no"
1364 with_own_liboping="yes"
1365 LDFLAGS="$save_LDFLAGS"
1366 CPPFLAGS="$save_CPPFLAGS"
1369 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1370 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1372 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1374 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1376 LDFLAGS="$LDFLAGS -L$withval/lib"
1377 CPPFLAGS="$CPPFLAGS -I$withval/include"
1384 if test "x$with_libpcap" = "xyes"
1386 AC_CHECK_LIB(pcap, pcap_open_live,
1388 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1389 ], [with_libpcap="no (libpcap not found)"])
1391 if test "x$with_libpcap" = "xyes"
1393 AC_CHECK_HEADERS(pcap.h,
1395 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1396 ], [with_libpcap="no (pcap.h not found)"])
1398 if test "x$with_libpcap" = "xyes"
1404 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1405 [Wether or not to use the pcap library])
1406 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1408 perl_interpreter="perl"
1409 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1411 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1413 LDFLAGS="$LDFLAGS -L$withval/lib"
1414 CPPFLAGS="$CPPFLAGS -I$withval/include"
1415 perl_interpreter="$withval/bin/perl"
1423 AC_SUBST(PERL, "$perl_interpreter")
1425 if test "x$with_libperl" = "xyes"
1428 SAVE_LDFLAGS=$LDFLAGS
1429 PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
1430 PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
1431 CFLAGS="$CFLAGS $PERL_CFLAGS"
1432 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1434 AC_CACHE_CHECK([for libperl],
1444 PerlInterpreter *perl = NULL;
1445 Perl_load_module (perl, PERL_LOADMOD_NOIMPORT,
1446 newSVpv ("Collectd::Plugin::FooBar", 24),
1449 [have_libperl="yes"],
1454 if test "x$have_libperl" = "xyes"
1456 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
1457 AC_SUBST(PERL_CFLAGS)
1458 AC_SUBST(PERL_LDFLAGS)
1464 LDFLAGS=$SAVE_LDFLAGS
1466 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1468 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1470 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1472 LDFLAGS="$LDFLAGS -L$withval/lib"
1473 CPPFLAGS="$CPPFLAGS -I$withval/include"
1478 if test "x$ac_system" = "xLinux"
1482 with_libiptc="no (Linux only)"
1485 if test "x$with_libiptc" = "xyes"
1487 AC_CHECK_LIB(iptc, iptc_init,
1489 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1490 ], [with_libiptc="no (libiptc not found)"])
1492 if test "x$with_libiptc" = "xyes"
1494 AC_CHECK_HEADERS(libiptc/libiptc.h,
1496 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1497 ], [with_libiptc="no (libiptc/libiptc.h not found)"])
1499 if test "x$with_libiptc" = "xyes"
1505 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1507 with_snmp_config="net-snmp-config"
1510 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1512 if test "x$withval" = "xno"
1514 with_libnetsnmp="no"
1515 else if test "x$withval" = "xyes"
1517 with_libnetsnmp="yes"
1519 if test -x "$withval"
1521 with_snmp_config="$withval"
1522 with_libnetsnmp="yes"
1524 with_snmp_config="$withval/bin/net-snmp-config"
1525 with_libnetsnmp="yes"
1529 [with_libnetsnmp="yes"])
1530 if test "x$with_libnetsnmp" = "xyes"
1532 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
1533 snmp_config_status=$?
1535 if test $snmp_config_status -ne 0
1537 with_libnetsnmp="no ($with_snmp_config failed)"
1539 SAVE_CPPFLAGS="$CPPFLAGS"
1540 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
1542 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1544 CPPFLAGS="$SAVE_CPPFLAGS"
1547 if test "x$with_libnetsnmp" = "xyes"
1549 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
1550 snmp_config_status=$?
1552 if test $snmp_config_status -ne 0
1554 with_libnetsnmp="no ($with_snmp_config failed)"
1556 AC_CHECK_LIB(netsnmp, init_snmp,
1557 [with_libnetsnmp="yes"],
1558 [with_libnetsnmp="no (libnetsnmp not found)"],
1562 if test "x$with_libnetsnmp" = "xyes"
1564 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
1565 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
1566 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
1567 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
1569 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1571 with_upsclient_config="libupsclient-config"
1572 with_upsclient_cflags=""
1573 with_upsclient_libs=""
1574 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])],
1576 if test "x$withval" = "xno"
1578 with_libupsclient="no"
1580 if test "x$withval" != "xyes"
1582 if test -f "$withval" && test -x "$withval";
1584 with_upsclient_config="$withval"
1586 with_upsclient_config="$withval/bin/libupsclient-config"
1589 with_libupsclient="yes"
1593 with_libupsclient="yes"
1595 if test "x$with_libupsclient" = "xyes"
1597 with_upsclient_cflags=`$with_upsclient_config --cflags 2>/dev/null`
1598 upsclient_config_status=$?
1600 if test $upsclient_config_status -ne 0
1602 with_libupsclient="no ($with_upsclient_config failed)"
1605 if test "x$with_libupsclient" = "xyes"
1607 SAVE_CPPFLAGS="$CPPFLAGS"
1608 CPPFLAGS="$CPPFLAGS $with_upsclient_cflags"
1610 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
1612 CPPFLAGS="$SAVE_CPPFLAGS"
1614 if test "x$with_libupsclient" = "xyes"
1616 with_upsclient_libs=`$with_upsclient_config --libs 2>/dev/null`
1617 upsclient_config_status=$?
1619 if test $upsclient_config_status -ne 0
1621 with_libupsclient="no ($with_upsclient_config failed)"
1624 if test "x$with_libupsclient" = "xyes"
1626 AC_CHECK_LIB(upsclient, upscli_connect,
1628 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_upsclient_cflags"
1629 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_upsclient_libs"
1630 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
1631 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
1634 with_libupsclient="no (symbol 'upscli_connect' not found)"
1635 ], [$with_upsclient_libs])
1637 if test "x$with_libupsclient" = "xyes"
1639 SAVE_CPPFLAGS="$CPPFLAGS"
1640 CPPFLAGS="$CPPFLAGS $with_upsclient_cflags"
1642 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
1643 [#include <stdlib.h>
1645 #include <upsclient.h>])
1647 CPPFLAGS="$SAVE_CPPFLAGS"
1649 AM_CONDITIONAL(BUILD_WITH_LIBUPSCLIENT, test "x$with_libupsclient" = "xyes")
1651 ### BEGIN of check for libxmms ###
1652 with_xmms_config="xmms-config"
1655 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
1657 if test "x$withval" != "xno" -a "x$withval" != "xyes"
1659 if test -f "$withval" && test -x "$withval";
1661 with_xmms_config="$withval"
1662 else if test -x "$withval/bin/xmms-config"
1664 with_xmms_config="$withval/bin/xmms-config"
1667 else if test "x$withval" = "xno"
1677 if test "x$with_libxmms" = "xyes"
1679 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
1680 xmms_config_status=$?
1682 if test $xmms_config_status -ne 0
1687 if test "x$with_libxmms" = "xyes"
1689 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
1690 xmms_config_status=$?
1692 if test $xmms_config_status -ne 0
1697 if test "x$with_libxmms" = "xyes"
1699 AC_CHECK_LIB(xmms, xmms_remote_get_info,
1701 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
1702 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
1703 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
1704 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
1711 with_libxmms_numeric=0
1712 if test "x$with_libxmms" = "xyes"
1714 with_libxmms_numeric=1
1716 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
1717 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
1718 ### END of check for libxmms ###
1720 with_libnetlink_cflags=""
1721 with_libnetlink_libs="-lnetlink"
1722 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
1724 echo "libnetlink: withval = $withval"
1725 if test "x$withval" = "xyes"
1727 with_libnetlink="yes"
1728 else if test "x$withval" = "xno"
1730 with_libnetlink="no"
1732 if test -d "$withval/include"
1734 with_libnetlink_cflags="-I$withval/include"
1735 with_libnetlink_libs="-L$withval/lib -lnetlink"
1736 with_libnetlink="yes"
1738 AC_MSG_ERROR("no such directory: $withval/include")
1743 if test "x$ac_system" = "xLinux"
1745 with_libnetlink="yes"
1747 with_libnetlink="no (Linux only library)"
1750 if test "x$with_libnetlink" = "xyes"
1753 CFLAGS="$CFLAGS $with_libnetlink_cflags"
1755 with_libnetlink="no (libnetlink.h not found)"
1757 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
1759 with_libnetlink="yes"
1763 #include <sys/types.h>
1764 #include <asm/types.h>
1765 #include <sys/socket.h>
1766 #include <linux/netlink.h>
1767 #include <linux/rtnetlink.h>])
1768 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
1770 #include <sys/types.h>
1771 #include <asm/types.h>
1772 #include <sys/socket.h>])
1776 #include <sys/types.h>
1777 #include <asm/types.h>
1778 #include <sys/socket.h>
1779 #include <linux/netlink.h>
1780 #include <linux/rtnetlink.h>
1784 int retval = TCA_STATS2;
1787 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
1792 #include <sys/types.h>
1793 #include <asm/types.h>
1794 #include <sys/socket.h>
1795 #include <linux/netlink.h>
1796 #include <linux/rtnetlink.h>
1800 int retval = TCA_STATS;
1803 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
1806 CFLAGS="$SAVE_CFLAGS"
1808 if test "x$with_libnetlink" = "xyes"
1810 AC_CHECK_LIB(netlink, rtnl_open,
1811 [with_libnetlink="yes"],
1812 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
1813 [$with_libnetlink_libs])
1815 if test "x$with_libnetlink" = "xyes"
1817 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
1818 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
1819 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
1820 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
1822 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
1824 # Check for enabled/disabled features
1827 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
1828 # ------------------------------------------------------------
1830 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
1835 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
1840 m4_define([EnDis],[disabled])dnl
1841 m4_define([YesNo],[no])dnl
1847 m4_define([EnDis],[enabled])dnl
1848 m4_define([YesNo],[yes])dnl
1851 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
1855 m4_if([$3], [feature], [],
1859 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
1865 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
1867 enable_$1='[YesNo]'dnl
1869 if test "x$enable_$1" = "xno"
1873 if test "x$enable_$1" = "xyes"
1877 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
1882 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
1883 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
1885 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
1887 # AC_PLUGIN(name, default, info)
1888 # ------------------------------------------------------------
1894 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
1896 if test "x$enableval" = "xyes"
1904 if test "x$2" = "xyes"
1911 if test "x$enable_plugin" = "xyes"
1913 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
1915 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
1916 enable_$1="$enable_plugin"
1918 )# AC_PLUGIN(name, default, info)
1920 m4_divert_once([HELP_ENABLE], [
1921 collectd features:])
1922 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
1923 AC_COLLECTD([debug], [enable], [feature], [debugging])
1924 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
1925 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
1933 plugin_interface="no"
1938 plugin_multimeter="no"
1940 plugin_processes="no"
1944 plugin_tcpconns="no"
1947 plugin_wireless="no"
1950 if test "x$ac_system" = "xLinux"
1952 plugin_battery="yes"
1954 plugin_cpufreq="yes"
1956 plugin_entropy="yes"
1957 plugin_interface="yes"
1962 plugin_processes="yes"
1965 plugin_tcpconns="yes"
1966 plugin_vserver="yes"
1967 plugin_wireless="yes"
1969 if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
1976 if test "x$with_libiokit" = "xyes"
1978 plugin_battery="yes"
1983 if test "x$with_devinfo$with_kstat" = "xyesyes"
1987 plugin_interface="yes"
1994 if test "x$with_libstatgrab" = "xyes"
1996 plugin_interface="yes"
2002 if test "x$have_processor_info" = "xyes"
2006 if test "x$have_sysctlbyname" = "xyes"
2010 plugin_tcpconns="yes"
2013 if test "x$have_statfs" = "xyes"
2017 if test "x$have_statvfs" = "xyes"
2022 if test "x$have_getifaddrs" = "xyes"
2024 plugin_interface="yes"
2027 if test "x$have_getloadavg" = "xyes"
2032 # Mac OS X memory interface
2033 if test "x$have_host_statistics" = "xyes"
2038 if test "x$have_termios_h" = "xyes"
2040 plugin_multimeter="yes"
2043 if test "x$have_thread_info" = "xyes"
2045 plugin_processes="yes"
2048 if test "x$with_libkvm" = "xyes"
2053 if test "x$have_getutent" = "xyes"
2057 if test "x$have_getutxent" = "xyes"
2062 # FIXME: sysctl for swap plugin
2064 m4_divert_once([HELP_ENABLE], [
2067 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
2068 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
2069 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
2070 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
2071 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
2072 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
2073 AC_PLUGIN([csv], [yes], [CSV output plugin])
2074 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
2075 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
2076 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
2077 AC_PLUGIN([email], [yes], [EMail statistics])
2078 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
2079 AC_PLUGIN([exec], [yes], [Execution of external programs])
2080 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
2081 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
2082 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
2083 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
2084 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
2085 AC_PLUGIN([load], [$plugin_load], [System load])
2086 AC_PLUGIN([logfile], [yes], [File logging plugin])
2087 AC_PLUGIN([mbmon], [yes], [Query mbmond])
2088 AC_PLUGIN([memcached], [yes], [memcached statistics])
2089 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
2090 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
2091 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
2092 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
2093 AC_PLUGIN([network], [yes], [Network communication plugin])
2094 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
2095 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
2096 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
2097 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
2098 AC_PLUGIN([perl], [$with_libperl], [Embed a Perl interpreter])
2099 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
2100 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
2101 AC_PLUGIN([rrdtool], [$with_rrdtool], [RRDTool output plugin])
2102 AC_PLUGIN([sensors], [$with_lm_sensors], [lm_sensors statistics])
2103 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
2104 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
2105 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
2106 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
2107 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
2108 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
2109 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
2110 AC_PLUGIN([users], [$plugin_users], [User statistics])
2111 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
2112 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
2113 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
2116 if test "x$ac_system" = "xLinux" -a "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
2118 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
2122 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
2124 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2126 PERL_BINDINGS_OPTIONS="$withval"
2127 with_perl_bindings="yes"
2129 PERL_BINDINGS_OPTIONS=""
2130 with_perl_bindings="$withval"
2134 PERL_BINDINGS_OPTIONS=""
2135 with_perl_bindings="yes"
2137 if test "x$with_perl_bindings" = "xyes"
2139 PERL_BINDINGS="perl"
2143 AC_SUBST(PERL_BINDINGS)
2144 AC_SUBST(PERL_BINDINGS_OPTIONS)
2146 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile bindings/Makefile)
2148 if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
2150 with_liboping="yes (shipped version)"
2153 if test "x$with_libperl" = "xyes"
2155 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
2157 enable_perl="no (needs libperl)"
2160 if test "x$with_perl_bindings" = "xyes" -a "x$PERL_BINDINGS_OPTIONS" != "x"
2162 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
2169 libcurl . . . . . . $with_libcurl
2170 libiokit . . . . . $with_libiokit
2171 libiptc . . . . . . $with_libiptc
2172 libkstat . . . . . $with_kstat
2173 libkvm . . . . . . $with_libkvm
2174 libmysql . . . . . $with_libmysql
2175 libnetlink . . . . $with_libnetlink
2176 libnetsnmp . . . . $with_libnetsnmp
2177 liboconfig . . . . $with_liboconfig
2178 liboping . . . . . $with_liboping
2179 libpcap . . . . . . $with_libpcap
2180 libperl . . . . . . $with_libperl
2181 libpthread . . . . $with_libpthread
2182 librrd . . . . . . $with_rrdtool
2183 libsensors . . . . $with_lm_sensors
2184 libstatgrab . . . . $with_libstatgrab
2185 libupsclient . . . $with_libupsclient
2186 libxmms . . . . . . $with_libxmms
2189 daemon mode . . . . $enable_daemon
2190 debug . . . . . . . $enable_debug
2193 perl . . . . . . . $with_perl_bindings
2196 apache . . . . . . $enable_apache
2197 apcups . . . . . . $enable_apcups
2198 apple_sensors . . . $enable_apple_sensors
2199 battery . . . . . . $enable_battery
2200 cpu . . . . . . . . $enable_cpu
2201 cpufreq . . . . . . $enable_cpufreq
2202 csv . . . . . . . . $enable_csv
2203 df . . . . . . . . $enable_df
2204 disk . . . . . . . $enable_disk
2205 dns . . . . . . . . $enable_dns
2206 email . . . . . . . $enable_email
2207 entropy . . . . . . $enable_entropy
2208 exec . . . . . . . $enable_exec
2209 hddtemp . . . . . . $enable_hddtemp
2210 interface . . . . . $enable_interface
2211 iptables . . . . . $enable_iptables
2212 ipvs . . . . . . . $enable_ipvs
2213 irq . . . . . . . . $enable_irq
2214 load . . . . . . . $enable_load
2215 logfile . . . . . . $enable_logfile
2216 mbmon . . . . . . . $enable_mbmon
2217 memcached . . . . . $enable_memcached
2218 memory . . . . . . $enable_memory
2219 multimeter . . . . $enable_multimeter
2220 mysql . . . . . . . $enable_mysql
2221 netlink . . . . . . $enable_netlink
2222 network . . . . . . $enable_network
2223 nfs . . . . . . . . $enable_nfs
2224 nginx . . . . . . . $enable_nginx
2225 ntpd . . . . . . . $enable_ntpd
2226 nut . . . . . . . . $enable_nut
2227 perl . . . . . . . $enable_perl
2228 ping . . . . . . . $enable_ping
2229 processes . . . . . $enable_processes
2230 rrdtool . . . . . . $enable_rrdtool
2231 sensors . . . . . . $enable_sensors
2232 serial . . . . . . $enable_serial
2233 snmp . . . . . . . $enable_snmp
2234 swap . . . . . . . $enable_swap
2235 syslog . . . . . . $enable_syslog
2236 tape . . . . . . . $enable_tape
2237 tcpconns . . . . . $enable_tcpconns
2238 unixsock . . . . . $enable_unixsock
2239 users . . . . . . . $enable_users
2240 vserver . . . . . . $enable_vserver
2241 wireless . . . . . $enable_wireless
2242 xmms . . . . . . . $enable_xmms