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)
6 m4_ifdef([LT_PACKAGE_VERSION],
9 LT_CONFIG_LTDL_DIR([libltdl])
11 LTDL_INIT([convenience])
16 AC_LIBLTDL_CONVENIENCE
20 AC_CONFIG_SUBDIRS(libltdl)
24 AM_INIT_AUTOMAKE(dist-bzip2)
27 AC_PREFIX_DEFAULT("/opt/collectd")
32 # Checks for programs.
40 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
48 AC_MSG_CHECKING([for kernel type ($host_os)])
51 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
55 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
67 AC_MSG_RESULT([$ac_system])
69 if test "x$ac_system" = "xLinux"
71 AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
72 if test -z "$KERNEL_DIR"
74 KERNEL_DIR="/lib/modules/`uname -r`/source"
77 KERNEL_CFLAGS="-I$KERNEL_DIR/include"
78 AC_SUBST(KERNEL_CFLAGS)
81 if test "x$ac_system" = "xSolaris"
83 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.])
86 # Where to install .pc files.
87 pkgconfigdir="${libdir}/pkgconfig"
88 AC_SUBST(pkgconfigdir)
90 # Check for standards compliance mode
91 AC_ARG_ENABLE(standards,
92 AS_HELP_STRING([--enable-standards], [Enable standards compliance mode]),
93 [enable_standards="$enableval"],
94 [enable_standards="no"])
95 if test "x$enable_standards" = "xyes"
97 AC_DEFINE(_ISOC99_SOURCE, 1, [Define to enforce ISO C99 compliance.])
98 AC_DEFINE(_POSIX_C_SOURCE, 200112L, [Define to enforce POSIX.1-2001 compliance.])
99 AC_DEFINE(_XOPEN_SOURCE, 600, [Define to enforce X/Open 6 (XSI) compliance.])
100 AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.])
102 AM_CONDITIONAL(BUILD_FEATURE_STANDARDS, test "x$enable_standards" = "xyes")
105 # Checks for header files.
112 AC_CHECK_HEADERS(stdio.h stdint.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)
115 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
120 # include <sys/types.h>
123 AC_CHECK_HEADERS(netinet/in.h, [], [],
128 # include <sys/types.h>
130 #if HAVE_NETINET_IN_SYSTM_H
131 # include <netinet/in_systm.h>
134 AC_CHECK_HEADERS(netinet/ip.h, [], [],
139 # include <sys/types.h>
141 #if HAVE_NETINET_IN_SYSTM_H
142 # include <netinet/in_systm.h>
144 #if HAVE_NETINET_IN_H
145 # include <netinet/in.h>
148 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
153 # include <sys/types.h>
155 #if HAVE_NETINET_IN_SYSTM_H
156 # include <netinet/in_systm.h>
158 #if HAVE_NETINET_IN_H
159 # include <netinet/in.h>
161 #if HAVE_NETINET_IP_H
162 # include <netinet/ip.h>
165 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
170 # include <sys/types.h>
172 #if HAVE_NETINET_IN_SYSTM_H
173 # include <netinet/in_systm.h>
175 #if HAVE_NETINET_IN_H
176 # include <netinet/in.h>
178 #if HAVE_NETINET_IP_H
179 # include <netinet/ip.h>
182 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
187 # include <sys/types.h>
189 #if HAVE_NETINET_IN_SYSTM_H
190 # include <netinet/in_systm.h>
192 #if HAVE_NETINET_IN_H
193 # include <netinet/in.h>
196 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
201 # include <sys/types.h>
203 #if HAVE_NETINET_IN_SYSTM_H
204 # include <netinet/in_systm.h>
206 #if HAVE_NETINET_IN_H
207 # include <netinet/in.h>
209 #if HAVE_NETINET_IP6_H
210 # include <netinet/ip6.h>
213 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
218 # include <sys/types.h>
220 #if HAVE_NETINET_IN_SYSTM_H
221 # include <netinet/in_systm.h>
223 #if HAVE_NETINET_IN_H
224 # include <netinet/in.h>
226 #if HAVE_NETINET_IP_H
227 # include <netinet/ip.h>
230 AC_CHECK_HEADERS(netinet/udp.h, [], [],
235 # include <sys/types.h>
237 #if HAVE_NETINET_IN_SYSTM_H
238 # include <netinet/in_systm.h>
240 #if HAVE_NETINET_IN_H
241 # include <netinet/in.h>
243 #if HAVE_NETINET_IP_H
244 # include <netinet/ip.h>
249 AC_CHECK_HEADERS(sys/dkstat.h)
250 if test "x$ac_system" = "xDarwin"
252 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)
253 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
255 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
258 # include <sys/types.h>
261 # include <sys/param.h>
266 AC_CHECK_HEADERS(linux/major.h libgen.h)
268 # For the battery plugin
269 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
271 #if HAVE_IOKIT_IOKITLIB_H
272 # include <IOKit/IOKitLib.h>
274 #if HAVE_IOKIT_IOTYPES_H
275 # include <IOKit/IOTypes.h>
279 # For the swap module
280 have_linux_wireless_h="no"
281 if test "x$ac_system" = "xLinux"
283 AC_CHECK_HEADERS(linux/wireless.h,
284 [have_linux_wireless_h="yes"],
285 [have_linux_wireless_h="no"],
288 #include <sys/ioctl.h>
289 #include <sys/socket.h>
293 # For the swap module
294 have_sys_swap_h="yes"
295 AC_CHECK_HEADERS(sys/swap.h vm/anon.h, [], [have_sys_swap_h="no"],
297 #undef _FILE_OFFSET_BITS
298 #undef _LARGEFILE64_SOURCE
300 # include <sys/types.h>
303 # include <sys/param.h>
307 if test "x$have_sys_swap_h$ac_system" = "xnoSolaris"
310 if test "x$GCC" = "xyes"
312 hint_64="CFLAGS='-m64'"
314 hint_64="CFLAGS='-xarch=v9'"
316 AC_MSG_NOTICE([Solaris detected and sys/swap.h not usable. Try building a 64-bit binary ($hint_64 ./configure).])
320 # For the processes plugin
322 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
324 # For interface plugin
325 AC_CHECK_HEADERS(ifaddrs.h)
326 AC_CHECK_HEADERS(net/if.h, [], [],
329 # include <sys/types.h>
331 #if HAVE_SYS_SOCKET_H
332 # include <sys/socket.h>
335 AC_CHECK_HEADERS(linux/if.h, [], [],
338 # include <sys/types.h>
340 #if HAVE_SYS_SOCKET_H
341 # include <sys/socket.h>
344 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
347 # include <sys/types.h>
349 #if HAVE_SYS_SOCKET_H
350 # include <sys/socket.h>
353 # include <linux/if.h>
358 have_net_ip_vs_h="no"
360 if test "x$ac_system" = "xLinux"
362 SAVE_CFLAGS="$CFLAGS"
363 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
365 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
366 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
368 CFLAGS="$SAVE_CFLAGS"
372 AC_CHECK_HEADERS(sys/ucred.h, [], [],
375 # include <sys/types.h>
378 # include <sys/param.h>
382 # For mount interface
383 AC_CHECK_HEADERS(sys/mount.h, [], [],
386 # include <sys/types.h>
389 # include <sys/param.h>
393 # For the email plugin
394 AC_CHECK_HEADERS(linux/un.h, [], [],
396 #if HAVE_SYS_SOCKET_H
397 # include <sys/socket.h>
401 AC_CHECK_HEADERS(pwd.h grp.h sys/un.h ctype.h limits.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)
404 AC_CHECK_HEADERS(arpa/nameser.h)
405 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
407 #if HAVE_ARPA_NAMESER_H
408 # include <arpa/nameser.h>
412 AC_CHECK_HEADERS(net/if_arp.h, [], [],
413 [#if HAVE_SYS_SOCKET_H
414 # include <sys/socket.h>
417 AC_CHECK_HEADERS(net/ppp_defs.h)
418 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
419 [#if HAVE_NET_PPP_DEFS_H
420 # include <net/ppp_defs.h>
423 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
428 # include <sys/types.h>
430 #if HAVE_SYS_SOCKET_H
431 # include <sys/socket.h>
436 #if HAVE_NETINET_IN_H
437 # include <netinet/in.h>
441 # For the multimeter plugin
443 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
446 # Checks for typedefs, structures, and compiler characteristics.
455 # Checks for library functions.
457 AC_PROG_GCC_TRADITIONAL
458 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf)
462 AC_CACHE_CHECK([for strtok_r],
463 [c_cv_have_strtok_r_default],
472 char buffer[] = "foo,bar,baz";
479 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
482 printf ("token = %s;\n", token);
485 [c_cv_have_strtok_r_default="yes"],
486 [c_cv_have_strtok_r_default="no"]
490 if test "x$c_cv_have_strtok_r_default" = "xno"
492 SAVE_CFLAGS="$CFLAGS"
493 CFLAGS="$CFLAGS -D_REENTRANT=1"
495 AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
496 [c_cv_have_strtok_r_reentrant],
505 char buffer[] = "foo,bar,baz";
512 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
515 printf ("token = %s;\n", token);
518 [c_cv_have_strtok_r_reentrant="yes"],
519 [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
524 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
526 socket_needs_socket="no"
527 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
528 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
530 nanosleep_needs_rt="no"
531 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
532 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
534 AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"])
535 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
536 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
537 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
538 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
539 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
540 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
541 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
542 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
543 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
544 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
545 AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"])
548 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
551 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
553 if test "x$withval" = "xno"; then
555 else if test "x$withval" = "xyes"; then
562 if test "x$nan_type" = "xnone"; then
563 AC_CACHE_CHECK([whether NAN is defined by default],
564 [c_cv_have_nan_default],
570 static float foo = NAN;
578 [c_cv_have_nan_default="yes"],
579 [c_cv_have_nan_default="no"]
582 if test "x$c_cv_have_nan_default" = "xyes"
587 if test "x$nan_type" = "xnone"; then
588 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
589 [c_cv_have_nan_isoc],
594 #define __USE_ISOC99 1
596 static float foo = NAN;
604 [c_cv_have_nan_isoc="yes"],
605 [c_cv_have_nan_isoc="no"]
608 if test "x$c_cv_have_nan_isoc" = "xyes"
613 if test "x$nan_type" = "xnone"; then
614 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
615 [c_cv_have_nan_zero],
624 #define NAN (0.0 / 0.0)
626 # define isnan(f) ((f) != (f))
628 static float foo = NAN;
636 [c_cv_have_nan_zero="yes"],
637 [c_cv_have_nan_zero="no"]
640 if test "x$c_cv_have_nan_zero" = "xyes"
646 if test "x$nan_type" = "xdefault"; then
647 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
648 [Define if NAN is defined by default and can initialize static variables.])
649 else if test "x$nan_type" = "xisoc99"; then
650 AC_DEFINE(NAN_STATIC_ISOC, 1,
651 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
652 else if test "x$nan_type" = "xzero"; then
653 AC_DEFINE(NAN_ZERO_ZERO, 1,
654 [Define if NAN can be defined as (0.0 / 0.0)])
656 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
659 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
661 if test "x$withval" = "xnothing"; then
662 fp_layout_type="nothing"
663 else if test "x$withval" = "xendianflip"; then
664 fp_layout_type="endianflip"
665 else if test "x$withval" = "xintswap"; then
666 fp_layout_type="intswap"
668 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
671 [fp_layout_type="unknown"])
673 if test "x$fp_layout_type" = "xunknown"; then
674 AC_CACHE_CHECK([if doubles are stored in x86 representation],
675 [c_cv_fp_layout_need_nothing],
686 # include <stdbool.h>
696 memcpy ((void *) &i0, (void *) &d, 8);
699 memcpy ((void *) c, (void *) &i1, 8);
701 if ((c[0] == 0x2f) && (c[1] == 0x25)
702 && (c[2] == 0xc0) && (c[3] == 0xc7)
703 && (c[4] == 0x43) && (c[5] == 0x2b)
704 && (c[6] == 0x1f) && (c[7] == 0x5b))
709 [c_cv_fp_layout_need_nothing="yes"],
710 [c_cv_fp_layout_need_nothing="no"]
713 if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then
714 fp_layout_type="nothing"
717 if test "x$fp_layout_type" = "xunknown"; then
718 AC_CACHE_CHECK([if endianflip converts to x86 representation],
719 [c_cv_fp_layout_need_endianflip],
730 # include <stdbool.h>
732 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
733 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
734 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
735 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
736 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
737 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
738 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
739 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
748 memcpy ((void *) &i0, (void *) &d, 8);
750 i1 = endianflip (i0);
751 memcpy ((void *) c, (void *) &i1, 8);
753 if ((c[0] == 0x2f) && (c[1] == 0x25)
754 && (c[2] == 0xc0) && (c[3] == 0xc7)
755 && (c[4] == 0x43) && (c[5] == 0x2b)
756 && (c[6] == 0x1f) && (c[7] == 0x5b))
761 [c_cv_fp_layout_need_endianflip="yes"],
762 [c_cv_fp_layout_need_endianflip="no"]
765 if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then
766 fp_layout_type="endianflip"
769 if test "x$fp_layout_type" = "xunknown"; then
770 AC_CACHE_CHECK([if intswap converts to x86 representation],
771 [c_cv_fp_layout_need_intswap],
782 # include <stdbool.h>
784 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
785 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
794 memcpy ((void *) &i0, (void *) &d, 8);
797 memcpy ((void *) c, (void *) &i1, 8);
799 if ((c[0] == 0x2f) && (c[1] == 0x25)
800 && (c[2] == 0xc0) && (c[3] == 0xc7)
801 && (c[4] == 0x43) && (c[5] == 0x2b)
802 && (c[6] == 0x1f) && (c[7] == 0x5b))
807 [c_cv_fp_layout_need_intswap="yes"],
808 [c_cv_fp_layout_need_intswap="no"]
811 if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then
812 fp_layout_type="intswap"
816 if test "x$fp_layout_type" = "xnothing"; then
817 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
818 [Define if doubles are stored in x86 representation.])
819 else if test "x$fp_layout_type" = "xendianflip"; then
820 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
821 [Define if endianflip is needed to convert to x86 representation.])
822 else if test "x$fp_layout_type" = "xintswap"; then
823 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
824 [Define if intswap is needed to convert to x86 representation.])
826 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
830 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
832 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
834 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
837 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
838 if test "x$have_getmntent" = "xno"; then
839 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
841 if test "x$have_getmntent" = "xno"; then
842 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
844 if test "x$have_getmntent" = "xno"; then
845 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
848 if test "x$have_getmntent" = "xc"; then
849 AC_CACHE_CHECK([whether getmntent takes one argument],
850 [c_cv_have_one_getmntent],
852 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
853 #include "$srcdir/src/utils_mount.h"]],
857 fh = setmntent ("/etc/mtab", "r");
861 [c_cv_have_one_getmntent="yes"],
862 [c_cv_have_one_getmntent="no"]
865 AC_CACHE_CHECK([whether getmntent takes two arguments],
866 [c_cv_have_two_getmntent],
868 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
869 #include "$srcdir/src/utils_mount.h"]],
874 fh = fopen ("/etc/mnttab", "r");
875 status = getmntent (fh, &mt);
878 [c_cv_have_two_getmntent="yes"],
879 [c_cv_have_two_getmntent="no"]
884 # Check for different versions of `getmntent' here..
886 if test "x$have_getmntent" = "xc"; then
887 if test "x$c_cv_have_one_getmntent" = "xyes"; then
888 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
889 [Define if the function getmntent exists and takes one argument.])
891 if test "x$c_cv_have_two_getmntent" = "xyes"; then
892 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
893 [Define if the function getmntent exists and takes two arguments.])
896 if test "x$have_getmntent" = "xsun"; then
897 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
898 [Define if the function getmntent exists. It's the version from libsun.])
900 if test "x$have_getmntent" = "xseq"; then
901 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
902 [Define if the function getmntent exists. It's the version from libseq.])
904 if test "x$have_getmntent" = "xgen"; then
905 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
906 [Define if the function getmntent exists. It's the version from libgen.])
909 # Check for structures
910 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
911 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
914 #include <sys/types.h>
915 #include <sys/socket.h>
918 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
919 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
922 #include <sys/types.h>
923 #include <sys/socket.h>
924 #include <linux/if.h>
925 #include <linux/netdevice.h>
928 AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
930 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
931 [Define if struct kinfo_proc exists in the FreeBSD variant.])
932 have_struct_kinfo_proc_freebsd="yes"
935 have_struct_kinfo_proc_freebsd="no"
939 #include <sys/param.h>
940 #include <sys/sysctl.h>
941 #include <sys/user.h>
944 AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc],
946 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
947 [Define if struct kinfo_proc exists in the OpenBSD variant.])
948 have_struct_kinfo_proc_openbsd="yes"
951 have_struct_kinfo_proc_openbsd="no"
954 #include <sys/param.h>
955 #include <sys/sysctl.h>
959 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
965 # include <sys/types.h>
967 #if HAVE_NETINET_IN_SYSTM_H
968 # include <netinet/in_systm.h>
970 #if HAVE_NETINET_IN_H
971 # include <netinet/in.h>
973 #if HAVE_NETINET_IP_H
974 # include <netinet/ip.h>
976 #if HAVE_NETINET_UDP_H
977 # include <netinet/udp.h>
980 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
986 # include <sys/types.h>
988 #if HAVE_NETINET_IN_SYSTM_H
989 # include <netinet/in_systm.h>
991 #if HAVE_NETINET_IN_H
992 # include <netinet/in.h>
994 #if HAVE_NETINET_IP_H
995 # include <netinet/ip.h>
997 #if HAVE_NETINET_UDP_H
998 # include <netinet/udp.h>
1002 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
1012 # Checks for libraries begin here
1014 with_libresolv="yes"
1015 AC_CHECK_LIB(resolv, res_search,
1017 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
1019 [with_libresolv="no"])
1020 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
1022 dnl Check for HAL (hardware abstraction library)
1024 AC_CHECK_LIB(hal,libhal_device_property_exists,
1025 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
1027 if test "x$with_libhal" = "xyes"; then
1028 if test "x$PKG_CONFIG" != "x"; then
1029 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
1030 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
1031 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
1032 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
1036 m4_divert_once([HELP_WITH], [
1037 collectd additional packages:])
1039 if test "x$ac_system" = "xSolaris"
1044 with_kstat="no (Solaris only)"
1045 with_devinfo="no (Solaris only)"
1048 if test "x$with_kstat" = "xyes"
1050 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1052 if test "x$with_kstat" = "xyes"
1054 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1055 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1057 if test "x$with_kstat" = "xyes"
1059 AC_DEFINE(HAVE_LIBKSTAT, 1,
1060 [Define to 1 if you have the 'kstat' library (-lkstat)])
1062 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1063 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1066 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1073 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1076 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1077 if test "x$with_kvm_getprocs" = "xyes"
1079 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1080 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1083 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1085 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1086 if test "x$with_kvm_getswapinfo" = "xyes"
1088 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1089 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1092 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1094 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1095 if test "x$with_kvm_nlist" = "xyes"
1097 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1098 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1101 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1103 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1104 if test "x$with_kvm_openfiles" = "xyes"
1106 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1107 [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1110 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1112 # --with-libcurl {{{
1113 with_curl_config="curl-config"
1116 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1118 if test "x$withval" = "xno"
1121 else if test "x$withval" = "xyes"
1125 if test -f "$withval" && test -x "$withval"
1127 with_curl_config="$withval"
1129 else if test -x "$withval/bin/curl-config"
1131 with_curl_config="$withval/bin/curl-config"
1140 if test "x$with_libcurl" = "xyes"
1142 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1143 curl_config_status=$?
1145 if test $curl_config_status -ne 0
1147 with_libcurl="no ($with_curl_config failed)"
1149 SAVE_CPPFLAGS="$CPPFLAGS"
1150 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1152 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1154 CPPFLAGS="$SAVE_CPPFLAGS"
1157 if test "x$with_libcurl" = "xyes"
1159 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1160 curl_config_status=$?
1162 if test $curl_config_status -ne 0
1164 with_libcurl="no ($with_curl_config failed)"
1166 AC_CHECK_LIB(curl, curl_easy_init,
1167 [with_libcurl="yes"],
1168 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1172 if test "x$with_libcurl" = "xyes"
1174 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1175 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1176 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1177 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1179 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1183 with_libdbi_cppflags=""
1184 with_libdbi_ldflags=""
1185 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1187 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1189 with_libdbi_cppflags="-I$withval/include"
1190 with_libdbi_ldflags="-L$withval/lib"
1193 with_libdbi="$withval"
1199 if test "x$with_libdbi" = "xyes"
1201 SAVE_CPPFLAGS="$CPPFLAGS"
1202 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1204 AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1206 CPPFLAGS="$SAVE_CPPFLAGS"
1208 if test "x$with_libdbi" = "xyes"
1210 SAVE_CPPFLAGS="$CPPFLAGS"
1211 SAVE_LDFLAGS="$LDFLAGS"
1212 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1213 LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1215 AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1217 CPPFLAGS="$SAVE_CPPFLAGS"
1218 LDFLAGS="$SAVE_LDFLAGS"
1220 if test "x$with_libdbi" = "xyes"
1222 BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1223 BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1224 BUILD_WITH_LIBDBI_LIBS="-ldbi"
1225 AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1226 AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1227 AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1229 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1232 # --with-libesmtp {{{
1233 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1235 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1237 LDFLAGS="$LDFLAGS -L$withval/lib"
1238 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1241 with_libesmtp="$withval"
1247 if test "x$with_libesmtp" = "xyes"
1249 AC_CHECK_LIB(esmtp, smtp_create_session,
1251 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1252 ], [with_libesmtp="no (libesmtp not found)"])
1254 if test "x$with_libesmtp" = "xyes"
1256 AC_CHECK_HEADERS(libesmtp.h,
1258 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1259 ], [with_libesmtp="no (libesmtp.h not found)"])
1261 if test "x$with_libesmtp" = "xyes"
1267 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1268 [Wether or not to use the esmtp library])
1269 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1272 # --with-libganglia {{{
1273 AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
1275 if test -f "$withval" && test -x "$withval"
1277 with_libganglia_config="$withval"
1278 with_libganglia="yes"
1279 else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"
1281 with_libganglia_config="$withval/bin/ganglia-config"
1282 with_libganglia="yes"
1283 else if test -d "$withval"
1285 GANGLIA_CPPFLAGS="-I$withval/include"
1286 GANGLIA_LDFLAGS="-L$withval/lib"
1287 with_libganglia="yes"
1289 with_libganglia_config="ganglia-config"
1290 with_libganglia="$withval"
1294 with_libganglia_config="ganglia-config"
1295 with_libganglia="yes"
1298 if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x"
1300 if test "x$GANGLIA_CPPFLAGS" = "x"
1302 GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
1305 if test "x$GANGLIA_LDFLAGS" = "x"
1307 GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
1310 if test "x$GANGLIA_LIBS" = "x"
1312 GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
1316 SAVE_CPPFLAGS="$CPPFLAGS"
1317 SAVE_LDFLAGS="$LDFLAGS"
1318 CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
1319 LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
1321 if test "x$with_libganglia" = "xyes"
1323 AC_CHECK_HEADERS(gm_protocol.h,
1325 AC_DEFINE(HAVE_GM_PROTOCOL_H, 1,
1326 [Define to 1 if you have the <gm_protocol.h> header file.])
1327 ], [with_libganglia="no (gm_protocol.h not found)"])
1330 if test "x$with_libganglia" = "xyes"
1332 AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg,
1334 AC_DEFINE(HAVE_LIBGANGLIA, 1,
1335 [Define to 1 if you have the ganglia library (-lganglia).])
1336 ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"])
1339 CPPFLAGS="$SAVE_CPPFLAGS"
1340 LDFLAGS="$SAVE_LDFLAGS"
1342 AC_SUBST(GANGLIA_CPPFLAGS)
1343 AC_SUBST(GANGLIA_LDFLAGS)
1344 AC_SUBST(GANGLIA_LIBS)
1345 AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
1348 # --with-libgcrypt {{{
1349 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS"
1350 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS"
1351 GCRYPT_LIBS="$GCRYPT_LIBS"
1352 AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])],
1354 if test -f "$withval" && test -x "$withval"
1356 with_libgcrypt_config="$withval"
1357 with_libgcrypt="yes"
1358 else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"
1360 with_libgcrypt_config="$withval/bin/gcrypt-config"
1361 with_libgcrypt="yes"
1362 else if test -d "$withval"
1364 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
1365 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
1366 with_libgcrypt="yes"
1368 with_libgcrypt_config="gcrypt-config"
1369 with_libgcrypt="$withval"
1373 with_libgcrypt_config="libgcrypt-config"
1374 with_libgcrypt="yes"
1377 if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x"
1379 if test "x$GCRYPT_CPPFLAGS" = "x"
1381 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
1384 if test "x$GCRYPT_LDFLAGS" = "x"
1386 gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null`
1387 GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib"
1390 if test "x$GCRYPT_LIBS" = "x"
1392 GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
1396 SAVE_CPPFLAGS="$CPPFLAGS"
1397 SAVE_LDFLAGS="$LDFLAGS"
1398 CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
1399 LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
1401 if test "x$with_libgcrypt" = "xyes"
1403 if test "x$GCRYPT_CPPFLAGS" != "x"
1405 AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS])
1407 AC_CHECK_HEADERS(gcrypt.h,
1408 [with_libgcrypt="yes"],
1409 [with_libgcrypt="no (gcrypt.h not found)"])
1412 if test "x$with_libgcrypt" = "xyes"
1414 if test "x$GCRYPT_LDFLAGS" != "x"
1416 AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS])
1418 AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
1419 [with_libgcrypt="yes"],
1420 [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
1422 if test "$with_libgcrypt" != "no"; then
1423 AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")
1427 CPPFLAGS="$SAVE_CPPFLAGS"
1428 LDFLAGS="$SAVE_LDFLAGS"
1430 if test "x$with_libgcrypt" = "xyes"
1432 AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).])
1435 AC_SUBST(GCRYPT_CPPFLAGS)
1436 AC_SUBST(GCRYPT_LDFLAGS)
1437 AC_SUBST(GCRYPT_LIBS)
1438 AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes")
1441 # --with-libiptc {{{
1442 with_own_libiptc="no"
1443 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1445 if test "x$withval" = "xshipped"
1447 with_own_libiptc="yes"
1449 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
1451 LIBIPTC_CPPFLAGS="$LIBIPTC_CPPFLAGS -I$withval/include"
1452 LIBIPTC_LDFLAGS="$LIBIPTC_LDFLAGS -L$withval/lib"
1455 with_libiptc="$withval"
1459 if test "x$ac_system" = "xLinux"
1463 with_libiptc="no (Linux only)"
1466 if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xno"
1468 AC_CHECK_LIB(iptc, iptc_init,
1470 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1474 with_own_libiptc="yes"
1477 if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xno"
1479 AC_CHECK_HEADERS(libiptc/libiptc.h,
1481 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1485 with_own_libiptc="yes"
1488 if test "x$with_libiptc" = "xyes"
1490 SAVE_CPPFLAGS="$CPPFLAGS"
1491 CPPFLAGS="$CPPFLAGS $LIBIPTC_CPPFLAGS"
1493 AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h, [],
1495 with_libiptc="no (Linux iptables headers not found - check KERNEL_DIR)"
1496 with_own_libiptc="no"
1499 #include "$srcdir/src/owniptc/ipt_kernel_headers.h"
1502 CPPFLAGS="$SAVE_CPPFLAGS"
1504 if test "x$with_libiptc" = "xyes"
1506 SAVE_CPPFLAGS="$CPPFLAGS"
1507 CPPFLAGS="$CPPFLAGS $LIBIPTC_CPPFLAGS"
1509 AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [],
1512 # include "$srcdir/src/owniptc/libiptc.h"
1513 # include "$srcdir/src/owniptc/libip6tc.h"
1515 # include <libiptc/libiptc.h>
1516 # include <libiptc/libip6tc.h>
1520 CPPFLAGS="$SAVE_CPPFLAGS"
1522 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1523 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_own_libiptc" = "xyes")
1524 if test "x$with_libiptc" = "xyes"
1526 BUILD_WITH_LIBIPTC_CPPFLAGS="$LIBIPTC_CPPFLAGS"
1527 BUILD_WITH_LIBIPTC_LDFLAGS="$LIBIPTC_LDFLAGS"
1528 AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS)
1529 AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS)
1531 if test "x$with_own_libiptc" = "xyes"
1533 AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1538 with_java_home="$JAVA_HOME"
1539 with_java_vmtype="client"
1543 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
1545 if test "x$withval" = "xno"
1548 else if test "x$withval" = "xyes"
1552 with_java_home="$withval"
1557 if test "x$with_java" = "xyes"
1559 if test -d "$with_java_home"
1561 AC_MSG_CHECKING([for jni.h])
1562 TMPDIR=`find -L "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1563 if test "x$TMPDIR" != "x"
1565 AC_MSG_RESULT([found in $TMPDIR])
1566 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1568 AC_MSG_RESULT([not found])
1571 AC_MSG_CHECKING([for jni_md.h])
1572 TMPDIR=`find -L "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1573 if test "x$TMPDIR" != "x"
1575 AC_MSG_RESULT([found in $TMPDIR])
1576 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1578 AC_MSG_RESULT([not found])
1581 AC_MSG_CHECKING([for libjvm.so])
1582 TMPDIR=`find -L "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' | head -n 1`
1583 if test "x$TMPDIR" != "x"
1585 AC_MSG_RESULT([found in $TMPDIR])
1586 JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPDIR -Wl,-rpath -Wl,$TMPDIR"
1588 AC_MSG_RESULT([not found])
1591 if test "x$JAVAC" = "x"
1593 AC_MSG_CHECKING([for javac])
1594 TMPDIR=`find -L "$with_java_home" -name javac -type f | head -n 1`
1595 if test "x$TMPDIR" != "x"
1598 AC_MSG_RESULT([$JAVAC])
1600 AC_MSG_RESULT([not found])
1603 else if test "x$with_java_home" != "x"
1605 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
1609 if test "x$JAVA_CPPFLAGS" != "x"
1611 AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
1613 if test "x$JAVA_CFLAGS" != "x"
1615 AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
1617 if test "x$JAVA_LDFLAGS" != "x"
1619 AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
1621 if test "x$JAVAC" = "x"
1623 with_javac_path="$PATH"
1624 if test "x$with_java_home" != "x"
1626 with_javac_path="$with_java_home:with_javac_path"
1627 if test -d "$with_java_home/bin"
1629 with_javac_path="$with_java_home/bin:with_javac_path"
1633 AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
1635 if test "x$JAVAC" = "x"
1637 with_java="no (javac not found)"
1640 SAVE_CPPFLAGS="$CPPFLAGS"
1641 SAVE_CFLAGS="$CFLAGS"
1642 SAVE_LDFLAGS="$LDFLAGS"
1643 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
1644 CFLAGS="$CFLAGS $JAVA_CFLAGS"
1645 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
1647 if test "x$with_java" = "xyes"
1649 AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
1651 if test "x$with_java" = "xyes"
1653 AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
1655 [with_java="no (libjvm not found)"],
1658 if test "x$with_java" = "xyes"
1660 JAVA_LIBS="$JAVA_LIBS -ljvm"
1661 AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
1664 CPPFLAGS="$SAVE_CPPFLAGS"
1665 CFLAGS="$SAVE_CFLAGS"
1666 LDFLAGS="$SAVE_LDFLAGS"
1668 AC_SUBST(JAVA_CPPFLAGS)
1669 AC_SUBST(JAVA_CFLAGS)
1670 AC_SUBST(JAVA_LDFLAGS)
1672 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
1675 # --with-libmemcached {{{
1676 with_libmemcached_cppflags=""
1677 with_libmemcached_ldflags=""
1678 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
1680 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1682 with_libmemcached_cppflags="-I$withval/include"
1683 with_libmemcached_ldflags="-L$withval/lib"
1684 with_libmemcached="yes"
1686 with_libmemcached="$withval"
1690 with_libmemcached="yes"
1692 if test "x$with_libmemcached" = "xyes"
1694 SAVE_CPPFLAGS="$CPPFLAGS"
1695 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
1697 AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
1699 CPPFLAGS="$SAVE_CPPFLAGS"
1701 if test "x$with_libmemcached" = "xyes"
1703 SAVE_CPPFLAGS="$CPPFLAGS"
1704 SAVE_LDFLAGS="$LDFLAGS"
1705 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
1706 LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
1708 AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
1710 CPPFLAGS="$SAVE_CPPFLAGS"
1711 LDFLAGS="$SAVE_LDFLAGS"
1713 if test "x$with_libmemcached" = "xyes"
1715 BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
1716 BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
1717 BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
1718 AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
1719 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
1720 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
1721 AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
1723 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
1726 # --with-libmysql {{{
1727 with_mysql_config="mysql_config"
1728 with_mysql_cflags=""
1730 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1732 if test "x$withval" = "xno"
1735 else if test "x$withval" = "xyes"
1739 if test -f "$withval" && test -x "$withval";
1741 with_mysql_config="$withval"
1742 else if test -x "$withval/bin/mysql_config"
1744 with_mysql_config="$withval/bin/mysql_config"
1752 if test "x$with_libmysql" = "xyes"
1754 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1755 mysql_config_status=$?
1757 if test $mysql_config_status -ne 0
1759 with_libmysql="no ($with_mysql_config failed)"
1761 SAVE_CPPFLAGS="$CPPFLAGS"
1762 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
1765 have_mysql_mysql_h="no"
1766 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
1768 if test "x$have_mysql_h" = "xno"
1770 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
1773 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
1775 with_libmysql="no (mysql.h not found)"
1778 CPPFLAGS="$SAVE_CPPFLAGS"
1781 if test "x$with_libmysql" = "xyes"
1783 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
1784 mysql_config_status=$?
1786 if test $mysql_config_status -ne 0
1788 with_libmysql="no ($with_mysql_config failed)"
1790 AC_CHECK_LIB(mysqlclient, mysql_init,
1791 [with_libmysql="yes"],
1792 [with_libmysql="no (symbol 'mysql_init' not found)"],
1795 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
1796 [with_libmysql="yes"],
1797 [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
1801 if test "x$with_libmysql" = "xyes"
1803 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
1804 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
1805 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
1806 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
1808 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
1811 # --with-libnetlink {{{
1812 with_libnetlink_cflags=""
1813 with_libnetlink_libs="-lnetlink"
1814 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
1816 echo "libnetlink: withval = $withval"
1817 if test "x$withval" = "xyes"
1819 with_libnetlink="yes"
1820 else if test "x$withval" = "xno"
1822 with_libnetlink="no"
1824 if test -d "$withval/include"
1826 with_libnetlink_cflags="-I$withval/include"
1827 with_libnetlink_libs="-L$withval/lib -lnetlink"
1828 with_libnetlink="yes"
1830 AC_MSG_ERROR("no such directory: $withval/include")
1835 if test "x$ac_system" = "xLinux"
1837 with_libnetlink="yes"
1839 with_libnetlink="no (Linux only library)"
1842 if test "x$with_libnetlink" = "xyes"
1844 SAVE_CFLAGS="$CFLAGS"
1845 CFLAGS="$CFLAGS $with_libnetlink_cflags"
1847 with_libnetlink="no (libnetlink.h not found)"
1849 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
1851 with_libnetlink="yes"
1855 #include <sys/types.h>
1856 #include <asm/types.h>
1857 #include <sys/socket.h>
1858 #include <linux/netlink.h>
1859 #include <linux/rtnetlink.h>])
1860 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
1862 #include <sys/types.h>
1863 #include <asm/types.h>
1864 #include <sys/socket.h>])
1868 #include <sys/types.h>
1869 #include <asm/types.h>
1870 #include <sys/socket.h>
1871 #include <linux/netlink.h>
1872 #include <linux/rtnetlink.h>
1876 int retval = TCA_STATS2;
1879 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
1884 #include <sys/types.h>
1885 #include <asm/types.h>
1886 #include <sys/socket.h>
1887 #include <linux/netlink.h>
1888 #include <linux/rtnetlink.h>
1892 int retval = TCA_STATS;
1895 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
1898 CFLAGS="$SAVE_CFLAGS"
1900 if test "x$with_libnetlink" = "xyes"
1902 AC_CHECK_LIB(netlink, rtnl_open,
1903 [with_libnetlink="yes"],
1904 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
1905 [$with_libnetlink_libs])
1907 if test "x$with_libnetlink" = "xyes"
1909 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
1910 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
1911 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
1912 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
1914 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
1917 # --with-libnetsnmp {{{
1918 with_snmp_config="net-snmp-config"
1921 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1923 if test "x$withval" = "xno"
1925 with_libnetsnmp="no"
1926 else if test "x$withval" = "xyes"
1928 with_libnetsnmp="yes"
1930 if test -x "$withval"
1932 with_snmp_config="$withval"
1933 with_libnetsnmp="yes"
1935 with_snmp_config="$withval/bin/net-snmp-config"
1936 with_libnetsnmp="yes"
1940 [with_libnetsnmp="yes"])
1941 if test "x$with_libnetsnmp" = "xyes"
1943 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
1944 snmp_config_status=$?
1946 if test $snmp_config_status -ne 0
1948 with_libnetsnmp="no ($with_snmp_config failed)"
1950 SAVE_CPPFLAGS="$CPPFLAGS"
1951 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
1953 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1955 CPPFLAGS="$SAVE_CPPFLAGS"
1958 if test "x$with_libnetsnmp" = "xyes"
1960 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
1961 snmp_config_status=$?
1963 if test $snmp_config_status -ne 0
1965 with_libnetsnmp="no ($with_snmp_config failed)"
1967 AC_CHECK_LIB(netsnmp, init_snmp,
1968 [with_libnetsnmp="yes"],
1969 [with_libnetsnmp="no (libnetsnmp not found)"],
1973 if test "x$with_libnetsnmp" = "xyes"
1975 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
1976 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
1977 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
1978 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
1980 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1983 # --with-liboconfig {{{
1984 with_own_liboconfig="no"
1985 liboconfig_LDFLAGS="$LDFLAGS"
1986 liboconfig_CPPFLAGS="$CPPFLAGS"
1987 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1989 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1991 if test -d "$withval/lib"
1993 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1995 if test -d "$withval/include"
1997 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
2000 if test "x$withval" = "xno"
2002 AC_MSG_ERROR("liboconfig is required")
2006 with_liboconfig="yes"
2009 save_LDFLAGS="$LDFLAGS"
2010 save_CPPFLAGS="$CPPFLAGS"
2011 LDFLAGS="$liboconfig_LDFLAGS"
2012 CPPFLAGS="$liboconfig_CPPFLAGS"
2013 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
2015 with_liboconfig="yes"
2016 with_own_liboconfig="no"
2019 with_liboconfig="yes"
2020 with_own_liboconfig="yes"
2021 LDFLAGS="$save_LDFLAGS"
2022 CPPFLAGS="$save_CPPFLAGS"
2025 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
2026 if test "x$with_own_liboconfig" = "xyes"
2028 with_liboconfig="yes (shipped version)"
2032 # --with-liboping {{{
2033 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
2035 if test "x$withval" = "xyes"
2038 else if test "x$withval" = "xno"
2043 LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
2044 LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
2047 [with_liboping="yes"])
2049 SAVE_CPPFLAGS="$CPPFLAGS"
2050 SAVE_LDFLAGS="$LDFLAGS"
2052 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
2053 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
2055 if test "x$with_liboping" = "xyes"
2057 if test "x$LIBOPING_CPPFLAGS" != "x"
2059 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
2061 AC_CHECK_HEADERS(oping.h,
2062 [with_liboping="yes"],
2063 [with_liboping="no ('oping.h' not found)"])
2065 if test "x$with_liboping" = "xyes"
2067 if test "x$LIBOPING_LDFLAGS" != "x"
2069 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
2071 AC_CHECK_LIB(oping, ping_construct,
2072 [with_liboping="yes"],
2073 [with_liboping="no (symbol 'ping_construct' not found)"])
2076 CPPFLAGS="$SAVE_CPPFLAGS"
2077 LDFLAGS="$SAVE_LDFLAGS"
2079 if test "x$with_liboping" = "xyes"
2081 BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
2082 BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
2083 AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
2084 AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
2086 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
2090 with_oracle_cppflags=""
2092 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
2094 if test "x$withval" = "xyes"
2096 if test "x$ORACLE_HOME" = "x"
2098 AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
2101 else if test "x$withval" = "xno"
2106 ORACLE_HOME="$withval"
2110 if test "x$ORACLE_HOME" = "x"
2112 with_oracle="no (ORACLE_HOME is not set)"
2117 if test "x$ORACLE_HOME" != "x"
2119 with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
2121 if test -e "$ORACLE_HOME/lib/ldflags"
2123 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
2125 #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
2126 with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
2128 if test "x$with_oracle" = "xyes"
2130 SAVE_CPPFLAGS="$CPPFLAGS"
2131 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2133 AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
2135 CPPFLAGS="$SAVE_CPPFLAGS"
2137 if test "x$with_oracle" = "xyes"
2139 SAVE_CPPFLAGS="$CPPFLAGS"
2140 SAVE_LDFLAGS="$LDFLAGS"
2141 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2142 LDFLAGS="$LDFLAGS $with_oracle_libs"
2144 AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
2146 CPPFLAGS="$SAVE_CPPFLAGS"
2147 LDFLAGS="$SAVE_LDFLAGS"
2149 if test "x$with_oracle" = "xyes"
2151 BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
2152 BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
2153 AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
2154 AC_SUBST(BUILD_WITH_ORACLE_LIBS)
2158 # --with-libowcapi {{{
2159 with_libowcapi_cppflags=""
2160 with_libowcapi_libs="-lowcapi"
2161 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
2163 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2165 with_libowcapi_cppflags="-I$withval/include"
2166 with_libowcapi_libs="-L$withval/lib -lowcapi"
2167 with_libowcapi="yes"
2169 with_libowcapi="$withval"
2173 with_libowcapi="yes"
2175 if test "x$with_libowcapi" = "xyes"
2177 SAVE_CPPFLAGS="$CPPFLAGS"
2178 CPPFLAGS="$with_libowcapi_cppflags"
2180 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
2182 CPPFLAGS="$SAVE_CPPFLAGS"
2184 if test "x$with_libowcapi" = "xyes"
2186 SAVE_LDFLAGS="$LDFLAGS"
2187 SAVE_CPPFLAGS="$CPPFLAGS"
2188 LDFLAGS="$with_libowcapi_libs"
2189 CPPFLAGS="$with_libowcapi_cppflags"
2191 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
2193 LDFLAGS="$SAVE_LDFLAGS"
2194 CPPFLAGS="$SAVE_CPPFLAGS"
2196 if test "x$with_libowcapi" = "xyes"
2198 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
2199 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
2200 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
2201 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
2205 # --with-libpcap {{{
2206 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
2208 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2210 LDFLAGS="$LDFLAGS -L$withval/lib"
2211 CPPFLAGS="$CPPFLAGS -I$withval/include"
2214 with_libpcap="$withval"
2220 if test "x$with_libpcap" = "xyes"
2222 AC_CHECK_LIB(pcap, pcap_open_live,
2224 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
2225 ], [with_libpcap="no (libpcap not found)"])
2227 if test "x$with_libpcap" = "xyes"
2229 AC_CHECK_HEADERS(pcap.h,
2231 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
2232 ], [with_libpcap="no (pcap.h not found)"])
2234 if test "x$with_libpcap" = "xyes"
2240 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
2241 [Wether or not to use the pcap library])
2242 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
2245 # --with-libperl {{{
2246 perl_interpreter="perl"
2247 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
2249 if test -x "$withval"
2251 perl_interpreter="$withval"
2253 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
2255 LDFLAGS="$LDFLAGS -L$withval/lib"
2256 CPPFLAGS="$CPPFLAGS -I$withval/include"
2257 perl_interpreter="$withval/bin/perl"
2260 with_libperl="$withval"
2267 AC_MSG_CHECKING([for perl])
2268 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
2269 if test -x "$perl_interpreter"
2271 AC_MSG_RESULT([yes ($perl_interpreter)])
2277 AC_SUBST(PERL, "$perl_interpreter")
2279 if test "x$with_libperl" = "xyes" \
2280 && test -n "$perl_interpreter"
2282 SAVE_CFLAGS="$CFLAGS"
2283 SAVE_LDFLAGS="$LDFLAGS"
2284 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
2285 PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
2286 PERL_LDFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
2287 CFLAGS="$CFLAGS $PERL_CFLAGS"
2288 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2290 AC_CACHE_CHECK([for libperl],
2291 [c_cv_have_libperl],
2295 #define PERL_NO_GET_CONTEXT
2302 load_module (PERL_LOADMOD_NOIMPORT,
2303 newSVpv ("Collectd::Plugin::FooBar", 24),
2306 [c_cv_have_libperl="yes"],
2307 [c_cv_have_libperl="no"]
2311 if test "x$c_cv_have_libperl" = "xyes"
2313 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
2314 AC_SUBST(PERL_CFLAGS)
2315 AC_SUBST(PERL_LDFLAGS)
2320 CFLAGS="$SAVE_CFLAGS"
2321 LDFLAGS="$SAVE_LDFLAGS"
2322 else if test -z "$perl_interpreter"; then
2323 with_libperl="no (no perl interpreter found)"
2324 c_cv_have_libperl="no"
2326 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
2328 if test "x$with_libperl" = "xyes"
2330 SAVE_CFLAGS="$CFLAGS"
2331 SAVE_LDFLAGS="$LDFLAGS"
2332 CFLAGS="$CFLAGS $PERL_CFLAGS"
2333 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2335 AC_CACHE_CHECK([if perl supports ithreads],
2336 [c_cv_have_perl_ithreads],
2344 #if !defined(USE_ITHREADS)
2345 # error "Perl does not support ithreads!"
2346 #endif /* !defined(USE_ITHREADS) */
2349 [c_cv_have_perl_ithreads="yes"],
2350 [c_cv_have_perl_ithreads="no"]
2354 if test "x$c_cv_have_perl_ithreads" = "xyes"
2356 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
2359 CFLAGS="$SAVE_CFLAGS"
2360 LDFLAGS="$SAVE_LDFLAGS"
2363 if test "x$with_libperl" = "xyes"
2365 SAVE_CFLAGS="$CFLAGS"
2366 SAVE_LDFLAGS="$LDFLAGS"
2367 # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
2368 # (see issues #41 and #42)
2369 CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
2370 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2372 AC_CACHE_CHECK([for broken Perl_load_module()],
2373 [c_cv_have_broken_perl_load_module],
2377 #define PERL_NO_GET_CONTEXT
2384 load_module (PERL_LOADMOD_NOIMPORT,
2385 newSVpv ("Collectd::Plugin::FooBar", 24),
2388 [c_cv_have_broken_perl_load_module="no"],
2389 [c_cv_have_broken_perl_load_module="yes"]
2393 CFLAGS="$SAVE_CFLAGS"
2394 LDFLAGS="$SAVE_LDFLAGS"
2396 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
2397 test "x$c_cv_have_broken_perl_load_module" = "xyes")
2399 if test "x$with_libperl" = "xyes"
2401 SAVE_CFLAGS="$CFLAGS"
2402 SAVE_LDFLAGS="$LDFLAGS"
2403 CFLAGS="$CFLAGS $PERL_CFLAGS"
2404 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2407 [struct mgvtbl.svt_local],
2408 [have_struct_mgvtbl_svt_local="yes"],
2409 [have_struct_mgvtbl_svt_local="no"],
2416 if test "x$have_struct_mgvtbl_svt_local" = "xyes"
2418 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
2419 [Define if Perl's struct mgvtbl has member svt_local.])
2422 CFLAGS="$SAVE_CFLAGS"
2423 LDFLAGS="$SAVE_LDFLAGS"
2428 with_pg_config="pg_config"
2429 with_libpq_includedir=""
2430 with_libpq_libdir=""
2431 with_libpq_cppflags=""
2432 with_libpq_ldflags=""
2433 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
2436 if test "x$withval" = "xno"
2439 else if test "x$withval" = "xyes"
2443 if test -f "$withval" && test -x "$withval";
2445 with_pg_config="$withval"
2446 else if test -x "$withval/bin/pg_config"
2448 with_pg_config="$withval/bin/pg_config"
2456 if test "x$with_libpq" = "xyes"
2458 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
2461 if test $pg_config_status -eq 0
2463 if test -n "$with_libpq_includedir"; then
2464 for dir in $with_libpq_includedir; do
2465 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
2469 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2472 SAVE_CPPFLAGS="$CPPFLAGS"
2473 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
2475 AC_CHECK_HEADERS(libpq-fe.h, [],
2476 [with_libpq="no (libpq-fe.h not found)"], [])
2478 CPPFLAGS="$SAVE_CPPFLAGS"
2480 if test "x$with_libpq" = "xyes"
2482 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
2485 if test $pg_config_status -eq 0
2487 if test -n "$with_libpq_libdir"; then
2488 for dir in $with_libpq_libdir; do
2489 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
2493 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2496 SAVE_LDFLAGS="$LDFLAGS"
2497 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
2499 AC_CHECK_LIB(pq, PQconnectdb,
2501 [with_libpq="no (symbol 'PQconnectdb' not found)"])
2503 AC_CHECK_LIB(pq, PQserverVersion,
2505 [with_libpq="no (symbol 'PQserverVersion' not found)"])
2507 LDFLAGS="$SAVE_LDFLAGS"
2509 if test "x$with_libpq" = "xyes"
2511 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
2512 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
2513 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
2514 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
2516 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
2519 # --with-libpthread {{{
2520 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
2521 [ if test "x$withval" != "xno" \
2522 && test "x$withval" != "xyes"
2524 LDFLAGS="$LDFLAGS -L$withval/lib"
2525 CPPFLAGS="$CPPFLAGS -I$withval/include"
2526 with_libpthread="yes"
2528 if test "x$withval" = "xno"
2530 with_libpthread="no (disabled)"
2533 ], [with_libpthread="yes"])
2534 if test "x$with_libpthread" = "xyes"
2536 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
2539 if test "x$with_libpthread" = "xyes"
2541 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
2543 if test "x$with_libpthread" = "xyes"
2549 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
2550 [Wether or not to use pthread (POSIX threads) library])
2551 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
2555 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
2558 librrd_threadsafe="yes"
2559 librrd_rrdc_update="no"
2560 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
2561 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
2563 librrd_cflags="-I$withval/include"
2564 librrd_ldflags="-L$withval/lib"
2567 with_librrd="$withval"
2569 ], [with_librrd="yes"])
2570 if test "x$with_librrd" = "xyes"
2572 SAVE_CPPFLAGS="$CPPFLAGS"
2573 SAVE_LDFLAGS="$LDFLAGS"
2575 CPPFLAGS="$CPPFLAGS $librrd_cflags"
2576 LDFLAGS="$LDFLAGS $librrd_ldflags"
2578 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
2580 CPPFLAGS="$SAVE_CPPFLAGS"
2581 LDFLAGS="$SAVE_LDFLAGS"
2583 if test "x$with_librrd" = "xyes"
2585 SAVE_CPPFLAGS="$CPPFLAGS"
2586 SAVE_LDFLAGS="$LDFLAGS"
2588 CPPFLAGS="$CPPFLAGS $librrd_cflags"
2589 LDFLAGS="$LDFLAGS $librrd_ldflags"
2591 AC_CHECK_LIB(rrd_th, rrd_update_r,
2593 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
2595 [librrd_threadsafe="no"
2596 AC_CHECK_LIB(rrd, rrd_update,
2598 librrd_ldflags="$librrd_ldflags -lrrd -lm"
2600 [with_librrd="no (symbol 'rrd_update' not found)"],
2605 if test "x$librrd_threadsafe" = "xyes"
2607 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
2609 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
2612 CPPFLAGS="$SAVE_CPPFLAGS"
2613 LDFLAGS="$SAVE_LDFLAGS"
2615 if test "x$with_librrd" = "xyes"
2617 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
2618 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
2619 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
2620 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
2622 if test "x$librrd_threadsafe" = "xyes"
2624 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
2628 # --with-libsensors {{{
2629 with_sensors_cflags=""
2630 with_sensors_ldflags=""
2631 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
2633 if test "x$withval" = "xno"
2635 with_libsensors="no"
2637 with_libsensors="yes"
2638 if test "x$withval" != "xyes"
2640 with_sensors_cflags="-I$withval/include"
2641 with_sensors_ldflags="-L$withval/lib"
2642 with_libsensors="yes"
2647 if test "x$ac_system" = "xLinux"
2649 with_libsensors="yes"
2651 with_libsensors="no (Linux only library)"
2654 if test "x$with_libsensors" = "xyes"
2656 SAVE_CPPFLAGS="$CPPFLAGS"
2657 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
2659 # AC_CHECK_HEADERS(sensors/sensors.h,
2661 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
2663 # [with_libsensors="no (sensors/sensors.h not found)"])
2664 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
2666 CPPFLAGS="$SAVE_CPPFLAGS"
2668 if test "x$with_libsensors" = "xyes"
2670 SAVE_CPPFLAGS="$CPPFLAGS"
2671 SAVE_LDFLAGS="$LDFLAGS"
2672 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
2673 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
2675 AC_CHECK_LIB(sensors, sensors_init,
2677 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
2679 [with_libsensors="no (libsensors not found)"])
2681 CPPFLAGS="$SAVE_CPPFLAGS"
2682 LDFLAGS="$SAVE_LDFLAGS"
2684 if test "x$with_libsensors" = "xyes"
2686 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
2687 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
2688 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
2689 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
2691 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
2694 # --with-libstatgrab {{{
2695 with_libstatgrab_cflags=""
2696 with_libstatgrab_ldflags=""
2697 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
2699 if test "x$withval" != "xno" \
2700 && test "x$withval" != "xyes"
2702 with_libstatgrab_cflags="-I$withval/include"
2703 with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
2704 with_libstatgrab="yes"
2705 with_libstatgrab_pkg_config="no"
2707 with_libstatgrab="$withval"
2708 with_libstatgrab_pkg_config="yes"
2712 with_libstatgrab="yes"
2713 with_libstatgrab_pkg_config="yes"
2716 if test "x$with_libstatgrab" = "xyes" \
2717 && test "x$with_libstatgrab_pkg_config" = "xyes"
2719 if test "x$PKG_CONFIG" != "x"
2721 AC_MSG_CHECKING([pkg-config for libstatgrab])
2723 $PKG_CONFIG --exists libstatgrab 2>/dev/null
2726 with_libstatgrab_pkg_config="no"
2727 with_libstatgrab="no ($PKG_CONFIG doesn't know libstatgrab)"
2728 temp_result="not found"
2730 AC_MSG_RESULT([$temp_result])
2732 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
2733 with_libstatgrab_pkg_config="no"
2734 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
2738 if test "x$with_libstatgrab" = "xyes" \
2739 && test "x$with_libstatgrab_pkg_config" = "xyes" \
2740 && test "x$with_libstatgrab_cflags" = "x"
2742 AC_MSG_CHECKING([for libstatgrab CFLAGS])
2743 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
2746 with_libstatgrab_cflags="$temp_result"
2748 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
2749 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
2751 AC_MSG_RESULT([$temp_result])
2754 if test "x$with_libstatgrab" = "xyes" \
2755 && test "x$with_libstatgrab_pkg_config" = "xyes" \
2756 && test "x$with_libstatgrab_ldflags" = "x"
2758 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
2759 temp_result="`$PKG_CONFIG --libs libstatgrab`"
2762 with_libstatgrab_ldflags="$temp_result"
2764 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
2765 temp_result="$PKG_CONFIG --libs libstatgrab failed"
2767 AC_MSG_RESULT([$temp_result])
2770 if test "x$with_libstatgrab" = "xyes"
2772 SAVE_CPPFLAGS="$CPPFLAGS"
2773 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
2775 AC_CHECK_HEADERS(statgrab.h,
2776 [with_libstatgrab="yes"],
2777 [with_libstatgrab="no (statgrab.h not found)"])
2779 CPPFLAGS="$SAVE_CPPFLAGS"
2782 if test "x$with_libstatgrab" = "xyes"
2784 SAVE_CFLAGS="$CFLAGS"
2785 SAVE_LDFLAGS="$LDFLAGS"
2787 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
2788 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
2790 AC_CHECK_LIB(statgrab, sg_init,
2791 [with_libstatgrab="yes"],
2792 [with_libstatgrab="no (symbol sg_init not found)"])
2794 CFLAGS="$SAVE_CFLAGS"
2795 LDFLAGS="$SAVE_LDFLAGS"
2798 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
2799 if test "x$with_libstatgrab" = "xyes"
2801 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
2802 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
2803 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
2804 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
2805 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
2809 # --with-libtokyotyrant {{{
2810 with_libtokyotyrant_cppflags=""
2811 with_libtokyotyrant_ldflags=""
2812 with_libtokyotyrant_libs=""
2813 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
2815 if test "x$withval" = "xno"
2817 with_libtokyotyrant="no"
2818 else if test "x$withval" = "xyes"
2820 with_libtokyotyrant="yes"
2822 with_libtokyotyrant_cppflags="-I$withval/include"
2823 with_libtokyotyrant_ldflags="-L$withval/include"
2824 with_libtokyotyrant_libs="-ltokyotyrant"
2825 with_libtokyotyrant="yes"
2829 with_libtokyotyrant="yes"
2832 if test "x$with_libtokyotyrant" = "xyes"
2834 if $PKG_CONFIG --exists tokyotyrant
2836 with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
2837 with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `pkg-config --libs-only-L tokyotyrant`"
2838 with_libtokyotyrant_libs="$with_libtokyotyrant_libs `pkg-config --libs-only-l tokyotyrant`"
2842 SAVE_CPPFLAGS="$CPPFLAGS"
2843 SAVE_LDFLAGS="$LDFLAGS"
2844 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
2845 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
2847 if test "x$with_libtokyotyrant" = "xyes"
2849 AC_CHECK_HEADERS(tcrdb.h,
2851 AC_DEFINE(HAVE_TCRDB_H, 1,
2852 [Define to 1 if you have the <tcrdb.h> header file.])
2853 ], [with_libtokyotyrant="no (tcrdb.h not found)"])
2856 if test "x$with_libtokyotyrant" = "xyes"
2858 AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
2860 AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
2861 [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
2863 [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
2864 [$with_libtokyotyrant_libs])
2867 CPPFLAGS="$SAVE_CPPFLAGS"
2868 LDFLAGS="$SAVE_LDFLAGS"
2870 if test "x$with_libtokyotyrant" = "xyes"
2872 BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
2873 BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
2874 BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
2875 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
2876 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
2877 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
2879 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
2882 # --with-libupsclient {{{
2883 with_libupsclient_config=""
2884 with_libupsclient_cflags=""
2885 with_libupsclient_libs=""
2886 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2888 if test "x$withval" = "xno"
2890 with_libupsclient="no"
2891 else if test "x$withval" = "xyes"
2893 with_libupsclient="use_pkgconfig"
2895 if test -x "$withval"
2897 with_libupsclient_config="$withval"
2898 with_libupsclient="use_libupsclient_config"
2899 else if test -x "$withval/bin/libupsclient-config"
2901 with_libupsclient_config="$withval/bin/net-snmp-config"
2902 with_libupsclient="use_libupsclient_config"
2904 AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
2905 with_libupsclient_cflags="-I$withval/include"
2906 with_libupsclient_libs="-L$withval/lib -lupsclient"
2907 with_libupsclient="yes"
2911 [with_libupsclient="use_pkgconfig"])
2913 # configure using libupsclient-config
2914 if test "x$with_libupsclient" = "xuse_libupsclient_config"
2916 AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
2917 with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
2920 with_libupsclient="no ($with_libupsclient_config failed)"
2922 with_libupsclient_libs="`$with_libupsclient_config --libs`"
2925 with_libupsclient="no ($with_libupsclient_config failed)"
2928 if test "x$with_libupsclient" = "xuse_libupsclient_config"
2930 with_libupsclient="yes"
2933 # configure using pkg-config
2934 if test "x$with_libupsclient" = "xuse_pkgconfig"
2936 if test "x$PKG_CONFIG" = "x"
2938 with_libupsclient="no (Don't have pkg-config)"
2941 if test "x$with_libupsclient" = "xuse_pkgconfig"
2943 AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
2944 $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
2947 with_libupsclient="no (pkg-config doesn't know library)"
2950 if test "x$with_libupsclient" = "xuse_pkgconfig"
2952 with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
2955 with_libupsclient="no ($PKG_CONFIG failed)"
2957 with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
2960 with_libupsclient="no ($PKG_CONFIG failed)"
2963 if test "x$with_libupsclient" = "xuse_pkgconfig"
2965 with_libupsclient="yes"
2968 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
2969 # the actual checks.
2970 if test "x$with_libupsclient" = "xyes"
2972 SAVE_CPPFLAGS="$CPPFLAGS"
2973 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
2975 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
2977 CPPFLAGS="$SAVE_CPPFLAGS"
2979 if test "x$with_libupsclient" = "xyes"
2981 SAVE_CPPFLAGS="$CPPFLAGS"
2982 SAVE_LDFLAGS="$LDFLAGS"
2984 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
2985 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
2987 AC_CHECK_LIB(upsclient, upscli_connect,
2988 [with_libupsclient="yes"],
2989 [with_libupsclient="no (symbol upscli_connect not found)"])
2991 CPPFLAGS="$SAVE_CPPFLAGS"
2992 LDFLAGS="$SAVE_LDFLAGS"
2994 if test "x$with_libupsclient" = "xyes"
2996 SAVE_CPPFLAGS="$CPPFLAGS"
2997 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
2999 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
3000 [#include <stdlib.h>
3002 #include <upsclient.h>])
3004 CPPFLAGS="$SAVE_CPPFLAGS"
3006 if test "x$with_libupsclient" = "xyes"
3008 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
3009 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
3010 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
3011 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
3015 # --with-libxmms {{{
3016 with_xmms_config="xmms-config"
3019 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
3021 if test "x$withval" != "xno" \
3022 && test "x$withval" != "xyes"
3024 if test -f "$withval" && test -x "$withval";
3026 with_xmms_config="$withval"
3027 else if test -x "$withval/bin/xmms-config"
3029 with_xmms_config="$withval/bin/xmms-config"
3032 else if test "x$withval" = "xno"
3042 if test "x$with_libxmms" = "xyes"
3044 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
3045 xmms_config_status=$?
3047 if test $xmms_config_status -ne 0
3052 if test "x$with_libxmms" = "xyes"
3054 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
3055 xmms_config_status=$?
3057 if test $xmms_config_status -ne 0
3062 if test "x$with_libxmms" = "xyes"
3064 AC_CHECK_LIB(xmms, xmms_remote_get_info,
3066 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
3067 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
3068 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
3069 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
3076 with_libxmms_numeric=0
3077 if test "x$with_libxmms" = "xyes"
3079 with_libxmms_numeric=1
3081 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
3082 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
3085 # --with-libyajl {{{
3086 with_libyajl_cppflags=""
3087 with_libyajl_ldflags=""
3088 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
3090 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3092 with_libyajl_cppflags="-I$withval/include"
3093 with_libyajl_ldflags="-L$withval/lib"
3096 with_libyajl="$withval"
3102 if test "x$with_libyajl" = "xyes"
3104 SAVE_CPPFLAGS="$CPPFLAGS"
3105 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3107 AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
3109 CPPFLAGS="$SAVE_CPPFLAGS"
3111 if test "x$with_libyajl" = "xyes"
3113 SAVE_CPPFLAGS="$CPPFLAGS"
3114 SAVE_LDFLAGS="$LDFLAGS"
3115 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3116 LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
3118 AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
3120 CPPFLAGS="$SAVE_CPPFLAGS"
3121 LDFLAGS="$SAVE_LDFLAGS"
3123 if test "x$with_libyajl" = "xyes"
3125 BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
3126 BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
3127 BUILD_WITH_LIBYAJL_LIBS="-lyajl"
3128 AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
3129 AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
3130 AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
3131 AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
3133 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
3136 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
3137 with_libxml2="no (pkg-config isn't available)"
3138 with_libxml2_cflags=""
3139 with_libxml2_ldflags=""
3140 with_libvirt="no (pkg-config isn't available)"
3141 with_libvirt_cflags=""
3142 with_libvirt_ldflags=""
3143 if test "x$PKG_CONFIG" != "x"
3145 pkg-config --exists 'libxml-2.0' 2>/dev/null
3150 with_libxml2="no (pkg-config doesn't know library)"
3153 pkg-config --exists libvirt 2>/dev/null
3158 with_libvirt="no (pkg-config doesn't know library)"
3161 if test "x$with_libxml2" = "xyes"
3163 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
3168 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
3174 if test "x$with_libxml2" = "xyes"
3176 SAVE_CPPFLAGS="$CPPFLAGS"
3177 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
3179 AC_CHECK_HEADERS(libxml/parser.h, [],
3180 [with_libxml2="no (libxml/parser.h not found)"])
3182 CPPFLAGS="$SAVE_CPPFLAGS"
3184 if test "x$with_libxml2" = "xyes"
3186 SAVE_CFLAGS="$CFLAGS"
3187 SAVE_LDFLAGS="$LDFLAGS"
3189 CFLAGS="$CFLAGS $with_libxml2_cflags"
3190 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
3192 AC_CHECK_LIB(xml2, xmlXPathEval,
3193 [with_libxml2="yes"],
3194 [with_libxml2="no (symbol xmlXPathEval not found)"])
3196 CFLAGS="$SAVE_CFLAGS"
3197 LDFLAGS="$SAVE_LDFLAGS"
3199 dnl Add the right compiler flags and libraries.
3200 if test "x$with_libxml2" = "xyes"; then
3201 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
3202 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
3203 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
3204 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
3206 if test "x$with_libvirt" = "xyes"
3208 with_libvirt_cflags="`pkg-config --cflags libvirt`"
3213 with_libvirt_ldflags="`pkg-config --libs libvirt`"
3219 if test "x$with_libvirt" = "xyes"
3221 SAVE_CPPFLAGS="$CPPFLAGS"
3222 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
3224 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
3225 [with_libvirt="no (libvirt/libvirt.h not found)"])
3227 CPPFLAGS="$SAVE_CPPFLAGS"
3229 if test "x$with_libvirt" = "xyes"
3231 SAVE_CFLAGS="$CFLAGS"
3232 SAVE_LDFLAGS="$LDFLAGS"
3234 CFLAGS="$CFLAGS $with_libvirt_cflags"
3235 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
3237 AC_CHECK_LIB(virt, virDomainBlockStats,
3238 [with_libvirt="yes"],
3239 [with_libvirt="no (symbol virDomainBlockStats not found)"])
3241 CFLAGS="$SAVE_CFLAGS"
3242 LDFLAGS="$SAVE_LDFLAGS"
3244 dnl Add the right compiler flags and libraries.
3245 if test "x$with_libvirt" = "xyes"; then
3246 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
3247 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
3248 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
3249 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
3253 # $PKG_CONFIG --exists OpenIPMIpthread {{{
3254 with_libopenipmipthread="yes"
3255 with_libopenipmipthread_cflags=""
3256 with_libopenipmipthread_libs=""
3258 AC_MSG_CHECKING([for pkg-config])
3260 if test "x$PKG_CONFIG" = "x"
3262 with_libopenipmipthread="no"
3265 temp_result="$PKG_CONFIG"
3267 AC_MSG_RESULT([$temp_result])
3269 if test "x$with_libopenipmipthread" = "xyes"
3271 AC_MSG_CHECKING([for libOpenIPMIpthread])
3272 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
3275 with_libopenipmipthread="no ($PKG_CONFIG doesn't know OpenIPMIpthread)"
3277 AC_MSG_RESULT([$with_libopenipmipthread])
3280 if test "x$with_libopenipmipthread" = "xyes"
3282 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
3283 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
3286 with_libopenipmipthread_cflags="$temp_result"
3288 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
3289 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
3291 AC_MSG_RESULT([$temp_result])
3294 if test "x$with_libopenipmipthread" = "xyes"
3296 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
3297 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
3300 with_libopenipmipthread_ldflags="$temp_result"
3302 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
3303 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
3305 AC_MSG_RESULT([$temp_result])
3308 if test "x$with_libopenipmipthread" = "xyes"
3310 SAVE_CPPFLAGS="$CPPFLAGS"
3311 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
3313 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
3314 [with_libopenipmipthread="yes"],
3315 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
3316 [#include <OpenIPMI/ipmiif.h>
3317 #include <OpenIPMI/ipmi_err.h>
3318 #include <OpenIPMI/ipmi_posix.h>
3319 #include <OpenIPMI/ipmi_conn.h>
3322 CPPFLAGS="$SAVE_CPPFLAGS"
3325 if test "x$with_libopenipmipthread" = "xyes"
3327 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
3328 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
3329 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
3330 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
3334 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
3335 [with_libnotify="yes"],
3336 [with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"])
3338 # Check for enabled/disabled features
3341 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
3342 # ------------------------------------------------------------
3344 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
3349 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
3354 m4_define([EnDis],[disabled])dnl
3355 m4_define([YesNo],[no])dnl
3361 m4_define([EnDis],[enabled])dnl
3362 m4_define([YesNo],[yes])dnl
3365 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
3369 m4_if([$3], [feature], [],
3373 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
3379 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
3381 enable_$1='[YesNo]'dnl
3383 if test "x$enable_$1" = "xno"
3387 if test "x$enable_$1" = "xyes"
3391 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
3396 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
3397 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
3399 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
3401 # AC_PLUGIN(name, default, info)
3402 # ------------------------------------------------------------
3409 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
3411 if test "x$enableval" = "xyes"
3414 else if test "x$enableval" = "xforce"
3423 if test "x$enable_all_plugins" = "xauto"
3425 if test "x$2" = "xyes"
3432 enable_plugin="$enable_all_plugins"
3435 if test "x$enable_plugin" = "xyes"
3437 if test "x$2" = "xyes" || test "x$force" = "xyes"
3439 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
3440 if test "x$2" != "xyes"
3442 dependency_warning="yes"
3444 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
3445 dependency_error="yes"
3446 enable_plugin="no (dependency error)"
3449 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
3450 enable_$1="$enable_plugin"
3452 )# AC_PLUGIN(name, default, info)
3454 m4_divert_once([HELP_ENABLE], [
3455 collectd features:])
3456 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
3457 AC_COLLECTD([debug], [enable], [feature], [debugging])
3458 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
3459 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
3461 dependency_warning="no"
3462 dependency_error="no"
3467 plugin_conntrack="no"
3470 plugin_curl_json="no"
3474 plugin_interface="no"
3481 plugin_multimeter="no"
3485 plugin_processes="no"
3486 plugin_protocols="no"
3490 plugin_tcpconns="no"
3497 plugin_wireless="no"
3501 if test "x$ac_system" = "xLinux"
3503 plugin_battery="yes"
3504 plugin_conntrack="yes"
3506 plugin_cpufreq="yes"
3508 plugin_entropy="yes"
3509 plugin_interface="yes"
3514 plugin_fscache="yes"
3515 plugin_processes="yes"
3516 plugin_protocols="yes"
3519 plugin_tcpconns="yes"
3520 plugin_thermal="yes"
3523 plugin_vserver="yes"
3524 plugin_wireless="yes"
3526 if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
3532 if test "x$ac_system" = "xOpenBSD"
3534 plugin_tcpconns="yes"
3538 if test "x$with_libiokit" = "xyes"
3540 plugin_battery="yes"
3545 if test "x$with_kstat" = "xyes"
3548 plugin_zfs_arc="yes"
3551 if test "x$with_devinfo$with_kstat" = "xyesyes"
3555 plugin_interface="yes"
3560 if test "x$have_sys_swap_h$with_kstat$ac_system" = "xyesyesSolaris"
3566 if test "x$with_libstatgrab" = "xyes"
3570 plugin_interface="yes"
3577 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
3583 if test "x$with_libopenipmipthread" = "xyes"
3588 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
3590 plugin_curl_json="yes"
3593 if test "x$have_processor_info" = "xyes"
3597 if test "x$have_sysctl" = "xyes"
3604 if test "x$have_sysctlbyname" = "xyes"
3608 plugin_tcpconns="yes"
3611 # Df plugin: Check if we know how to determine mount points first.
3612 #if test "x$have_listmntent" = "xyes"; then
3615 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
3619 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
3623 #if test "x$have_getmntent" = "xseq"
3627 if test "x$c_cv_have_one_getmntent" = "xyes"
3632 # Df plugin: Check if we have either `statfs' or `statvfs' second.
3633 if test "x$plugin_df" = "xyes"
3636 if test "x$have_statfs" = "xyes"
3640 if test "x$have_statvfs" = "xyes"
3646 if test "x$have_getifaddrs" = "xyes"
3648 plugin_interface="yes"
3651 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
3653 plugin_libvirt="yes"
3656 if test "x$have_getloadavg" = "xyes"
3661 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
3666 # Mac OS X memory interface
3667 if test "x$have_host_statistics" = "xyes"
3672 if test "x$have_termios_h" = "xyes"
3674 plugin_multimeter="yes"
3678 if test "x$have_thread_info" = "xyes"
3680 plugin_processes="yes"
3683 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
3685 plugin_processes="yes"
3688 if test "x$with_kvm_getswapinfo" = "xyes"
3693 if test "x$have_swapctl" = "xyes"
3698 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
3700 plugin_tcpconns="yes"
3703 if test "x$have_getutent" = "xyes"
3707 if test "x$have_getutxent" = "xyes"
3712 m4_divert_once([HELP_ENABLE], [
3715 AC_ARG_ENABLE([all-plugins],
3716 AC_HELP_STRING([--enable-all-plugins],
3717 [enable all plugins (auto by def)]),
3719 if test "x$enableval" = "xyes"
3721 enable_all_plugins="yes"
3722 else if test "x$enableval" = "xauto"
3724 enable_all_plugins="auto"
3726 enable_all_plugins="no"
3729 [enable_all_plugins="auto"])
3731 m4_divert_once([HELP_ENABLE], [])
3733 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
3734 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
3735 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
3736 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
3737 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
3738 AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
3739 AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics])
3740 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
3741 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
3742 AC_PLUGIN([csv], [yes], [CSV output plugin])
3743 AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics])
3744 AC_PLUGIN([curl_json], [$plugin_curl_json], [CouchDB statistics])
3745 AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
3746 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
3747 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
3748 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
3749 AC_PLUGIN([email], [yes], [EMail statistics])
3750 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
3751 AC_PLUGIN([exec], [yes], [Execution of external programs])
3752 AC_PLUGIN([filecount], [yes], [Count files in directories])
3753 AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics])
3754 AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin])
3755 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
3756 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
3757 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
3758 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
3759 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
3760 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
3761 AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine])
3762 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
3763 AC_PLUGIN([load], [$plugin_load], [System load])
3764 AC_PLUGIN([logfile], [yes], [File logging plugin])
3765 AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics])
3766 AC_PLUGIN([match_empty_counter], [yes], [The empty counter match])
3767 AC_PLUGIN([match_regex], [yes], [The regex match])
3768 AC_PLUGIN([match_timediff], [yes], [The timediff match])
3769 AC_PLUGIN([match_value], [yes], [The value match])
3770 AC_PLUGIN([mbmon], [yes], [Query mbmond])
3771 AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics])
3772 AC_PLUGIN([memcached], [yes], [memcached statistics])
3773 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
3774 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
3775 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
3776 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
3777 AC_PLUGIN([network], [yes], [Network communication plugin])
3778 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
3779 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
3780 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
3781 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
3782 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
3783 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
3784 AC_PLUGIN([olsrd], [yes], [olsrd statistics])
3785 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
3786 AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics])
3787 AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
3788 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
3789 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
3790 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
3791 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
3792 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
3793 AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics])
3794 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
3795 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
3796 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
3797 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
3798 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
3799 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
3800 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
3801 AC_PLUGIN([table], [yes], [Parsing of tabular data])
3802 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
3803 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
3804 AC_PLUGIN([target_notification], [yes], [The notification target])
3805 AC_PLUGIN([target_replace], [yes], [The replace target])
3806 AC_PLUGIN([target_set], [yes], [The set target])
3807 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
3808 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
3809 AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values])
3810 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
3811 AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant], [TokyoTyrant database statistics])
3812 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
3813 AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics])
3814 AC_PLUGIN([users], [$plugin_users], [User statistics])
3815 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
3816 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
3817 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
3818 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
3819 AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin])
3820 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
3821 AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics])
3823 dnl Default configuration file
3824 # Load either syslog or logfile
3825 LOAD_PLUGIN_SYSLOG=""
3826 LOAD_PLUGIN_LOGFILE=""
3828 AC_MSG_CHECKING([which default log plugin to load])
3829 default_log_plugin="none"
3830 if test "x$enable_syslog" = "xyes"
3832 default_log_plugin="syslog"
3834 LOAD_PLUGIN_SYSLOG="##"
3837 if test "x$enable_logfile" = "xyes"
3839 if test "x$default_log_plugin" = "xnone"
3841 default_log_plugin="logfile"
3843 LOAD_PLUGIN_LOGFILE="#"
3846 LOAD_PLUGIN_LOGFILE="##"
3848 AC_MSG_RESULT([$default_log_plugin])
3850 AC_SUBST(LOAD_PLUGIN_SYSLOG)
3851 AC_SUBST(LOAD_PLUGIN_LOGFILE)
3853 DEFAULT_LOG_LEVEL="info"
3854 if test "x$enable_debug" = "xyes"
3856 DEFAULT_LOG_LEVEL="debug"
3858 AC_SUBST(DEFAULT_LOG_LEVEL)
3860 # Load only one of rrdtool, network, csv in the default config.
3861 LOAD_PLUGIN_RRDTOOL=""
3862 LOAD_PLUGIN_NETWORK=""
3865 AC_MSG_CHECKING([which default write plugin to load])
3866 default_write_plugin="none"
3867 if test "x$enable_rrdtool" = "xyes"
3869 default_write_plugin="rrdtool"
3871 LOAD_PLUGIN_RRDTOOL="##"
3874 if test "x$enable_network" = "xyes"
3876 if test "x$default_write_plugin" = "xnone"
3878 default_write_plugin="network"
3880 LOAD_PLUGIN_NETWORK="#"
3883 LOAD_PLUGIN_NETWORK="##"
3886 if test "x$enable_csv" = "xyes"
3888 if test "x$default_write_plugin" = "xnone"
3890 default_write_plugin="csv"
3895 LOAD_PLUGIN_CSV="##"
3897 AC_MSG_RESULT([$default_write_plugin])
3899 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
3900 AC_SUBST(LOAD_PLUGIN_NETWORK)
3901 AC_SUBST(LOAD_PLUGIN_CSV)
3904 if test "x$ac_system" = "xLinux" \
3905 && test "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
3907 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
3911 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
3913 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3915 PERL_BINDINGS_OPTIONS="$withval"
3916 with_perl_bindings="yes"
3918 PERL_BINDINGS_OPTIONS=""
3919 with_perl_bindings="$withval"
3923 PERL_BINDINGS_OPTIONS=""
3924 if test -n "$perl_interpreter"
3926 with_perl_bindings="yes"
3928 with_perl_bindings="no (no perl interpreter found)"
3931 if test "x$with_perl_bindings" = "xyes"
3933 PERL_BINDINGS="perl"
3937 AC_SUBST(PERL_BINDINGS)
3938 AC_SUBST(PERL_BINDINGS_OPTIONS)
3940 dnl libcollectdclient
3941 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
3942 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
3943 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
3945 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
3947 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
3949 AC_SUBST(LCC_VERSION_MAJOR)
3950 AC_SUBST(LCC_VERSION_MINOR)
3951 AC_SUBST(LCC_VERSION_PATCH)
3952 AC_SUBST(LCC_VERSION_EXTRA)
3953 AC_SUBST(LCC_VERSION_STRING)
3955 AC_CONFIG_FILES(src/libcollectdclient/lcc_features.h)
3957 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/owniptc/Makefile src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile)
3959 if test "x$with_librrd" = "xyes" \
3960 && test "x$librrd_threadsafe" != "xyes"
3962 with_librrd="yes (warning: librrd is not thread-safe)"
3965 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" = "xyes"
3967 with_libiptc="yes (shipped version)"
3970 if test "x$with_libperl" = "xyes"
3972 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
3974 enable_perl="no (needs libperl)"
3977 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
3979 enable_perl="no (libperl doesn't support ithreads)"
3982 if test "x$with_perl_bindings" = "xyes" \
3983 && test "x$PERL_BINDINGS_OPTIONS" != "x"
3985 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
3992 libcurl . . . . . . . $with_libcurl
3993 libdbi . . . . . . . $with_libdbi
3994 libesmtp . . . . . . $with_libesmtp
3995 libganglia . . . . . $with_libganglia
3996 libgcrypt . . . . . . $with_libgcrypt
3997 libiokit . . . . . . $with_libiokit
3998 libiptc . . . . . . . $with_libiptc
3999 libjvm . . . . . . . $with_java
4000 libkstat . . . . . . $with_kstat
4001 libkvm . . . . . . . $with_libkvm
4002 libmemcached . . . . $with_libmemcached
4003 libmysql . . . . . . $with_libmysql
4004 libnetlink . . . . . $with_libnetlink
4005 libnetsnmp . . . . . $with_libnetsnmp
4006 libnotify . . . . . . $with_libnotify
4007 liboconfig . . . . . $with_liboconfig
4008 libopenipmi . . . . . $with_libopenipmipthread
4009 liboping . . . . . . $with_liboping
4010 libpcap . . . . . . . $with_libpcap
4011 libperl . . . . . . . $with_libperl
4012 libpq . . . . . . . . $with_libpq
4013 libpthread . . . . . $with_libpthread
4014 librrd . . . . . . . $with_librrd
4015 libsensors . . . . . $with_libsensors
4016 libstatgrab . . . . . $with_libstatgrab
4017 libtokyotyrant . . . $with_libtokyotyrant
4018 libupsclient . . . . $with_libupsclient
4019 libvirt . . . . . . . $with_libvirt
4020 libxml2 . . . . . . . $with_libxml2
4021 libxmms . . . . . . . $with_libxmms
4022 libyajl . . . . . . . $with_libyajl
4023 oracle . . . . . . . $with_oracle
4026 daemon mode . . . . . $enable_daemon
4027 debug . . . . . . . . $enable_debug
4030 perl . . . . . . . . $with_perl_bindings
4033 apache . . . . . . . $enable_apache
4034 apcups . . . . . . . $enable_apcups
4035 apple_sensors . . . . $enable_apple_sensors
4036 ascent . . . . . . . $enable_ascent
4037 battery . . . . . . . $enable_battery
4038 bind . . . . . . . . $enable_bind
4039 conntrack . . . . . . $enable_conntrack
4040 cpu . . . . . . . . . $enable_cpu
4041 cpufreq . . . . . . . $enable_cpufreq
4042 csv . . . . . . . . . $enable_csv
4043 curl . . . . . . . . $enable_curl
4044 curl_json . . . . . . $enable_curl_json
4045 dbi . . . . . . . . . $enable_dbi
4046 df . . . . . . . . . $enable_df
4047 disk . . . . . . . . $enable_disk
4048 dns . . . . . . . . . $enable_dns
4049 email . . . . . . . . $enable_email
4050 entropy . . . . . . . $enable_entropy
4051 exec . . . . . . . . $enable_exec
4052 filecount . . . . . . $enable_filecount
4053 fscache . . . . . . . $enable_fscache
4054 gmond . . . . . . . . $enable_gmond
4055 hddtemp . . . . . . . $enable_hddtemp
4056 interface . . . . . . $enable_interface
4057 ipmi . . . . . . . . $enable_ipmi
4058 iptables . . . . . . $enable_iptables
4059 ipvs . . . . . . . . $enable_ipvs
4060 irq . . . . . . . . . $enable_irq
4061 java . . . . . . . . $enable_java
4062 libvirt . . . . . . . $enable_libvirt
4063 load . . . . . . . . $enable_load
4064 logfile . . . . . . . $enable_logfile
4065 madwifi . . . . . . . $enable_madwifi
4066 match_empty_counter . $enable_match_empty_counter
4067 match_regex . . . . . $enable_match_regex
4068 match_timediff . . . $enable_match_timediff
4069 match_value . . . . . $enable_match_value
4070 mbmon . . . . . . . . $enable_mbmon
4071 memcachec . . . . . . $enable_memcachec
4072 memcached . . . . . . $enable_memcached
4073 memory . . . . . . . $enable_memory
4074 multimeter . . . . . $enable_multimeter
4075 mysql . . . . . . . . $enable_mysql
4076 netlink . . . . . . . $enable_netlink
4077 network . . . . . . . $enable_network
4078 nfs . . . . . . . . . $enable_nfs
4079 nginx . . . . . . . . $enable_nginx
4080 notify_desktop . . . $enable_notify_desktop
4081 notify_email . . . . $enable_notify_email
4082 ntpd . . . . . . . . $enable_ntpd
4083 nut . . . . . . . . . $enable_nut
4084 olsrd . . . . . . . . $enable_olsrd
4085 onewire . . . . . . . $enable_onewire
4086 openvpn . . . . . . . $enable_openvpn
4087 oracle . . . . . . . $enable_oracle
4088 perl . . . . . . . . $enable_perl
4089 ping . . . . . . . . $enable_ping
4090 postgresql . . . . . $enable_postgresql
4091 powerdns . . . . . . $enable_powerdns
4092 processes . . . . . . $enable_processes
4093 protocols . . . . . . $enable_protocols
4094 rrdcached . . . . . . $enable_rrdcached
4095 rrdtool . . . . . . . $enable_rrdtool
4096 sensors . . . . . . . $enable_sensors
4097 serial . . . . . . . $enable_serial
4098 snmp . . . . . . . . $enable_snmp
4099 swap . . . . . . . . $enable_swap
4100 syslog . . . . . . . $enable_syslog
4101 table . . . . . . . . $enable_table
4102 tail . . . . . . . . $enable_tail
4103 tape . . . . . . . . $enable_tape
4104 target_notification . $enable_target_notification
4105 target_replace . . . $enable_target_replace
4106 target_set . . . . . $enable_target_set
4107 tcpconns . . . . . . $enable_tcpconns
4108 teamspeak2 . . . . . $enable_teamspeak2
4109 ted . . . . . . . . . $enable_ted
4110 thermal . . . . . . . $enable_thermal
4111 tokyotyrant . . . . . $enable_tokyotyrant
4112 unixsock . . . . . . $enable_unixsock
4113 uptime . . . . . . . $enable_uptime
4114 users . . . . . . . . $enable_users
4115 uuid . . . . . . . . $enable_uuid
4116 vmem . . . . . . . . $enable_vmem
4117 vserver . . . . . . . $enable_vserver
4118 wireless . . . . . . $enable_wireless
4119 write_http . . . . . $enable_write_http
4120 xmms . . . . . . . . $enable_xmms
4121 zfs_arc . . . . . . . $enable_zfs_arc
4125 if test "x$dependency_error" = "xyes"; then
4126 AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
4129 if test "x$dependency_warning" = "xyes"; then
4130 AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
4133 # vim: set fdm=marker :