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
31 AC_CONFIG_SUBDIRS(libltdl)
33 AC_MSG_CHECKING([for kernel type ($host_os)])
36 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
40 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
49 AC_MSG_RESULT([$ac_system])
52 # Checks for header files.
58 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)
61 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
66 # include <sys/types.h>
69 AC_CHECK_HEADERS(netinet/in.h, [], [],
74 # include <sys/types.h>
76 #if HAVE_NETINET_IN_SYSTM_H
77 # include <netinet/in_systm.h>
80 AC_CHECK_HEADERS(netinet/ip.h, [], [],
85 # include <sys/types.h>
87 #if HAVE_NETINET_IN_SYSTM_H
88 # include <netinet/in_systm.h>
91 # include <netinet/in.h>
94 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
99 # include <sys/types.h>
101 #if HAVE_NETINET_IN_SYSTM_H
102 # include <netinet/in_systm.h>
104 #if HAVE_NETINET_IN_H
105 # include <netinet/in.h>
107 #if HAVE_NETINET_IP_H
108 # include <netinet/ip.h>
111 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
116 # include <sys/types.h>
118 #if HAVE_NETINET_IN_SYSTM_H
119 # include <netinet/in_systm.h>
121 #if HAVE_NETINET_IN_H
122 # include <netinet/in.h>
124 #if HAVE_NETINET_IP_H
125 # include <netinet/ip.h>
128 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
133 # include <sys/types.h>
135 #if HAVE_NETINET_IN_SYSTM_H
136 # include <netinet/in_systm.h>
138 #if HAVE_NETINET_IN_H
139 # include <netinet/in.h>
142 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
147 # include <sys/types.h>
149 #if HAVE_NETINET_IN_SYSTM_H
150 # include <netinet/in_systm.h>
152 #if HAVE_NETINET_IN_H
153 # include <netinet/in.h>
155 #if HAVE_NETINET_IP6_H
156 # include <netinet/ip6.h>
159 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
164 # include <sys/types.h>
166 #if HAVE_NETINET_IN_SYSTM_H
167 # include <netinet/in_systm.h>
169 #if HAVE_NETINET_IN_H
170 # include <netinet/in.h>
172 #if HAVE_NETINET_IP_H
173 # include <netinet/ip.h>
176 AC_CHECK_HEADERS(netinet/udp.h, [], [],
181 # include <sys/types.h>
183 #if HAVE_NETINET_IN_SYSTM_H
184 # include <netinet/in_systm.h>
186 #if HAVE_NETINET_IN_H
187 # include <netinet/in.h>
189 #if HAVE_NETINET_IP_H
190 # include <netinet/ip.h>
195 AC_CHECK_HEADERS(sys/dkstat.h)
196 if test "x$ac_system" = "xDarwin"
198 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)
199 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
201 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
204 # include <sys/types.h>
207 # include <sys/param.h>
212 AC_CHECK_HEADERS(linux/major.h libgen.h)
214 # For the battery plugin
215 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
217 #if HAVE_IOKIT_IOKITLIB_H
218 # include <IOKit/IOKitLib.h>
220 #if HAVE_IOKIT_IOTYPES_H
221 # include <IOKit/IOTypes.h>
225 # For the swap module
226 AC_CHECK_HEADERS(sys/swap.h, [], [],
229 # include <sys/types.h>
232 # include <sys/param.h>
237 # For the processes plugin
239 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
241 # For interface plugin
242 AC_CHECK_HEADERS(ifaddrs.h)
243 AC_CHECK_HEADERS(net/if.h, [], [],
246 # include <sys/types.h>
248 #if HAVE_SYS_SOCKET_H
249 # include <sys/socket.h>
252 AC_CHECK_HEADERS(linux/if.h, [], [],
255 # include <sys/types.h>
257 #if HAVE_SYS_SOCKET_H
258 # include <sys/socket.h>
261 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
264 # include <sys/types.h>
266 #if HAVE_SYS_SOCKET_H
267 # include <sys/socket.h>
270 # include <linux/if.h>
275 have_net_ip_vs_h="no"
277 if test "x$ac_system" = "xLinux"
279 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
280 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
284 AC_CHECK_HEADERS(sys/ucred.h, [], [],
287 # include <sys/types.h>
290 # include <sys/param.h>
294 # For mount interface
295 AC_CHECK_HEADERS(sys/mount.h, [], [],
298 # include <sys/types.h>
301 # include <sys/param.h>
305 # For the email plugin
306 AC_CHECK_HEADERS(linux/un.h, [], [],
308 #if HAVE_SYS_SOCKET_H
309 # include <sys/socket.h>
313 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)
316 AC_CHECK_HEADERS(arpa/nameser.h)
317 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
319 #if HAVE_ARPA_NAMESER_H
320 # include <arpa/nameser.h>
324 AC_CHECK_HEADERS(net/if_arp.h, [], [],
325 [#if HAVE_SYS_SOCKET_H
326 # include <sys/socket.h>
329 AC_CHECK_HEADERS(net/ppp_defs.h)
330 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
331 [#if HAVE_NET_PPP_DEFS_H
332 # include <net/ppp_defs.h>
335 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
340 # include <sys/types.h>
342 #if HAVE_SYS_SOCKET_H
343 # include <sys/socket.h>
348 #if HAVE_NETINET_IN_H
349 # include <netinet/in.h>
353 # For the multimeter plugin
355 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
358 # Checks for typedefs, structures, and compiler characteristics.
367 # Checks for library functions.
369 AC_PROG_GCC_TRADITIONAL
370 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog)
374 AC_CACHE_CHECK([for strtok_r],
375 [have_strtok_r_default],
384 char buffer[] = "foo,bar,baz";
391 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
394 printf ("token = %s;\n", token);
397 [have_strtok_r_default="yes"],
398 [have_strtok_r_default="no"]
402 if test "x$have_strtok_r_default" = "xno"
404 SAVE_CFLAGS="$CFLAGS"
405 CFLAGS="$CFLAGS -D_REENTRANT=1"
407 AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
408 [have_strtok_r_reentrant],
417 char buffer[] = "foo,bar,baz";
424 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
427 printf ("token = %s;\n", token);
430 [have_strtok_r_reentrant="yes"],
431 [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
436 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
438 socket_needs_socket="no"
439 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
440 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
442 nanosleep_needs_rt="no"
443 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
444 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
446 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
447 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
448 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
449 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
450 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
451 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
452 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
453 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
454 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
455 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
458 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
461 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
463 if test "x$withval" = "xno"; then
465 else if test "x$withval" = "xyes"; then
472 if test "x$nan_type" = "xnone"; then
473 AC_CACHE_CHECK([whether NAN is defined by default],
480 static float foo = NAN;
488 [have_nan_default="yes"],
489 [have_nan_default="no"]
492 if test "x$have_nan_default" = "xyes"
497 if test "x$nan_type" = "xnone"; then
498 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
504 #define __USE_ISOC99 1
506 static float foo = NAN;
514 [have_nan_isoc="yes"],
518 if test "x$have_nan_isoc" = "xyes"
523 if test "x$nan_type" = "xnone"; then
524 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
534 #define NAN (0.0 / 0.0)
536 # define isnan(f) ((f) != (f))
538 static float foo = NAN;
546 [have_nan_zero="yes"],
550 if test "x$have_nan_zero" = "xyes"
556 if test "x$nan_type" = "xdefault"; then
557 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
558 [Define if NAN is defined by default and can initialize static variables.])
559 else if test "x$nan_type" = "xisoc99"; then
560 AC_DEFINE(NAN_STATIC_ISOC, 1,
561 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
562 else if test "x$nan_type" = "xzero"; then
563 AC_DEFINE(NAN_ZERO_ZERO, 1,
564 [Define if NAN can be defined as (0.0 / 0.0)])
566 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
569 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
571 if test "x$withval" = "xnothing"; then
572 fp_layout_type="nothing"
573 else if test "x$withval" = "xendianflip"; then
574 fp_layout_type="endianflip"
575 else if test "x$withval" = "xintswap"; then
576 fp_layout_type="intswap"
578 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
581 [fp_layout_type="unknown"])
583 if test "x$fp_layout_type" = "xunknown"; then
584 AC_CACHE_CHECK([if doubles are stored in x86 representation],
585 [fp_layout_need_nothing],
601 memcpy ((void *) &i0, (void *) &d, 8);
604 memcpy ((void *) c, (void *) &i1, 8);
606 if ((c[0] == 0x2f) && (c[1] == 0x25)
607 && (c[2] == 0xc0) && (c[3] == 0xc7)
608 && (c[4] == 0x43) && (c[5] == 0x2b)
609 && (c[6] == 0x1f) && (c[7] == 0x5b))
614 [fp_layout_need_nothing="yes"],
615 [fp_layout_need_nothing="no"]
618 if test "x$fp_layout_need_nothing" = "xyes"; then
619 fp_layout_type="nothing"
622 if test "x$fp_layout_type" = "xunknown"; then
623 AC_CACHE_CHECK([if endianflip converts to x86 representation],
624 [fp_layout_need_endianflip],
632 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
633 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
634 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
635 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
636 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
637 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
638 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
639 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
648 memcpy ((void *) &i0, (void *) &d, 8);
650 i1 = endianflip (i0);
651 memcpy ((void *) c, (void *) &i1, 8);
653 if ((c[0] == 0x2f) && (c[1] == 0x25)
654 && (c[2] == 0xc0) && (c[3] == 0xc7)
655 && (c[4] == 0x43) && (c[5] == 0x2b)
656 && (c[6] == 0x1f) && (c[7] == 0x5b))
661 [fp_layout_need_endianflip="yes"],
662 [fp_layout_need_endianflip="no"]
665 if test "x$fp_layout_need_endianflip" = "xyes"; then
666 fp_layout_type="endianflip"
669 if test "x$fp_layout_type" = "xunknown"; then
670 AC_CACHE_CHECK([if intswap converts to x86 representation],
671 [fp_layout_need_intswap],
679 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
680 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
689 memcpy ((void *) &i0, (void *) &d, 8);
692 memcpy ((void *) c, (void *) &i1, 8);
694 if ((c[0] == 0x2f) && (c[1] == 0x25)
695 && (c[2] == 0xc0) && (c[3] == 0xc7)
696 && (c[4] == 0x43) && (c[5] == 0x2b)
697 && (c[6] == 0x1f) && (c[7] == 0x5b))
702 [fp_layout_need_intswap="yes"],
703 [fp_layout_need_intswap="no"]
706 if test "x$fp_layout_need_intswap" = "xyes"; then
707 fp_layout_type="intswap"
711 if test "x$fp_layout_type" = "xnothing"; then
712 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
713 [Define if doubles are stored in x86 representation.])
714 else if test "x$fp_layout_type" = "xendianflip"; then
715 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
716 [Define if endianflip is needed to convert to x86 representation.])
717 else if test "x$fp_layout_type" = "xintswap"; then
718 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
719 [Define if intswap is needed to convert to x86 representation.])
721 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
725 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
727 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
729 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
732 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
733 if test "x$have_getmntent" = "xno"; then
734 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
736 if test "x$have_getmntent" = "xno"; then
737 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
739 if test "x$have_getmntent" = "xno"; then
740 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
743 if test "x$have_getmntent" = "xc"; then
744 AC_CACHE_CHECK([whether getmntent takes one argument],
745 [have_one_getmntent],
747 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
749 #include "$srcdir/src/utils_mount.h"]],
753 fh = setmntent ("/etc/mtab", "r");
757 [have_one_getmntent="yes"],
758 [have_one_getmntent="no"]
761 AC_CACHE_CHECK([whether getmntent takes two arguments],
762 [have_two_getmntent],
764 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
765 #include <sys/mnttab.h>
766 #include "$srcdir/src/utils_mount.h"]],
771 fh = fopen ("/etc/mnttab", "r");
772 status = getmntent (fh, &mt);
775 [have_two_getmntent="yes"],
776 [have_two_getmntent="no"]
781 # Check for different versions of `getmntent' here..
783 if test "x$have_getmntent" = "xc"; then
784 if test "x$have_one_getmntent" = "xyes"; then
785 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
786 [Define if the function getmntent exists and takes one argument.])
788 if test "x$have_two_getmntent" = "xyes"; then
789 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
790 [Define if the function getmntent exists and takes two arguments.])
793 if test "x$have_getmntent" = "xsun"; then
794 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
795 [Define if the function getmntent exists. It's the version from libsun.])
797 if test "x$have_getmntent" = "xseq"; then
798 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
799 [Define if the function getmntent exists. It's the version from libseq.])
801 if test "x$have_getmntent" = "xgen"; then
802 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
803 [Define if the function getmntent exists. It's the version from libgen.])
806 # Check for structures
807 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
808 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
811 #include <sys/types.h>
812 #include <sys/socket.h>
815 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
816 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
819 #include <sys/types.h>
820 #include <sys/socket.h>
821 #include <linux/if.h>
822 #include <linux/netdevice.h>
825 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
830 # include <sys/types.h>
832 #if HAVE_NETINET_IN_SYSTM_H
833 # include <netinet/in_systm.h>
835 #if HAVE_NETINET_IN_H
836 # include <netinet/in.h>
838 #if HAVE_NETINET_IP_H
839 # include <netinet/ip.h>
841 #if HAVE_NETINET_UDP_H
842 # include <netinet/udp.h>
845 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
850 # include <sys/types.h>
852 #if HAVE_NETINET_IN_SYSTM_H
853 # include <netinet/in_systm.h>
855 #if HAVE_NETINET_IN_H
856 # include <netinet/in.h>
858 #if HAVE_NETINET_IP_H
859 # include <netinet/ip.h>
861 #if HAVE_NETINET_UDP_H
862 # include <netinet/udp.h>
866 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
876 AC_CHECK_LIB(resolv, res_search,
878 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
880 [with_libresolv="no"])
881 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
884 m4_divert_once([HELP_WITH], [
885 collectd additional packages:])
887 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
890 librrd_threadsafe="yes"
891 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
892 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
894 librrd_cflags="-I$withval/include"
895 librrd_ldflags="-L$withval/lib"
898 ], [with_rrdtool="yes"])
899 if test "x$with_rrdtool" = "xyes"
901 SAVE_CPPFLAGS="$CPPFLAGS"
902 SAVE_LDFLAGS="$LDFLAGS"
904 CPPFLAGS="$CPPFLAGS $librrd_cflags"
905 LDFLAGS="$LDFLAGS $librrd_ldflags"
907 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
909 CPPFLAGS="$SAVE_CPPFLAGS"
910 LDFLAGS="$SAVE_LDFLAGS"
912 if test "x$with_rrdtool" = "xyes"
914 SAVE_CPPFLAGS="$CPPFLAGS"
915 SAVE_LDFLAGS="$LDFLAGS"
917 CPPFLAGS="$CPPFLAGS $librrd_cflags"
918 LDFLAGS="$LDFLAGS $librrd_ldflags"
920 AC_CHECK_LIB(rrd_th, rrd_update_r,
922 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
924 [librrd_threadsafe="no"
925 AC_CHECK_LIB(rrd, rrd_update,
927 librrd_ldflags="$librrd_ldflags -lrrd -lm"
929 [with_rrdtool="no (symbol 'rrd_update' not found)"],
934 CPPFLAGS="$SAVE_CPPFLAGS"
935 LDFLAGS="$SAVE_LDFLAGS"
937 if test "x$with_rrdtool" = "xyes"
939 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
940 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
941 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
942 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
944 if test "x$librrd_threadsafe" = "xyes"
946 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
949 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
950 [ if test "x$withval" != "xno" -a "x$withval" != "xyes"
952 LDFLAGS="$LDFLAGS -L$withval/lib"
953 CPPFLAGS="$CPPFLAGS -I$withval/include"
954 with_libpthread="yes"
956 if test "x$withval" = "xno"
958 with_libpthread="no (disabled)"
961 ], [with_libpthread="yes"])
962 if test "x$with_libpthread" = "xyes"
964 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
966 if test "x$with_libpthread" = "xyes"
968 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
970 if test "x$with_libpthread" = "xyes"
976 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
977 [Wether or not to use pthread (POSIX threads) library])
978 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
980 if test "x$ac_system" = "xSolaris"
985 with_kstat="no (Solaris only)"
986 with_devinfo="no (Solaris only)"
989 if test "x$with_kstat" = "xyes"
991 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
993 if test "x$with_kstat" = "xyes"
995 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
996 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
998 if test "x$with_kstat" = "xyes"
1000 AC_DEFINE(HAVE_LIBKSTAT, 1,
1001 [Define to 1 if you have the 'kstat' library (-lkstat)])
1003 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1004 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1006 ### BEGIN of check for libcurl ###
1007 with_curl_config="curl-config"
1010 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1012 if test "x$withval" = "xno"
1015 else if test "x$withval" = "xyes"
1019 if test -f "$withval" && test -x "$withval"
1021 with_curl_config="$withval"
1023 else if test -x "$withval/bin/curl-config"
1025 with_curl_config="$withval/bin/curl-config"
1034 if test "x$with_libcurl" = "xyes"
1036 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1037 curl_config_status=$?
1039 if test $curl_config_status -ne 0
1041 with_libcurl="no ($with_curl_config failed)"
1043 SAVE_CPPFLAGS="$CPPFLAGS"
1044 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1046 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1048 CPPFLAGS="$SAVE_CPPFLAGS"
1051 if test "x$with_libcurl" = "xyes"
1053 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1054 curl_config_status=$?
1056 if test $curl_config_status -ne 0
1058 with_libcurl="no ($with_curl_config failed)"
1060 AC_CHECK_LIB(curl, curl_easy_init,
1061 [with_libcurl="yes"],
1062 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1066 if test "x$with_libcurl" = "xyes"
1068 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1069 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1070 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1071 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1073 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1074 ### END of check for libcurl ###
1078 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1087 AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
1088 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1090 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
1092 if test "x$withval" != "xno" \
1093 && test "x$withval" != "xyes"
1095 LDFLAGS="$LDFLAGS -L$withval/lib"
1096 CPPFLAGS="$CPPFLAGS -I$withval/include"
1097 with_libstatgrab="yes"
1101 if test "x$ac_system" = "xunknown"
1103 with_libstatgrab="yes"
1105 with_libstatgrab="no"
1108 if test "x$with_libstatgrab" = "xyes"
1110 AC_CHECK_LIB(statgrab, sg_init, [with_libstatgrab="yes"], [with_libstatgrab="no (libstatgrab not found)"])
1112 if test "x$with_libstatgrab" = "xyes"
1114 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (statgrab.h not found)"])
1116 if test "x$with_libstatgrab" = "xyes"
1118 AC_CHECK_LIB(devstat, getdevs, [with_libdevstat="yes"], [with_libdevstat="no"])
1120 if test "x$with_libstatgrab" = "xyes"
1122 collect_libstatgrab=1
1124 collect_libstatgrab=0
1126 AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
1127 [Wether or not to use statgrab library])
1128 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
1129 AM_CONDITIONAL(BUILD_WITH_LIBDEVSTAT, test "x$with_libdevstat" = "xyes")
1131 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
1132 if test "x$with_libkvm" = "xyes"
1134 AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
1136 AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
1138 with_sensors_cflags=""
1139 with_sensors_ldflags=""
1140 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
1142 if test "x$withval" = "xno"
1144 with_lm_sensors="no"
1146 with_lm_sensors="yes"
1147 if test "x$withval" != "xyes"
1149 with_sensors_cflags="-I$withval/include"
1150 with_sensors_ldflags="-L$withval/lib"
1151 with_lm_sensors="yes"
1156 if test "x$ac_system" = "xLinux"
1158 with_lm_sensors="yes"
1160 with_lm_sensors="no (Linux only library)"
1163 if test "x$with_lm_sensors" = "xyes"
1165 SAVE_CPPFLAGS="$CPPFLAGS"
1166 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
1168 # AC_CHECK_HEADERS(sensors/sensors.h,
1170 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
1172 # [with_lm_sensors="no (sensors/sensors.h not found)"])
1173 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_lm_sensors="no (sensors/sensors.h not found)"])
1175 CPPFLAGS="$SAVE_CPPFLAGS"
1177 if test "x$with_lm_sensors" = "xyes"
1179 SAVE_CPPFLAGS="$CPPFLAGS"
1180 SAVE_LDFLAGS="$LDFLAGS"
1181 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
1182 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
1184 AC_CHECK_LIB(sensors, sensors_init,
1186 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
1188 [with_lm_sensors="no (libsensors not found)"])
1190 CPPFLAGS="$SAVE_CPPFLAGS"
1191 LDFLAGS="$SAVE_LDFLAGS"
1193 if test "x$with_lm_sensors" = "xyes"
1195 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
1196 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
1197 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
1198 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
1200 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
1202 with_mysql_config="mysql_config"
1203 with_mysql_cflags=""
1205 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1207 if test "x$withval" = "xno"
1210 else if test "x$withval" = "xyes"
1214 if test -f "$withval" && test -x "$withval";
1216 with_mysql_config="$withval"
1217 else if test -x "$withval/bin/mysql_config"
1219 with_mysql_config="$withval/bin/mysql_config"
1227 if test "x$with_libmysql" = "xyes"
1229 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1230 mysql_config_status=$?
1232 if test $mysql_config_status -ne 0
1236 SAVE_CPPFLAGS="$CPPFLAGS"
1237 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
1239 AC_CHECK_HEADERS(mysql/mysql.h, [], [with_libmysql="no (mysql/mysql.h not found)"], [])
1241 CPPFLAGS="$SAVE_CPPFLAGS"
1244 if test "x$with_libmysql" = "xyes"
1246 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
1247 mysql_config_status=$?
1249 if test $mysql_config_status -ne 0
1253 AC_CHECK_LIB(mysqlclient, mysql_init,
1254 [with_libmysql="yes"],
1255 [with_libmysql="no (symbol 'mysql_init' not found)"],
1259 if test "x$with_libmysql" = "xyes"
1261 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
1262 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
1263 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
1264 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
1266 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
1268 with_own_liboconfig="no"
1269 liboconfig_LDFLAGS="$LDFLAGS"
1270 liboconfig_CPPFLAGS="$CPPFLAGS"
1271 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1273 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1275 if test -d "$withval/lib"
1277 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1279 if test -d "$withval/include"
1281 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1284 if test "x$withval" = "xno"
1286 AC_MSG_ERROR("liboconfig is required")
1290 with_liboconfig="yes"
1293 save_LDFLAGS="$LDFLAGS"
1294 save_CPPFLAGS="$CPPFLAGS"
1295 LDFLAGS="$liboconfig_LDFLAGS"
1296 CPPFLAGS="$liboconfig_CPPFLAGS"
1297 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1299 with_liboconfig="yes"
1300 with_own_liboconfig="no"
1303 with_liboconfig="yes"
1304 with_own_liboconfig="yes"
1305 LDFLAGS="$save_LDFLAGS"
1306 CPPFLAGS="$save_CPPFLAGS"
1309 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1310 if test "x$with_own_liboconfig" = "xyes"
1312 with_liboconfig="yes (shipped version)"
1315 #with_liboping="yes"
1316 with_own_liboping="no"
1317 liboping_LDFLAGS="$LDFLAGS"
1318 liboping_CPPFLAGS="$CPPFLAGS"
1319 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1321 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1323 if test -d "$withval/lib"
1325 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
1327 if test -d "$withval/include"
1329 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
1332 if test "x$withval" = "xno"
1335 with_own_liboping="no"
1343 if test "x$with_liboping" = "xyes"
1345 save_LDFLAGS="$LDFLAGS"
1346 save_CPPFLAGS="$CPPFLAGS"
1347 LDFLAGS="$liboping_LDFLAGS"
1348 CPPFLAGS="$liboping_CPPFLAGS"
1349 AC_CHECK_LIB(oping, ping_construct,
1352 with_own_liboping="no"
1356 with_own_liboping="yes"
1357 LDFLAGS="$save_LDFLAGS"
1358 CPPFLAGS="$save_CPPFLAGS"
1361 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1362 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1364 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1366 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1368 LDFLAGS="$LDFLAGS -L$withval/lib"
1369 CPPFLAGS="$CPPFLAGS -I$withval/include"
1376 if test "x$with_libpcap" = "xyes"
1378 AC_CHECK_LIB(pcap, pcap_open_live,
1380 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1381 ], [with_libpcap="no (libpcap not found)"])
1383 if test "x$with_libpcap" = "xyes"
1385 AC_CHECK_HEADERS(pcap.h,
1387 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1388 ], [with_libpcap="no (pcap.h not found)"])
1390 if test "x$with_libpcap" = "xyes"
1396 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1397 [Wether or not to use the pcap library])
1398 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1400 perl_interpreter="perl"
1401 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1403 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1405 LDFLAGS="$LDFLAGS -L$withval/lib"
1406 CPPFLAGS="$CPPFLAGS -I$withval/include"
1407 perl_interpreter="$withval/bin/perl"
1415 AC_MSG_CHECKING([for perl])
1416 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
1417 if test -x "$perl_interpreter"
1419 AC_MSG_RESULT([yes])
1425 AC_SUBST(PERL, "$perl_interpreter")
1427 if test "x$with_libperl" = "xyes" -a -n "$perl_interpreter"
1430 SAVE_LDFLAGS=$LDFLAGS
1431 PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
1432 PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
1433 CFLAGS="$CFLAGS $PERL_CFLAGS"
1434 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1436 AC_CACHE_CHECK([for libperl],
1446 PerlInterpreter *perl = NULL;
1447 Perl_load_module (perl, PERL_LOADMOD_NOIMPORT,
1448 newSVpv ("Collectd::Plugin::FooBar", 24),
1451 [have_libperl="yes"],
1456 if test "x$have_libperl" = "xyes"
1458 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
1459 AC_SUBST(PERL_CFLAGS)
1460 AC_SUBST(PERL_LDFLAGS)
1466 LDFLAGS=$SAVE_LDFLAGS
1467 else if test -z "$perl_interpreter"; then
1468 with_libperl="no (no perl interpreter found)"
1471 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1473 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1475 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1477 LDFLAGS="$LDFLAGS -L$withval/lib"
1478 CPPFLAGS="$CPPFLAGS -I$withval/include"
1483 if test "x$ac_system" = "xLinux"
1487 with_libiptc="no (Linux only)"
1490 if test "x$with_libiptc" = "xyes"
1492 AC_CHECK_LIB(iptc, iptc_init,
1494 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1495 ], [with_libiptc="no (libiptc not found)"])
1497 if test "x$with_libiptc" = "xyes"
1499 AC_CHECK_HEADERS(libiptc/libiptc.h,
1501 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1502 ], [with_libiptc="no (libiptc/libiptc.h not found)"])
1504 if test "x$with_libiptc" = "xyes"
1510 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1512 with_snmp_config="net-snmp-config"
1515 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1517 if test "x$withval" = "xno"
1519 with_libnetsnmp="no"
1520 else if test "x$withval" = "xyes"
1522 with_libnetsnmp="yes"
1524 if test -x "$withval"
1526 with_snmp_config="$withval"
1527 with_libnetsnmp="yes"
1529 with_snmp_config="$withval/bin/net-snmp-config"
1530 with_libnetsnmp="yes"
1534 [with_libnetsnmp="yes"])
1535 if test "x$with_libnetsnmp" = "xyes"
1537 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
1538 snmp_config_status=$?
1540 if test $snmp_config_status -ne 0
1542 with_libnetsnmp="no ($with_snmp_config failed)"
1544 SAVE_CPPFLAGS="$CPPFLAGS"
1545 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
1547 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1549 CPPFLAGS="$SAVE_CPPFLAGS"
1552 if test "x$with_libnetsnmp" = "xyes"
1554 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
1555 snmp_config_status=$?
1557 if test $snmp_config_status -ne 0
1559 with_libnetsnmp="no ($with_snmp_config failed)"
1561 AC_CHECK_LIB(netsnmp, init_snmp,
1562 [with_libnetsnmp="yes"],
1563 [with_libnetsnmp="no (libnetsnmp not found)"],
1567 if test "x$with_libnetsnmp" = "xyes"
1569 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
1570 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
1571 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
1572 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
1574 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1576 with_upsclient_config="libupsclient-config"
1577 with_upsclient_cflags=""
1578 with_upsclient_libs=""
1579 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])],
1581 if test "x$withval" = "xno"
1583 with_libupsclient="no"
1585 if test "x$withval" != "xyes"
1587 if test -f "$withval" && test -x "$withval";
1589 with_upsclient_config="$withval"
1591 with_upsclient_config="$withval/bin/libupsclient-config"
1594 with_libupsclient="yes"
1598 with_libupsclient="yes"
1600 if test "x$with_libupsclient" = "xyes"
1602 with_upsclient_cflags=`$with_upsclient_config --cflags 2>/dev/null`
1603 upsclient_config_status=$?
1605 if test $upsclient_config_status -ne 0
1607 with_libupsclient="no ($with_upsclient_config failed)"
1610 if test "x$with_libupsclient" = "xyes"
1612 SAVE_CPPFLAGS="$CPPFLAGS"
1613 CPPFLAGS="$CPPFLAGS $with_upsclient_cflags"
1615 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
1617 CPPFLAGS="$SAVE_CPPFLAGS"
1619 if test "x$with_libupsclient" = "xyes"
1621 with_upsclient_libs=`$with_upsclient_config --libs 2>/dev/null`
1622 upsclient_config_status=$?
1624 if test $upsclient_config_status -ne 0
1626 with_libupsclient="no ($with_upsclient_config failed)"
1629 if test "x$with_libupsclient" = "xyes"
1631 AC_CHECK_LIB(upsclient, upscli_connect,
1633 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_upsclient_cflags"
1634 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_upsclient_libs"
1635 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
1636 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
1639 with_libupsclient="no (symbol 'upscli_connect' not found)"
1640 ], [$with_upsclient_libs])
1642 if test "x$with_libupsclient" = "xyes"
1644 SAVE_CPPFLAGS="$CPPFLAGS"
1645 CPPFLAGS="$CPPFLAGS $with_upsclient_cflags"
1647 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
1648 [#include <stdlib.h>
1650 #include <upsclient.h>])
1652 CPPFLAGS="$SAVE_CPPFLAGS"
1654 AM_CONDITIONAL(BUILD_WITH_LIBUPSCLIENT, test "x$with_libupsclient" = "xyes")
1656 ### BEGIN of check for libxmms ###
1657 with_xmms_config="xmms-config"
1660 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
1662 if test "x$withval" != "xno" -a "x$withval" != "xyes"
1664 if test -f "$withval" && test -x "$withval";
1666 with_xmms_config="$withval"
1667 else if test -x "$withval/bin/xmms-config"
1669 with_xmms_config="$withval/bin/xmms-config"
1672 else if test "x$withval" = "xno"
1682 if test "x$with_libxmms" = "xyes"
1684 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
1685 xmms_config_status=$?
1687 if test $xmms_config_status -ne 0
1692 if test "x$with_libxmms" = "xyes"
1694 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
1695 xmms_config_status=$?
1697 if test $xmms_config_status -ne 0
1702 if test "x$with_libxmms" = "xyes"
1704 AC_CHECK_LIB(xmms, xmms_remote_get_info,
1706 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
1707 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
1708 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
1709 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
1716 with_libxmms_numeric=0
1717 if test "x$with_libxmms" = "xyes"
1719 with_libxmms_numeric=1
1721 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
1722 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
1723 ### END of check for libxmms ###
1725 with_libnetlink_cflags=""
1726 with_libnetlink_libs="-lnetlink"
1727 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
1729 echo "libnetlink: withval = $withval"
1730 if test "x$withval" = "xyes"
1732 with_libnetlink="yes"
1733 else if test "x$withval" = "xno"
1735 with_libnetlink="no"
1737 if test -d "$withval/include"
1739 with_libnetlink_cflags="-I$withval/include"
1740 with_libnetlink_libs="-L$withval/lib -lnetlink"
1741 with_libnetlink="yes"
1743 AC_MSG_ERROR("no such directory: $withval/include")
1748 if test "x$ac_system" = "xLinux"
1750 with_libnetlink="yes"
1752 with_libnetlink="no (Linux only library)"
1755 if test "x$with_libnetlink" = "xyes"
1758 CFLAGS="$CFLAGS $with_libnetlink_cflags"
1760 with_libnetlink="no (libnetlink.h not found)"
1762 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
1764 with_libnetlink="yes"
1768 #include <sys/types.h>
1769 #include <asm/types.h>
1770 #include <sys/socket.h>
1771 #include <linux/netlink.h>
1772 #include <linux/rtnetlink.h>])
1773 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
1775 #include <sys/types.h>
1776 #include <asm/types.h>
1777 #include <sys/socket.h>])
1781 #include <sys/types.h>
1782 #include <asm/types.h>
1783 #include <sys/socket.h>
1784 #include <linux/netlink.h>
1785 #include <linux/rtnetlink.h>
1789 int retval = TCA_STATS2;
1792 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
1797 #include <sys/types.h>
1798 #include <asm/types.h>
1799 #include <sys/socket.h>
1800 #include <linux/netlink.h>
1801 #include <linux/rtnetlink.h>
1805 int retval = TCA_STATS;
1808 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
1811 CFLAGS="$SAVE_CFLAGS"
1813 if test "x$with_libnetlink" = "xyes"
1815 AC_CHECK_LIB(netlink, rtnl_open,
1816 [with_libnetlink="yes"],
1817 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
1818 [$with_libnetlink_libs])
1820 if test "x$with_libnetlink" = "xyes"
1822 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
1823 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
1824 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
1825 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
1827 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
1829 # Check for enabled/disabled features
1832 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
1833 # ------------------------------------------------------------
1835 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
1840 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
1845 m4_define([EnDis],[disabled])dnl
1846 m4_define([YesNo],[no])dnl
1852 m4_define([EnDis],[enabled])dnl
1853 m4_define([YesNo],[yes])dnl
1856 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
1860 m4_if([$3], [feature], [],
1864 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
1870 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
1872 enable_$1='[YesNo]'dnl
1874 if test "x$enable_$1" = "xno"
1878 if test "x$enable_$1" = "xyes"
1882 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
1887 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
1888 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
1890 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
1892 # AC_PLUGIN(name, default, info)
1893 # ------------------------------------------------------------
1899 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
1901 if test "x$enableval" = "xyes"
1909 if test "x$2" = "xyes"
1916 if test "x$enable_plugin" = "xyes"
1918 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
1920 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
1921 enable_$1="$enable_plugin"
1923 )# AC_PLUGIN(name, default, info)
1925 m4_divert_once([HELP_ENABLE], [
1926 collectd features:])
1927 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
1928 AC_COLLECTD([debug], [enable], [feature], [debugging])
1929 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
1930 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
1938 plugin_interface="no"
1943 plugin_multimeter="no"
1945 plugin_processes="no"
1949 plugin_tcpconns="no"
1952 plugin_wireless="no"
1955 if test "x$ac_system" = "xLinux"
1957 plugin_battery="yes"
1959 plugin_cpufreq="yes"
1961 plugin_entropy="yes"
1962 plugin_interface="yes"
1967 plugin_processes="yes"
1970 plugin_tcpconns="yes"
1971 plugin_vserver="yes"
1972 plugin_wireless="yes"
1974 if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
1981 if test "x$with_libiokit" = "xyes"
1983 plugin_battery="yes"
1988 if test "x$with_devinfo$with_kstat" = "xyesyes"
1992 plugin_interface="yes"
1999 if test "x$with_libstatgrab" = "xyes"
2001 plugin_interface="yes"
2007 if test "x$have_processor_info" = "xyes"
2011 if test "x$have_sysctlbyname" = "xyes"
2015 plugin_tcpconns="yes"
2018 if test "x$have_statfs" = "xyes"
2022 if test "x$have_statvfs" = "xyes"
2027 if test "x$have_getifaddrs" = "xyes"
2029 plugin_interface="yes"
2032 if test "x$have_getloadavg" = "xyes"
2037 # Mac OS X memory interface
2038 if test "x$have_host_statistics" = "xyes"
2043 if test "x$have_termios_h" = "xyes"
2045 plugin_multimeter="yes"
2048 if test "x$have_thread_info" = "xyes"
2050 plugin_processes="yes"
2053 if test "x$with_libkvm" = "xyes"
2058 if test "x$have_getutent" = "xyes"
2062 if test "x$have_getutxent" = "xyes"
2067 # FIXME: sysctl for swap plugin
2069 m4_divert_once([HELP_ENABLE], [
2072 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
2073 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
2074 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
2075 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
2076 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
2077 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
2078 AC_PLUGIN([csv], [yes], [CSV output plugin])
2079 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
2080 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
2081 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
2082 AC_PLUGIN([email], [yes], [EMail statistics])
2083 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
2084 AC_PLUGIN([exec], [yes], [Execution of external programs])
2085 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
2086 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
2087 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
2088 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
2089 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
2090 AC_PLUGIN([load], [$plugin_load], [System load])
2091 AC_PLUGIN([logfile], [yes], [File logging plugin])
2092 AC_PLUGIN([mbmon], [yes], [Query mbmond])
2093 AC_PLUGIN([memcached], [yes], [memcached statistics])
2094 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
2095 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
2096 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
2097 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
2098 AC_PLUGIN([network], [yes], [Network communication plugin])
2099 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
2100 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
2101 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
2102 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
2103 AC_PLUGIN([perl], [$with_libperl], [Embed a Perl interpreter])
2104 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
2105 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
2106 AC_PLUGIN([rrdtool], [$with_rrdtool], [RRDTool output plugin])
2107 AC_PLUGIN([sensors], [$with_lm_sensors], [lm_sensors statistics])
2108 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
2109 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
2110 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
2111 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
2112 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
2113 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
2114 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
2115 AC_PLUGIN([users], [$plugin_users], [User statistics])
2116 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
2117 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
2118 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
2121 if test "x$ac_system" = "xLinux" -a "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
2123 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
2127 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
2129 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2131 PERL_BINDINGS_OPTIONS="$withval"
2132 with_perl_bindings="yes"
2134 PERL_BINDINGS_OPTIONS=""
2135 with_perl_bindings="$withval"
2139 PERL_BINDINGS_OPTIONS=""
2140 if test -n "$perl_interpreter"
2142 with_perl_bindings="yes"
2144 with_perl_bindings="no (no perl interpreter found)"
2147 if test "x$with_perl_bindings" = "xyes"
2149 PERL_BINDINGS="perl"
2153 AC_SUBST(PERL_BINDINGS)
2154 AC_SUBST(PERL_BINDINGS_OPTIONS)
2156 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile bindings/Makefile)
2158 if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
2160 with_liboping="yes (shipped version)"
2163 if test "x$with_libperl" = "xyes"
2165 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
2167 enable_perl="no (needs libperl)"
2170 if test "x$with_perl_bindings" = "xyes" -a "x$PERL_BINDINGS_OPTIONS" != "x"
2172 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
2179 libcurl . . . . . . $with_libcurl
2180 libiokit . . . . . $with_libiokit
2181 libiptc . . . . . . $with_libiptc
2182 libkstat . . . . . $with_kstat
2183 libkvm . . . . . . $with_libkvm
2184 libmysql . . . . . $with_libmysql
2185 libnetlink . . . . $with_libnetlink
2186 libnetsnmp . . . . $with_libnetsnmp
2187 liboconfig . . . . $with_liboconfig
2188 liboping . . . . . $with_liboping
2189 libpcap . . . . . . $with_libpcap
2190 libperl . . . . . . $with_libperl
2191 libpthread . . . . $with_libpthread
2192 librrd . . . . . . $with_rrdtool
2193 libsensors . . . . $with_lm_sensors
2194 libstatgrab . . . . $with_libstatgrab
2195 libupsclient . . . $with_libupsclient
2196 libxmms . . . . . . $with_libxmms
2199 daemon mode . . . . $enable_daemon
2200 debug . . . . . . . $enable_debug
2203 perl . . . . . . . $with_perl_bindings
2206 apache . . . . . . $enable_apache
2207 apcups . . . . . . $enable_apcups
2208 apple_sensors . . . $enable_apple_sensors
2209 battery . . . . . . $enable_battery
2210 cpu . . . . . . . . $enable_cpu
2211 cpufreq . . . . . . $enable_cpufreq
2212 csv . . . . . . . . $enable_csv
2213 df . . . . . . . . $enable_df
2214 disk . . . . . . . $enable_disk
2215 dns . . . . . . . . $enable_dns
2216 email . . . . . . . $enable_email
2217 entropy . . . . . . $enable_entropy
2218 exec . . . . . . . $enable_exec
2219 hddtemp . . . . . . $enable_hddtemp
2220 interface . . . . . $enable_interface
2221 iptables . . . . . $enable_iptables
2222 ipvs . . . . . . . $enable_ipvs
2223 irq . . . . . . . . $enable_irq
2224 load . . . . . . . $enable_load
2225 logfile . . . . . . $enable_logfile
2226 mbmon . . . . . . . $enable_mbmon
2227 memcached . . . . . $enable_memcached
2228 memory . . . . . . $enable_memory
2229 multimeter . . . . $enable_multimeter
2230 mysql . . . . . . . $enable_mysql
2231 netlink . . . . . . $enable_netlink
2232 network . . . . . . $enable_network
2233 nfs . . . . . . . . $enable_nfs
2234 nginx . . . . . . . $enable_nginx
2235 ntpd . . . . . . . $enable_ntpd
2236 nut . . . . . . . . $enable_nut
2237 perl . . . . . . . $enable_perl
2238 ping . . . . . . . $enable_ping
2239 processes . . . . . $enable_processes
2240 rrdtool . . . . . . $enable_rrdtool
2241 sensors . . . . . . $enable_sensors
2242 serial . . . . . . $enable_serial
2243 snmp . . . . . . . $enable_snmp
2244 swap . . . . . . . $enable_swap
2245 syslog . . . . . . $enable_syslog
2246 tape . . . . . . . $enable_tape
2247 tcpconns . . . . . $enable_tcpconns
2248 unixsock . . . . . $enable_unixsock
2249 users . . . . . . . $enable_users
2250 vserver . . . . . . $enable_vserver
2251 wireless . . . . . $enable_wireless
2252 xmms . . . . . . . $enable_xmms