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)
68 if test "x$ac_system" = "xSolaris"
70 CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
74 # Checks for header files.
80 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)
83 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
88 # include <sys/types.h>
91 AC_CHECK_HEADERS(netinet/in.h, [], [],
96 # include <sys/types.h>
98 #if HAVE_NETINET_IN_SYSTM_H
99 # include <netinet/in_systm.h>
102 AC_CHECK_HEADERS(netinet/ip.h, [], [],
107 # include <sys/types.h>
109 #if HAVE_NETINET_IN_SYSTM_H
110 # include <netinet/in_systm.h>
112 #if HAVE_NETINET_IN_H
113 # include <netinet/in.h>
116 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
121 # include <sys/types.h>
123 #if HAVE_NETINET_IN_SYSTM_H
124 # include <netinet/in_systm.h>
126 #if HAVE_NETINET_IN_H
127 # include <netinet/in.h>
129 #if HAVE_NETINET_IP_H
130 # include <netinet/ip.h>
133 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
138 # include <sys/types.h>
140 #if HAVE_NETINET_IN_SYSTM_H
141 # include <netinet/in_systm.h>
143 #if HAVE_NETINET_IN_H
144 # include <netinet/in.h>
146 #if HAVE_NETINET_IP_H
147 # include <netinet/ip.h>
150 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
155 # include <sys/types.h>
157 #if HAVE_NETINET_IN_SYSTM_H
158 # include <netinet/in_systm.h>
160 #if HAVE_NETINET_IN_H
161 # include <netinet/in.h>
164 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
169 # include <sys/types.h>
171 #if HAVE_NETINET_IN_SYSTM_H
172 # include <netinet/in_systm.h>
174 #if HAVE_NETINET_IN_H
175 # include <netinet/in.h>
177 #if HAVE_NETINET_IP6_H
178 # include <netinet/ip6.h>
181 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
186 # include <sys/types.h>
188 #if HAVE_NETINET_IN_SYSTM_H
189 # include <netinet/in_systm.h>
191 #if HAVE_NETINET_IN_H
192 # include <netinet/in.h>
194 #if HAVE_NETINET_IP_H
195 # include <netinet/ip.h>
198 AC_CHECK_HEADERS(netinet/udp.h, [], [],
203 # include <sys/types.h>
205 #if HAVE_NETINET_IN_SYSTM_H
206 # include <netinet/in_systm.h>
208 #if HAVE_NETINET_IN_H
209 # include <netinet/in.h>
211 #if HAVE_NETINET_IP_H
212 # include <netinet/ip.h>
217 AC_CHECK_HEADERS(sys/dkstat.h)
218 if test "x$ac_system" = "xDarwin"
220 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)
221 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
223 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
226 # include <sys/types.h>
229 # include <sys/param.h>
234 AC_CHECK_HEADERS(linux/major.h libgen.h)
236 # For the battery plugin
237 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
239 #if HAVE_IOKIT_IOKITLIB_H
240 # include <IOKit/IOKitLib.h>
242 #if HAVE_IOKIT_IOTYPES_H
243 # include <IOKit/IOTypes.h>
247 # For the swap module
248 have_sys_swap_h="yes"
249 AC_CHECK_HEADERS(sys/swap.h, [], [have_sys_swap_h="no"],
252 # include <sys/types.h>
255 # include <sys/param.h>
259 if test "x$have_sys_swap_h$ac_system" = "xnoSolaris"
261 AC_MSG_NOTICE([Solaris detected and sys/swap.h not found: Try building a 64bit binary.])
265 # For the processes plugin
267 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
269 # For interface plugin
270 AC_CHECK_HEADERS(ifaddrs.h)
271 AC_CHECK_HEADERS(net/if.h, [], [],
274 # include <sys/types.h>
276 #if HAVE_SYS_SOCKET_H
277 # include <sys/socket.h>
280 AC_CHECK_HEADERS(linux/if.h, [], [],
283 # include <sys/types.h>
285 #if HAVE_SYS_SOCKET_H
286 # include <sys/socket.h>
289 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
292 # include <sys/types.h>
294 #if HAVE_SYS_SOCKET_H
295 # include <sys/socket.h>
298 # include <linux/if.h>
303 have_net_ip_vs_h="no"
305 if test "x$ac_system" = "xLinux"
308 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
310 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
311 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
317 AC_CHECK_HEADERS(sys/ucred.h, [], [],
320 # include <sys/types.h>
323 # include <sys/param.h>
327 # For mount interface
328 AC_CHECK_HEADERS(sys/mount.h, [], [],
331 # include <sys/types.h>
334 # include <sys/param.h>
338 # For the email plugin
339 AC_CHECK_HEADERS(linux/un.h, [], [],
341 #if HAVE_SYS_SOCKET_H
342 # include <sys/socket.h>
346 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)
349 AC_CHECK_HEADERS(arpa/nameser.h)
350 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
352 #if HAVE_ARPA_NAMESER_H
353 # include <arpa/nameser.h>
357 AC_CHECK_HEADERS(net/if_arp.h, [], [],
358 [#if HAVE_SYS_SOCKET_H
359 # include <sys/socket.h>
362 AC_CHECK_HEADERS(net/ppp_defs.h)
363 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
364 [#if HAVE_NET_PPP_DEFS_H
365 # include <net/ppp_defs.h>
368 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
373 # include <sys/types.h>
375 #if HAVE_SYS_SOCKET_H
376 # include <sys/socket.h>
381 #if HAVE_NETINET_IN_H
382 # include <netinet/in.h>
386 # For the multimeter plugin
388 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
391 # Checks for typedefs, structures, and compiler characteristics.
400 # Checks for library functions.
402 AC_PROG_GCC_TRADITIONAL
403 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog)
407 AC_CACHE_CHECK([for strtok_r],
408 [have_strtok_r_default],
417 char buffer[] = "foo,bar,baz";
424 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
427 printf ("token = %s;\n", token);
430 [have_strtok_r_default="yes"],
431 [have_strtok_r_default="no"]
435 if test "x$have_strtok_r_default" = "xno"
437 SAVE_CFLAGS="$CFLAGS"
438 CFLAGS="$CFLAGS -D_REENTRANT=1"
440 AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
441 [have_strtok_r_reentrant],
450 char buffer[] = "foo,bar,baz";
457 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
460 printf ("token = %s;\n", token);
463 [have_strtok_r_reentrant="yes"],
464 [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
469 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
471 socket_needs_socket="no"
472 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
473 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
475 nanosleep_needs_rt="no"
476 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
477 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
479 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
480 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
481 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
482 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
483 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
484 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
485 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
486 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
487 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
488 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
491 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
494 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
496 if test "x$withval" = "xno"; then
498 else if test "x$withval" = "xyes"; then
505 if test "x$nan_type" = "xnone"; then
506 AC_CACHE_CHECK([whether NAN is defined by default],
513 static float foo = NAN;
521 [have_nan_default="yes"],
522 [have_nan_default="no"]
525 if test "x$have_nan_default" = "xyes"
530 if test "x$nan_type" = "xnone"; then
531 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
537 #define __USE_ISOC99 1
539 static float foo = NAN;
547 [have_nan_isoc="yes"],
551 if test "x$have_nan_isoc" = "xyes"
556 if test "x$nan_type" = "xnone"; then
557 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
567 #define NAN (0.0 / 0.0)
569 # define isnan(f) ((f) != (f))
571 static float foo = NAN;
579 [have_nan_zero="yes"],
583 if test "x$have_nan_zero" = "xyes"
589 if test "x$nan_type" = "xdefault"; then
590 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
591 [Define if NAN is defined by default and can initialize static variables.])
592 else if test "x$nan_type" = "xisoc99"; then
593 AC_DEFINE(NAN_STATIC_ISOC, 1,
594 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
595 else if test "x$nan_type" = "xzero"; then
596 AC_DEFINE(NAN_ZERO_ZERO, 1,
597 [Define if NAN can be defined as (0.0 / 0.0)])
599 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
602 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
604 if test "x$withval" = "xnothing"; then
605 fp_layout_type="nothing"
606 else if test "x$withval" = "xendianflip"; then
607 fp_layout_type="endianflip"
608 else if test "x$withval" = "xintswap"; then
609 fp_layout_type="intswap"
611 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
614 [fp_layout_type="unknown"])
616 if test "x$fp_layout_type" = "xunknown"; then
617 AC_CACHE_CHECK([if doubles are stored in x86 representation],
618 [fp_layout_need_nothing],
634 memcpy ((void *) &i0, (void *) &d, 8);
637 memcpy ((void *) c, (void *) &i1, 8);
639 if ((c[0] == 0x2f) && (c[1] == 0x25)
640 && (c[2] == 0xc0) && (c[3] == 0xc7)
641 && (c[4] == 0x43) && (c[5] == 0x2b)
642 && (c[6] == 0x1f) && (c[7] == 0x5b))
647 [fp_layout_need_nothing="yes"],
648 [fp_layout_need_nothing="no"]
651 if test "x$fp_layout_need_nothing" = "xyes"; then
652 fp_layout_type="nothing"
655 if test "x$fp_layout_type" = "xunknown"; then
656 AC_CACHE_CHECK([if endianflip converts to x86 representation],
657 [fp_layout_need_endianflip],
665 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
666 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
667 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
668 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
669 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
670 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
671 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
672 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
681 memcpy ((void *) &i0, (void *) &d, 8);
683 i1 = endianflip (i0);
684 memcpy ((void *) c, (void *) &i1, 8);
686 if ((c[0] == 0x2f) && (c[1] == 0x25)
687 && (c[2] == 0xc0) && (c[3] == 0xc7)
688 && (c[4] == 0x43) && (c[5] == 0x2b)
689 && (c[6] == 0x1f) && (c[7] == 0x5b))
694 [fp_layout_need_endianflip="yes"],
695 [fp_layout_need_endianflip="no"]
698 if test "x$fp_layout_need_endianflip" = "xyes"; then
699 fp_layout_type="endianflip"
702 if test "x$fp_layout_type" = "xunknown"; then
703 AC_CACHE_CHECK([if intswap converts to x86 representation],
704 [fp_layout_need_intswap],
712 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
713 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
722 memcpy ((void *) &i0, (void *) &d, 8);
725 memcpy ((void *) c, (void *) &i1, 8);
727 if ((c[0] == 0x2f) && (c[1] == 0x25)
728 && (c[2] == 0xc0) && (c[3] == 0xc7)
729 && (c[4] == 0x43) && (c[5] == 0x2b)
730 && (c[6] == 0x1f) && (c[7] == 0x5b))
735 [fp_layout_need_intswap="yes"],
736 [fp_layout_need_intswap="no"]
739 if test "x$fp_layout_need_intswap" = "xyes"; then
740 fp_layout_type="intswap"
744 if test "x$fp_layout_type" = "xnothing"; then
745 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
746 [Define if doubles are stored in x86 representation.])
747 else if test "x$fp_layout_type" = "xendianflip"; then
748 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
749 [Define if endianflip is needed to convert to x86 representation.])
750 else if test "x$fp_layout_type" = "xintswap"; then
751 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
752 [Define if intswap is needed to convert to x86 representation.])
754 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
758 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
760 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
762 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
765 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
766 if test "x$have_getmntent" = "xno"; then
767 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
769 if test "x$have_getmntent" = "xno"; then
770 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
772 if test "x$have_getmntent" = "xno"; then
773 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
776 if test "x$have_getmntent" = "xc"; then
777 AC_CACHE_CHECK([whether getmntent takes one argument],
778 [have_one_getmntent],
780 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
782 #include "$srcdir/src/utils_mount.h"]],
786 fh = setmntent ("/etc/mtab", "r");
790 [have_one_getmntent="yes"],
791 [have_one_getmntent="no"]
794 AC_CACHE_CHECK([whether getmntent takes two arguments],
795 [have_two_getmntent],
797 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
798 #include <sys/mnttab.h>
799 #include "$srcdir/src/utils_mount.h"]],
804 fh = fopen ("/etc/mnttab", "r");
805 status = getmntent (fh, &mt);
808 [have_two_getmntent="yes"],
809 [have_two_getmntent="no"]
814 # Check for different versions of `getmntent' here..
816 if test "x$have_getmntent" = "xc"; then
817 if test "x$have_one_getmntent" = "xyes"; then
818 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
819 [Define if the function getmntent exists and takes one argument.])
821 if test "x$have_two_getmntent" = "xyes"; then
822 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
823 [Define if the function getmntent exists and takes two arguments.])
826 if test "x$have_getmntent" = "xsun"; then
827 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
828 [Define if the function getmntent exists. It's the version from libsun.])
830 if test "x$have_getmntent" = "xseq"; then
831 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
832 [Define if the function getmntent exists. It's the version from libseq.])
834 if test "x$have_getmntent" = "xgen"; then
835 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
836 [Define if the function getmntent exists. It's the version from libgen.])
839 # Check for structures
840 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
841 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
844 #include <sys/types.h>
845 #include <sys/socket.h>
848 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
849 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
852 #include <sys/types.h>
853 #include <sys/socket.h>
854 #include <linux/if.h>
855 #include <linux/netdevice.h>
858 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
863 # include <sys/types.h>
865 #if HAVE_NETINET_IN_SYSTM_H
866 # include <netinet/in_systm.h>
868 #if HAVE_NETINET_IN_H
869 # include <netinet/in.h>
871 #if HAVE_NETINET_IP_H
872 # include <netinet/ip.h>
874 #if HAVE_NETINET_UDP_H
875 # include <netinet/udp.h>
878 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
883 # include <sys/types.h>
885 #if HAVE_NETINET_IN_SYSTM_H
886 # include <netinet/in_systm.h>
888 #if HAVE_NETINET_IN_H
889 # include <netinet/in.h>
891 #if HAVE_NETINET_IP_H
892 # include <netinet/ip.h>
894 #if HAVE_NETINET_UDP_H
895 # include <netinet/udp.h>
899 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
909 # Checks for libraries begin here
912 AC_CHECK_LIB(resolv, res_search,
914 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
916 [with_libresolv="no"])
917 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
919 dnl Check for HAL (hardware abstraction library)
921 AC_CHECK_LIB(hal,libhal_device_property_exists,
922 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
924 if test "x$with_libhal" = "xyes"; then
925 if test "x$PKG_CONFIG" != "x"; then
926 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
927 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
928 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
929 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
933 m4_divert_once([HELP_WITH], [
934 collectd additional packages:])
936 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
939 librrd_threadsafe="yes"
940 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
941 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
943 librrd_cflags="-I$withval/include"
944 librrd_ldflags="-L$withval/lib"
947 with_rrdtool="$withval"
949 ], [with_rrdtool="yes"])
950 if test "x$with_rrdtool" = "xyes"
952 SAVE_CPPFLAGS="$CPPFLAGS"
953 SAVE_LDFLAGS="$LDFLAGS"
955 CPPFLAGS="$CPPFLAGS $librrd_cflags"
956 LDFLAGS="$LDFLAGS $librrd_ldflags"
958 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
960 CPPFLAGS="$SAVE_CPPFLAGS"
961 LDFLAGS="$SAVE_LDFLAGS"
963 if test "x$with_rrdtool" = "xyes"
965 SAVE_CPPFLAGS="$CPPFLAGS"
966 SAVE_LDFLAGS="$LDFLAGS"
968 CPPFLAGS="$CPPFLAGS $librrd_cflags"
969 LDFLAGS="$LDFLAGS $librrd_ldflags"
971 AC_CHECK_LIB(rrd_th, rrd_update_r,
973 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
975 [librrd_threadsafe="no"
976 AC_CHECK_LIB(rrd, rrd_update,
978 librrd_ldflags="$librrd_ldflags -lrrd -lm"
980 [with_rrdtool="no (symbol 'rrd_update' not found)"],
985 CPPFLAGS="$SAVE_CPPFLAGS"
986 LDFLAGS="$SAVE_LDFLAGS"
988 if test "x$with_rrdtool" = "xyes"
990 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
991 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
992 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
993 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
995 if test "x$librrd_threadsafe" = "xyes"
997 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
1000 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
1001 [ if test "x$withval" != "xno" \
1002 && test "x$withval" != "xyes"
1004 LDFLAGS="$LDFLAGS -L$withval/lib"
1005 CPPFLAGS="$CPPFLAGS -I$withval/include"
1006 with_libpthread="yes"
1008 if test "x$withval" = "xno"
1010 with_libpthread="no (disabled)"
1013 ], [with_libpthread="yes"])
1014 if test "x$with_libpthread" = "xyes"
1016 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
1018 if test "x$with_libpthread" = "xyes"
1020 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
1022 if test "x$with_libpthread" = "xyes"
1028 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
1029 [Wether or not to use pthread (POSIX threads) library])
1030 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
1032 if test "x$ac_system" = "xSolaris"
1037 with_kstat="no (Solaris only)"
1038 with_devinfo="no (Solaris only)"
1041 if test "x$with_kstat" = "xyes"
1043 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1045 if test "x$with_kstat" = "xyes"
1047 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1048 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1050 if test "x$with_kstat" = "xyes"
1052 AC_DEFINE(HAVE_LIBKSTAT, 1,
1053 [Define to 1 if you have the 'kstat' library (-lkstat)])
1055 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1056 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1058 ### BEGIN of check for libcurl ###
1059 with_curl_config="curl-config"
1062 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1064 if test "x$withval" = "xno"
1067 else if test "x$withval" = "xyes"
1071 if test -f "$withval" && test -x "$withval"
1073 with_curl_config="$withval"
1075 else if test -x "$withval/bin/curl-config"
1077 with_curl_config="$withval/bin/curl-config"
1086 if test "x$with_libcurl" = "xyes"
1088 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1089 curl_config_status=$?
1091 if test $curl_config_status -ne 0
1093 with_libcurl="no ($with_curl_config failed)"
1095 SAVE_CPPFLAGS="$CPPFLAGS"
1096 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1098 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1100 CPPFLAGS="$SAVE_CPPFLAGS"
1103 if test "x$with_libcurl" = "xyes"
1105 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1106 curl_config_status=$?
1108 if test $curl_config_status -ne 0
1110 with_libcurl="no ($with_curl_config failed)"
1112 AC_CHECK_LIB(curl, curl_easy_init,
1113 [with_libcurl="yes"],
1114 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1118 if test "x$with_libcurl" = "xyes"
1120 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1121 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1122 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1123 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1125 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1126 ### END of check for libcurl ###
1129 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1136 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1138 with_libstatgrab_cflags=""
1139 with_libstatgrab_ldflags=""
1140 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
1142 if test "x$withval" != "xno" \
1143 && test "x$withval" != "xyes"
1145 with_libstatgrab_cflags="-I$withval/include"
1146 with_libstatgrab_ldflags="-L$withval/lib"
1147 with_libstatgrab="yes"
1149 with_libstatgrab="$withval"
1153 if test "x$ac_system" = "xunknown"
1155 with_libstatgrab="yes"
1157 with_libstatgrab="no"
1160 with_libstatgrab_pkg_config="yes"
1161 if test "x$with_libstatgrab" = "xyes" \
1162 && test "x$PKG_CONFIG" != "x"
1164 AC_MSG_CHECKING([pkg-config for libstatgrab])
1166 $PKG_CONFIG --exists libstatgrab 2>/dev/null
1169 with_libstatgrab_pkg_config="no"
1170 temp_result="not found"
1172 AC_MSG_RESULT([$temp_result])
1174 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
1175 with_libstatgrab_pkg_config="no"
1176 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
1179 if test "x$with_libstatgrab" = "xyes" \
1180 && test "x$with_libstatgrab_pkg_config" = "xyes" \
1181 && test "x$with_libstatgrab_cflags" = "x"
1183 AC_MSG_CHECKING([for libstatgrab CFLAGS])
1184 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
1187 with_libstatgrab_cflags="$temp_result"
1189 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
1190 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
1192 AC_MSG_RESULT([$temp_result])
1195 if test "x$with_libstatgrab" = "xyes" \
1196 && test "x$with_libstatgrab_pkg_config" = "xyes" \
1197 && test "x$with_libstatgrab_ldflags" = "x"
1199 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
1200 temp_result="`$PKG_CONFIG --libs libstatgrab`"
1203 with_libstatgrab_ldflags="$temp_result"
1205 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
1206 temp_result="$PKG_CONFIG --libs libstatgrab failed"
1208 AC_MSG_RESULT([$temp_result])
1211 if test "x$with_libstatgrab" = "xyes"
1213 SAVE_CPPFLAGS="$CPPFLAGS"
1214 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
1216 AC_CHECK_HEADERS(statgrab.h,
1217 [with_libstatgrab="yes"],
1218 [with_libstatgrab="no (statgrab.h not found)"])
1220 CPPFLAGS="$SAVE_CPPFLAGS"
1223 if test "x$with_libstatgrab" = "xyes"
1225 SAVE_CFLAGS="$CFLAGS"
1226 SAVE_LDFLAGS="$LDFLAGS"
1228 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
1229 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
1231 AC_CHECK_LIB(statgrab, sg_init,
1232 [with_libstatgrab="yes"],
1233 [with_libstatgrab="no (symbol sg_init not found)"])
1235 CFLAGS="$SAVE_CFLAGS"
1236 LDFLAGS="$SAVE_LDFLAGS"
1239 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
1240 if test "x$with_libstatgrab" = "xyes"
1242 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
1243 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
1244 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
1245 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
1246 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
1250 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1251 if test "x$with_kvm_getprocs" = "xyes"
1253 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1254 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1257 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1259 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1260 if test "x$with_kvm_getswapinfo" = "xyes"
1262 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1263 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1266 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1268 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1269 if test "x$with_kvm_nlist" = "xyes"
1271 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1272 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1275 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1277 with_sensors_cflags=""
1278 with_sensors_ldflags=""
1279 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
1281 if test "x$withval" = "xno"
1283 with_lm_sensors="no"
1285 with_lm_sensors="yes"
1286 if test "x$withval" != "xyes"
1288 with_sensors_cflags="-I$withval/include"
1289 with_sensors_ldflags="-L$withval/lib"
1290 with_lm_sensors="yes"
1295 if test "x$ac_system" = "xLinux"
1297 with_lm_sensors="yes"
1299 with_lm_sensors="no (Linux only library)"
1302 if test "x$with_lm_sensors" = "xyes"
1304 SAVE_CPPFLAGS="$CPPFLAGS"
1305 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
1307 # AC_CHECK_HEADERS(sensors/sensors.h,
1309 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
1311 # [with_lm_sensors="no (sensors/sensors.h not found)"])
1312 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_lm_sensors="no (sensors/sensors.h not found)"])
1314 CPPFLAGS="$SAVE_CPPFLAGS"
1316 if test "x$with_lm_sensors" = "xyes"
1318 SAVE_CPPFLAGS="$CPPFLAGS"
1319 SAVE_LDFLAGS="$LDFLAGS"
1320 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
1321 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
1323 AC_CHECK_LIB(sensors, sensors_init,
1325 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
1327 [with_lm_sensors="no (libsensors not found)"])
1329 CPPFLAGS="$SAVE_CPPFLAGS"
1330 LDFLAGS="$SAVE_LDFLAGS"
1332 if test "x$with_lm_sensors" = "xyes"
1334 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
1335 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
1336 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
1337 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
1339 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
1341 with_mysql_config="mysql_config"
1342 with_mysql_cflags=""
1344 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1346 if test "x$withval" = "xno"
1349 else if test "x$withval" = "xyes"
1353 if test -f "$withval" && test -x "$withval";
1355 with_mysql_config="$withval"
1356 else if test -x "$withval/bin/mysql_config"
1358 with_mysql_config="$withval/bin/mysql_config"
1366 if test "x$with_libmysql" = "xyes"
1368 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1369 mysql_config_status=$?
1371 if test $mysql_config_status -ne 0
1373 with_libmysql="no ($with_mysql_config failed)"
1375 SAVE_CPPFLAGS="$CPPFLAGS"
1376 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
1379 have_mysql_mysql_h="no"
1380 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
1382 if test "x$have_mysql_h" = "xno"
1384 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
1387 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
1389 with_libmysql="no (mysql.h not found)"
1392 CPPFLAGS="$SAVE_CPPFLAGS"
1395 if test "x$with_libmysql" = "xyes"
1397 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
1398 mysql_config_status=$?
1400 if test $mysql_config_status -ne 0
1402 with_libmysql="no ($with_mysql_config failed)"
1404 AC_CHECK_LIB(mysqlclient, mysql_init,
1405 [with_libmysql="yes"],
1406 [with_libmysql="no (symbol 'mysql_init' not found)"],
1410 if test "x$with_libmysql" = "xyes"
1412 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
1413 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
1414 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
1415 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
1417 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
1419 with_own_liboconfig="no"
1420 liboconfig_LDFLAGS="$LDFLAGS"
1421 liboconfig_CPPFLAGS="$CPPFLAGS"
1422 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1424 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1426 if test -d "$withval/lib"
1428 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1430 if test -d "$withval/include"
1432 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1435 if test "x$withval" = "xno"
1437 AC_MSG_ERROR("liboconfig is required")
1441 with_liboconfig="yes"
1444 save_LDFLAGS="$LDFLAGS"
1445 save_CPPFLAGS="$CPPFLAGS"
1446 LDFLAGS="$liboconfig_LDFLAGS"
1447 CPPFLAGS="$liboconfig_CPPFLAGS"
1448 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1450 with_liboconfig="yes"
1451 with_own_liboconfig="no"
1454 with_liboconfig="yes"
1455 with_own_liboconfig="yes"
1456 LDFLAGS="$save_LDFLAGS"
1457 CPPFLAGS="$save_CPPFLAGS"
1460 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1461 if test "x$with_own_liboconfig" = "xyes"
1463 with_liboconfig="yes (shipped version)"
1466 #with_liboping="yes"
1467 with_own_liboping="no"
1468 liboping_LDFLAGS="$LDFLAGS"
1469 liboping_CPPFLAGS="$CPPFLAGS"
1470 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1472 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1474 if test -d "$withval/lib"
1476 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
1478 if test -d "$withval/include"
1480 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
1483 if test "x$withval" = "xno"
1486 with_own_liboping="no"
1487 else if test "x$withval" = "xyes"
1496 if test "x$with_liboping" = "xyes"
1498 save_LDFLAGS="$LDFLAGS"
1499 save_CPPFLAGS="$CPPFLAGS"
1500 LDFLAGS="$liboping_LDFLAGS"
1501 CPPFLAGS="$liboping_CPPFLAGS"
1502 AC_CHECK_LIB(oping, ping_construct,
1505 with_own_liboping="no"
1509 with_own_liboping="yes"
1510 LDFLAGS="$save_LDFLAGS"
1511 CPPFLAGS="$save_CPPFLAGS"
1514 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1515 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1517 with_libowcapi_cppflags=""
1518 with_libowcapi_libs="-lowcapi"
1519 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
1521 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1523 with_libowcapi_cppflags="-I$withval/include"
1524 with_libowcapi_libs="-L$withval/lib -lowcapi"
1525 with_libowcapi="yes"
1527 with_libowcapi="$withval"
1531 with_libowcapi="yes"
1533 if test "x$with_libowcapi" = "xyes"
1535 SAVE_CPPFLAGS="$CPPFLAGS"
1536 CPPFLAGS="$with_libowcapi_cppflags"
1538 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
1540 CPPFLAGS="$SAVE_CPPFLAGS"
1542 if test "x$with_libowcapi" = "xyes"
1544 SAVE_LDFLAGS="$LDFLAGS"
1545 SAVE_CPPFLAGS="$CPPFLAGS"
1546 LDFLAGS="$with_libowcapi_libs"
1547 CPPFLAGS="$with_libowcapi_cppflags"
1549 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
1551 LDFLAGS="$SAVE_LDFLAGS"
1552 CPPFLAGS="$SAVE_CPPFLAGS"
1554 if test "x$with_libowcapi" = "xyes"
1556 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
1557 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
1558 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
1559 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
1563 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1565 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1567 LDFLAGS="$LDFLAGS -L$withval/lib"
1568 CPPFLAGS="$CPPFLAGS -I$withval/include"
1571 with_libpcap="$withval"
1577 if test "x$with_libpcap" = "xyes"
1579 AC_CHECK_LIB(pcap, pcap_open_live,
1581 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1582 ], [with_libpcap="no (libpcap not found)"])
1584 if test "x$with_libpcap" = "xyes"
1586 AC_CHECK_HEADERS(pcap.h,
1588 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1589 ], [with_libpcap="no (pcap.h not found)"])
1591 if test "x$with_libpcap" = "xyes"
1597 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1598 [Wether or not to use the pcap library])
1599 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1601 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1603 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1605 LDFLAGS="$LDFLAGS -L$withval/lib"
1606 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1609 with_libesmtp="$withval"
1615 if test "x$with_libesmtp" = "xyes"
1617 AC_CHECK_LIB(esmtp, smtp_create_session,
1619 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1620 ], [with_libesmtp="no (libesmtp not found)"])
1622 if test "x$with_libesmtp" = "xyes"
1624 AC_CHECK_HEADERS(libesmtp.h,
1626 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1627 ], [with_libesmtp="no (libesmtp.h not found)"])
1629 if test "x$with_libesmtp" = "xyes"
1635 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1636 [Wether or not to use the esmtp library])
1637 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1639 perl_interpreter="perl"
1640 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1642 if test -x "$withval"
1644 perl_interpreter="$withval"
1646 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
1648 LDFLAGS="$LDFLAGS -L$withval/lib"
1649 CPPFLAGS="$CPPFLAGS -I$withval/include"
1650 perl_interpreter="$withval/bin/perl"
1653 with_libperl="$withval"
1660 AC_MSG_CHECKING([for perl])
1661 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
1662 if test -x "$perl_interpreter"
1664 AC_MSG_RESULT([yes ($perl_interpreter)])
1670 AC_SUBST(PERL, "$perl_interpreter")
1672 if test "x$with_libperl" = "xyes" \
1673 && test -n "$perl_interpreter"
1676 SAVE_LDFLAGS=$LDFLAGS
1677 PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
1678 PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
1679 CFLAGS="$CFLAGS $PERL_CFLAGS"
1680 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1682 AC_CACHE_CHECK([for libperl],
1687 #define PERL_NO_GET_CONTEXT
1694 load_module (PERL_LOADMOD_NOIMPORT,
1695 newSVpv ("Collectd::Plugin::FooBar", 24),
1698 [have_libperl="yes"],
1703 if test "x$have_libperl" = "xyes"
1705 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
1706 AC_SUBST(PERL_CFLAGS)
1707 AC_SUBST(PERL_LDFLAGS)
1713 LDFLAGS=$SAVE_LDFLAGS
1714 else if test -z "$perl_interpreter"; then
1715 with_libperl="no (no perl interpreter found)"
1718 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1720 if test "x$with_libperl" = "xyes"
1723 SAVE_LDFLAGS=$LDFLAGS
1724 CFLAGS="$CFLAGS $PERL_CFLAGS"
1725 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1727 AC_CACHE_CHECK([if perl supports ithreads],
1728 [have_perl_ithreads],
1736 #if !defined(USE_ITHREADS)
1737 # error "Perl does not support ithreads!"
1738 #endif /* !defined(USE_ITHREADS) */
1741 [have_perl_ithreads="yes"],
1742 [have_perl_ithreads="no"]
1746 if test "x$have_perl_ithreads" = "xyes"
1748 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
1752 LDFLAGS=$SAVE_LDFLAGS
1755 with_own_libiptc="no"
1756 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1758 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1760 LDFLAGS="$LDFLAGS -L$withval/lib"
1761 CPPFLAGS="$CPPFLAGS -I$withval/include"
1764 with_libiptc="$withval"
1768 if test "x$ac_system" = "xLinux"
1772 with_libiptc="no (Linux only)"
1775 if test "x$with_libiptc" = "xyes"
1777 AC_CHECK_LIB(iptc, iptc_init,
1779 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1783 with_own_libiptc="yes"
1786 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" != "xyes"
1788 AC_CHECK_HEADERS(libiptc/libiptc.h,
1790 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1794 with_own_libiptc="yes"
1797 if test "x$with_libiptc" = "xyes"
1800 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
1802 AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h, [],
1804 with_libiptc="no (Linux iptables headers not found - check KERNEL_DIR)"
1805 with_own_libiptc="no"
1808 #include "$srcdir/src/libiptc/ipt_kernel_headers.h"
1813 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1814 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_own_libiptc" = "xyes")
1815 if test "x$with_own_libiptc" = "xyes"
1817 AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1820 with_snmp_config="net-snmp-config"
1823 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1825 if test "x$withval" = "xno"
1827 with_libnetsnmp="no"
1828 else if test "x$withval" = "xyes"
1830 with_libnetsnmp="yes"
1832 if test -x "$withval"
1834 with_snmp_config="$withval"
1835 with_libnetsnmp="yes"
1837 with_snmp_config="$withval/bin/net-snmp-config"
1838 with_libnetsnmp="yes"
1842 [with_libnetsnmp="yes"])
1843 if test "x$with_libnetsnmp" = "xyes"
1845 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
1846 snmp_config_status=$?
1848 if test $snmp_config_status -ne 0
1850 with_libnetsnmp="no ($with_snmp_config failed)"
1852 SAVE_CPPFLAGS="$CPPFLAGS"
1853 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
1855 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1857 CPPFLAGS="$SAVE_CPPFLAGS"
1860 if test "x$with_libnetsnmp" = "xyes"
1862 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
1863 snmp_config_status=$?
1865 if test $snmp_config_status -ne 0
1867 with_libnetsnmp="no ($with_snmp_config failed)"
1869 AC_CHECK_LIB(netsnmp, init_snmp,
1870 [with_libnetsnmp="yes"],
1871 [with_libnetsnmp="no (libnetsnmp not found)"],
1875 if test "x$with_libnetsnmp" = "xyes"
1877 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
1878 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
1879 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
1880 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
1882 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1884 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
1885 [with_libnotify="yes"],
1886 [with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"])
1888 with_libupsclient="no (pkg-config isn't available)"
1889 with_libupsclient_cflags=""
1890 with_libupsclient_libs=""
1891 if test "x$PKG_CONFIG" != "x"
1893 pkg-config --exists 'libupsclient' 2>/dev/null
1896 with_libupsclient="yes"
1898 with_libupsclient="no (pkg-config doesn't know library)"
1901 if test "x$with_libupsclient" = "xyes"
1903 with_libupsclient_cflags="`pkg-config --cflags 'libupsclient'`"
1906 with_libupsclient="no"
1908 with_libupsclient_libs="`pkg-config --libs 'libupsclient'`"
1911 with_libupsclient="no"
1914 if test "x$with_libupsclient" = "xyes"
1916 SAVE_CPPFLAGS="$CPPFLAGS"
1917 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
1919 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
1921 CPPFLAGS="$SAVE_CPPFLAGS"
1923 if test "x$with_libupsclient" = "xyes"
1925 SAVE_CPPFLAGS="$CPPFLAGS"
1926 SAVE_LDFLAGS="$LDFLAGS"
1928 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
1929 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
1931 AC_CHECK_LIB(upsclient, upscli_connect,
1932 [with_libupsclient="yes"],
1933 [with_libupsclient="no (symbol upscli_connect not found)"])
1935 CPPFLAGS="$SAVE_CPPFLAGS"
1936 LDFLAGS="$SAVE_LDFLAGS"
1938 if test "x$with_libupsclient" = "xyes"
1940 SAVE_CPPFLAGS="$CPPFLAGS"
1941 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
1943 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
1944 [#include <stdlib.h>
1946 #include <upsclient.h>])
1948 CPPFLAGS="$SAVE_CPPFLAGS"
1950 if test "x$with_libupsclient" = "xyes"
1952 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
1953 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
1954 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
1955 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
1958 ### BEGIN of check for libxmms ###
1959 with_xmms_config="xmms-config"
1962 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
1964 if test "x$withval" != "xno" \
1965 && test "x$withval" != "xyes"
1967 if test -f "$withval" && test -x "$withval";
1969 with_xmms_config="$withval"
1970 else if test -x "$withval/bin/xmms-config"
1972 with_xmms_config="$withval/bin/xmms-config"
1975 else if test "x$withval" = "xno"
1985 if test "x$with_libxmms" = "xyes"
1987 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
1988 xmms_config_status=$?
1990 if test $xmms_config_status -ne 0
1995 if test "x$with_libxmms" = "xyes"
1997 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
1998 xmms_config_status=$?
2000 if test $xmms_config_status -ne 0
2005 if test "x$with_libxmms" = "xyes"
2007 AC_CHECK_LIB(xmms, xmms_remote_get_info,
2009 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
2010 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
2011 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
2012 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
2019 with_libxmms_numeric=0
2020 if test "x$with_libxmms" = "xyes"
2022 with_libxmms_numeric=1
2024 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
2025 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
2026 ### END of check for libxmms ###
2028 with_libnetlink_cflags=""
2029 with_libnetlink_libs="-lnetlink"
2030 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
2032 echo "libnetlink: withval = $withval"
2033 if test "x$withval" = "xyes"
2035 with_libnetlink="yes"
2036 else if test "x$withval" = "xno"
2038 with_libnetlink="no"
2040 if test -d "$withval/include"
2042 with_libnetlink_cflags="-I$withval/include"
2043 with_libnetlink_libs="-L$withval/lib -lnetlink"
2044 with_libnetlink="yes"
2046 AC_MSG_ERROR("no such directory: $withval/include")
2051 if test "x$ac_system" = "xLinux"
2053 with_libnetlink="yes"
2055 with_libnetlink="no (Linux only library)"
2058 if test "x$with_libnetlink" = "xyes"
2061 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2063 with_libnetlink="no (libnetlink.h not found)"
2065 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
2067 with_libnetlink="yes"
2071 #include <sys/types.h>
2072 #include <asm/types.h>
2073 #include <sys/socket.h>
2074 #include <linux/netlink.h>
2075 #include <linux/rtnetlink.h>])
2076 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2078 #include <sys/types.h>
2079 #include <asm/types.h>
2080 #include <sys/socket.h>])
2084 #include <sys/types.h>
2085 #include <asm/types.h>
2086 #include <sys/socket.h>
2087 #include <linux/netlink.h>
2088 #include <linux/rtnetlink.h>
2092 int retval = TCA_STATS2;
2095 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
2100 #include <sys/types.h>
2101 #include <asm/types.h>
2102 #include <sys/socket.h>
2103 #include <linux/netlink.h>
2104 #include <linux/rtnetlink.h>
2108 int retval = TCA_STATS;
2111 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
2114 CFLAGS="$SAVE_CFLAGS"
2116 if test "x$with_libnetlink" = "xyes"
2118 AC_CHECK_LIB(netlink, rtnl_open,
2119 [with_libnetlink="yes"],
2120 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
2121 [$with_libnetlink_libs])
2123 if test "x$with_libnetlink" = "xyes"
2125 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
2126 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
2127 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
2128 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
2130 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
2132 with_libopenipmipthread="yes"
2133 with_libopenipmipthread_cflags=""
2134 with_libopenipmipthread_libs=""
2136 AC_MSG_CHECKING([for pkg-config])
2138 if test "x$PKG_CONFIG" = "x"
2140 with_libopenipmipthread="no"
2143 temp_result="$PKG_CONFIG"
2145 AC_MSG_RESULT([$temp_result])
2147 if test "x$with_libopenipmipthread" = "xyes"
2149 AC_MSG_CHECKING([for libOpenIPMIpthread])
2150 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
2153 with_libopenipmipthread="no ($PKG_CONFIG doesn't know OpenIPMIpthread)"
2155 AC_MSG_RESULT([$with_libopenipmipthread])
2158 if test "x$with_libopenipmipthread" = "xyes"
2160 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
2161 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
2164 with_libopenipmipthread_cflags="$temp_result"
2166 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
2167 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
2169 AC_MSG_RESULT([$temp_result])
2172 if test "x$with_libopenipmipthread" = "xyes"
2174 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
2175 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
2178 with_libopenipmipthread_ldflags="$temp_result"
2180 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
2181 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
2183 AC_MSG_RESULT([$temp_result])
2186 if test "x$with_libopenipmipthread" = "xyes"
2188 SAVE_CPPFLAGS="$CPPFLAGS"
2189 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
2191 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
2192 [with_libopenipmipthread="yes"],
2193 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
2194 [#include <OpenIPMI/ipmiif.h>
2195 #include <OpenIPMI/ipmi_err.h>
2196 #include <OpenIPMI/ipmi_posix.h>
2197 #include <OpenIPMI/ipmi_conn.h>
2200 CPPFLAGS="$SAVE_CPPFLAGS"
2203 if test "x$with_libopenipmipthread" = "xyes"
2205 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
2206 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
2207 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
2208 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
2211 dnl Check for libpq.
2212 with_pg_config="pg_config"
2213 with_libpq_includedir=""
2214 with_libpq_libdir=""
2215 with_libpq_cppflags=""
2216 with_libpq_ldflags=""
2217 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
2220 if test "x$withval" = "xno"
2223 else if test "x$withval" = "xyes"
2227 if test -f "$withval" && test -x "$withval";
2229 with_pg_config="$withval"
2230 else if test -x "$withval/bin/pg_config"
2232 with_pg_config="$withval/bin/pg_config"
2240 if test "x$with_libpq" = "xyes"
2242 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
2245 if test $pg_config_status -eq 0
2247 if test -n "$with_libpq_includedir"; then
2248 for dir in $with_libpq_includedir; do
2249 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
2253 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2256 SAVE_CPPFLAGS="$CPPFLAGS"
2257 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
2259 AC_CHECK_HEADERS(libpq-fe.h, [],
2260 [with_libpq="no (libpq-fe.h not found)"], [])
2262 CPPFLAGS="$SAVE_CPPFLAGS"
2264 if test "x$with_libpq" = "xyes"
2266 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
2269 if test $pg_config_status -eq 0
2271 if test -n "$with_libpq_libdir"; then
2272 for dir in $with_libpq_libdir; do
2273 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
2277 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2280 SAVE_LDFLAGS="$LDFLAGS"
2281 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
2283 AC_CHECK_LIB(pq, PQconnectdb,
2285 [with_libpq="no (symbol 'PQconnectdb' not found)"])
2287 LDFLAGS="$SAVE_LDFLAGS"
2289 if test "x$with_libpq" = "xyes"
2291 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
2292 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
2293 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
2294 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
2296 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
2298 dnl Check for libvirt and libxml2 libraries.
2299 with_libxml2="no (pkg-config isn't available)"
2300 with_libxml2_cflags=""
2301 with_libxml2_ldflags=""
2302 with_libvirt="no (pkg-config isn't available)"
2303 with_libvirt_cflags=""
2304 with_libvirt_ldflags=""
2305 if test "x$PKG_CONFIG" != "x"
2307 pkg-config --exists 'libxml-2.0' 2>/dev/null
2312 with_libxml2="no (pkg-config doesn't know library)"
2315 pkg-config --exists libvirt 2>/dev/null
2320 with_libvirt="no (pkg-config doesn't know library)"
2323 if test "x$with_libxml2" = "xyes"
2325 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
2330 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
2336 if test "x$with_libxml2" = "xyes"
2338 SAVE_CPPFLAGS="$CPPFLAGS"
2339 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
2341 AC_CHECK_HEADERS(libxml/parser.h, [],
2342 [with_libxml2="no (libxml/parser.h not found)"])
2344 CPPFLAGS="$SAVE_CPPFLAGS"
2346 if test "x$with_libxml2" = "xyes"
2348 SAVE_CFLAGS="$CFLAGS"
2349 SAVE_LDFLAGS="$LDFLAGS"
2351 CFLAGS="$CFLAGS $with_libxml2_cflags"
2352 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
2354 AC_CHECK_LIB(xml2, xmlXPathEval,
2355 [with_libxml2="yes"],
2356 [with_libxml2="no (symbol xmlXPathEval not found)"])
2358 CFLAGS="$SAVE_CFLAGS"
2359 LDFLAGS="$SAVE_LDFLAGS"
2361 dnl Add the right compiler flags and libraries.
2362 if test "x$with_libxml2" = "xyes"; then
2363 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
2364 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
2365 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
2366 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
2368 if test "x$with_libvirt" = "xyes"
2370 with_libvirt_cflags="`pkg-config --cflags libvirt`"
2375 with_libvirt_ldflags="`pkg-config --libs libvirt`"
2381 if test "x$with_libvirt" = "xyes"
2383 SAVE_CPPFLAGS="$CPPFLAGS"
2384 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
2386 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
2387 [with_libvirt="no (libvirt/libvirt.h not found)"])
2389 CPPFLAGS="$SAVE_CPPFLAGS"
2391 if test "x$with_libvirt" = "xyes"
2393 SAVE_CFLAGS="$CFLAGS"
2394 SAVE_LDFLAGS="$LDFLAGS"
2396 CFLAGS="$CFLAGS $with_libvirt_cflags"
2397 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
2399 AC_CHECK_LIB(virt, virDomainBlockStats,
2400 [with_libvirt="yes"],
2401 [with_libvirt="no (symbol virDomainBlockStats not found)"])
2403 CFLAGS="$SAVE_CFLAGS"
2404 LDFLAGS="$SAVE_LDFLAGS"
2406 dnl Add the right compiler flags and libraries.
2407 if test "x$with_libvirt" = "xyes"; then
2408 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
2409 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
2410 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
2411 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
2414 dnl End of check for libvirt and libxml2 libraries.
2416 # Check for enabled/disabled features
2419 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
2420 # ------------------------------------------------------------
2422 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
2427 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
2432 m4_define([EnDis],[disabled])dnl
2433 m4_define([YesNo],[no])dnl
2439 m4_define([EnDis],[enabled])dnl
2440 m4_define([YesNo],[yes])dnl
2443 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
2447 m4_if([$3], [feature], [],
2451 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
2457 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
2459 enable_$1='[YesNo]'dnl
2461 if test "x$enable_$1" = "xno"
2465 if test "x$enable_$1" = "xyes"
2469 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
2474 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
2475 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
2477 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
2479 # AC_PLUGIN(name, default, info)
2480 # ------------------------------------------------------------
2486 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
2488 if test "x$enableval" = "xyes"
2496 if test "x$2" = "xyes"
2503 if test "x$enable_plugin" = "xyes"
2505 if test "x$2" = "xyes"
2507 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
2508 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
2509 dependency_error="yes"
2510 enable_plugin="no (dependency error)"
2513 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
2514 enable_$1="$enable_plugin"
2516 )# AC_PLUGIN(name, default, info)
2518 m4_divert_once([HELP_ENABLE], [
2519 collectd features:])
2520 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
2521 AC_COLLECTD([debug], [enable], [feature], [debugging])
2522 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
2523 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
2525 dependency_error="no"
2533 plugin_interface="no"
2540 plugin_multimeter="no"
2543 plugin_processes="no"
2547 plugin_tcpconns="no"
2552 plugin_wireless="no"
2555 if test "x$ac_system" = "xLinux"
2557 plugin_battery="yes"
2559 plugin_cpufreq="yes"
2561 plugin_entropy="yes"
2562 plugin_interface="yes"
2567 plugin_processes="yes"
2570 plugin_tcpconns="yes"
2571 plugin_thermal="yes"
2573 plugin_vserver="yes"
2574 plugin_wireless="yes"
2576 if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
2582 if test "x$ac_system" = "xOpenBSD"
2584 plugin_tcpconns="yes"
2588 if test "x$with_libiokit" = "xyes"
2590 plugin_battery="yes"
2595 if test "x$with_devinfo$with_kstat" = "xyesyes"
2599 plugin_interface="yes"
2604 if test "x$have_sys_swap_h$with_kstat$ac_system" = "xyesyesSolaris"
2610 if test "x$with_libstatgrab" = "xyes"
2614 plugin_interface="yes"
2621 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
2626 if test "x$with_libopenipmipthread" = "xyes"
2631 if test "x$have_processor_info" = "xyes"
2635 if test "x$have_sysctlbyname" = "xyes"
2639 plugin_tcpconns="yes"
2642 if test "x$have_statfs" = "xyes"
2646 if test "x$have_statvfs" = "xyes"
2651 if test "x$have_getifaddrs" = "xyes"
2653 plugin_interface="yes"
2656 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
2658 plugin_libvirt="yes"
2661 if test "x$have_getloadavg" = "xyes"
2666 if test "x$have_libperl$have_perl_ithreads" = "xyesyes"
2671 # Mac OS X memory interface
2672 if test "x$have_host_statistics" = "xyes"
2677 if test "x$have_termios_h" = "xyes"
2679 plugin_multimeter="yes"
2682 if test "x$have_thread_info" = "xyes"
2684 plugin_processes="yes"
2687 if test "x$with_kvm_getprocs" = "xyes"
2689 plugin_processes="yes"
2692 if test "x$with_kvm_getswapinfo" = "xyes"
2697 if test "x$with_kvm_nlist" = "xyes"
2699 plugin_tcpconns="yes"
2702 if test "x$have_getutent" = "xyes"
2706 if test "x$have_getutxent" = "xyes"
2711 # FIXME: sysctl for swap plugin
2713 m4_divert_once([HELP_ENABLE], [
2716 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
2717 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
2718 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
2719 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
2720 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
2721 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
2722 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
2723 AC_PLUGIN([csv], [yes], [CSV output plugin])
2724 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
2725 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
2726 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
2727 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
2728 AC_PLUGIN([email], [yes], [EMail statistics])
2729 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
2730 AC_PLUGIN([exec], [yes], [Execution of external programs])
2731 AC_PLUGIN([filecount], [yes], [Count files in directories])
2732 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
2733 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
2734 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
2735 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
2736 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
2737 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
2738 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
2739 AC_PLUGIN([load], [$plugin_load], [System load])
2740 AC_PLUGIN([logfile], [yes], [File logging plugin])
2741 AC_PLUGIN([mbmon], [yes], [Query mbmond])
2742 AC_PLUGIN([memcached], [yes], [memcached statistics])
2743 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
2744 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
2745 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
2746 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
2747 AC_PLUGIN([network], [yes], [Network communication plugin])
2748 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
2749 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
2750 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
2751 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
2752 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
2753 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
2754 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
2755 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
2756 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
2757 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
2758 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
2759 AC_PLUGIN([rrdtool], [$with_rrdtool], [RRDTool output plugin])
2760 AC_PLUGIN([sensors], [$with_lm_sensors], [lm_sensors statistics])
2761 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
2762 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
2763 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
2764 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
2765 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
2766 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
2767 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
2768 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
2769 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
2770 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
2771 AC_PLUGIN([users], [$plugin_users], [User statistics])
2772 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
2773 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
2774 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
2775 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
2776 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
2779 if test "x$ac_system" = "xLinux" \
2780 && test "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
2782 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
2786 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
2788 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2790 PERL_BINDINGS_OPTIONS="$withval"
2791 with_perl_bindings="yes"
2793 PERL_BINDINGS_OPTIONS=""
2794 with_perl_bindings="$withval"
2798 PERL_BINDINGS_OPTIONS=""
2799 if test -n "$perl_interpreter"
2801 with_perl_bindings="yes"
2803 with_perl_bindings="no (no perl interpreter found)"
2806 if test "x$with_perl_bindings" = "xyes"
2808 PERL_BINDINGS="perl"
2812 AC_SUBST(PERL_BINDINGS)
2813 AC_SUBST(PERL_BINDINGS_OPTIONS)
2815 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libiptc/Makefile src/liboconfig/Makefile src/liboping/Makefile bindings/Makefile)
2817 if test "x$with_rrdtool" = "xyes" \
2818 && test "x$librrd_threadsafe" != "xyes"
2820 with_rrdtool="yes (warning: librrd is not thread-safe)"
2823 if test "x$with_liboping" = "xyes" \
2824 && test "x$with_own_liboping" = "xyes"
2826 with_liboping="yes (shipped version)"
2829 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" = "xyes"
2831 with_libiptc="yes (shipped version)"
2834 if test "x$with_libperl" = "xyes"
2836 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
2838 enable_perl="no (needs libperl)"
2841 if test "x$with_perl_bindings" = "xyes" \
2842 && test "x$PERL_BINDINGS_OPTIONS" != "x"
2844 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
2851 libcurl . . . . . . . $with_libcurl
2852 libesmtp . . . . . . $with_libesmtp
2853 libiokit . . . . . . $with_libiokit
2854 libiptc . . . . . . . $with_libiptc
2855 libkstat . . . . . . $with_kstat
2856 libkvm . . . . . . . $with_libkvm
2857 libmysql . . . . . . $with_libmysql
2858 libnetlink . . . . . $with_libnetlink
2859 libnetsnmp . . . . . $with_libnetsnmp
2860 libnotify . . . . . . $with_libnotify
2861 liboconfig . . . . . $with_liboconfig
2862 libopenipmi . . . . . $with_libopenipmipthread
2863 liboping . . . . . . $with_liboping
2864 libpcap . . . . . . . $with_libpcap
2865 libperl . . . . . . . $with_libperl
2866 libpthread . . . . . $with_libpthread
2867 libpq . . . . . . . . $with_libpq
2868 librrd . . . . . . . $with_rrdtool
2869 libsensors . . . . . $with_lm_sensors
2870 libstatgrab . . . . . $with_libstatgrab
2871 libupsclient . . . . $with_libupsclient
2872 libvirt . . . . . . . $with_libvirt
2873 libxml2 . . . . . . . $with_libxml2
2874 libxmms . . . . . . . $with_libxmms
2877 daemon mode . . . . . $enable_daemon
2878 debug . . . . . . . . $enable_debug
2881 perl . . . . . . . . $with_perl_bindings
2884 apache . . . . . . . $enable_apache
2885 apcups . . . . . . . $enable_apcups
2886 apple_sensors . . . . $enable_apple_sensors
2887 ascent . . . . . . . $enable_ascent
2888 battery . . . . . . . $enable_battery
2889 cpu . . . . . . . . . $enable_cpu
2890 cpufreq . . . . . . . $enable_cpufreq
2891 csv . . . . . . . . . $enable_csv
2892 df . . . . . . . . . $enable_df
2893 disk . . . . . . . . $enable_disk
2894 dns . . . . . . . . . $enable_dns
2895 email . . . . . . . . $enable_email
2896 entropy . . . . . . . $enable_entropy
2897 exec . . . . . . . . $enable_exec
2898 filecount . . . . . . $enable_filecount
2899 hddtemp . . . . . . . $enable_hddtemp
2900 interface . . . . . . $enable_interface
2901 iptables . . . . . . $enable_iptables
2902 ipmi . . . . . . . . $enable_ipmi
2903 ipvs . . . . . . . . $enable_ipvs
2904 irq . . . . . . . . . $enable_irq
2905 libvirt . . . . . . . $enable_libvirt
2906 load . . . . . . . . $enable_load
2907 logfile . . . . . . . $enable_logfile
2908 mbmon . . . . . . . . $enable_mbmon
2909 memcached . . . . . . $enable_memcached
2910 memory . . . . . . . $enable_memory
2911 multimeter . . . . . $enable_multimeter
2912 mysql . . . . . . . . $enable_mysql
2913 netlink . . . . . . . $enable_netlink
2914 network . . . . . . . $enable_network
2915 nfs . . . . . . . . . $enable_nfs
2916 nginx . . . . . . . . $enable_nginx
2917 notify_desktop . . . $enable_notify_desktop
2918 notify_email . . . . $enable_notify_email
2919 ntpd . . . . . . . . $enable_ntpd
2920 nut . . . . . . . . . $enable_nut
2921 onewire . . . . . . . $enable_onewire
2922 perl . . . . . . . . $enable_perl
2923 ping . . . . . . . . $enable_ping
2924 postgresql . . . . . $enable_postgresql
2925 powerdns . . . . . . $enable_powerdns
2926 processes . . . . . . $enable_processes
2927 rrdtool . . . . . . . $enable_rrdtool
2928 sensors . . . . . . . $enable_sensors
2929 serial . . . . . . . $enable_serial
2930 snmp . . . . . . . . $enable_snmp
2931 swap . . . . . . . . $enable_swap
2932 syslog . . . . . . . $enable_syslog
2933 tail . . . . . . . . $enable_tail
2934 tape . . . . . . . . $enable_tape
2935 tcpconns . . . . . . $enable_tcpconns
2936 teamspeak2 . . . . . $enable_teamspeak2
2937 thermal . . . . . . . $enable_thermal
2938 unixsock . . . . . . $enable_unixsock
2939 users . . . . . . . . $enable_users
2940 uuid . . . . . . . . $enable_uuid
2941 vmem . . . . . . . . $enable_vmem
2942 vserver . . . . . . . $enable_vserver
2943 wireless . . . . . . $enable_wireless
2944 xmms . . . . . . . . $enable_xmms
2948 if test "x$dependency_error" = "xyes"; then
2949 AC_MSG_ERROR("Some plugins are missing dependencies - see above summary for details")