1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, m4_esyscmd(./version-gen.sh))
3 AC_CONFIG_SRCDIR(src/collectd.c)
4 AC_CONFIG_HEADERS(src/config.h)
5 AM_INIT_AUTOMAKE(dist-bzip2)
8 AC_PREFIX_DEFAULT("/opt/collectd")
13 # Checks for programs.
21 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
25 AC_LIBLTDL_CONVENIENCE
33 AC_CONFIG_SUBDIRS(libltdl)
35 AC_MSG_CHECKING([for kernel type ($host_os)])
38 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
42 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
54 AC_MSG_RESULT([$ac_system])
56 if test "x$ac_system" = "xLinux"
58 AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
59 if test -z "$KERNEL_DIR"
61 KERNEL_DIR="/lib/modules/`uname -r`/source"
64 KERNEL_CFLAGS="-I$KERNEL_DIR/include"
65 AC_SUBST(KERNEL_CFLAGS)
69 # Checks for header files.
75 AC_CHECK_HEADERS(stdio.h stdint.h stdbool.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 sys/isa_defs.h)
78 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
83 # include <sys/types.h>
86 AC_CHECK_HEADERS(netinet/in.h, [], [],
91 # include <sys/types.h>
93 #if HAVE_NETINET_IN_SYSTM_H
94 # include <netinet/in_systm.h>
97 AC_CHECK_HEADERS(netinet/ip.h, [], [],
102 # include <sys/types.h>
104 #if HAVE_NETINET_IN_SYSTM_H
105 # include <netinet/in_systm.h>
107 #if HAVE_NETINET_IN_H
108 # include <netinet/in.h>
111 AC_CHECK_HEADERS(netinet/ip_icmp.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/ip_var.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>
141 #if HAVE_NETINET_IP_H
142 # include <netinet/ip.h>
145 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
150 # include <sys/types.h>
152 #if HAVE_NETINET_IN_SYSTM_H
153 # include <netinet/in_systm.h>
155 #if HAVE_NETINET_IN_H
156 # include <netinet/in.h>
159 AC_CHECK_HEADERS(netinet/icmp6.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_IP6_H
173 # include <netinet/ip6.h>
176 AC_CHECK_HEADERS(netinet/tcp.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>
193 AC_CHECK_HEADERS(netinet/udp.h, [], [],
198 # include <sys/types.h>
200 #if HAVE_NETINET_IN_SYSTM_H
201 # include <netinet/in_systm.h>
203 #if HAVE_NETINET_IN_H
204 # include <netinet/in.h>
206 #if HAVE_NETINET_IP_H
207 # include <netinet/ip.h>
212 AC_CHECK_HEADERS(sys/dkstat.h)
213 if test "x$ac_system" = "xDarwin"
215 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)
216 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
218 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
221 # include <sys/types.h>
224 # include <sys/param.h>
229 AC_CHECK_HEADERS(linux/major.h libgen.h)
231 # For the battery plugin
232 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
234 #if HAVE_IOKIT_IOKITLIB_H
235 # include <IOKit/IOKitLib.h>
237 #if HAVE_IOKIT_IOTYPES_H
238 # include <IOKit/IOTypes.h>
242 # For the swap module
243 AC_CHECK_HEADERS(sys/swap.h, [], [],
246 # include <sys/types.h>
249 # include <sys/param.h>
254 # For the processes plugin
256 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
258 # For interface plugin
259 AC_CHECK_HEADERS(ifaddrs.h)
260 AC_CHECK_HEADERS(net/if.h, [], [],
263 # include <sys/types.h>
265 #if HAVE_SYS_SOCKET_H
266 # include <sys/socket.h>
269 AC_CHECK_HEADERS(linux/if.h, [], [],
272 # include <sys/types.h>
274 #if HAVE_SYS_SOCKET_H
275 # include <sys/socket.h>
278 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
281 # include <sys/types.h>
283 #if HAVE_SYS_SOCKET_H
284 # include <sys/socket.h>
287 # include <linux/if.h>
292 have_net_ip_vs_h="no"
294 if test "x$ac_system" = "xLinux"
297 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
299 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
300 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
306 AC_CHECK_HEADERS(sys/ucred.h, [], [],
309 # include <sys/types.h>
312 # include <sys/param.h>
316 # For mount interface
317 AC_CHECK_HEADERS(sys/mount.h, [], [],
320 # include <sys/types.h>
323 # include <sys/param.h>
327 # For the email plugin
328 AC_CHECK_HEADERS(linux/un.h, [], [],
330 #if HAVE_SYS_SOCKET_H
331 # include <sys/socket.h>
335 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 wordexp.h)
338 AC_CHECK_HEADERS(arpa/nameser.h)
339 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
341 #if HAVE_ARPA_NAMESER_H
342 # include <arpa/nameser.h>
346 AC_CHECK_HEADERS(net/if_arp.h, [], [],
347 [#if HAVE_SYS_SOCKET_H
348 # include <sys/socket.h>
351 AC_CHECK_HEADERS(net/ppp_defs.h)
352 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
353 [#if HAVE_NET_PPP_DEFS_H
354 # include <net/ppp_defs.h>
357 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
362 # include <sys/types.h>
364 #if HAVE_SYS_SOCKET_H
365 # include <sys/socket.h>
370 #if HAVE_NETINET_IN_H
371 # include <netinet/in.h>
375 # For the multimeter plugin
377 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
380 # Checks for typedefs, structures, and compiler characteristics.
389 # Checks for library functions.
391 AC_PROG_GCC_TRADITIONAL
392 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog)
396 AC_CACHE_CHECK([for strtok_r],
397 [have_strtok_r_default],
406 char buffer[] = "foo,bar,baz";
413 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
416 printf ("token = %s;\n", token);
419 [have_strtok_r_default="yes"],
420 [have_strtok_r_default="no"]
424 if test "x$have_strtok_r_default" = "xno"
426 SAVE_CFLAGS="$CFLAGS"
427 CFLAGS="$CFLAGS -D_REENTRANT=1"
429 AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
430 [have_strtok_r_reentrant],
439 char buffer[] = "foo,bar,baz";
446 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
449 printf ("token = %s;\n", token);
452 [have_strtok_r_reentrant="yes"],
453 [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
458 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
460 socket_needs_socket="no"
461 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
462 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
464 nanosleep_needs_rt="no"
465 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
466 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
468 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
469 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
470 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
471 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
472 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
473 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
474 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
475 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
476 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
477 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
480 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
483 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
485 if test "x$withval" = "xno"; then
487 else if test "x$withval" = "xyes"; then
494 if test "x$nan_type" = "xnone"; then
495 AC_CACHE_CHECK([whether NAN is defined by default],
502 static float foo = NAN;
510 [have_nan_default="yes"],
511 [have_nan_default="no"]
514 if test "x$have_nan_default" = "xyes"
519 if test "x$nan_type" = "xnone"; then
520 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
526 #define __USE_ISOC99 1
528 static float foo = NAN;
536 [have_nan_isoc="yes"],
540 if test "x$have_nan_isoc" = "xyes"
545 if test "x$nan_type" = "xnone"; then
546 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
556 #define NAN (0.0 / 0.0)
558 # define isnan(f) ((f) != (f))
560 static float foo = NAN;
568 [have_nan_zero="yes"],
572 if test "x$have_nan_zero" = "xyes"
578 if test "x$nan_type" = "xdefault"; then
579 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
580 [Define if NAN is defined by default and can initialize static variables.])
581 else if test "x$nan_type" = "xisoc99"; then
582 AC_DEFINE(NAN_STATIC_ISOC, 1,
583 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
584 else if test "x$nan_type" = "xzero"; then
585 AC_DEFINE(NAN_ZERO_ZERO, 1,
586 [Define if NAN can be defined as (0.0 / 0.0)])
588 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
591 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
593 if test "x$withval" = "xnothing"; then
594 fp_layout_type="nothing"
595 else if test "x$withval" = "xendianflip"; then
596 fp_layout_type="endianflip"
597 else if test "x$withval" = "xintswap"; then
598 fp_layout_type="intswap"
600 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
603 [fp_layout_type="unknown"])
605 if test "x$fp_layout_type" = "xunknown"; then
606 AC_CACHE_CHECK([if doubles are stored in x86 representation],
607 [fp_layout_need_nothing],
623 memcpy ((void *) &i0, (void *) &d, 8);
626 memcpy ((void *) c, (void *) &i1, 8);
628 if ((c[0] == 0x2f) && (c[1] == 0x25)
629 && (c[2] == 0xc0) && (c[3] == 0xc7)
630 && (c[4] == 0x43) && (c[5] == 0x2b)
631 && (c[6] == 0x1f) && (c[7] == 0x5b))
636 [fp_layout_need_nothing="yes"],
637 [fp_layout_need_nothing="no"]
640 if test "x$fp_layout_need_nothing" = "xyes"; then
641 fp_layout_type="nothing"
644 if test "x$fp_layout_type" = "xunknown"; then
645 AC_CACHE_CHECK([if endianflip converts to x86 representation],
646 [fp_layout_need_endianflip],
654 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
655 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
656 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
657 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
658 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
659 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
660 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
661 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
670 memcpy ((void *) &i0, (void *) &d, 8);
672 i1 = endianflip (i0);
673 memcpy ((void *) c, (void *) &i1, 8);
675 if ((c[0] == 0x2f) && (c[1] == 0x25)
676 && (c[2] == 0xc0) && (c[3] == 0xc7)
677 && (c[4] == 0x43) && (c[5] == 0x2b)
678 && (c[6] == 0x1f) && (c[7] == 0x5b))
683 [fp_layout_need_endianflip="yes"],
684 [fp_layout_need_endianflip="no"]
687 if test "x$fp_layout_need_endianflip" = "xyes"; then
688 fp_layout_type="endianflip"
691 if test "x$fp_layout_type" = "xunknown"; then
692 AC_CACHE_CHECK([if intswap converts to x86 representation],
693 [fp_layout_need_intswap],
701 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
702 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
711 memcpy ((void *) &i0, (void *) &d, 8);
714 memcpy ((void *) c, (void *) &i1, 8);
716 if ((c[0] == 0x2f) && (c[1] == 0x25)
717 && (c[2] == 0xc0) && (c[3] == 0xc7)
718 && (c[4] == 0x43) && (c[5] == 0x2b)
719 && (c[6] == 0x1f) && (c[7] == 0x5b))
724 [fp_layout_need_intswap="yes"],
725 [fp_layout_need_intswap="no"]
728 if test "x$fp_layout_need_intswap" = "xyes"; then
729 fp_layout_type="intswap"
733 if test "x$fp_layout_type" = "xnothing"; then
734 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
735 [Define if doubles are stored in x86 representation.])
736 else if test "x$fp_layout_type" = "xendianflip"; then
737 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
738 [Define if endianflip is needed to convert to x86 representation.])
739 else if test "x$fp_layout_type" = "xintswap"; then
740 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
741 [Define if intswap is needed to convert to x86 representation.])
743 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
747 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
749 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
751 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
754 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
755 if test "x$have_getmntent" = "xno"; then
756 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
758 if test "x$have_getmntent" = "xno"; then
759 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
761 if test "x$have_getmntent" = "xno"; then
762 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
765 if test "x$have_getmntent" = "xc"; then
766 AC_CACHE_CHECK([whether getmntent takes one argument],
767 [have_one_getmntent],
769 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
771 #include "$srcdir/src/utils_mount.h"]],
775 fh = setmntent ("/etc/mtab", "r");
779 [have_one_getmntent="yes"],
780 [have_one_getmntent="no"]
783 AC_CACHE_CHECK([whether getmntent takes two arguments],
784 [have_two_getmntent],
786 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
787 #include <sys/mnttab.h>
788 #include "$srcdir/src/utils_mount.h"]],
793 fh = fopen ("/etc/mnttab", "r");
794 status = getmntent (fh, &mt);
797 [have_two_getmntent="yes"],
798 [have_two_getmntent="no"]
803 # Check for different versions of `getmntent' here..
805 if test "x$have_getmntent" = "xc"; then
806 if test "x$have_one_getmntent" = "xyes"; then
807 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
808 [Define if the function getmntent exists and takes one argument.])
810 if test "x$have_two_getmntent" = "xyes"; then
811 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
812 [Define if the function getmntent exists and takes two arguments.])
815 if test "x$have_getmntent" = "xsun"; then
816 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
817 [Define if the function getmntent exists. It's the version from libsun.])
819 if test "x$have_getmntent" = "xseq"; then
820 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
821 [Define if the function getmntent exists. It's the version from libseq.])
823 if test "x$have_getmntent" = "xgen"; then
824 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
825 [Define if the function getmntent exists. It's the version from libgen.])
828 # Check for structures
829 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
830 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
833 #include <sys/types.h>
834 #include <sys/socket.h>
837 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
838 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
841 #include <sys/types.h>
842 #include <sys/socket.h>
843 #include <linux/if.h>
844 #include <linux/netdevice.h>
847 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
852 # include <sys/types.h>
854 #if HAVE_NETINET_IN_SYSTM_H
855 # include <netinet/in_systm.h>
857 #if HAVE_NETINET_IN_H
858 # include <netinet/in.h>
860 #if HAVE_NETINET_IP_H
861 # include <netinet/ip.h>
863 #if HAVE_NETINET_UDP_H
864 # include <netinet/udp.h>
867 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
872 # include <sys/types.h>
874 #if HAVE_NETINET_IN_SYSTM_H
875 # include <netinet/in_systm.h>
877 #if HAVE_NETINET_IN_H
878 # include <netinet/in.h>
880 #if HAVE_NETINET_IP_H
881 # include <netinet/ip.h>
883 #if HAVE_NETINET_UDP_H
884 # include <netinet/udp.h>
888 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
898 # Checks for libraries begin here
901 AC_CHECK_LIB(resolv, res_search,
903 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
905 [with_libresolv="no"])
906 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
908 dnl Check for HAL (hardware abstraction library)
910 AC_CHECK_LIB(hal,libhal_device_property_exists,
911 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
913 if test "x$with_libhal" = "xyes"; then
914 if test "x$PKG_CONFIG" != "x"; then
915 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
916 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
917 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
918 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
922 m4_divert_once([HELP_WITH], [
923 collectd additional packages:])
925 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
928 librrd_threadsafe="yes"
929 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
930 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
932 librrd_cflags="-I$withval/include"
933 librrd_ldflags="-L$withval/lib"
936 with_rrdtool="$withval"
938 ], [with_rrdtool="yes"])
939 if test "x$with_rrdtool" = "xyes"
941 SAVE_CPPFLAGS="$CPPFLAGS"
942 SAVE_LDFLAGS="$LDFLAGS"
944 CPPFLAGS="$CPPFLAGS $librrd_cflags"
945 LDFLAGS="$LDFLAGS $librrd_ldflags"
947 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
949 CPPFLAGS="$SAVE_CPPFLAGS"
950 LDFLAGS="$SAVE_LDFLAGS"
952 if test "x$with_rrdtool" = "xyes"
954 SAVE_CPPFLAGS="$CPPFLAGS"
955 SAVE_LDFLAGS="$LDFLAGS"
957 CPPFLAGS="$CPPFLAGS $librrd_cflags"
958 LDFLAGS="$LDFLAGS $librrd_ldflags"
960 AC_CHECK_LIB(rrd_th, rrd_update_r,
962 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
964 [librrd_threadsafe="no"
965 AC_CHECK_LIB(rrd, rrd_update,
967 librrd_ldflags="$librrd_ldflags -lrrd -lm"
969 [with_rrdtool="no (symbol 'rrd_update' not found)"],
974 CPPFLAGS="$SAVE_CPPFLAGS"
975 LDFLAGS="$SAVE_LDFLAGS"
977 if test "x$with_rrdtool" = "xyes"
979 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
980 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
981 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
982 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
984 if test "x$librrd_threadsafe" = "xyes"
986 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
989 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
990 [ if test "x$withval" != "xno" \
991 && test "x$withval" != "xyes"
993 LDFLAGS="$LDFLAGS -L$withval/lib"
994 CPPFLAGS="$CPPFLAGS -I$withval/include"
995 with_libpthread="yes"
997 if test "x$withval" = "xno"
999 with_libpthread="no (disabled)"
1002 ], [with_libpthread="yes"])
1003 if test "x$with_libpthread" = "xyes"
1005 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
1007 if test "x$with_libpthread" = "xyes"
1009 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
1011 if test "x$with_libpthread" = "xyes"
1017 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
1018 [Wether or not to use pthread (POSIX threads) library])
1019 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
1021 if test "x$ac_system" = "xSolaris"
1026 with_kstat="no (Solaris only)"
1027 with_devinfo="no (Solaris only)"
1030 if test "x$with_kstat" = "xyes"
1032 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1034 if test "x$with_kstat" = "xyes"
1036 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1037 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1039 if test "x$with_kstat" = "xyes"
1041 AC_DEFINE(HAVE_LIBKSTAT, 1,
1042 [Define to 1 if you have the 'kstat' library (-lkstat)])
1044 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1045 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1047 ### BEGIN of check for libcurl ###
1048 with_curl_config="curl-config"
1051 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1053 if test "x$withval" = "xno"
1056 else if test "x$withval" = "xyes"
1060 if test -f "$withval" && test -x "$withval"
1062 with_curl_config="$withval"
1064 else if test -x "$withval/bin/curl-config"
1066 with_curl_config="$withval/bin/curl-config"
1075 if test "x$with_libcurl" = "xyes"
1077 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1078 curl_config_status=$?
1080 if test $curl_config_status -ne 0
1082 with_libcurl="no ($with_curl_config failed)"
1084 SAVE_CPPFLAGS="$CPPFLAGS"
1085 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1087 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1089 CPPFLAGS="$SAVE_CPPFLAGS"
1092 if test "x$with_libcurl" = "xyes"
1094 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1095 curl_config_status=$?
1097 if test $curl_config_status -ne 0
1099 with_libcurl="no ($with_curl_config failed)"
1101 AC_CHECK_LIB(curl, curl_easy_init,
1102 [with_libcurl="yes"],
1103 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1107 if test "x$with_libcurl" = "xyes"
1109 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1110 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1111 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1112 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1114 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1115 ### END of check for libcurl ###
1118 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1125 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1127 with_libstatgrab_cflags=""
1128 with_libstatgrab_ldflags=""
1129 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
1131 if test "x$withval" != "xno" \
1132 && test "x$withval" != "xyes"
1134 with_libstatgrab_cflags="-I$withval/include"
1135 with_libstatgrab_ldflags="-L$withval/lib"
1136 with_libstatgrab="yes"
1138 with_libstatgrab="$withval"
1142 if test "x$ac_system" = "xunknown"
1144 with_libstatgrab="yes"
1146 with_libstatgrab="no"
1149 with_libstatgrab_pkg_config="yes"
1150 if test "x$with_libstatgrab" = "xyes" \
1151 && test "x$PKG_CONFIG" != "x"
1153 AC_MSG_CHECKING([pkg-config for libstatgrab])
1155 $PKG_CONFIG --exists libstatgrab 2>/dev/null
1158 with_libstatgrab_pkg_config="no"
1159 temp_result="not found"
1161 AC_MSG_RESULT([$temp_result])
1163 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
1164 with_libstatgrab_pkg_config="no"
1165 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
1168 if test "x$with_libstatgrab" = "xyes" \
1169 && test "x$with_libstatgrab_pkg_config" = "xyes" \
1170 && test "x$with_libstatgrab_cflags" = "x"
1172 AC_MSG_CHECKING([for libstatgrab CFLAGS])
1173 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
1176 with_libstatgrab_cflags="$temp_result"
1178 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
1179 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
1181 AC_MSG_RESULT([$temp_result])
1184 if test "x$with_libstatgrab" = "xyes" \
1185 && test "x$with_libstatgrab_pkg_config" = "xyes" \
1186 && test "x$with_libstatgrab_ldflags" = "x"
1188 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
1189 temp_result="`$PKG_CONFIG --libs libstatgrab`"
1192 with_libstatgrab_ldflags="$temp_result"
1194 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
1195 temp_result="$PKG_CONFIG --libs libstatgrab failed"
1197 AC_MSG_RESULT([$temp_result])
1200 if test "x$with_libstatgrab" = "xyes"
1202 SAVE_CPPFLAGS="$CPPFLAGS"
1203 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
1205 AC_CHECK_HEADERS(statgrab.h,
1206 [with_libstatgrab="yes"],
1207 [with_libstatgrab="no (statgrab.h not found)"])
1209 CPPFLAGS="$SAVE_CPPFLAGS"
1212 if test "x$with_libstatgrab" = "xyes"
1214 SAVE_CFLAGS="$CFLAGS"
1215 SAVE_LDFLAGS="$LDFLAGS"
1217 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
1218 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
1220 AC_CHECK_LIB(statgrab, sg_init,
1221 [with_libstatgrab="yes"],
1222 [with_libstatgrab="no (symbol sg_init not found)"])
1224 CFLAGS="$SAVE_CFLAGS"
1225 LDFLAGS="$SAVE_LDFLAGS"
1228 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
1229 if test "x$with_libstatgrab" = "xyes"
1231 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
1232 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
1233 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
1234 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
1235 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
1239 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1240 if test "x$with_kvm_getprocs" = "xyes"
1242 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1243 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1246 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1248 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1249 if test "x$with_kvm_getswapinfo" = "xyes"
1251 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1252 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1255 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1257 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1258 if test "x$with_kvm_nlist" = "xyes"
1260 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1261 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1264 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1266 with_sensors_cflags=""
1267 with_sensors_ldflags=""
1268 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
1270 if test "x$withval" = "xno"
1272 with_lm_sensors="no"
1274 with_lm_sensors="yes"
1275 if test "x$withval" != "xyes"
1277 with_sensors_cflags="-I$withval/include"
1278 with_sensors_ldflags="-L$withval/lib"
1279 with_lm_sensors="yes"
1284 if test "x$ac_system" = "xLinux"
1286 with_lm_sensors="yes"
1288 with_lm_sensors="no (Linux only library)"
1291 if test "x$with_lm_sensors" = "xyes"
1293 SAVE_CPPFLAGS="$CPPFLAGS"
1294 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
1296 # AC_CHECK_HEADERS(sensors/sensors.h,
1298 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
1300 # [with_lm_sensors="no (sensors/sensors.h not found)"])
1301 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_lm_sensors="no (sensors/sensors.h not found)"])
1303 CPPFLAGS="$SAVE_CPPFLAGS"
1305 if test "x$with_lm_sensors" = "xyes"
1307 SAVE_CPPFLAGS="$CPPFLAGS"
1308 SAVE_LDFLAGS="$LDFLAGS"
1309 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
1310 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
1312 AC_CHECK_LIB(sensors, sensors_init,
1314 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
1316 [with_lm_sensors="no (libsensors not found)"])
1318 CPPFLAGS="$SAVE_CPPFLAGS"
1319 LDFLAGS="$SAVE_LDFLAGS"
1321 if test "x$with_lm_sensors" = "xyes"
1323 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
1324 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
1325 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
1326 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
1328 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
1330 with_mysql_config="mysql_config"
1331 with_mysql_cflags=""
1333 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1335 if test "x$withval" = "xno"
1338 else if test "x$withval" = "xyes"
1342 if test -f "$withval" && test -x "$withval";
1344 with_mysql_config="$withval"
1345 else if test -x "$withval/bin/mysql_config"
1347 with_mysql_config="$withval/bin/mysql_config"
1355 if test "x$with_libmysql" = "xyes"
1357 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1358 mysql_config_status=$?
1360 if test $mysql_config_status -ne 0
1364 SAVE_CPPFLAGS="$CPPFLAGS"
1365 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
1367 AC_CHECK_HEADERS(mysql/mysql.h, [], [with_libmysql="no (mysql/mysql.h not found)"], [])
1369 CPPFLAGS="$SAVE_CPPFLAGS"
1372 if test "x$with_libmysql" = "xyes"
1374 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
1375 mysql_config_status=$?
1377 if test $mysql_config_status -ne 0
1381 AC_CHECK_LIB(mysqlclient, mysql_init,
1382 [with_libmysql="yes"],
1383 [with_libmysql="no (symbol 'mysql_init' not found)"],
1387 if test "x$with_libmysql" = "xyes"
1389 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
1390 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
1391 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
1392 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
1394 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
1396 with_own_liboconfig="no"
1397 liboconfig_LDFLAGS="$LDFLAGS"
1398 liboconfig_CPPFLAGS="$CPPFLAGS"
1399 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1401 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1403 if test -d "$withval/lib"
1405 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1407 if test -d "$withval/include"
1409 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1412 if test "x$withval" = "xno"
1414 AC_MSG_ERROR("liboconfig is required")
1418 with_liboconfig="yes"
1421 save_LDFLAGS="$LDFLAGS"
1422 save_CPPFLAGS="$CPPFLAGS"
1423 LDFLAGS="$liboconfig_LDFLAGS"
1424 CPPFLAGS="$liboconfig_CPPFLAGS"
1425 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1427 with_liboconfig="yes"
1428 with_own_liboconfig="no"
1431 with_liboconfig="yes"
1432 with_own_liboconfig="yes"
1433 LDFLAGS="$save_LDFLAGS"
1434 CPPFLAGS="$save_CPPFLAGS"
1437 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1438 if test "x$with_own_liboconfig" = "xyes"
1440 with_liboconfig="yes (shipped version)"
1443 #with_liboping="yes"
1444 with_own_liboping="no"
1445 liboping_LDFLAGS="$LDFLAGS"
1446 liboping_CPPFLAGS="$CPPFLAGS"
1447 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1449 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1451 if test -d "$withval/lib"
1453 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
1455 if test -d "$withval/include"
1457 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
1460 if test "x$withval" = "xno"
1463 with_own_liboping="no"
1464 else if test "x$withval" = "xyes"
1473 if test "x$with_liboping" = "xyes"
1475 save_LDFLAGS="$LDFLAGS"
1476 save_CPPFLAGS="$CPPFLAGS"
1477 LDFLAGS="$liboping_LDFLAGS"
1478 CPPFLAGS="$liboping_CPPFLAGS"
1479 AC_CHECK_LIB(oping, ping_construct,
1482 with_own_liboping="no"
1486 with_own_liboping="yes"
1487 LDFLAGS="$save_LDFLAGS"
1488 CPPFLAGS="$save_CPPFLAGS"
1491 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1492 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1494 with_libowcapi_cppflags=""
1495 with_libowcapi_libs="-lowcapi"
1496 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
1498 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1500 with_libowcapi_cppflags="-I$withval/include"
1501 with_libowcapi_libs="-L$withval/lib -lowcapi"
1502 with_libowcapi="yes"
1504 with_libowcapi="$withval"
1508 with_libowcapi="yes"
1510 if test "x$with_libowcapi" = "xyes"
1512 SAVE_CPPFLAGS="$CPPFLAGS"
1513 CPPFLAGS="$with_libowcapi_cppflags"
1515 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
1517 CPPFLAGS="$SAVE_CPPFLAGS"
1519 if test "x$with_libowcapi" = "xyes"
1521 SAVE_LDFLAGS="$LDFLAGS"
1522 SAVE_CPPFLAGS="$CPPFLAGS"
1523 LDFLAGS="$with_libowcapi_libs"
1524 CPPFLAGS="$with_libowcapi_cppflags"
1526 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
1528 LDFLAGS="$SAVE_LDFLAGS"
1529 CPPFLAGS="$SAVE_CPPFLAGS"
1531 if test "x$with_libowcapi" = "xyes"
1533 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
1534 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
1535 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
1536 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
1540 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1542 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1544 LDFLAGS="$LDFLAGS -L$withval/lib"
1545 CPPFLAGS="$CPPFLAGS -I$withval/include"
1548 with_libpcap="$withval"
1554 if test "x$with_libpcap" = "xyes"
1556 AC_CHECK_LIB(pcap, pcap_open_live,
1558 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1559 ], [with_libpcap="no (libpcap not found)"])
1561 if test "x$with_libpcap" = "xyes"
1563 AC_CHECK_HEADERS(pcap.h,
1565 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1566 ], [with_libpcap="no (pcap.h not found)"])
1568 if test "x$with_libpcap" = "xyes"
1574 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1575 [Wether or not to use the pcap library])
1576 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1578 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1580 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1582 LDFLAGS="$LDFLAGS -L$withval/lib"
1583 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1586 with_libesmtp="$withval"
1592 if test "x$with_libesmtp" = "xyes"
1594 AC_CHECK_LIB(esmtp, smtp_create_session,
1596 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1597 ], [with_libesmtp="no (libesmtp not found)"])
1599 if test "x$with_libesmtp" = "xyes"
1601 AC_CHECK_HEADERS(libesmtp.h,
1603 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1604 ], [with_libesmtp="no (libesmtp.h not found)"])
1606 if test "x$with_libesmtp" = "xyes"
1612 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1613 [Wether or not to use the esmtp library])
1614 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1616 perl_interpreter="perl"
1617 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1619 if test -x "$withval"
1621 perl_interpreter="$withval"
1623 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
1625 LDFLAGS="$LDFLAGS -L$withval/lib"
1626 CPPFLAGS="$CPPFLAGS -I$withval/include"
1627 perl_interpreter="$withval/bin/perl"
1630 with_libperl="$withval"
1637 AC_MSG_CHECKING([for perl])
1638 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
1639 if test -x "$perl_interpreter"
1641 AC_MSG_RESULT([yes ($perl_interpreter)])
1647 AC_SUBST(PERL, "$perl_interpreter")
1649 if test "x$with_libperl" = "xyes" \
1650 && test -n "$perl_interpreter"
1653 SAVE_LDFLAGS=$LDFLAGS
1654 PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
1655 PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
1656 CFLAGS="$CFLAGS $PERL_CFLAGS"
1657 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1659 AC_CACHE_CHECK([for libperl],
1664 #define PERL_NO_GET_CONTEXT
1671 load_module (PERL_LOADMOD_NOIMPORT,
1672 newSVpv ("Collectd::Plugin::FooBar", 24),
1675 [have_libperl="yes"],
1680 if test "x$have_libperl" = "xyes"
1682 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
1683 AC_SUBST(PERL_CFLAGS)
1684 AC_SUBST(PERL_LDFLAGS)
1690 LDFLAGS=$SAVE_LDFLAGS
1691 else if test -z "$perl_interpreter"; then
1692 with_libperl="no (no perl interpreter found)"
1695 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1697 if test "x$with_libperl" = "xyes"
1700 SAVE_LDFLAGS=$LDFLAGS
1701 CFLAGS="$CFLAGS $PERL_CFLAGS"
1702 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1704 AC_CACHE_CHECK([if perl supports ithreads],
1705 [have_perl_ithreads],
1713 #if !defined(USE_ITHREADS)
1714 # error "Perl does not support ithreads!"
1715 #endif /* !defined(USE_ITHREADS) */
1718 [have_perl_ithreads="yes"],
1719 [have_perl_ithreads="no"]
1723 if test "x$have_perl_ithreads" = "xyes"
1725 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
1729 LDFLAGS=$SAVE_LDFLAGS
1732 with_own_libiptc="no"
1733 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1735 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1737 LDFLAGS="$LDFLAGS -L$withval/lib"
1738 CPPFLAGS="$CPPFLAGS -I$withval/include"
1741 with_libiptc="$withval"
1745 if test "x$ac_system" = "xLinux"
1749 with_libiptc="no (Linux only)"
1752 if test "x$with_libiptc" = "xyes"
1754 AC_CHECK_LIB(iptc, iptc_init,
1756 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1760 with_own_libiptc="yes"
1763 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" != "xyes"
1765 AC_CHECK_HEADERS(libiptc/libiptc.h,
1767 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1771 with_own_libiptc="yes"
1774 if test "x$with_libiptc" = "xyes"
1777 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
1779 AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h, [],
1781 with_libiptc="no (Linux iptables headers not found - check KERNEL_DIR)"
1782 with_own_libiptc="no"
1785 #include "$srcdir/src/libiptc/ipt_kernel_headers.h"
1790 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1791 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_own_libiptc" = "xyes")
1792 if test "x$with_own_libiptc" = "xyes"
1794 AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1797 with_snmp_config="net-snmp-config"
1800 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1802 if test "x$withval" = "xno"
1804 with_libnetsnmp="no"
1805 else if test "x$withval" = "xyes"
1807 with_libnetsnmp="yes"
1809 if test -x "$withval"
1811 with_snmp_config="$withval"
1812 with_libnetsnmp="yes"
1814 with_snmp_config="$withval/bin/net-snmp-config"
1815 with_libnetsnmp="yes"
1819 [with_libnetsnmp="yes"])
1820 if test "x$with_libnetsnmp" = "xyes"
1822 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
1823 snmp_config_status=$?
1825 if test $snmp_config_status -ne 0
1827 with_libnetsnmp="no ($with_snmp_config failed)"
1829 SAVE_CPPFLAGS="$CPPFLAGS"
1830 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
1832 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1834 CPPFLAGS="$SAVE_CPPFLAGS"
1837 if test "x$with_libnetsnmp" = "xyes"
1839 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
1840 snmp_config_status=$?
1842 if test $snmp_config_status -ne 0
1844 with_libnetsnmp="no ($with_snmp_config failed)"
1846 AC_CHECK_LIB(netsnmp, init_snmp,
1847 [with_libnetsnmp="yes"],
1848 [with_libnetsnmp="no (libnetsnmp not found)"],
1852 if test "x$with_libnetsnmp" = "xyes"
1854 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
1855 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
1856 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
1857 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
1859 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1861 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
1862 [with_libnotify="yes"],
1863 [with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"])
1865 with_libupsclient="no (pkg-config isn't available)"
1866 with_libupsclient_cflags=""
1867 with_libupsclient_libs=""
1868 if test "x$PKG_CONFIG" != "x"
1870 pkg-config --exists 'libupsclient' 2>/dev/null
1873 with_libupsclient="yes"
1875 with_libupsclient="no (pkg-config doesn't know library)"
1878 if test "x$with_libupsclient" = "xyes"
1880 with_libupsclient_cflags="`pkg-config --cflags 'libupsclient'`"
1883 with_libupsclient="no"
1885 with_libupsclient_libs="`pkg-config --libs 'libupsclient'`"
1888 with_libupsclient="no"
1891 if test "x$with_libupsclient" = "xyes"
1893 SAVE_CPPFLAGS="$CPPFLAGS"
1894 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
1896 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
1898 CPPFLAGS="$SAVE_CPPFLAGS"
1900 if test "x$with_libupsclient" = "xyes"
1902 SAVE_CPPFLAGS="$CPPFLAGS"
1903 SAVE_LDFLAGS="$LDFLAGS"
1905 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
1906 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
1908 AC_CHECK_LIB(upsclient, upscli_connect,
1909 [with_libupsclient="yes"],
1910 [with_libupsclient="no (symbol upscli_connect not found)"])
1912 CPPFLAGS="$SAVE_CPPFLAGS"
1913 LDFLAGS="$SAVE_LDFLAGS"
1915 if test "x$with_libupsclient" = "xyes"
1917 SAVE_CPPFLAGS="$CPPFLAGS"
1918 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
1920 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
1921 [#include <stdlib.h>
1923 #include <upsclient.h>])
1925 CPPFLAGS="$SAVE_CPPFLAGS"
1927 if test "x$with_libupsclient" = "xyes"
1929 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
1930 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
1931 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
1932 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
1935 ### BEGIN of check for libxmms ###
1936 with_xmms_config="xmms-config"
1939 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
1941 if test "x$withval" != "xno" \
1942 && test "x$withval" != "xyes"
1944 if test -f "$withval" && test -x "$withval";
1946 with_xmms_config="$withval"
1947 else if test -x "$withval/bin/xmms-config"
1949 with_xmms_config="$withval/bin/xmms-config"
1952 else if test "x$withval" = "xno"
1962 if test "x$with_libxmms" = "xyes"
1964 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
1965 xmms_config_status=$?
1967 if test $xmms_config_status -ne 0
1972 if test "x$with_libxmms" = "xyes"
1974 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
1975 xmms_config_status=$?
1977 if test $xmms_config_status -ne 0
1982 if test "x$with_libxmms" = "xyes"
1984 AC_CHECK_LIB(xmms, xmms_remote_get_info,
1986 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
1987 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
1988 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
1989 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
1996 with_libxmms_numeric=0
1997 if test "x$with_libxmms" = "xyes"
1999 with_libxmms_numeric=1
2001 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
2002 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
2003 ### END of check for libxmms ###
2005 with_libnetlink_cflags=""
2006 with_libnetlink_libs="-lnetlink"
2007 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
2009 echo "libnetlink: withval = $withval"
2010 if test "x$withval" = "xyes"
2012 with_libnetlink="yes"
2013 else if test "x$withval" = "xno"
2015 with_libnetlink="no"
2017 if test -d "$withval/include"
2019 with_libnetlink_cflags="-I$withval/include"
2020 with_libnetlink_libs="-L$withval/lib -lnetlink"
2021 with_libnetlink="yes"
2023 AC_MSG_ERROR("no such directory: $withval/include")
2028 if test "x$ac_system" = "xLinux"
2030 with_libnetlink="yes"
2032 with_libnetlink="no (Linux only library)"
2035 if test "x$with_libnetlink" = "xyes"
2038 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2040 with_libnetlink="no (libnetlink.h not found)"
2042 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
2044 with_libnetlink="yes"
2048 #include <sys/types.h>
2049 #include <asm/types.h>
2050 #include <sys/socket.h>
2051 #include <linux/netlink.h>
2052 #include <linux/rtnetlink.h>])
2053 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2055 #include <sys/types.h>
2056 #include <asm/types.h>
2057 #include <sys/socket.h>])
2061 #include <sys/types.h>
2062 #include <asm/types.h>
2063 #include <sys/socket.h>
2064 #include <linux/netlink.h>
2065 #include <linux/rtnetlink.h>
2069 int retval = TCA_STATS2;
2072 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
2077 #include <sys/types.h>
2078 #include <asm/types.h>
2079 #include <sys/socket.h>
2080 #include <linux/netlink.h>
2081 #include <linux/rtnetlink.h>
2085 int retval = TCA_STATS;
2088 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
2091 CFLAGS="$SAVE_CFLAGS"
2093 if test "x$with_libnetlink" = "xyes"
2095 AC_CHECK_LIB(netlink, rtnl_open,
2096 [with_libnetlink="yes"],
2097 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
2098 [$with_libnetlink_libs])
2100 if test "x$with_libnetlink" = "xyes"
2102 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
2103 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
2104 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
2105 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
2107 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
2109 with_libopenipmipthread="yes"
2110 with_libopenipmipthread_cflags=""
2111 with_libopenipmipthread_libs=""
2113 AC_MSG_CHECKING([for pkg-config])
2115 if test "x$PKG_CONFIG" = "x"
2117 with_libopenipmipthread="no"
2120 temp_result="$PKG_CONFIG"
2122 AC_MSG_RESULT([$temp_result])
2124 if test "x$with_libopenipmipthread" = "xyes"
2126 AC_MSG_CHECKING([for libOpenIPMIpthread])
2127 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
2130 with_libopenipmipthread="no ($PKG_CONFIG doesn't know OpenIPMIpthread)"
2132 AC_MSG_RESULT([$with_libopenipmipthread])
2135 if test "x$with_libopenipmipthread" = "xyes"
2137 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
2138 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
2141 with_libopenipmipthread_cflags="$temp_result"
2143 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
2144 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
2146 AC_MSG_RESULT([$temp_result])
2149 if test "x$with_libopenipmipthread" = "xyes"
2151 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
2152 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
2155 with_libopenipmipthread_ldflags="$temp_result"
2157 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
2158 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
2160 AC_MSG_RESULT([$temp_result])
2163 if test "x$with_libopenipmipthread" = "xyes"
2165 SAVE_CPPFLAGS="$CPPFLAGS"
2166 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
2168 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
2169 [with_libopenipmipthread="yes"],
2170 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
2171 [#include <OpenIPMI/ipmiif.h>
2172 #include <OpenIPMI/ipmi_err.h>
2173 #include <OpenIPMI/ipmi_posix.h>
2174 #include <OpenIPMI/ipmi_conn.h>
2177 CPPFLAGS="$SAVE_CPPFLAGS"
2180 if test "x$with_libopenipmipthread" = "xyes"
2182 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
2183 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
2184 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
2185 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
2188 dnl Check for libpq.
2189 with_pg_config="pg_config"
2190 with_libpq_includedir=""
2191 with_libpq_libdir=""
2192 with_libpq_cppflags=""
2193 with_libpq_ldflags=""
2194 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
2197 if test "x$withval" = "xno"
2200 else if test "x$withval" = "xyes"
2204 if test -f "$withval" && test -x "$withval";
2206 with_pg_config="$withval"
2207 else if test -x "$withval/bin/pg_config"
2209 with_pg_config="$withval/bin/pg_config"
2217 if test "x$with_libpq" = "xyes"
2219 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
2222 if test $pg_config_status -eq 0
2224 if test -n "$with_libpq_includedir"; then
2225 for dir in $with_libpq_includedir; do
2226 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
2230 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2233 SAVE_CPPFLAGS="$CPPFLAGS"
2234 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
2236 AC_CHECK_HEADERS(libpq-fe.h, [],
2237 [with_libpq="no (libpq-fe.h not found)"], [])
2239 CPPFLAGS="$SAVE_CPPFLAGS"
2241 if test "x$with_libpq" = "xyes"
2243 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
2246 if test $pg_config_status -eq 0
2248 if test -n "$with_libpq_libdir"; then
2249 for dir in $with_libpq_libdir; do
2250 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
2254 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2257 SAVE_LDFLAGS="$LDFLAGS"
2258 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
2260 AC_CHECK_LIB(pq, PQconnectdb,
2262 [with_libpq="no (symbol 'PQconnectdb' not found)"])
2264 LDFLAGS="$SAVE_LDFLAGS"
2266 if test "x$with_libpq" = "xyes"
2268 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
2269 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
2270 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
2271 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
2273 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
2275 dnl Check for libvirt and libxml2 libraries.
2276 with_libxml2="no (pkg-config isn't available)"
2277 with_libxml2_cflags=""
2278 with_libxml2_ldflags=""
2279 with_libvirt="no (pkg-config isn't available)"
2280 with_libvirt_cflags=""
2281 with_libvirt_ldflags=""
2282 if test "x$PKG_CONFIG" != "x"
2284 pkg-config --exists 'libxml-2.0' 2>/dev/null
2289 with_libxml2="no (pkg-config doesn't know library)"
2292 pkg-config --exists libvirt 2>/dev/null
2297 with_libvirt="no (pkg-config doesn't know library)"
2300 if test "x$with_libxml2" = "xyes"
2302 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
2307 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
2313 if test "x$with_libxml2" = "xyes"
2315 SAVE_CPPFLAGS="$CPPFLAGS"
2316 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
2318 AC_CHECK_HEADERS(libxml/parser.h, [],
2319 [with_libxml2="no (libxml/parser.h not found)"])
2321 CPPFLAGS="$SAVE_CPPFLAGS"
2323 if test "x$with_libxml2" = "xyes"
2325 SAVE_CFLAGS="$CFLAGS"
2326 SAVE_LDFLAGS="$LDFLAGS"
2328 CFLAGS="$CFLAGS $with_libxml2_cflags"
2329 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
2331 AC_CHECK_LIB(xml2, xmlXPathEval,
2332 [with_libxml2="yes"],
2333 [with_libxml2="no (symbol xmlXPathEval not found)"])
2335 CFLAGS="$SAVE_CFLAGS"
2336 LDFLAGS="$SAVE_LDFLAGS"
2338 dnl Add the right compiler flags and libraries.
2339 if test "x$with_libxml2" = "xyes"; then
2340 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
2341 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
2342 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
2343 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
2345 if test "x$with_libvirt" = "xyes"
2347 with_libvirt_cflags="`pkg-config --cflags libvirt`"
2352 with_libvirt_ldflags="`pkg-config --libs libvirt`"
2358 if test "x$with_libvirt" = "xyes"
2360 SAVE_CPPFLAGS="$CPPFLAGS"
2361 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
2363 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
2364 [with_libvirt="no (libvirt/libvirt.h not found)"])
2366 CPPFLAGS="$SAVE_CPPFLAGS"
2368 if test "x$with_libvirt" = "xyes"
2370 SAVE_CFLAGS="$CFLAGS"
2371 SAVE_LDFLAGS="$LDFLAGS"
2373 CFLAGS="$CFLAGS $with_libvirt_cflags"
2374 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
2376 AC_CHECK_LIB(virt, virDomainBlockStats,
2377 [with_libvirt="yes"],
2378 [with_libvirt="no (symbol virDomainBlockStats not found)"])
2380 CFLAGS="$SAVE_CFLAGS"
2381 LDFLAGS="$SAVE_LDFLAGS"
2383 dnl Add the right compiler flags and libraries.
2384 if test "x$with_libvirt" = "xyes"; then
2385 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
2386 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
2387 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
2388 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
2391 dnl End of check for libvirt and libxml2 libraries.
2393 # Check for enabled/disabled features
2396 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
2397 # ------------------------------------------------------------
2399 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
2404 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
2409 m4_define([EnDis],[disabled])dnl
2410 m4_define([YesNo],[no])dnl
2416 m4_define([EnDis],[enabled])dnl
2417 m4_define([YesNo],[yes])dnl
2420 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
2424 m4_if([$3], [feature], [],
2428 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
2434 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
2436 enable_$1='[YesNo]'dnl
2438 if test "x$enable_$1" = "xno"
2442 if test "x$enable_$1" = "xyes"
2446 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
2451 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
2452 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
2454 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
2456 # AC_PLUGIN(name, default, info)
2457 # ------------------------------------------------------------
2463 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
2465 if test "x$enableval" = "xyes"
2473 if test "x$2" = "xyes"
2480 if test "x$enable_plugin" = "xyes"
2482 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
2484 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
2485 enable_$1="$enable_plugin"
2487 )# AC_PLUGIN(name, default, info)
2489 m4_divert_once([HELP_ENABLE], [
2490 collectd features:])
2491 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
2492 AC_COLLECTD([debug], [enable], [feature], [debugging])
2493 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
2494 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
2503 plugin_interface="no"
2510 plugin_multimeter="no"
2513 plugin_processes="no"
2517 plugin_tcpconns="no"
2522 plugin_wireless="no"
2525 if test "x$ac_system" = "xLinux"
2527 plugin_battery="yes"
2529 plugin_cpufreq="yes"
2531 plugin_entropy="yes"
2532 plugin_interface="yes"
2537 plugin_processes="yes"
2540 plugin_tcpconns="yes"
2541 plugin_thermal="yes"
2543 plugin_vserver="yes"
2544 plugin_wireless="yes"
2546 if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
2552 if test "x$ac_system" = "xOpenBSD"
2554 plugin_tcpconns="yes"
2558 if test "x$with_libiokit" = "xyes"
2560 plugin_battery="yes"
2565 if test "x$with_devinfo$with_kstat" = "xyesyes"
2569 plugin_interface="yes"
2576 if test "x$with_libstatgrab" = "xyes"
2580 plugin_interface="yes"
2587 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
2592 if test "x$with_libopenipmipthread" = "xyes"
2597 if test "x$have_processor_info" = "xyes"
2601 if test "x$have_sysctlbyname" = "xyes"
2605 plugin_tcpconns="yes"
2608 if test "x$have_statfs" = "xyes"
2612 if test "x$have_statvfs" = "xyes"
2617 if test "x$have_getifaddrs" = "xyes"
2619 plugin_interface="yes"
2622 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
2624 plugin_libvirt="yes"
2627 if test "x$have_getloadavg" = "xyes"
2632 if test "x$have_libperl$have_perl_ithreads" = "xyesyes"
2637 # Mac OS X memory interface
2638 if test "x$have_host_statistics" = "xyes"
2643 if test "x$have_termios_h" = "xyes"
2645 plugin_multimeter="yes"
2648 if test "x$have_thread_info" = "xyes"
2650 plugin_processes="yes"
2653 if test "x$with_kvm_getprocs" = "xyes"
2655 plugin_processes="yes"
2658 if test "x$with_kvm_getswapinfo" = "xyes"
2663 if test "x$with_kvm_nlist" = "xyes"
2665 plugin_tcpconns="yes"
2668 if test "x$have_getutent" = "xyes"
2672 if test "x$have_getutxent" = "xyes"
2677 # FIXME: sysctl for swap plugin
2679 m4_divert_once([HELP_ENABLE], [
2682 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
2683 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
2684 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
2685 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
2686 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
2687 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
2688 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
2689 AC_PLUGIN([csv], [yes], [CSV output plugin])
2690 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
2691 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
2692 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
2693 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
2694 AC_PLUGIN([email], [yes], [EMail statistics])
2695 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
2696 AC_PLUGIN([exec], [yes], [Execution of external programs])
2697 AC_PLUGIN([filecount], [yes], [Count files in directories])
2698 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
2699 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
2700 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
2701 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
2702 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
2703 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
2704 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
2705 AC_PLUGIN([load], [$plugin_load], [System load])
2706 AC_PLUGIN([logfile], [yes], [File logging plugin])
2707 AC_PLUGIN([mbmon], [yes], [Query mbmond])
2708 AC_PLUGIN([memcached], [yes], [memcached statistics])
2709 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
2710 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
2711 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
2712 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
2713 AC_PLUGIN([network], [yes], [Network communication plugin])
2714 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
2715 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
2716 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
2717 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
2718 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
2719 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
2720 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
2721 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
2722 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
2723 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
2724 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
2725 AC_PLUGIN([rrdtool], [$with_rrdtool], [RRDTool output plugin])
2726 AC_PLUGIN([sensors], [$with_lm_sensors], [lm_sensors statistics])
2727 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
2728 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
2729 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
2730 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
2731 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
2732 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
2733 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
2734 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
2735 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
2736 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
2737 AC_PLUGIN([users], [$plugin_users], [User statistics])
2738 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
2739 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
2740 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
2741 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
2742 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
2745 if test "x$ac_system" = "xLinux" \
2746 && test "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
2748 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
2752 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
2754 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2756 PERL_BINDINGS_OPTIONS="$withval"
2757 with_perl_bindings="yes"
2759 PERL_BINDINGS_OPTIONS=""
2760 with_perl_bindings="$withval"
2764 PERL_BINDINGS_OPTIONS=""
2765 if test -n "$perl_interpreter"
2767 with_perl_bindings="yes"
2769 with_perl_bindings="no (no perl interpreter found)"
2772 if test "x$with_perl_bindings" = "xyes"
2774 PERL_BINDINGS="perl"
2778 AC_SUBST(PERL_BINDINGS)
2779 AC_SUBST(PERL_BINDINGS_OPTIONS)
2781 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libiptc/Makefile src/liboconfig/Makefile src/liboping/Makefile bindings/Makefile)
2783 if test "x$with_rrdtool" = "xyes" \
2784 && test "x$librrd_threadsafe" != "xyes"
2786 with_rrdtool="yes (warning: librrd is not thread-safe)"
2789 if test "x$with_liboping" = "xyes" \
2790 && test "x$with_own_liboping" = "xyes"
2792 with_liboping="yes (shipped version)"
2795 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" = "xyes"
2797 with_libiptc="yes (shipped version)"
2800 if test "x$with_libperl" = "xyes"
2802 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
2804 enable_perl="no (needs libperl)"
2807 if test "x$with_perl_bindings" = "xyes" \
2808 && test "x$PERL_BINDINGS_OPTIONS" != "x"
2810 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
2817 libcurl . . . . . . . $with_libcurl
2818 libesmtp . . . . . . $with_libesmtp
2819 libiokit . . . . . . $with_libiokit
2820 libiptc . . . . . . . $with_libiptc
2821 libkstat . . . . . . $with_kstat
2822 libkvm . . . . . . . $with_libkvm
2823 libmysql . . . . . . $with_libmysql
2824 libnetlink . . . . . $with_libnetlink
2825 libnetsnmp . . . . . $with_libnetsnmp
2826 libnotify . . . . . . $with_libnotify
2827 liboconfig . . . . . $with_liboconfig
2828 libopenipmi . . . . . $with_libopenipmipthread
2829 liboping . . . . . . $with_liboping
2830 libpcap . . . . . . . $with_libpcap
2831 libperl . . . . . . . $with_libperl
2832 libpthread . . . . . $with_libpthread
2833 libpq . . . . . . . . $with_libpq
2834 librrd . . . . . . . $with_rrdtool
2835 libsensors . . . . . $with_lm_sensors
2836 libstatgrab . . . . . $with_libstatgrab
2837 libupsclient . . . . $with_libupsclient
2838 libvirt . . . . . . . $with_libvirt
2839 libxml2 . . . . . . . $with_libxml2
2840 libxmms . . . . . . . $with_libxmms
2843 daemon mode . . . . . $enable_daemon
2844 debug . . . . . . . . $enable_debug
2847 perl . . . . . . . . $with_perl_bindings
2850 apache . . . . . . . $enable_apache
2851 apcups . . . . . . . $enable_apcups
2852 apple_sensors . . . . $enable_apple_sensors
2853 ascent . . . . . . . $enable_ascent
2854 battery . . . . . . . $enable_battery
2855 cpu . . . . . . . . . $enable_cpu
2856 cpufreq . . . . . . . $enable_cpufreq
2857 csv . . . . . . . . . $enable_csv
2858 df . . . . . . . . . $enable_df
2859 disk . . . . . . . . $enable_disk
2860 dns . . . . . . . . . $enable_dns
2861 email . . . . . . . . $enable_email
2862 entropy . . . . . . . $enable_entropy
2863 exec . . . . . . . . $enable_exec
2864 filecount . . . . . . $enable_filecount
2865 hddtemp . . . . . . . $enable_hddtemp
2866 interface . . . . . . $enable_interface
2867 iptables . . . . . . $enable_iptables
2868 ipmi . . . . . . . . $enable_ipmi
2869 ipvs . . . . . . . . $enable_ipvs
2870 irq . . . . . . . . . $enable_irq
2871 libvirt . . . . . . . $enable_libvirt
2872 load . . . . . . . . $enable_load
2873 logfile . . . . . . . $enable_logfile
2874 mbmon . . . . . . . . $enable_mbmon
2875 memcached . . . . . . $enable_memcached
2876 memory . . . . . . . $enable_memory
2877 multimeter . . . . . $enable_multimeter
2878 mysql . . . . . . . . $enable_mysql
2879 netlink . . . . . . . $enable_netlink
2880 network . . . . . . . $enable_network
2881 nfs . . . . . . . . . $enable_nfs
2882 nginx . . . . . . . . $enable_nginx
2883 notify_desktop . . . $enable_notify_desktop
2884 notify_email . . . . $enable_notify_email
2885 ntpd . . . . . . . . $enable_ntpd
2886 nut . . . . . . . . . $enable_nut
2887 onewire . . . . . . . $enable_onewire
2888 perl . . . . . . . . $enable_perl
2889 ping . . . . . . . . $enable_ping
2890 postgresql . . . . . $enable_postgresql
2891 powerdns . . . . . . $enable_powerdns
2892 processes . . . . . . $enable_processes
2893 rrdtool . . . . . . . $enable_rrdtool
2894 sensors . . . . . . . $enable_sensors
2895 serial . . . . . . . $enable_serial
2896 snmp . . . . . . . . $enable_snmp
2897 swap . . . . . . . . $enable_swap
2898 syslog . . . . . . . $enable_syslog
2899 tail . . . . . . . . $enable_tail
2900 tape . . . . . . . . $enable_tape
2901 tcpconns . . . . . . $enable_tcpconns
2902 teamspeak2 . . . . . $enable_teamspeak2
2903 thermal . . . . . . . $enable_thermal
2904 unixsock . . . . . . $enable_unixsock
2905 users . . . . . . . . $enable_users
2906 uuid . . . . . . . . $enable_uuid
2907 vmem . . . . . . . . $enable_vmem
2908 vserver . . . . . . . $enable_vserver
2909 wireless . . . . . . $enable_wireless
2910 xmms . . . . . . . . $enable_xmms