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_CACHE_CHECK([for strtok_r],
376 [have_strtok_r_default],
385 char buffer[] = "foo,bar,baz";
392 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
395 printf ("token = %s;\n", token);
398 [have_strtok_r_default="yes"],
399 [have_strtok_r_default="no"]
403 if test "x$have_strtok_r_default" = "xno"
405 SAVE_CFLAGS="$CFLAGS"
406 CFLAGS="$CFLAGS -D_REENTRANT=1"
408 AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
409 [have_strtok_r_reentrant],
418 char buffer[] = "foo,bar,baz";
425 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
428 printf ("token = %s;\n", token);
431 [have_strtok_r_reentrant="yes"],
432 [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
437 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
439 socket_needs_socket="no"
440 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
441 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
443 nanosleep_needs_rt="no"
444 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
445 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
447 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
448 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
449 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
450 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
451 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
452 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
453 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
454 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
455 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
456 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
459 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
462 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
464 if test "x$withval" = "xno"; then
466 else if test "x$withval" = "xyes"; then
473 if test "x$nan_type" = "xnone"; then
474 AC_CACHE_CHECK([whether NAN is defined by default],
481 static float foo = NAN;
489 [have_nan_default="yes"],
490 [have_nan_default="no"]
493 if test "x$have_nan_default" = "xyes"
498 if test "x$nan_type" = "xnone"; then
499 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
505 #define __USE_ISOC99 1
507 static float foo = NAN;
515 [have_nan_isoc="yes"],
519 if test "x$have_nan_isoc" = "xyes"
524 if test "x$nan_type" = "xnone"; then
525 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
535 #define NAN (0.0 / 0.0)
537 # define isnan(f) ((f) != (f))
539 static float foo = NAN;
547 [have_nan_zero="yes"],
551 if test "x$have_nan_zero" = "xyes"
557 if test "x$nan_type" = "xdefault"; then
558 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
559 [Define if NAN is defined by default and can initialize static variables.])
560 else if test "x$nan_type" = "xisoc99"; then
561 AC_DEFINE(NAN_STATIC_ISOC, 1,
562 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
563 else if test "x$nan_type" = "xzero"; then
564 AC_DEFINE(NAN_ZERO_ZERO, 1,
565 [Define if NAN can be defined as (0.0 / 0.0)])
567 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
570 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
572 if test "x$withval" = "xnothing"; then
573 fp_layout_type="nothing"
574 else if test "x$withval" = "xendianflip"; then
575 fp_layout_type="endianflip"
576 else if test "x$withval" = "xintswap"; then
577 fp_layout_type="intswap"
579 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
582 [fp_layout_type="unknown"])
584 if test "x$fp_layout_type" = "xunknown"; then
585 AC_CACHE_CHECK([if doubles are stored in x86 representation],
586 [fp_layout_need_nothing],
602 memcpy ((void *) &i0, (void *) &d, 8);
605 memcpy ((void *) c, (void *) &i1, 8);
607 if ((c[0] == 0x2f) && (c[1] == 0x25)
608 && (c[2] == 0xc0) && (c[3] == 0xc7)
609 && (c[4] == 0x43) && (c[5] == 0x2b)
610 && (c[6] == 0x1f) && (c[7] == 0x5b))
615 [fp_layout_need_nothing="yes"],
616 [fp_layout_need_nothing="no"]
619 if test "x$fp_layout_need_nothing" = "xyes"; then
620 fp_layout_type="nothing"
623 if test "x$fp_layout_type" = "xunknown"; then
624 AC_CACHE_CHECK([if endianflip converts to x86 representation],
625 [fp_layout_need_endianflip],
633 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
634 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
635 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
636 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
637 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
638 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
639 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
640 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
649 memcpy ((void *) &i0, (void *) &d, 8);
651 i1 = endianflip (i0);
652 memcpy ((void *) c, (void *) &i1, 8);
654 if ((c[0] == 0x2f) && (c[1] == 0x25)
655 && (c[2] == 0xc0) && (c[3] == 0xc7)
656 && (c[4] == 0x43) && (c[5] == 0x2b)
657 && (c[6] == 0x1f) && (c[7] == 0x5b))
662 [fp_layout_need_endianflip="yes"],
663 [fp_layout_need_endianflip="no"]
666 if test "x$fp_layout_need_endianflip" = "xyes"; then
667 fp_layout_type="endianflip"
670 if test "x$fp_layout_type" = "xunknown"; then
671 AC_CACHE_CHECK([if intswap converts to x86 representation],
672 [fp_layout_need_intswap],
680 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
681 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
690 memcpy ((void *) &i0, (void *) &d, 8);
693 memcpy ((void *) c, (void *) &i1, 8);
695 if ((c[0] == 0x2f) && (c[1] == 0x25)
696 && (c[2] == 0xc0) && (c[3] == 0xc7)
697 && (c[4] == 0x43) && (c[5] == 0x2b)
698 && (c[6] == 0x1f) && (c[7] == 0x5b))
703 [fp_layout_need_intswap="yes"],
704 [fp_layout_need_intswap="no"]
707 if test "x$fp_layout_need_intswap" = "xyes"; then
708 fp_layout_type="intswap"
712 if test "x$fp_layout_type" = "xnothing"; then
713 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
714 [Define if doubles are stored in x86 representation.])
715 else if test "x$fp_layout_type" = "xendianflip"; then
716 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
717 [Define if endianflip is needed to convert to x86 representation.])
718 else if test "x$fp_layout_type" = "xintswap"; then
719 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
720 [Define if intswap is needed to convert to x86 representation.])
722 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
726 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
728 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
730 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
733 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
734 if test "x$have_getmntent" = "xno"; then
735 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
737 if test "x$have_getmntent" = "xno"; then
738 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
740 if test "x$have_getmntent" = "xno"; then
741 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
744 if test "x$have_getmntent" = "xc"; then
745 AC_CACHE_CHECK([whether getmntent takes one argument],
746 [have_one_getmntent],
748 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
750 #include "$srcdir/src/utils_mount.h"]],
754 fh = setmntent ("/etc/mtab", "r");
758 [have_one_getmntent="yes"],
759 [have_one_getmntent="no"]
762 AC_CACHE_CHECK([whether getmntent takes two arguments],
763 [have_two_getmntent],
765 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
766 #include <sys/mnttab.h>
767 #include "$srcdir/src/utils_mount.h"]],
772 fh = fopen ("/etc/mnttab", "r");
773 status = getmntent (fh, &mt);
776 [have_two_getmntent="yes"],
777 [have_two_getmntent="no"]
782 # Check for different versions of `getmntent' here..
784 if test "x$have_getmntent" = "xc"; then
785 if test "x$have_one_getmntent" = "xyes"; then
786 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
787 [Define if the function getmntent exists and takes one argument.])
789 if test "x$have_two_getmntent" = "xyes"; then
790 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
791 [Define if the function getmntent exists and takes two arguments.])
794 if test "x$have_getmntent" = "xsun"; then
795 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
796 [Define if the function getmntent exists. It's the version from libsun.])
798 if test "x$have_getmntent" = "xseq"; then
799 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
800 [Define if the function getmntent exists. It's the version from libseq.])
802 if test "x$have_getmntent" = "xgen"; then
803 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
804 [Define if the function getmntent exists. It's the version from libgen.])
807 # Check for structures
808 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
809 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
812 #include <sys/types.h>
813 #include <sys/socket.h>
816 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
817 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
820 #include <sys/types.h>
821 #include <sys/socket.h>
822 #include <linux/if.h>
823 #include <linux/netdevice.h>
826 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
831 # include <sys/types.h>
833 #if HAVE_NETINET_IN_SYSTM_H
834 # include <netinet/in_systm.h>
836 #if HAVE_NETINET_IN_H
837 # include <netinet/in.h>
839 #if HAVE_NETINET_IP_H
840 # include <netinet/ip.h>
842 #if HAVE_NETINET_UDP_H
843 # include <netinet/udp.h>
846 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
851 # include <sys/types.h>
853 #if HAVE_NETINET_IN_SYSTM_H
854 # include <netinet/in_systm.h>
856 #if HAVE_NETINET_IN_H
857 # include <netinet/in.h>
859 #if HAVE_NETINET_IP_H
860 # include <netinet/ip.h>
862 #if HAVE_NETINET_UDP_H
863 # include <netinet/udp.h>
867 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
877 # Checks for libraries begin here
880 AC_CHECK_LIB(resolv, res_search,
882 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
884 [with_libresolv="no"])
885 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
888 m4_divert_once([HELP_WITH], [
889 collectd additional packages:])
891 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
894 librrd_threadsafe="yes"
895 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
896 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
898 librrd_cflags="-I$withval/include"
899 librrd_ldflags="-L$withval/lib"
902 ], [with_rrdtool="yes"])
903 if test "x$with_rrdtool" = "xyes"
905 SAVE_CPPFLAGS="$CPPFLAGS"
906 SAVE_LDFLAGS="$LDFLAGS"
908 CPPFLAGS="$CPPFLAGS $librrd_cflags"
909 LDFLAGS="$LDFLAGS $librrd_ldflags"
911 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
913 CPPFLAGS="$SAVE_CPPFLAGS"
914 LDFLAGS="$SAVE_LDFLAGS"
916 if test "x$with_rrdtool" = "xyes"
918 SAVE_CPPFLAGS="$CPPFLAGS"
919 SAVE_LDFLAGS="$LDFLAGS"
921 CPPFLAGS="$CPPFLAGS $librrd_cflags"
922 LDFLAGS="$LDFLAGS $librrd_ldflags"
924 AC_CHECK_LIB(rrd_th, rrd_update_r,
926 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
928 [librrd_threadsafe="no"
929 AC_CHECK_LIB(rrd, rrd_update,
931 librrd_ldflags="$librrd_ldflags -lrrd -lm"
933 [with_rrdtool="no (symbol 'rrd_update' not found)"],
938 CPPFLAGS="$SAVE_CPPFLAGS"
939 LDFLAGS="$SAVE_LDFLAGS"
941 if test "x$with_rrdtool" = "xyes"
943 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
944 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
945 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
946 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
948 if test "x$librrd_threadsafe" = "xyes"
950 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
953 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
954 [ if test "x$withval" != "xno" \
955 && test "x$withval" != "xyes"
957 LDFLAGS="$LDFLAGS -L$withval/lib"
958 CPPFLAGS="$CPPFLAGS -I$withval/include"
959 with_libpthread="yes"
961 if test "x$withval" = "xno"
963 with_libpthread="no (disabled)"
966 ], [with_libpthread="yes"])
967 if test "x$with_libpthread" = "xyes"
969 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
971 if test "x$with_libpthread" = "xyes"
973 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
975 if test "x$with_libpthread" = "xyes"
981 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
982 [Wether or not to use pthread (POSIX threads) library])
983 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
985 if test "x$ac_system" = "xSolaris"
990 with_kstat="no (Solaris only)"
991 with_devinfo="no (Solaris only)"
994 if test "x$with_kstat" = "xyes"
996 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
998 if test "x$with_kstat" = "xyes"
1000 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1001 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1003 if test "x$with_kstat" = "xyes"
1005 AC_DEFINE(HAVE_LIBKSTAT, 1,
1006 [Define to 1 if you have the 'kstat' library (-lkstat)])
1008 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1009 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1011 ### BEGIN of check for libcurl ###
1012 with_curl_config="curl-config"
1015 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1017 if test "x$withval" = "xno"
1020 else if test "x$withval" = "xyes"
1024 if test -f "$withval" && test -x "$withval"
1026 with_curl_config="$withval"
1028 else if test -x "$withval/bin/curl-config"
1030 with_curl_config="$withval/bin/curl-config"
1039 if test "x$with_libcurl" = "xyes"
1041 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1042 curl_config_status=$?
1044 if test $curl_config_status -ne 0
1046 with_libcurl="no ($with_curl_config failed)"
1048 SAVE_CPPFLAGS="$CPPFLAGS"
1049 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1051 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1053 CPPFLAGS="$SAVE_CPPFLAGS"
1056 if test "x$with_libcurl" = "xyes"
1058 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1059 curl_config_status=$?
1061 if test $curl_config_status -ne 0
1063 with_libcurl="no ($with_curl_config failed)"
1065 AC_CHECK_LIB(curl, curl_easy_init,
1066 [with_libcurl="yes"],
1067 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1071 if test "x$with_libcurl" = "xyes"
1073 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1074 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1075 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1076 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1078 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1079 ### END of check for libcurl ###
1082 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1089 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1091 with_libstatgrab_cflags=""
1092 with_libstatgrab_ldflags=""
1093 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
1095 if test "x$withval" != "xno" \
1096 && test "x$withval" != "xyes"
1098 with_libstatgrab_cflags="-I$withval/include"
1099 with_libstatgrab_ldflags="-L$withval/lib"
1100 with_libstatgrab="yes"
1104 if test "x$ac_system" = "xunknown"
1106 with_libstatgrab="yes"
1108 with_libstatgrab="no"
1111 with_libstatgrab_pkg_config="yes"
1112 if test "x$with_libstatgrab" = "xyes" \
1113 && test "x$PKG_CONFIG" != "x"
1115 AC_MSG_CHECKING([pkg-config for libstatgrab])
1117 $PKG_CONFIG --exists libstatgrab 2>/dev/null
1120 with_libstatgrab_pkg_config="no"
1121 temp_result="not found"
1123 AC_MSG_RESULT([$temp_result])
1125 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
1126 with_libstatgrab_pkg_config="no"
1127 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
1130 if test "x$with_libstatgrab" = "xyes" \
1131 && test "x$with_libstatgrab_pkg_config" = "xyes" \
1132 && test "x$with_libstatgrab_cflags" = "x"
1134 AC_MSG_CHECKING([for libstatgrab CFLAGS])
1135 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
1138 with_libstatgrab_cflags="$temp_result"
1140 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
1141 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
1143 AC_MSG_RESULT([$temp_result])
1146 if test "x$with_libstatgrab" = "xyes" \
1147 && test "x$with_libstatgrab_pkg_config" = "xyes" \
1148 && test "x$with_libstatgrab_ldflags" = "x"
1150 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
1151 temp_result="`$PKG_CONFIG --libs libstatgrab`"
1154 with_libstatgrab_ldflags="$temp_result"
1156 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
1157 temp_result="$PKG_CONFIG --libs libstatgrab failed"
1159 AC_MSG_RESULT([$temp_result])
1162 if test "x$with_libstatgrab" = "xyes"
1164 SAVE_CPPFLAGS="$CPPFLAGS"
1165 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
1167 AC_CHECK_HEADERS(statgrab.h,
1168 [with_libstatgrab="yes"],
1169 [with_libstatgrab="no (statgrab.h not found)"])
1171 CPPFLAGS="$SAVE_CPPFLAGS"
1174 if test "x$with_libstatgrab" = "xyes"
1176 SAVE_CFLAGS="$CFLAGS"
1177 SAVE_LDFLAGS="$LDFLAGS"
1179 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
1180 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
1182 AC_CHECK_LIB(statgrab, sg_init,
1183 [with_libstatgrab="yes"],
1184 [with_libstatgrab="no (symbol sg_init not found)"])
1186 CFLAGS="$SAVE_CFLAGS"
1187 LDFLAGS="$SAVE_LDFLAGS"
1190 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
1191 if test "x$with_libstatgrab" = "xyes"
1193 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
1194 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
1195 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
1196 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
1197 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
1200 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
1201 if test "x$with_libkvm" = "xyes"
1203 AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
1205 AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
1207 with_sensors_cflags=""
1208 with_sensors_ldflags=""
1209 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
1211 if test "x$withval" = "xno"
1213 with_lm_sensors="no"
1215 with_lm_sensors="yes"
1216 if test "x$withval" != "xyes"
1218 with_sensors_cflags="-I$withval/include"
1219 with_sensors_ldflags="-L$withval/lib"
1220 with_lm_sensors="yes"
1225 if test "x$ac_system" = "xLinux"
1227 with_lm_sensors="yes"
1229 with_lm_sensors="no (Linux only library)"
1232 if test "x$with_lm_sensors" = "xyes"
1234 SAVE_CPPFLAGS="$CPPFLAGS"
1235 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
1237 # AC_CHECK_HEADERS(sensors/sensors.h,
1239 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
1241 # [with_lm_sensors="no (sensors/sensors.h not found)"])
1242 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_lm_sensors="no (sensors/sensors.h not found)"])
1244 CPPFLAGS="$SAVE_CPPFLAGS"
1246 if test "x$with_lm_sensors" = "xyes"
1248 SAVE_CPPFLAGS="$CPPFLAGS"
1249 SAVE_LDFLAGS="$LDFLAGS"
1250 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
1251 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
1253 AC_CHECK_LIB(sensors, sensors_init,
1255 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
1257 [with_lm_sensors="no (libsensors not found)"])
1259 CPPFLAGS="$SAVE_CPPFLAGS"
1260 LDFLAGS="$SAVE_LDFLAGS"
1262 if test "x$with_lm_sensors" = "xyes"
1264 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
1265 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
1266 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
1267 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
1269 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
1271 with_mysql_config="mysql_config"
1272 with_mysql_cflags=""
1274 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1276 if test "x$withval" = "xno"
1279 else if test "x$withval" = "xyes"
1283 if test -f "$withval" && test -x "$withval";
1285 with_mysql_config="$withval"
1286 else if test -x "$withval/bin/mysql_config"
1288 with_mysql_config="$withval/bin/mysql_config"
1296 if test "x$with_libmysql" = "xyes"
1298 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1299 mysql_config_status=$?
1301 if test $mysql_config_status -ne 0
1305 SAVE_CPPFLAGS="$CPPFLAGS"
1306 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
1308 AC_CHECK_HEADERS(mysql/mysql.h, [], [with_libmysql="no (mysql/mysql.h not found)"], [])
1310 CPPFLAGS="$SAVE_CPPFLAGS"
1313 if test "x$with_libmysql" = "xyes"
1315 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
1316 mysql_config_status=$?
1318 if test $mysql_config_status -ne 0
1322 AC_CHECK_LIB(mysqlclient, mysql_init,
1323 [with_libmysql="yes"],
1324 [with_libmysql="no (symbol 'mysql_init' not found)"],
1328 if test "x$with_libmysql" = "xyes"
1330 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
1331 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
1332 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
1333 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
1335 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
1337 with_own_liboconfig="no"
1338 liboconfig_LDFLAGS="$LDFLAGS"
1339 liboconfig_CPPFLAGS="$CPPFLAGS"
1340 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1342 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1344 if test -d "$withval/lib"
1346 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1348 if test -d "$withval/include"
1350 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1353 if test "x$withval" = "xno"
1355 AC_MSG_ERROR("liboconfig is required")
1359 with_liboconfig="yes"
1362 save_LDFLAGS="$LDFLAGS"
1363 save_CPPFLAGS="$CPPFLAGS"
1364 LDFLAGS="$liboconfig_LDFLAGS"
1365 CPPFLAGS="$liboconfig_CPPFLAGS"
1366 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1368 with_liboconfig="yes"
1369 with_own_liboconfig="no"
1372 with_liboconfig="yes"
1373 with_own_liboconfig="yes"
1374 LDFLAGS="$save_LDFLAGS"
1375 CPPFLAGS="$save_CPPFLAGS"
1378 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1379 if test "x$with_own_liboconfig" = "xyes"
1381 with_liboconfig="yes (shipped version)"
1384 #with_liboping="yes"
1385 with_own_liboping="no"
1386 liboping_LDFLAGS="$LDFLAGS"
1387 liboping_CPPFLAGS="$CPPFLAGS"
1388 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1390 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1392 if test -d "$withval/lib"
1394 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
1396 if test -d "$withval/include"
1398 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
1401 if test "x$withval" = "xno"
1404 with_own_liboping="no"
1412 if test "x$with_liboping" = "xyes"
1414 save_LDFLAGS="$LDFLAGS"
1415 save_CPPFLAGS="$CPPFLAGS"
1416 LDFLAGS="$liboping_LDFLAGS"
1417 CPPFLAGS="$liboping_CPPFLAGS"
1418 AC_CHECK_LIB(oping, ping_construct,
1421 with_own_liboping="no"
1425 with_own_liboping="yes"
1426 LDFLAGS="$save_LDFLAGS"
1427 CPPFLAGS="$save_CPPFLAGS"
1430 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1431 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1433 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1435 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1437 LDFLAGS="$LDFLAGS -L$withval/lib"
1438 CPPFLAGS="$CPPFLAGS -I$withval/include"
1445 if test "x$with_libpcap" = "xyes"
1447 AC_CHECK_LIB(pcap, pcap_open_live,
1449 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1450 ], [with_libpcap="no (libpcap not found)"])
1452 if test "x$with_libpcap" = "xyes"
1454 AC_CHECK_HEADERS(pcap.h,
1456 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1457 ], [with_libpcap="no (pcap.h not found)"])
1459 if test "x$with_libpcap" = "xyes"
1465 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1466 [Wether or not to use the pcap library])
1467 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1469 perl_interpreter="perl"
1470 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1472 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1474 LDFLAGS="$LDFLAGS -L$withval/lib"
1475 CPPFLAGS="$CPPFLAGS -I$withval/include"
1476 perl_interpreter="$withval/bin/perl"
1484 AC_MSG_CHECKING([for perl])
1485 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
1486 if test -x "$perl_interpreter"
1488 AC_MSG_RESULT([yes])
1494 AC_SUBST(PERL, "$perl_interpreter")
1496 if test "x$with_libperl" = "xyes" \
1497 && test -n "$perl_interpreter"
1500 SAVE_LDFLAGS=$LDFLAGS
1501 PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
1502 PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
1503 CFLAGS="$CFLAGS $PERL_CFLAGS"
1504 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1506 AC_CACHE_CHECK([for libperl],
1516 PerlInterpreter *perl = NULL;
1517 Perl_load_module (perl, PERL_LOADMOD_NOIMPORT,
1518 newSVpv ("Collectd::Plugin::FooBar", 24),
1521 [have_libperl="yes"],
1526 if test "x$have_libperl" = "xyes"
1528 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
1529 AC_SUBST(PERL_CFLAGS)
1530 AC_SUBST(PERL_LDFLAGS)
1536 LDFLAGS=$SAVE_LDFLAGS
1537 else if test -z "$perl_interpreter"; then
1538 with_libperl="no (no perl interpreter found)"
1541 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1543 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1545 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1547 LDFLAGS="$LDFLAGS -L$withval/lib"
1548 CPPFLAGS="$CPPFLAGS -I$withval/include"
1553 if test "x$ac_system" = "xLinux"
1557 with_libiptc="no (Linux only)"
1560 if test "x$with_libiptc" = "xyes"
1562 AC_CHECK_LIB(iptc, iptc_init,
1564 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1565 ], [with_libiptc="no (libiptc not found)"])
1567 if test "x$with_libiptc" = "xyes"
1569 AC_CHECK_HEADERS(libiptc/libiptc.h,
1571 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1572 ], [with_libiptc="no (libiptc/libiptc.h not found)"])
1574 if test "x$with_libiptc" = "xyes"
1580 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1582 with_snmp_config="net-snmp-config"
1585 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1587 if test "x$withval" = "xno"
1589 with_libnetsnmp="no"
1590 else if test "x$withval" = "xyes"
1592 with_libnetsnmp="yes"
1594 if test -x "$withval"
1596 with_snmp_config="$withval"
1597 with_libnetsnmp="yes"
1599 with_snmp_config="$withval/bin/net-snmp-config"
1600 with_libnetsnmp="yes"
1604 [with_libnetsnmp="yes"])
1605 if test "x$with_libnetsnmp" = "xyes"
1607 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
1608 snmp_config_status=$?
1610 if test $snmp_config_status -ne 0
1612 with_libnetsnmp="no ($with_snmp_config failed)"
1614 SAVE_CPPFLAGS="$CPPFLAGS"
1615 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
1617 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1619 CPPFLAGS="$SAVE_CPPFLAGS"
1622 if test "x$with_libnetsnmp" = "xyes"
1624 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
1625 snmp_config_status=$?
1627 if test $snmp_config_status -ne 0
1629 with_libnetsnmp="no ($with_snmp_config failed)"
1631 AC_CHECK_LIB(netsnmp, init_snmp,
1632 [with_libnetsnmp="yes"],
1633 [with_libnetsnmp="no (libnetsnmp not found)"],
1637 if test "x$with_libnetsnmp" = "xyes"
1639 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
1640 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
1641 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
1642 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
1644 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1646 with_upsclient_config="libupsclient-config"
1647 with_upsclient_cflags=""
1648 with_upsclient_libs=""
1649 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])],
1651 if test "x$withval" = "xno"
1653 with_libupsclient="no"
1655 if test "x$withval" != "xyes"
1657 if test -f "$withval" && test -x "$withval";
1659 with_upsclient_config="$withval"
1661 with_upsclient_config="$withval/bin/libupsclient-config"
1664 with_libupsclient="yes"
1668 with_libupsclient="yes"
1670 if test "x$with_libupsclient" = "xyes"
1672 with_upsclient_cflags=`$with_upsclient_config --cflags 2>/dev/null`
1673 upsclient_config_status=$?
1675 if test $upsclient_config_status -ne 0
1677 with_libupsclient="no ($with_upsclient_config failed)"
1680 if test "x$with_libupsclient" = "xyes"
1682 SAVE_CPPFLAGS="$CPPFLAGS"
1683 CPPFLAGS="$CPPFLAGS $with_upsclient_cflags"
1685 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
1687 CPPFLAGS="$SAVE_CPPFLAGS"
1689 if test "x$with_libupsclient" = "xyes"
1691 with_upsclient_libs=`$with_upsclient_config --libs 2>/dev/null`
1692 upsclient_config_status=$?
1694 if test $upsclient_config_status -ne 0
1696 with_libupsclient="no ($with_upsclient_config failed)"
1699 if test "x$with_libupsclient" = "xyes"
1701 AC_CHECK_LIB(upsclient, upscli_connect,
1703 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_upsclient_cflags"
1704 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_upsclient_libs"
1705 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
1706 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
1709 with_libupsclient="no (symbol 'upscli_connect' not found)"
1710 ], [$with_upsclient_libs])
1712 if test "x$with_libupsclient" = "xyes"
1714 SAVE_CPPFLAGS="$CPPFLAGS"
1715 CPPFLAGS="$CPPFLAGS $with_upsclient_cflags"
1717 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
1718 [#include <stdlib.h>
1720 #include <upsclient.h>])
1722 CPPFLAGS="$SAVE_CPPFLAGS"
1724 AM_CONDITIONAL(BUILD_WITH_LIBUPSCLIENT, test "x$with_libupsclient" = "xyes")
1726 ### BEGIN of check for libxmms ###
1727 with_xmms_config="xmms-config"
1730 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
1732 if test "x$withval" != "xno" \
1733 && test "x$withval" != "xyes"
1735 if test -f "$withval" && test -x "$withval";
1737 with_xmms_config="$withval"
1738 else if test -x "$withval/bin/xmms-config"
1740 with_xmms_config="$withval/bin/xmms-config"
1743 else if test "x$withval" = "xno"
1753 if test "x$with_libxmms" = "xyes"
1755 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
1756 xmms_config_status=$?
1758 if test $xmms_config_status -ne 0
1763 if test "x$with_libxmms" = "xyes"
1765 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
1766 xmms_config_status=$?
1768 if test $xmms_config_status -ne 0
1773 if test "x$with_libxmms" = "xyes"
1775 AC_CHECK_LIB(xmms, xmms_remote_get_info,
1777 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
1778 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
1779 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
1780 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
1787 with_libxmms_numeric=0
1788 if test "x$with_libxmms" = "xyes"
1790 with_libxmms_numeric=1
1792 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
1793 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
1794 ### END of check for libxmms ###
1796 with_libnetlink_cflags=""
1797 with_libnetlink_libs="-lnetlink"
1798 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
1800 echo "libnetlink: withval = $withval"
1801 if test "x$withval" = "xyes"
1803 with_libnetlink="yes"
1804 else if test "x$withval" = "xno"
1806 with_libnetlink="no"
1808 if test -d "$withval/include"
1810 with_libnetlink_cflags="-I$withval/include"
1811 with_libnetlink_libs="-L$withval/lib -lnetlink"
1812 with_libnetlink="yes"
1814 AC_MSG_ERROR("no such directory: $withval/include")
1819 if test "x$ac_system" = "xLinux"
1821 with_libnetlink="yes"
1823 with_libnetlink="no (Linux only library)"
1826 if test "x$with_libnetlink" = "xyes"
1829 CFLAGS="$CFLAGS $with_libnetlink_cflags"
1831 with_libnetlink="no (libnetlink.h not found)"
1833 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
1835 with_libnetlink="yes"
1839 #include <sys/types.h>
1840 #include <asm/types.h>
1841 #include <sys/socket.h>
1842 #include <linux/netlink.h>
1843 #include <linux/rtnetlink.h>])
1844 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
1846 #include <sys/types.h>
1847 #include <asm/types.h>
1848 #include <sys/socket.h>])
1852 #include <sys/types.h>
1853 #include <asm/types.h>
1854 #include <sys/socket.h>
1855 #include <linux/netlink.h>
1856 #include <linux/rtnetlink.h>
1860 int retval = TCA_STATS2;
1863 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
1868 #include <sys/types.h>
1869 #include <asm/types.h>
1870 #include <sys/socket.h>
1871 #include <linux/netlink.h>
1872 #include <linux/rtnetlink.h>
1876 int retval = TCA_STATS;
1879 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
1882 CFLAGS="$SAVE_CFLAGS"
1884 if test "x$with_libnetlink" = "xyes"
1886 AC_CHECK_LIB(netlink, rtnl_open,
1887 [with_libnetlink="yes"],
1888 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
1889 [$with_libnetlink_libs])
1891 if test "x$with_libnetlink" = "xyes"
1893 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
1894 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
1895 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
1896 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
1898 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
1900 # Check for enabled/disabled features
1903 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
1904 # ------------------------------------------------------------
1906 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
1911 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
1916 m4_define([EnDis],[disabled])dnl
1917 m4_define([YesNo],[no])dnl
1923 m4_define([EnDis],[enabled])dnl
1924 m4_define([YesNo],[yes])dnl
1927 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
1931 m4_if([$3], [feature], [],
1935 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
1941 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
1943 enable_$1='[YesNo]'dnl
1945 if test "x$enable_$1" = "xno"
1949 if test "x$enable_$1" = "xyes"
1953 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
1958 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
1959 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
1961 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
1963 # AC_PLUGIN(name, default, info)
1964 # ------------------------------------------------------------
1970 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
1972 if test "x$enableval" = "xyes"
1980 if test "x$2" = "xyes"
1987 if test "x$enable_plugin" = "xyes"
1989 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
1991 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
1992 enable_$1="$enable_plugin"
1994 )# AC_PLUGIN(name, default, info)
1996 m4_divert_once([HELP_ENABLE], [
1997 collectd features:])
1998 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
1999 AC_COLLECTD([debug], [enable], [feature], [debugging])
2000 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
2001 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
2009 plugin_interface="no"
2014 plugin_multimeter="no"
2016 plugin_processes="no"
2020 plugin_tcpconns="no"
2023 plugin_wireless="no"
2026 if test "x$ac_system" = "xLinux"
2028 plugin_battery="yes"
2030 plugin_cpufreq="yes"
2032 plugin_entropy="yes"
2033 plugin_interface="yes"
2038 plugin_processes="yes"
2041 plugin_tcpconns="yes"
2042 plugin_vserver="yes"
2043 plugin_wireless="yes"
2045 if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
2052 if test "x$with_libiokit" = "xyes"
2054 plugin_battery="yes"
2059 if test "x$with_devinfo$with_kstat" = "xyesyes"
2063 plugin_interface="yes"
2070 if test "x$with_libstatgrab" = "xyes"
2072 plugin_interface="yes"
2078 if test "x$have_processor_info" = "xyes"
2082 if test "x$have_sysctlbyname" = "xyes"
2086 plugin_tcpconns="yes"
2089 if test "x$have_statfs" = "xyes"
2093 if test "x$have_statvfs" = "xyes"
2098 if test "x$have_getifaddrs" = "xyes"
2100 plugin_interface="yes"
2103 if test "x$have_getloadavg" = "xyes"
2108 # Mac OS X memory interface
2109 if test "x$have_host_statistics" = "xyes"
2114 if test "x$have_termios_h" = "xyes"
2116 plugin_multimeter="yes"
2119 if test "x$have_thread_info" = "xyes"
2121 plugin_processes="yes"
2124 if test "x$with_libkvm" = "xyes"
2129 if test "x$have_getutent" = "xyes"
2133 if test "x$have_getutxent" = "xyes"
2138 # FIXME: sysctl for swap plugin
2140 m4_divert_once([HELP_ENABLE], [
2143 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
2144 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
2145 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
2146 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
2147 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
2148 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
2149 AC_PLUGIN([csv], [yes], [CSV output plugin])
2150 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
2151 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
2152 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
2153 AC_PLUGIN([email], [yes], [EMail statistics])
2154 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
2155 AC_PLUGIN([exec], [yes], [Execution of external programs])
2156 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
2157 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
2158 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
2159 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
2160 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
2161 AC_PLUGIN([load], [$plugin_load], [System load])
2162 AC_PLUGIN([logfile], [yes], [File logging plugin])
2163 AC_PLUGIN([mbmon], [yes], [Query mbmond])
2164 AC_PLUGIN([memcached], [yes], [memcached statistics])
2165 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
2166 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
2167 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
2168 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
2169 AC_PLUGIN([network], [yes], [Network communication plugin])
2170 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
2171 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
2172 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
2173 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
2174 AC_PLUGIN([perl], [$with_libperl], [Embed a Perl interpreter])
2175 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
2176 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
2177 AC_PLUGIN([rrdtool], [$with_rrdtool], [RRDTool output plugin])
2178 AC_PLUGIN([sensors], [$with_lm_sensors], [lm_sensors statistics])
2179 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
2180 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
2181 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
2182 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
2183 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
2184 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
2185 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
2186 AC_PLUGIN([users], [$plugin_users], [User statistics])
2187 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
2188 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
2189 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
2192 if test "x$ac_system" = "xLinux" \
2193 && test "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
2195 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
2199 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
2201 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2203 PERL_BINDINGS_OPTIONS="$withval"
2204 with_perl_bindings="yes"
2206 PERL_BINDINGS_OPTIONS=""
2207 with_perl_bindings="$withval"
2211 PERL_BINDINGS_OPTIONS=""
2212 if test -n "$perl_interpreter"
2214 with_perl_bindings="yes"
2216 with_perl_bindings="no (no perl interpreter found)"
2219 if test "x$with_perl_bindings" = "xyes"
2221 PERL_BINDINGS="perl"
2225 AC_SUBST(PERL_BINDINGS)
2226 AC_SUBST(PERL_BINDINGS_OPTIONS)
2228 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile bindings/Makefile)
2230 if test "x$with_liboping" = "xyes" \
2231 && test "x$with_own_liboping" = "xyes"
2233 with_liboping="yes (shipped version)"
2236 if test "x$with_libperl" = "xyes"
2238 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
2240 enable_perl="no (needs libperl)"
2243 if test "x$with_perl_bindings" = "xyes" \
2244 && test "x$PERL_BINDINGS_OPTIONS" != "x"
2246 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
2253 libcurl . . . . . . $with_libcurl
2254 libiokit . . . . . $with_libiokit
2255 libiptc . . . . . . $with_libiptc
2256 libkstat . . . . . $with_kstat
2257 libkvm . . . . . . $with_libkvm
2258 libmysql . . . . . $with_libmysql
2259 libnetlink . . . . $with_libnetlink
2260 libnetsnmp . . . . $with_libnetsnmp
2261 liboconfig . . . . $with_liboconfig
2262 liboping . . . . . $with_liboping
2263 libpcap . . . . . . $with_libpcap
2264 libperl . . . . . . $with_libperl
2265 libpthread . . . . $with_libpthread
2266 librrd . . . . . . $with_rrdtool
2267 libsensors . . . . $with_lm_sensors
2268 libstatgrab . . . . $with_libstatgrab
2269 libupsclient . . . $with_libupsclient
2270 libxmms . . . . . . $with_libxmms
2273 daemon mode . . . . $enable_daemon
2274 debug . . . . . . . $enable_debug
2277 perl . . . . . . . $with_perl_bindings
2280 apache . . . . . . $enable_apache
2281 apcups . . . . . . $enable_apcups
2282 apple_sensors . . . $enable_apple_sensors
2283 battery . . . . . . $enable_battery
2284 cpu . . . . . . . . $enable_cpu
2285 cpufreq . . . . . . $enable_cpufreq
2286 csv . . . . . . . . $enable_csv
2287 df . . . . . . . . $enable_df
2288 disk . . . . . . . $enable_disk
2289 dns . . . . . . . . $enable_dns
2290 email . . . . . . . $enable_email
2291 entropy . . . . . . $enable_entropy
2292 exec . . . . . . . $enable_exec
2293 hddtemp . . . . . . $enable_hddtemp
2294 interface . . . . . $enable_interface
2295 iptables . . . . . $enable_iptables
2296 ipvs . . . . . . . $enable_ipvs
2297 irq . . . . . . . . $enable_irq
2298 load . . . . . . . $enable_load
2299 logfile . . . . . . $enable_logfile
2300 mbmon . . . . . . . $enable_mbmon
2301 memcached . . . . . $enable_memcached
2302 memory . . . . . . $enable_memory
2303 multimeter . . . . $enable_multimeter
2304 mysql . . . . . . . $enable_mysql
2305 netlink . . . . . . $enable_netlink
2306 network . . . . . . $enable_network
2307 nfs . . . . . . . . $enable_nfs
2308 nginx . . . . . . . $enable_nginx
2309 ntpd . . . . . . . $enable_ntpd
2310 nut . . . . . . . . $enable_nut
2311 perl . . . . . . . $enable_perl
2312 ping . . . . . . . $enable_ping
2313 processes . . . . . $enable_processes
2314 rrdtool . . . . . . $enable_rrdtool
2315 sensors . . . . . . $enable_sensors
2316 serial . . . . . . $enable_serial
2317 snmp . . . . . . . $enable_snmp
2318 swap . . . . . . . $enable_swap
2319 syslog . . . . . . $enable_syslog
2320 tape . . . . . . . $enable_tape
2321 tcpconns . . . . . $enable_tcpconns
2322 unixsock . . . . . $enable_unixsock
2323 users . . . . . . . $enable_users
2324 vserver . . . . . . $enable_vserver
2325 wireless . . . . . $enable_wireless
2326 xmms . . . . . . . $enable_xmms